Example #1
0
        public void PostNotification(Dictionary <string, object> data, OnPostNotificationSuccess inOnPostNotificationSuccess, OnPostNotificationFailure inOnPostNotificationFailure)
        {
            postNotificationSuccessDelegate = inOnPostNotificationSuccess;
            postNotificationFailureDelegate = inOnPostNotificationFailure;

            PostNotification(data);
        }
        public override void PostNotification(Dictionary <string, object> data, OnPostNotificationSuccess success, OnPostNotificationFailure failure)
        {
            string jsonString = Json.Serialize(data);

            iOS.OneSignal.PostNotificationWithJsonString(jsonString,
                                                         result => success?.Invoke(NSDictToPureDict(result)),
                                                         error =>
            {
                if (failure != null)
                {
                    Dictionary <string, object> dict;
                    if (error.UserInfo != null && error.UserInfo["returned"] != null)
                    {
                        dict = NSDictToPureDict(error.UserInfo);
                    }
                    else
                    {
                        dict = new Dictionary <string, object> {
                            { "error", "HTTP no response error" }
                        }
                    };
                    failure(dict);
                }
            });
        }
Example #3
0
 public static void PostNotification(Dictionary <string, object> data, OnPostNotificationSuccess inOnPostNotificationSuccess, OnPostNotificationFailure inOnPostNotificationFailure)
 {
   #if ONESIGNAL_PLATFORM
     postNotificationSuccessDelegate = inOnPostNotificationSuccess;
     postNotificationFailureDelegate = inOnPostNotificationFailure;
     oneSignalPlatform.PostNotification(data);
   #endif
 }
Example #4
0
        public static void PostNotification(string jsonString, OnPostNotificationSuccess inOnPostNotificationSuccess, OnPostNotificationFailure inOnPostNotificationFailure)
        {
#if ONESIGNAL_PLATFORM
            postNotificationSuccessDelegate = inOnPostNotificationSuccess;
            postNotificationFailureDelegate = inOnPostNotificationFailure;
            oneSignalPlatform.PostNotification(jsonString);
#endif
        }
 public static void PostNotification(Dictionary <string, object> data, OnPostNotificationSuccess onPostNotificationSuccessDelegate, OnPostNotificationFailure onPostNotificationFailureDelegate)
 {
                 #if ONESIGNAL_PLATFORM
     OneSignal.onPostNotificationSuccessDelegate = onPostNotificationSuccessDelegate;
     OneSignal.onPostNotificationFailureDelegate = onPostNotificationFailureDelegate;
     oneSignalPlatform.PostNotification(data);
                 #endif
 }
 // Called from the native SDK
 private void onPostNotificationFailed(string response)
 {
     if (postNotificationFailureDelegate != null)
     {
         postNotificationFailureDelegate(Json.Deserialize(response) as Dictionary <string, object>);
         postNotificationFailureDelegate = null;
         postNotificationSuccessDelegate = null;
     }
 }
Example #7
0
 // Called from the native SDK
 public static void onPostNotificationFailed(Dictionary <string, object> response)
 {
     if (postNotificationFailureDelegate != null)
     {
         OnPostNotificationFailure tempPostNotificationFailureDelegate = postNotificationFailureDelegate;
         postNotificationFailureDelegate = null;
         postNotificationSuccessDelegate = null;
         tempPostNotificationFailureDelegate(response);
     }
 }
Example #8
0
 public void OnPostNotificationFailedCallback(Dictionary <string, object> response)
 {
     if (_postNotificationFailureDelegate != null)
     {
         OnPostNotificationFailure tempPostNotificationFailureDelegate = _postNotificationFailureDelegate;
         _postNotificationFailureDelegate = null;
         _postNotificationSuccessDelegate = null;
         tempPostNotificationFailureDelegate(response);
     }
 }
Example #9
0
    public static void PostNotification(Dictionary <string, object> data, OnPostNotificationSuccess inOnPostNotificationSuccess, OnPostNotificationFailure inOnPostNotificationFailure)
    {
        #if ONESIGNAL_PLATFORM
        string delegateGuidSuccess = OneSignalUnityUtils.GetNewGuid();
        string delegateGuidFailure = OneSignalUnityUtils.GetNewGuid();

        delegates.Add(delegateGuidSuccess, inOnPostNotificationSuccess);
        delegates.Add(delegateGuidFailure, inOnPostNotificationFailure);

        oneSignalPlatform.PostNotification(delegateGuidSuccess, delegateGuidFailure, data);
        #endif
    }
 public abstract void PostNotification(Dictionary <string, object> data, OnPostNotificationSuccess inOnPostNotificationSuccess, OnPostNotificationFailure inOnPostNotificationFailure);
Example #11
0
 public override void PostNotification(Dictionary <string, object> data, OnPostNotificationSuccess success, OnPostNotificationFailure failure)
 {
     Android.OneSignal.PostNotification(Json.Serialize(data), new PostNotificationResponseHandler(success, failure));
 }
Example #12
0
		// Called from the native SDK
		private void onPostNotificationFailed(string response) {
			if (postNotificationFailureDelegate != null) {
				postNotificationFailureDelegate(Json.Deserialize(response) as Dictionary<string, object>);
				postNotificationFailureDelegate = null;
				postNotificationSuccessDelegate = null;
			}
		}
Example #13
0
	public static void PostNotification(Dictionary<string, object> data, OnPostNotificationSuccess inOnPostNotificationSuccess, OnPostNotificationFailure inOnPostNotificationFailure) {
		#if ONESIGNAL_PLATFORM
			postNotificationSuccessDelegate = inOnPostNotificationSuccess;
			postNotificationFailureDelegate = inOnPostNotificationFailure;
			oneSignalPlatform.PostNotification(data);
		#endif
	}
Example #14
0
 public PostNotificationResponseHandler(OnPostNotificationSuccess success, OnPostNotificationFailure failure)
 {
     _success = success;
     _failure = failure;
 }