Skip to content

Commit c742ced

Browse files
author
qingqing.wang
committed
setup 方法新增 setControlWifiSwitch 参数,默认为true
1 parent befdf4f commit c742ced

File tree

6 files changed

+58
-25
lines changed

6 files changed

+58
-25
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
1+
## 2.0.3
2+
+ 新增:setup 方法新增 setControlWifiSwitch 参数,默认为true
23
## 2.0.1
34
+ 新增:适配Flutter 2.0,flutter sdk 2.0以下版本请使用0.6.23。
45
## 0.6.23

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ dependencies:
1919

2020
```
2121
dependencies:
22-
jverify: 2.0.1
22+
jverify: 2.0.3
2323
```
2424

2525
### 配置

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

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import android.widget.TextView;
2020

2121
import java.lang.reflect.Field;
22+
import java.lang.reflect.Method;
2223
import java.util.ArrayList;
2324
import java.util.Arrays;
2425
import java.util.HashMap;
@@ -44,7 +45,7 @@
4445
/**
4546
* JverifyPlugin
4647
*/
47-
public class JverifyPlugin implements FlutterPlugin,MethodCallHandler {
48+
public class JverifyPlugin implements FlutterPlugin, MethodCallHandler {
4849

4950
// 定义日志 TAG
5051
private static final String TAG = "| JVER | Android | -";
@@ -69,21 +70,21 @@ public class JverifyPlugin implements FlutterPlugin,MethodCallHandler {
6970

7071

7172
@Override
72-
public void onAttachedToEngine( FlutterPluginBinding flutterPluginBinding) {
73+
public void onAttachedToEngine(FlutterPluginBinding flutterPluginBinding) {
7374
channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "jverify");
7475
channel.setMethodCallHandler(this);
7576
context = flutterPluginBinding.getApplicationContext();
7677
}
7778

7879

7980
@Override
80-
public void onDetachedFromEngine( FlutterPluginBinding binding) {
81+
public void onDetachedFromEngine(FlutterPluginBinding binding) {
8182
channel.setMethodCallHandler(null);
8283
}
8384

8485

8586
@Override
86-
public void onMethodCall( MethodCall call, Result result) {
87+
public void onMethodCall(MethodCall call, Result result) {
8788
Log.d(TAG, "onMethodCall:" + call.method);
8889

8990
Log.d(TAG, "processMethod:" + call.method);
@@ -148,6 +149,12 @@ private void setup(MethodCall call, Result result) {
148149
Log.d(TAG, "Action - setup:");
149150

150151
Object timeout = getValueByKey(call, "timeout");
152+
boolean setControlWifiSwitch = (boolean) getValueByKey(call, "setControlWifiSwitch");
153+
if (!setControlWifiSwitch) {
154+
Log.d(TAG, "Action - setup: setControlWifiSwitch==" + false);
155+
setControlWifiSwitch();
156+
}
157+
151158
JVerificationInterface.init(context, (Integer) timeout, new RequestCallback<String>() {
152159
@Override
153160
public void onResult(int code, String message) {
@@ -160,6 +167,18 @@ public void onResult(int code, String message) {
160167
});
161168
}
162169

170+
private void setControlWifiSwitch() {
171+
try {
172+
Class<JVerificationInterface> aClass = JVerificationInterface.class;
173+
Method method = aClass.getDeclaredMethod("setControlWifiSwitch", boolean.class);
174+
method.setAccessible(true);
175+
method.invoke(aClass, false);
176+
} catch (Exception e) {
177+
e.printStackTrace();
178+
}
179+
}
180+
181+
163182
/**
164183
* SDK设置debug模式
165184
*/
@@ -858,7 +877,7 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder)
858877
}
859878
}
860879

861-
builder.enableHintToast((Boolean)privacyHintToast, null);
880+
builder.enableHintToast((Boolean) privacyHintToast, null);
862881
/************** 授权页弹窗模式 ***************/
863882
if (popViewConfig != null) {
864883
Map popViewConfigMap = (Map) popViewConfig;

example/lib/main.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,13 @@ class _MyAppState extends State<MyApp> {
378378
uiConfig.privacyNavTitleTitle2 = "协议22 web页标题";
379379
uiConfig.privacyNavReturnBtnImage = "return_bg"; //图片必须存在;
380380

381+
//弹框模式
382+
// JVPopViewConfig popViewConfig = JVPopViewConfig();
383+
// popViewConfig.width = (screenWidth - 100.0).toInt();
384+
// popViewConfig.height = (screenHeight - 150.0).toInt();
385+
//
386+
// uiConfig.popViewConfig = popViewConfig;
387+
381388
/// 添加自定义的 控件 到授权界面
382389
List<JVCustomWidget> widgetList = [];
383390

lib/jverify.dart

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ class Jverify {
6969
static final _instance = new Jverify.private(const MethodChannel("jverify"));
7070

7171
/// 自定义控件的点击事件
72-
addClikWidgetEventListener(
73-
String eventId, JVClickWidgetEventListener callback) {
72+
addClikWidgetEventListener(String eventId,
73+
JVClickWidgetEventListener callback) {
7474
_eventHanders.clickEventsMap[eventId] = callback;
7575
}
7676

@@ -98,7 +98,7 @@ class Jverify {
9898
bool isContains = _eventHanders.clickEventsMap.containsKey(widgetId);
9999
if (isContains) {
100100
JVClickWidgetEventListener cb =
101-
_eventHanders.clickEventsMap[widgetId];
101+
_eventHanders.clickEventsMap[widgetId];
102102
cb(widgetId);
103103
}
104104
}
@@ -115,7 +115,7 @@ class Jverify {
115115
case 'onReceiveLoginAuthCallBackEvent':
116116
{
117117
for (JVLoginAuthCallBackListener cb
118-
in _eventHanders.loginAuthCallBackEvents) {
118+
in _eventHanders.loginAuthCallBackEvents) {
119119
Map json = call.arguments.cast<dynamic, dynamic>();
120120
JVListenerEvent event = JVListenerEvent.fromJson(json);
121121
cb(event);
@@ -154,11 +154,10 @@ class Jverify {
154154
}
155155

156156
/// 初始化, timeout单位毫秒,合法范围是(0,30000],推荐设置为5000-10000,默认值为10000
157-
void setup(
158-
{@required String appKey,
159-
String channel,
160-
bool useIDFA,
161-
int timeout = 10000}) {
157+
void setup({@required String appKey,
158+
String channel,
159+
bool useIDFA,
160+
int timeout = 10000, bool setControlWifiSwitch = true}) {
162161
print("$flutter_log" + "setup");
163162

164163
_channel.setMethodCallHandler(_handlerMethod);
@@ -167,7 +166,8 @@ class Jverify {
167166
"appKey": appKey,
168167
"channel": channel,
169168
"useIDFA": useIDFA,
170-
"timeout": timeout
169+
"timeout": timeout,
170+
"setControlWifiSwitch":setControlWifiSwitch
171171
});
172172
}
173173

@@ -561,7 +561,7 @@ class JVUIConfig {
561561
JVPopViewConfig popViewConfig;
562562

563563
JVIOSUIModalTransitionStyle modelTransitionStyle = //弹出方式 only ios
564-
JVIOSUIModalTransitionStyle.CoverVertical;
564+
JVIOSUIModalTransitionStyle.CoverVertical;
565565

566566
Map toJsonMap() {
567567
return {
@@ -650,7 +650,8 @@ class JVUIConfig {
650650
"needStartAnim": needStartAnim,
651651
"needCloseAnim": needCloseAnim,
652652
"privacyNavTitleTitle": privacyNavTitleTitle ??= null,
653-
}..removeWhere((key, value) => value == null);
653+
}
654+
..removeWhere((key, value) => value == null);
654655
}
655656
}
656657

@@ -666,9 +667,9 @@ class JVPopViewConfig {
666667
int offsetCenterY = 0; // 窗口相对屏幕中心的y轴偏移量
667668
bool isBottom = false; // only Android,窗口是否居屏幕底部。设置后 offsetCenterY 将失效,
668669
double popViewCornerRadius =
669-
5.0; // only ios,弹窗圆角大小,Android 从 AndroidManifest 配置中读取
670+
5.0; // only ios,弹窗圆角大小,Android 从 AndroidManifest 配置中读取
670671
double backgroundAlpha =
671-
0.3; // only ios,背景的透明度,Android 从 AndroidManifest 配置中读取
672+
0.3; // only ios,背景的透明度,Android 从 AndroidManifest 配置中读取
672673

673674
bool isPopViewTheme; // 是否支持弹窗模式
674675
JVPopViewConfig() {
@@ -685,7 +686,8 @@ class JVPopViewConfig {
685686
"isBottom": isBottom ??= null,
686687
"popViewCornerRadius": popViewCornerRadius,
687688
"backgroundAlpha": backgroundAlpha,
688-
}..removeWhere((key, value) => value == null);
689+
}
690+
..removeWhere((key, value) => value == null);
689691
}
690692
}
691693

@@ -751,7 +753,8 @@ class JVCustomWidget {
751753
"top": top,
752754
"width": width,
753755
"height": height,
754-
}..removeWhere((key, value) => value == null);
756+
}
757+
..removeWhere((key, value) => value == null);
755758
}
756759
}
757760

@@ -859,5 +862,8 @@ String getStringFromEnum<T>(T) {
859862
return null;
860863
}
861864

862-
return T.toString().split('.').last;
865+
return T
866+
.toString()
867+
.split('.')
868+
.last;
863869
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: jverify
22
description: JIGUANG Official Jverifycation SDK flutter plugin project.
3-
version: 2.0.1
3+
version: 2.0.3
44
homepage: https://www.jiguang.cn
55

66
environment:

0 commit comments

Comments
 (0)