Skip to content

Commit 6114053

Browse files
committed
add debug mode config update to 0.0.7
1 parent 260459a commit 6114053

File tree

9 files changed

+40
-25
lines changed

9 files changed

+40
-25
lines changed

.packages

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated by pub on 2018-10-08 23:40:55.475551.
1+
# Generated by pub on 2018-12-18 11:12:10.903707.
22
analyzer:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.33.0/lib/
33
args:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/args-1.5.0/lib/
44
async:file:///Applications/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.0.8/lib/

android/build.gradle

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

3636
dependencies {
37-
compile 'cn.jiguang.sdk:jpush:3.1.6' // 此处以JPush 3.1.6 版本为例。
38-
compile 'cn.jiguang.sdk:jcore:1.2.5' // 此处以JCore 1.2.5 版本为例。
37+
implementation 'cn.jiguang.sdk:jpush:3.1.6' // 此处以JPush 3.1.6 版本为例。
38+
implementation 'cn.jiguang.sdk:jcore:1.2.5' // 此处以JCore 1.2.5 版本为例。
3939
}

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ public void onMethodCall(MethodCall call, Result result) {
9696
}
9797

9898
public void setup(MethodCall call, Result result) {
99-
100-
JPushInterface.setDebugMode(true); // 设置开启日志,发布时请关闭日志
99+
HashMap<String, Object> map = call.arguments();
100+
boolean debug = (boolean)map.get("debug");
101+
JPushInterface.setDebugMode(debug);
101102
JPushInterface.init(registrar.context()); // 初始化 JPush
102103
JPushPlugin.instance.dartIsReady = true;
103104

@@ -227,9 +228,6 @@ public void sendLocalNotification(MethodCall call, Result result) {
227228
}
228229

229230

230-
231-
232-
233231
/**
234232
* 接收自定义消息,通知,通知点击事件等事件的广播
235233
* 文档链接:http://docs.jiguang.cn/client/android_api/

example/ios/Runner/AppDelegate.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ - (BOOL)application:(UIApplication *)application
88
[GeneratedPluginRegistrant registerWithRegistry:self];
99
// Override point for customization after application launch.
1010
return [super application:application didFinishLaunchingWithOptions:launchOptions];
11+
1112
}
1213

1314
@end

example/lib/main.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ final JPush jpush = new JPush();
3535
jpush.setup(
3636
appKey: "a1703c14b186a68a66ef86c1",
3737
channel: "theChannel",
38-
production: false
38+
production: false,
39+
// debug: true,
3940
);
4041
jpush.applyPushAuthority(new NotificationSettingsIOS(
4142
sound: false,

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ packages:
136136
path: ".."
137137
relative: true
138138
source: path
139-
version: "0.0.5"
139+
version: "0.0.7"
140140
js:
141141
dependency: transitive
142142
description:

ios/Classes/JPushPlugin.m

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,17 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
150150
}
151151
}
152152

153+
154+
153155
- (void)setup:(FlutterMethodCall*)call result:(FlutterResult)result {
154156
NSDictionary *arguments = call.arguments;
155-
157+
NSNumber *debug = arguments[@"debug"];
158+
if ([debug boolValue]) {
159+
[JPUSHService setDebugMode];
160+
} else {
161+
[JPUSHService setLogOFF];
162+
}
163+
156164
[JPUSHService setupWithOption:_launchNotification
157165
appKey:arguments[@"appKey"]
158166
channel:arguments[@"channel"]
@@ -383,6 +391,8 @@ - (void)sendLocalNotification:(FlutterMethodCall*)call result:(FlutterResult)res
383391
result(@[@[]]);
384392
}
385393

394+
395+
386396
- (void)dealloc {
387397
_isJPushDidLogin = NO;
388398
[[NSNotificationCenter defaultCenter] removeObserver:self];

lib/jpush_flutter.dart

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ class JPush {
2929
String appKey,
3030
String channel,
3131
bool production,
32+
bool debug = false,
3233
}) {
33-
_channel.invokeMethod('setup', { 'appKey': appKey, 'channel': channel, 'production': production });
34+
_channel.invokeMethod('setup', { 'appKey': appKey, 'channel': channel, 'production': production, 'debug': debug});
3435
}
3536
///
3637
/// 初始化 JPush 必须先初始化才能执行其他操作(比如接收事件传递)
@@ -154,6 +155,10 @@ class JPush {
154155
return result;
155156
}
156157

158+
void setDebugMode() {
159+
_channel.invokeMethod('setDebugMode');
160+
}
161+
157162
///
158163
/// iOS Only
159164
/// 设置应用 Badge(小红点)
@@ -239,18 +244,18 @@ class NotificationSettingsIOS {
239244

240245

241246

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

256261
final int buildId;//?

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: jpush_flutter
22
description: Offically supported JPush Flutter plugin.
3-
version: 0.0.6
3+
version: 0.0.7
44
author: huminios <[email protected]>
55
homepage: https://www.jiguang.cn
66

0 commit comments

Comments
 (0)