Пример #1
0
 public void Initialize()
 {
     WitAuthUtility.InitEditorTokens();
     configuration = target as WitConfiguration;
     currentToken  = WitAuthUtility.GetAppServerToken(configuration);
     if (WitAuthUtility.IsServerTokenValid(currentToken) &&
         !string.IsNullOrEmpty(configuration?.clientAccessToken))
     {
         configuration?.UpdateData(() =>
         {
             EditorForegroundRunner.Run(() => EditorUtility.SetDirty(configuration));
         });
     }
 }
Пример #2
0
 /// <summary>
 /// Gets the app info and client id that is associated with the server token being used
 /// </summary>
 /// <param name="serverToken">The server token to use to get the app config</param>
 /// <param name="action"></param>
 public static void FetchAppConfigFromServerToken(this WitConfiguration configuration,
                                                  string serverToken, Action action)
 {
     if (WitAuthUtility.IsServerTokenValid(serverToken))
     {
         FetchApplicationFromServerToken(configuration, serverToken,
                                         () =>
         {
             FetchClientToken(configuration,
                              () => { configuration.UpdateData(action); });
         });
     }
     else
     {
         Debug.LogError($"No server token set for {configuration.name}.");
     }
 }