Giter Site home page Giter Site logo

vanethos / flutter_notification_permissions Goto Github PK

View Code? Open in Web Editor NEW
81.0 4.0 61.0 4.45 MB

Plugin for Flutter to check and ask for Notification Permissions

License: BSD 2-Clause "Simplified" License

Ruby 15.06% Swift 23.08% Objective-C 2.06% Dart 27.79% Java 18.60% Kotlin 0.44% HTML 12.97%

flutter_notification_permissions's Introduction

Flutter Notification Permissions

Package to check for and ask for Notification Permissions on iOS and Android.

Checking Notification Permission Status

Future<PermissionStatus> permissionStatus =
    NotificationPermissions.getNotificationPermissionStatus();

This method will return an enum with the following values:

enum PermissionStatus {
  provisional, // iOS Only
	granted,
	unknown,
	denied
}

In iOS, a permission is unknown when the user hasn’t accepted or refuse the notification permissions. In Android this state will never occur, since the permission will be granted by default and it will be denied if the user goes to the app settings and turns off notifications for the app. The provisional status will also offer the same behavior.

Requesting Notification Permissions

If the PermissionStatus is denied or unknown, we can ask the user for the Permissions:

Future<PermissionStatus> permissionStatus = NotificationPermissions.requestNotificationPermissions({NotificationSettingsIos iosSettings, bool openSettings});

On Android, if the permission is denied, this method will open the app settings.

In iOS, if the permission is unknown or provisional, it will show an alert window asking the user for the permission. On the other hand, if the permission is denied it has the same behaviour as Android, opening the app settings. Also in iOS if you set openSettings to false settings window won't be opened. You will get denied status. NotificationPermissions.requestNotificationPermissions returns status after user select answer from native permission popup.

Note: if the permission is granted, this method will not do anything.

iOS Error: Swift.h not found

If your project is in Objective-C, you will have to do the changes referenced in this SO post in order to solve the issue:

'notification_permissions/notification_permissions-Swift.h' file not found
    #import <notification_permissions/notification_permissions-Swift.h>
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.

Add use_frameworks! in target Runner in your (YOUR_PROJECT)/ios/Podfile

target 'Runner' do
  use_frameworks! # Add here

Special Thanks

Special thanks to fedecastelli for helping me in the Swift Code!

flutter_notification_permissions's People

Contributors

anoop4real avatar britannio avatar duncankelbie avatar ened avatar hespinola avatar kuzmisin avatar nohli avatar pawlowskim avatar steven-spiel avatar vanethos avatar zazo032 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

flutter_notification_permissions's Issues

SwiftNotificationPermissionsPlugin.swift: runtime: UI API called from background thread: UIApplication.canOpenURL(_:) must be used from main thread only

Hello,

I have implemented the example code in iOS, there is 5 - 10 seconds delays when I click the navigation button to the iOS setting screen. I got the issue log below from Xcode log, could you take a look and see whether it is an issue? Thanks.

