master
raoxudong 5 years ago
parent 01b5f7c1f0
commit 6d2bd260bb

@ -1,4 +1,4 @@
# Generated by pub on 2019-09-25 15:21:45.301321.
# Generated by pub on 2019-11-19 13:53:32.095797.
analyzer:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/analyzer-0.37.0/lib/
args:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/args-1.5.2/lib/
async:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/async-2.3.0/lib/
@ -19,7 +19,7 @@ io:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/io-0.3.3/lib
js:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/js-0.6.1+1/lib/
kernel:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/kernel-0.3.20/lib/
matcher:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/matcher-0.12.5/lib/
meta:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/meta-1.1.6/lib/
meta:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/meta-1.1.7/lib/
mime:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/mime-0.9.6+3/lib/
mockito:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/mockito-3.0.2/lib/
multi_server_socket:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/multi_server_socket-1.0.2/lib/

@ -1,3 +1,7 @@
## 0.3.0
+ 新增:清除通知栏单条通知方法
+ 修复:点击通知栏无法获取消息问题
+ 同步最新版 SDK
## 0.2.0
+ 适配最新版本 JPush SDK
+ Android 支持设置角标 badge

@ -7,7 +7,7 @@
```yaml
dependencies:
jpush_flutter: 0.2.0
jpush_flutter: 0.3.0
//github
dependencies:

@ -34,8 +34,8 @@ android {
}
dependencies {
implementation 'cn.jiguang.sdk:jpush:3.3.4'
implementation 'cn.jiguang.sdk:jcore:2.1.2'
implementation 'cn.jiguang.sdk:jpush:3.4.0'
implementation 'cn.jiguang.sdk:jcore:2.1.6'
// implementation 'com.android.support:appcompat-v7:28.+'
compileOnly files('libs/flutter.jar')

@ -12,6 +12,7 @@ import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugin.common.PluginRegistry.Registrar;
import java.util.ArrayList;
@ -23,17 +24,26 @@ import java.util.Map;
import java.util.Set;
import cn.jpush.android.api.JPushInterface;
import io.flutter.view.FlutterNativeView;
/** JPushPlugin */
public class JPushPlugin implements MethodCallHandler {
/** Plugin registration. */
public static void registerWith(Registrar registrar) {
final MethodChannel channel = new MethodChannel(registrar.messenger(), "jpush");
channel.setMethodCallHandler(new JPushPlugin(registrar, channel));
registrar.addViewDestroyListener(new PluginRegistry.ViewDestroyListener() {
@Override
public boolean onViewDestroy(FlutterNativeView flutterNativeView) {
instance.dartIsReady = false;
return false;
}
});
}
private static String TAG = "| JPUSH | Android | ";
private static String TAG = "| JPUSH | Flutter | Android | ";
public static JPushPlugin instance;
static List<Map<String, Object>> openNotificationCache = new ArrayList<>();
@ -86,6 +96,8 @@ public class JPushPlugin implements MethodCallHandler {
resumePush(call, result);
} else if (call.method.equals("clearAllNotifications")) {
clearAllNotifications(call, result);
} else if (call.method.equals("clearNotification")) {
clearNotification(call,result);
} else if (call.method.equals("getLaunchAppNotification")) {
getLaunchAppNotification(call, result);
} else if (call.method.equals("getRegistrationID")) {
@ -133,6 +145,7 @@ public class JPushPlugin implements MethodCallHandler {
if (ridAvailable && dartIsReady) {
// try to schedule get rid cache
for (Result res: JPushPlugin.instance.getRidCache) {
Log.d(TAG,"scheduleCache rid = " + rid);
res.success(rid);
JPushPlugin.instance.getRidCache.remove(res);
}
@ -220,6 +233,13 @@ public class JPushPlugin implements MethodCallHandler {
JPushInterface.clearAllNotifications(registrar.context());
}
public void clearNotification(MethodCall call, Result result) {
Log.d(TAG,"clearNotification: ");
Object id = call.arguments;
if (id != null) {
JPushInterface.clearNotificationById(registrar.context(),(int)id);
}
}
public void getLaunchAppNotification(MethodCall call, Result result) {
Log.d(TAG,"");

@ -0,0 +1,10 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Applications/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/raoxudong/JPush/jpush-github/jpush-flutter-plugin/example"
export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "FLUTTER_FRAMEWORK_DIR=/Applications/flutter/bin/cache/artifacts/engine/ios"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"

@ -13,7 +13,7 @@ class MyApp extends StatefulWidget {
class _MyAppState extends State<MyApp> {
String debugLable = 'Unknown';
final JPush jpush = new JPush();
final JPush jpush = new JPush();
@override
void initState() {
super.initState();
@ -25,26 +25,7 @@ final JPush jpush = new JPush();
String platformVersion;
// Platform messages may fail, so we use a try/catch PlatformException.
jpush.getRegistrationID().then((rid) {
setState(() {
debugLable = "flutter getRegistrationID: $rid";
});
});
jpush.setup(
appKey: "a1703c14b186a68a66ef86c1",
channel: "theChannel",
production: false,
debug: true,
);
jpush.applyPushAuthority(new NotificationSettingsIOS(
sound: true,
alert: true,
badge: true));
try {
jpush.addEventHandler(
onReceiveNotification: (Map<String, dynamic> message) async {
print("flutter onReceiveNotification: $message");
@ -70,6 +51,28 @@ final JPush jpush = new JPush();
platformVersion = 'Failed to get platform version.';
}
jpush.setup(
appKey: "你自己应用的 AppKey",
channel: "theChannel",
production: false,
debug: true,
);
jpush.applyPushAuthority(new NotificationSettingsIOS(
sound: true,
alert: true,
badge: true));
// Platform messages may fail, so we use a try/catch PlatformException.
jpush.getRegistrationID().then((rid) {
print("flutter get registration id : $rid");
setState(() {
debugLable = "flutter getRegistrationID: $rid";
});
});
// If the widget was removed from the tree while the asynchronous platform
// message was in flight, we want to discard the reply rather than calling
// setState to update our non-existent appearance.
@ -94,9 +97,11 @@ final JPush jpush = new JPush();
child: new Column(
children:[
new Text('result: $debugLable\n'),
new FlatButton(
child: new Text('sendLocalNotification\n'),
onPressed: () {
new Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Text(" "),
new CustomButton(title: "sendLocalNotification", onPressed: (){
//
var fireDate = DateTime.fromMillisecondsSinceEpoch(DateTime.now().millisecondsSinceEpoch + 3000);
var localNotification = LocalNotification(
@ -114,12 +119,9 @@ final JPush jpush = new JPush();
debugLable = res;
});
});
}),
new FlatButton(
child: new Text('getLaunchAppNotification\n'),
onPressed: () {
new Text(" "),
new CustomButton(title: "getLaunchAppNotification", onPressed: (){
jpush.getLaunchAppNotification().then((map) {
setState(() {
debugLable = "getLaunchAppNotification success: $map";
@ -130,16 +132,13 @@ final JPush jpush = new JPush();
debugLable = "getLaunchAppNotification error: $error";
});
});
}),
new FlatButton(
child: new Text('applyPushAuthority\n'),
onPressed: () {
jpush.applyPushAuthority(NotificationSettingsIOS(badge: true, alert: true, sound: true));
}),
new FlatButton(
child: new Text('setTags\n'),
onPressed: () {
]),
new Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Text(" "),
new CustomButton(title: "setTags", onPressed: (){
jpush.setTags(["lala","haha"]).then((map) {
var tags = map['tags'];
setState(() {
@ -152,42 +151,21 @@ final JPush jpush = new JPush();
});
}) ;
}),
new FlatButton(
child: new Text('cleanTags\n'),
onPressed: () {
jpush.cleanTags().then((map) {
var tags = map['tags'];
setState(() {
debugLable = "cleanTags success: $map $tags";
});
})
.catchError((error) {
setState(() {
debugLable = "cleanTags error: $error";
});
}) ;
}),
new FlatButton(
child: new Text('addTags\n'),
onPressed: () {
new Text(" "),
new CustomButton(title: "addTags", onPressed: (){
jpush.addTags(["lala","haha"]).then((map) {
var tags = map['tags'];
setState(() {
debugLable = "addTags success: $map $tags";
});
})
.catchError((error) {
}).catchError((error) {
setState(() {
debugLable = "addTags error: $error";
});
}) ;
}),
new FlatButton(
child: new Text('deleteTags\n'),
onPressed: () {
new Text(" "),
new CustomButton(title: "deleteTags", onPressed: (){
jpush.deleteTags(["lala","haha"]).then((map) {
var tags = map['tags'];
setState(() {
@ -199,12 +177,14 @@ final JPush jpush = new JPush();
debugLable = "deleteTags error: $error";
});
}) ;
}),
new FlatButton(
child: new Text('getAllTags\n'),
onPressed: () {
]
),
new Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Text(" "),
new CustomButton(title: "getAllTags", onPressed: (){
jpush.getAllTags().then((map) {
setState(() {
debugLable = "getAllTags success: $map";
@ -215,12 +195,28 @@ final JPush jpush = new JPush();
debugLable = "getAllTags error: $error";
});
}) ;
}),
new FlatButton(
child: new Text('setAlias\n'),
onPressed: () {
new Text(" "),
new CustomButton(title: "cleanTags", onPressed: (){
jpush.cleanTags().then((map) {
var tags = map['tags'];
setState(() {
debugLable = "cleanTags success: $map $tags";
});
})
.catchError((error) {
setState(() {
debugLable = "cleanTags error: $error";
});
}) ;
}),
]
),
new Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Text(" "),
new CustomButton(title: "setAlias", onPressed: (){
jpush.setAlias("thealias11").then((map) {
setState(() {
debugLable = "setAlias success: $map";
@ -231,12 +227,9 @@ final JPush jpush = new JPush();
debugLable = "setAlias error: $error";
});
}) ;
}),
new FlatButton(
child: new Text('deleteAlias\n'),
onPressed: () {
new Text(" "),
new CustomButton(title: "deleteAlias", onPressed: (){
jpush.deleteAlias().then((map) {
setState(() {
debugLable = "deleteAlias success: $map";
@ -247,12 +240,32 @@ final JPush jpush = new JPush();
debugLable = "deleteAlias error: $error";
});
}) ;
}),
new FlatButton(
child: new Text('setBadge\n'),
onPressed: () {
]
),
new Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Text(" "),
new CustomButton(title: "stopPush",onPressed: (){
jpush.stopPush();
}),
new Text(" "),
new CustomButton(title: "resumePush", onPressed: (){
jpush.resumePush();
}),
],
),
new Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Text(" "),
new CustomButton(title: "clearAllNotifications",onPressed: (){
jpush.clearAllNotifications();
}),
new Text(" "),
new CustomButton(title: "setBadge", onPressed: (){
jpush.setBadge(66).then((map) {
setState(() {
debugLable = "setBadge success: $map";
@ -262,37 +275,35 @@ final JPush jpush = new JPush();
setState(() {
debugLable = "setBadge error: $error";
});
}) ;
}),
new FlatButton(
child: new Text('stopPush\n'),
onPressed: () {
jpush.stopPush();
}),
new FlatButton(
child: new Text('resumePush\n'),
onPressed: () {
jpush.resumePush();
}),
new FlatButton(
child: new Text('clearAllNotifications\n'),
onPressed: () {
jpush.clearAllNotifications();
});
}),
],
),
]
)
),
),
);
}
}
///
class CustomButton extends StatelessWidget {
final VoidCallback onPressed;
final String title;
const CustomButton({@required this.onPressed, @required this.title});
@override
Widget build(BuildContext context) {
return new FlatButton(
onPressed: onPressed,
child: new Text("$title"),
color: Color(0xff585858),
highlightColor: Color(0xff888888),
splashColor: Color(0xff888888),
textColor: Colors.white,
//padding: EdgeInsets.fromLTRB(5, 5, 5, 5),
);
}
}

@ -21,14 +21,14 @@ packages:
name: async
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.0"
version: "2.3.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.4"
version: "1.0.5"
charcode:
dependency: transitive
description:
@ -136,7 +136,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.2.0"
version: "0.3.0"
js:
dependency: transitive
description:
@ -171,7 +171,7 @@ packages:
name: meta
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.6"
version: "1.1.7"
mime:
dependency: transitive
description:
@ -220,14 +220,14 @@ packages:
name: path
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.6.2"
version: "1.6.4"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.7.0"
version: "1.8.0+1"
platform:
dependency: transitive
description:
@ -255,7 +255,7 @@ packages:
name: quiver
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.3"
version: "2.0.5"
shelf:
dependency: transitive
description:
@ -330,7 +330,7 @@ packages:
name: string_scanner
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.4"
version: "1.0.5"
term_glyph:
dependency: transitive
description:

@ -5,7 +5,7 @@
#import <JPush/JPUSHService.h>
#define JPLog(fmt, ...) NSLog((@"| JPUSH | iOS | " fmt), ##__VA_ARGS__)
#define JPLog(fmt, ...) NSLog((@"| JPUSH | Flutter | iOS | " fmt), ##__VA_ARGS__)
@interface NSError (FlutterError)
@property(readonly, nonatomic) FlutterError *flutterError;
@ -140,9 +140,12 @@ static NSMutableArray<FlutterResult>* getRidResults;
} else if([@"stopPush" isEqualToString:call.method]) {
[self stopPush:call result:result];
} else if([@"resumePush" isEqualToString:call.method]) {
[self applyPushAuthority:call result:result];
JPLog(@"ios platform not support resume push.");
//[self applyPushAuthority:call result:result];
} else if([@"clearAllNotifications" isEqualToString:call.method]) {
[self clearAllNotifications:call result:result];
} else if ([@"clearNotification" isEqualToString:call.method]) {
[self clearNotification:call result:result];
} else if([@"getLaunchAppNotification" isEqualToString:call.method]) {
[self getLaunchAppNotification:call result:result];
} else if([@"getRegistrationID" isEqualToString:call.method]) {
@ -307,10 +310,37 @@ static NSMutableArray<FlutterResult>* getRidResults;
JPLog(@"stopPush:");
[[UIApplication sharedApplication] unregisterForRemoteNotifications];
}
- (void)clearAllNotifications:(FlutterMethodCall*)call result:(FlutterResult)result {
JPLog(@"clearAllNotifications:");
[[UIApplication sharedApplication] setApplicationIconBadgeNumber: 0];
if (@available(iOS 10.0, *)) {
//iOS 10 以上支持
JPushNotificationIdentifier *identifier = [[JPushNotificationIdentifier alloc] init];
identifier.identifiers = nil;
identifier.delivered = YES; //等于 YES 则移除所有在通知中心显示的,等于 NO 则为移除所有待推送的
[JPUSHService removeNotification:identifier];
} else {
// iOS 10 以下移除所有推送;iOS 10 以上移除所有在通知中心显示推送和待推送请求
[JPUSHService removeNotification:nil];
}
}
- (void)clearNotification:(FlutterMethodCall*)call result:(FlutterResult)result {
JPLog(@"clearNotification:");
NSNumber *notificationId = call.arguments;
if (!notificationId) {
return ;
}
JPushNotificationIdentifier *identifier = [[JPushNotificationIdentifier alloc] init];
identifier.identifiers = @[notificationId.stringValue];
if (@available(iOS 10.0, *)) {
//iOS 10 以上有效,等于 YES 则在通知中心显示的里面移除,等于 NO 则为在待推送的里面移除;iOS 10 以下无效
identifier.delivered = YES;
} else {
// Fallback on earlier versions
}
[JPUSHService removeNotification:identifier];
}
- (void)getLaunchAppNotification:(FlutterMethodCall*)call result:(FlutterResult)result {
@ -416,8 +446,7 @@ static NSMutableArray<FlutterResult>* getRidResults;
#pragma mark - AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
if (launchOptions != nil) {
_launchNotification = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey];
@ -442,12 +471,12 @@ didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
// _resumingFromBackground = YES;
// _resumingFromBackground = YES;
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
// application.applicationIconBadgeNumber = 1;
// application.applicationIconBadgeNumber = 0;
// application.applicationIconBadgeNumber = 1;
// application.applicationIconBadgeNumber = 0;
}
- (bool)application:(UIApplication *)application

@ -10,7 +10,7 @@ A new flutter plugin project.
DESC
s.homepage = 'http://example.com'
s.license = { :file => '../LICENSE' }
s.author = { 'huminios' => '380108184@qq.com' }
s.author = { 'xudong.rao' => 'xudong.rao@outlook.com' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h'
@ -20,4 +20,3 @@ A new flutter plugin project.
s.ios.deployment_target = '8.0'
s.static_framework = true
end

@ -3,7 +3,6 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:platform/platform.dart';
typedef Future<dynamic> EventHandler(Map<String, dynamic> event);
class JPush {
@ -18,9 +17,8 @@ class JPush {
: _channel = channel,
_platform = platform;
static final JPush _instance = new JPush.private(
const MethodChannel('jpush'),
const LocalPlatform());
static final JPush _instance =
new JPush.private(const MethodChannel('jpush'), const LocalPlatform());
EventHandler _onReceiveNotification;
EventHandler _onOpenNotification;
@ -34,8 +32,14 @@ class JPush {
}) {
print(flutter_log + "setup:");
_channel.invokeMethod('setup', { 'appKey': appKey, 'channel': channel, 'production': production, 'debug': debug});
_channel.invokeMethod('setup', {
'appKey': appKey,
'channel': channel,
'production': production,
'debug': debug
});
}
///
/// JPush ()
///
@ -70,7 +74,8 @@ class JPush {
///
///
///
void applyPushAuthority([NotificationSettingsIOS iosSettings = const NotificationSettingsIOS()]) {
void applyPushAuthority(
[NotificationSettingsIOS iosSettings = const NotificationSettingsIOS()]) {
print(flutter_log + "applyPushAuthority:");
if (!_platform.isIOS) {
@ -90,7 +95,8 @@ class JPush {
Future<Map<dynamic, dynamic>> setTags(List<String> tags) async {
print(flutter_log + "setTags:");
final Map<dynamic, dynamic> result = await _channel.invokeMethod('setTags', tags);
final Map<dynamic, dynamic> result =
await _channel.invokeMethod('setTags', tags);
return result;
}
@ -103,7 +109,8 @@ class JPush {
Future<Map<dynamic, dynamic>> cleanTags() async {
print(flutter_log + "cleanTags:");
final Map<dynamic, dynamic> result = await _channel.invokeMethod('cleanTags');
final Map<dynamic, dynamic> result =
await _channel.invokeMethod('cleanTags');
return result;
}
@ -118,7 +125,8 @@ class JPush {
Future<Map<dynamic, dynamic>> addTags(List<String> tags) async {
print(flutter_log + "addTags:");
final Map<dynamic, dynamic> result = await _channel.invokeMethod('addTags', tags);
final Map<dynamic, dynamic> result =
await _channel.invokeMethod('addTags', tags);
return result;
}
@ -132,7 +140,8 @@ class JPush {
Future<Map<dynamic, dynamic>> deleteTags(List<String> tags) async {
print(flutter_log + "deleteTags:");
final Map<dynamic, dynamic> result = await _channel.invokeMethod('deleteTags', tags);
final Map<dynamic, dynamic> result =
await _channel.invokeMethod('deleteTags', tags);
return result;
}
@ -145,7 +154,8 @@ class JPush {
Future<Map<dynamic, dynamic>> getAllTags() async {
print(flutter_log + "getAllTags:");
final Map<dynamic, dynamic> result = await _channel.invokeMethod('getAllTags');
final Map<dynamic, dynamic> result =
await _channel.invokeMethod('getAllTags');
return result;
}
@ -160,7 +170,8 @@ class JPush {
Future<Map<dynamic, dynamic>> setAlias(String alias) async {
print(flutter_log + "setAlias:");
final Map<dynamic, dynamic> result = await _channel.invokeMethod('setAlias', alias);
final Map<dynamic, dynamic> result =
await _channel.invokeMethod('setAlias', alias);
return result;
}
@ -173,7 +184,8 @@ class JPush {
Future<Map<dynamic, dynamic>> deleteAlias() async {
print(flutter_log + "deleteAlias:");
final Map<dynamic, dynamic> result = await _channel.invokeMethod('deleteAlias');
final Map<dynamic, dynamic> result =
await _channel.invokeMethod('deleteAlias');
return result;
}
@ -187,7 +199,7 @@ class JPush {
Future setBadge(int badge) async {
print(flutter_log + "setBadge:");
await _channel.invokeMethod('setBadge', {"badge":badge});
await _channel.invokeMethod('setBadge', {"badge": badge});
}
///
@ -217,6 +229,15 @@ class JPush {
await _channel.invokeMethod('clearAllNotifications');
}
///
///
/// @param notificationId idLocalNotification id
///
void clearNotification({@required int notificationId}) {
print(flutter_log + "clearNotification:");
_channel.invokeListMethod("clearNotification",notificationId);
}
///
/// iOS Only
/// notification notification
@ -227,7 +248,8 @@ class JPush {
Future<Map<dynamic, dynamic>> getLaunchAppNotification() async {
print(flutter_log + "getLaunchAppNotification:");
final Map<dynamic, dynamic> result = await _channel.invokeMethod('getLaunchAppNotification');
final Map<dynamic, dynamic> result =
await _channel.invokeMethod('getLaunchAppNotification');
return result;
}
@ -255,6 +277,8 @@ class JPush {
return notification.toMap().toString();
}
}
class NotificationSettingsIOS {
@ -262,7 +286,7 @@ class NotificationSettingsIOS {
final bool alert;
final bool badge;
const NotificationSettingsIOS ({
const NotificationSettingsIOS({
this.sound = true,
this.alert = true,
this.badge = true,
@ -273,37 +297,31 @@ class NotificationSettingsIOS {
}
}
/// @property {number} [buildId] - 1 2 `setStyleCustom`
/// @property {number} [id] - id,
/// @property {string} [title] -
/// @property {string} [content] -
/// @property {object} [extra] - extra
/// @property {number} [fireTime] -
/// // iOS Only
/// @property {number} [badge] -
/// // iOS Only
/// @property {string} [soundName] -
/// // iOS 10+ Only
/// @property {string} [subtitle] -
/// @property {number} [buildId] - 1 2 `setStyleCustom`
/// @property {number} [id] - id,
/// @property {string} [title] -
/// @property {string} [content] -
/// @property {object} [extra] - extra
/// @property {number} [fireTime] -
/// // iOS Only
/// @property {number} [badge] -
/// // iOS Only
/// @property {string} [soundName] -
/// // iOS 10+ Only
/// @property {string} [subtitle] -
class LocalNotification {
final int buildId;//?
final int buildId; //?
final int id;
final String title;
final String content;
final Map<String, String> extra;//?
final Map<String, String> extra; //?
final DateTime fireTime;
final int badge;//?
final String soundName;//?
final String subtitle;//?
final int badge; //?
final String soundName; //?
final String subtitle; //?
const LocalNotification ({
@required this.id,
const LocalNotification(
{@required this.id,
@required this.title,
@required this.content,
@required this.fireTime,
@ -311,9 +329,8 @@ class LocalNotification {
this.extra,
this.badge = 0,
this.soundName,
this.subtitle
}):
assert(id != null),
this.subtitle})
: assert(id != null),
assert(title != null),
assert(content != null),
assert(fireTime != null);
@ -329,7 +346,6 @@ class LocalNotification {
'badge': badge,
'soundName': soundName,
'subtitle': subtitle
}..removeWhere((key, value)=>value==null);
}..removeWhere((key, value) => value == null);
}
}

@ -145,7 +145,7 @@ packages:
name: meta
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.6"
version: "1.1.7"
mime:
dependency: transitive
description:

@ -1,7 +1,7 @@
name: jpush_flutter
description: Offically supported JPush Flutter plugin.
version: 0.2.0
author: huminios <h380108184@gmail.com>
version: 0.3.0
author: xudong.rao <xudong.rao@outlook.com>
homepage: https://www.jiguang.cn
environment:

Loading…
Cancel
Save