public virtual void Start() { this.Services.Lifecycle.RegisterToReceiveRemoteNotifications(async userInfo => { var dict = userInfo.FromNsDictionary(); var pr = new PushNotification(dict, null); await this.Services.Services.SafeResolveAndExecute <IPushDelegate>(x => x.OnReceived(pr)); this.payloadSubj.OnNext(pr); }); this.Services.Lifecycle.RegisterForNotificationReceived(async response => { if (response.Notification?.Request?.Trigger is UNPushNotificationTrigger) { var shiny = response.FromNative(); var pr = new PushNotificationResponse( shiny.Notification, shiny.ActionIdentifier, shiny.Text ); await this.Services .Services .RunDelegates <IPushDelegate>(x => x.OnEntry(pr)) .ConfigureAwait(false); } }); if (!this.CurrentRegistrationToken.IsEmpty()) { // do I need to do this? I would normally be calling RequestAccess on startup anyhow this.RequestAccess().ContinueWith(x => { }); } }
public PushNotificationResponse?FromIntent(Intent intent) { if (!intent.HasExtra(INTENT_KEY)) { return(null); } var notificationString = intent.GetStringExtra(INTENT_KEY); var notification = this.Services.Serializer.Deserialize <Shiny.Notifications.Notification>(notificationString); var action = intent.GetStringExtra(ShinyPushNotificationBroadcastReceiver.EntryIntentAction); var text = RemoteInput.GetResultsFromIntent(intent)?.GetString("Result"); var response = new PushNotificationResponse(notification, action, text); return(response); }
public Task OnEntry(PushNotificationResponse response) => Task.CompletedTask;
public Task OnEntry(PushNotificationResponse response) => this.services.RunDelegates <IPushDelegate>(x => x.OnEntry(response));