Esempio n. 1
0
        protected override bool OnNotificationProcessing(OSNotificationReceivedResult p0)
        {
            _result = p0;
            var overrideSettings = new OverrideSettings {
                Extender = this
            };

            DisplayNotification(overrideSettings);

            return(false);
        }
Esempio n. 2
0
        protected override bool OnNotificationProcessing(OSNotificationReceivedResult p0)
        {
            _result = p0;
            var overrideSettings = new OverrideSettings {
                Extender = this
            };
            var type = p0.Payload.AdditionalData.GetString("type");

            if (!type.Equals(PushSubscription.User.GetEnumDescription()) || BasePresenter.User.PushSubscriptions.Contains(PushSubscription.User))
            {
                DisplayNotification(overrideSettings);
            }
            return(false);
        }
Esempio n. 3
0
        protected override bool OnNotificationProcessing(OSNotificationReceivedResult p0)
        {
            _result = p0;
            var overrideSettings = new OverrideSettings {
                Extender = this
            };

            var isUserAuthenticated = AppSettings.User.HasPostingPermission;

            if (isUserAuthenticated)
            {
                DisplayNotification(overrideSettings);
            }

            return(isUserAuthenticated);
        }
        protected override bool OnNotificationProcessing(OSNotificationReceivedResult p0)
        {
            //OverrideSettings overrideSettings = new OverrideSettings();
            //overrideSettings.Extender = new NotificationCompat.CarExtender();

            Com.OneSignal.Android.OSNotificationPayload payload = p0.Payload;
            JSONObject additionalData = payload.AdditionalData;

            if (additionalData.Has("room_name"))
            {
                //string roomName = additionalData.Get("room_name").ToString();
                //string callType = additionalData.Get("call_type").ToString();
                //string callId = additionalData.Get("call_id").ToString();
                //string fromId = additionalData.Get("from_id").ToString();
                //string toId = additionalData.Get("to_id").ToString();

                return(false);
            }

            return(true);
        }
        protected override bool OnNotificationProcessing(OSNotificationReceivedResult notificationResult)
        {
            MessagingCenter.Send(Xamarin.Forms.Application.Current, "NotificationCount", 1);
            if (!string.IsNullOrEmpty(notificationResult.Payload.Title))
            {
                if (notificationResult.Payload.Title.ToLower() == "intercept")
                {
                    return(true);
                }
                if (notificationResult.Payload.Title.ToLower() == "important" || notificationResult.Payload.Title.ToLower() == "background")
                {
                    string title       = notificationResult.Payload.Title;
                    string message     = notificationResult.Payload.Body;
                    string channelName = "notificationAppChannel";
                    using (var notificationManager = NotificationManager.FromContext(BaseContext))
                    {
                        Notification notification;
                        if (Build.VERSION.SdkInt < BuildVersionCodes.O)
                        {
                            notification = new Notification.Builder(BaseContext, channelName)
                                           .SetContentTitle(title)
                                           .SetContentText(message)
                                           .SetSmallIcon(Resource.Drawable.beard_notification_icon)
                                           .Build();
                        }
                        else
                        {
                            var myUrgentChannel = PackageName;

                            NotificationChannel channel;
                            channel = notificationManager.GetNotificationChannel(myUrgentChannel);
                            if (channel == null)
                            {
                                channel = new NotificationChannel(myUrgentChannel, channelName, NotificationImportance.High);
                                channel.EnableVibration(true);
                                channel.EnableLights(true);
                                channel.LockscreenVisibility = NotificationVisibility.Public;
                                notificationManager.CreateNotificationChannel(channel);
                            }

                            notificationManager.NotificationChannels.First(nch => nch.Id == myUrgentChannel).Importance = notificationResult.Payload.Title.ToLower() == "important"
                                ? NotificationImportance.High
                                : NotificationImportance.Default;
                            channel?.Dispose();

                            notification = new Notification.Builder(BaseContext, myUrgentChannel)
                                           .SetContentTitle(title)
                                           .SetContentText(message)
                                           .SetAutoCancel(true)
                                           .SetSmallIcon(Resource.Drawable.beard_notification_icon)
                                           .Build();
                        }
                        notificationManager.Notify(1331, notification);
                        notification.Dispose();
                    }
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 6
0
 protected override bool OnNotificationProcessing(OSNotificationReceivedResult receivedResult)
 {
     return(false);
 }