diff --git a/CHANGELOG.md b/CHANGELOG.md index c7a41ec..20e9962 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,36 @@ +## 2.2.4 ++ 优化: Android更新到2.7.7 +## 2.2.2 ++ 优化: 修复iOS横竖屏锁定无效的问题 +## 2.2.1 ++ 优化: Android更新到2.7.6 +## 2.2.0 ++ 优化: ios 认证plug.m代码 ++ 优化: iOS更新到2.7.6 +## 2.1.9 ++ 优化: ios 认证plug.m代码 ++ 新增:授权界面视频背景 ++ 新增:登录按钮字体加粗 ++ 新增:登录按钮相对底部偏移量 ++ 新增:隐私协议页面导航栏字体加粗 ++ 新增:slogan相对底部偏移量 ++ 新增:slogan字体加粗 ++ 新增:手机号码字体加粗 ++ 新增:隐私条款相对底部偏移量 ++ 新增:隐私条款文字加粗 ++ 新增:隐私条款文字下划线 ++ 新增:logo相对底部偏移量 ++ 新增:导航栏标题字体加粗 ++ 新增:手机号码相对底部偏移量 +## 2.1.8 ++ 升级:android 认证 2.7.4,ios 2.7.5 ++ 升级:android Jcore 2.9.0 +## 2.1.7 ++ 插件兼容ios 2.7.4 +## 2.1.6 ++ 升级:android 认证 2.7.3,ios 2.7.4 +## 2.1.4 ++ 修复:修复setup 接口不会回调问题 ## 2.1.2 + 升级:升级 android 认证 2.7.2 jcore 2.8.2,ios 2.7.1 ## 2.1.0 diff --git a/README.md b/README.md index 5b76297..fd7bb4c 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ dependencies: ``` dependencies: - jverify: 2.1.2 + jverify: 2.2.4 ``` ### 配置 diff --git a/android/build.gradle b/android/build.gradle index 676c6c8..01ef01a 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -53,6 +53,6 @@ android { dependencies { // implementation fileTree(include: '*.aar', dir: 'libs') - implementation 'cn.jiguang.sdk:jcore:2.8.2' - implementation 'cn.jiguang.sdk:jverification:2.7.2' + implementation 'cn.jiguang.sdk:jcore:2.9.0' + implementation 'cn.jiguang.sdk:jverification:2.7.7' } diff --git a/android/src/main/java/com/jiguang/jverify/JverifyPlugin.java b/android/src/main/java/com/jiguang/jverify/JverifyPlugin.java index 8b6d8c8..d6b306a 100644 --- a/android/src/main/java/com/jiguang/jverify/JverifyPlugin.java +++ b/android/src/main/java/com/jiguang/jverify/JverifyPlugin.java @@ -18,6 +18,10 @@ import android.widget.RelativeLayout; import android.widget.TextView; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayList; @@ -32,6 +36,7 @@ import cn.jiguang.verifysdk.api.JVerifyUIConfig; import cn.jiguang.verifysdk.api.LoginSettings; import cn.jiguang.verifysdk.api.PreLoginListener; +import cn.jiguang.verifysdk.api.PrivacyBean; import cn.jiguang.verifysdk.api.RequestCallback; import cn.jiguang.verifysdk.api.VerifyListener; import io.flutter.embedding.engine.plugins.FlutterPlugin; @@ -523,10 +528,13 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder) Object authBGGifPath = valueForKey(uiconfig, "authBGGifPath"); Object authBackgroundImage = valueForKey(uiconfig, "authBackgroundImage"); + Object authBGVideoPath = valueForKey(uiconfig, "authBGVideoPath"); + Object authBGVideoImgPath = valueForKey(uiconfig, "authBGVideoImgPath"); Object navColor = valueForKey(uiconfig, "navColor"); Object navText = valueForKey(uiconfig, "navText"); Object navTextColor = valueForKey(uiconfig, "navTextColor"); + Object navTextBold = valueForKey(uiconfig, "navTextBold"); Object navReturnImgPath = valueForKey(uiconfig, "navReturnImgPath"); Object navHidden = valueForKey(uiconfig, "navHidden"); Object navReturnBtnHidden = valueForKey(uiconfig, "navReturnBtnHidden"); @@ -538,11 +546,14 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder) Object logoOffsetY = valueForKey(uiconfig, "logoOffsetY"); Object logoOffsetX = valueForKey(uiconfig, "logoOffsetX"); Object logoHidden = valueForKey(uiconfig, "logoHidden"); + Object logoOffsetBottomY = valueForKey(uiconfig, "logoOffsetBottomY"); Object numberColor = valueForKey(uiconfig, "numberColor"); Object numberSize = valueForKey(uiconfig, "numberSize"); + Object numberTextBold = valueForKey(uiconfig, "numberTextBold"); Object numFieldOffsetY = valueForKey(uiconfig, "numFieldOffsetY"); Object numFieldOffsetX = valueForKey(uiconfig, "numFieldOffsetX"); + Object numberFieldOffsetBottomY = valueForKey(uiconfig, "numberFieldOffsetBottomY"); Object numberFieldWidth = valueForKey(uiconfig, "numberFieldWidth"); Object numberFieldHeight = valueForKey(uiconfig, "numberFieldHeight"); @@ -550,10 +561,12 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder) Object logBtnText = valueForKey(uiconfig, "logBtnText"); Object logBtnOffsetY = valueForKey(uiconfig, "logBtnOffsetY"); Object logBtnOffsetX = valueForKey(uiconfig, "logBtnOffsetX"); + Object logBtnBottomOffsetY = valueForKey(uiconfig, "logBtnBottomOffsetY"); Object logBtnWidth = valueForKey(uiconfig, "logBtnWidth"); Object logBtnHeight = valueForKey(uiconfig, "logBtnHeight"); Object logBtnTextSize = valueForKey(uiconfig, "logBtnTextSize"); Object logBtnTextColor = valueForKey(uiconfig, "logBtnTextColor"); + Object logBtnTextBold = valueForKey(uiconfig, "logBtnTextBold"); Object logBtnBackgroundPath = valueForKey(uiconfig, "logBtnBackgroundPath"); Object uncheckedImgPath = valueForKey(uiconfig, "uncheckedImgPath"); @@ -562,15 +575,16 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder) Object privacyTopOffsetY = valueForKey(uiconfig, "privacyTopOffsetY"); Object privacyOffsetY = valueForKey(uiconfig, "privacyOffsetY"); Object privacyOffsetX = valueForKey(uiconfig, "privacyOffsetX"); - Object CLAUSE_NAME = valueForKey(uiconfig, "clauseName"); - Object CLAUSE_URL = valueForKey(uiconfig, "clauseUrl"); +// Object CLAUSE_NAME = valueForKey(uiconfig, "clauseName"); +// Object CLAUSE_URL = valueForKey(uiconfig, "clauseUrl"); Object CLAUSE_BASE_COLOR = valueForKey(uiconfig, "clauseBaseColor"); Object CLAUSE_COLOR = valueForKey(uiconfig, "clauseColor"); - Object CLAUSE_NAME_TWO = valueForKey(uiconfig, "clauseNameTwo"); - Object CLAUSE_URL_TWO = valueForKey(uiconfig, "clauseUrlTwo"); +// Object CLAUSE_NAME_TWO = valueForKey(uiconfig, "clauseNameTwo"); +// Object CLAUSE_URL_TWO = valueForKey(uiconfig, "clauseUrlTwo"); Object privacyTextCenterGravity = valueForKey(uiconfig, "privacyTextCenterGravity"); Object privacyText = valueForKey(uiconfig, "privacyText"); Object privacyTextSize = valueForKey(uiconfig, "privacyTextSize"); + Object privacyTextBold = valueForKey(uiconfig, "privacyTextBold"); Object privacyCheckboxHidden = valueForKey(uiconfig, "privacyCheckboxHidden"); Object privacyCheckboxSize = valueForKey(uiconfig, "privacyCheckboxSize"); Object privacyWithBookTitleMark = valueForKey(uiconfig, "privacyWithBookTitleMark"); @@ -583,11 +597,14 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder) Object sloganBottomOffsetY = valueForKey(uiconfig, "sloganBottomOffsetY"); Object sloganTextSize = valueForKey(uiconfig, "sloganTextSize"); Object sloganHidden = valueForKey(uiconfig, "sloganHidden"); + Object sloganTextBold = valueForKey(uiconfig, "sloganTextBold"); + Object privacyUnderlineText = valueForKey(uiconfig, "privacyUnderlineText"); Object privacyNavColor = valueForKey(uiconfig, "privacyNavColor"); Object privacyNavTitleTextColor = valueForKey(uiconfig, "privacyNavTitleTextColor"); Object privacyNavTitleTextSize = valueForKey(uiconfig, "privacyNavTitleTextSize"); - Object privacyNavReturnBtnImage = valueForKey(uiconfig, "privacyNavReturnBtnImage"); + Object privacyNavTitleTextBold = valueForKey(uiconfig, "privacyNavTitleTextBold"); + Object privacyNavReturnBtnPath = valueForKey(uiconfig, "privacyNavReturnBtnImage"); Object privacyNavTitleTitle1 = valueForKey(uiconfig, "privacyNavTitleTitle1"); Object privacyNavTitleTitle2 = valueForKey(uiconfig, "privacyNavTitleTitle2"); @@ -610,6 +627,8 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder) Object privacyHintToast = valueForKey(uiconfig, "privacyHintToast"); + Object privacyItem = valueForKey(uiconfig, "privacyItem"); + /************* 状态栏 ***************/ if (statusBarColorWithNav != null) { builder.setStatusBarColorWithNav((Boolean) statusBarColorWithNav); @@ -686,6 +705,12 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder) } } + if (authBGVideoPath != null) { + if (!((String)authBGVideoPath).startsWith("http")) + authBGVideoPath = "android.resource://"+context.getPackageName()+"/raw/"+authBGVideoPath; + builder.setAuthBGVideoPath((String) authBGVideoPath, (String) authBGVideoImgPath); + } + /************** nav ***************/ if (navHidden != null) { builder.setNavHidden((Boolean) navHidden); @@ -705,6 +730,9 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder) if (navTextColor != null) { builder.setNavTextColor(exchangeObject(navTextColor)); } + if (navTextBold != null) { + builder.setNavTextBold((Boolean) navTextBold); + } if (navReturnImgPath != null) { builder.setNavReturnImgPath((String) navReturnImgPath); } @@ -731,8 +759,14 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder) builder.setLogoImgPath((String) logoImgPath); } } + if (logoOffsetBottomY != null) { + builder.setLogoOffsetBottomY((Integer) logoOffsetBottomY); + } /************** number ***************/ + if (numberFieldOffsetBottomY != null) { + builder.setNumberFieldOffsetBottomY((Integer) numberFieldOffsetBottomY); + } if (numFieldOffsetY != null) { builder.setNumFieldOffsetY((Integer) numFieldOffsetY); } @@ -751,6 +785,9 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder) if (numberSize != null) { builder.setNumberSize((Number) numberSize); } + if (numberTextBold != null) { + builder.setNumberTextBold((Boolean) numberTextBold); + } /************** slogan ***************/ @@ -760,6 +797,9 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder) if (sloganOffsetX != null) { builder.setSloganOffsetX((Integer) sloganOffsetX); } + if (sloganBottomOffsetY != null) { + builder.setSloganBottomOffsetY((Integer) sloganBottomOffsetY); + } if (sloganTextSize != null) { builder.setSloganTextSize((Integer) sloganTextSize); } @@ -769,6 +809,9 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder) if (sloganHidden != null) { builder.setSloganHidden((Boolean) sloganHidden); } + if (sloganTextBold != null) { + builder.setSloganTextBold((Boolean) sloganTextBold); + } /************** login btn ***************/ @@ -778,6 +821,9 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder) if (logBtnOffsetX != null) { builder.setLogBtnOffsetX((Integer) logBtnOffsetX); } + if (logBtnBottomOffsetY != null) { + builder.setLogBtnBottomOffsetY((Integer) logBtnBottomOffsetY); + } if (logBtnWidth != null) { builder.setLogBtnWidth((Integer) logBtnWidth); } @@ -793,6 +839,9 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder) if (logBtnTextColor != null) { builder.setLogBtnTextColor(exchangeObject(logBtnTextColor)); } + if (logBtnTextBold != null) { + builder.setLogBtnTextBold((Boolean) logBtnTextBold); + } if (logBtnBackgroundPath != null) { int res_id = getResourceByReflect((String) logBtnBackgroundPath); if (res_id > 0) { @@ -840,7 +889,13 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder) if (privacyText != null) { ArrayList privacyTextList = (ArrayList) privacyText; privacyTextList.addAll(Arrays.asList("", "", "", "")); - builder.setPrivacyText(privacyTextList.get(0), privacyTextList.get(1), privacyTextList.get(2), privacyTextList.get(3)); + builder.setPrivacyText(privacyTextList.get(0), privacyTextList.get(1)); + } + if (privacyTextBold != null) { + builder.setPrivacyTextBold((Boolean) privacyTextBold); + } + if (privacyUnderlineText != null) { + builder.setPrivacyUnderlineText((Boolean) privacyUnderlineText); } builder.setPrivacyTextCenterGravity((Boolean) privacyTextCenterGravity); @@ -848,11 +903,28 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder) builder.setPrivacyCheckboxInCenter((Boolean) privacyCheckboxInCenter); builder.setPrivacyState((Boolean) privacyState); - if (CLAUSE_NAME != null && CLAUSE_URL != null) { - builder.setAppPrivacyOne((String) CLAUSE_NAME, (String) CLAUSE_URL); + if (privacyItem != null) { + try { + JSONArray jsonArray = new JSONArray((String) privacyItem); + int length = jsonArray.length(); + JSONObject jsonObject; + PrivacyBean privacyBean; + ArrayList privacyBeans = new ArrayList<>(length); + for (int i = 0; i < length; i++) { + jsonObject = jsonArray.optJSONObject(i); + privacyBean = new PrivacyBean(jsonObject.optString("name"), jsonObject.optString("url"), + jsonObject.optString("separator")); + + privacyBeans.add(privacyBean); + } + + builder.setPrivacyNameAndUrlBeanList(privacyBeans); + } catch (JSONException e) { + e.printStackTrace(); + } } + int baseColor = -10066330; - ; int color = -16007674; if (CLAUSE_BASE_COLOR != null) { if (CLAUSE_BASE_COLOR instanceof Long) { @@ -869,9 +941,6 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder) } } builder.setAppPrivacyColor(baseColor, color); - if (CLAUSE_NAME_TWO != null && CLAUSE_URL_TWO != null) { - builder.setAppPrivacyTwo((String) CLAUSE_NAME_TWO, (String) CLAUSE_URL_TWO); - } /************** 隐私 web 页面 ***************/ if (privacyNavColor != null) { @@ -883,19 +952,21 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder) if (privacyNavTitleTextColor != null) { builder.setPrivacyNavTitleTextColor(exchangeObject(privacyNavTitleTextColor)); } - if (privacyNavTitleTitle1 != null) { - builder.setAppPrivacyNavTitle1((String) privacyNavTitleTitle1); - } - if (privacyNavTitleTitle2 != null) { - builder.setAppPrivacyNavTitle2((String) privacyNavTitleTitle2); +// if (privacyNavTitleTitle1 != null) { +// builder.setAppPrivacyNavTitle1((String) privacyNavTitleTitle1); +// } +// if (privacyNavTitleTitle2 != null) { +// builder.setAppPrivacyNavTitle2((String) privacyNavTitleTitle2); +// } + + if (privacyNavTitleTextBold != null) { + builder.setPrivacyNavTitleTextBold((Boolean) privacyNavTitleTextBold); } - if (privacyNavReturnBtnImage != null) { - int res_id = getResourceByReflect((String) privacyNavReturnBtnImage); + if (privacyNavReturnBtnPath != null) { + int res_id = getResourceByReflect((String) privacyNavReturnBtnPath); if (res_id > 0) { - ImageView view = new ImageView(context); - view.setImageResource(res_id); - builder.setPrivacyNavReturnBtn(view); + builder.setPrivacyNavReturnBtnPath((String) privacyNavReturnBtnPath); } } diff --git a/documents/APIs.md b/documents/APIs.md index 33b8b61..14ad765 100644 --- a/documents/APIs.md +++ b/documents/APIs.md @@ -8,6 +8,7 @@ - [setCustomAuthViewAllWidgets](#setCustomAuthViewAllWidgets) - [setGetCodeInternal](#setGetCodeInternal) - [getSMSCode](#getSMSCode) +- [clearPreLoginCache](#clearPreLoginCache) #### setup @@ -135,22 +136,30 @@ jverify.getToken().then((map){ uiConfig.uncheckedImgPath = "uncheck_image";//图片必须存在 uiConfig.privacyCheckboxInCenter = true; //uiConfig.privacyCheckboxHidden = false; - + uiConfig.textVerAlignment = 1; + //uiConfig.privacyOffsetX = isiOS ? (20 + uiConfig.privacyCheckboxSize) : null; - uiConfig.privacyOffsetY = 15;// 距离底部距离 - uiConfig.privacyVerticalLayoutItem = JVIOSLayoutItem.ItemSuper; - uiConfig.clauseName = "协议1"; - uiConfig.clauseUrl = "http://www.baidu.com"; - uiConfig.clauseBaseColor = Colors.black.value; - uiConfig.clauseNameTwo = "协议二"; - uiConfig.clauseUrlTwo = "http://www.hao123.com"; - uiConfig.clauseColor = Colors.red.value; - uiConfig.privacyText = ["1极","2光","3认","4证"]; - uiConfig.privacyTextSize = 13; - //uiConfig.privacyWithBookTitleMark = true; - //uiConfig.privacyTextCenterGravity = false; - uiConfig.authStatusBarStyle = JVIOSBarStyle.StatusBarStyleDarkContent; - uiConfig.privacyStatusBarStyle = JVIOSBarStyle.StatusBarStyleDefault; + uiConfig.privacyOffsetY = 15; // 距离底部距离 + uiConfig.privacyVerticalLayoutItem = JVIOSLayoutItem.ItemSuper; + uiConfig.clauseName = "协议1"; + uiConfig.clauseUrl = "http://www.baidu.com"; + uiConfig.clauseBaseColor = Colors.black.value; + uiConfig.clauseNameTwo = "协议二"; + uiConfig.clauseUrlTwo = "http://www.hao123.com"; + uiConfig.clauseColor = Colors.red.value; + uiConfig.privacyText = ["1极", "4证"]; + uiConfig.privacyTextSize = 13; + uiConfig.privacyItem = [ + JVPrivacy("自定义协议1", "http://www.baidu.com", + beforeName: "==", afterName: "++", separator: "*"), + JVPrivacy("自定义协议2", "http://www.baidu.com", separator: "、") + ]; + //uiConfig.privacyWithBookTitleMark = true; + //uiConfig.privacyTextCenterGravity = false; + uiConfig.authStatusBarStyle = JVIOSBarStyle.StatusBarStyleDarkContent; + uiConfig.privacyStatusBarStyle = JVIOSBarStyle.StatusBarStyleDefault; + uiConfig.modelTransitionStyle = + JVIOSUIModalTransitionStyle.CrossDissolve; uiConfig.statusBarColorWithNav = true; uiConfig.virtualButtonTransparent = true; @@ -482,10 +491,7 @@ jverify.getSMSCode(phone,{signId:signId,tempId:tempId}).then((map){ |loginBtnPressedImage |String |设置授权登录按钮按下状态图片(ios)| |loginBtnUnableImage |String |设置授权登录按钮不可用状态图片(ios)| |logBtnOffsetY |int |设置登录按钮相对于标题栏下边缘y偏移| -|clauseName |String |设置开发者隐私条款1名称| -|clauseUrl |String |设置开发者隐私条款1的URL| -|clauseNameTwo |String |设置开发者隐私条款2名称| -|clauseUrlTwo |String |设置开发者隐私条款2的URL| +|privacyItem |List |设置开发者隐私条款| |clauseBaseColor |int |设置隐私条款名称颜色(基础文字颜色)| |clauseColor |int |设置隐私条款名称颜色(协议文字颜色)| |privacyOffsetY |int |设置隐私条款相对于授权页面底部下边缘y偏移| diff --git a/example/android/app/src/main/res/drawable-hdpi/main_bg.png b/example/android/app/src/main/res/drawable-hdpi/main_bg.png new file mode 100644 index 0000000..1e35906 Binary files /dev/null and b/example/android/app/src/main/res/drawable-hdpi/main_bg.png differ diff --git a/example/android/app/src/main/res/drawable-hdpi/main_v_bg.png b/example/android/app/src/main/res/drawable-hdpi/main_v_bg.png new file mode 100644 index 0000000..c37a9d2 Binary files /dev/null and b/example/android/app/src/main/res/drawable-hdpi/main_v_bg.png differ diff --git a/example/android/app/src/main/res/drawable-xxhdpi-v4/back.png b/example/android/app/src/main/res/drawable-xxhdpi-v4/back.png new file mode 100644 index 0000000..003f855 Binary files /dev/null and b/example/android/app/src/main/res/drawable-xxhdpi-v4/back.png differ diff --git a/example/android/app/src/main/res/drawable/logo.png b/example/android/app/src/main/res/drawable/logo.png deleted file mode 100644 index af9787e..0000000 Binary files a/example/android/app/src/main/res/drawable/logo.png and /dev/null differ diff --git a/example/android/app/src/main/res/raw/main_vi.mp4 b/example/android/app/src/main/res/raw/main_vi.mp4 new file mode 100644 index 0000000..c348ad7 Binary files /dev/null and b/example/android/app/src/main/res/raw/main_vi.mp4 differ diff --git a/example/android/build.gradle b/example/android/build.gradle index 1cc2840..b3fe2b7 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,7 +1,7 @@ buildscript { repositories { - maven { url 'https://maven.aliyun.com/repository/public/' } + mavenCentral() google() jcenter() } @@ -13,7 +13,7 @@ buildscript { allprojects { repositories { - maven { url 'https://maven.aliyun.com/repository/public/' } + mavenCentral() google() jcenter() } diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist index 9367d48..8d4492f 100644 --- a/example/ios/Flutter/AppFrameworkInfo.plist +++ b/example/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 8.0 + 9.0 diff --git a/example/ios/Flutter/Flutter.podspec b/example/ios/Flutter/Flutter.podspec index 5ca3041..663d5b2 100644 --- a/example/ios/Flutter/Flutter.podspec +++ b/example/ios/Flutter/Flutter.podspec @@ -1,18 +1,18 @@ # # NOTE: This podspec is NOT to be published. It is only used as a local source! +# This is a generated file; do not edit or check into version control. # Pod::Spec.new do |s| s.name = 'Flutter' s.version = '1.0.0' s.summary = 'High-performance, high-fidelity mobile apps.' - s.description = <<-DESC -Flutter provides an easy and productive way to build and deploy high-performance mobile apps for Android and iOS. - DESC s.homepage = 'https://flutter.io' s.license = { :type => 'MIT' } s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' } s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s } - s.ios.deployment_target = '8.0' - s.vendored_frameworks = 'Flutter.framework' + s.ios.deployment_target = '9.0' + # Framework linking is handled by Flutter tooling, not CocoaPods. + # Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs. + s.vendored_frameworks = 'path/to/nothing' end diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh index 0be2a44..1558e94 100755 --- a/example/ios/Flutter/flutter_export_environment.sh +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -1,13 +1,14 @@ #!/bin/sh # This is a generated file; do not edit or check into version control. -export "FLUTTER_ROOT=D:\Workspace\android\flutter" -export "FLUTTER_APPLICATION_PATH=D:\Workspace\work\work\jverify-flutter-plugin\example" -export "FLUTTER_TARGET=lib\main.dart" +export "FLUTTER_ROOT=/Users/douban/development/flutter" +export "FLUTTER_APPLICATION_PATH=/Users/douban/Documents/极光工作/JG_CODE/jverify-flutter-plugin/example" +export "COCOAPODS_PARALLEL_CODE_SIGN=true" +export "FLUTTER_TARGET=/Users/douban/Documents/极光工作/JG_CODE/jverify-flutter-plugin/example/./lib/main.dart" export "FLUTTER_BUILD_DIR=build" -export "SYMROOT=${SOURCE_ROOT}/../build\ios" export "FLUTTER_BUILD_NAME=1.0.0" export "FLUTTER_BUILD_NUMBER=1" +export "DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==" export "DART_OBFUSCATION=false" -export "TRACK_WIDGET_CREATION=false" +export "TRACK_WIDGET_CREATION=true" export "TREE_SHAKE_ICONS=false" -export "PACKAGE_CONFIG=.packages" +export "PACKAGE_CONFIG=/Users/douban/Documents/极光工作/JG_CODE/jverify-flutter-plugin/example/.dart_tool/package_config.json" diff --git a/example/ios/Podfile b/example/ios/Podfile index d077b08..f7d6a5e 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -10,60 +10,29 @@ project 'Runner', { 'Release' => :release, } -def parse_KV_file(file, separator='=') - file_abs_path = File.expand_path(file) - if !File.exists? file_abs_path - return []; +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" end - pods_ary = [] - skip_line_start_symbols = ["#", "/"] - File.foreach(file_abs_path) { |line| - next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } - plugin = line.split(pattern=separator) - if plugin.length == 2 - podname = plugin[0].strip() - path = plugin[1].strip() - podpath = File.expand_path("#{path}", file_abs_path) - pods_ary.push({:name => podname, :path => podpath}); - else - puts "Invalid plugin specification: #{line}" - end - } - return pods_ary + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" end -target 'Runner' do - # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock - # referring to absolute paths on developers' machines. - system('rm -rf .symlinks') - system('mkdir -p .symlinks/plugins') +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) - # Flutter Pods - generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') - if generated_xcode_build_settings.empty? - puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." - end - generated_xcode_build_settings.map { |p| - if p[:name] == 'FLUTTER_FRAMEWORK_DIR' - symlink = File.join('.symlinks', 'flutter') - File.symlink(File.dirname(p[:path]), symlink) - pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) - end - } +flutter_ios_podfile_setup - # Plugin Pods - plugin_pods = parse_KV_file('../.flutter-plugins') - plugin_pods.map { |p| - symlink = File.join('.symlinks', 'plugins', p[:name]) - File.symlink(p[:path], symlink) - pod p[:name], :path => File.join(symlink, 'ios') - } +target 'Runner' do + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) end post_install do |installer| installer.pods_project.targets.each do |target| - target.build_configurations.each do |config| - config.build_settings['ENABLE_BITCODE'] = 'NO' - end + flutter_additional_ios_build_settings(target) end end diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 6cc2a5b..8342941 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -166,7 +166,6 @@ 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - 3EAA4E67215C408AB6EF1883 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -241,24 +240,6 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; - 3EAA4E67215C408AB6EF1883 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", - "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework", - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; 881F7F5C9B13C6100922CDA7 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -369,7 +350,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -400,7 +381,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.jiguang.verification; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = JVerificationDemo_dev; + PROVISIONING_PROFILE_SPECIFIER = PRLIU_DEV_ALL; VERSIONING_SYSTEM = "apple-generic"; }; name = Profile; @@ -450,7 +431,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -497,7 +478,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -529,7 +510,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.jiguang.verification; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = JVerificationDemo_dev; + PROVISIONING_PROFILE_SPECIFIER = PRLIU_DEV_ALL; VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; @@ -557,7 +538,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.jiguang.verification; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = JVerificationDemo_dev; + PROVISIONING_PROFILE_SPECIFIER = PRLIU_DEV_ALL; VERSIONING_SYSTEM = "apple-generic"; }; name = Release; diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 1d526a1..919434a 100644 --- a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/example/lib/main.dart b/example/lib/main.dart index 223b79b..02a097d 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'dart:io'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:jverify/jverify.dart'; @@ -209,7 +210,7 @@ class _MyAppState extends State { _showLoading(context); }); String phoneNum = controllerPHone.text; - if (phoneNum == null || phoneNum.isEmpty) { + if (phoneNum.isEmpty) { setState(() { _hideLoading(); _result = "[3002],msg = 没有输入手机号码"; @@ -290,6 +291,9 @@ class _MyAppState extends State { /// JVUIConfig uiConfig = JVUIConfig(); // uiConfig.authBGGifPath = "main_gif"; + // uiConfig.authBGVideoPath="main_vi"; + uiConfig.authBGVideoPath="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"; + uiConfig.authBGVideoImgPath="main_v_bg"; //uiConfig.navHidden = true; uiConfig.navColor = Colors.red.value; @@ -313,8 +317,6 @@ class _MyAppState extends State { uiConfig.numberColor = Colors.blue.value; uiConfig.numberSize = 18; - - uiConfig.sloganOffsetY = isiOS ? 20 : 160; uiConfig.sloganVerticalLayoutItem = JVIOSLayoutItem.ItemNumber; uiConfig.sloganTextColor = Colors.black.value; @@ -330,6 +332,7 @@ class _MyAppState extends State { uiConfig.logBtnText = "登录按钮"; uiConfig.logBtnTextColor = Colors.brown.value; uiConfig.logBtnTextSize = 16; + uiConfig.logBtnTextBold = true; uiConfig.loginBtnNormalImage = "login_btn_normal"; //图片必须存在 uiConfig.loginBtnPressedImage = "login_btn_press"; //图片必须存在 uiConfig.loginBtnUnableImage = "login_btn_unable"; //图片必须存在 @@ -342,7 +345,7 @@ class _MyAppState extends State { uiConfig.checkedImgPath = "check_image"; //图片必须存在 uiConfig.uncheckedImgPath = "uncheck_image"; //图片必须存在 uiConfig.privacyCheckboxInCenter = true; - //uiConfig.privacyCheckboxHidden = false; + uiConfig.privacyCheckboxHidden = true; //uiConfig.privacyOffsetX = isiOS ? (20 + uiConfig.privacyCheckboxSize) : null; uiConfig.privacyOffsetY = 15; // 距离底部距离 @@ -353,8 +356,18 @@ class _MyAppState extends State { uiConfig.clauseNameTwo = "协议二"; uiConfig.clauseUrlTwo = "http://www.hao123.com"; uiConfig.clauseColor = Colors.red.value; - uiConfig.privacyText = ["1极", "2光", "3认", "4证"]; + uiConfig.privacyText = ["1极", "4证"]; uiConfig.privacyTextSize = 13; + uiConfig.privacyItem = [ + JVPrivacy("自定义协议1", "http://www.baidu.com", + beforeName: "==", afterName: "++", separator: "*"), + JVPrivacy("自定义协议2", "http://www.baidu.com", separator: "、"), + JVPrivacy("自定义协议3", "http://www.baidu.com", separator: "、"), + JVPrivacy("自定义协议4", "http://www.baidu.com", separator: "、"), + JVPrivacy("自定义协议5", "http://www.baidu.com", separator: "、") + + ]; + uiConfig.textVerAlignment = 1; //uiConfig.privacyWithBookTitleMark = true; //uiConfig.privacyTextCenterGravity = false; uiConfig.authStatusBarStyle = JVIOSBarStyle.StatusBarStyleDarkContent; @@ -373,53 +386,23 @@ class _MyAppState extends State { uiConfig.enterAnim = "activity_slide_enter_bottom"; uiConfig.exitAnim = "activity_slide_exit_bottom"; - uiConfig.privacyNavColor = Colors.red.value; uiConfig.privacyNavTitleTextColor = Colors.blue.value; uiConfig.privacyNavTitleTextSize = 16; uiConfig.privacyNavTitleTitle = "ios lai le"; //only ios - uiConfig.privacyNavTitleTitle1 = "协议11 web页标题"; - uiConfig.privacyNavTitleTitle2 = "协议22 web页标题"; - uiConfig.privacyNavReturnBtnImage = "return_bg"; //图片必须存在; + uiConfig.privacyNavReturnBtnImage = "back"; //图片必须存在; //弹框模式 - // JVPopViewConfig popViewConfig = JVPopViewConfig(); - // popViewConfig.width = (screenWidth - 100.0).toInt(); - // popViewConfig.height = (screenHeight - 150.0).toInt(); - // - // uiConfig.popViewConfig = popViewConfig; +// JVPopViewConfig popViewConfig = JVPopViewConfig(); +// popViewConfig.width = (screenWidth - 100.0).toInt(); +// popViewConfig.height = (screenHeight - 150.0).toInt(); +// +// uiConfig.popViewConfig = popViewConfig; /// 添加自定义的 控件 到授权界面 List widgetList = []; - /// 步骤 1:调用接口设置 UI - jverify.setCustomAuthorizationView(true, uiConfig, - landscapeConfig: uiConfig, widgets: widgetList); - - /// 步骤 2:调用一键登录接口 - - /// 方式一:使用同步接口 (如果想使用异步接口,则忽略此步骤,看方式二) - /// 先,添加 loginAuthSyncApi 接口回调的监听 - jverify.addLoginAuthCallBackListener((event) { - setState(() { - _hideLoading(); - _hideLoading(); - _result = "监听获取返回数据:[${event.code}] message = ${event.message}"; - }); - print( - "通过添加监听,获取到 loginAuthSyncApi 接口返回数据,code=${event.code},message = ${event.message},operator = ${event.operator}"); - }); - - /// 再,执行同步的一键登录接口 - jverify.loginAuthSyncApi(autoDismiss: true); - } else { - setState(() { - _hideLoading(); - _result = "[2016],msg = 当前网络环境不支持认证"; - }); - - /* final String text_widgetId = "jv_add_custom_text";// 标识控件 id JVCustomWidget textWidget = JVCustomWidget(text_widgetId, JVCustomWidgetType.textView); textWidget.title = "新加 text view 控件"; @@ -462,7 +445,36 @@ class _MyAppState extends State { } }); widgetList.add(buttonWidget); - */ + + /// 步骤 1:调用接口设置 UI + jverify.setCustomAuthorizationView(true, uiConfig, + landscapeConfig: uiConfig, widgets: widgetList); + + /// 步骤 2:调用一键登录接口 + + /// 方式一:使用同步接口 (如果想使用异步接口,则忽略此步骤,看方式二) + /// 先,添加 loginAuthSyncApi 接口回调的监听 + jverify.addLoginAuthCallBackListener((event) { + setState(() { + _hideLoading(); + _hideLoading(); + _result = "监听获取返回数据:[${event.code}] message = ${event.message}"; + }); + print( + "通过添加监听,获取到 loginAuthSyncApi 接口返回数据,code=${event.code},message = ${event.message},operator = ${event.operator}"); + }); + + /// 再,执行同步的一键登录接口 + jverify.loginAuthSyncApi(autoDismiss: true); + } else { + setState(() { + _hideLoading(); + _result = "[2016],msg = 当前网络环境不支持认证"; + }); + + + + /* 弹框模式 JVPopViewConfig popViewConfig = JVPopViewConfig(); @@ -517,6 +529,12 @@ class _MyAppState extends State { print("receive auth page event :${event.toMap()}"); }); } + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties.add(StringProperty('f_result_key', f_result_key)); + } } /// 封装 按钮 diff --git a/ios/Classes/JverifyPlugin.m b/ios/Classes/JverifyPlugin.m index 0ae3239..1b81450 100644 --- a/ios/Classes/JverifyPlugin.m +++ b/ios/Classes/JverifyPlugin.m @@ -24,12 +24,12 @@ @implementation JverifyPlugin NSObject* _jv_registrar; + (void)registerWithRegistrar:(NSObject*)registrar { - FlutterMethodChannel* channel = [FlutterMethodChannel methodChannelWithName:@"jverify" - binaryMessenger:[registrar messenger]]; - _jv_registrar = registrar; - JverifyPlugin* instance = [[JverifyPlugin alloc] init]; - instance.channel = channel; - [registrar addMethodCallDelegate:instance channel:channel]; + FlutterMethodChannel* channel = [FlutterMethodChannel methodChannelWithName:@"jverify" + binaryMessenger:[registrar messenger]]; + _jv_registrar = registrar; + JverifyPlugin* instance = [[JverifyPlugin alloc] init]; + instance.channel = channel; + [registrar addMethodCallDelegate:instance channel:channel]; } - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { @@ -57,7 +57,7 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { }else if([methodName isEqualToString:@"dismissLoginAuthView"]){ [self dismissLoginController:call result:result]; }else if([methodName isEqualToString:@"setCustomUI"]){ -// [self setCustomUIWithConfig:call result:result]; + // [self setCustomUIWithConfig:call result:result]; }else if ([methodName isEqualToString:@"setCustomAuthViewAllWidgets"]) { [self setCustomAuthViewAllWidgets:call result:result]; }else if ([methodName isEqualToString:@"clearPreLoginCache"]) { @@ -82,9 +82,9 @@ - (void)getSMSCode:(FlutterMethodCall*) call result:(FlutterResult)resultDict{ NSString *tempId = arguments[@"tempId"]; [JVERIFICATIONService getSMSCode:phoneNumber templateID:tempId signID:singId completionHandler:^(NSDictionary * _Nonnull result) { dispatch_async(dispatch_get_main_queue(), ^{ - NSNumber *code = [result objectForKey:@"code"]; - NSString *msg = [result objectForKey:@"msg"]; - NSString *uuid = [result objectForKey:@"uuid"]; + NSNumber *code = [result objectForKey:@"code"]; + NSString *msg = [result objectForKey:@"msg"]; + NSString *uuid = [result objectForKey:@"uuid"]; if ([code intValue] == 3000) { NSDictionary*dict = @{@"code":code,@"message":msg,@"result":uuid}; resultDict(dict); @@ -146,11 +146,11 @@ - (void)setup:(FlutterMethodCall*) call result:(FlutterResult)result{ __strong typeof(weakself) strongself = weakself; dispatch_async(dispatch_get_main_queue(), ^{ NSString *message = result[@"content"]; - NSString *code = result[@"code"]; - NSDictionary *dic = @{ - j_code_key:(code?@([code intValue]):@(0)), - j_msg_key:(message?message:@"") - }; + NSString *code = result[@"code"]; + NSDictionary *dic = @{ + j_code_key:(code?@([code intValue]):@(0)), + j_msg_key:(message?message:@"") + }; //通过 channel 返回 [strongself.channel invokeMethod:@"onReceiveSDKSetupCallBackEvent" arguments:dic]; }); @@ -205,9 +205,9 @@ -(void)getToken:(FlutterMethodCall*)call result:(FlutterResult)result{ 参数说明 timeout 超时时间。单位ms,合法范围3000~10000。 completion 参数是字典 返回token 、错误码等相关信息,token有效期1分钟, 一次认证后失效 - res 字典 - 获取到token时,key 有 code、token、operator 字段, - 获取不到token时,key 为 code 、content 字段 + res 字典 + 获取到token时,key 有 code、token、operator 字段, + 获取不到token时,key 为 code 、content 字段 */ [JVERIFICATIONService getToken:timeout completion:^(NSDictionary *res) { @@ -220,10 +220,10 @@ -(void)getToken:(FlutterMethodCall*)call result:(FlutterResult)result{ content = res[@"content"]; } NSDictionary *dict = @{ - j_code_key: res[@"code"], - j_msg_key : content, - j_opr_key : res[@"operator"] ? res[@"operator"] : @"" - }; + j_code_key: res[@"code"], + j_msg_key : content, + j_opr_key : res[@"operator"] ? res[@"operator"] : @"" + }; dispatch_async(dispatch_get_main_queue(), ^{ result(dict); @@ -234,33 +234,33 @@ -(void)getToken:(FlutterMethodCall*)call result:(FlutterResult)result{ #pragma mark - SDK 发起号码认证 -(void)verifyNumber:(FlutterMethodCall*) call result:(FlutterResult)result{ JVLog(@"Action - verifyNumber::%@",call.arguments); - - /* 2.4.3版本开始,此接口已移除 - NSDictionary *arguments= [call arguments]; - NSString *phone = arguments[@"phone"]; - NSString *token = arguments[@"token"]; - - [JVERIFICATIONService ] - JVAuthEntity *entity = [[JVAuthEntity alloc] init]; - entity.number = phone; - if (![token isKindOfClass:[NSNull class]]) { - if (token && token.length) { - entity.token = token; - } - } - [JVERIFICATIONService verifyNumber:entity result:^(NSDictionary *res) { - JVLog(@"sdk verifyNumber completion : %@",res); - - NSDictionary *dict = @{ - j_code_key:res[@"code"], - j_msg_key :res[@"content"] ? res[@"content"] : @"" - }; - dispatch_async(dispatch_get_main_queue(), ^{ - result(dict); - }); - }]; - */ + /* 2.4.3版本开始,此接口已移除 + NSDictionary *arguments= [call arguments]; + NSString *phone = arguments[@"phone"]; + NSString *token = arguments[@"token"]; + + [JVERIFICATIONService ] + JVAuthEntity *entity = [[JVAuthEntity alloc] init]; + entity.number = phone; + if (![token isKindOfClass:[NSNull class]]) { + if (token && token.length) { + entity.token = token; + } + } + + [JVERIFICATIONService verifyNumber:entity result:^(NSDictionary *res) { + JVLog(@"sdk verifyNumber completion : %@",res); + + NSDictionary *dict = @{ + j_code_key:res[@"code"], + j_msg_key :res[@"content"] ? res[@"content"] : @"" + }; + dispatch_async(dispatch_get_main_queue(), ^{ + result(dict); + }); + }]; + */ } #pragma mark - SDK 登录预取号 - (void)preLogin:(FlutterMethodCall*) call result:(FlutterResult)result { @@ -275,17 +275,17 @@ - (void)preLogin:(FlutterMethodCall*) call result:(FlutterResult)result { /* 参数说明: - completion 预取号结果 - result 字典 key为code和message两个字段 - timeout 超时时间。单位ms,合法范围3000~10000。 + completion 预取号结果 + result 字典 key为code和message两个字段 + timeout 超时时间。单位ms,合法范围3000~10000。 */ [JVERIFICATIONService preLogin:timeout completion:^(NSDictionary *res) { JVLog(@"sdk preLogin completion :%@",res); NSDictionary *dict = @{ - j_code_key:res[@"code"], - j_msg_key :res[@"message"] ? res[@"message"] : @"" - }; + j_code_key:res[@"code"], + j_msg_key :res[@"message"] ? res[@"message"] : @"" + }; dispatch_async(dispatch_get_main_queue(), ^{ result(dict); }); @@ -308,7 +308,7 @@ -(void)loginAuthSyncApi:(FlutterMethodCall*) call result:(FlutterResult)result { } -(void)loginAuthSync:(BOOL)isSync call:(FlutterMethodCall*)call result:(FlutterResult)result { JVLog(@"Action - loginAuthSync::%@",call.arguments); - + NSDictionary *arguments = [call arguments]; NSNumber *hide = arguments[@"autoDismiss"]; NSTimeInterval timeout = [arguments[@"timeout"] longLongValue]; @@ -327,10 +327,10 @@ -(void)loginAuthSync:(BOOL)isSync call:(FlutterMethodCall*)call result:(FlutterR } NSDictionary *dict = @{ - j_code_key:res[@"code"], - j_msg_key :content, - j_opr_key :res[@"operator"]?:@"" - }; + j_code_key:res[@"code"], + j_msg_key :content, + j_opr_key :res[@"operator"]?:@"" + }; __strong typeof(weakself) strongself = weakself; dispatch_async(dispatch_get_main_queue(), ^{ if (isSync) { @@ -345,9 +345,9 @@ -(void)loginAuthSync:(BOOL)isSync call:(FlutterMethodCall*)call result:(FlutterR JVLog("Authorization actionBlock: type = %ld", (long)type); /// 事件 NSDictionary *jsonMap = @{ - j_code_key:@(type), - j_msg_key:content?content:@"" - }; + j_code_key:@(type), + j_msg_key:content?content:@"" + }; __strong typeof(weakself) strongself = weakself; dispatch_async(dispatch_get_main_queue(), ^{ [strongself.channel invokeMethod:@"onReceiveAuthPageEvent" arguments:jsonMap]; @@ -380,10 +380,10 @@ - (void)setCustomAuthorizationView:(FlutterMethodCall*) call result:(FlutterResu } - (void)layoutUIConfig:(NSDictionary *)uiconfigPara widgets:(NSArray *)widgets isAutorotate:(BOOL)isAutorotate { - + JVUIConfig *config = [[JVUIConfig alloc] init]; config.autoLayout = YES; - + config.shouldAutorotate = isAutorotate; [self setCustomUIWithUIConfig:config configArguments:uiconfigPara]; [JVERIFICATIONService customUIWithConfig:config customViews:^(UIView *customAreaView) { @@ -428,12 +428,20 @@ - (void)setCustomUIWithUIConfig:(JVUIConfig *)uiconfig configArguments:(NSDictio uiconfig.preferredStatusBarStyle = [self getStatusBarStyle:authStatusBarStyle]; uiconfig.agreementPreferredStatusBarStyle = [self getStatusBarStyle:privacyStatusBarStyle]; uiconfig.dismissAnimationFlag = needCloseAnim; - + if ([[config allKeys] containsObject:@"authBGVideoPath"] && [[config allKeys] containsObject:@"authBGVideoImgPath"]) { + [uiconfig setVideoBackgroudResource:[config objectForKey:@"authBGVideoPath"] placeHolder:[config objectForKey:@"authBGVideoImgPath"]]; + } + if ([[config allKeys] containsObject:@"authBGGifPath"]) { + NSString *gitPath = [[NSBundle mainBundle] pathForResource:[config objectForKey:@"authBGGifPath"] ofType:@"gif"]; + if (gitPath) { + uiconfig.authPageGifImagePath = gitPath; + } + } /************** 弹出方式 ***************/ UIModalTransitionStyle transitionStyle = [self getTransitionStyle:[self getValue:config key:@"modelTransitionStyle"]]; uiconfig.modalTransitionStyle = transitionStyle; - /************** 背景 ***************/ + /************** 背景 ***************/ NSString *authBackgroundImage = [config objectForKey:@"authBackgroundImage"]; authBackgroundImage = authBackgroundImage?:nil; if (authBackgroundImage) { @@ -442,11 +450,11 @@ - (void)setCustomUIWithUIConfig:(JVUIConfig *)uiconfig configArguments:(NSDictio needStartAnim = [[self getValue:config key:@"needCloseAnim"] boolValue]; needCloseAnim = [[self getValue:config key:@"needCloseAnim"] boolValue]; - + JVLog(@"Action - setCustomAuthorizationView:needStartAnim %d",needStartAnim); JVLog(@"Action - setCustomAuthorizationView:needStartAnim %d",needCloseAnim); - /************** 导航栏 ***************/ + /************** 导航栏 ***************/ NSNumber *navHidden = [self getValue:config key:@"navHidden"]; if (navHidden) { uiconfig.navCustom = [navHidden boolValue]; @@ -548,7 +556,7 @@ - (void)setCustomUIWithUIConfig:(JVUIConfig *)uiconfig configArguments:(NSDictio NSNumber *sloganOffsetY = [self getNumberValue:config key:@"sloganOffsetY"]; NSNumber *sloganWidth = [self getNumberValue:config key:@"sloganWidth"]; NSNumber *sloganHeight = [self getNumberValue:config key:@"sloganHeight"]; - + if (sloganLayoutItem == JVLayoutItemNone) { uiconfig.sloganOffsetY = [sloganOffsetY floatValue]; }else{ @@ -613,13 +621,30 @@ - (void)setCustomUIWithUIConfig:(JVUIConfig *)uiconfig configArguments:(NSDictio uiconfig.logBtnImgs = images; /************** chck box ***************/ + NSNumber *privacyOffsetY = [self getNumberValue:config key:@"privacyOffsetY"]; + NSNumber *privacyOffsetX = [self getValue:config key:@"privacyOffsetX"]; + CGFloat privacyCheckboxSize = [[self getNumberValue:config key:@"privacyCheckboxSize"] floatValue]; if (privacyCheckboxSize == 0) { privacyCheckboxSize = 20.0; } BOOL privacyCheckboxInCenter = [[self getValue:config key:@"privacyCheckboxInCenter"] boolValue]; - JVLayoutConstraint *box_cons_x = [JVLayoutConstraint constraintWithAttribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:JVLayoutItemPrivacy attribute:NSLayoutAttributeLeft multiplier:1 constant:0]; + BOOL privacyCheckboxHidden = [[self getValue:config key:@"privacyCheckboxHidden"] boolValue]; + uiconfig.checkViewHidden = privacyCheckboxHidden; + CGFloat privacyLeftSpace = 0; + + if (privacyOffsetX == nil) { + uiconfig.privacyTextAlignment = NSTextAlignmentCenter; + privacyOffsetX = @(15); + + } + privacyLeftSpace = privacyCheckboxHidden ? [privacyOffsetX floatValue] : ([privacyOffsetX floatValue]+privacyCheckboxSize+5+5);//算上CheckBox的左右间隙; + CGFloat privacyRightSpace = [privacyOffsetX floatValue] ; + + + //checkbox + JVLayoutConstraint *box_cons_x = [JVLayoutConstraint constraintWithAttribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:JVLayoutItemPrivacy attribute:NSLayoutAttributeLeft multiplier:1 constant:-[privacyOffsetX floatValue]/2]; JVLayoutConstraint *box_cons_y = [JVLayoutConstraint constraintWithAttribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:JVLayoutItemPrivacy attribute:NSLayoutAttributeTop multiplier:1 constant:3]; if (privacyCheckboxInCenter) { box_cons_y = [JVLayoutConstraint constraintWithAttribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:JVLayoutItemPrivacy attribute:NSLayoutAttributeCenterY multiplier:1 constant:0]; @@ -630,9 +655,6 @@ - (void)setCustomUIWithUIConfig:(JVUIConfig *)uiconfig configArguments:(NSDictio uiconfig.checkViewConstraints = @[box_cons_x,box_cons_y,box_cons_w,box_cons_h]; uiconfig.checkViewHorizontalConstraints = uiconfig.checkViewConstraints; - BOOL privacyCheckboxHidden = [[self getValue:config key:@"privacyCheckboxHidden"] boolValue]; - uiconfig.checkViewHidden = privacyCheckboxHidden; - NSNumber *privacyState = [self getValue:config key:@"privacyState"]; uiconfig.privacyState = [privacyState boolValue]; @@ -644,8 +666,83 @@ - (void)setCustomUIWithUIConfig:(JVUIConfig *)uiconfig configArguments:(NSDictio if (checkedImgPath) { uiconfig.checkedImg = [UIImage imageNamed:checkedImgPath]; } - + /************** privacy ***************/ + + //自定义协议 + NSString *tempSting = @""; + BOOL privacyWithBookTitleMark = [[self getValue:config key:@"privacyWithBookTitleMark"] boolValue]; + + NSMutableArray *appPrivacyss = [NSMutableArray array]; + if([[config allKeys] containsObject:@"privacyText"] && [[config objectForKey:@"privacyText"] isKindOfClass:[NSArray class]]) + { + if ([[config objectForKey:@"privacyText"] count]>=1) { + [appPrivacyss addObject:[[config objectForKey:@"privacyText"] objectAtIndex:0]]; + tempSting = [tempSting stringByAppendingString:[[config objectForKey:@"privacyText"] objectAtIndex:0]]; + } + + } + if([[config allKeys] containsObject:@"privacyItem"] && [[config objectForKey:@"privacyItem"] isKindOfClass:[NSString class]]){ + NSString *privacyJson = [config objectForKey:@"privacyItem"]; + NSData *privacyData = [privacyJson dataUsingEncoding:NSUTF8StringEncoding]; + NSArray *privacys= [NSJSONSerialization JSONObjectWithData:privacyData options:0 error:nil]; + for (NSInteger i = 0; i=2) { + [appPrivacyss addObject:[[config objectForKey:@"privacyText"] objectAtIndex:1]]; + tempSting = [tempSting stringByAppendingString:[[config objectForKey:@"privacyText"] objectAtIndex:1]]; + } + + } + + //设置 + if (appPrivacyss.count>1) { + uiconfig.appPrivacys = appPrivacyss; + } + BOOL privacyHintToast = [[self getValue:config key:@"privacyHintToast"] boolValue]; if(privacyHintToast){ uiconfig.customPrivacyAlertViewBlock = ^(UIViewController *vc) { @@ -656,32 +753,28 @@ - (void)setCustomUIWithUIConfig:(JVUIConfig *)uiconfig configArguments:(NSDictio }; } - - BOOL isCenter = [[self getValue:config key:@"privacyTextCenterGravity"] boolValue]; NSTextAlignment alignmet = isCenter?NSTextAlignmentCenter:NSTextAlignmentLeft; uiconfig.privacyTextAlignment = alignmet; - BOOL privacyWithBookTitleMark = [[self getValue:config key:@"privacyWithBookTitleMark"] boolValue]; uiconfig.privacyShowBookSymbol = privacyWithBookTitleMark; - NSString *tempSting = @""; NSString *clauseName = [self getValue:config key:@"clauseName"]; NSString *clauseUrl = [self getValue:config key:@"clauseUrl"]; - if (clauseName && clauseUrl) { + if (![[config allKeys] containsObject:@"privacyItem"] && clauseName && clauseUrl) { uiconfig.appPrivacyOne = @[clauseName,clauseUrl]; tempSting = [tempSting stringByAppendingFormat:@"%@%@%@",(privacyWithBookTitleMark?@"《":@""),clauseName,(privacyWithBookTitleMark?@"》":@"")]; } NSString *clauseNameTwo = [self getValue:config key:@"clauseNameTwo"]; NSString *clauseUrlTwo = [self getValue:config key:@"clauseUrlTwo"]; - if (clauseNameTwo && clauseUrlTwo) { + if (![[config allKeys] containsObject:@"privacyItem"] && clauseNameTwo && clauseUrlTwo) { uiconfig.appPrivacyTwo = @[clauseNameTwo,clauseUrlTwo]; tempSting = [tempSting stringByAppendingFormat:@"%@%@%@",(privacyWithBookTitleMark?@"《":@""),clauseNameTwo,(privacyWithBookTitleMark?@"》":@"")]; } NSArray *privacyComponents = [self getValue:config key:@"privacyText"]; - if (privacyComponents.count) { + if (![[config allKeys] containsObject:@"privacyItem"] && privacyComponents.count) { uiconfig.privacyComponents = privacyComponents; tempSting = [tempSting stringByAppendingString:[privacyComponents componentsJoinedByString:@"、"]]; } @@ -692,39 +785,35 @@ - (void)setCustomUIWithUIConfig:(JVUIConfig *)uiconfig configArguments:(NSDictio } JVLayoutItem privacyLayoutItem = [self getLayotItem:[self getValue:config key:@"privacyVerticalLayoutItem"]]; - NSNumber *privacyOffsetY = [self getNumberValue:config key:@"privacyOffsetY"]; - NSNumber *privacyOffsetX = [self getValue:config key:@"privacyOffsetX"]; - CGFloat privacyLeftSpace = 0; - CGFloat privacyRightSpace = 15; - if (privacyOffsetX == nil) { - uiconfig.privacyTextAlignment = NSTextAlignmentCenter; - privacyOffsetX = @(15); - privacyLeftSpace = [privacyOffsetX floatValue] + privacyCheckboxSize; - privacyRightSpace = privacyCheckboxSize; - }else{ - privacyLeftSpace = [privacyOffsetX floatValue]; - privacyRightSpace = privacyLeftSpace - privacyCheckboxSize; + int widthScreen = [UIScreen mainScreen].bounds.size.width; + NSDictionary *popViewConfig = [self getValue:config key:@"popViewConfig"]; + if (popViewConfig) { + widthScreen = [[self getValue:popViewConfig key:@"width"] intValue]; } + tempSting = [tempSting stringByAppendingString:@"《中国移动统一认证服务条款》"]; + CGFloat lableWidht = widthScreen - (privacyLeftSpace + privacyRightSpace); + CGSize lablesize = [tempSting boundingRectWithSize:CGSizeMake(lableWidht, CGFLOAT_MAX) + options:NSStringDrawingUsesLineFragmentOrigin + attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:[privacyTextSize floatValue]]} + context:nil].size; - tempSting = [tempSting stringByAppendingString:@"《xxx统一认证服务条款》"]; - CGFloat lableWidht = [UIScreen mainScreen].bounds.size.width - [privacyOffsetX floatValue]*2 - privacyCheckboxSize*3; - CGSize lablesize = [tempSting boundingRectWithSize:CGSizeMake(lableWidht, MAXFLOAT) - options:NSStringDrawingUsesLineFragmentOrigin - attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:[privacyTextSize floatValue]+2]} - context:nil].size; - - JVLayoutConstraint *privacy_cons_left = [JVLayoutConstraint constraintWithAttribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:JVLayoutItemSuper attribute:NSLayoutAttributeLeft multiplier:1 constant:privacyLeftSpace]; - JVLayoutConstraint *privacy_cons_right = [JVLayoutConstraint constraintWithAttribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:JVLayoutItemSuper attribute:NSLayoutAttributeRight multiplier:1 constant:-(privacyRightSpace)]; + JVLayoutConstraint *privacy_cons_x = [JVLayoutConstraint constraintWithAttribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:JVLayoutItemSuper attribute:NSLayoutAttributeLeft multiplier:1 constant:privacyLeftSpace]; JVLayoutConstraint *privacy_cons_y = [JVLayoutConstraint constraintWithAttribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:JVLayoutItemSuper attribute:NSLayoutAttributeBottom multiplier:1 constant:-[privacyOffsetY floatValue]]; + JVLayoutConstraint *privacy_cons_w = [JVLayoutConstraint constraintWithAttribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:JVLayoutItemNone attribute:NSLayoutAttributeWidth multiplier:1 constant:lableWidht]; JVLayoutConstraint *privacy_cons_h = [JVLayoutConstraint constraintWithAttribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:JVLayoutItemNone attribute:NSLayoutAttributeHeight multiplier:1 constant:lablesize.height]; - if (privacyLayoutItem == JVLayoutItemNone) { uiconfig.privacyOffsetY = [privacyOffsetY floatValue]; }else{ - uiconfig.privacyConstraints = @[privacy_cons_left,privacy_cons_y,privacy_cons_right,privacy_cons_h]; + uiconfig.privacyConstraints = @[privacy_cons_x,privacy_cons_y,privacy_cons_w,privacy_cons_h]; uiconfig.privacyHorizontalConstraints = uiconfig.privacyConstraints; } + //隐私条款垂直对齐方式 + if ([[config allKeys] containsObject:@"textVerAlignment"]) { + uiconfig.textVerAlignment = [[config objectForKey:@"textVerAlignment"] intValue]; + }else{ + uiconfig.textVerAlignment = JVVerAlignmentMiddle; + } NSNumber *clauseBaseColor = [self getValue:config key:@"clauseBaseColor"]; UIColor *privacyBasicColor =[UIColor grayColor]; @@ -748,7 +837,7 @@ - (void)setCustomUIWithUIConfig:(JVUIConfig *)uiconfig configArguments:(NSDictio if (!privacyNavText) { privacyNavText = @"运营商服务条款"; } - + UIColor *privacyNavTitleTextColor = UIColorFromRGB(-1); if ([self getValue:config key:@"privacyNavTitleTextColor"]) { privacyNavTitleTextColor = UIColorFromRGB([[self getValue:config key:@"privacyNavTitleTextColor"] intValue]); @@ -761,6 +850,7 @@ - (void)setCustomUIWithUIConfig:(JVUIConfig *)uiconfig configArguments:(NSDictio NSFontAttributeName:[UIFont systemFontOfSize:[privacyNavTitleTextSize floatValue]]}; NSAttributedString *privayAttr = [[NSAttributedString alloc]initWithString:privacyNavText attributes:privayNavTextAttr]; uiconfig.agreementNavText = privayAttr; + uiconfig.agreementNavTextColor = privacyNavTitleTextColor; NSString *privacyNavReturnBtnImage =[self getValue:config key:@"privacyNavReturnBtnImage"]; if(privacyNavReturnBtnImage){ @@ -773,7 +863,7 @@ - (void)setCustomUIWithUIConfig:(JVUIConfig *)uiconfig configArguments:(NSDictio privacyNavTitleTitle1 = @"服务条款"; } NSDictionary *privayNavTextAttr1 = @{NSForegroundColorAttributeName:privacyNavTitleTextColor, - NSFontAttributeName:[UIFont systemFontOfSize:[privacyNavTitleTextSize floatValue]]}; + NSFontAttributeName:[UIFont systemFontOfSize:[privacyNavTitleTextSize floatValue]]}; NSAttributedString *privayAttr1 = [[NSAttributedString alloc]initWithString:privacyNavTitleTitle1 attributes:privayNavTextAttr1]; uiconfig.firstPrivacyAgreementNavText = privayAttr1; @@ -783,7 +873,7 @@ - (void)setCustomUIWithUIConfig:(JVUIConfig *)uiconfig configArguments:(NSDictio privacyNavTitleTitle2 = @"服务条款"; } NSDictionary *privayNavTextAttr2 = @{NSForegroundColorAttributeName:privacyNavTitleTextColor, - NSFontAttributeName:[UIFont systemFontOfSize:[privacyNavTitleTextSize floatValue]]}; + NSFontAttributeName:[UIFont systemFontOfSize:[privacyNavTitleTextSize floatValue]]}; NSAttributedString *privayAttr2 = [[NSAttributedString alloc]initWithString:privacyNavTitleTitle2 attributes:privayNavTextAttr2]; uiconfig.secondPrivacyAgreementNavText = privayAttr2; @@ -792,12 +882,11 @@ - (void)setCustomUIWithUIConfig:(JVUIConfig *)uiconfig configArguments:(NSDictio JVLayoutConstraint *loadingConstraintY = [JVLayoutConstraint constraintWithAttribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:JVLayoutItemSuper attribute:NSLayoutAttributeCenterY multiplier:1 constant:0]; JVLayoutConstraint *loadingConstraintW = [JVLayoutConstraint constraintWithAttribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:JVLayoutItemNone attribute:NSLayoutAttributeWidth multiplier:1 constant:30]; JVLayoutConstraint *loadingConstraintH = [JVLayoutConstraint constraintWithAttribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:JVLayoutItemNone attribute:NSLayoutAttributeHeight multiplier:1 constant:30]; - + uiconfig.loadingConstraints = @[loadingConstraintX,loadingConstraintY,loadingConstraintW,loadingConstraintH]; uiconfig.loadingHorizontalConstraints = uiconfig.loadingConstraints; /************** 窗口模式样式设置 ***************/ - NSDictionary *popViewConfig = [self getValue:config key:@"popViewConfig"]; if (popViewConfig) { NSNumber *isPopViewTheme = [self getValue:popViewConfig key:@""]; NSNumber *width = [self getValue:popViewConfig key:@"width"]; @@ -815,7 +904,12 @@ - (void)setCustomUIWithUIConfig:(JVUIConfig *)uiconfig configArguments:(NSDictio uiconfig.navCustom = YES; uiconfig.windowCornerRadius = [popViewCornerRadius floatValue]; uiconfig.windowBackgroundAlpha = [backgroundAlpha floatValue]; - + + // 弹窗模式背景图 + if (authBackgroundImage) { + uiconfig.windowBackgroundImage = [UIImage imageNamed:authBackgroundImage]; + } + CGFloat windowW = [width floatValue]; CGFloat windowH = [height floatValue]; CGFloat windowX = [offsetCenterX floatValue]; @@ -941,7 +1035,7 @@ - (UIButton *)addCustomButtonWidget:(NSDictionary *)widgetDic { if (font) { button.titleLabel.font = [UIFont systemFontOfSize:[font floatValue]]; } - + NSNumber *isShowUnderline = [self getValue:widgetDic key:@"isShowUnderline"]; if ([isShowUnderline boolValue]) { @@ -955,13 +1049,13 @@ - (UIButton *)addCustomButtonWidget:(NSDictionary *)widgetDic { NSNumber *isClickEnable = [self getValue:widgetDic key:@"isClickEnable"]; button.userInteractionEnabled = [isClickEnable boolValue]; [button addTarget:self action:@selector(clickCustomWidgetAction:) forControlEvents:UIControlEventTouchUpInside]; - - NSString *widgetId = [self getValue:widgetDic key:@"widgetId"]; - + + NSString *widgetId = [self getValue:widgetDic key:@"widgetId"]; + NSString *tag = @(left+top+width+height).stringValue; button.tag = [tag integerValue]; - + [self.customWidgetIdDic setObject:widgetId forKey:tag]; diff --git a/ios/jverify.podspec b/ios/jverify.podspec index 0b20101..f8c8f51 100644 --- a/ios/jverify.podspec +++ b/ios/jverify.podspec @@ -15,8 +15,8 @@ A new flutter plugin project. s.source_files = 'Classes/**/*' s.public_header_files = 'Classes/**/*.h' s.dependency 'Flutter' - s.dependency 'JCore', '2.6.2' - s.dependency 'JVerification', '2.7.1' + s.dependency 'JCore', '3.1.2' + s.dependency 'JVerification', '2.7.7' s.ios.deployment_target = '8.0' s.static_framework = true end diff --git a/lib/jverify.dart b/lib/jverify.dart index 0403397..18df648 100644 --- a/lib/jverify.dart +++ b/lib/jverify.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:convert'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; @@ -457,6 +458,8 @@ class JVUIConfig { /// 授权页背景图片 String? authBackgroundImage; String? authBGGifPath; // 授权界面gif图片 only android + String? authBGVideoPath; // 授权界面video + String? authBGVideoImgPath; // 授权界面video的第一频图片 /// 导航栏 int? navColor; @@ -466,12 +469,14 @@ class JVUIConfig { bool navHidden = false; bool navReturnBtnHidden = false; bool navTransparent = false; + bool? navTextBold; /// logo int? logoWidth; int? logoHeight; int? logoOffsetX; int? logoOffsetY; + int? logoOffsetBottomY; JVIOSLayoutItem? logoVerticalLayoutItem; bool? logoHidden; String? logoImgPath; @@ -479,32 +484,37 @@ class JVUIConfig { /// 号码 int? numberColor; int? numberSize; + bool? numberTextBold; int? numFieldOffsetX; int? numFieldOffsetY; int? numberFieldWidth; int? numberFieldHeight; JVIOSLayoutItem? numberVerticalLayoutItem; + int? numberFieldOffsetBottomY; /// slogan int? sloganOffsetX; int? sloganOffsetY; + int? sloganBottomOffsetY; JVIOSLayoutItem? sloganVerticalLayoutItem; int? sloganTextColor; int? sloganTextSize; int? sloganWidth; int? sloganHeight; - + bool? sloganTextBold; bool sloganHidden = false; /// 登录按钮 int? logBtnOffsetX; int? logBtnOffsetY; + int? logBtnBottomOffsetY; int? logBtnWidth; int? logBtnHeight; JVIOSLayoutItem? logBtnVerticalLayoutItem; String? logBtnText; int? logBtnTextSize; int? logBtnTextColor; + bool? logBtnTextBold; String? logBtnBackgroundPath; String? loginBtnNormalImage; // only ios String? loginBtnPressedImage; // only ios @@ -530,13 +540,19 @@ class JVUIConfig { int? clauseColor; List? privacyText; int? privacyTextSize; + List? privacyItem; bool privacyWithBookTitleMark = true; //设置隐私条款运营商协议名是否加书名号 bool privacyTextCenterGravity = false; //隐私条款文字是否居中对齐(默认左对齐) + int? textVerAlignment = 1;//设置条款文字是否垂直居中对齐(默认居中对齐) 0是top 1是m 2是b + int? privacyTopOffsetY; + bool? privacyTextBold; + bool? privacyUnderlineText; //设置隐私条款文字字体是否加下划线 /// 隐私协议 web 页 UI 配置 int? privacyNavColor; // 导航栏颜色 int? privacyNavTitleTextColor; // 标题颜色 int? privacyNavTitleTextSize; // 标题大小 + bool? privacyNavTitleTextBold; // 标题字体加粗 String? privacyNavTitleTitle; //协议0 web页面导航栏标题 only ios String? privacyNavTitleTitle1; // 协议1 web页面导航栏标题 String? privacyNavTitleTitle2; // 协议2 web页面导航栏标题 @@ -574,11 +590,15 @@ class JVUIConfig { Map toJsonMap() { return { + "privacyItem": privacyItem != null ? json.encode(privacyItem) : null, "authBackgroundImage": authBackgroundImage ??= null, "authBGGifPath": authBGGifPath ??= null, + "authBGVideoPath": authBGVideoPath ??= null, + "authBGVideoImgPath": authBGVideoImgPath ??= null, "navColor": navColor ??= null, "navText": navText ??= null, "navTextColor": navTextColor ??= null, + "navTextBold": navTextBold ??= null, "navReturnImgPath": navReturnImgPath ??= null, "navHidden": navHidden, "navReturnBtnHidden": navReturnBtnHidden, @@ -588,23 +608,28 @@ class JVUIConfig { "logoHeight": logoHeight ??= null, "logoOffsetY": logoOffsetY ??= null, "logoOffsetX": logoOffsetX ??= null, + "logoOffsetBottomY": logoOffsetBottomY ??= null, "logoVerticalLayoutItem": getStringFromEnum(logoVerticalLayoutItem), "logoHidden": logoHidden ??= null, "numberColor": numberColor ??= null, "numberSize": numberSize ??= null, + "numberTextBold": numberTextBold ??= null, "numFieldOffsetY": numFieldOffsetY ??= null, "numFieldOffsetX": numFieldOffsetX ??= null, + "numberFieldOffsetBottomY": numberFieldOffsetBottomY ??= null, "numberFieldWidth": numberFieldWidth ??= null, "numberFieldHeight": numberFieldHeight ??= null, "numberVerticalLayoutItem": getStringFromEnum(numberVerticalLayoutItem), "logBtnText": logBtnText ??= null, "logBtnOffsetY": logBtnOffsetY ??= null, "logBtnOffsetX": logBtnOffsetX ??= null, + "logBtnBottomOffsetY": logBtnBottomOffsetY ??= null, "logBtnWidth": logBtnWidth ??= null, "logBtnHeight": logBtnHeight ??= null, "logBtnVerticalLayoutItem": getStringFromEnum(logBtnVerticalLayoutItem), "logBtnTextSize": logBtnTextSize ??= null, "logBtnTextColor": logBtnTextColor ??= null, + "logBtnTextBold": logBtnTextBold ??= null, "logBtnBackgroundPath": logBtnBackgroundPath ??= null, "loginBtnNormalImage": loginBtnNormalImage ??= null, "loginBtnPressedImage": loginBtnPressedImage ??= null, @@ -615,9 +640,12 @@ class JVUIConfig { "privacyHintToast": privacyHintToast, "privacyOffsetY": privacyOffsetY ??= null, "privacyOffsetX": privacyOffsetX ??= null, + "privacyTopOffsetY": privacyTopOffsetY ??= null, "privacyVerticalLayoutItem": getStringFromEnum(privacyVerticalLayoutItem), "privacyText": privacyText ??= null, "privacyTextSize": privacyTextSize ??= null, + "privacyTextBold": privacyTextBold ??= null, + "privacyUnderlineText": privacyUnderlineText ??= null, "clauseName": clauseName ??= null, "clauseUrl": clauseUrl ??= null, "clauseBaseColor": clauseBaseColor ??= null, @@ -627,11 +655,13 @@ class JVUIConfig { "sloganOffsetY": sloganOffsetY ??= null, "sloganTextColor": sloganTextColor ??= null, "sloganOffsetX": sloganOffsetX ??= null, + "sloganBottomOffsetY": sloganBottomOffsetY ??= null, "sloganVerticalLayoutItem": getStringFromEnum(sloganVerticalLayoutItem), "sloganTextSize": sloganTextSize ??= null, "sloganWidth": sloganWidth ??= null, "sloganHeight": sloganHeight ??= null, "sloganHidden": sloganHidden, + "sloganTextBold": sloganTextBold ??= null, "privacyState": privacyState, "privacyCheckboxInCenter": privacyCheckboxInCenter, "privacyTextCenterGravity": privacyTextCenterGravity, @@ -640,6 +670,7 @@ class JVUIConfig { "privacyNavColor": privacyNavColor ??= null, "privacyNavTitleTextColor": privacyNavTitleTextColor ??= null, "privacyNavTitleTextSize": privacyNavTitleTextSize ??= null, + "privacyNavTitleTextBold": privacyNavTitleTextBold ??= null, "privacyNavTitleTitle1": privacyNavTitleTitle1 ??= null, "privacyNavTitleTitle2": privacyNavTitleTitle2 ??= null, "privacyNavReturnBtnImage": privacyNavReturnBtnImage ??= null, @@ -663,6 +694,7 @@ class JVUIConfig { "enterAnim": enterAnim, "exitAnim": exitAnim, "privacyNavTitleTitle": privacyNavTitleTitle ??= null, + "textVerAlignment":textVerAlignment, }..removeWhere((key, value) => value == null); } } @@ -776,9 +808,10 @@ enum JVTextAlignmentType { left, right, center } /// 监听返回类 class JVListenerEvent { - int code; //返回码,具体事件返回码请查看(https://docs.jiguang.cn/jverification/client/android_api/) - String message; //事件描述、事件返回值等 - String operator; //成功时为对应运营商,CM代表中国移动,CU代表中国联通,CT代表中国电信。失败时可能为null + int? + code; //返回码,具体事件返回码请查看(https://docs.jiguang.cn/jverification/client/android_api/) + String? message; //事件描述、事件返回值等 + String? operator; //成功时为对应运营商,CM代表中国移动,CU代表中国联通,CT代表中国电信。失败时可能为null JVListenerEvent.fromJson(Map json) : code = json['code'], @@ -866,3 +899,34 @@ String getStringFromEnum(T) { return T.toString().split('.').last; } + +class JVPrivacy { + String? name; + String? url; + String? beforeName; + String? afterName; + String? separator;//ios分隔符专属 + + JVPrivacy(this.name, this.url, + {this.beforeName, this.afterName, this.separator}); + + Map toMap() { + return { + 'name': name, + 'url': url, + 'beforeName': beforeName, + 'afterName': afterName, + 'separator': separator + }; + } + + Map toJson() { + Map map = new Map(); + map["name"] = this.name; + map["url"] = this.url; + map["beforeName"] = this.beforeName; + map["afterName"] = this.afterName; + map["separator"] = this.separator; + return map..removeWhere((key, value) => value == null); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index 86779cb..8679a12 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: jverify description: JIGUANG Official Jverifycation SDK flutter plugin project. -version: 2.1.2 +version: 2.2.4 homepage: https://www.jiguang.cn environment: @@ -11,6 +11,7 @@ environment: dependencies: flutter: sdk: flutter + dev_dependencies: