public void onSuccess()
        {
#if DEVELOPMENT_BUILD
            Debug.Log("onSuccess");
#endif
            MainThreadExecutor.Queue(onSuccessAction);
        }
Exemple #2
0
        public void onFailure(string error)
        {
#if DEVELOPMENT_BUILD
            Debug.Log("onFailure: " + error);
#endif
            MainThreadExecutor.Queue(() => onFailureAction(error));
        }
        internal static void Init()
        {
            lock (initLock)
            {
                if (instance == null)
                {
                    var instances = FindObjectsOfType <MainThreadExecutor>();

                    if (instances.Length > 1)
                    {
                        Debug.LogError("[MainThreadExecutor] Something went really wrong " +
                                       " - there should never be more than 1 MainThreadExecutor!" +
                                       " Reopening the scene might fix it.");
                    }
                    else if (instances.Length == 0)
                    {
                        GameObject singleton = new GameObject();
                        instance       = singleton.AddComponent <MainThreadExecutor>();
                        singleton.name = "[singleton] " + typeof(MainThreadExecutor);

                        DontDestroyOnLoad(singleton);

                        Debug.Log("[Singleton] An instance of " + typeof(MainThreadExecutor) +
                                  " is needed in the scene, so '" + singleton +
                                  "' was created with DontDestroyOnLoad.");
                    }
                    else
                    {
                        instance = instances[0];
                        Debug.Log("[Singleton] Using instance already created: " + instance.gameObject.name);
                    }
                }
            }
        }
        private void onFailure(AndroidJavaObject errorAJO)
        {
#if DEVELOPMENT_BUILD
            Debug.Log("onFailure: " + errorAJO);
#endif
            string errorMessage = errorAJO.Call <string>("getMessage") ?? string.Empty;
            MainThreadExecutor.Queue(() => onFailureAction(errorMessage));
        }
Exemple #5
0
        public void onSuccess(string result)
        {
#if DEVELOPMENT_BUILD
            Debug.Log("onSuccess: " + result);
#endif
            TResult deserializedResult = convertFunc(result);
            MainThreadExecutor.Queue(() => onSuccessAction(deserializedResult));
        }
Exemple #6
0
 void onUnreadNotificationsCountChanged(int unreadNotificationsCount)
 {
     if (onUnreadNotificationsCountChangeAction != null)
     {
         MainThreadExecutor.Queue(
             () => onUnreadNotificationsCountChangeAction(unreadNotificationsCount)
             );
     }
 }
Exemple #7
0
        public void onFailure(AndroidJavaObject exception)
        {
            var errorMessage = exception.Call <String>("getMessage");

#if DEVELOPMENT_BUILD
            Debug.Log("onFailure: " + errorMessage);
#endif
            MainThreadExecutor.Queue(() => onFailureAction(errorMessage));
        }
 void onError(AndroidJavaObject javaException)
 {
     if (onFailureAction != null)
     {
         var message = javaException.IsJavaNull() ? string.Empty : javaException.Call <String>("getMessage");
         var ex      = new Exception(message);
         MainThreadExecutor.Queue(() => onFailureAction(ex.Message));
     }
 }
Exemple #9
0
        public static IGetSocialNativeBridge GetInstance()
        {
            if (instance == null)
            {
                instance = new GetSocialNativeBridgeIOS();
            }

            MainThreadExecutor.Init();

            return(instance);
        }
Exemple #10
0
 void inviteFriends(AndroidJavaObject context, string subject, string text, string referralDataUrl, string base64image, AndroidJavaObject callback)
 {
     MainThreadExecutor.Queue(() => {
         invitePlugin.InviteFriends(
             subject: subject,
             text: text,
             image: !string.IsNullOrEmpty(base64image) ? Convert.FromBase64String(base64image) : null,
             referralDataUrl: referralDataUrl,
             onSuccess: (requestId, to) => OnComplete(callback, requestId, to),
             onCancel: () => OnCancel(callback),
             onFailure: (exception) => OnError(callback, exception));
     });
 }
Exemple #11
0
        private void InitializeGetSocial()
        {
            using (AndroidJavaObject clazz = new AndroidJavaClass("im.getsocial.sdk.core.unity.GetSocialUnityBridge"))
            {
                getSocialJavaObject = clazz.CallStatic <AndroidJavaObject>("initBridge");
            }

            if (getSocialJavaObject.IsJavaNull())
            {
                throw new Exception("Failed to instantiate Android GetSocial SDK");
            }

            if (!AndroidUtils.IsUnityBuildOfGetSocialAndroidSDK())
            {
                throw new Exception(
                          "Wrong version of GetSocial Android SDK is included into the build. BuildConfig.TARGET_PLATFORM != \"UNITY\"");
            }

            // Call OnResume manually first time
            OnResume();
            MainThreadExecutor.Init();
        }
Exemple #12
0
 protected void onFailure(AndroidJavaObject nullRef)
 {
     MainThreadExecutor.Queue(() => onFailureAction(string.Empty));
 }
Exemple #13
0
 void onSuccess(int newRank)
 {
     MainThreadExecutor.Queue(() => onSuccessAction(newRank));
 }
 protected static void ExecuteOnMainThread(Action action)
 {
     MainThreadExecutor.Queue(action);
 }
Exemple #15
0
 // additional callbacks for an Unity JNI issue
 protected void onSuccess(AndroidJavaObject nullRef)
 {
     MainThreadExecutor.Queue(() => onSuccessAction(default(TResult)));
 }
 private static void Ui(Action onUiThread)
 {
     MainThreadExecutor.Queue(onUiThread);
 }
Exemple #17
0
 void onInviteFriendsIntent()
 {
     MainThreadExecutor.Queue(onInviteFriendsIntentAction);
 }
Exemple #18
0
 void onInvitedFriends(int friendsInvited)
 {
     MainThreadExecutor.Queue(() => onInvitedFriendsAction(friendsInvited));
 }
 void onComplete(int result)
 {
     MainThreadExecutor.Queue(() => onCompleteAction((CurrentUser.AddIdentityResult)result));
 }
 void onClose()
 {
     MainThreadExecutor.Queue(onCloseAction);
 }
Exemple #21
0
 void onFailure(AndroidJavaObject exception)
 {
     MainThreadExecutor.Queue(onFailureAction);
 }
 void onOpen()
 {
     MainThreadExecutor.Queue(onOpenAction);
 }