Skip to content

Commit 2dddc57

Browse files
authored
Merge pull request #94 from jpush/dev
v0.3.0
2 parents de83aaf + ead3665 commit 2dddc57

File tree

13 files changed

+949
-860
lines changed

13 files changed

+949
-860
lines changed

.packages

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated by pub on 2019-09-25 15:21:45.301321.
1+
# Generated by pub on 2019-11-19 13:53:32.095797.
22
analyzer:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/analyzer-0.37.0/lib/
33
args:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/args-1.5.2/lib/
44
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
1919
js:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/js-0.6.1+1/lib/
2020
kernel:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/kernel-0.3.20/lib/
2121
matcher:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/matcher-0.12.5/lib/
22-
meta:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/meta-1.1.6/lib/
22+
meta:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/meta-1.1.7/lib/
2323
mime:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/mime-0.9.6+3/lib/
2424
mockito:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/mockito-3.0.2/lib/
2525
multi_server_socket:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/multi_server_socket-1.0.2/lib/

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.3.0
2+
+ 新增:清除通知栏单条通知方法
3+
+ 修复:点击通知栏无法获取消息问题
4+
+ 同步最新版 SDK
15
## 0.2.0
26
+ 适配最新版本 JPush SDK
37
+ Android 支持设置角标 badge

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
```yaml
99
dependencies:
10-
jpush_flutter: 0.2.0
10+
jpush_flutter: 0.3.0
1111

1212
//github
1313
dependencies:

android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ android {
3434
}
3535

3636
dependencies {
37-
implementation 'cn.jiguang.sdk:jpush:3.3.4'
38-
implementation 'cn.jiguang.sdk:jcore:2.1.2'
37+
implementation 'cn.jiguang.sdk:jpush:3.4.0'
38+
implementation 'cn.jiguang.sdk:jcore:2.1.6'
3939
// implementation 'com.android.support:appcompat-v7:28.+'
4040
compileOnly files('libs/flutter.jar')
4141

android/src/main/java/com/jiguang/jpush/JPushPlugin.java

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import io.flutter.plugin.common.MethodChannel;
1313
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
1414
import io.flutter.plugin.common.MethodChannel.Result;
15+
import io.flutter.plugin.common.PluginRegistry;
1516
import io.flutter.plugin.common.PluginRegistry.Registrar;
1617

1718
import java.util.ArrayList;
@@ -23,17 +24,26 @@
2324
import java.util.Set;
2425

2526
import cn.jpush.android.api.JPushInterface;
27+
import io.flutter.view.FlutterNativeView;
2628

2729
/** JPushPlugin */
2830
public class JPushPlugin implements MethodCallHandler {
31+
2932
/** Plugin registration. */
3033
public static void registerWith(Registrar registrar) {
3134
final MethodChannel channel = new MethodChannel(registrar.messenger(), "jpush");
3235
channel.setMethodCallHandler(new JPushPlugin(registrar, channel));
33-
36+
37+
registrar.addViewDestroyListener(new PluginRegistry.ViewDestroyListener() {
38+
@Override
39+
public boolean onViewDestroy(FlutterNativeView flutterNativeView) {
40+
instance.dartIsReady = false;
41+
return false;
42+
}
43+
});
3444
}
3545

36-
private static String TAG = "| JPUSH | Android | ";
46+
private static String TAG = "| JPUSH | Flutter | Android | ";
3747
public static JPushPlugin instance;
3848
static List<Map<String, Object>> openNotificationCache = new ArrayList<>();
3949

@@ -86,6 +96,8 @@ public void onMethodCall(MethodCall call, Result result) {
8696
resumePush(call, result);
8797
} else if (call.method.equals("clearAllNotifications")) {
8898
clearAllNotifications(call, result);
99+
} else if (call.method.equals("clearNotification")) {
100+
clearNotification(call,result);
89101
} else if (call.method.equals("getLaunchAppNotification")) {
90102
getLaunchAppNotification(call, result);
91103
} else if (call.method.equals("getRegistrationID")) {
@@ -133,6 +145,7 @@ public void scheduleCache() {
133145
if (ridAvailable && dartIsReady) {
134146
// try to schedule get rid cache
135147
for (Result res: JPushPlugin.instance.getRidCache) {
148+
Log.d(TAG,"scheduleCache rid = " + rid);
136149
res.success(rid);
137150
JPushPlugin.instance.getRidCache.remove(res);
138151
}
@@ -220,6 +233,13 @@ public void clearAllNotifications(MethodCall call, Result result) {
220233

221234
JPushInterface.clearAllNotifications(registrar.context());
222235
}
236+
public void clearNotification(MethodCall call, Result result) {
237+
Log.d(TAG,"clearNotification: ");
238+
Object id = call.arguments;
239+
if (id != null) {
240+
JPushInterface.clearNotificationById(registrar.context(),(int)id);
241+
}
242+
}
223243

224244
public void getLaunchAppNotification(MethodCall call, Result result) {
225245
Log.d(TAG,"");
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
# This is a generated file; do not edit or check into version control.
3+
export "FLUTTER_ROOT=/Applications/flutter"
4+
export "FLUTTER_APPLICATION_PATH=/Users/raoxudong/JPush/jpush-github/jpush-flutter-plugin/example"
5+
export "FLUTTER_TARGET=lib/main.dart"
6+
export "FLUTTER_BUILD_DIR=build"
7+
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
8+
export "FLUTTER_FRAMEWORK_DIR=/Applications/flutter/bin/cache/artifacts/engine/ios"
9+
export "FLUTTER_BUILD_NAME=1.0.0"
10+
export "FLUTTER_BUILD_NUMBER=1"

0 commit comments

Comments
 (0)