Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
flutter_push
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
zhuguoming
2025-02-25 15:05:23 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
a0aa49f5ed098bfc1a8c2e74f68adec77f024e79
a0aa49f5
2 parents
66f3011c
9820c6d4
Merge branch 'master' of
http://gitlab.boeart.cn/flutter_package/flutter_push
合并
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
15 deletions
android/src/main/kotlin/com/ewin/flutter_push/EwinMixPushReceiver.kt
android/src/main/kotlin/com/ewin/flutter_push/FlutterPushPlugin.kt
lib/flutter_push.dart
lib/flutter_push_method_channel.dart
lib/flutter_push_platform_interface.dart
android/src/main/kotlin/com/ewin/flutter_push/EwinMixPushReceiver.kt
View file @
a0aa49f
...
...
@@ -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
}
if(FlutterPushPlugin.isInit()){
this.invokeListener(MixListenerTypeEnum.NotificationMessageClicked, message)
}
// var intent: Intent? = null
// if (message.payload == null) {
...
...
android/src/main/kotlin/com/ewin/flutter_push/FlutterPushPlugin.kt
View file @
a0aa49f
...
...
@@ -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()
}
...
...
lib/flutter_push.dart
View file @
a0aa49f
...
...
@@ -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
();
}
}
...
...
lib/flutter_push_method_channel.dart
View file @
a0aa49f
...
...
@@ -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'
);
}
}
...
...
lib/flutter_push_platform_interface.dart
View file @
a0aa49f
...
...
@@ -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
(
'
platformVer
sion() has not been implemented.'
);
throw
UnimplementedError
(
'
checkPermis
sion() has not been implemented.'
);
}
Future
<
bool
>
getPermission
()
async
{
throw
UnimplementedError
(
'
platformVer
sion() has not been implemented.'
);
throw
UnimplementedError
(
'
getPermis
sion() 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.'
);
}
}
...
...
Please
register
or
login
to post a comment