Skip to content

Commit

Permalink
Merge pull request #53 from jpush/dev
Browse files Browse the repository at this point in the history
V0.0.13
  • Loading branch information
shikk committed Jul 26, 2019
2 parents 14c476d + 54967f5 commit 9c2973c
Show file tree
Hide file tree
Showing 14 changed files with 363 additions and 318 deletions.
109 changes: 55 additions & 54 deletions .packages
@@ -1,55 +1,56 @@
# Generated by pub on 2018-12-28 11:16:51.907295.
analyzer:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.33.0/lib/
args:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/args-1.5.0/lib/
async:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.0.8/lib/
boolean_selector:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/boolean_selector-1.0.4/lib/
charcode:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.2/lib/
collection:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.14.11/lib/
convert:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/convert-2.0.2/lib/
crypto:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/crypto-2.0.6/lib/
csslib:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/csslib-0.14.6/lib/
front_end:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/front_end-0.1.6/lib/
glob:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/glob-1.1.7/lib/
html:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/html-0.13.3+3/lib/
http:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0/lib/
http_multi_server:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/http_multi_server-2.0.5/lib/
http_parser:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.3/lib/
io:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/io-0.3.3/lib/
js:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.1+1/lib/
json_rpc_2:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/json_rpc_2-2.0.9/lib/
kernel:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/kernel-0.3.6/lib/
logging:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/logging-0.11.3+2/lib/
matcher:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.3+1/lib/
meta:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.1.6/lib/
mime:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/mime-0.9.6+2/lib/
mockito:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/mockito-3.0.0/lib/
multi_server_socket:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/multi_server_socket-1.0.2/lib/
node_preamble:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/node_preamble-1.4.4/lib/
package_config:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/package_config-1.0.5/lib/
package_resolver:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/package_resolver-1.0.6/lib/
path:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/path-1.6.2/lib/
platform:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/platform-2.2.0/lib/
plugin:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/plugin-0.2.0+3/lib/
pool:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/pool-1.3.6/lib/
pub_semver:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/pub_semver-1.4.2/lib/
shelf:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/shelf-0.7.3+3/lib/
shelf_packages_handler:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/shelf_packages_handler-1.0.4/lib/
shelf_static:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/shelf_static-0.2.8/lib/
shelf_web_socket:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/shelf_web_socket-0.2.2+4/lib/
sky_engine:file:///Applications/flutter/bin/cache/pkg/sky_engine/lib/
source_map_stack_trace:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/source_map_stack_trace-1.1.5/lib/
source_maps:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/source_maps-0.10.8/lib/
source_span:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.4.1/lib/
stack_trace:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.9.3/lib/
stream_channel:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/stream_channel-1.6.8/lib/
string_scanner:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.0.4/lib/
term_glyph:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.0.1/lib/
test:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/test-1.3.4/lib/
typed_data:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/typed_data-1.1.6/lib/
utf:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/utf-0.9.0+5/lib/
vector_math:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/vector_math-2.0.8/lib/
vm_service_client:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/vm_service_client-0.2.6/lib/
watcher:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/watcher-0.9.7+10/lib/
web_socket_channel:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/web_socket_channel-1.0.9/lib/
yaml:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/yaml-2.1.15/lib/
# Generated by pub on 2019-07-24 14:38:49.565093.
analyzer:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/analyzer-0.37.0/lib/
args:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/args-1.5.2/lib/
async:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/async-2.3.0/lib/
boolean_selector:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/boolean_selector-1.0.5/lib/
charcode:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/charcode-1.1.2/lib/
collection:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/collection-1.14.11/lib/
convert:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/convert-2.1.1/lib/
crypto:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/crypto-2.0.6/lib/
csslib:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/csslib-0.16.1/lib/
flutter:file:///Users/shikk/Documents/flutter/packages/flutter/lib/
front_end:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/front_end-0.1.20/lib/
glob:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/glob-1.1.7/lib/
html:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/html-0.14.0+2/lib/
http:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/http-0.12.0+2/lib/
http_multi_server:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/http_multi_server-2.1.0/lib/
http_parser:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/http_parser-3.1.3/lib/
io:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/io-0.3.3/lib/
js:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/js-0.6.1+1/lib/
kernel:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/kernel-0.3.20/lib/
matcher:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/matcher-0.12.5/lib/
meta:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/meta-1.1.6/lib/
mime:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/mime-0.9.6+3/lib/
mockito:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/mockito-3.0.2/lib/
multi_server_socket:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/multi_server_socket-1.0.2/lib/
node_preamble:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/node_preamble-1.4.5/lib/
package_config:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/package_config-1.0.5/lib/
package_resolver:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/package_resolver-1.0.10/lib/
path:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/path-1.6.2/lib/
pedantic:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/pedantic-1.8.0+1/lib/
platform:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/platform-2.2.0/lib/
pool:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/pool-1.4.0/lib/
pub_semver:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/pub_semver-1.4.2/lib/
shelf:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/shelf-0.7.5/lib/
shelf_packages_handler:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/shelf_packages_handler-1.0.4/lib/
shelf_static:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/shelf_static-0.2.8/lib/
shelf_web_socket:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/shelf_web_socket-0.2.3/lib/
sky_engine:file:///Users/shikk/Documents/flutter/bin/cache/pkg/sky_engine/lib/
source_map_stack_trace:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/source_map_stack_trace-1.1.5/lib/
source_maps:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/source_maps-0.10.8/lib/
source_span:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/source_span-1.5.5/lib/
stack_trace:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/stack_trace-1.9.3/lib/
stream_channel:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/stream_channel-2.0.0/lib/
stream_transform:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/stream_transform-0.0.19/lib/
string_scanner:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/string_scanner-1.0.4/lib/
term_glyph:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/term_glyph-1.1.0/lib/
test:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/test-1.6.5/lib/
test_api:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/test_api-0.2.6/lib/
test_core:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/test_core-0.2.7/lib/
typed_data:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/typed_data-1.1.6/lib/
vector_math:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/vector_math-2.0.8/lib/
vm_service_lib:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/vm_service_lib-3.22.2/lib/
watcher:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/watcher-0.9.7+12/lib/
web_socket_channel:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/web_socket_channel-1.0.14/lib/
yaml:file:///Users/shikk/.pub-cache/hosted/pub.flutter-io.cn/yaml-2.1.16/lib/
jpush_flutter:lib/
6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,9 @@
## 0.0.13