=================================================================
Main Thread Checker: UI API called on a background thread: -[UIApplication canOpenURL:]
PID: 4660, TID: 1359225, Thread name: (none), Queue name: com.apple.usernotifications.UNUserNotificationServiceConnection.call-out, QoS: 0
Backtrace:
4 notification_permissions 0x000000010506070c $s24notification_permissions34SwiftNotificationPermissionsPluginC6handle_6resultySo17FlutterMethodCallC_yypSgctFySScfU_ + 2408
5 notification_permissions 0x0000000105061524 $s24notification_permissions34SwiftNotificationPermissionsPluginC03getD6Status10completionyySSc_tFySo22UNNotificationSettingsCcfU_ + 496
6 notification_permissions 0x00000001050616b0 $sSo22UNNotificationSettingsCIegg_ABIeyBy_TR + 80
7 libdispatch.dylib 0x00000001050eb6f0 _dispatch_call_block_and_release + 24
8 libdispatch.dylib 0x00000001050ecc74 _dispatch_client_callout + 16
9 libdispatch.dylib 0x00000001050f4bf4 _dispatch_lane_serial_drain + 712
10 libdispatch.dylib 0x00000001050f58ec _dispatch_lane_invoke + 512
11 libdispatch.dylib 0x00000001050ff77c dispatch_workloop_worker_thread + 1148
12 libsystem_pthread.dylib 0x0000000196ed9114 pthread_wqthread + 304
13 libsystem_pthread.dylib 0x0000000196edbcd4 start_wqthread + 4
2019-07-21 16:59:26.520187-0400 Runner[4660:1359225] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication canOpenURL:]
PID: 4660, TID: 1359225, Thread name: (none), Queue name: com.apple.usernotifications.UNUserNotificationServiceConnection.call-out, QoS: 0
Backtrace:
4 notification_permissions 0x000000010506070c $s24notification_permissions34SwiftNotificationPermissionsPluginC6handle_6resultySo17FlutterMethodCallC_yypSgctFySScfU
+ 2408
5 notification_permissions 0x0000000105061524 $s24notification_permissions34SwiftNotificationPermissionsPluginC03getD6Status10completionyySSc_tFySo22UNNotificationSettingsCcfU
+ 496
6 notification_permissions 0x00000001050616b0 $sSo22UNNotificationSettingsCIegg_ABIeyBy_TR + 80
7 libdispatch.dylib 0x00000001050eb6f0 _dispatch_call_block_and_release + 24
8 libdispatch.dylib 0x00000001050ecc74 _dispatch_client_callout + 16
9 libdispatch.dylib 0x00000001050f4bf4 _dispatch_lane_serial_drain + 712
10 libdispatch.dylib 0x00000001050f58ec _dispatch_lane_invoke + 512
11 libdispatch.dylib 0x00000001050ff77c _dispatch_workloop_worker_thread + 1148
12 libsystem_pthread.dylib 0x0000000196ed9114 _pthread_wqthread + 304
13 libsystem_pthread.dylib 0x0000000196edbcd4 start_wqthread + 4

image
image

[Android] Using 'requestNotificationPermissions' doesn't wait for result

Hi,

I'm using 'requestNotificationPermissions' in this way:
var hasNotificationPermissions = true;

  static Future<bool> checkNotificationPermissions() async {
    var hasNotificationPermissions = true;
    var hasNotificationPermissionsStatus =
        await NotificationPermissions.getNotificationPermissionStatus();
    if (hasNotificationPermissionsStatus == PermissionStatus.denied ||
        hasNotificationPermissionsStatus == PermissionStatus.unknown) {
      hasNotificationPermissionsStatus =
          await NotificationPermissions.requestNotificationPermissions(
              iosSettings: const NotificationSettingsIos(
                  alert: true, sound: false, badge: false),
              openSettings: true);
      if (hasNotificationPermissionsStatus == PermissionStatus.denied ||
          hasNotificationPermissionsStatus == PermissionStatus.unknown) {
        hasNotificationPermissions = false;
      }
    }

    return Future.value(hasNotificationPermissions);
  }

In this case, requestNotificationPermissions open the app setting, but the code continue and ignore the await, it doesn't waiting to the pressing of the back button in the settings screen and set hasNotificationPermissionsStatus with PermissionStatus.denied.

How can I solve this behavior?

Thanks.

iOS - Permission granted when each single option is disabled

I use:
flutter --version

Flutter 2.2.1 • channel unknown • unknown source
Framework • revision 02c026b03c (vor 6 Monaten) • 2021-05-27 12:24:44 -0700
Engine • revision 0fdb562ac8
Tools • Dart 2.13.1

Package:
notification_permissions: ^0.6.1

I just recognized that iOS shows "notifications off" in the settings of the app, when each single option is disabled, BUT the actual toggle "Enable push notification" is enabled.

The return type of the following code is granted

final permissionStatus = await NotificationPermissions.getNotificationPermissionStatus();

But obviously, the push notifications will not receive when each option is disabled.

IMG_4353
IMG_4352

iOS - getNotificationPermissionStatus() never returns

On iOS if authorizationStatus value is provisional then the call to getNotificationPermissionStatus() never returns and my app is stuck waiting forever. Ideally I would like the PermissionStatus enum to be extended to include provisional so I can run different logic in that scenario.

It would be great if getNotificationPermissionStatus() always returns even if iOS adds more possible authorizationStatus values in future so that my app does not get stuck waiting forever.

The plugin `notification_permissions` uses a deprecated version of the Android embedding.

