zhuguoming
... ... @@ -32,12 +32,12 @@ class EwinMixPushReceiver : MixPushReceiver() {
}
override fun onNotificationMessageClicked(context: Context, message: MixPushMessage) {
if(!FlutterPushPlugin.isInit()){
FlutterPushPlugin.lastMsg = message
context.startActivity(context.packageManager.getLaunchIntentForPackage(context.packageName))
return
FlutterPushPlugin.lastMsg = message
context.startActivity(context.packageManager.getLaunchIntentForPackage(context.packageName))
if(FlutterPushPlugin.isInit()){
this.invokeListener(MixListenerTypeEnum.NotificationMessageClicked, message)
}
this.invokeListener(MixListenerTypeEnum.NotificationMessageClicked, message)
// var intent: Intent? = null
// if (message.payload == null) {
... ...
... ... @@ -25,7 +25,7 @@ import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.provider.Settings;
import android.util.Log
/** FlutterPushPlugin */
... ... @@ -50,6 +50,10 @@ class FlutterPushPlugin: FlutterPlugin, MethodCallHandler {
}
override fun onMethodCall(call: MethodCall, result: Result) {
Log.d("onMethodCall", "${call.method}")
if (call.method == "getPlatformVersion") {
result.success("Android ${android.os.Build.VERSION.RELEASE}")
} else if (call.method == "init") {
... ... @@ -83,6 +87,9 @@ class FlutterPushPlugin: FlutterPlugin, MethodCallHandler {
NotificationManagerUtils.openPermissionSetting(context)
}
result.success(true)
} else if (call.method == "msgReceive") {
lastMsg = null
result.success(true)
} else {
result.notImplemented()
}
... ...
... ... @@ -8,7 +8,7 @@ class FlutterPush {
return FlutterPushPlatform.instance.getPlatformVersion();
}
Future<void> init({
Future<bool> init({
String? defaultPlatform,
String? appId,
String? appKey,
... ... @@ -31,4 +31,8 @@ class FlutterPush {
void removeListener(ListenerValue func) {
FlutterPushPlatform.instance.removeListener(func);
}
void msgReceive() {
FlutterPushPlatform.instance.msgReceive();
}
}
... ...
... ... @@ -21,7 +21,7 @@ class MethodChannelFlutterPush extends FlutterPushPlatform {
/// 初始化,如果没有appId或appKey,请登录小米开发者中心申请
/// [appId] 应用appId
/// [appKey] 应用appKey
Future<void> init({
Future<bool> init({
String? defaultPlatform,
String? appId,
String? appKey,
... ... @@ -57,4 +57,9 @@ class MethodChannelFlutterPush extends FlutterPushPlatform {
Future<String?> getRegId() async {
return await methodChannel.invokeMethod('getRegId');
}
/// 获取客户端的 RegId
Future<bool> msgReceive() async {
return await methodChannel.invokeMethod('msgReceive');
}
}
... ...
... ... @@ -28,39 +28,42 @@ abstract class FlutterPushPlatform extends PlatformInterface {
throw UnimplementedError('platformVersion() has not been implemented.');
}
/// 初始化,如果没有appId或appKey,请登录小米开发者中心申请
/// [appId] 应用appId
/// [appKey] 应用appKey
Future<void> init({
Future<bool> init({
String? defaultPlatform,
String? appId,
String? appKey,
}) async {
throw UnimplementedError('platformVersion() has not been implemented.');
throw UnimplementedError('init() has not been implemented.');
}
Future<bool> checkPermission() async {
throw UnimplementedError('platformVersion() has not been implemented.');
throw UnimplementedError('checkPermission() has not been implemented.');
}
Future<bool> getPermission() async {
throw UnimplementedError('platformVersion() has not been implemented.');
throw UnimplementedError('getPermission() has not been implemented.');
}
/// 添加消息监听
void addListener(ListenerValue func) {
throw UnimplementedError('platformVersion() has not been implemented.');
throw UnimplementedError('addListener() has not been implemented.');
}
/// 移除消息监听
void removeListener(ListenerValue func) {
throw UnimplementedError('platformVersion() has not been implemented.');
throw UnimplementedError('removeListener() has not been implemented.');
}
/// 获取客户端的 RegId
Future<String?> getRegId() async {
throw UnimplementedError('platformVersion() has not been implemented.');
throw UnimplementedError('getRegId() has not been implemented.');
}
/// 获取客户端的 RegId
Future<bool> msgReceive() async {
throw UnimplementedError('msgReceive() has not been implemented.');
}
}
... ...