public void SetConfiguration(MapboxConfiguration configuration, bool throwExecptions = true) { if (configuration == null) { if (throwExecptions) { throw new InvalidTokenException("No configuration file found! Configure your access token from the Mapbox > Settings menu."); } } TokenValidator.Retrieve(configuration.AccessToken, (response) => { if (OnTokenValidation != null) { OnTokenValidation(response.Status); } if (response.Status != MapboxTokenStatus.TokenValid && throwExecptions) { throw new InvalidTokenException(response.Status.ToString()); } }); _configuration = configuration; ConfigureFileSource(); ConfigureTelemetry(); }
public void SetConfiguration(MapboxConfiguration configuration, bool throwExecptions = true) { if (configuration == null) { if (throwExecptions) { throw new InvalidTokenException(_tokenNotSetErrorMessage); } } if (null == configuration || string.IsNullOrEmpty(configuration.AccessToken)) { Debug.LogError(_tokenNotSetErrorMessage); } else { TokenValidator.Retrieve(configuration.GetMapsSkuToken, configuration.AccessToken, (response) => { if (OnTokenValidation != null) { OnTokenValidation(response.Status); } if (response.Status != MapboxTokenStatus.TokenValid && throwExecptions) { configuration.AccessToken = string.Empty; Debug.Log("Exception Here"); Debug.LogError(new InvalidTokenException(response.Status.ToString().ToString())); } }); _configuration = configuration; ConfigureFileSource(); ConfigureTelemetry(); Configured = true; } }