Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

enable automatic permission request by user for notifications when ch… #2843

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

gecsbernat
Copy link

@gecsbernat gecsbernat commented Oct 24, 2019

enable automatic permission request by user for notifications when checkpermission called

Description

First we have to request notification permission from user. Without this you cannot send notifications.

I had to use localnotifications plugin to request permissions but because of that the push.on('registration',) did not fired on ios when app in foreground.
issue: #2222

This is a solution for this:
#2085

Related Issue

#2085

Motivation and Context

I had to use localnotifications plugin to request permissions but because of that the push.on('registration',) did not fired on ios when app in foreground.

How Has This Been Tested?

Screenshots (if appropriate):

https://i1.wp.com/www.simplifiedios.net/wp-content/uploads/2018/01/iOS-Local-Notification-Authorization.png?w=399&ssl=1

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

[self.commandDelegate sendPluginResult:commandResult callbackId:command.callbackId];
}];
}else{
NSMutableDictionary* message = [NSMutableDictionary dictionaryWithCapacity:1];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you should try to avoid dublicate code, because these 4 lines are the same if already granted or the completionHandler is called.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants