@@ -242,18 +242,24 @@ export class MapboxView extends MapboxViewBase {
242242 public onLoaded ( ) {
243243 super . onLoaded ( ) ;
244244 if ( Trace . isEnabled ( ) ) {
245- CLog ( CLogTypes . info , 'onLoaded()' ) ;
245+ CLog ( CLogTypes . info , 'onLoaded()' , this ) ;
246246 }
247247
248248 if ( ! this . initialized ) {
249249 this . initMap ( ) ;
250250 this . initialized = true ;
251251 }
252252 }
253+ public onUnloaded ( ) {
254+ super . onUnloaded ( ) ;
255+ if ( Trace . isEnabled ( ) ) {
256+ CLog ( CLogTypes . info , 'onUnloaded()' , this ) ;
257+ }
258+ }
253259
254260 public initNativeView ( ) : void {
255261 if ( Trace . isEnabled ( ) ) {
256- CLog ( CLogTypes . info , 'initNativeView(): top' ) ;
262+ CLog ( CLogTypes . info , 'initNativeView(): top' , this ) ;
257263 }
258264 this . nativeView . owner = this ;
259265 // Application.android.on(AndroidApplication.activityStartedEvent, this.onStart, this);
@@ -274,15 +280,15 @@ export class MapboxView extends MapboxViewBase {
274280 * @link https://docs.nativescript.org/plugins/ui-plugin-custom
275281 */
276282 disposeNativeView ( ) {
283+ super . disposeNativeView ( ) ;
277284 if ( Trace . isEnabled ( ) ) {
278- CLog ( CLogTypes . info , 'disposeNativeView(): top' ) ;
285+ CLog ( CLogTypes . info , 'disposeNativeView(): top' , this ) ;
279286 }
280287
281288 this . nativeView . owner = null ;
282289
283290 this . mapbox ?. destroy ( ) ;
284291 this . mapbox = null ;
285- super . disposeNativeView ( ) ;
286292 }
287293
288294 /**
@@ -612,7 +618,7 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
612618 logoPlugin . setPosition ( Mapbox . mapPositionToGravity ( settings . logoPosition ) ) ;
613619
614620 if ( Trace . isEnabled ( ) ) {
615- CLog ( CLogTypes . info , 'show(): onMapReady() with instance:' , this . _mapboxMapInstance ) ;
621+ CLog ( CLogTypes . info , 'show(): onMapReady() with instance:' , this . _mapboxMapInstance , this . _mapboxViewInstance ) ;
616622 }
617623
618624 // Android SDK 7.0.0 and on requires that the style be set separately after the map
@@ -807,16 +813,11 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
807813 }
808814 }
809815
810- /**
811- * destroy the map programmatically
812- *
813- * Destroy the map instance.
814- */
815- clear ( nativeMap ?: any ) {
816+ async destroy ( nativeMap ?: any ) {
816817 this . clearEventListeners ( ) ;
817818 this . _markerIconDownloadCache = { } ;
818819 if ( Trace . isEnabled ( ) ) {
819- CLog ( CLogTypes . info , 'destroy(): destroying mapbox view.' ) ;
820+ CLog ( CLogTypes . info , 'destroy(): destroying mapbox view.' , this . view , this . _mapboxViewInstance ) ;
820821 }
821822
822823 if ( this . lineManager ) {
@@ -860,7 +861,7 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
860861 const viewGroup = this . _mapboxViewInstance . getParent ( ) as android . view . ViewGroup ;
861862 if ( viewGroup !== null ) {
862863 if ( Trace . isEnabled ( ) ) {
863- CLog ( CLogTypes . info , 'destroy(): removing _mapboxViewInstance view.' ) ;
864+ CLog ( CLogTypes . info , 'destroy(): removing _mapboxViewInstance view.' , this . _mapboxViewInstance ) ;
864865 }
865866 viewGroup . removeView ( this . _mapboxViewInstance ) ;
866867 }
@@ -877,9 +878,6 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
877878 this . _mapboxMapInstance = null ;
878879 }
879880 }
880- async destroy ( nativeMap ?: any ) {
881- this . clear ( ) ;
882- }
883881
884882 // private enableUserLocationPlugin() {
885883 // if (!this.map) {
@@ -1016,35 +1014,13 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
10161014 this . _mapboxViewInstance . onStart ( ) ;
10171015 }
10181016
1019- // async onResume(nativeMapViewInstance?: any) {
1020- // if (Trace.isEnabled()) {
1021- // CLog(CLogTypes.info, 'onResume()');
1022- // }
1023- // this._mapboxViewInstance.onResume();
1024- // }
1025-
1026- // async onPause(nativeMapViewInstance?: any) {
1027- // if (Trace.isEnabled()) {
1028- // CLog(CLogTypes.info, 'onPause()');
1029- // }
1030-
1031- // this._mapboxViewInstance.onPause();
1032- // }
1033-
10341017 async onStop ( nativeMap ?: any ) {
10351018 if ( Trace . isEnabled ( ) ) {
10361019 CLog ( CLogTypes . info , 'onStop()' ) ;
10371020 }
10381021 this . _mapboxViewInstance . onStop ( ) ;
10391022 }
10401023
1041- // async onLowMemory(nativeMap?: any) {
1042- // if (Trace.isEnabled()) {
1043- // CLog(CLogTypes.info, 'onLowMemory()');
1044- // }
1045- // this._mapboxViewInstance.onLowMemory();
1046- // }
1047-
10481024 async onDestroy ( nativeMap ?: any ) {
10491025 if ( Trace . isEnabled ( ) ) {
10501026 CLog ( CLogTypes . info , 'onDestroy()' ) ;
0 commit comments