udpate comments

master
huangminlinux 6 years ago
parent 6edcc0eb3e
commit 4f66e022b0

@ -1,7 +1,7 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'dart:io' show Platform, stdout; import 'dart:io' show Platform;
typedef Future<dynamic> EventHandler(Map<String, dynamic> event); typedef Future<dynamic> EventHandler(Map<String, dynamic> event);
@ -19,16 +19,6 @@ class JPush {
static EventHandler _onOpenNotification; static EventHandler _onOpenNotification;
static EventHandler _onReceiveMessage; static EventHandler _onReceiveMessage;
// <String, dynamic>{
// 'source': source.index,
// 'maxWidth': maxWidth,
// 'maxHeight': maxHeight,
// }
/**
*
*/
static void setup({ static void setup({
String appKey, String appKey,
String channel, String channel,
@ -36,9 +26,9 @@ class JPush {
}) { }) {
_channel.invokeMethod('setup', { 'appKey': appKey, 'channel': channel, 'production': production }); _channel.invokeMethod('setup', { 'appKey': appKey, 'channel': channel, 'production': production });
} }
/** ///
* JPush () /// JPush ()
*/ ///
static void addEventHandler({ static void addEventHandler({
EventHandler onReceiveNotification, EventHandler onReceiveNotification,
EventHandler onOpenNotification, EventHandler onOpenNotification,
@ -63,12 +53,10 @@ class JPush {
} }
} }
/** ///
* ///
*/ ///
static Future applyPushAuthority([NotificationSettingsIOS iosSettings = const NotificationSettingsIOS()]) { static Future applyPushAuthority([NotificationSettingsIOS iosSettings = const NotificationSettingsIOS()]) {
// TODO:
// await _channel.invokeMethod('applyPushAuthority');
if (!Platform.isIOS) { if (!Platform.isIOS) {
return; return;
@ -77,137 +65,137 @@ class JPush {
_channel.invokeMethod('applyPushAuthority', iosSettings.toMap()); _channel.invokeMethod('applyPushAuthority', iosSettings.toMap());
} }
/** ///
* Tag tags /// Tag tags
* ///
* @param {Array} params = [String] /// @param {Array} params = [String]
* @param {Function} success = ({"tags":[String]}) => { } /// @param {Function} success = ({"tags":[String]}) => { }
* @param {Function} fail = ({"errorCode":int}) => { } /// @param {Function} fail = ({"errorCode":int}) => { }
*/ ///
static Future<Map<dynamic, dynamic>> setTags(List<String> tags) async { static Future<Map<dynamic, dynamic>> setTags(List<String> tags) async {
final Map<dynamic, dynamic> result = await _channel.invokeMethod('setTags', tags); final Map<dynamic, dynamic> result = await _channel.invokeMethod('setTags', tags);
return result; return result;
} }
/** ///
* tags /// tags
* ///
* @param {Function} success = ({"tags":[String]}) => { } /// @param {Function} success = ({"tags":[String]}) => { }
* @param {Function} fail = ({"errorCode":int}) => { } /// @param {Function} fail = ({"errorCode":int}) => { }
*/ ///
static Future<Map<dynamic, dynamic>> cleanTags() async { static Future<Map<dynamic, dynamic>> cleanTags() async {
final Map<dynamic, dynamic> result = await _channel.invokeMethod('cleanTags'); final Map<dynamic, dynamic> result = await _channel.invokeMethod('cleanTags');
return result; return result;
} }
/** ///
* tags tags /// tags tags
* ///
* @param {Array} tags = [String] /// @param {Array} tags = [String]
* @param {Function} success = ({"tags":[String]}) => { } /// @param {Function} success = ({"tags":[String]}) => { }
* @param {Function} fail = ({"errorCode":int}) => { } /// @param {Function} fail = ({"errorCode":int}) => { }
*/ ///
static Future<Map<dynamic, dynamic>> addTags(List<String> tags) async { static Future<Map<dynamic, dynamic>> addTags(List<String> tags) async {
final Map<dynamic, dynamic> result = await _channel.invokeMethod('addTags', tags); final Map<dynamic, dynamic> result = await _channel.invokeMethod('addTags', tags);
return result; return result;
} }
/** ///
* tags /// tags
* ///
* @param {Array} tags = [String] /// @param {Array} tags = [String]
* @param {Function} success = ({"tags":[String]}) => { } /// @param {Function} success = ({"tags":[String]}) => { }
* @param {Function} fail = ({"errorCode":int}) => { } /// @param {Function} fail = ({"errorCode":int}) => { }
*/ ///
static Future<Map<dynamic, dynamic>> deleteTags(List<String> tags) async { static Future<Map<dynamic, dynamic>> deleteTags(List<String> tags) async {
final Map<dynamic, dynamic> result = await _channel.invokeMethod('deleteTags', tags); final Map<dynamic, dynamic> result = await _channel.invokeMethod('deleteTags', tags);
return result; return result;
} }
/** ///
* tags /// tags
* ///
* @param {Function} success = ({"tags":[String]}) => { } /// @param {Function} success = ({"tags":[String]}) => { }
* @param {Function} fail = ({"errorCode":int}) => { } /// @param {Function} fail = ({"errorCode":int}) => { }
*/ ///
static Future<Map<dynamic, dynamic>> getAllTags() async { static Future<Map<dynamic, dynamic>> getAllTags() async {
final Map<dynamic, dynamic> result = await _channel.invokeMethod('getAllTags'); final Map<dynamic, dynamic> result = await _channel.invokeMethod('getAllTags');
return result; return result;
} }
/** ///
* alias. /// alias.
* ///
* @param {String} alias /// @param {String} alias
* ///
* @param {Function} success = ({"alias":String}) => { } /// @param {Function} success = ({"alias":String}) => { }
* @param {Function} fail = ({"errorCode":int}) => { } /// @param {Function} fail = ({"errorCode":int}) => { }
*/ ///
static Future<Map<dynamic, dynamic>> setAlias(String alias) async { static Future<Map<dynamic, dynamic>> setAlias(String alias) async {
final Map<dynamic, dynamic> result = await _channel.invokeMethod('setAlias', alias); final Map<dynamic, dynamic> result = await _channel.invokeMethod('setAlias', alias);
return result; return result;
} }
/** ///
* alias /// alias
* ///
* @param {Function} success = ({"alias":String}) => { } /// @param {Function} success = ({"alias":String}) => { }
* @param {Function} fail = ({"errorCode":int}) => { } /// @param {Function} fail = ({"errorCode":int}) => { }
*/ ///
static Future<Map<dynamic, dynamic>> deleteAlias() async { static Future<Map<dynamic, dynamic>> deleteAlias() async {
final Map<dynamic, dynamic> result = await _channel.invokeMethod('deleteAlias'); final Map<dynamic, dynamic> result = await _channel.invokeMethod('deleteAlias');
return result; return result;
} }
/** ///
* iOS Only /// iOS Only
* Badge /// Badge
* ///
* @param {Int} badge /// @param {Int} badge
*/ ///
static Future setBadge(int badge) async { static Future setBadge(int badge) async {
await _channel.invokeMethod('setBadge', badge); await _channel.invokeMethod('setBadge', badge);
} }
/** ///
* resumePush /// resumePush
*/ ///
static Future stopPush() async { static Future stopPush() async {
await _channel.invokeMethod('stopPush'); await _channel.invokeMethod('stopPush');
} }
/** ///
* ///
*/ ///
static Future resumePush() async { static Future resumePush() async {
await _channel.invokeMethod('resumePush'); await _channel.invokeMethod('resumePush');
} }
/** ///
* ///
*/ ///
static Future clearAllNotifications() async { static Future clearAllNotifications() async {
await _channel.invokeMethod('clearAllNotifications'); await _channel.invokeMethod('clearAllNotifications');
} }
/** ///
* iOS Only /// iOS Only
* notification notification /// notification notification
* notification remoteNotification localNotification /// notification remoteNotification localNotification
* icon notification @{} /// icon notification @{}
* @param {Function} callback = (Object) => {} /// @param {Function} callback = (Object) => {}
*/ ///
static Future<Map<dynamic, dynamic>> getLaunchAppNotification() async { static Future<Map<dynamic, dynamic>> getLaunchAppNotification() async {
final Map<dynamic, dynamic> result = await _channel.invokeMethod('getLaunchAppNotification'); final Map<dynamic, dynamic> result = await _channel.invokeMethod('getLaunchAppNotification');
return result; return result;
} }
/** ///
* RegistrationId, JPush RegistrationId /// RegistrationId, JPush RegistrationId
* ///
* * @param {Function} callback = (String) => {} /// @param {Function} callback = (String) => {}
*/ ///
static Future<String> getRegistrationID() async { static Future<String> getRegistrationID() async {
final String rid = await _channel.invokeMethod('getRegistrationID'); final String rid = await _channel.invokeMethod('getRegistrationID');
return rid; return rid;

Loading…
Cancel
Save