jpush-flutter-plugin
jpush-flutter-plugin copied to clipboard
JPush-flutter-plugin 期望改进的2个地方
每次启动均需要通过请求授权来设置代理,这与App本身的启动流程不符合**(产品要求先检查权限,开启则不需要请求权限, JPush需要在Setup内置默认权限检查,并设置代理)**
- (void)applyPushAuthority:(FlutterMethodCall*)call result:(FlutterResult)result {
JPLog(@"applyPushAuthority:%@",call.arguments);
notificationTypes = 0;
NSDictionary *arguments = call.arguments;
if ([arguments[@"sound"] boolValue]) {
notificationTypes |= JPAuthorizationOptionSound;
}
if ([arguments[@"alert"] boolValue]) {
notificationTypes |= JPAuthorizationOptionAlert;
}
if ([arguments[@"badge"] boolValue]) {
notificationTypes |= JPAuthorizationOptionBadge;
}
JPUSHRegisterEntity * entity = [[JPUSHRegisterEntity alloc] init];
entity.types = notificationTypes;
/// 如果app已经授权通知权限,flutter端不用调用`applyPushAuthority:`, 默认在`setup`方法中实现默认的代理设置并在代理设置成功后返回`result`事件表示初始化已经完成;
[JPUSHService registerForRemoteNotificationConfig:entity delegate:self];
}
2. 关于iOS setBadge
为0的时候建议增加可选值, 允许保留通知中心的通知(产品有这个需求),
- 关于如何实现清除角标不清除通知可以参考这两个连接
https://stackoverflow.com/questions/37789581/clear-applicationiconbadgenumber-without-removing-notifications-not-working/41758039#41758039
https://developer.apple.com/forums/thread/7598