featurn:
适配flutter 1.7.8
升级 jpush sdk 版本为3.3.4

## 0.0.12

featurn: 修改LocalNotification的属性名为"extra"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -7,7 +7,7 @@

```yaml
dependencies:
jpush_flutter: 0.0.12
jpush_flutter: 0.0.13
```

### 配置
Expand Down
7 changes: 5 additions & 2 deletions android/build.gradle
Expand Up @@ -34,6 +34,9 @@ android {
}

dependencies {
implementation 'cn.jiguang.sdk:jpush:3.1.6' // 此处以JPush 3.1.6 版本为例。
implementation 'cn.jiguang.sdk:jcore:1.2.5' // 此处以JCore 1.2.5 版本为例。
implementation 'cn.jiguang.sdk:jpush:3.3.4'
implementation 'cn.jiguang.sdk:jcore:2.1.2'
implementation 'com.android.support:appcompat-v7:27.+'
compileOnly files('libs/flutter.jar')

}
4 changes: 2 additions & 2 deletions android/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
#Tue Sep 18 15:12:00 CST 2018
#Fri Jul 26 11:14:36 CST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-rc-3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
Binary file added android/libs/flutter.jar
Binary file not shown.
11 changes: 11 additions & 0 deletions android/src/main/AndroidManifest.xml
Expand Up @@ -22,5 +22,16 @@
<category android:name="${applicationId}" />
</intent-filter>
</receiver>
<!-- Since JCore2.0.0 Required SDK核心功能-->
<!-- 可配置android:process参数将Service放在其他进程中;android:enabled属性不能是false -->
<!-- 这个是自定义Service,要继承极光JCommonService,可以在更多手机平台上使得推送通道保持的更稳定 -->
<service android:name=".JPushCustomService"
android:enabled="true"
android:exported="false"
android:process=":pushcore">
<intent-filter>
<action android:name="cn.jiguang.user.service.action" />
</intent-filter>
</service>
</application>
</manifest>
@@ -0,0 +1,6 @@
package com.jiguang.jpush;

import cn.jpush.android.service.JCommonService;

public class JPushCustomService extends JCommonService {
}
106 changes: 62 additions & 44 deletions android/src/main/java/com/jiguang/jpush/JPushEventReceiver.java
@@ -1,6 +1,8 @@
package com.jiguang.jpush;

import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;

import org.json.JSONException;
Expand All @@ -19,97 +21,113 @@
public class JPushEventReceiver extends JPushMessageReceiver {

@Override
public void onTagOperatorResult(Context context, JPushMessage jPushMessage) {
public void onTagOperatorResult(Context context, final JPushMessage jPushMessage) {
super.onTagOperatorResult(context, jPushMessage);

JSONObject resultJson = new JSONObject();
final JSONObject resultJson = new JSONObject();

int sequence = jPushMessage.getSequence();
final int sequence = jPushMessage.getSequence();
try {
resultJson.put("sequence", sequence);
} catch (JSONException e) {
e.printStackTrace();
}

Result callback = JPushPlugin.instance.callbackMap.get(sequence);//instance.eventCallbackMap.get(sequence);
final Result callback = JPushPlugin.instance.callbackMap.get(sequence);//instance.eventCallbackMap.get(sequence);

if (callback == null) {
Log.i("JPushPlugin", "Unexpected error, callback is null!");
return;
}

if (jPushMessage.getErrorCode() == 0) { // success
Set<String> tags = jPushMessage.getTags();
List<String> tagList = new ArrayList<>(tags);
Map<String, Object> res = new HashMap<>();
res.put("tags", tagList);
callback.success(res);
} else {
try {
resultJson.put("code", jPushMessage.getErrorCode());
} catch (JSONException e) {
e.printStackTrace();
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (jPushMessage.getErrorCode() == 0) { // success
Set<String> tags = jPushMessage.getTags();
List<String> tagList = new ArrayList<>(tags);
Map<String, Object> res = new HashMap<>();
res.put("tags", tagList);
callback.success(res);
} else {
try {
resultJson.put("code", jPushMessage.getErrorCode());
} catch (JSONException e) {
e.printStackTrace();
}
callback.error(Integer.toString(jPushMessage.getErrorCode()), "", "");
}

JPushPlugin.instance.callbackMap.remove(sequence);
}
callback.error(Integer.toString(jPushMessage.getErrorCode()), "", "");
}
});

JPushPlugin.instance.callbackMap.remove(sequence);
}



