Skip to content

Commit

Permalink
add debug mode config update to 0.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
huangminlinux committed Dec 18, 2018
1 parent 260459a commit 6114053
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .packages
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by pub on 2018-10-08 23:40:55.475551.
# Generated by pub on 2018-12-18 11:12:10.903707.
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/
Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ android {
}

dependencies {
compile 'cn.jiguang.sdk:jpush:3.1.6' // 此处以JPush 3.1.6 版本为例。
compile 'cn.jiguang.sdk:jcore:1.2.5' // 此处以JCore 1.2.5 版本为例。
implementation 'cn.jiguang.sdk:jpush:3.1.6' // 此处以JPush 3.1.6 版本为例。
implementation 'cn.jiguang.sdk:jcore:1.2.5' // 此处以JCore 1.2.5 版本为例。
}
8 changes: 3 additions & 5 deletions android/src/main/java/com/jiguang/jpush/JPushPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ public void onMethodCall(MethodCall call, Result result) {
}

public void setup(MethodCall call, Result result) {

JPushInterface.setDebugMode(true); // 设置开启日志,发布时请关闭日志
HashMap<String, Object> map = call.arguments();
boolean debug = (boolean)map.get("debug");
JPushInterface.setDebugMode(debug);
JPushInterface.init(registrar.context()); // 初始化 JPush
JPushPlugin.instance.dartIsReady = true;

Expand Down Expand Up @@ -227,9 +228,6 @@ public void sendLocalNotification(MethodCall call, Result result) {
}





/**
* 接收自定义消息,通知,通知点击事件等事件的广播
* 文档链接:http://docs.jiguang.cn/client/android_api/
Expand Down
1 change: 1 addition & 0 deletions example/ios/Runner/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ - (BOOL)application:(UIApplication *)application
[GeneratedPluginRegistrant registerWithRegistry:self];
// Override point for customization after application launch.
return [super application:application didFinishLaunchingWithOptions:launchOptions];

}

@end
3 changes: 2 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ final JPush jpush = new JPush();
jpush.setup(
appKey: "a1703c14b186a68a66ef86c1",
channel: "theChannel",
production: false
production: false,
// debug: true,
);
jpush.applyPushAuthority(new NotificationSettingsIOS(
sound: false,
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.0.5"
version: "0.0.7"
js:
dependency: transitive
description:
Expand Down
12 changes: 11 additions & 1 deletion ios/Classes/JPushPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,17 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
}
}



- (void)setup:(FlutterMethodCall*)call result:(FlutterResult)result {
NSDictionary *arguments = call.arguments;

NSNumber *debug = arguments[@"debug"];
if ([debug boolValue]) {
[JPUSHService setDebugMode];
} else {
[JPUSHService setLogOFF];
}

[JPUSHService setupWithOption:_launchNotification
appKey:arguments[@"appKey"]
channel:arguments[@"channel"]
Expand Down Expand Up @@ -383,6 +391,8 @@ - (void)sendLocalNotification:(FlutterMethodCall*)call result:(FlutterResult)res
result(@[@[]]);
}



- (void)dealloc {
_isJPushDidLogin = NO;
[[NSNotificationCenter defaultCenter] removeObserver:self];
Expand Down
31 changes: 18 additions & 13 deletions lib/jpush_flutter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ class JPush {
String appKey,
String channel,
bool production,
bool debug = false,
}) {
_channel.invokeMethod('setup', { 'appKey': appKey, 'channel': channel, 'production': production });
_channel.invokeMethod('setup', { 'appKey': appKey, 'channel': channel, 'production': production, 'debug': debug});
}
///
/// 初始化 JPush 必须先初始化才能执行其他操作(比如接收事件传递)
Expand Down Expand Up @@ -154,6 +155,10 @@ class JPush {
return result;
}

void setDebugMode() {
_channel.invokeMethod('setDebugMode');
}

///
/// iOS Only
/// 设置应用 Badge(小红点)
Expand Down Expand Up @@ -239,18 +244,18 @@ class NotificationSettingsIOS {



/// @property {number} [buildId] - 通知样式:1 为基础样式,2 为自定义样式(需先调用 `setStyleCustom` 设置自定义样式)
/// @property {number} [id] - 通知 id, 可用于取消通知
/// @property {string} [title] - 通知标题
/// @property {string} [content] - 通知内容
/// @property {object} [extra] - extra 字段
/// @property {number} [fireTime] - 通知触发时间(毫秒)
/// // iOS Only
/// @property {number} [badge] - 本地推送触发后应用角标值
/// // iOS Only
/// @property {string} [soundName] - 指定推送的音频文件
/// // iOS 10+ Only
/// @property {string} [subtitle] - 子标题
/// @property {number} [buildId] - 通知样式:1 为基础样式,2 为自定义样式(需先调用 `setStyleCustom` 设置自定义样式)
/// @property {number} [id] - 通知 id, 可用于取消通知
/// @property {string} [title] - 通知标题
/// @property {string} [content] - 通知内容
/// @property {object} [extra] - extra 字段
/// @property {number} [fireTime] - 通知触发时间(毫秒)
/// // iOS Only
/// @property {number} [badge] - 本地推送触发后应用角标值
/// // iOS Only
/// @property {string} [soundName] - 指定推送的音频文件
/// // iOS 10+ Only
/// @property {string} [subtitle] - 子标题
class LocalNotification {

final int buildId;//?
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: jpush_flutter
description: Offically supported JPush Flutter plugin.
version: 0.0.6
version: 0.0.7
author: huminios <h380108184@gmail.com>
homepage: https://www.jiguang.cn

Expand Down

0 comments on commit 6114053

Please sign in to comment.