Esempio n. 1
0
        private async Task RegisterPushNotifications(bool enabled)
        {
            if (!_featuresService.IsProEnabled)
            {
                var response = await _alertDialogService.PromptYesNo(
                    "Requires Activation",
                    "Push notifications require activation. Would you like to go there now to activate push notifications?");

                if (response)
                {
                    UpgradeViewController.Present(this);
                }

                return;
            }

            if (enabled)
            {
                await _pushNotificationsService.Register();
            }
            else
            {
                await _pushNotificationsService.Deregister();
            }

            _applicationService.Account.IsPushNotificationsEnabled = enabled;
            await _applicationService.UpdateActiveAccount();
        }
Esempio n. 2
0
        private async void RegisterPushNotifications(bool enabled)
        {
            try
            {
                if (enabled)
                {
                    await _pushNotificationsService.Register();
                }
                else
                {
                    await _pushNotificationsService.Deregister();
                }

                _applicationService.Account.IsPushNotificationsEnabled = enabled;
                _accountsService.Update(_applicationService.Account);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("Unable to register push notifications: " + e.Message);
            }
        }