@@ -25,7 +25,7 @@ public class MapboxAccess : IFileSource
25
25
public delegate void TokenValidationEvent ( MapboxTokenStatus response ) ;
26
26
public event TokenValidationEvent OnTokenValidation ;
27
27
28
- static MapboxAccess _instance ;
28
+ private static MapboxAccess _instance ;
29
29
30
30
/// <summary>
31
31
/// The singleton instance.
@@ -43,7 +43,10 @@ public static MapboxAccess Instance
43
43
}
44
44
45
45
46
- MapboxConfiguration _configuration ;
46
+ public static bool Configured ;
47
+ public static string ConfigurationJSON ;
48
+ private MapboxConfiguration _configuration ;
49
+
47
50
/// <summary>
48
51
/// The Mapbox API access token.
49
52
/// </summary>
@@ -89,6 +92,8 @@ public void SetConfiguration(MapboxConfiguration configuration, bool throwExecpt
89
92
90
93
ConfigureFileSource ( ) ;
91
94
ConfigureTelemetry ( ) ;
95
+
96
+ Configured = true ;
92
97
}
93
98
94
99
@@ -142,12 +147,16 @@ public void ClearAllCacheFiles()
142
147
private void LoadAccessToken ( )
143
148
{
144
149
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
+ }
146
155
147
156
#if ! WINDOWS_UWP
148
- SetConfiguration ( configurationTextAsset == null ? null : JsonUtility . FromJson < MapboxConfiguration > ( configurationTextAsset . text ) ) ;
157
+ SetConfiguration ( ConfigurationJSON == null ? null : JsonUtility . FromJson < MapboxConfiguration > ( ConfigurationJSON ) ) ;
149
158
#else
150
- SetConfiguration ( configurationTextAsset == null ? null : Mapbox . Json . JsonConvert . DeserializeObject < MapboxConfiguration > ( configurationTextAsset . text ) ) ;
159
+ SetConfiguration ( ConfigurationJSON == null ? null : Mapbox . Json . JsonConvert . DeserializeObject < MapboxConfiguration > ( ConfigurationJSON ) ) ;
151
160
#endif
152
161
}
153
162
0 commit comments