Skip to content

Commit

Permalink
Merge pull request #94 from jpush/dev
Browse files Browse the repository at this point in the history
v0.3.0
  • Loading branch information
raoxudong authored Nov 19, 2019
2 parents de83aaf + ead3665 commit 2dddc57
Show file tree
Hide file tree
Showing 13 changed files with 949 additions and 860 deletions.
4 changes: 2 additions & 2 deletions .packages
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by pub on 2019-09-25 15:21:45.301321.
# Generated by pub on 2019-11-19 13:53:32.095797.
analyzer:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/analyzer-0.37.0/lib/
args:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/args-1.5.2/lib/
async:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/async-2.3.0/lib/
Expand All @@ -19,7 +19,7 @@ io:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/io-0.3.3/lib
js:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/js-0.6.1+1/lib/
kernel:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/kernel-0.3.20/lib/
matcher:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/matcher-0.12.5/lib/
meta:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/meta-1.1.6/lib/
meta:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/meta-1.1.7/lib/
mime:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/mime-0.9.6+3/lib/
mockito:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/mockito-3.0.2/lib/
multi_server_socket:file:///Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/multi_server_socket-1.0.2/lib/
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.0
+ 新增:清除通知栏单条通知方法
+ 修复:点击通知栏无法获取消息问题
+ 同步最新版 SDK
## 0.2.0
+ 适配最新版本 JPush SDK
+ Android 支持设置角标 badge
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

```yaml
dependencies:
jpush_flutter: 0.2.0
jpush_flutter: 0.3.0

//github
dependencies:
Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ android {
}

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

Expand Down
24 changes: 22 additions & 2 deletions android/src/main/java/com/jiguang/jpush/JPushPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugin.common.PluginRegistry.Registrar;

import java.util.ArrayList;
Expand All @@ -23,17 +24,26 @@
import java.util.Set;

import cn.jpush.android.api.JPushInterface;
import io.flutter.view.FlutterNativeView;

/** JPushPlugin */
public class JPushPlugin implements MethodCallHandler {

/** Plugin registration. */
public static void registerWith(Registrar registrar) {
final MethodChannel channel = new MethodChannel(registrar.messenger(), "jpush");
channel.setMethodCallHandler(new JPushPlugin(registrar, channel));


registrar.addViewDestroyListener(new PluginRegistry.ViewDestroyListener() {
@Override
public boolean onViewDestroy(FlutterNativeView flutterNativeView) {
instance.dartIsReady = false;
return false;
}
});
}

private static String TAG = "| JPUSH | Android | ";
private static String TAG = "| JPUSH | Flutter | Android | ";
public static JPushPlugin instance;
static List<Map<String, Object>> openNotificationCache = new ArrayList<>();

Expand Down Expand Up @@ -86,6 +96,8 @@ public void onMethodCall(MethodCall call, Result result) {
resumePush(call, result);
} else if (call.method.equals("clearAllNotifications")) {
clearAllNotifications(call, result);
} else if (call.method.equals("clearNotification")) {
clearNotification(call,result);
} else if (call.method.equals("getLaunchAppNotification")) {
getLaunchAppNotification(call, result);
} else if (call.method.equals("getRegistrationID")) {
Expand Down Expand Up @@ -133,6 +145,7 @@ public void scheduleCache() {
if (ridAvailable && dartIsReady) {
// try to schedule get rid cache
for (Result res: JPushPlugin.instance.getRidCache) {
Log.d(TAG,"scheduleCache rid = " + rid);
res.success(rid);
JPushPlugin.instance.getRidCache.remove(res);
}
Expand Down Expand Up @@ -220,6 +233,13 @@ public void clearAllNotifications(MethodCall call, Result result) {

JPushInterface.clearAllNotifications(registrar.context());
}
public void clearNotification(MethodCall call, Result result) {
Log.d(TAG,"clearNotification: ");
Object id = call.arguments;
if (id != null) {
JPushInterface.clearNotificationById(registrar.context(),(int)id);
}
}

public void getLaunchAppNotification(MethodCall call, Result result) {
Log.d(TAG,"");
Expand Down
10 changes: 10 additions & 0 deletions example/ios/Flutter/flutter_export_environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Applications/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/raoxudong/JPush/jpush-github/jpush-flutter-plugin/example"
export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "FLUTTER_FRAMEWORK_DIR=/Applications/flutter/bin/cache/artifacts/engine/ios"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
Loading

0 comments on commit 2dddc57

Please sign in to comment.