@Override
public void onCheckTagOperatorResult(Context context, JPushMessage jPushMessage) {
public void onCheckTagOperatorResult(Context context, final JPushMessage jPushMessage) {
super.onCheckTagOperatorResult(context, jPushMessage);



int sequence = jPushMessage.getSequence();
final int sequence = jPushMessage.getSequence();


Result callback = JPushPlugin.instance.callbackMap.get(sequence);
final Result callback = JPushPlugin.instance.callbackMap.get(sequence);

if (callback == null) {
Log.i("JPushPlugin", "Unexpected error, callback is null!");
return;
}

if (jPushMessage.getErrorCode() == 0) {
Set<String> tags = jPushMessage.getTags();
List<String> tagList = new ArrayList<>(tags);
Map<String, Object> res = new HashMap<>();
res.put("tags", tagList);
callback.success(res);
} else {

callback.error(Integer.toString(jPushMessage.getErrorCode()), "", "");
}

JPushPlugin.instance.callbackMap.remove(sequence);
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (jPushMessage.getErrorCode() == 0) {
Set<String> tags = jPushMessage.getTags();
List<String> tagList = new ArrayList<>(tags);
Map<String, Object> res = new HashMap<>();
res.put("tags", tagList);
callback.success(res);
} else {

callback.error(Integer.toString(jPushMessage.getErrorCode()), "", "");
}

JPushPlugin.instance.callbackMap.remove(sequence);
}
});
}

@Override
public void onAliasOperatorResult(Context context, JPushMessage jPushMessage) {
public void onAliasOperatorResult(Context context, final JPushMessage jPushMessage) {
super.onAliasOperatorResult(context, jPushMessage);

int sequence = jPushMessage.getSequence();
final int sequence = jPushMessage.getSequence();

Result callback = JPushPlugin.instance.callbackMap.get(sequence);
final Result callback = JPushPlugin.instance.callbackMap.get(sequence);

if (callback == null) {
Log.i("JPushPlugin", "Unexpected error, callback is null!");
return;
}

if (jPushMessage.getErrorCode() == 0) { // success
Map<String, Object> res = new HashMap<>();
res.put("alias", (jPushMessage.getAlias() == null)? "" : jPushMessage.getAlias());
callback.success(res);
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (jPushMessage.getErrorCode() == 0) { // success
Map<String, Object> res = new HashMap<>();
res.put("alias", (jPushMessage.getAlias() == null)? "" : jPushMessage.getAlias());
callback.success(res);

} else {
callback.error(Integer.toString(jPushMessage.getErrorCode()), "", "");
}
} else {
callback.error(Integer.toString(jPushMessage.getErrorCode()), "", "");
}

JPushPlugin.instance.callbackMap.remove(sequence);
JPushPlugin.instance.callbackMap.remove(sequence);
}
});
}
}
6 changes: 3 additions & 3 deletions example/android/app/build.gradle
Expand Up @@ -34,7 +34,7 @@ android {

// applicationId "com.jiguang.jpushexample"

applicationId "com.example.huminios.jpushtest" //JPush 上注册的包名.
applicationId "com.shikk.testJpush" //JPush 上注册的包名.

minSdkVersion 16
targetSdkVersion 27
Expand All @@ -46,13 +46,13 @@ android {

ndk {
//选择要添加的对应 cpu 类型的 .so 库。
abiFilters 'armeabi', 'armeabi-v7a', 'x86', 'x86_64', 'mips', 'mips64'// 'arm64-v8a',
abiFilters 'armeabi', 'armeabi-v7a', 'x86', 'x86_64', 'mips', 'mips64', 'arm64-v8a'
// 还可以添加
}

manifestPlaceholders = [
JPUSH_PKGNAME : applicationId,
JPUSH_APPKEY : "a1703c14b186a68a66ef86c1", //JPush 上注册的包名对应的 Appkey.
JPUSH_APPKEY : "31c7c1b2cf59c1d42895a782", //JPush 上注册的包名对应的 Appkey.
JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可.
]
}
Expand Down
2 changes: 1 addition & 1 deletion example/lib/main.dart
Expand Up @@ -107,7 +107,7 @@ final JPush jpush = new JPush();
fireTime: fireDate,
subtitle: 'fasf',
badge: 5,
extras: {"fa": "0"}
extra: {"fa": "0"}
);
jpush.sendLocalNotification(localNotification).then((res) {
setState(() {
Expand Down

0 comments on commit 9c2973c

Please sign in to comment.