예제 #1
0
 public override void DidReceiveNotificationResponse(UNUserNotificationCenter center, UNNotificationResponse response, Action completionHandler)
 {
 }
예제 #2
0
        public override async void DidReceiveNotificationResponse(UNUserNotificationCenter center, UNNotificationResponse response, Action completionHandler)
        {
            await this.Execute(response.Notification.Request, x => this.sdelegate.Value?.OnReceived(x));

            completionHandler();
        }
예제 #3
0
 public void DidReceiveNotificationResponse(UNUserNotificationCenter center, UNNotificationResponse response, Action completionHandler) =>
 NotifoFirebasePlugin.DidReceiveNotificationResponse(center, response, completionHandler);
예제 #4
0
        public override void DidReceiveNotificationResponse(UNUserNotificationCenter center, UNNotificationResponse response, Action completionHandler)
        {
            UNNotificationRequest request          = response?.Notification?.Request;
            NSDictionary          notificationInfo = request?.Content?.UserInfo;

            if (notificationInfo != null)
            {
                SensusServiceHelper.Get().Logger.Log("Notification received user response:  " + (request.Identifier ?? "[null identifier]"), LoggingLevel.Normal, GetType());

                (SensusContext.Current.CallbackScheduler as IiOSCallbackScheduler)?.OpenDisplayPage(notificationInfo);

                // provide some generic feedback if the user responded to a silent notification. this should only happen in race cases where
                // a silent notification is issued just before we enter background.
                if ((notificationInfo.ValueForKey(new NSString(iOSNotifier.SILENT_NOTIFICATION_KEY)) as NSNumber)?.BoolValue ?? false)
                {
                    SensusServiceHelper.Get().FlashNotificationAsync("Study Updated.");
                }
            }

            completionHandler();
        }
예제 #5
0
        public async override void DidReceiveNotificationResponse(UNUserNotificationCenter center, UNNotificationResponse response, Action completionHandler)
        {
            // Take action based on identifier
            if (response.IsDefaultAction)
            {
                // Handle default action...
                var info = response.Notification.Request.Content.UserInfo;
                if (info.ContainsKey(new NSString("prospectId")))
                {
                    var prospectId      = (info[new NSString("prospectId")] as NSNumber).Int32Value;
                    var prospectService = Mvx.IoCProvider.Resolve <IProspectService>();
                    var prospect        = await prospectService.GetProspectAsync(prospectId);

                    var navigationService = Mvx.IoCProvider.Resolve <IMvxNavigationService>();
                    await navigationService.Navigate <ProspectSMSViewModel, Prospect>(prospect);
                }
            }
            else if (response.IsDismissAction)
            {
                // Handle dismiss action
            }

            // Inform caller it has been handled
            completionHandler();
        }
예제 #6
0
 // If we hit this, it means that the app has been styarted from a notification
 public override void DidReceiveNotificationResponse(UNUserNotificationCenter center,
                                                     UNNotificationResponse response, Action completionHandler)
 {
     NotificationHasBeenTapped = true;
     OnNotificationTappedHandler?.Invoke(this, response.Notification.Request.Identifier);
 }
        public sealed override void OnNotificationTappedWithAction(string actionId, string notificationDataJson, UNNotificationResponse notificationResponse)
        {
            base.OnNotificationTappedWithAction(actionId, notificationDataJson, notificationResponse);
            var deserializedObject = JsonConvert.DeserializeObject <TNotificationData>(notificationDataJson);

            ExecuteOnNotificationTappedWithAction(actionId, deserializedObject, notificationResponse);
        }
 public virtual void ExecuteOnNotificationTappedWithAction(string actionId, TNotificationData notificationData, UNNotificationResponse notificationResponse)
 {
 }
        public sealed override void OnNotificationDismissed(string notificationDataJson, UNNotificationResponse notificationResponse)
        {
            base.OnNotificationDismissed(notificationDataJson, notificationResponse);
            var deserializedObject = JsonConvert.DeserializeObject <TNotificationData>(notificationDataJson);

            ExecuteOnNotificationDismissed(deserializedObject, notificationResponse);
        }
 public virtual void ExecuteOnNotificationDismissed(TNotificationData notificationData, UNNotificationResponse notificationResponse)
 {
 }
예제 #11
0
 public override void DidReceiveNotificationResponse(UNUserNotificationCenter center, UNNotificationResponse response, Action completionHandler)
 {
     // I Clicked it :)
     _action(_id, new NotificationResult()
     {
         Action = NotificationAction.Clicked
     });
 }
예제 #12
0
 public override void DidReceiveNotificationResponse(UNUserNotificationCenter center, UNNotificationResponse response, Action completionHandler)
 {
     _didTapNotification = response.IsDefaultAction;
     Push.DidReceiveRemoteNotification(response.Notification.Request.Content.UserInfo);
     completionHandler();
 }
예제 #13
0
        public override void DidReceiveNotificationResponse(UNUserNotificationCenter center, UNNotificationResponse response, Action completionHandler)
        {
            // Take action based on Action ID
            switch (response.ActionIdentifier)
            {
            case "reply":
                // Do something
                break;

            default:
                // Take action based on identifier
                if (response.IsDefaultAction)
                {
                    // Handle default action...
                }
                else if (response.IsDismissAction)
                {
                    // Handle dismiss action
                }
                break;
            }

            // Inform caller it has been handled
            completionHandler();
        }
예제 #14
0
        public override void DidReceiveNotificationResponse(UNUserNotificationCenter center, UNNotificationResponse response, Action completionHandler)
        {
            if (response.ActionIdentifier == "foodpin.makeReservation")
            {
                Console.WriteLine("Make reservation...");
                var phone = response.Notification.Request.Content.UserInfo["phone"];
                if (phone != null)
                {
                    var telURL = "tel://" + phone;
                    var url    = new NSUrl(telURL);
                    if (url != null)
                    {
                        if (UIApplication.SharedApplication.CanOpenUrl(url))
                        {
                            Console.WriteLine("calling " + telURL);
                            UIApplication.SharedApplication.OpenUrl(url);
                        }
                    }
                }
            }

            completionHandler();
        }
예제 #15
0
        public override void DidReceiveNotificationResponse(UNUserNotificationCenter center, UNNotificationResponse response, Action completionHandler)
        {
            // Do something, e.g. set a Boolean property to track the foreground state.
            NSDictionary          userInfo = response.Notification.Request.Content.UserInfo;
            UNNotificationRequest request  = response.Notification.Request; // 收到推送的请求
            UNNotificationContent content  = request.Content;               // 收到推送的消息内容

            NSNumber badge    = content.Badge;                              // 推送消息的角标
            string   body     = content.Body;                               // 推送消息体
            string   subtitle = content.Subtitle;                           // 推送消息的副标题
            string   title    = content.Title;                              // 推送消息的标题

            if (request.Trigger is UNPushNotificationTrigger)
            {
                // iOS10 前台收到远程通知 处理业务逻辑
                // User tapped on notification badge
                System.Diagnostics.Debug.WriteLine("iOS10 收到远程通知:");
            }
            else
            {
                // iOS10 前台收到本地通知
                System.Diagnostics.Debug.WriteLine("iOS10 收到本地通知:");
            }

            // 前台情况下alert
            completionHandler();
        }