@@ -25,7 +25,7 @@ public class MapboxAccess : IFileSource
2525 public delegate void TokenValidationEvent ( MapboxTokenStatus response ) ;
2626 public event TokenValidationEvent OnTokenValidation ;
2727
28- static MapboxAccess _instance ;
28+ private static MapboxAccess _instance ;
2929
3030 /// <summary>
3131 /// The singleton instance.
@@ -43,7 +43,10 @@ public static MapboxAccess Instance
4343 }
4444
4545
46- MapboxConfiguration _configuration ;
46+ public static bool Configured ;
47+ public static string ConfigurationJSON ;
48+ private MapboxConfiguration _configuration ;
49+
4750 /// <summary>
4851 /// The Mapbox API access token.
4952 /// </summary>
@@ -89,6 +92,8 @@ public void SetConfiguration(MapboxConfiguration configuration, bool throwExecpt
8992
9093 ConfigureFileSource ( ) ;
9194 ConfigureTelemetry ( ) ;
95+
96+ Configured = true ;
9297 }
9398
9499
@@ -142,12 +147,16 @@ public void ClearAllCacheFiles()
142147 private void LoadAccessToken ( )
143148 {
144149
145- TextAsset configurationTextAsset = Resources . Load < TextAsset > ( Constants . Path . MAPBOX_RESOURCES_RELATIVE ) ;
150+ if ( string . IsNullOrEmpty ( ConfigurationJSON ) )
151+ {
152+ TextAsset configurationTextAsset = Resources . Load < TextAsset > ( Constants . Path . MAPBOX_RESOURCES_RELATIVE ) ;
153+ ConfigurationJSON = configurationTextAsset . text ;
154+ }
146155
147156#if ! WINDOWS_UWP
148- SetConfiguration ( configurationTextAsset == null ? null : JsonUtility . FromJson < MapboxConfiguration > ( configurationTextAsset . text ) ) ;
157+ SetConfiguration ( ConfigurationJSON == null ? null : JsonUtility . FromJson < MapboxConfiguration > ( ConfigurationJSON ) ) ;
149158#else
150- SetConfiguration ( configurationTextAsset == null ? null : Mapbox . Json . JsonConvert . DeserializeObject < MapboxConfiguration > ( configurationTextAsset . text ) ) ;
159+ SetConfiguration ( ConfigurationJSON == null ? null : Mapbox . Json . JsonConvert . DeserializeObject < MapboxConfiguration > ( ConfigurationJSON ) ) ;
151160#endif
152161 }
153162
0 commit comments