Showing
5 changed files
with
26 additions
and
9 deletions
@@ -32,12 +32,12 @@ class EwinMixPushReceiver : MixPushReceiver() { | @@ -32,12 +32,12 @@ class EwinMixPushReceiver : MixPushReceiver() { | ||
32 | } | 32 | } |
33 | 33 | ||
34 | override fun onNotificationMessageClicked(context: Context, message: MixPushMessage) { | 34 | override fun onNotificationMessageClicked(context: Context, message: MixPushMessage) { |
35 | - if(!FlutterPushPlugin.isInit()){ | 35 | + |
36 | FlutterPushPlugin.lastMsg = message | 36 | FlutterPushPlugin.lastMsg = message |
37 | context.startActivity(context.packageManager.getLaunchIntentForPackage(context.packageName)) | 37 | context.startActivity(context.packageManager.getLaunchIntentForPackage(context.packageName)) |
38 | - return | ||
39 | - } | 38 | + if(FlutterPushPlugin.isInit()){ |
40 | this.invokeListener(MixListenerTypeEnum.NotificationMessageClicked, message) | 39 | this.invokeListener(MixListenerTypeEnum.NotificationMessageClicked, message) |
40 | + } | ||
41 | 41 | ||
42 | // var intent: Intent? = null | 42 | // var intent: Intent? = null |
43 | // if (message.payload == null) { | 43 | // if (message.payload == null) { |
@@ -83,6 +83,9 @@ class FlutterPushPlugin: FlutterPlugin, MethodCallHandler { | @@ -83,6 +83,9 @@ class FlutterPushPlugin: FlutterPlugin, MethodCallHandler { | ||
83 | NotificationManagerUtils.openPermissionSetting(context) | 83 | NotificationManagerUtils.openPermissionSetting(context) |
84 | } | 84 | } |
85 | result.success(true) | 85 | result.success(true) |
86 | + } else if (call.method == "msgReceive") { | ||
87 | + lastMsg = null | ||
88 | + result.success(true) | ||
86 | } else { | 89 | } else { |
87 | result.notImplemented() | 90 | result.notImplemented() |
88 | } | 91 | } |
@@ -31,4 +31,8 @@ class FlutterPush { | @@ -31,4 +31,8 @@ class FlutterPush { | ||
31 | void removeListener(ListenerValue func) { | 31 | void removeListener(ListenerValue func) { |
32 | FlutterPushPlatform.instance.removeListener(func); | 32 | FlutterPushPlatform.instance.removeListener(func); |
33 | } | 33 | } |
34 | + | ||
35 | + void msgReceive() { | ||
36 | + FlutterPushPlatform.instance.msgReceive(); | ||
37 | + } | ||
34 | } | 38 | } |
@@ -57,4 +57,9 @@ class MethodChannelFlutterPush extends FlutterPushPlatform { | @@ -57,4 +57,9 @@ class MethodChannelFlutterPush extends FlutterPushPlatform { | ||
57 | Future<String?> getRegId() async { | 57 | Future<String?> getRegId() async { |
58 | return await methodChannel.invokeMethod('getRegId'); | 58 | return await methodChannel.invokeMethod('getRegId'); |
59 | } | 59 | } |
60 | + | ||
61 | + /// 获取客户端的 RegId | ||
62 | + Future<String?> msgReceive() async { | ||
63 | + return await methodChannel.invokeMethod('msgReceive'); | ||
64 | + } | ||
60 | } | 65 | } |
@@ -38,29 +38,34 @@ abstract class FlutterPushPlatform extends PlatformInterface { | @@ -38,29 +38,34 @@ abstract class FlutterPushPlatform extends PlatformInterface { | ||
38 | String? appId, | 38 | String? appId, |
39 | String? appKey, | 39 | String? appKey, |
40 | }) async { | 40 | }) async { |
41 | - throw UnimplementedError('platformVersion() has not been implemented.'); | 41 | + throw UnimplementedError('init() has not been implemented.'); |
42 | } | 42 | } |
43 | 43 | ||
44 | Future<bool> checkPermission() async { | 44 | Future<bool> checkPermission() async { |
45 | - throw UnimplementedError('platformVersion() has not been implemented.'); | 45 | + throw UnimplementedError('checkPermission() has not been implemented.'); |
46 | } | 46 | } |
47 | 47 | ||
48 | Future<bool> getPermission() async { | 48 | Future<bool> getPermission() async { |
49 | - throw UnimplementedError('platformVersion() has not been implemented.'); | 49 | + throw UnimplementedError('getPermission() has not been implemented.'); |
50 | } | 50 | } |
51 | 51 | ||
52 | /// 添加消息监听 | 52 | /// 添加消息监听 |
53 | void addListener(ListenerValue func) { | 53 | void addListener(ListenerValue func) { |
54 | - throw UnimplementedError('platformVersion() has not been implemented.'); | 54 | + throw UnimplementedError('addListener() has not been implemented.'); |
55 | } | 55 | } |
56 | 56 | ||
57 | /// 移除消息监听 | 57 | /// 移除消息监听 |
58 | void removeListener(ListenerValue func) { | 58 | void removeListener(ListenerValue func) { |
59 | - throw UnimplementedError('platformVersion() has not been implemented.'); | 59 | + throw UnimplementedError('removeListener() has not been implemented.'); |
60 | } | 60 | } |
61 | 61 | ||
62 | /// 获取客户端的 RegId | 62 | /// 获取客户端的 RegId |
63 | Future<String?> getRegId() async { | 63 | Future<String?> getRegId() async { |
64 | - throw UnimplementedError('platformVersion() has not been implemented.'); | 64 | + throw UnimplementedError('getRegId() has not been implemented.'); |
65 | + } | ||
66 | + | ||
67 | + /// 获取客户端的 RegId | ||
68 | + Future<String?> msgReceive() async { | ||
69 | + throw UnimplementedError('msgReceive() has not been implemented.'); | ||
65 | } | 70 | } |
66 | } | 71 | } |
-
Please register or login to post a comment