Skip to content

Commit 00e7caa

Browse files
authored
Merge pull request #30 from jpush/dev
v0.6.0
2 parents c5d42eb + 267bc56 commit 00e7caa

File tree

14 files changed

+432
-57
lines changed

14 files changed

+432
-57
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.6.0
2+
+ 新增:SDK 初始化回调监听
3+
+ 新增:授权页弹窗模式
4+
+ 修复:授权页无法唤起问题
5+
+ 同步 JVerification SDK 2.5.2 版本
16
## 0.5.2
27
+ 修复:授权登录回调通知 bug
38
## 0.5.1

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
```yaml
99
//pub 集成
1010
dependencies:
11-
jverify: 0.5.2
11+
jverify: 0.6.0
1212

1313

1414
//github 集成

android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ android {
3939

4040
dependencies {
4141
compileOnly files('libs/flutter.jar')
42-
implementation 'cn.jiguang.sdk:jverification:2.5.0'
43-
implementation 'cn.jiguang.sdk:jcore:2.1.2'
42+
implementation 'cn.jiguang.sdk:jverification:2.5.2'
43+
implementation 'cn.jiguang.sdk:jcore:2.1.6'
4444
}

android/src/main/java/com/jiguang/jverify/JverifyPlugin.java

Lines changed: 63 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
import cn.jiguang.verifysdk.api.JVerificationInterface;
3434
import cn.jiguang.verifysdk.api.JVerifyUIClickCallback;
3535
import cn.jiguang.verifysdk.api.JVerifyUIConfig;
36+
import cn.jiguang.verifysdk.api.LoginSettings;
3637
import cn.jiguang.verifysdk.api.PreLoginListener;
38+
import cn.jiguang.verifysdk.api.RequestCallback;
3739
import cn.jiguang.verifysdk.api.VerifyListener;
3840
import io.flutter.plugin.common.MethodCall;
3941
import io.flutter.plugin.common.MethodChannel;
@@ -116,7 +118,18 @@ public void onMethodCall(MethodCall call, Result result) {
116118
/** SDK 初始换 */
117119
private void setup(MethodCall call,Result result){
118120
Log.d(TAG,"Action - setup:");
119-
JVerificationInterface.init(context);
121+
122+
Object timeout = getValueByKey(call,"timeout");
123+
JVerificationInterface.init(context, (Integer)timeout, new RequestCallback<String>() {
124+
@Override
125+
public void onResult(int code, String message) {
126+
Map<String,Object> map = new HashMap<>();
127+
map.put(j_code_key,code);
128+
map.put(j_msg_key,message);
129+
// 通过 channel 返回
130+
channel.invokeMethod("onReceiveSDKSetupCallBackEvent",map);
131+
}
132+
});
120133
}
121134

122135
/** SDK设置debug模式 */
@@ -286,8 +299,24 @@ private void loginAuthInterface(final Boolean isSync, MethodCall call, final Res
286299
Log.d(TAG,"Action - loginAuthInterface:");
287300

288301
Object autoFinish = getValueByKey(call,"autoDismiss");
302+
Integer timeOut = call.argument("timeout");
303+
304+
LoginSettings settings = new LoginSettings();
305+
settings.setAutoFinish((Boolean)autoFinish);
306+
settings.setTimeout(timeOut);
307+
settings.setAuthPageEventListener(new AuthPageEventListener() {
308+
@Override
309+
public void onEvent(int cmd, String msg) {
310+
Log.d(TAG,"Action - AuthPageEventListener: cmd = " + cmd);
311+
/// 事件
312+
final HashMap jsonMap = new HashMap();
313+
jsonMap.put(j_code_key, cmd);
314+
jsonMap.put(j_msg_key, msg);
315+
channel.invokeMethod("onReceiveAuthPageEvent", jsonMap);
316+
}
317+
});
289318

290-
JVerificationInterface.loginAuth(context, (Boolean) autoFinish, new VerifyListener() {
319+
JVerificationInterface.loginAuth(context, settings, new VerifyListener() {
291320
@Override
292321
public void onResult(int code, String content, String operator) {
293322
if (code == 6000){
@@ -307,16 +336,6 @@ public void onResult(int code, String content, String operator) {
307336
result.success(map);
308337
}
309338
}
310-
}, new AuthPageEventListener() {
311-
@Override
312-
public void onEvent(int cmd, String msg) {
313-
Log.d(TAG,"Action - AuthPageEventListener: cmd = " + cmd);
314-
/// 事件
315-
final HashMap jsonMap = new HashMap();
316-
jsonMap.put(j_code_key, cmd);
317-
jsonMap.put(j_msg_key, msg);
318-
channel.invokeMethod("onReceiveAuthPageEvent", jsonMap);
319-
}
320339
});
321340
}
322341

@@ -325,6 +344,12 @@ private void dismissLoginAuthView(MethodCall call, Result result) {
325344
Log.d(TAG,"Action - dismissLoginAuthView:");
326345

327346
JVerificationInterface.dismissLoginAuthActivity();
347+
JVerificationInterface.dismissLoginAuthActivity(true, new RequestCallback<String>() {
348+
@Override
349+
public void onResult(int i, String s) {
350+
351+
}
352+
});
328353
}
329354

330355
/** 自定义授权界面 UI 、添加自定义控件*/
@@ -474,8 +499,10 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder
474499
Object privacyNavTitleTextColor = valueForKey(uiconfig,"privacyNavTitleTextColor");
475500
Object privacyNavTitleTextSize = valueForKey(uiconfig,"privacyNavTitleTextSize");
476501
Object privacyNavReturnBtnImage = valueForKey(uiconfig,"privacyNavReturnBtnImage");
502+
Object privacyNavTitleTitle1 = valueForKey(uiconfig,"privacyNavTitleTitle1");
503+
Object privacyNavTitleTitle2 = valueForKey(uiconfig,"privacyNavTitleTitle2");
477504

478-
505+
Object popViewConfig = valueForKey(uiconfig,"popViewConfig");
479506

480507
/************** 背景 ***************/
481508
if (authBackgroundImage != null ){
@@ -677,6 +704,12 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder
677704
if (privacyNavTitleTextColor != null){
678705
builder.setPrivacyNavTitleTextColor(exchangeObject(privacyNavTitleTextColor));
679706
}
707+
if (privacyNavTitleTitle1 != null) {
708+
builder.setAppPrivacyNavTitle1((String) privacyNavTitleTitle1);
709+
}
710+
if (privacyNavTitleTitle2 != null) {
711+
builder.setAppPrivacyNavTitle2((String) privacyNavTitleTitle2);
712+
}
680713

681714
if (privacyNavReturnBtnImage != null){
682715
int res_id = getResourceByReflect((String)privacyNavReturnBtnImage);
@@ -686,6 +719,23 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder
686719
builder.setPrivacyNavReturnBtn(view);
687720
}
688721
}
722+
723+
builder.enableHintToast(true,null);
724+
/************** 授权页弹窗模式 ***************/
725+
if (popViewConfig != null) {
726+
Map popViewConfigMap = (Map)popViewConfig;
727+
Object isPopViewTheme = valueForKey(popViewConfigMap,"isPopViewTheme");
728+
if ((Boolean) isPopViewTheme) {
729+
Object width = valueForKey(popViewConfigMap,"width");
730+
Object height = valueForKey(popViewConfigMap,"height");
731+
Object offsetCenterX = valueForKey(popViewConfigMap,"offsetCenterX");
732+
Object offsetCenterY = valueForKey(popViewConfigMap,"offsetCenterY");
733+
Object isBottom = valueForKey(popViewConfigMap,"isBottom");
734+
735+
builder.setDialogTheme((int)width, (int)height, (int)offsetCenterX, (int)offsetCenterY, (Boolean)isBottom);
736+
737+
}
738+
}
689739
}
690740

691741
/** 添加自定义 widget 到 SDK 原有的授权界面里 */

documents/APIs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ jverify.addLoginAuthCallBackListener((event){
9494
jverify.loginAuthSyncApi(autoDismiss: true);
9595
9696
/*
97-
/// 方式二:使用异步接口 (如果想使用异步接口,则忽略此步骤,看方式一)
97+
/// 方式二:使用异步接口 (如果想使用同步接口,则忽略此步骤,看方式一)
9898
9999
/// 先,执行异步的一键登录接口
100100
jverify.loginAuth(true).then((map) {
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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/jverify-flutter-plugin/example"
5+
export "FLUTTER_TARGET=/Users/raoxudong/JPush/jpush-github/jverify-flutter-plugin/example/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 "TRACK_WIDGET_CREATION=true"

example/ios/Podfile.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
PODS:
22
- Flutter (1.0.0)
33
- JCore (2.1.4-noidfa)
4-
- JVerification (2.5.0):
4+
- JVerification (2.5.2):
55
- JCore (< 3.0.0, >= 1.2.6)
66
- jverify (0.0.1):
77
- Flutter
88
- JCore (= 2.1.4-noidfa)
9-
- JVerification (= 2.5.0)
9+
- JVerification
1010

1111
DEPENDENCIES:
1212
- Flutter (from `.symlinks/flutter/ios`)
@@ -24,10 +24,10 @@ EXTERNAL SOURCES:
2424
:path: ".symlinks/plugins/jverify/ios"
2525

2626
SPEC CHECKSUMS:
27-
Flutter: 58dd7d1b27887414a370fcccb9e645c08ffd7a6a
27+
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
2828
JCore: 2f15311e6889ab43ed5d629802ef793cac566465
29-
JVerification: e51834e1c7f0f1b6b911987234a57bf80b9eeff8
30-
jverify: 8a4261f246cf320f412d4f8fa8f7b3b2cb134dc9
29+
JVerification: e62574b51a4a38ee5f7b46140a4698cb215d34ce
30+
jverify: ebdfc61d824bb06ba49ba46f52ad3f3b27f00401
3131

3232
PODFILE CHECKSUM: aff02bfeed411c636180d6812254b2daeea14d09
3333

example/lib/main.dart

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,8 @@ class _MyAppState extends State<MyApp> {
358358
uiConfig.privacyNavColor = Colors.red.value;;
359359
uiConfig.privacyNavTitleTextColor = Colors.blue.value;
360360
uiConfig.privacyNavTitleTextSize = 16;
361+
uiConfig.privacyNavTitleTitle1 = "协议1 web页标题";
362+
uiConfig.privacyNavTitleTitle2 = "协议2 web页标题";
361363
uiConfig.privacyNavReturnBtnImage = "return_bg";//图片必须存在;
362364

363365
/// 添加自定义的 控件 到授权界面
@@ -409,6 +411,15 @@ class _MyAppState extends State<MyApp> {
409411
*/
410412

411413

414+
/* 弹框模式
415+
JVPopViewConfig popViewConfig = JVPopViewConfig();
416+
popViewConfig.width = (screenWidth - 100.0).toInt();
417+
popViewConfig.height = (screenHeight - 150.0).toInt();
418+
419+
uiConfig.popViewConfig = popViewConfig;
420+
*/
421+
422+
412423
/// 步骤 1:调用接口设置 UI
413424
jverify.setCustomAuthorizationView(true, uiConfig, landscapeConfig: uiConfig);
414425

@@ -458,7 +469,13 @@ class _MyAppState extends State<MyApp> {
458469
// Platform messages are asynchronous, so we initialize in an async method.
459470
Future<void> initPlatformState() async {
460471
String platformVersion;
461-
jverify.setDebugMode(false); // 打开调试模式
472+
473+
// 初始化 SDK 之前添加监听
474+
jverify.addSDKSetupCallBackListener((JVSDKSetupEvent event){
475+
print("receive sdk setup call back event :${event.toMap()}");
476+
});
477+
478+
jverify.setDebugMode(true); // 打开调试模式
462479
jverify.setup(
463480
appKey: "你自己应用的 AppKey",//"你自己应用的 AppKey",
464481
channel: "devloper-default"); // 初始化sdk, appKey 和 channel 只对ios设置有效

example/pubspec.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ packages:
77
name: async
88
url: "https://pub.flutter-io.cn"
99
source: hosted
10-
version: "2.2.0"
10+
version: "2.3.0"
1111
boolean_selector:
1212
dependency: transitive
1313
description:
1414
name: boolean_selector
1515
url: "https://pub.flutter-io.cn"
1616
source: hosted
17-
version: "1.0.4"
17+
version: "1.0.5"
1818
charcode:
1919
dependency: transitive
2020
description:
@@ -52,7 +52,7 @@ packages:
5252
path: ".."
5353
relative: true
5454
source: path
55-
version: "0.5.2"
55+
version: "0.6.0"
5656
matcher:
5757
dependency: transitive
5858
description:
@@ -66,7 +66,7 @@ packages:
6666
name: meta
6767
url: "https://pub.flutter-io.cn"
6868
source: hosted
69-
version: "1.1.6"
69+
version: "1.1.7"
7070
modal_progress_hud:
7171
dependency: "direct main"
7272
description:
@@ -80,14 +80,14 @@ packages:
8080
name: path
8181
url: "https://pub.flutter-io.cn"
8282
source: hosted
83-
version: "1.6.2"
83+
version: "1.6.4"
8484
pedantic:
8585
dependency: transitive
8686
description:
8787
name: pedantic
8888
url: "https://pub.flutter-io.cn"
8989
source: hosted
90-
version: "1.7.0"
90+
version: "1.8.0+1"
9191
platform:
9292
dependency: transitive
9393
description:
@@ -101,7 +101,7 @@ packages:
101101
name: quiver
102102
url: "https://pub.flutter-io.cn"
103103
source: hosted
104-
version: "2.0.3"
104+
version: "2.0.5"
105105
sky_engine:
106106
dependency: transitive
107107
description: flutter
@@ -134,7 +134,7 @@ packages:
134134
name: string_scanner
135135
url: "https://pub.flutter-io.cn"
136136
source: hosted
137-
version: "1.0.4"
137+
version: "1.0.5"
138138
term_glyph:
139139
dependency: transitive
140140
description:

0 commit comments

Comments
 (0)