I started getting the following warning (that surely looks almost like an error):

The plugin notification_permissions uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.

I just want to be sure that it's being looked at and that my app won't stop working once Android updates.

Here's my flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, 2.4.0-5.0.pre.164, on Microsoft Windows [version 10.0.19042.1110],
    locale pt-BR)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
[√] Chrome - develop for the web
[√] Android Studio (version 4.2)
[√] Connected device (3 available)

• No issues found!

requestNotificationPermissions() doesnt open settings in on iOS simulator

requestNotificationPermissions() doesnt open app settings in simulator on mac, is this expected?

My code:

Container(
                                          child: Transform.scale(
                                            scale: ScreenUtil().setWidth(2.5),
                                            child: CupertinoSwitch(
                                              activeColor: store
                                                  .theme.cupertinoSwitchColor,
                                              value: store.notificationsStore
                                                  .notificationPermissionGranted,
                                              onChanged: (_) async {
                                                NotificationPermissions
                                                    .requestNotificationPermissions(
                                                  openSettings: true,
                                                );
                                              },
                                            ),
                                          ),
                                        )

[Android] The option setting 'android.enableR8=true' is deprecated

I found issue when install package and run project flutter from android studio:

The option setting 'android.enableR8=true' is deprecated.
It will be removed in version 5.0 of the Android Gradle plugin.
You will no longer be able to disable R8
Affected Modules: notification_permissions

IOS => not compile with firebase_messaing

firebase_messaing config:
Remove the use_frameworks! line from ios/Podfile (workaround for flutter/flutter#9694).

Xcode's output:

=== BUILD TARGET flutter_app_badger OF PROJECT Pods WITH CONFIGURATION Debug ===
/Volumes/Home/gustavobrian/Documents/proyectos_flutter/prueba_notif/ios/Pods/FMDB/src/fmdb/FMDatabaseQueue.m:101:9: warning: 'dispatch_queue_set_specific' is only available on iOS 5.0 or newer [-Wunguarded-availability]
dispatch_queue_set_specific(_queue, kDispatchQueueSpecificKey, (__bridge void *)self, NULL);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
In module 'Foundation' imported from /Volumes/Home/gustavobrian/Documents/proyectos_flutter/prueba_notif/ios/Pods/FMDB/src/fmdb/FMDatabaseQueue.h:9:
In module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In module 'Dispatch' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:20:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/dispatch/queue.h:1352:1: note: 'dispatch_queue_set_specific' has been explicitly marked partial here
dispatch_queue_set_specific(dispatch_queue_t queue, const void *key,
^
/Volumes/Home/gustavobrian/Documents/proyectos_flutter/prueba_notif/ios/Pods/FMDB/src/fmdb/FMDatabaseQueue.m:101:9: note: enclose 'dispatch_queue_set_specific' in an @available check to silence this warning
dispatch_queue_set_specific(_queue, kDispatchQueueSpecificKey, (__bridge void *)self, NULL);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Volumes/Home/gustavobrian/Documents/proyectos_flutter/prueba_notif/ios/Pods/FMDB/src/fmdb/FMDatabaseQueue.m:184:54: warning: 'dispatch_get_specific' is only available on iOS 5.0 or newer [-Wunguarded-availability]
FMDatabaseQueue *currentSyncQueue = (__bridge id)dispatch_get_specific(kDispatchQueueSpecificKey);
^~~~~~~~~~~~~~~~~~~~~
In module 'Foundation' imported from /Volumes/Home/gustavobrian/Documents/proyectos_flutter/prueba_notif/ios/Pods/FMDB/src/fmdb/FMDatabaseQueue.h:9:
In module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In module 'Dispatch' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:20:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/dispatch/queue.h:1408:1: note: 'dispatch_get_specific' has been explicitly marked partial here
dispatch_get_specific(const void *key);
^
/Volumes/Home/gustavobrian/Documents/proyectos_flutter/prueba_notif/ios/Pods/FMDB/src/fmdb/FMDatabaseQueue.m:184:54: note: enclose 'dispatch_get_specific' in an @available check to silence this warning
FMDatabaseQueue *currentSyncQueue = (__bridge id)dispatch_get_specific(kDispatchQueueSpecificKey);
^~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
=== BUILD TARGET flutter_app_badger OF PROJECT Pods WITH CONFIGURATION Debug ===
/Volumes/Home/gustavobrian/Documents/proyectos_flutter/prueba_notif/ios/Pods/FMDB/src/fmdb/FMDatabase.m:1486:15: warning: 'sqlite3_wal_checkpoint_v2' is only available on iOS 5.0 or newer [-Wunguarded-availability]
int err = sqlite3_wal_checkpoint_v2(_db, dbName, checkpointMode, logFrameCount, checkpointCount);
^~~~~~~~~~~~~~~~~~~~~~~~~
In module 'SQLite3' imported from /Volumes/Home/gustavobrian/Documents/proyectos_flutter/prueba_notif/ios/Pods/FMDB/src/fmdb/FMDatabase.m:8:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/sqlite3.h:8244:16: note: 'sqlite3_wal_checkpoint_v2' has been explicitly marked partial here
SQLITE_API int sqlite3_wal_checkpoint_v2(
^
/Volumes/Home/gustavobrian/Documents/proyectos_flutter/prueba_notif/ios/Pods/FMDB/src/fmdb/FMDatabase.m:1486:15: note: enclose 'sqlite3_wal_checkpoint_v2' in an @available check to silence this warning
int err = sqlite3_wal_checkpoint_v2(_db, dbName, checkpointMode, logFrameCount, checkpointCount);
^~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
/Volumes/Home/gustavobrian/Documents/proyectos_flutter/prueba_notif/ios/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m:133:17: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
_view.frame = CGRectMake(0.0, 0.0, CGRectGetWidth(_view.bounds), 0.0);
^
self->
/Volumes/Home/gustavobrian/Documents/proyectos_flutter/prueba_notif/ios/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m:133:67: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
_view.frame = CGRectMake(0.0, 0.0, CGRectGetWidth(_view.bounds), 0.0);
^
self->
/Volumes/Home/gustavobrian/Documents/proyectos_flutter/prueba_notif/ios/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m:148:18: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
[_view sizeToFit];
^
self->
/Volumes/Home/gustavobrian/Documents/proyectos_flutter/prueba_notif/ios/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m:189:13: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
if (_navigationController) {
^
self->
/Volumes/Home/gustavobrian/Documents/proyectos_flutter/prueba_notif/ios/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m:190:40: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
[self updateNavigationBarY:_view.statusBarHeight];
^
self->
/Volumes/Home/gustavobrian/Documents/proyectos_flutter/prueba_notif/ios/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m:193:24: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
CGRect frame = _view.frame;
^
self->
/Volumes/Home/gustavobrian/Documents/proyectos_flutter/prueba_notif/ios/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m:195:9: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
_view.frame = frame;
^
self->
/Volumes/Home/gustavobrian/Documents/proyectos_flutter/prueba_notif/ios/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m:203:17: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
_view.closed = YES;
^
self->
8 warnings generated.
/Volumes/Home/gustavobrian/.pub-cache/hosted/pub.dartlang.org/notification_permissions-0.2.2/ios/Classes/NotificationPermissionsPlugin.m:2:9: fatal error: 'notification_permissions/notification_permissions-Swift.h' file not found
#import <notification_permissions/notification_permissions-Swift.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Fatal Exception: java.lang.NoSuchMethodError

Firebase crash log:

Fatal Exception: java.lang.NoSuchMethodError: No static method f(Landroid/content/Context;)Landroidx/core/app/n; in class Landroidx/core/app/n; or its super classes (declaration of 'androidx.core.app.n' appears in /data/app/~~S_zz7RiRmvHW3bspwnclbg==/androidx.test.tools.crawler-6DMZwvhRTKfw6HiB15rVYA==/base.apk)
       at com.vanethos.notification_permissions.MethodCallHandlerImpl.getNotificationPermissionStatus(MethodCallHandlerImpl.java:2)
       at com.vanethos.notification_permissions.MethodCallHandlerImpl.onMethodCall(MethodCallHandlerImpl.java:10)
       at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:17)
       at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:18)
       at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0(DartMessenger.java:20)
       at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$DartMessenger(DartMessenger.java)
       at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$TsixYUB5E6FpKhMtCSQVHKE89gQ.run(-.java:12)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at androidx.test.espresso.base.Interrogator.loopAndInterrogate(Interrogator.java:10)
       at androidx.test.espresso.base.UiControllerImpl.loopUntil(UiControllerImpl.java:7)
       at androidx.test.espresso.base.UiControllerImpl.loopMainThreadUntilIdle(UiControllerImpl.java:16)
       at androidx.test.espresso.ViewInteraction.doPerform(ViewInteraction.java:3)
       at androidx.test.espresso.ViewInteraction.-$$Nest$mdoPerform(ViewInteraction.java)
       at androidx.test.espresso.ViewInteraction$1.call(ViewInteraction.java:6)
       at androidx.test.espresso.ViewInteraction$1.call(ViewInteraction.java:1)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:201)
       at android.os.Looper.loop(Looper.java:288)
       at android.app.ActivityThread.main(ActivityThread.java:7839)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

obfuscation issue?

requestNotificationPermissions returns "unknown" even when it's actually granted

If the permission status is currently unknown, requestNotificationPermissions will return granted if I accept the dialog, which is correct.

But when the status is already granted,
requestNotificationPermissions always returns unknown, yet
getNotificationPermissionStatus returns granted correctly.

Tested on iOS 12.1, 13.1, 13.2.

[!] Unable to read the license file `../LICENSE` for the spec `notification_permissions (0.0.1)`

When running pod install I'm getting this warnings:

[!] A license was specified in podspec `notification_permissions` but the file does not exist - /Users/myuser/dev/apps/myapp/ios/.symlinks/plugins/notification_permissions/LICENSE

[!] Unable to read the license file `../LICENSE` for the spec `notification_permissions (0.0.1)`

[!] Unable to read the license file `../LICENSE` for the spec `notification_permissions (0.0.1)`

I checked and the LICENCE.md file is there on the folder.

I'm using version 0.4.3

File not found

I got the error when I build my iOS app with notification_permissions

'notification_permissions/notification_permissions-Swift.h' file not found
    #import <notification_permissions/notification_permissions-Swift.h>
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.

How to fix this issue?

MissingPluginException

Hi,

I'm getting this exception when running the project on an iOS device (emulator or physical):
Unhandled Exception: MissingPluginException(No implementation found for method getNotificationPermissionStatus on channel notification_permissions)

The implementation works on Android devices. My flutter project is created from an old template (when obj-c was the default for the iOS project) but I have a swift file in the project, I have the use_frameworks! fix from https://stackoverflow.com/questions/53450817/flutter-type-uiapplication-has-no-member-opensettingsurlstring/53453243#53453243 and I have a requirement on SWIFT 5.0.

I can see that the getNotificationPermissionStatus is handled in the swift file and that the obj-c file wraps the swift logic.

Any idea why I'm getting this error?
Ping @Vanethos - if you have any ideas I would really appreciate your feedback.

requestNotificationPermissions() doesn't open notification settings directly on Android

Actual behavior: opens the general app settings (user must then tap the notifications button)
Expected behavior: opens the notification settings directly

Using this intent should solve the issue:
https://developer.android.com/reference/android/provider/Settings.html#ACTION_APP_NOTIFICATION_SETTINGS

https://github.com/Vanethos/flutter_notification_permissions/blob/master/android/src/main/java/com/vanethos/notification_permissions/NotificationPermissionsPlugin.java#L40

Null Safety Migration

Hey,
just wanted to check in if you're already working on migrating to null safety. Or are you waiting on a dependency to migrate?

notification_permissions causes build failure

Adding notification_permissions package will cause the below error

Removing this pub, and this one only, fixes the problem...

 ** BUILD FAILED **
Xcode's output:
↳
    /Users/kevin/.pub-cache/hosted/pub.dartlang.org/rate_my_app-0.5.0+3/ios/Classes/RateMyAppPlugin.m:15:30: warning: 'requestReview' is only available on iOS 10.3 or newer [-Wunguarded-availability]
        [SKStoreReviewController requestReview];
                                 ^~~~~~~~~~~~~~
    In module 'StoreKit' imported from /Users/kevin/.pub-cache/hosted/pub.dartlang.org/rate_my_app-0.5.0+3/ios/Classes/RateMyAppPlugin.m:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/StoreKit.framework/Headers/SKStoreReviewController.h:22:1: note: 'requestReview' has been marked as being introduced in iOS 10.3 here, but the deployment target is iOS 8.0.0
    + (void)requestReview API_AVAILABLE(ios(10.3), macos(10.14)) __TVOS_PROHIBITED;
    ^
    /Users/kevin/.pub-cache/hosted/pub.dartlang.org/rate_my_app-0.5.0+3/ios/Classes/RateMyAppPlugin.m:15:30: note: enclose 'requestReview' in an @available check to silence this warning
        [SKStoreReviewController requestReview];
                                 ^~~~~~~~~~~~~~
    /Users/kevin/.pub-cache/hosted/pub.dartlang.org/rate_my_app-0.5.0+3/ios/Classes/RateMyAppPlugin.m:15:6: warning: 'SKStoreReviewController' is only available on iOS 10.3 or newer [-Wunguarded-availability]
        [SKStoreReviewController requestReview];
         ^~~~~~~~~~~~~~~~~~~~~~~
    In module 'StoreKit' imported from /Users/kevin/.pub-cache/hosted/pub.dartlang.org/rate_my_app-0.5.0+3/ios/Classes/RateMyAppPlugin.m:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/StoreKit.framework/Headers/SKStoreReviewController.h:14:85: note: 'SKStoreReviewController' has been marked as being introduced in iOS 10.3 here, but the deployment target is iOS 8.0.0
    SK_EXTERN_CLASS API_AVAILABLE(ios(10.3), macos(10.14)) __TVOS_PROHIBITED @interface SKStoreReviewController : NSObject
                                                                                        ^
    /Users/kevin/.pub-cache/hosted/pub.dartlang.org/rate_my_app-0.5.0+3/ios/Classes/RateMyAppPlugin.m:15:6: note: enclose 'SKStoreReviewController' in an @available check to silence this warning
        [SKStoreReviewController requestReview];
         ^~~~~~~~~~~~~~~~~~~~~~~
    2 warnings generated.
    /Users/kevin/.pub-cache/hosted/pub.dartlang.org/google_sign_in-4.1.1/ios/Classes/FLTGoogleSignInPlugin.m:138:13: warning: unused variable 'sourceApplication' [-Wunused-variable]
      NSString *sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey];
                ^
    /Users/kevin/.pub-cache/hosted/pub.dartlang.org/google_sign_in-4.1.1/ios/Classes/FLTGoogleSignInPlugin.m:138:41: warning: 'UIApplicationOpenURLOptionsSourceApplicationKey' is only available on iOS 9.0 or newer [-Wunguarded-availability]
      NSString *sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey];
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In module 'UIKit' imported from /Users/kevin/GitHub/FolsomDevs/app_pooli_flutter/ios/Pods/Target Support Files/google_sign_in/google_sign_in-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:518:51: note: 'UIApplicationOpenURLOptionsSourceApplicationKey' has been marked as being introduced in iOS 9.0 here, but the deployment target is iOS 8.0.0
    UIKIT_EXTERN UIApplicationOpenURLOptionsKey const UIApplicationOpenURLOptionsSourceApplicationKey NS_SWIFT_NAME(sourceApplication) API_AVAILABLE(ios(9.0));   // value is an NSString containing the bundle ID of the originating application; non-nil if the originating application and this application share the same team identifier
                                                      ^
    /Users/kevin/.pub-cache/hosted/pub.dartlang.org/google_sign_in-4.1.1/ios/Classes/FLTGoogleSignInPlugin.m:138:41: note: enclose 'UIApplicationOpenURLOptionsSourceApplicationKey' in an @available check to silence this warning
      NSString *sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey];
  
 2 warnings generated.
    ld: warning: Could not find or use auto-linked library 'swiftCoreFoundation'
    ld: warning: Could not find or use auto-linked library 'swiftCompatibility50'
    ld: warning: Could not find or use auto-linked library 'swiftDarwin'
    ld: warning: Could not find or use auto-linked library 'swiftObjectiveC'
    ld: warning: Could not find or use auto-linked library 'swiftSwiftOnoneSupport'
    ld: warning: Could not find or use auto-linked library 'swiftQuartzCore'
    ld: warning: Could not find or use auto-linked library 'swiftCore'
    ld: warning: Could not find or use auto-linked library 'swiftCoreGraphics'
    ld: warning: Could not find or use auto-linked library 'swiftUIKit'
    ld: warning: Could not find or use auto-linked library 'swiftFoundation'
    ld: warning: Could not find or use auto-linked library 'swiftCoreImage'
    ld: warning: Could not find or use auto-linked library 'swiftCompatibilityDynamicReplacements'
    ld: warning: Could not find or use auto-linked library 'swiftMetal'
    ld: warning: Could not find or use auto-linked library 'swiftDispatch'
    ld: warning: Could not find or use auto-linked library 'swiftCoreMedia'
    ld: warning: Could not find or use auto-linked library 'swiftCoreAudio'
    Undefined symbols for architecture x86_64:
          protocol conformance descriptor for __C.UNAuthorizationStatus : Swift.Equatable in __C_Synthesized in libnotification_permissions.a(SwiftNotificationPermissionsPlugin.o)
          protocol conformance descriptor for __C.UIApplicationOpenExternalURLOptionsKey : Swift.Equatable in __C_Synthesized in libnotification_permissions.a(SwiftNotificationPermissionsPlugin.o)
          protocol conformance descriptor for __C.UIUserNotificationType : Swift.Equatable in __C_Synthesized in libnotification_permissions.a(SwiftNotificationPermissionsPlugin.o)
          protocol conformance descriptor for __C.UNAuthorizationOptions : Swift.Equatable in __C_Synthesized in libnotification_permissions.a(SwiftNotificationPermissionsPlugin.o)
      "method descriptor for static Swift.Equatable.== infix(A, A) -> Swift.Bool", referenced from:
          protocol conformance descriptor for __C.UNAuthorizationStatus : Swift.Equatable in __C_Synthesized in libnotification_permissions.a(SwiftNotificationPermissionsPlugin.o)
          protocol conformance descriptor for __C.UIApplicationOpenExternalURLOptionsKey : Swift.Equatable in __C_Synthesized in libnotification_permissions.a(SwiftNotificationPermissionsPlugin.o)
          protocol conformance descriptor for __C.UIUserNotificationType : Swift.Equatable in __C_Synthesized in libnotification_permissions.a(SwiftNotificationPermissionsPlugin.o)
          protocol conformance descriptor for __C.UNAuthorizationOptions : Swift.Equatable in __C_Synthesized in libnotification_permissions.a(SwiftNotificationPermissionsPlugin.o)
      "protocol conformance descriptor for Swift.String : Swift._ObjectiveCBridgeable in Foundation", referenced from:
          lazy protocol witness table accessor for type Swift.String and conformance Swift.String : Swift._ObjectiveCBridgeable in Foundation in libnotification_permissions.a(SwiftNotificationPermissionsPlugin.o)
      "_swift_beginAccess", referenced from:
          notification_permissions.SwiftNotificationPermissionsPlugin.permissionGranted.getter : Swift.String in libnotification_permissions.a(SwiftNotificationPermissionsPlugin.o)
          notification_permissions.SwiftNotificationPermissionsPlugin.permissionGranted.setter : Swift.String in libnotification_permissions.a(SwiftNotificationPermissionsPlugin.o)
          notification_permissions.SwiftNotificationPermissionsPlugin.permissionGranted.modify : Swift.String in libnotification_permissions.a(SwiftNotificationPermissionsPlugin.o)
          notification_permissions.SwiftNotificationPermissionsPlugin.permissionUnknown.getter : Swift.String in libnotification_permissions.a(SwiftNotificationPermissionsPlugin.o)
          notification_permissions.SwiftNotificationPermissionsPlugin.permissionUnknown.setter : Swift.String in libnotification_permissions.a(SwiftNotificationPermissionsPlugin.o)
          notification_permissions.SwiftNotificationPermissionsPlugin.permissionUnknown.modify : Swift.String in libnotification_permissions.a(SwiftNotificationPermissionsPlugin.o)
          notification_permissions.SwiftNotificationPermissionsPlugin.permissionDenied.getter : Swift.String in libnotification_permissions.a(SwiftNotificationPermissionsPlugin.o)

Remote notifications

Hey it would be good if we had the option to also register users for remote notifications on iOS
application.registerForRemoteNotifications()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.