diff --git a/CHANGELOG.md b/CHANGELOG.md index c7a41ec..316d585 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,75 @@ +## 2.4.4 ++ 新增:iOS 二次弹窗支持设置取消按钮 +## 2.4.3 ++ 优化:修复bug ++ 更新:iOS 升级到 3.2.1版本 +## 2.4.1 ++ 新增:新增一键登录失败可以选择跳转短信登录的功能 ++ 优化:更新iOS最新极光原生SDK_3.2.0 +## 2.3.9 ++ 优化:修复bug ++ 优化:更新Android最新极光原生SDK_3.1.9 +## 2.3.9 ++ 优化:修复bug +## 2.3.8 ++ 优化: 更新Android最新极光原生SDK_3.1.4 +## 2.3.7 ++ 优化: 更新Android最新极光原生SDK +## 2.3.6 ++ 优化: 增加合规接口 +## 2.3.5 ++ 优化: fix +## 2.3.4 ++ 优化: 增加setIsPrivacyViewDarkMode参数,协议页面是否支持暗黑模式 +## 2.3.3 ++ 优化: 修复Android的回调参数个数问题 修复setLogBtnBottomOffsetY不生效问题 +## 2.3.2 ++ 优化: 升级原生SDK iOS:3.1.2 android:3.1.1 +## 2.3.1 ++ 优化: 优化iOS代码,解决UI问题 +## 2.3.0 ++ 优化: Android/ios更新到极光原生SDK3.0.1 +## 2.2.9 ++ 优化: Android更新到2.9.7 +## 2.2.7 ++ 优化: iOS更新到2.9.3 +## 2.2.6 ++ 优化: Android更新到2.9.3 +## 2.2.5 ++ 优化: iOS原生SDK更新到2.7.9 +## 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..314d9f6 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ dependencies: ``` dependencies: - jverify: 2.1.2 + jverify: 2.3.6 ``` ### 配置 diff --git a/android/build.gradle b/android/build.gradle index 676c6c8..8e51f0f 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -9,7 +9,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' + classpath 'com.android.tools.build:gradle:3.4.2' } } @@ -34,25 +34,11 @@ android { lintOptions { disable 'InvalidPackage' } - buildTypes { - release { - minifyEnabled true - useProguard true - // library 混淆 -> 随 library 引用,自动添加到 apk 打包混淆 - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'consumer-rules.pro' - } - debug { - minifyEnabled false - useProguard false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'consumer-rules.pro' - } - } - } 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:3.3.0' + implementation 'cn.jiguang.sdk:jverification:3.1.9' } diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 068dcfd..433639a 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/android/src/main/java/com/jiguang/jverify/JverifyPlugin.java b/android/src/main/java/com/jiguang/jverify/JverifyPlugin.java index 8b6d8c8..3504bf2 100644 --- a/android/src/main/java/com/jiguang/jverify/JverifyPlugin.java +++ b/android/src/main/java/com/jiguang/jverify/JverifyPlugin.java @@ -1,5 +1,6 @@ package com.jiguang.jverify; +import android.app.Activity; import android.content.Context; import android.content.res.Resources; import android.graphics.Bitmap; @@ -14,9 +15,13 @@ import android.view.Gravity; import android.view.View; import android.widget.Button; -import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; +import android.widget.Toast; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -26,13 +31,18 @@ import java.util.List; import java.util.Map; +import cn.jiguang.api.utils.JCollectionAuth; import cn.jiguang.verifysdk.api.AuthPageEventListener; import cn.jiguang.verifysdk.api.JVerificationInterface; +import cn.jiguang.verifysdk.api.JVerifyLoginBtClickCallback; import cn.jiguang.verifysdk.api.JVerifyUIClickCallback; 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.SmsClickActionListener; +import cn.jiguang.verifysdk.api.SmsListener; import cn.jiguang.verifysdk.api.VerifyListener; import io.flutter.embedding.engine.plugins.FlutterPlugin; import io.flutter.plugin.common.MethodCall; @@ -58,6 +68,8 @@ public class JverifyPlugin implements FlutterPlugin, MethodCallHandler { private static String j_msg_key = "message"; /// 运营商信息 private static String j_opr_key = "operator"; + /// 手机号信息 + private static String j_phone_key = "phone"; // 默认超时时间 private static int j_default_timeout = 5000; // 重复请求 @@ -91,7 +103,9 @@ public void onMethodCall(MethodCall call, Result result) { setup(call, result); } else if (call.method.equals("setDebugMode")) { setDebugMode(call, result); - } else if (call.method.equals("isInitSuccess")) { + } else if (call.method.equals("setCollectionAuth")) { + setCollectionAuth(call, result); + }else if (call.method.equals("isInitSuccess")) { isInitSuccess(call, result); } else if (call.method.equals("checkVerifyEnable")) { checkVerifyEnable(call, result); @@ -119,6 +133,8 @@ public void onMethodCall(MethodCall call, Result result) { getSMSCode(call, result); } else if (call.method.equals("setSmsIntervalTime")) { setGetCodeInternal(call, result); + } else if (call.method.equals("smsAuth")) { + smsAuth(call, result); } else { result.notImplemented(); } @@ -193,6 +209,18 @@ private void setDebugMode(MethodCall call, Result result) { runMainThread(map, result, null); } + /** + * SDK合规授权 + */ + private void setCollectionAuth(MethodCall call, Result result) { + Log.d(TAG, "Action - setCollectionAuth:"); + Object enable = getValueByKey(call, "auth"); + JCollectionAuth.setAuth(context,(Boolean)enable); + Map map = new HashMap<>(); + map.put(j_result_key, enable); + runMainThread(map, result, null); + } + /** * 获取 SDK 初始化是否成功标识 */ @@ -291,7 +319,7 @@ private void getToken(final MethodCall call, final Result result) { JVerificationInterface.getToken(context, timeOut, new VerifyListener() { @Override - public void onResult(int code, String content, String operator) { + public void onResult(final int code, final String content, final String operator, final JSONObject operatorReturn) { if (code == 2000) {//code: 返回码,2000代表获取成功,其他为失败 Log.d(TAG, "token=" + content + ", operator=" + operator); @@ -329,16 +357,16 @@ private void preLogin(final MethodCall call, final Result result) { JVerificationInterface.preLogin(context, timeOut, new PreLoginListener() { @Override - public void onResult(int code, String message) { + public void onResult(final int code, final String content, final JSONObject operatorReturn) { if (code == 7000) {//code: 返回码,7000代表获取成功,其他为失败,详见错误码描述 - Log.d(TAG, "verify success, message =" + message); + Log.d(TAG, "verify success, message =" + content); } else { - Log.e(TAG, "verify fail,code=" + code + ", message =" + message); + Log.e(TAG, "verify fail,code=" + code + ", message =" + content); } Map map = new HashMap<>(); map.put(j_code_key, code); - map.put(j_msg_key, message); + map.put(j_msg_key, content); runMainThread(map, result, null); } @@ -354,7 +382,6 @@ private void clearPreLoginCache(MethodCall call, final Result result) { JVerificationInterface.clearPreLoginCache(); } - /** * SDK请求授权一键登录,异步 */ @@ -376,11 +403,10 @@ private void loginAuthInterface(final Boolean isSync, final MethodCall call, fin Object autoFinish = getValueByKey(call, "autoDismiss"); Integer timeOut = call.argument("timeout"); + final Integer loginAuthIndex = call.argument("loginAuthIndex"); + Object enableSMSService = getValueByKey(call, "enableSms"); - LoginSettings settings = new LoginSettings(); - settings.setAutoFinish((Boolean) autoFinish); - settings.setTimeout(timeOut); - settings.setAuthPageEventListener(new AuthPageEventListener() { + AuthPageEventListener eventListener = new AuthPageEventListener() { @Override public void onEvent(int cmd, String msg) { Log.d(TAG, "Action - AuthPageEventListener: cmd = " + cmd); @@ -388,14 +414,15 @@ public void onEvent(int cmd, String msg) { final HashMap jsonMap = new HashMap(); jsonMap.put(j_code_key, cmd); jsonMap.put(j_msg_key, msg); + jsonMap.put("loginAuthIndex", loginAuthIndex); runMainThread(jsonMap, null, "onReceiveAuthPageEvent"); } - }); + }; - JVerificationInterface.loginAuth(context, settings, new VerifyListener() { + VerifyListener listener = new VerifyListener() { @Override - public void onResult(int code, String content, String operator) { + public void onResult(final int code, final String content, final String operator, JSONObject operatorReturn) { if (code == 6000) { Log.d(TAG, "code=" + code + ", token=" + content + " ,operator=" + operator); } else { @@ -405,6 +432,8 @@ public void onResult(int code, String content, String operator) { map.put(j_code_key, code); map.put(j_msg_key, content); map.put(j_opr_key, operator); + map.put("loginAuthIndex", loginAuthIndex); + if (isSync) { // 通过 channel 返回 runMainThread(map, null, "onReceiveLoginAuthCallBackEvent"); @@ -413,6 +442,46 @@ public void onResult(int code, String content, String operator) { runMainThread(map, result, null); } } + }; + + if (enableSMSService != null) { + JVerificationInterface.loginAuth((Boolean)enableSMSService, context, (Boolean) autoFinish, listener, eventListener); + } else { + LoginSettings settings = new LoginSettings(); + settings.setAutoFinish((Boolean) autoFinish); + settings.setTimeout(timeOut); + settings.setAuthPageEventListener(eventListener); + + JVerificationInterface.loginAuth(context, settings, listener); + } + + } + + /** + * SDK请求短信登录 + */ + private void smsAuth(MethodCall call, final Result result){ + Log.d(TAG, "Action - smsAuth:"); + + Object autoFinish = getValueByKey(call, "autoDismiss"); + Integer timeOut = call.argument("timeout"); + final Integer smsAuthIndex = call.argument("smsAuthIndex"); + + JVerificationInterface.smsLoginAuth(context, (Boolean) autoFinish, timeOut, new SmsListener(){ + @Override + public void onResult(final int code, final String content,final String phone){ + Log.d(TAG, "smsAuth code=" + code + ", token=" + content + " ,phone=" + phone); + + Map map = new HashMap<>(); + map.put(j_code_key, code); + map.put(j_msg_key, content); + map.put(j_phone_key, phone); + map.put("smsAuthIndex", smsAuthIndex); + + // 通过 channel 返回 + runMainThread(map, null, "onReceiveSMSAuthCallBackEvent"); + + } }); } @@ -452,9 +521,9 @@ private void setCustomAuthViewAllWidgets(MethodCall call, Result result) { /// 新增自定义的控件 String type = (String) widgetMap.get("type"); if (type.equals("textView")) { - addCustomTextWidgets(widgetMap, builder); + addCustomTextWidgets(widgetMap, builder, false); } else if (type.equals("button")) { - addCustomButtonWidgets(widgetMap, builder); + addCustomButtonWidgets(widgetMap, builder, false); } else { Log.e(TAG, "don't support widget"); } @@ -487,14 +556,14 @@ private void setCustomAuthorizationView(MethodCall call, Result result) { /// 新增自定义的控件 String type = (String) widgetMap.get("type"); if (type.equals("textView")) { - addCustomTextWidgets(widgetMap, portraitBuilder); + addCustomTextWidgets(widgetMap, portraitBuilder, false); if (isAutorotate) { - addCustomTextWidgets(widgetMap, landscapeBuilder); + addCustomTextWidgets(widgetMap, landscapeBuilder, false); } } else if (type.equals("button")) { - addCustomButtonWidgets(widgetMap, portraitBuilder); + addCustomButtonWidgets(widgetMap, portraitBuilder, false); if (isAutorotate) { - addCustomButtonWidgets(widgetMap, landscapeBuilder); + addCustomButtonWidgets(widgetMap, landscapeBuilder, false); } } else { Log.e(TAG, "don't support widget"); @@ -523,10 +592,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 +610,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 +625,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 +639,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 +661,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 +691,11 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder) Object privacyHintToast = valueForKey(uiconfig, "privacyHintToast"); + Object privacyItem = valueForKey(uiconfig, "privacyItem"); + + Object setIsPrivacyViewDarkMode = valueForKey(uiconfig, "setIsPrivacyViewDarkMode"); + + /************* 状态栏 ***************/ if (statusBarColorWithNav != null) { builder.setStatusBarColorWithNav((Boolean) statusBarColorWithNav); @@ -686,6 +772,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 +797,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 +826,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 +852,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 +864,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 +876,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 +888,10 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder) if (logBtnOffsetX != null) { builder.setLogBtnOffsetX((Integer) logBtnOffsetX); } + if (logBtnBottomOffsetY != null) { + builder.setLogoOffsetY(-1); + builder.setLogBtnBottomOffsetY((Integer) logBtnBottomOffsetY); + } if (logBtnWidth != null) { builder.setLogBtnWidth((Integer) logBtnWidth); } @@ -793,6 +907,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 +957,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 +971,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 +1009,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 +1020,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); } } @@ -915,6 +1054,494 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder) } } + + Object privacyCheckDialogConfig = valueForKey(uiconfig, "privacyCheckDialogConfig"); + + /************** 协议的二次弹窗配置 ***************/ + if (privacyCheckDialogConfig != null) { + Map privacyCheckDialogConfigMap = (Map) privacyCheckDialogConfig; + Object enablePrivacyCheckDialog = valueForKey(privacyCheckDialogConfigMap, "enablePrivacyCheckDialog"); + if ((Boolean) enablePrivacyCheckDialog) { + Object width = valueForKey(privacyCheckDialogConfigMap, "width"); + Object height = valueForKey(privacyCheckDialogConfigMap, "height"); + Object offsetX = valueForKey(privacyCheckDialogConfigMap, "offsetX"); + Object offsetY = valueForKey(privacyCheckDialogConfigMap, "offsetY"); + Object gravity = valueForKey(privacyCheckDialogConfigMap, "gravity"); + + if(width !=null){ + builder.setPrivacyCheckDialogWidth((int) width); + } + if(height !=null) { + builder.setPrivacyCheckDialogHeight((int) height); + } + if(offsetX !=null) { + builder.setPrivacyCheckDialogOffsetX((int) offsetX); + } + if(offsetX !=null) { + builder.setPrivacyCheckDialogOffsetY((int) offsetY); + } + if(gravity !=null) { + builder.setprivacyCheckDialogGravity(getAlignmentFromString((String) gravity)); + } + + Object dialogTitle = valueForKey(privacyCheckDialogConfigMap, "title"); + if(dialogTitle !=null) { + builder.setPrivacyCheckDialogTitleText((String) dialogTitle); + } + + + Object titleTextSize = valueForKey(privacyCheckDialogConfigMap, "titleTextSize"); + if(titleTextSize !=null) { + builder.setPrivacyCheckDialogTitleTextSize(exchangeObject(titleTextSize)); + } + + Object titleTextColor = valueForKey(privacyCheckDialogConfigMap, "titleTextColor"); + Object contentTextSize = valueForKey(privacyCheckDialogConfigMap, "contentTextSize"); + + builder.enablePrivacyCheckDialog(true); + + if(titleTextColor != null){ + builder.setPrivacyCheckDialogTitleTextColor(exchangeObject(titleTextColor)); + } + Object gravity_privacyCheckDialog = valueForKey(privacyCheckDialogConfigMap, "gravity"); + if(gravity_privacyCheckDialog != null){ + builder.setPrivacyCheckDialogContentTextGravity(getAlignmentFromString((String) gravity_privacyCheckDialog)); + } + if(contentTextSize != null){ + builder.setPrivacyCheckDialogContentTextSize(exchangeObject(contentTextSize)); + } + + Object dialogLoginBtnText = valueForKey(privacyCheckDialogConfigMap, "logBtnText"); + Object logBtnImgPath = valueForKey(privacyCheckDialogConfigMap, "logBtnImgPath"); + Object logBtnTextColor_dialog = valueForKey(privacyCheckDialogConfigMap, "logBtnTextColor"); + Object logBtnMarginL = valueForKey(privacyCheckDialogConfigMap, "logBtnMarginL"); + Object logBtnMarginR = valueForKey(privacyCheckDialogConfigMap, "logBtnMarginR"); + Object logBtnMarginT = valueForKey(privacyCheckDialogConfigMap, "logBtnMarginT"); + Object logBtnMarginB = valueForKey(privacyCheckDialogConfigMap, "logBtnMarginB"); + Object dialogLogBtnWidth = valueForKey(privacyCheckDialogConfigMap, "logBtnWidth"); + Object dialogLogBtnHeight = valueForKey(privacyCheckDialogConfigMap, "logBtnHeight"); + + + if(dialogLoginBtnText !=null) { + builder.setPrivacyCheckDialogLogBtnText((String) dialogLoginBtnText); + } + if(logBtnImgPath != null){ + int res_id_logBtnImgPath = getResourceByReflect((String) logBtnImgPath); + if (res_id_logBtnImgPath > 0) { + builder.setPrivacyCheckDialogLogBtnImgPath((String) logBtnImgPath); + } + } + if (logBtnTextColor_dialog != null){ + builder.setPrivacyCheckDialoglogBtnTextColor(exchangeObject(logBtnTextColor_dialog)); + } + if(logBtnMarginL !=null) { + builder.setPrivacyCheckDialogLogBtnMarginL((int) logBtnMarginL); + } + if(logBtnMarginR !=null) { + builder.setPrivacyCheckDialogLogBtnMarginR((int) logBtnMarginR); + } + if(logBtnMarginT !=null) { + builder.setPrivacyCheckDialogLogBtnMarginT((int) logBtnMarginT); + } + if(logBtnMarginB !=null) { + builder.setPrivacyCheckDialogLogBtnMarginB((int) logBtnMarginB); + } + if(dialogLogBtnWidth !=null) { + builder.setPrivacyCheckDialogLogBtnWidth((int) dialogLogBtnWidth); + } + if(dialogLogBtnHeight !=null) { + builder.setPrivacyCheckDialogLogBtnHeight((int) dialogLogBtnHeight); + } + + Object widgets = valueForKey(privacyCheckDialogConfigMap,"widgets"); + if (widgets != null) { + List widgetList = (List) widgets; + for (Map widgetMap : widgetList) { + /// 新增自定义的控件 + String type = (String) widgetMap.get("type"); + if (type.equals("textView")) { + addCustomTextWidgets(widgetMap, builder, true); + } else if (type.equals("button")) { + addCustomButtonWidgets(widgetMap, builder, true); + } else { + Log.e(TAG, "don't support widget"); + } + } + } + } + } + + /************** 协议页面是否支持暗黑模式 ***************/ + if (setIsPrivacyViewDarkMode != null) { + builder.setIsPrivacyViewDarkMode((Boolean)setIsPrivacyViewDarkMode); + } + + + /************** SMS UI配置***************/ + Object smsUIConfig = valueForKey(uiconfig, "smsUIConfig"); + + if (smsUIConfig != null) { + Map smsUIConfigMap = (Map) smsUIConfig; + Object enableSMSService = valueForKey(smsUIConfigMap, "enableSMSService"); + if (enableSMSService != null && (Boolean) enableSMSService) { + + Object smsNavText = valueForKey(smsUIConfigMap, "smsNavText"); + Object smsSloganTextSize = valueForKey(smsUIConfigMap, "smsSloganTextSize"); + Object isSmsSloganHidden = valueForKey(smsUIConfigMap, "isSmsSloganHidden"); + Object isSmsSloganTextBold = valueForKey(smsUIConfigMap, "isSmsSloganTextBold"); + Object smsSloganOffsetX = valueForKey(smsUIConfigMap, "smsSloganOffsetX"); + Object smsSloganOffsetY = valueForKey(smsUIConfigMap, "smsSloganOffsetY"); + Object smsSloganOffsetBottomY = valueForKey(smsUIConfigMap, "smsSloganOffsetBottomY"); + Object smsSloganTextColor = valueForKey(smsUIConfigMap, "smsSloganTextColor"); + Object smsLogoWidth = valueForKey(smsUIConfigMap, "smsLogoWidth"); + Object smsLogoHeight = valueForKey(smsUIConfigMap, "smsLogoHeight"); + Object smsLogoOffsetX = valueForKey(smsUIConfigMap, "smsLogoOffsetX"); + Object smsLogoOffsetY = valueForKey(smsUIConfigMap, "smsLogoOffsetY"); + Object smsLogoOffsetBottomY = valueForKey(smsUIConfigMap, "smsLogoOffsetBottomY"); + Object isSmsLogoHidden = valueForKey(smsUIConfigMap, "isSmsLogoHidden"); + Object smsLogoResName = valueForKey(smsUIConfigMap, "smsLogoResName"); + + if(smsNavText !=null){ + builder.setSmsNavText((String) smsNavText); + } + if(smsSloganTextSize !=null){ + builder.setSmsSloganTextSize((Integer) smsSloganTextSize); + } + if(isSmsSloganHidden !=null){ + builder.setSmsSloganHidden((Boolean) isSmsSloganHidden); + } + if(isSmsSloganTextBold !=null){ + builder.setSmsSloganTextBold((Boolean) isSmsSloganTextBold); + } + if(smsSloganOffsetX !=null){ + builder.setSmsSloganOffsetX((Integer) smsSloganOffsetX); + } + if(smsSloganOffsetY !=null){ + builder.setSmsSloganOffsetY((Integer) smsSloganOffsetY); + } + if(smsSloganOffsetBottomY !=null){ + builder.setSmsSloganOffsetBottomY((Integer) smsSloganOffsetBottomY); + } + if(smsSloganTextColor !=null){ + builder.setSmsSloganTextColor((Integer) smsSloganTextColor); + } + if(smsLogoWidth !=null){ + builder.setSmsLogoWidth((Integer) smsLogoWidth); + } + if(smsLogoHeight !=null){ + builder.setSmsLogoHeight((Integer) smsLogoHeight); + } + if(smsLogoOffsetX !=null){ + builder.setSmsLogoOffsetX((Integer) smsLogoOffsetX); + } + if(smsLogoOffsetY !=null){ + builder.setSmsLogoOffsetY((Integer) smsLogoOffsetY); + } + if(smsLogoOffsetBottomY !=null){ + builder.setSmsLogoOffsetBottomY((Integer) smsLogoOffsetBottomY); + } + if(isSmsLogoHidden !=null){ + builder.setSmsLogoHidden((Boolean) isSmsLogoHidden); + } + if(smsLogoResName !=null){ + int res_id_smsLogoPath = getResourceByReflect((String) smsLogoResName); + if (res_id_smsLogoPath > 0) { + builder.setSmsLogoImgPath((String) smsLogoResName); + } + } + + + Object smsPhoneTextViewOffsetX = valueForKey(smsUIConfigMap, "smsPhoneTextViewOffsetX"); + Object smsPhoneTextViewOffsetY = valueForKey(smsUIConfigMap, "smsPhoneTextViewOffsetY"); + Object smsPhoneTextViewTextSize = valueForKey(smsUIConfigMap, "smsPhoneTextViewTextSize"); + Object smsPhoneTextViewTextColor = valueForKey(smsUIConfigMap, "smsPhoneTextViewTextColor"); + Object smsPhoneInputViewOffsetX = valueForKey(smsUIConfigMap, "smsPhoneInputViewOffsetX"); + Object smsPhoneInputViewOffsetY = valueForKey(smsUIConfigMap, "smsPhoneInputViewOffsetY"); + Object smsPhoneInputViewWidth = valueForKey(smsUIConfigMap, "smsPhoneInputViewWidth"); + Object smsPhoneInputViewHeight = valueForKey(smsUIConfigMap, "smsPhoneInputViewHeight"); + Object smsPhoneInputViewTextColor = valueForKey(smsUIConfigMap, "smsPhoneInputViewTextColor"); + Object smsPhoneInputViewTextSize = valueForKey(smsUIConfigMap, "smsPhoneInputViewTextSize"); + Object smsVerifyCodeTextViewOffsetX = valueForKey(smsUIConfigMap, "smsVerifyCodeTextViewOffsetX"); + Object smsVerifyCodeTextViewOffsetY = valueForKey(smsUIConfigMap, "smsVerifyCodeTextViewOffsetY"); + Object smsVerifyCodeTextViewTextSize = valueForKey(smsUIConfigMap, "smsVerifyCodeTextViewTextSize"); + Object smsVerifyCodeTextViewTextColor = valueForKey(smsUIConfigMap, "smsVerifyCodeTextViewTextColor"); + Object smsVerifyCodeEditTextViewTextSize = valueForKey(smsUIConfigMap, "smsVerifyCodeEditTextViewTextSize"); + Object smsVerifyCodeEditTextViewTextColor = valueForKey(smsUIConfigMap, "smsVerifyCodeEditTextViewTextColor"); + Object smsVerifyCodeEditTextViewOffsetX = valueForKey(smsUIConfigMap, "smsVerifyCodeEditTextViewOffsetX"); + Object smsVerifyCodeEditTextViewOffsetY = valueForKey(smsUIConfigMap, "smsVerifyCodeEditTextViewOffsetY"); + Object smsVerifyCodeEditTextViewOffsetR = valueForKey(smsUIConfigMap, "smsVerifyCodeEditTextViewOffsetR"); + Object smsVerifyCodeEditTextViewWidth = valueForKey(smsUIConfigMap, "smsVerifyCodeEditTextViewWidth"); + Object smsVerifyCodeEditTextViewHeight = valueForKey(smsUIConfigMap, "smsVerifyCodeEditTextViewHeight"); + Object smsGetVerifyCodeTextViewOffsetX = valueForKey(smsUIConfigMap, "smsGetVerifyCodeTextViewOffsetX"); + Object smsGetVerifyCodeTextViewOffsetY = valueForKey(smsUIConfigMap, "smsGetVerifyCodeTextViewOffsetY"); + Object smsGetVerifyCodeTextViewTextSize = valueForKey(smsUIConfigMap, "smsGetVerifyCodeTextViewTextSize"); + Object smsGetVerifyCodeTextViewTextColor = valueForKey(smsUIConfigMap, "smsGetVerifyCodeTextViewTextColor"); + Object smsGetVerifyCodeTextViewOffsetR = valueForKey(smsUIConfigMap, "smsGetVerifyCodeTextViewOffsetR"); + Object smsGetVerifyCodeBtnBackgroundPath = valueForKey(smsUIConfigMap, "smsGetVerifyCodeBtnBackgroundPath"); + + if(smsPhoneTextViewOffsetX !=null){ + builder.setSmsPhoneTextViewOffsetX((Integer) smsPhoneTextViewOffsetX); + } + if(smsPhoneTextViewOffsetY !=null){ + builder.setSmsPhoneTextViewOffsetY((Integer) smsPhoneTextViewOffsetY); + } + if(smsPhoneTextViewTextSize !=null){ + builder.setSmsPhoneTextViewTextSize((Integer) smsPhoneTextViewTextSize); + } + if(smsPhoneTextViewTextColor !=null){ + builder.setSmsPhoneTextViewTextColor((Integer) smsPhoneTextViewTextColor); + } + if(smsPhoneInputViewOffsetX !=null){ + builder.setSmsPhoneInputViewOffsetX((Integer) smsPhoneInputViewOffsetX); + } + if(smsPhoneInputViewOffsetY !=null){ + builder.setSmsPhoneInputViewOffsetY((Integer) smsPhoneInputViewOffsetY); + } + if(smsPhoneInputViewWidth !=null){ + builder.setSmsPhoneInputViewWidth((Integer) smsPhoneInputViewWidth); + } + if(smsPhoneInputViewHeight !=null){ + builder.setSmsPhoneInputViewHeight((Integer) smsPhoneInputViewHeight); + } + if(smsPhoneInputViewTextColor !=null){ + builder.setSmsPhoneInputViewTextColor((Integer) smsPhoneInputViewTextColor); + } + if(smsPhoneInputViewTextSize !=null){ + builder.setSmsPhoneInputViewTextSize((Integer) smsPhoneInputViewTextSize); + } + if(smsVerifyCodeTextViewOffsetX !=null){ + builder.setSmsVerifyCodeTextViewOffsetX((Integer) smsVerifyCodeTextViewOffsetX); + } + if(smsVerifyCodeTextViewOffsetY !=null){ + builder.setSmsVerifyCodeTextViewOffsetY((Integer) smsVerifyCodeTextViewOffsetY); + } + if(smsVerifyCodeTextViewTextSize !=null){ + builder.setSmsVerifyCodeTextSizeTextSize((Integer) smsVerifyCodeTextViewTextSize); + } + if(smsVerifyCodeTextViewTextColor !=null){ + builder.setSmsVerifyCodeTextViewTextColor((Integer) smsVerifyCodeTextViewTextColor); + } + if(smsVerifyCodeEditTextViewTextSize !=null){ + builder.setSmsVerifyCodeEditTextViewTextSize((Integer) smsVerifyCodeEditTextViewTextSize); + } + if(smsVerifyCodeEditTextViewTextColor !=null){ + builder.setSmsVerifyCodeEditTextViewTextColor((Integer) smsVerifyCodeEditTextViewTextColor); + } + if(smsVerifyCodeEditTextViewOffsetX !=null){ + builder.setSmsVerifyCodeEditTextViewTextOffsetX((Integer) smsVerifyCodeEditTextViewOffsetX); + } + if(smsVerifyCodeEditTextViewOffsetY !=null){ + builder.setSmsVerifyCodeEditTextViewOffsetY((Integer) smsVerifyCodeEditTextViewOffsetY); + } + if(smsVerifyCodeEditTextViewOffsetR !=null){ + builder.setSmsVerifyCodeEditTextViewOffsetR((Integer) smsVerifyCodeEditTextViewOffsetR); + } + if(smsVerifyCodeEditTextViewWidth !=null){ + builder.setSmsVerifyCodeEditTextViewWidth((Integer) smsVerifyCodeEditTextViewWidth); + } + if(smsVerifyCodeEditTextViewHeight !=null){ + builder.setSmsVerifyCodeEditTextViewHeight((Integer) smsVerifyCodeEditTextViewHeight); + } + if(smsGetVerifyCodeTextViewOffsetX !=null){ + builder.setSmsGetVerifyCodeTextViewOffsetX((Integer) smsGetVerifyCodeTextViewOffsetX); + } + if(smsGetVerifyCodeTextViewOffsetY !=null){ + builder.setSmsGetVerifyCodeTextViewOffsetY((Integer) smsGetVerifyCodeTextViewOffsetY); + } + if(smsGetVerifyCodeTextViewTextSize !=null){ + builder.setSmsGetVerifyCodeTextSize((Integer) smsGetVerifyCodeTextViewTextSize); + } + if(smsGetVerifyCodeTextViewTextColor !=null){ + builder.setSmsGetVerifyCodeTextViewTextColor((Integer) smsGetVerifyCodeTextViewTextColor); + } +// if(smsGetVerifyCodeTextViewOffsetR !=null){ +// builder.setSmsGetVerifyCodeTextViewOffsetR((Integer) smsGetVerifyCodeTextViewOffsetR); +// } + if(smsGetVerifyCodeBtnBackgroundPath !=null){ + int res_id_smsGetVerifyCodeBtnBackgroundPath = getResourceByReflect((String) smsGetVerifyCodeBtnBackgroundPath); + if (res_id_smsGetVerifyCodeBtnBackgroundPath > 0) { + builder.setSmsGetVerifyCodeBtnBackgroundPath((String) smsGetVerifyCodeBtnBackgroundPath); + } + } + + + Object smsLogBtnOffsetX = valueForKey(smsUIConfigMap, "smsLogBtnOffsetX"); + Object smsLogBtnOffsetY = valueForKey(smsUIConfigMap, "smsLogBtnOffsetY"); + Object smsLogBtnWidth = valueForKey(smsUIConfigMap, "smsLogBtnWidth"); + Object smsLogBtnHeight = valueForKey(smsUIConfigMap, "smsLogBtnHeight"); + Object smsLogBtnTextSize = valueForKey(smsUIConfigMap, "smsLogBtnTextSize"); + Object smsLogBtnBottomOffsetY = valueForKey(smsUIConfigMap, "smsLogBtnBottomOffsetY"); + Object smsLogBtnText = valueForKey(smsUIConfigMap, "smsLogBtnText"); + Object smsLogBtnTextColor = valueForKey(smsUIConfigMap, "smsLogBtnTextColor"); + Object isSmsLogBtnTextBold = valueForKey(smsUIConfigMap, "isSmsLogBtnTextBold"); + Object smsLogBtnBackgroundPath = valueForKey(smsUIConfigMap, "smsLogBtnBackgroundPath"); + Object smsFirstSeperLineOffsetX = valueForKey(smsUIConfigMap, "smsFirstSeperLineOffsetX"); + Object smsFirstSeperLineOffsetY = valueForKey(smsUIConfigMap, "smsFirstSeperLineOffsetY"); + Object smsFirstSeperLineOffsetR = valueForKey(smsUIConfigMap, "smsFirstSeperLineOffsetR"); + Object smsFirstSeperLineColor = valueForKey(smsUIConfigMap, "smsFirstSeperLineColor"); + Object smsSecondSeperLineOffsetX = valueForKey(smsUIConfigMap, "smsSecondSeperLineOffsetX"); + Object smsSecondSeperLineOffsetY = valueForKey(smsUIConfigMap, "smsSecondSeperLineOffsetY"); + Object smsSecondSeperLineOffsetR = valueForKey(smsUIConfigMap, "smsSecondSeperLineOffsetR"); + Object smsSecondSeperLineColor = valueForKey(smsUIConfigMap, "smsSecondSeperLineColor"); + Object isSmsPrivacyTextGravityCenter = valueForKey(smsUIConfigMap, "isSmsPrivacyTextGravityCenter"); + Object smsPrivacyOffsetX = valueForKey(smsUIConfigMap, "smsPrivacyOffsetX"); + Object smsPrivacyOffsetY = valueForKey(smsUIConfigMap, "smsPrivacyOffsetY"); + Object smsPrivacyTopOffsetY = valueForKey(smsUIConfigMap, "smsPrivacyTopOffsetY"); + Object smsPrivacyMarginL = valueForKey(smsUIConfigMap, "smsPrivacyMarginL"); + Object smsPrivacyMarginR = valueForKey(smsUIConfigMap, "smsPrivacyMarginR"); + Object smsPrivacyMarginT = valueForKey(smsUIConfigMap, "smsPrivacyMarginT"); + Object smsPrivacyMarginB = valueForKey(smsUIConfigMap, "smsPrivacyMarginB"); + Object smsPrivacyCheckboxSize = valueForKey(smsUIConfigMap, "smsPrivacyCheckboxSize"); + Object isSmsPrivacyCheckboxInCenter = valueForKey(smsUIConfigMap, "isSmsPrivacyCheckboxInCenter"); + Object smsPrivacyCheckboxMargin = valueForKey(smsUIConfigMap, "smsPrivacyCheckboxMargin"); + Object smsPrivacyBeanList = valueForKey(smsUIConfigMap, "smsPrivacyBeanList"); + Object smsPrivacyClauseStart = valueForKey(smsUIConfigMap, "smsPrivacyClauseStart"); + Object smsPrivacyClauseEnd = valueForKey(smsUIConfigMap, "smsPrivacyClauseEnd"); + Object smsPrivacyUncheckedMsg = valueForKey(smsUIConfigMap, "smsPrivacyUncheckedMsg"); + Object smsGetCodeFailMsg = valueForKey(smsUIConfigMap, "smsGetCodeFailMsg"); + Object smsPhoneInvalidMsg = valueForKey(smsUIConfigMap, "smsPhoneInvalidMsg"); + + if(smsLogBtnOffsetX !=null){ + builder.setSmsLogBtnOffsetX((Integer) smsLogBtnOffsetX); + } + if(smsLogBtnOffsetY !=null){ + builder.setSmsLogBtnOffsetY((Integer) smsLogBtnOffsetY); + } + if(smsLogBtnWidth !=null){ + builder.setSmsLogBtnWidth((Integer) smsLogBtnWidth); + } + if(smsLogBtnHeight !=null){ + builder.setSmsLogBtnHeight((Integer) smsLogBtnHeight); + } + if(smsLogBtnTextSize !=null){ + builder.setSmsLogBtnTextSize((Integer) smsLogBtnTextSize); + } + if(smsLogBtnBottomOffsetY !=null){ + builder.setSmsLogBtnBottomOffsetY((Integer) smsLogBtnBottomOffsetY); + } + if(smsLogBtnText !=null){ + builder.setSmsLogBtnText((String) smsLogBtnText); + } + if(smsLogBtnTextColor !=null){ + builder.setSmsLogBtnTextColor((Integer) smsLogBtnTextColor); + } + if(isSmsLogBtnTextBold !=null){ + builder.isSmsLogBtnTextBold((Boolean) isSmsLogBtnTextBold); + } + if(smsLogBtnBackgroundPath !=null){ + int res_id_smsLogBtnBackgroundPath = getResourceByReflect((String) smsLogBtnBackgroundPath); + if (res_id_smsLogBtnBackgroundPath > 0) { + builder.setSmsLogBtnBackgroundPath((String) smsLogBtnBackgroundPath); + } + } + if(smsFirstSeperLineOffsetX !=null){ + builder.setSmsFirstSeperLineOffsetX((Integer) smsFirstSeperLineOffsetX); + } + if(smsFirstSeperLineOffsetY !=null){ + builder.setSmsFirstSeperLineOffsetY((Integer) smsFirstSeperLineOffsetY); + } + if(smsFirstSeperLineOffsetR !=null){ + builder.setSmsFirstSeperLineOffsetR((Integer) smsFirstSeperLineOffsetR); + } + if(smsFirstSeperLineColor !=null){ + builder.setSmsFirstSeperLineColor((Integer) smsFirstSeperLineColor); + } + if(smsSecondSeperLineOffsetX !=null){ + builder.setSmsSecondSeperLineOffsetX((Integer) smsSecondSeperLineOffsetX); + } + if(smsSecondSeperLineOffsetY !=null){ + builder.setSmsSecondSeperLineOffsetY((Integer) smsSecondSeperLineOffsetY); + } + if(smsSecondSeperLineOffsetR !=null){ + builder.setSmsSecondSeperLineOffsetR((Integer) smsSecondSeperLineOffsetR); + } + if(smsSecondSeperLineColor !=null){ + builder.setSmsSecondSeperLineColor((Integer) smsSecondSeperLineColor); + } + if(isSmsPrivacyTextGravityCenter !=null){ + builder.isSmsPrivacyTextGravityCenter((Boolean) isSmsPrivacyTextGravityCenter); + } + if(smsPrivacyOffsetX !=null){ + builder.setSmsPrivacyOffsetX((Integer) smsPrivacyOffsetX); + } + if(smsPrivacyOffsetY !=null){ + builder.setSmsPrivacyOffsetY((Integer) smsPrivacyOffsetY); + } + if(smsPrivacyTopOffsetY !=null){ + builder.setSmsPrivacyTopOffsetY((Integer) smsPrivacyTopOffsetY); + } + if(smsPrivacyMarginL !=null){ + builder.setSmsPrivacyMarginL((Integer) smsPrivacyMarginL); + } + if(smsPrivacyMarginR !=null){ + builder.setSmsPrivacyMarginR((Integer) smsPrivacyMarginR); + } + if(smsPrivacyMarginT !=null){ + builder.setSmsPrivacyMarginT((Integer) smsPrivacyMarginT); + } + if(smsPrivacyMarginB !=null){ + builder.setSmsPrivacyMarginB((Integer) smsPrivacyMarginB); + } + if(smsPrivacyCheckboxSize !=null){ + builder.setSmsPrivacyCheckboxSize((Integer) smsPrivacyCheckboxSize); + } + if(isSmsPrivacyCheckboxInCenter !=null){ + builder.isSmsPrivacyCheckboxInCenter((Boolean) isSmsPrivacyCheckboxInCenter); + } + if(smsPrivacyCheckboxMargin !=null){ + ArrayList smsPrivacyCheckboxMarginArray = (ArrayList) smsPrivacyCheckboxMargin; + int[] intArray = new int[smsPrivacyCheckboxMarginArray.size()]; + for (int i = 0; i < smsPrivacyCheckboxMarginArray.size(); i++) { + intArray[i] = smsPrivacyCheckboxMarginArray.get(i); + } + builder.setSmsPrivacyCheckboxMargin(intArray); + } + if (smsPrivacyBeanList != null) { + try { + JSONArray jsonArray = new JSONArray((String) smsPrivacyBeanList); + 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.setSmsPrivacyBeanList(privacyBeans); + } catch (JSONException e) { + e.printStackTrace(); + } + } + if(smsPrivacyClauseStart !=null){ + builder.setSmsPrivacyClauseStart((String) smsPrivacyClauseStart); + } + if(smsPrivacyClauseEnd !=null){ + builder.setSmsPrivacyClauseEnd((String) smsPrivacyClauseEnd); + } + builder.setSmsGetVerifyCodeDialog(true,Toast.makeText(context,smsPhoneInvalidMsg != null ? (String) smsPhoneInvalidMsg :"请输入正确的手机号",Toast.LENGTH_SHORT)); + + builder.setSmsClickActionListener(new SmsClickActionListener() { + @Override + public void onClicked(int Code, String msg, Context context, Activity activity, Boolean isUnchecked, List beanArrayList, JVerifyLoginBtClickCallback jVerifyLoginBtClickCallback) { + Log.d(TAG, msg); + if (!isUnchecked){ + Toast.makeText(context, smsPrivacyUncheckedMsg != null ? (String) smsPrivacyUncheckedMsg : "请先勾选协议",Toast.LENGTH_SHORT).show(); + }else if(Code ==3005){ + Toast.makeText(context, smsGetCodeFailMsg != null ? (String) smsGetCodeFailMsg : "获取验证码失败",Toast.LENGTH_SHORT).show(); + jVerifyLoginBtClickCallback.login(); + }else { + jVerifyLoginBtClickCallback.login(); + } + + } + }); + } + } + } /** 添加自定义 widget 到 SDK 原有的授权界面里 */ @@ -922,7 +1549,7 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder) /** * 添加自定义 TextView */ - private void addCustomTextWidgets(Map para, JVerifyUIConfig.Builder builder) { + private void addCustomTextWidgets(Map para, JVerifyUIConfig.Builder builder, boolean isDialog) { Log.d(TAG, "addCustomTextView " + para); TextView customView = new TextView(context); @@ -1005,19 +1632,31 @@ private void addCustomTextWidgets(Map para, JVerifyUIConfig.Builder builder) { final HashMap jsonMap = new HashMap(); jsonMap.put("widgetId", widgetId); - builder.addCustomView(customView, false, new JVerifyUIClickCallback() { - @Override - public void onClicked(Context context, View view) { - Log.d(TAG, "onClicked text widget."); - channel.invokeMethod("onReceiveClickWidgetEvent", jsonMap); - } - }); + + if (isDialog) { + builder.addCustomViewToCheckDialog(customView, new JVerifyUIClickCallback() { + @Override + public void onClicked(Context context, View view) { + Log.d(TAG, "onClicked dialog button widget."); + runMainThread(jsonMap, null, "onReceiveClickWidgetEvent"); + } + }); + } else { + builder.addCustomView(customView, false, new JVerifyUIClickCallback() { + @Override + public void onClicked(Context context, View view) { + Log.d(TAG, "onClicked text widget."); + channel.invokeMethod("onReceiveClickWidgetEvent", jsonMap); + } + }); + } + } /** * 添加自定义 button */ - private void addCustomButtonWidgets(Map para, JVerifyUIConfig.Builder builder) { + private void addCustomButtonWidgets(Map para, JVerifyUIConfig.Builder builder, boolean isDialog) { Log.d(TAG, "addCustomButtonWidgets: para = " + para); Button customView = new Button(context); @@ -1059,10 +1698,12 @@ private void addCustomButtonWidgets(Map para, JVerifyUIConfig.Builder builder) { // 设置背景图(只支持 button 设置) String btnNormalImageName = (String) para.get("btnNormalImageName"); String btnPressedImageName = (String) para.get("btnPressedImageName"); - if (btnPressedImageName == null) { - btnPressedImageName = btnNormalImageName; + if (btnNormalImageName != null) { + if (btnPressedImageName == null) { + btnPressedImageName = btnNormalImageName; + } + setButtonSelector(customView, btnNormalImageName, btnPressedImageName); } - setButtonSelector(customView, btnNormalImageName, btnPressedImageName); //下划线 Boolean isShowUnderline = (Boolean) para.get("isShowUnderline"); @@ -1110,13 +1751,24 @@ private void addCustomButtonWidgets(Map para, JVerifyUIConfig.Builder builder) { final HashMap jsonMap = new HashMap(); jsonMap.put("widgetId", widgetId); - builder.addCustomView(customView, false, new JVerifyUIClickCallback() { - @Override - public void onClicked(Context context, View view) { - Log.d(TAG, "onClicked button widget."); - runMainThread(jsonMap, null, "onReceiveClickWidgetEvent"); - } - }); + if (isDialog) { + builder.addCustomViewToCheckDialog(customView, new JVerifyUIClickCallback() { + @Override + public void onClicked(Context context, View view) { + Log.d(TAG, "onClicked dialog button widget."); + runMainThread(jsonMap, null, "onReceiveClickWidgetEvent"); + } + }); + } else { + builder.addCustomView(customView, false, new JVerifyUIClickCallback() { + @Override + public void onClicked(Context context, View view) { + Log.d(TAG, "onClicked button widget."); + runMainThread(jsonMap, null, "onReceiveClickWidgetEvent"); + } + }); + } + } diff --git a/documents/APIs.md b/documents/APIs.md index 33b8b61..04cfc38 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; @@ -172,20 +181,17 @@ jverify.getToken().then((map){ ListwidgetList = []; /// 步骤 1:调用接口设置 UI jverify.setCustomAuthorizationView(true, uiConfig, landscapeConfig: uiConfig); - - /// 步骤 2:调用一键登录接口 - - /// 方式一:使用同步接口 (如果想使用异步接口,则忽略此步骤,看方式二) - /// 先,添加 loginAuthSyncApi 接口回调的监听 - jverify.addLoginAuthCallBackListener((event){ - setState(() { - _loading = false; - _result = "监听获取返回数据:[${event.code}] message = ${event.message}"; - }); - print("通过添加监听,获取到 loginAuthSyncApi 接口返回数据,code=${event.code},message = ${event.message},operator = ${event.operator}"); - }); - /// 再,执行同步的一键登录接口 - jverify.loginAuthSyncApi(autoDismiss: true); + + /// 步骤 2:调用一键登录接口 + jverify.loginAuthSyncApi2(autoDismiss: true, loginAuthcallback: (event) { + setState(() { + _hideLoading(); + _hideLoading(); + _result = "获取返回数据:[${event.code}] message = ${event.message}"; + }); + print( + "获取到 loginAuthSyncApi 接口返回数据,code=${event.code},message = ${event.message},operator = ${event.operator}"); + }); } else { setState(() { _loading = false; @@ -375,6 +381,56 @@ uiConfig.privacyNavTitleTextSize = 16; uiConfig.privacyNavTitleTitle = "协议0 web页标题";//仅ios uiConfig.privacyNavTitleTitle1 = "协议1 web页标题"; uiConfig.privacyNavTitleTitle2 = "协议2 web页标题"; + +//协议二次弹窗内容设置 -Android +JVPrivacyCheckDialogConfig privacyCheckDialogConfig = +JVPrivacyCheckDialogConfig(); +// privacyCheckDialogConfig.width = 250;//协议⼆次弹窗本身的宽 +// privacyCheckDialogConfig.height = 100;//协议⼆次弹窗本身的⾼ +privacyCheckDialogConfig.title = "测试协议标题"; //弹窗标题 +privacyCheckDialogConfig.offsetX = 0;// 窗口相对屏幕中心的x轴偏移量 +privacyCheckDialogConfig.offsetY = 0;// 窗口相对屏幕中心的y轴偏移量 +privacyCheckDialogConfig.logBtnText = "同11意";//弹窗登录按钮 +privacyCheckDialogConfig.titleTextSize = 22;// 弹窗标题字体大小 +privacyCheckDialogConfig.gravity = "center";//弹窗对齐方式 +privacyCheckDialogConfig.titleTextColor = Colors.black.value;// 弹窗标题字体颜色 +privacyCheckDialogConfig.contentTextGravity = "left";//协议⼆次弹窗协议内容对⻬⽅式 +privacyCheckDialogConfig.contentTextSize = 14;//协议⼆次弹窗协议内容字体⼤⼩ +privacyCheckDialogConfig.logBtnImgPath = "login_btn_normal";//协议⼆次弹窗登录按钮的背景图⽚ +privacyCheckDialogConfig.logBtnTextColor = Colors.black.value;//协议⼆次弹窗登录按钮的字体颜⾊ +privacyCheckDialogConfig.logBtnMarginT = 20;//协议⼆次弹窗登录按钮上边距 +privacyCheckDialogConfig.logBtnMarginB = 20;//协议⼆次弹窗登录按钮下边距 +privacyCheckDialogConfig.logBtnMarginL = 10;//协议⼆次弹窗登录按钮左边距 +privacyCheckDialogConfig.logBtnWidth = 140;//协议⼆次弹窗登录按钮宽 +privacyCheckDialogConfig.logBtnHeight = 40;//协议⼆次弹窗登录按高 +/// 添加自定义的 控件 到dialog +List dialogWidgetList = []; +final String btn_dialog_widgetId = "jv_add_custom_dialog_button"; // 标识控件 id +JVCustomWidget buttonDialogWidget = +JVCustomWidget(btn_dialog_widgetId, JVCustomWidgetType.button); +buttonDialogWidget.title = "取消"; +buttonDialogWidget.left = 163; +buttonDialogWidget.top = 142; +buttonDialogWidget.width = 140; +buttonDialogWidget.height = 40; +buttonDialogWidget.textAlignment = JVTextAlignmentType.center; +buttonDialogWidget.btnNormalImageName = "main_btn_other"; +buttonDialogWidget.btnPressedImageName = "main_btn_other"; +// buttonDialogWidget.backgroundColor = Colors.yellow.value; +//buttonWidget.textAlignment = JVTextAlignmentType.left; + +// 添加点击事件监听 +jverify.addClikWidgetEventListener(btn_dialog_widgetId, (eventId) { +print("receive listener - click dialog widget event :$eventId"); +if (btn_dialog_widgetId == eventId) { +print("receive listener - 点击【新加 dialog button】"); +} +}); +dialogWidgetList.add(buttonDialogWidget); +privacyCheckDialogConfig.widgets = dialogWidgetList; +uiConfig.privacyCheckDialogConfig = privacyCheckDialogConfig; + + Jverify jverify = new Jverify(); ``` @@ -461,6 +517,21 @@ jverify.getSMSCode(phone,{signId:signId,tempId:tempId}).then((map){ }); ``` +#### smsAuth + +短信登录接口,主动拉起短信验证码登录页面 + +设置短信登录页面相关UI同设置一键登录页面相关UI +参考API接口中JVUIConfig的smsUIConfig参数即可 +在接口setCustomAuthorizationView中一同设置 + +```dart +Jverify jverify = new Jverify(); +jverify.smsAuth(autoDismiss: true, smsCallback: (event) { + +}); + +``` |参数名 |参数类型 |说明| |:----:|:-----:|:-----:| @@ -482,10 +553,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/.gitignore b/example/.gitignore index 981913e..24476c5 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -8,6 +8,7 @@ .buildlog/ .history .svn/ +migrate_working_dir/ # IntelliJ related *.iml @@ -15,61 +16,29 @@ *.iws .idea/ -# Visual Studio Code related -.vscode/ +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ # Flutter/Dart/Pub related **/doc/api/ +**/ios/Flutter/.last_build_id .dart_tool/ .flutter-plugins +.flutter-plugins-dependencies .packages .pub-cache/ .pub/ /build/ -# Android related -**/android/**/gradle-wrapper.jar -**/android/.gradle -**/android/captures/ -**/android/gradlew -**/android/gradlew.bat -**/android/local.properties -**/android/**/GeneratedPluginRegistrant.java - -# iOS/XCode related -**/ios/**/*.mode1v3 -**/ios/**/*.mode2v3 -**/ios/**/*.moved-aside -**/ios/**/*.pbxuser -**/ios/**/*.perspectivev3 -**/ios/**/*sync/ -**/ios/**/.sconsign.dblite -**/ios/**/.tags* -**/ios/**/.vagrant/ -**/ios/**/DerivedData/ -**/ios/**/Icon? -**/ios/**/Pods/ -**/ios/**/.symlinks/ -**/ios/**/profile -**/ios/**/xcuserdata -**/ios/.generated/ -**/ios/Flutter/App.framework -**/ios/Flutter/Flutter.framework -**/ios/Flutter/Generated.xcconfig -**/ios/Flutter/app.flx -**/ios/Flutter/app.zip -**/ios/Flutter/flutter_assets/ -**/ios/ServiceDefinitions.json -**/ios/Runner/GeneratedPluginRegistrant.* +# Symbolication related +app.*.symbols -# Exceptions to above rules. -!**/ios/**/default.mode1v3 -!**/ios/**/default.mode2v3 -!**/ios/**/default.pbxuser -!**/ios/**/default.perspectivev3 -!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages +# Obfuscation related +app.*.map.json -**/ios/**/Podfile.lock -**/ios/**/Runner.xcworkspace/ -.flutter-plugins-dependencies -**/ios/**/*.sh \ No newline at end of file +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/example/README.md b/example/README.md index 8ee8dd9..2b3fce4 100644 --- a/example/README.md +++ b/example/README.md @@ -1,6 +1,6 @@ -# jverify_example +# example -Demonstrates how to use the jverify plugin. +A new Flutter project. ## Getting Started @@ -8,9 +8,9 @@ This project is a starting point for a Flutter application. A few resources to get you started if this is your first Flutter project: -- [Lab: Write your first Flutter app](https://flutter.io/docs/get-started/codelab) -- [Cookbook: Useful Flutter samples](https://flutter.io/docs/cookbook) +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) -For help getting started with Flutter, view our -[online documentation](https://flutter.io/docs), which offers tutorials, +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, samples, guidance on mobile development, and a full API reference. diff --git a/example/analysis_options.yaml b/example/analysis_options.yaml new file mode 100644 index 0000000..61b6c4d --- /dev/null +++ b/example/analysis_options.yaml @@ -0,0 +1,29 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at + # https://dart-lang.github.io/linter/lints/index.html. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/example/android/.gitignore b/example/android/.gitignore new file mode 100644 index 0000000..6f56801 --- /dev/null +++ b/example/android/.gitignore @@ -0,0 +1,13 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties +**/*.keystore +**/*.jks diff --git a/example/android/.gradle/7.5/checksums/checksums.lock b/example/android/.gradle/7.5/checksums/checksums.lock new file mode 100644 index 0000000..e3962cd Binary files /dev/null and b/example/android/.gradle/7.5/checksums/checksums.lock differ diff --git a/example/android/.gradle/7.5/checksums/md5-checksums.bin b/example/android/.gradle/7.5/checksums/md5-checksums.bin new file mode 100644 index 0000000..4eb002c Binary files /dev/null and b/example/android/.gradle/7.5/checksums/md5-checksums.bin differ diff --git a/example/android/.gradle/7.5/checksums/sha1-checksums.bin b/example/android/.gradle/7.5/checksums/sha1-checksums.bin new file mode 100644 index 0000000..737c5c3 Binary files /dev/null and b/example/android/.gradle/7.5/checksums/sha1-checksums.bin differ diff --git a/example/android/.gradle/7.5/dependencies-accessors/dependencies-accessors.lock b/example/android/.gradle/7.5/dependencies-accessors/dependencies-accessors.lock new file mode 100644 index 0000000..fce6450 Binary files /dev/null and b/example/android/.gradle/7.5/dependencies-accessors/dependencies-accessors.lock differ diff --git a/example/android/.gradle/7.5/dependencies-accessors/gc.properties b/example/android/.gradle/7.5/dependencies-accessors/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/example/android/.gradle/7.5/executionHistory/executionHistory.bin b/example/android/.gradle/7.5/executionHistory/executionHistory.bin new file mode 100644 index 0000000..7e725e2 Binary files /dev/null and b/example/android/.gradle/7.5/executionHistory/executionHistory.bin differ diff --git a/example/android/.gradle/7.5/executionHistory/executionHistory.lock b/example/android/.gradle/7.5/executionHistory/executionHistory.lock new file mode 100644 index 0000000..13d1611 Binary files /dev/null and b/example/android/.gradle/7.5/executionHistory/executionHistory.lock differ diff --git a/example/android/.gradle/7.5/fileChanges/last-build.bin b/example/android/.gradle/7.5/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/example/android/.gradle/7.5/fileChanges/last-build.bin differ diff --git a/example/android/.gradle/7.5/fileHashes/fileHashes.bin b/example/android/.gradle/7.5/fileHashes/fileHashes.bin new file mode 100644 index 0000000..f78c2ad Binary files /dev/null and b/example/android/.gradle/7.5/fileHashes/fileHashes.bin differ diff --git a/example/android/.gradle/7.5/fileHashes/fileHashes.lock b/example/android/.gradle/7.5/fileHashes/fileHashes.lock new file mode 100644 index 0000000..651fd81 Binary files /dev/null and b/example/android/.gradle/7.5/fileHashes/fileHashes.lock differ diff --git a/example/android/.gradle/7.5/fileHashes/resourceHashesCache.bin b/example/android/.gradle/7.5/fileHashes/resourceHashesCache.bin new file mode 100644 index 0000000..ddd5c7a Binary files /dev/null and b/example/android/.gradle/7.5/fileHashes/resourceHashesCache.bin differ diff --git a/example/android/.gradle/7.5/gc.properties b/example/android/.gradle/7.5/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/example/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/example/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000..204e53c Binary files /dev/null and b/example/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/example/android/.gradle/buildOutputCleanup/cache.properties b/example/android/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..f5dd157 --- /dev/null +++ b/example/android/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Wed May 10 17:49:25 CST 2023 +gradle.version=7.5 diff --git a/example/android/.gradle/buildOutputCleanup/outputFiles.bin b/example/android/.gradle/buildOutputCleanup/outputFiles.bin new file mode 100644 index 0000000..aee9ec9 Binary files /dev/null and b/example/android/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/example/android/.gradle/vcs-1/gc.properties b/example/android/.gradle/vcs-1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 1878a1c..60386ff 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -1,4 +1,3 @@ - def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -23,55 +22,54 @@ if (flutterVersionName == null) { } apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 28 + compileSdkVersion flutter.compileSdkVersion + ndkVersion flutter.ndkVersion - lintOptions { - disable 'InvalidPackage' + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "cn.jiguang.xx" // 应用包名 + applicationId "cn.jiguang.auth" + // You can update the following values to match your application needs. + // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. minSdkVersion 17 - targetSdkVersion 28 + targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" - - ndk { - //选择要添加的对应 cpu 类型的 .so 库。 - abiFilters 'armeabi', 'armeabi-v7a', 'x86', 'x86_64', 'mips', 'mips64', 'arm64-v8a' - // 还可以添加 - } manifestPlaceholders = [ - JPUSH_PKGNAME : applicationId, - JPUSH_APPKEY : "你自己应用的 AppKey", //你自己应用的 AppKey. - JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可. + // 设置manifest.xml中的变量 + JPUSH_PKGNAME: applicationId, + JPUSH_APPKEY : "1b5965ba23557bcf384e0b08", + JPUSH_CHANNEL: "default_developer", + applicationName: "android.app.Application", ] + } - signingConfigs { + buildTypes { release { - keyAlias 'androiddebugkey' - keyPassword 'android' - storePassword 'android' - storeFile file('debug.keystore') + minifyEnabled true + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } - debug { - storeFile file('debug.keystore') + debug{ + minifyEnabled false } } - buildTypes { - release { - signingConfig signingConfigs.release - shrinkResources false - } + + signingConfigs { debug { - signingConfig signingConfigs.debug + storeFile file("./debug.keystore") + } + uidyn { + storeFile file("./debug.keystore") } } } @@ -79,9 +77,3 @@ android { flutter { source '../..' } - -dependencies { - testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test:runner:1.0.2' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' -} diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/android/app/src/debug/AndroidManifest.xml index dddbcb2..8bce946 100644 --- a/example/android/app/src/debug/AndroidManifest.xml +++ b/example/android/app/src/debug/AndroidManifest.xml @@ -1,6 +1,7 @@ - diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 484c138..27228f3 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,18 +1,12 @@ - - - + - - + android:name="io.flutter.embedding.android.NormalTheme" + android:resource="@style/NormalTheme" + /> diff --git a/example/android/app/src/main/java/com/jiguang/jverify_example/MainActivity.java b/example/android/app/src/main/java/com/example/ttt/MainActivity.java similarity index 74% rename from example/android/app/src/main/java/com/jiguang/jverify_example/MainActivity.java rename to example/android/app/src/main/java/com/example/ttt/MainActivity.java index b757c83..98b1060 100644 --- a/example/android/app/src/main/java/com/jiguang/jverify_example/MainActivity.java +++ b/example/android/app/src/main/java/com/example/ttt/MainActivity.java @@ -1,7 +1,6 @@ -package com.jiguang.jverify_example; +package com.example.ttt; import io.flutter.embedding.android.FlutterActivity; public class MainActivity extends FlutterActivity { } - diff --git a/example/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/example/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 0000000..bfc758d --- /dev/null +++ b/example/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,24 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new com.jiguang.jverify.JverifyPlugin()); + } catch (Exception e) { + Log.e(TAG, "Error registering plugin jverify, com.jiguang.jverify.JverifyPlugin", e); + } + } +} diff --git a/example/android/app/src/main/res/anim/activity_slide_enter_bottom.xml b/example/android/app/src/main/res/anim/activity_slide_enter_bottom.xml deleted file mode 100644 index cab55c1..0000000 --- a/example/android/app/src/main/res/anim/activity_slide_enter_bottom.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/example/android/app/src/main/res/anim/activity_slide_exit_bottom.xml b/example/android/app/src/main/res/anim/activity_slide_exit_bottom.xml deleted file mode 100644 index 692ba73..0000000 --- a/example/android/app/src/main/res/anim/activity_slide_exit_bottom.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/example/android/app/src/main/res/drawable-v21/launch_background.xml b/example/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/example/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/example/android/app/src/main/res/drawable-xxhdpi-v4/main_gif.gif b/example/android/app/src/main/res/drawable-xxhdpi-v4/main_gif.gif deleted file mode 100644 index c4fff90..0000000 Binary files a/example/android/app/src/main/res/drawable-xxhdpi-v4/main_gif.gif and /dev/null 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/drawable/main_btn_other.png b/example/android/app/src/main/res/drawable/main_btn_other.png new file mode 100644 index 0000000..25ce35f Binary files /dev/null and b/example/android/app/src/main/res/drawable/main_btn_other.png differ diff --git a/example/android/app/src/main/res/values-night/styles.xml b/example/android/app/src/main/res/values-night/styles.xml index 449a9f9..06952be 100644 --- a/example/android/app/src/main/res/values-night/styles.xml +++ b/example/android/app/src/main/res/values-night/styles.xml @@ -3,14 +3,14 @@ - diff --git a/example/android/app/src/main/res/xml/network_security_config.xml b/example/android/app/src/main/res/xml/network_security_config.xml deleted file mode 100644 index d7b4192..0000000 --- a/example/android/app/src/main/res/xml/network_security_config.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/example/android/app/src/profile/AndroidManifest.xml b/example/android/app/src/profile/AndroidManifest.xml index dddbcb2..8bce946 100644 --- a/example/android/app/src/profile/AndroidManifest.xml +++ b/example/android/app/src/profile/AndroidManifest.xml @@ -1,6 +1,7 @@ - diff --git a/example/android/build.gradle b/example/android/build.gradle index 1cc2840..713d7f6 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,21 +1,20 @@ - buildscript { + ext.kotlin_version = '1.7.10' repositories { - maven { url 'https://maven.aliyun.com/repository/public/' } google() - jcenter() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' + classpath 'com.android.tools.build:gradle:7.2.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } allprojects { repositories { - maven { url 'https://maven.aliyun.com/repository/public/' } google() - jcenter() + mavenCentral() } } @@ -27,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 6b3f493..94adc3a 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -1,3 +1,3 @@ org.gradle.jvmargs=-Xmx1536M -#android.enableR8=true -android.useAndroidX=true \ No newline at end of file +android.useAndroidX=true +android.enableJetifier=true diff --git a/example/android/gradle/wrapper/gradle-wrapper.jar b/example/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..13372ae Binary files /dev/null and b/example/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index 2819f02..3c472b9 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Fri Jun 23 08:50:38 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip diff --git a/example/android/gradlew b/example/android/gradlew new file mode 100755 index 0000000..9d82f78 --- /dev/null +++ b/example/android/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/example/android/gradlew.bat b/example/android/gradlew.bat new file mode 100644 index 0000000..aec9973 --- /dev/null +++ b/example/android/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/example/android/local.properties b/example/android/local.properties new file mode 100644 index 0000000..2c1d68a --- /dev/null +++ b/example/android/local.properties @@ -0,0 +1,5 @@ +sdk.dir=/Users/shunihuang/Library/Android/sdk +flutter.sdk=/Users/shunihuang/flutter +flutter.buildMode=debug +flutter.versionName=1.0.0 +flutter.versionCode=1 \ No newline at end of file diff --git a/example/android/settings.gradle b/example/android/settings.gradle index 5a2f14f..44e62bc 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -1,15 +1,11 @@ include ':app' -def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() -def plugins = new Properties() -def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') -if (pluginsFile.exists()) { - pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } -} +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } -plugins.each { name, path -> - def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() - include ":$name" - project(":$name").projectDir = pluginDirectory -} +def flutterSdkPath = properties.getProperty("flutter.sdk") +assert flutterSdkPath != null, "flutter.sdk not set in local.properties" +apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/example/ios/.gitignore b/example/ios/.gitignore new file mode 100644 index 0000000..7a7f987 --- /dev/null +++ b/example/ios/.gitignore @@ -0,0 +1,34 @@ +**/dgph +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/ephemeral/ +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist index 9367d48..9625e10 100644 --- a/example/ios/Flutter/AppFrameworkInfo.plist +++ b/example/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 8.0 + 11.0 diff --git a/example/ios/Flutter/Debug.xcconfig b/example/ios/Flutter/Debug.xcconfig index e8efba1..ec97fc6 100644 --- a/example/ios/Flutter/Debug.xcconfig +++ b/example/ios/Flutter/Debug.xcconfig @@ -1,2 +1,2 @@ -#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Generated.xcconfig" diff --git a/example/ios/Flutter/Flutter.podspec b/example/ios/Flutter/Flutter.podspec index 5ca3041..29758b7 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 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.summary = 'A UI toolkit for beautiful and fast apps.' + s.homepage = 'https://flutter.dev' + s.license = { :type => 'BSD' } 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 = '11.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/Release.xcconfig b/example/ios/Flutter/Release.xcconfig index 399e934..c4855bf 100644 --- a/example/ios/Flutter/Release.xcconfig +++ b/example/ios/Flutter/Release.xcconfig @@ -1,2 +1,2 @@ -#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Generated.xcconfig" diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh index 0be2a44..cbba00e 100755 --- a/example/ios/Flutter/flutter_export_environment.sh +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -1,13 +1,13 @@ #!/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/jiguang/Documents/fluttersdk" +export "FLUTTER_APPLICATION_PATH=/Users/jiguang/jverify-flutter-plugin/example" +export "COCOAPODS_PARALLEL_CODE_SIGN=true" +export "FLUTTER_TARGET=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_OBFUSCATION=false" export "TRACK_WIDGET_CREATION=false" -export "TREE_SHAKE_ICONS=false" -export "PACKAGE_CONFIG=.packages" +export "TREE_SHAKE_ICONS=true" +export "PACKAGE_CONFIG=/Users/jiguang/jverify-flutter-plugin/example/.dart_tool/package_config.json" diff --git a/example/ios/Podfile b/example/ios/Podfile index d077b08..88359b2 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '9.0' +# platform :ios, '11.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' @@ -10,60 +10,32 @@ 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 + +target 'Runner' do + use_frameworks! + use_modular_headers! - # 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') - } + 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/Podfile.lock b/example/ios/Podfile.lock new file mode 100644 index 0000000..41bf989 --- /dev/null +++ b/example/ios/Podfile.lock @@ -0,0 +1,34 @@ +PODS: + - Flutter (1.0.0) + - JCore (4.6.0) + - JVerification (3.2.0): + - JCore (>= 2.1.6) + - jverify (0.0.1): + - Flutter + - JCore (= 4.6.0) + - JVerification (= 3.2.0) + +DEPENDENCIES: + - Flutter (from `Flutter`) + - jverify (from `.symlinks/plugins/jverify/ios`) + +SPEC REPOS: + trunk: + - JCore + - JVerification + +EXTERNAL SOURCES: + Flutter: + :path: Flutter + jverify: + :path: ".symlinks/plugins/jverify/ios" + +SPEC CHECKSUMS: + Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 + JCore: bfb281ba5fbf3d3e50ccb36bb41d54e0e99312df + JVerification: a7ea43d7428d0a55316456d1b0874c04450c67ca + jverify: de350b6713d505f62ae653a0035d9f1f4697a017 + +PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 + +COCOAPODS: 1.11.3 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 6cc2a5b..bcdd884 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -3,23 +3,17 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 3435548B110DBB2CC5D00020 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 53080C7B42889D6BF16C71FE /* Pods_Runner.framework */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 77679FB52265E09400A83DD6 /* libc++.1.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 77679FB42265E09400A83DD6 /* libc++.1.tbd */; }; - 77679FB72265E0A400A83DD6 /* libresolv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 77679FB62265E0A400A83DD6 /* libresolv.tbd */; }; - 77679FB92265E0B700A83DD6 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 77679FB82265E0B700A83DD6 /* libz.tbd */; }; - 77679FBB2265E0C400A83DD6 /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 77679FBA2265E0C400A83DD6 /* libsqlite3.tbd */; }; - 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; - 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; - 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; - FB04C0A161B4BF33D40EB046 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 061E6927262E9E58BBA96272 /* libPods-Runner.a */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -36,28 +30,23 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 061E6927262E9E58BBA96272 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 213B11D553A3A738EAA8532F /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 6187B7C2B26A2CF62F2B8AD7 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; - 77679FB42265E09400A83DD6 /* libc++.1.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.1.tbd"; path = "usr/lib/libc++.1.tbd"; sourceTree = SDKROOT; }; - 77679FB62265E0A400A83DD6 /* libresolv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libresolv.tbd; path = usr/lib/libresolv.tbd; sourceTree = SDKROOT; }; - 77679FB82265E0B700A83DD6 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; - 77679FBA2265E0C400A83DD6 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; }; + 53080C7B42889D6BF16C71FE /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 6409C314064BCAB50826DBDA /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; - 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - F7E2B83C6E832CA8E4C04C1E /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + E956EFA78A47B0A76A369253 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + F265F0A65553B8881DF61146 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -65,25 +54,27 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 77679FBB2265E0C400A83DD6 /* libsqlite3.tbd in Frameworks */, - 77679FB92265E0B700A83DD6 /* libz.tbd in Frameworks */, - 77679FB72265E0A400A83DD6 /* libresolv.tbd in Frameworks */, - 77679FB52265E09400A83DD6 /* libc++.1.tbd in Frameworks */, - FB04C0A161B4BF33D40EB046 /* libPods-Runner.a in Frameworks */, + 3435548B110DBB2CC5D00020 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 4887942CF214D5CA1C0138F5 /* Frameworks */ = { + 36B6F91344C0BEE2943148A3 /* Pods */ = { isa = PBXGroup; children = ( - 77679FBA2265E0C400A83DD6 /* libsqlite3.tbd */, - 77679FB82265E0B700A83DD6 /* libz.tbd */, - 77679FB62265E0A400A83DD6 /* libresolv.tbd */, - 77679FB42265E09400A83DD6 /* libc++.1.tbd */, - 061E6927262E9E58BBA96272 /* libPods-Runner.a */, + 6409C314064BCAB50826DBDA /* Pods-Runner.debug.xcconfig */, + F265F0A65553B8881DF61146 /* Pods-Runner.release.xcconfig */, + E956EFA78A47B0A76A369253 /* Pods-Runner.profile.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; + 648888C82C6BA9BC4827927D /* Frameworks */ = { + isa = PBXGroup; + children = ( + 53080C7B42889D6BF16C71FE /* Pods_Runner.framework */, ); name = Frameworks; sourceTree = ""; @@ -105,8 +96,8 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, - E02A8967CAB8FB26CE2DAFA7 /* Pods */, - 4887942CF214D5CA1C0138F5 /* Frameworks */, + 36B6F91344C0BEE2943148A3 /* Pods */, + 648888C82C6BA9BC4827927D /* Frameworks */, ); sourceTree = ""; }; @@ -121,37 +112,18 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( - 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, - 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 97C146FA1CF9000F007C117D /* Main.storyboard */, 97C146FD1CF9000F007C117D /* Assets.xcassets */, 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 97C147021CF9000F007C117D /* Info.plist */, - 97C146F11CF9000F007C117D /* Supporting Files */, 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, ); path = Runner; sourceTree = ""; }; - 97C146F11CF9000F007C117D /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 97C146F21CF9000F007C117D /* main.m */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - E02A8967CAB8FB26CE2DAFA7 /* Pods */ = { - isa = PBXGroup; - children = ( - F7E2B83C6E832CA8E4C04C1E /* Pods-Runner.debug.xcconfig */, - 6187B7C2B26A2CF62F2B8AD7 /* Pods-Runner.release.xcconfig */, - 213B11D553A3A738EAA8532F /* Pods-Runner.profile.xcconfig */, - ); - path = Pods; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -159,14 +131,13 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 881F7F5C9B13C6100922CDA7 /* [CP] Check Pods Manifest.lock */, + E2F27679182B69431F131AE1 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - 3EAA4E67215C408AB6EF1883 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -183,18 +154,17 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0910; - ORGANIZATIONNAME = "The Chromium Authors"; + LastUpgradeCheck = 1300; + ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { CreatedOnToolsVersion = 7.3.1; - DevelopmentTeam = 8X2A38Q9VD; - ProvisioningStyle = Manual; + LastSwiftMigration = 1100; }; }; }; buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; - compatibilityVersion = "Xcode 3.2"; + compatibilityVersion = "Xcode 9.3"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( @@ -218,7 +188,6 @@ files = ( 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, - 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, ); @@ -229,6 +198,7 @@ /* Begin PBXShellScriptBuildPhase section */ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -241,25 +211,22 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; - 3EAA4E67215C408AB6EF1883 /* [CP] Embed Pods Frameworks */ = { + 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; 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"; + name = "Run Script"; 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; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; - 881F7F5C9B13C6100922CDA7 /* [CP] Check Pods Manifest.lock */ = { + E2F27679182B69431F131AE1 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -281,20 +248,6 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 9740EEB61CF901F6004384FC /* Run Script */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Run Script"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -302,8 +255,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, - 97C146F31CF9000F007C117D /* main.m in Sources */, + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -343,12 +295,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -369,9 +323,10 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -382,25 +337,24 @@ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 8X2A38Q9VD; + DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = UT282795WK; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - "$(PROJECT_DIR)/Runner", - ); INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/Flutter", - "$(PROJECT_DIR)/Runner", + "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.jiguang.verification; + PRODUCT_BUNDLE_IDENTIFIER = cn.jiguang.hxhg; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = JVerificationDemo_dev; + PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = cn.jiguang.hxhg; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Profile; @@ -418,12 +372,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -450,7 +406,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 = 11.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -471,12 +427,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -497,9 +455,12 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -510,26 +471,25 @@ baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_IDENTITY = "iPhone Developer"; + CLANG_ENABLE_MODULES = YES; CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 8X2A38Q9VD; + DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = UT282795WK; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - "$(PROJECT_DIR)/Runner", - ); INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/Flutter", - "$(PROJECT_DIR)/Runner", + "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.jiguang.verification; + PRODUCT_BUNDLE_IDENTIFIER = cn.jiguang.hxhg; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = JVerificationDemo_dev; + PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = cn.jiguang.hxhg; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; @@ -539,25 +499,24 @@ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 8X2A38Q9VD; + DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = UT282795WK; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - "$(PROJECT_DIR)/Runner", - ); INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/Flutter", - "$(PROJECT_DIR)/Runner", + "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.jiguang.verification; + PRODUCT_BUNDLE_IDENTIFIER = cn.jiguang.hxhg; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = JVerificationDemo_dev; + PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = cn.jiguang.hxhg; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; 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/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 0e8f951..c87d15a 100644 --- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ - - - - + + - - - - + + + + + + diff --git a/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/example/ios/Runner/AppDelegate.h b/example/ios/Runner/AppDelegate.h deleted file mode 100644 index 36e21bb..0000000 --- a/example/ios/Runner/AppDelegate.h +++ /dev/null @@ -1,6 +0,0 @@ -#import -#import - -@interface AppDelegate : FlutterAppDelegate - -@end diff --git a/example/ios/Runner/AppDelegate.m b/example/ios/Runner/AppDelegate.m deleted file mode 100644 index 59a72e9..0000000 --- a/example/ios/Runner/AppDelegate.m +++ /dev/null @@ -1,13 +0,0 @@ -#include "AppDelegate.h" -#include "GeneratedPluginRegistrant.h" - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application - didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - [GeneratedPluginRegistrant registerWithRegistry:self]; - // Override point for customization after application launch. - return [super application:application didFinishLaunchingWithOptions:launchOptions]; -} - -@end diff --git a/example/ios/Runner/AppDelegate.swift b/example/ios/Runner/AppDelegate.swift new file mode 100644 index 0000000..70693e4 --- /dev/null +++ b/example/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import UIKit +import Flutter + +@UIApplicationMain +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png index 3d43d11..dc9ada4 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png index 28c6bf0..7353c41 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png index 2ccbfd9..797d452 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png index f091b6b..6ed2d93 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png index 4cde121..4cd7b00 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png index d0ef06e..fe73094 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png index dcdc230..321773c 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png index 2ccbfd9..797d452 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png index c8f9ed8..502f463 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png index a6d6b86..0ec3034 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png index a6d6b86..0ec3034 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png index 75b2d16..e9f5fea 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png index c4df70d..84ac32a 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png index 6a84f41..8953cba 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png index d0e1f58..0467bf1 100644 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/Contents.json b/example/ios/Runner/Assets.xcassets/Contents.json deleted file mode 100644 index da4a164..0000000 --- a/example/ios/Runner/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/example/ios/Runner/Base.lproj/Main.storyboard b/example/ios/Runner/Base.lproj/Main.storyboard index f5ee3ed..f3c2851 100644 --- a/example/ios/Runner/Base.lproj/Main.storyboard +++ b/example/ios/Runner/Base.lproj/Main.storyboard @@ -1,10 +1,8 @@ - - - + + - - + @@ -16,14 +14,13 @@ - + - + - diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist index 05e0e3c..a581248 100644 --- a/example/ios/Runner/Info.plist +++ b/example/ios/Runner/Info.plist @@ -2,10 +2,12 @@ - CFBundleDisplayName - + CADisableMinimumFrameDurationOnPhone + CFBundleDevelopmentRegion - en + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Example CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier @@ -13,7 +15,7 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - jverify_example + example CFBundlePackageType APPL CFBundleShortVersionString @@ -24,11 +26,8 @@ $(FLUTTER_BUILD_NUMBER) LSRequiresIPhoneOS - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - + UIApplicationSupportsIndirectInputEvents + UILaunchStoryboardName LaunchScreen UIMainStoryboardFile @@ -47,6 +46,6 @@ UIInterfaceOrientationLandscapeRight UIViewControllerBasedStatusBarAppearance - + diff --git a/example/ios/Runner/Runner-Bridging-Header.h b/example/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 0000000..308a2a5 --- /dev/null +++ b/example/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/example/ios/Runner/main.m b/example/ios/Runner/main.m deleted file mode 100644 index dff6597..0000000 --- a/example/ios/Runner/main.m +++ /dev/null @@ -1,9 +0,0 @@ -#import -#import -#import "AppDelegate.h" - -int main(int argc, char* argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/example/lib/main.dart b/example/lib/main.dart index 223b79b..4444961 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'; @@ -123,7 +124,7 @@ class _MyAppState extends State { child: SizedBox( child: new CustomButton( onPressed: () { - loginAuth(); + loginAuth(false); }, title: "一键登录", ), @@ -131,6 +132,18 @@ class _MyAppState extends State { ), margin: EdgeInsets.fromLTRB(40, 5, 40, 5), ), + new Container( + child: SizedBox( + child: new CustomButton( + onPressed: () { + loginAuth(true); + }, + title: "短信登录", + ), + width: double.infinity, + ), + margin: EdgeInsets.fromLTRB(40, 5, 40, 5), + ), new Container( child: SizedBox( child: new CustomButton( @@ -209,7 +222,7 @@ class _MyAppState extends State { _showLoading(context); }); String phoneNum = controllerPHone.text; - if (phoneNum == null || phoneNum.isEmpty) { + if (phoneNum.isEmpty) { setState(() { _hideLoading(); _result = "[3002],msg = 没有输入手机号码"; @@ -272,13 +285,16 @@ class _MyAppState extends State { } /// SDK 请求授权一键登录 - void loginAuth() { + void loginAuth(bool isSms) { setState(() { _showLoading(context); }); jverify.checkVerifyEnable().then((map) { bool result = map[f_result_key]; - if (result) { + print("checkVerifyEnable $map"); + //需要使用sms的时候不检查result + // if (result) { + if (true) { final screenSize = MediaQuery.of(context).size; final screenWidth = screenSize.width; final screenHeight = screenSize.height; @@ -290,12 +306,16 @@ 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; - uiConfig.navText = "登录"; - uiConfig.navTextColor = Colors.blue.value; - uiConfig.navReturnImgPath = "return_bg"; //图片必须存在 + uiConfig.navHidden = !isiOS; + // uiConfig.navColor = Colors.red.value; + // uiConfig.navText = "登录"; + // uiConfig.navTextColor = Colors.blue.value; + // uiConfig.navReturnImgPath = "return_bg"; //图片必须存在 uiConfig.logoWidth = 100; uiConfig.logoHeight = 80; @@ -313,8 +333,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 +348,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"; //图片必须存在 @@ -337,12 +356,13 @@ class _MyAppState extends State { uiConfig.privacyHintToast = true; //only android 设置隐私条款不选中时点击登录按钮默认显示toast。 - uiConfig.privacyState = true; //设置默认勾选 + uiConfig.privacyState = false; //设置默认勾选 uiConfig.privacyCheckboxSize = 20; uiConfig.checkedImgPath = "check_image"; //图片必须存在 uiConfig.uncheckedImgPath = "uncheck_image"; //图片必须存在 uiConfig.privacyCheckboxInCenter = true; - //uiConfig.privacyCheckboxHidden = false; + uiConfig.privacyCheckboxHidden = false; + uiConfig.isAlertPrivacyVc = true; //uiConfig.privacyOffsetX = isiOS ? (20 + uiConfig.privacyCheckboxSize) : null; uiConfig.privacyOffsetY = 15; // 距离底部距离 @@ -353,8 +373,17 @@ 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; @@ -363,7 +392,7 @@ class _MyAppState extends State { JVIOSUIModalTransitionStyle.CrossDissolve; uiConfig.statusBarColorWithNav = true; - uiConfig.virtualButtonTransparent = true; + // uiConfig.virtualButtonTransparent = true; uiConfig.privacyStatusBarColorWithNav = true; uiConfig.privacyVirtualButtonTransparent = true; @@ -373,60 +402,104 @@ 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"; //图片必须存在; + + //协议二次弹窗内容设置 -iOS + uiConfig.isAlertPrivacyVc = true; + uiConfig.agreementAlertViewTitleTexSize = 18; + uiConfig.agreementAlertViewTitleTextColor = Colors.red.value; + uiConfig.agreementAlertViewContentTextAlignment = + JVTextAlignmentType.center; + uiConfig.agreementAlertViewContentTextFontSize = 16; + uiConfig.agreementAlertViewLoginBtnNormalImagePath = "login_btn_normal"; + uiConfig.agreementAlertViewLoginBtnPressedImagePath = "login_btn_press"; + uiConfig.agreementAlertViewLoginBtnUnableImagePath = "login_btn_unable"; + uiConfig.agreementAlertViewLogBtnTextColor = Colors.black.value; + + //协议二次弹窗内容设置 -Android + JVPrivacyCheckDialogConfig privacyCheckDialogConfig = + JVPrivacyCheckDialogConfig(); + // privacyCheckDialogConfig.width = 250; + // privacyCheckDialogConfig.height = 100; + privacyCheckDialogConfig.title = "测试协议标题"; + privacyCheckDialogConfig.offsetX = 0; + privacyCheckDialogConfig.offsetY = 0; + privacyCheckDialogConfig.logBtnText = "同11意"; + privacyCheckDialogConfig.titleTextSize = 22; + privacyCheckDialogConfig.gravity = "center"; + privacyCheckDialogConfig.titleTextColor = Colors.black.value; + privacyCheckDialogConfig.contentTextGravity = "left"; + privacyCheckDialogConfig.contentTextSize = 14; + privacyCheckDialogConfig.logBtnImgPath = "login_btn_normal"; + privacyCheckDialogConfig.logBtnTextColor = Colors.black.value; + privacyCheckDialogConfig.logBtnMarginT = 20; + privacyCheckDialogConfig.logBtnMarginB = 20; + privacyCheckDialogConfig.logBtnMarginL = 10; + privacyCheckDialogConfig.logBtnWidth = 140; + privacyCheckDialogConfig.logBtnHeight = 40; + + /// 添加自定义的 控件 到dialog + List dialogWidgetList = []; + final String btn_dialog_widgetId = + "jv_add_custom_dialog_button"; // 标识控件 id + JVCustomWidget buttonDialogWidget = + JVCustomWidget(btn_dialog_widgetId, JVCustomWidgetType.button); + buttonDialogWidget.title = "取消"; + buttonDialogWidget.left = 163; + buttonDialogWidget.top = 142; + buttonDialogWidget.width = 140; + buttonDialogWidget.height = 40; + buttonDialogWidget.textAlignment = JVTextAlignmentType.center; + buttonDialogWidget.btnNormalImageName = "main_btn_other"; + buttonDialogWidget.btnPressedImageName = "main_btn_other"; + // buttonDialogWidget.backgroundColor = Colors.yellow.value; + //buttonWidget.textAlignment = JVTextAlignmentType.left; + + // 添加点击事件监听 + jverify.addClikWidgetEventListener(btn_dialog_widgetId, (eventId) { + print("receive listener - click dialog widget event :$eventId"); + if (btn_dialog_widgetId == eventId) { + print("receive listener - 点击【新加 dialog button】"); + } + }); + dialogWidgetList.add(buttonDialogWidget); + privacyCheckDialogConfig.widgets = dialogWidgetList; + uiConfig.privacyCheckDialogConfig = privacyCheckDialogConfig; + + //sms + JVSMSUIConfig smsConfig = JVSMSUIConfig(); + smsConfig.smsPrivacyBeanList = [ + JVPrivacy("自定义协议1", "http://www.baidu.com", + beforeName: "==", afterName: "++", separator: "*") + ]; + smsConfig.enableSMSService = true; + uiConfig.smsUIConfig = smsConfig; + + uiConfig.setIsPrivacyViewDarkMode = false; //协议页面是否支持暗黑模式 //弹框模式 // 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); + final String text_widgetId = "jv_add_custom_text"; // 标识控件 id + JVCustomWidget textWidget = + JVCustomWidget(text_widgetId, JVCustomWidgetType.textView); textWidget.title = "新加 text view 控件"; textWidget.left = 20; - textWidget.top = 360 ; + textWidget.top = 360; textWidget.width = 200; - textWidget.height = 40; + textWidget.height = 40; textWidget.backgroundColor = Colors.yellow.value; textWidget.isShowUnderline = true; textWidget.textAlignment = JVTextAlignmentType.center; @@ -441,13 +514,14 @@ class _MyAppState extends State { }); widgetList.add(textWidget); - final String btn_widgetId = "jv_add_custom_button";// 标识控件 id - JVCustomWidget buttonWidget = JVCustomWidget(btn_widgetId, JVCustomWidgetType.button); + final String btn_widgetId = "jv_add_custom_button"; // 标识控件 id + JVCustomWidget buttonWidget = + JVCustomWidget(btn_widgetId, JVCustomWidgetType.button); buttonWidget.title = "新加 button 控件"; buttonWidget.left = 100; buttonWidget.top = 400; buttonWidget.width = 150; - buttonWidget.height = 40; + buttonWidget.height = 40; buttonWidget.isShowUnderline = true; buttonWidget.backgroundColor = Colors.brown.value; //buttonWidget.btnNormalImageName = ""; @@ -462,7 +536,51 @@ class _MyAppState extends State { } }); widgetList.add(buttonWidget); - */ + + // 设置iOS的二次弹窗按钮 + uiConfig.agreementAlertViewWidgets = dialogWidgetList; + uiConfig.agreementAlertViewUIFrames = { + "superViewFrame": [10, 60, 280, 300], + "alertViewFrame": [0, 0, 280, 300], + "titleFrame": [10, 10, 260, 40], + "contentFrame": [15, 60, 250, 110], + "buttonFrame": [10, 200, 100, 40] + }; + + /// 步骤 1:调用接口设置 UI + jverify.setCustomAuthorizationView(true, uiConfig, + landscapeConfig: uiConfig, widgets: widgetList); + if (!isSms) { + /// 步骤 2:调用一键登录接口 + jverify.loginAuthSyncApi2( + autoDismiss: true, + enableSms: true, + loginAuthcallback: (event) { + setState(() { + _hideLoading(); + _result = "获取返回数据:[${event.code}] message = ${event.message}"; + }); + print( + "获取到 loginAuthSyncApi 接口返回数据,code=${event.code},message = ${event.message},operator = ${event.operator}"); + }); + } else { + /// 步骤 2:调用短信登录接口 + jverify.smsAuth( + autoDismiss: true, + smsCallback: (event) { + setState(() { + _hideLoading(); + _result = "获取返回数据:[${event.code}] message = ${event.message}"; + }); + print( + "获取到 smsAuth 接口返回数据,code=${event.code},message = ${event.message},phone = ${event.phone}"); + }); + } + } else { + setState(() { + _hideLoading(); + _result = "[2016],msg = 当前网络环境不支持认证"; + }); /* 弹框模式 JVPopViewConfig popViewConfig = JVPopViewConfig(); @@ -491,7 +609,6 @@ class _MyAppState extends State { }); */ - } }); } @@ -504,8 +621,9 @@ class _MyAppState extends State { }); jverify.setDebugMode(true); // 打开调试模式 + jverify.setCollectionAuth(true); jverify.setup( - appKey: "a0e6ace8d5b3e0247e3f58db", //"你自己应用的 AppKey", + appKey: "4fcc3e237eec4c4fb804ad49", //"你自己应用的 AppKey", channel: "devloper-default"); // 初始化sdk, appKey 和 channel 只对ios设置有效 // If the widget was removed from the tree while the asynchronous platform // message was in flight, we want to discard the reply rather than calling @@ -517,6 +635,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/example/linux/flutter/generated_plugin_registrant.cc b/example/linux/flutter/generated_plugin_registrant.cc new file mode 100644 index 0000000..e71a16d --- /dev/null +++ b/example/linux/flutter/generated_plugin_registrant.cc @@ -0,0 +1,11 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + + +void fl_register_plugins(FlPluginRegistry* registry) { +} diff --git a/example/linux/flutter/generated_plugin_registrant.h b/example/linux/flutter/generated_plugin_registrant.h new file mode 100644 index 0000000..e0f0a47 --- /dev/null +++ b/example/linux/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void fl_register_plugins(FlPluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/example/linux/flutter/generated_plugins.cmake b/example/linux/flutter/generated_plugins.cmake new file mode 100644 index 0000000..2e1de87 --- /dev/null +++ b/example/linux/flutter/generated_plugins.cmake @@ -0,0 +1,23 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/example/macos/Flutter/GeneratedPluginRegistrant.swift b/example/macos/Flutter/GeneratedPluginRegistrant.swift new file mode 100644 index 0000000..cccf817 --- /dev/null +++ b/example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -0,0 +1,10 @@ +// +// Generated file. Do not edit. +// + +import FlutterMacOS +import Foundation + + +func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { +} diff --git a/example/macos/Flutter/ephemeral/Flutter-Generated.xcconfig b/example/macos/Flutter/ephemeral/Flutter-Generated.xcconfig new file mode 100644 index 0000000..bb586be --- /dev/null +++ b/example/macos/Flutter/ephemeral/Flutter-Generated.xcconfig @@ -0,0 +1,11 @@ +// This is a generated file; do not edit or check into version control. +FLUTTER_ROOT=/Users/jiguang/Documents/fluttersdk +FLUTTER_APPLICATION_PATH=/Users/jiguang/jverify-flutter-plugin/example +COCOAPODS_PARALLEL_CODE_SIGN=true +FLUTTER_BUILD_DIR=build +FLUTTER_BUILD_NAME=1.0.0 +FLUTTER_BUILD_NUMBER=1 +DART_OBFUSCATION=false +TRACK_WIDGET_CREATION=true +TREE_SHAKE_ICONS=false +PACKAGE_CONFIG=.dart_tool/package_config.json diff --git a/example/macos/Flutter/ephemeral/flutter_export_environment.sh b/example/macos/Flutter/ephemeral/flutter_export_environment.sh new file mode 100755 index 0000000..7813bd7 --- /dev/null +++ b/example/macos/Flutter/ephemeral/flutter_export_environment.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=/Users/jiguang/Documents/fluttersdk" +export "FLUTTER_APPLICATION_PATH=/Users/jiguang/jverify-flutter-plugin/example" +export "COCOAPODS_PARALLEL_CODE_SIGN=true" +export "FLUTTER_BUILD_DIR=build" +export "FLUTTER_BUILD_NAME=1.0.0" +export "FLUTTER_BUILD_NUMBER=1" +export "DART_OBFUSCATION=false" +export "TRACK_WIDGET_CREATION=true" +export "TREE_SHAKE_ICONS=false" +export "PACKAGE_CONFIG=.dart_tool/package_config.json" diff --git a/example/macos/Podfile b/example/macos/Podfile new file mode 100644 index 0000000..049abe2 --- /dev/null +++ b/example/macos/Podfile @@ -0,0 +1,40 @@ +platform :osx, '10.14' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', '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 + + 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 Flutter-Generated.xcconfig, then run \"flutter pub get\"" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_macos_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_macos_build_settings(target) + end +end diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 8258a72..c9d2371 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,13 +1,39 @@ -name: jverify_example -description: Demonstrates how to use the jverify plugin. -publish_to: 'none' +name: example +description: A new Flutter project. +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.0.0+1 environment: - sdk: ">=2.12.0 <3.0.0" + sdk: '>=2.18.0 <3.0.0' +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. dependencies: flutter: sdk: flutter + + jverify: + path: ../ + # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 @@ -16,12 +42,17 @@ dev_dependencies: flutter_test: sdk: flutter - jverify: - path: ../ + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^2.0.0 + # For information on the generic Dart part of this file, see the -# following page: https://www.dartlang.org/tools/pub/pubspec +# following page: https://dart.dev/tools/pub/pubspec -# The following section is specific to Flutter. +# The following section is specific to Flutter packages. flutter: # The following line ensures that the Material Icons font is @@ -31,14 +62,14 @@ flutter: # To add assets to your application, add an assets section, like this: # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.io/assets-and-images/#resolution-aware. + # https://flutter.dev/assets-and-images/#resolution-aware # For details regarding adding assets from package dependencies, see - # https://flutter.io/assets-and-images/#from-packages + # https://flutter.dev/assets-and-images/#from-packages # To add custom fonts to your application, add a fonts section here, # in this "flutter" section. Each entry in this list should have a @@ -58,4 +89,4 @@ flutter: # weight: 700 # # For details regarding fonts from package dependencies, - # see https://flutter.io/custom-fonts/#from-packages + # see https://flutter.dev/custom-fonts/#from-packages diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart index 52ba176..092d222 100644 --- a/example/test/widget_test.dart +++ b/example/test/widget_test.dart @@ -1,27 +1,30 @@ // This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester -// utility that Flutter provides. For example, you can send tap and scroll +// utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:jverify_example/main.dart'; +import 'package:example/main.dart'; void main() { - testWidgets('Verify Platform version', (WidgetTester tester) async { + testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. - await tester.pumpWidget(MyApp()); + await tester.pumpWidget(const MyApp()); - // Verify that platform version is retrieved. - expect( - find.byWidgetPredicate( - (Widget widget) => widget is Text && - widget.data.startsWith('Running on:'), - ), - findsOneWidget, - ); + // Verify that our counter starts at 0. + expect(find.text('0'), findsOneWidget); + expect(find.text('1'), findsNothing); + + // Tap the '+' icon and trigger a frame. + await tester.tap(find.byIcon(Icons.add)); + await tester.pump(); + + // Verify that our counter has incremented. + expect(find.text('0'), findsNothing); + expect(find.text('1'), findsOneWidget); }); } diff --git a/ios/Classes/JverifyPlugin.m b/ios/Classes/JverifyPlugin.m index 0ae3239..81fd97d 100644 --- a/ios/Classes/JverifyPlugin.m +++ b/ios/Classes/JverifyPlugin.m @@ -1,5 +1,6 @@ #import "JverifyPlugin.h" #import "JVERIFICATIONService.h" +#import "JGInforCollectionAuth.h" // 如果需要使用 idfa 功能所需要引入的头文件(可选) #import #define UIColorFromRGB(rgbValue) ([UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]) @@ -15,21 +16,28 @@ static NSString *const j_msg_key = @"message"; /// 运营商信息 static NSString *const j_opr_key = @"operator"; +/// 手机号 +static NSString *const j_phone_key = @"phone"; /// 默认超时时间 static long j_default_timeout = 5000; static BOOL needStartAnim = FALSE; static BOOL needCloseAnim = FALSE; + +@interface JverifyPlugin () +@property (nonatomic, copy) void(^hidAgreementAlertView)(void); +@end + @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 { @@ -40,6 +48,8 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { [self setup:call result:result]; }else if([methodName isEqualToString:@"setDebugMode"]){ [self setDebugMode:call result:result]; + }else if([methodName isEqualToString:@"setCollectionAuth"]){ + [self setCollectionAuth:call result:result]; }else if([methodName isEqualToString:@"isInitSuccess"]) { [self isSetupClient:result]; }else if([methodName isEqualToString:@"checkVerifyEnable"]){ @@ -57,7 +67,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"]) { @@ -68,6 +78,8 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { [self getSMSCode:call result:result]; }else if ([methodName isEqualToString:@"setGetCodeInternal"]){ [self setGetCodeInternal:call result:result]; + }else if ([methodName isEqualToString:@"smsAuth"]) { + [self smsAuth:call result:result]; } else { result(FlutterMethodNotImplemented); @@ -82,9 +94,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); @@ -101,6 +113,45 @@ - (void)setGetCodeInternal:(FlutterMethodCall*) call result:(FlutterResult)resul NSNumber *time = arguments[@"timeInterval"]; [JVERIFICATIONService setGetCodeInternal:[time intValue]]; } + +- (void)smsAuth:(FlutterMethodCall*) call result:(FlutterResult)resultDict{ + NSDictionary *arguments = call.arguments; + NSNumber *autoDismiss = arguments[@"autoDismiss"]; + NSTimeInterval timeout = [arguments[@"timeout"] longLongValue]; + NSInteger smsAuthIndex = [arguments[@"smsAuthIndex"] longLongValue]; + UIViewController *vc = [UIApplication sharedApplication].keyWindow.rootViewController; + __weak typeof(self) weakself = self; + [JVERIFICATIONService getSMSAuthorizationWithController:vc hide:[autoDismiss boolValue] animated:needStartAnim timeout:timeout completion:^(NSDictionary * _Nonnull res) { + + JVLog(@"getSMSAuthorizationWithController result = %@",res); + + NSString *msg; + NSString *phoneNumber; + if([res[@"content"] isKindOfClass:[NSString class]]){ + msg = res[@"content"]; + }else if ([res[@"content"] isKindOfClass:[NSDictionary class]]) { + phoneNumber = [res[@"content"] objectForKey:@"number"]; + if ([[res[@"content"] objectForKey:@"tokenReponse"] isKindOfClass:[NSDictionary class]]) { + msg = [res[@"content"][@"tokenReponse"] objectForKey:@"resultMsg"]; + } + } + NSDictionary *dict = @{ + j_code_key:res[@"code"], + j_msg_key :msg?:@"", + j_phone_key: phoneNumber?:@"", + @"smsAuthIndex": @(smsAuthIndex) + }; + __strong typeof(weakself) strongself = weakself; + dispatch_async(dispatch_get_main_queue(), ^{ + //通过 channel 返回 + [strongself.channel invokeMethod:@"onReceiveSMSAuthCallBackEvent" arguments:dict]; + }); + + } actionBlock:^(NSInteger type, NSString * _Nonnull content) { + + }]; +} + #pragma mark - 设置日志 debug 模式 -(void)setDebugMode:(FlutterMethodCall*) call result:(FlutterResult)result{ JVLog(@"Action - setDebugMode::"); @@ -110,6 +161,18 @@ -(void)setDebugMode:(FlutterMethodCall*) call result:(FlutterResult)result{ [JVERIFICATIONService setDebug:[debug boolValue]]; } +#pragma mark - 设置合规/采集授权 +-(void)setCollectionAuth:(FlutterMethodCall*) call result:(FlutterResult)result{ + JVLog(@"Action - setCollectionAuth::"); + + NSDictionary *arguments = call.arguments; + __block NSNumber *auth = arguments[@"auth"]; + + [JGInforCollectionAuth JCollectionAuth:^(JGInforCollectionAuthItems * _Nonnull authInfo) { + authInfo.isAuth = [auth boolValue]; + }]; +} + #pragma mark - 初始化 SDK - (void)setup:(FlutterMethodCall*) call result:(FlutterResult)result{ JVLog(@"Action - setup::"); @@ -146,11 +209,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 +268,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 +283,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 +297,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 +338,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[@"content"] ? res[@"content"] : @"" + }; dispatch_async(dispatch_get_main_queue(), ^{ result(dict); }); @@ -308,15 +371,17 @@ -(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]; - + NSInteger loginAuthIndex = [arguments[@"loginAuthIndex"] longLongValue]; + NSNumber *enableSms = arguments[@"enableSms"]; + UIViewController *vc = [UIApplication sharedApplication].keyWindow.rootViewController; __weak typeof(self) weakself = self; - [JVERIFICATIONService getAuthorizationWithController:vc hide:[hide boolValue] animated:needStartAnim timeout:timeout completion:^(NSDictionary *res) { + [JVERIFICATIONService getAuthorizationWithController:vc enableSms:[enableSms boolValue] hide:[hide boolValue] animated:needStartAnim timeout:timeout completion:^(NSDictionary *res) { JVLog(@"getAuthorizationWithController result = %@",res); NSString *content = @""; @@ -325,12 +390,12 @@ -(void)loginAuthSync:(BOOL)isSync call:(FlutterMethodCall*)call result:(FlutterR }else if(res[@"content"]){ content = res[@"content"]; } - 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"]?:@"", + @"loginAuthIndex": @(loginAuthIndex) + }; __strong typeof(weakself) strongself = weakself; dispatch_async(dispatch_get_main_queue(), ^{ if (isSync) { @@ -345,9 +410,10 @@ -(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:@"", + @"loginAuthIndex": @(loginAuthIndex) + }; __strong typeof(weakself) strongself = weakself; dispatch_async(dispatch_get_main_queue(), ^{ [strongself.channel invokeMethod:@"onReceiveAuthPageEvent" arguments:jsonMap]; @@ -380,10 +446,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) { @@ -404,6 +470,9 @@ - (void)layoutUIConfig:(NSDictionary *)uiconfigPara widgets:(NSArray *)widgets i JVLayoutConstraint *JVLayoutTop(CGFloat top,JVLayoutItem toItem,NSLayoutAttribute attr2) { return [JVLayoutConstraint constraintWithAttribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:toItem attribute:attr2 multiplier:1 constant:top]; } +JVLayoutConstraint *JVLayoutBottom(CGFloat bottom,JVLayoutItem toItem,NSLayoutAttribute attr2) { + return [JVLayoutConstraint constraintWithAttribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:toItem attribute:attr2 multiplier:1 constant:bottom]; +} JVLayoutConstraint *JVLayoutLeft(CGFloat left,JVLayoutItem toItem,NSLayoutAttribute attr2) { return [JVLayoutConstraint constraintWithAttribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:toItem attribute:attr2 multiplier:1 constant:left]; } @@ -413,6 +482,9 @@ - (void)layoutUIConfig:(NSDictionary *)uiconfigPara widgets:(NSArray *)widgets i JVLayoutConstraint *JVLayoutCenterX(CGFloat centerX) { return [JVLayoutConstraint constraintWithAttribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:JVLayoutItemSuper attribute:NSLayoutAttributeCenterX multiplier:1 constant:centerX]; } +JVLayoutConstraint *JVLayoutCenterY(CGFloat centerY,JVLayoutItem toItem) { + return [JVLayoutConstraint constraintWithAttribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:toItem attribute:NSLayoutAttributeCenterY multiplier:1 constant:centerY]; +} JVLayoutConstraint *JVLayoutWidth(CGFloat widht) { return [JVLayoutConstraint constraintWithAttribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:JVLayoutItemNone attribute:NSLayoutAttributeWidth multiplier:1 constant:widht]; } @@ -420,6 +492,12 @@ - (void)layoutUIConfig:(NSDictionary *)uiconfigPara widgets:(NSArray *)widgets i return [JVLayoutConstraint constraintWithAttribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:JVLayoutItemNone attribute:NSLayoutAttributeHeight multiplier:1 constant:height]; } +- (void)cancelAgreementAlertView { + if (self.hidAgreementAlertView) { + self.hidAgreementAlertView(); + } +} + //自定义授权页面原有的 UI 控件 - (void)setCustomUIWithUIConfig:(JVUIConfig *)uiconfig configArguments:(NSDictionary *)config { JVLog(@"Action - setCustomUIWithUIConfig::"); @@ -428,25 +506,33 @@ - (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) { uiconfig.authPageBackgroundImage = [UIImage imageNamed:authBackgroundImage]; } - needStartAnim = [[self getValue:config key:@"needCloseAnim"] boolValue]; + needStartAnim = [[self getValue:config key:@"needStartAnim"] 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]; @@ -481,8 +567,7 @@ - (void)setCustomUIWithUIConfig:(JVUIConfig *)uiconfig configArguments:(NSDictio if (navTransparent) { uiconfig.navTransparent = [navTransparent boolValue]; } - uiconfig.navReturnHidden = NO; - + /************** logo ***************/ JVLayoutItem logoLayoutItem = [self getLayotItem:[self getValue:config key:@"logoVerticalLayoutItem"]]; NSNumber *logoWidth = [self getNumberValue:config key:@"logoWidth"]; @@ -548,7 +633,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 +698,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:-5]; 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 +732,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,44 +743,165 @@ - (void)setCustomUIWithUIConfig:(JVUIConfig *)uiconfig configArguments:(NSDictio if (checkedImgPath) { uiconfig.checkedImg = [UIImage imageNamed:checkedImgPath]; } - + /************** privacy ***************/ + //隐私弹窗 + BOOL isAlertPrivacyVc = [[self getValue:config key:@"isAlertPrivacyVc"] boolValue]; + uiconfig.isAlertPrivacyVC = isAlertPrivacyVc; + uiconfig.agreementAlertViewShowWindow = YES; + + //自定义协议 + 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) { + uiconfig.customPrivacyAlertViewBlock = ^(UIViewController *vc , NSArray *appPrivacys,void(^loginAction)(void)) { UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"请点击同意协议" message:nil preferredStyle:UIAlertControllerStyleAlert]; [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil] ]; + [alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:nil] ]; [vc presentViewController:alert animated:true completion:nil]; }; } + // 二次弹窗自定义视图 + __weak __typeof(self)weakSelf = self; + NSArray *agreementAlertViewWidgets = [self getValue:config key:@"agreementAlertViewWidgets"]; + uiconfig.customAgreementAlertView = ^(UIView * _Nonnull superView, void (^ _Nonnull hidAlertView)(void)) { + weakSelf.hidAgreementAlertView = hidAlertView; + for (NSDictionary *widgetDic in agreementAlertViewWidgets) { + NSString *type = [self getValue:widgetDic key:@"type"]; + if ([type isEqualToString:@"textView"]) { + [superView addSubview:[self addCustomTextWidget:widgetDic]]; + }else if ([type isEqualToString:@"button"]){ + UIButton *cancle = [self addCustomButtonWidget:widgetDic]; + [superView addSubview:cancle]; + [cancle addTarget:weakSelf action:@selector(cancelAgreementAlertView) forControlEvents:UIControlEventTouchUpInside]; + }else{ + + } + } + }; + + NSDictionary *agreementAlertViewUIFrames = [self getValue:config key:@"agreementAlertViewUIFrames"]; + + uiconfig.resetAgreementAlertViewFrameBlock = ^(NSValue * _Nullable __autoreleasing * _Nullable superViewFrame, NSValue * _Nullable __autoreleasing * _Nullable alertViewFrame, NSValue * _Nullable __autoreleasing * _Nullable titleFrame, NSValue * _Nullable __autoreleasing * _Nullable contentFrame, NSValue * _Nullable __autoreleasing * _Nullable buttonFrame) { + NSArray *superView = [agreementAlertViewUIFrames valueForKey:@"superViewFrame"]; + if (superView && superView.count >= 4) { + *superViewFrame = [NSValue valueWithCGRect:CGRectMake([superView[0] intValue], [superView[1] intValue], [superView[2] intValue], [superView[3] intValue])]; + } + NSArray *alertView = [agreementAlertViewUIFrames valueForKey:@"alertViewFrame"]; + if (alertView && alertView.count >= 4) { + *alertViewFrame = [NSValue valueWithCGRect:CGRectMake([alertView[0] intValue], [alertView[1] intValue], [alertView[2] intValue], [alertView[3] intValue])]; + } + NSArray *title = [agreementAlertViewUIFrames valueForKey:@"titleFrame"]; + if (title && title.count >= 4) { + *titleFrame = [NSValue valueWithCGRect:CGRectMake([title[0] intValue], [title[1] intValue], [title[2] intValue], [title[3] intValue])]; + } + NSArray *content = [agreementAlertViewUIFrames valueForKey:@"contentFrame"]; + if (content && content.count >= 4) { + *contentFrame = [NSValue valueWithCGRect:CGRectMake([content[0] intValue], [content[1] intValue], [content[2] intValue], [content[3] intValue])]; + } + NSArray *button = [agreementAlertViewUIFrames valueForKey:@"buttonFrame"]; + if (button && button.count >= 4) { + *buttonFrame = [NSValue valueWithCGRect:CGRectMake([button[0] intValue], [button[1] intValue], [button[2] intValue], [button[3] intValue])]; + } + }; 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 +912,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 +964,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 +977,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 +990,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 +1000,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 +1009,44 @@ - (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; + /************** 协议二次弹窗样式***************/ + + NSInteger agreementAlertViewTitleTexSize = [[self getValue:config key:@"agreementAlertViewTitleTexSize"] integerValue]; + uiconfig.agreementAlertViewTitleTexFont = [UIFont systemFontOfSize:agreementAlertViewTitleTexSize]; + + NSNumber *agreementAlertViewTitleTextColorInt = [self getValue:config key:@"agreementAlertViewTitleTextColor"]; + if (agreementAlertViewTitleTextColorInt) { + UIColor *agreementAlertViewTitleTextColor = UIColorFromRGB([agreementAlertViewTitleTextColorInt integerValue]); + uiconfig.agreementAlertViewTitleTextColor = agreementAlertViewTitleTextColor; + } + + NSTextAlignment agreementAlertViewContentTextAlignment = [[self getValue:config key:@"agreementAlertViewContentTextAlignment"] integerValue]; + uiconfig.agreementAlertViewContentTextAlignment = NSTextAlignmentLeft; + + NSInteger agreementAlertViewContentTextFontSize = [[self getValue:config key:@"agreementAlertViewContentTextFontSize"] integerValue]; + uiconfig.agreementAlertViewContentTextFontSize = agreementAlertViewContentTextFontSize; + + + UIImage *agreementAlertViewLoginBtnNormalImage = [UIImage imageNamed:[config objectForKey:@"agreementAlertViewLoginBtnNormalImagePath"]] ? : [UIImage imageNamed:@"login_btn_normal"]; + UIImage *agreementAlertViewLoginBtnPressedImage = [UIImage imageNamed:[config objectForKey:@"agreementAlertViewLoginBtnPressedImagePath"]] ? : [UIImage imageNamed:@"login_btn_press"]; + UIImage *agreementAlertViewLoginBtnUnableImage = [UIImage imageNamed:[config objectForKey:@"agreementAlertViewLoginBtnUnableImagePath"]] ? : [UIImage imageNamed:@"login_btn_unable"]; + if(agreementAlertViewLoginBtnNormalImage && agreementAlertViewLoginBtnPressedImage && agreementAlertViewLoginBtnUnableImage){ + NSArray * agreementAlertViewLogBtnImgs =[[NSArray alloc]initWithObjects:agreementAlertViewLoginBtnNormalImage,agreementAlertViewLoginBtnPressedImage,agreementAlertViewLoginBtnUnableImage,nil]; + uiconfig.agreementAlertViewLogBtnImgs = agreementAlertViewLogBtnImgs; + } + + + NSNumber *agreementAlertViewLogBtnTextColorInt = [self getValue:config key:@"agreementAlertViewLogBtnTextColor"]; + if (agreementAlertViewLogBtnTextColorInt) { + UIColor *agreementAlertViewLogBtnTextColor = UIColorFromRGB([agreementAlertViewLogBtnTextColorInt integerValue]); + uiconfig.agreementAlertViewLogBtnTextColor = agreementAlertViewLogBtnTextColor; + } + /************** 窗口模式样式设置 ***************/ - NSDictionary *popViewConfig = [self getValue:config key:@"popViewConfig"]; if (popViewConfig) { NSNumber *isPopViewTheme = [self getValue:popViewConfig key:@""]; NSNumber *width = [self getValue:popViewConfig key:@"width"]; @@ -815,7 +1064,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]; @@ -827,6 +1081,443 @@ - (void)setCustomUIWithUIConfig:(JVUIConfig *)uiconfig configArguments:(NSDictio uiconfig.windowConstraints = @[windowConstraintX,windowConstraintY,windowConstraintW,windowConstraintH]; uiconfig.windowHorizontalConstraints = uiconfig.windowConstraints; } + + NSDictionary *smsUIConfig = [config valueForKey:@"smsUIConfig"]; + if (smsUIConfig && [smsUIConfig isKindOfClass:[NSDictionary class]]) { + [self setCustomSmsUIConfig:uiconfig smsUIConfigArguments:smsUIConfig]; + } +} + +- (void)setCustomSmsUIConfig:(JVUIConfig *)uiConfig smsUIConfigArguments:(NSDictionary *)smsUIConfig { + + NSString *smsAuthPageBackgroundImagePath = [self getValue:smsUIConfig key:@"smsAuthPageBackgroundImagePath"]; + if (smsAuthPageBackgroundImagePath) { + uiConfig.smsAuthPageBackgroundImage = [UIImage imageNamed:smsAuthPageBackgroundImagePath]; + } + + NSString *smsNavText = [self getValue:smsUIConfig key:@"smsNavText"]; + NSNumber *smsNavTextSize = [self getValue:smsUIConfig key:@"smsNavTextSize"]; + NSNumber *smsNavTextColor = [self getValue:smsUIConfig key:@"smsNavTextColor"]; + NSNumber *smsNavTextBold = [self getValue:smsUIConfig key:@"smsNavTextBold"]; + NSMutableDictionary *smsNavTextAttris = [NSMutableDictionary dictionary]; + if (smsNavTextColor) { + [smsNavTextAttris setValue:UIColorFromRGB([smsNavTextColor integerValue]) forKey:NSForegroundColorAttributeName]; + } + if (smsNavTextSize) { + if (smsNavTextBold) { + [smsNavTextAttris setValue:[UIFont boldSystemFontOfSize:[smsNavTextSize floatValue]] forKey:NSFontAttributeName]; + }else { + [smsNavTextAttris setValue:[UIFont systemFontOfSize:[smsNavTextSize floatValue]] forKey:NSFontAttributeName]; + } + + } + if (smsNavText) { + uiConfig.smsNavText = [[NSAttributedString alloc]initWithString:smsNavText attributes:nil];; + } + + // logo + NSNumber *smsLogoWidth = [self getValue:smsUIConfig key:@"smsLogoWidth"]; + NSNumber *smsLogoHeight = [self getValue:smsUIConfig key:@"smsLogoHeight"]; + NSNumber *smsLogoOffsetX = [self getValue:smsUIConfig key:@"smsLogoOffsetX"]; + NSNumber *smsLogoOffsetY = [self getValue:smsUIConfig key:@"smsLogoOffsetY"]; + NSNumber *smsLogoOffsetBottomY = [self getValue:smsUIConfig key:@"smsLogoOffsetBottomY"]; + NSNumber *isSmsLogoHidden = [self getValue:smsUIConfig key:@"isSmsLogoHidden"]; + NSString *smsLogoResName =[self getValue:smsUIConfig key:@"smsLogoResName"]; + if (isSmsLogoHidden) { + uiConfig.smsLogoHidden = [isSmsLogoHidden boolValue]; + } + if(smsLogoResName){ + uiConfig.smsLogoImg = [UIImage imageNamed:smsLogoResName]; + } + NSMutableArray *smsLogoAttris = [NSMutableArray array]; + if (smsLogoWidth){ + JVLayoutConstraint *sms_logo_cons_w = JVLayoutWidth([smsLogoWidth floatValue]); + [smsLogoAttris addObject:sms_logo_cons_w]; + } + if (smsLogoHeight) { + JVLayoutConstraint *sms_logo_cons_h = JVLayoutHeight([smsLogoHeight floatValue]); + [smsLogoAttris addObject:sms_logo_cons_h]; + } + if (smsLogoOffsetX) { + JVLayoutConstraint *sms_logo_cons_x = JVLayoutLeft([smsLogoOffsetX floatValue], JVLayoutItemSuper, NSLayoutAttributeLeft); + [smsLogoAttris addObject:sms_logo_cons_x]; + } + if (smsLogoOffsetY) { + JVLayoutConstraint *sms_logo_cons_y = JVLayoutTop([smsLogoOffsetY floatValue],JVLayoutItemSuper,NSLayoutAttributeTop); + [smsLogoAttris addObject:sms_logo_cons_y]; + } + if (smsLogoOffsetBottomY) { + JVLayoutConstraint *sms_logo_cons_b = JVLayoutBottom([smsLogoOffsetBottomY floatValue], JVLayoutItemSuper, NSLayoutAttributeBottom); + [smsLogoAttris addObject:sms_logo_cons_b]; + } + + uiConfig.smsLogoConstraints = smsLogoAttris; + uiConfig.smsLogoHorizontalConstraints = uiConfig.smsLogoConstraints; + + // slogan + NSNumber *smsSloganTextSize = [self getValue:smsUIConfig key:@"smsSloganTextSize"]; + NSNumber *smsSloganTextColor = [self getValue:smsUIConfig key:@"smsSloganTextColor"]; + NSNumber *smsSloganOffsetX = [self getValue:smsUIConfig key:@"smsSloganOffsetX"]; + NSNumber *smsSloganOffsetY = [self getValue:smsUIConfig key:@"smsSloganOffsetY"]; + NSNumber *smsSloganOffsetBottomY = [self getValue:smsUIConfig key:@"smsSloganOffsetBottomY"]; + NSNumber *smsSloganHeight = [self getValue:smsUIConfig key:@"smsSloganHeight"]; + NSNumber *smsSloganWidth = [self getValue:smsUIConfig key:@"smsSloganWidth"]; + if (smsSloganTextSize) { + uiConfig.smsSloganFont = [UIFont systemFontOfSize:[smsSloganTextSize floatValue]]; + } + if (smsSloganTextColor) { + uiConfig.smsSloganTextColor = UIColorFromRGB([smsSloganTextColor integerValue]); + } + NSMutableArray *smsSloganAttris = [NSMutableArray array]; + if (smsSloganOffsetX) { + JVLayoutConstraint *sms_slogan_cons_x = JVLayoutLeft([smsSloganOffsetX floatValue], JVLayoutItemSuper, NSLayoutAttributeLeft); + [smsSloganAttris addObject:sms_slogan_cons_x]; + } + if (smsSloganOffsetY) { + JVLayoutConstraint *sms_slogan_cons_y = JVLayoutTop([smsSloganOffsetY floatValue],JVLayoutItemSuper,NSLayoutAttributeTop); + [smsSloganAttris addObject:sms_slogan_cons_y]; + } + if (smsSloganOffsetBottomY) { + JVLayoutConstraint *sms_slogan_cons_b = JVLayoutBottom([smsSloganOffsetBottomY floatValue], JVLayoutItemSuper, NSLayoutAttributeBottom); + [smsSloganAttris addObject:sms_slogan_cons_b]; + } + if (smsSloganWidth) { + JVLayoutConstraint *sms_slogan_cons_w = JVLayoutWidth([smsSloganWidth floatValue]); + [smsSloganAttris addObject:sms_slogan_cons_w]; + } + if (smsSloganHeight) { + JVLayoutConstraint *sms_slogan_cons_h = JVLayoutHeight([smsSloganHeight floatValue]); + [smsSloganAttris addObject:sms_slogan_cons_h]; + } + uiConfig.smsSloganConstraints = smsSloganAttris; + uiConfig.smsSloganHorizontalConstraints = uiConfig.smsSloganConstraints; + + + // SMS号码输入框设置 + NSNumber *smsPhoneInputViewOffsetX = [self getValue:smsUIConfig key:@"smsPhoneInputViewOffsetX"]; + NSNumber *smsPhoneInputViewOffsetY = [self getValue:smsUIConfig key:@"smsPhoneInputViewOffsetY"]; + NSNumber *smsPhoneInputViewWidth = [self getValue:smsUIConfig key:@"smsPhoneInputViewWidth"]; + NSNumber *smsPhoneInputViewHeight = [self getValue:smsUIConfig key:@"smsPhoneInputViewHeight"]; + NSNumber *smsPhoneInputViewTextColor = [self getValue:smsUIConfig key:@"smsPhoneInputViewTextColor"]; + NSNumber *smsPhoneInputViewTextSize = [self getValue:smsUIConfig key:@"smsPhoneInputViewTextSize"]; + NSString *smsPhoneInputViewPlaceholderText = [self getValue:smsUIConfig key:@"smsPhoneInputViewPlaceholderText"]; + NSString *smsPhoneInputViewBorderStyle = [self getValue:smsUIConfig key:@"smsPhoneInputViewBorderStyle"]; + if (smsPhoneInputViewTextColor) { + uiConfig.smsNumberTFColor = UIColorFromRGB([smsPhoneInputViewTextColor integerValue]); + } + if (smsPhoneInputViewTextSize) { + uiConfig.smsNumberTFFont = [UIFont systemFontOfSize:[smsPhoneInputViewTextSize floatValue]]; + } + if (smsPhoneInputViewPlaceholderText) { + uiConfig.smsNumberTFPlaceholder = smsPhoneInputViewPlaceholderText; + } + if (smsPhoneInputViewBorderStyle) { + uiConfig.smsNumberTFBorderStyle = [self getTFBorderStyleStyle:smsPhoneInputViewBorderStyle]; + } + NSMutableArray *smsPhoneInputViewAttris = [NSMutableArray array]; + if (smsPhoneInputViewOffsetX) { + JVLayoutConstraint *sms_phoneInputView_cons_x = JVLayoutLeft([smsPhoneInputViewOffsetX floatValue], JVLayoutItemSuper, NSLayoutAttributeLeft); + [smsPhoneInputViewAttris addObject:sms_phoneInputView_cons_x]; + } + if (smsPhoneInputViewOffsetY) { + JVLayoutConstraint *sms_phoneInputView_cons_y = JVLayoutTop([smsPhoneInputViewOffsetY floatValue],JVLayoutItemSuper,NSLayoutAttributeTop); + [smsPhoneInputViewAttris addObject:sms_phoneInputView_cons_y]; + } + if (smsPhoneInputViewWidth) { + JVLayoutConstraint *sms_phoneInputView_cons_w = JVLayoutWidth([smsPhoneInputViewWidth floatValue]); + [smsPhoneInputViewAttris addObject:sms_phoneInputView_cons_w]; + } + if (smsPhoneInputViewHeight) { + JVLayoutConstraint *sms_phoneInputView_cons_h = JVLayoutHeight([smsPhoneInputViewHeight floatValue]); + [smsPhoneInputViewAttris addObject:sms_phoneInputView_cons_h]; + } + + uiConfig.smsNumberTFConstraints = smsPhoneInputViewAttris; + uiConfig.smsNumberTFHorizontalConstraints = uiConfig.smsNumberTFConstraints; + + + // SMS验证码输入框设置 + NSNumber *smsVerifyCodeEditTextViewOffsetX = [self getValue:smsUIConfig key:@"smsVerifyCodeEditTextViewOffsetX"]; + NSNumber *smsVerifyCodeEditTextViewOffsetY = [self getValue:smsUIConfig key:@"smsVerifyCodeEditTextViewOffsetY"]; + NSNumber *smsVerifyCodeEditTextViewOffsetR = [self getValue:smsUIConfig key:@"smsVerifyCodeEditTextViewOffsetR"]; + NSNumber *smsVerifyCodeEditTextViewWidth = [self getValue:smsUIConfig key:@"smsVerifyCodeEditTextViewWidth"]; + NSNumber *smsVerifyCodeEditTextViewHeight = [self getValue:smsUIConfig key:@"smsVerifyCodeEditTextViewHeight"]; + NSNumber *smsVerifyCodeEditTextViewTextColor = [self getValue:smsUIConfig key:@"smsVerifyCodeEditTextViewTextColor"]; + NSNumber *smsVerifyCodeEditTextViewTextSize = [self getValue:smsUIConfig key:@"smsVerifyCodeEditTextViewTextSize"]; + NSString *smsVerifyCodeEditTextViewPlaceholderText = [self getValue:smsUIConfig key:@"smsVerifyCodeEditTextViewPlaceholderText"]; + NSString *smsVerifyCodeEditTextViewBorderStyle = [self getValue:smsUIConfig key:@"smsVerifyCodeEditTextViewBorderStyle"]; + if (smsVerifyCodeEditTextViewTextColor) { + uiConfig.smsCodeTFColor = UIColorFromRGB([smsVerifyCodeEditTextViewTextColor integerValue]); + } + if (smsVerifyCodeEditTextViewTextSize) { + uiConfig.smsCodeTFFont = [UIFont systemFontOfSize:[smsVerifyCodeEditTextViewTextSize floatValue]]; + } + if (smsVerifyCodeEditTextViewPlaceholderText) { + uiConfig.smsCodeTFPlaceholder = smsVerifyCodeEditTextViewPlaceholderText; + } + if (smsVerifyCodeEditTextViewBorderStyle) { + uiConfig.smsCodeTFBorderStyle = [self getTFBorderStyleStyle:smsVerifyCodeEditTextViewBorderStyle]; + } + NSMutableArray *smsVerifyCodeEditTextViewAttris = [NSMutableArray array]; + if (smsVerifyCodeEditTextViewOffsetX) { + JVLayoutConstraint *sms_verifyCodeEditTextView_cons_x = JVLayoutLeft([smsVerifyCodeEditTextViewOffsetX floatValue], JVLayoutItemSuper, NSLayoutAttributeLeft); + [smsVerifyCodeEditTextViewAttris addObject:sms_verifyCodeEditTextView_cons_x]; + } + if (smsVerifyCodeEditTextViewOffsetY) { + JVLayoutConstraint *sms_verifyCodeEditTextView_cons_y = JVLayoutTop([smsVerifyCodeEditTextViewOffsetY floatValue],JVLayoutItemSuper,NSLayoutAttributeTop); + [smsVerifyCodeEditTextViewAttris addObject:sms_verifyCodeEditTextView_cons_y]; + } + if (smsVerifyCodeEditTextViewOffsetR) { + JVLayoutConstraint *sms_verifyCodeEditTextView_cons_R = JVLayoutRight([smsVerifyCodeEditTextViewOffsetR floatValue],JVLayoutItemSuper,NSLayoutAttributeRight); + [smsVerifyCodeEditTextViewAttris addObject:sms_verifyCodeEditTextView_cons_R]; + } + if (smsVerifyCodeEditTextViewWidth) { + JVLayoutConstraint *w = JVLayoutWidth([smsVerifyCodeEditTextViewWidth floatValue]); + [smsVerifyCodeEditTextViewAttris addObject:w]; + } + if (smsVerifyCodeEditTextViewHeight) { + JVLayoutConstraint *h = JVLayoutHeight([smsVerifyCodeEditTextViewHeight floatValue]); + [smsVerifyCodeEditTextViewAttris addObject:h]; + } + uiConfig.smsCodeTFConstraints = smsVerifyCodeEditTextViewAttris; + uiConfig.smsCodeTFHorizontalConstraints = uiConfig.smsCodeTFConstraints; + + // SMS获取验证码按钮 + NSNumber *smsGetVerifyCodeTextViewOffsetX = [self getValue:smsUIConfig key:@"smsGetVerifyCodeTextViewOffsetX"]; + NSNumber *smsGetVerifyCodeTextViewOffsetY = [self getValue:smsUIConfig key:@"smsGetVerifyCodeTextViewOffsetY"]; + NSNumber *smsGetVerifyCodeTextViewOffsetR = [self getValue:smsUIConfig key:@"smsGetVerifyCodeTextViewOffsetR"]; + NSNumber *smsGetVerifyCodeBtnWidth = [self getValue:smsUIConfig key:@"smsGetVerifyCodeBtnWidth"]; + NSNumber *smsGetVerifyCodeBtnHeight = [self getValue:smsUIConfig key:@"smsGetVerifyCodeBtnHeight"]; + NSNumber *smsGetVerifyCodeTextViewTextColor = [self getValue:smsUIConfig key:@"smsGetVerifyCodeTextViewTextColor"]; + NSNumber *smsGetVerifyCodeTextViewTextSize = [self getValue:smsUIConfig key:@"smsGetVerifyCodeTextViewTextSize"]; + NSString *smsGetVerifyCodeBtnText = [self getValue:smsUIConfig key:@"smsGetVerifyCodeBtnText"]; + NSString *smsGetVerifyCodeBtnBackgroundPath = [self getValue:smsUIConfig key:@"smsGetVerifyCodeBtnBackgroundPaths"]; + NSArray *smsGetVerifyCodeBtnBackgroundPaths = [self getValue:smsUIConfig key:@"smsGetVerifyCodeBtnBackgroundPaths"]; + NSNumber *smsGetVerifyCodeBtnCornerRadius = [self getValue:smsUIConfig key:@"smsGetVerifyCodeBtnCornerRadius"]; + if (smsGetVerifyCodeBtnText) { + NSMutableDictionary *smsGetVerifyCodeTextViewAttr = [NSMutableDictionary dictionary]; + if (smsGetVerifyCodeTextViewTextColor) { + [smsGetVerifyCodeTextViewAttr setValue:UIColorFromRGB([smsGetVerifyCodeTextViewTextColor integerValue]) forKey:NSForegroundColorAttributeName]; + } + if (smsGetVerifyCodeTextViewTextSize) { + [smsGetVerifyCodeTextViewAttr setValue:[UIFont systemFontOfSize:[smsGetVerifyCodeTextViewTextSize floatValue]] forKey:NSFontAttributeName]; + } + uiConfig.smsGetCodeBtnAttributedString = [[NSAttributedString alloc] initWithString:smsGetVerifyCodeBtnText attributes:smsGetVerifyCodeTextViewAttr]; + } + if (smsGetVerifyCodeBtnBackgroundPaths) { + UIImage *img = [UIImage imageNamed:smsGetVerifyCodeBtnBackgroundPaths[0]]; + UIImage *img1 = [UIImage imageNamed:smsGetVerifyCodeBtnBackgroundPaths[1]]; + UIImage *img2 = [UIImage imageNamed:smsGetVerifyCodeBtnBackgroundPaths[2]]; + uiConfig.smsGetCodeBtnImgs = @[img, img1, img2]; + }else if (smsGetVerifyCodeBtnBackgroundPath) { + UIImage *img = [UIImage imageNamed:smsGetVerifyCodeBtnBackgroundPath]; + uiConfig.smsGetCodeBtnImgs = @[img,img,img]; + } + if (smsGetVerifyCodeBtnCornerRadius) { + uiConfig.smsGetCodeBtnCornerRadius = [smsGetVerifyCodeBtnCornerRadius floatValue]; + } + NSMutableArray *smsGetVerifyCodeBtnAttris = [NSMutableArray array]; + if (smsGetVerifyCodeTextViewOffsetX) { + JVLayoutConstraint *sms_getVerifyCodeBtn_cons_x = JVLayoutLeft([smsGetVerifyCodeTextViewOffsetX floatValue], JVLayoutItemSuper, NSLayoutAttributeLeft); + [smsGetVerifyCodeBtnAttris addObject:sms_getVerifyCodeBtn_cons_x]; + } + if (smsGetVerifyCodeTextViewOffsetY) { + JVLayoutConstraint *sms_getVerifyCodeBtn_cons_y = JVLayoutTop([smsGetVerifyCodeTextViewOffsetY floatValue],JVLayoutItemSuper,NSLayoutAttributeTop); + [smsGetVerifyCodeBtnAttris addObject:sms_getVerifyCodeBtn_cons_y]; + } + if (smsGetVerifyCodeTextViewOffsetR) { + JVLayoutConstraint *sms_getVerifyCodeBtn_cons_R = JVLayoutRight([smsGetVerifyCodeTextViewOffsetR floatValue],JVLayoutItemSuper,NSLayoutAttributeRight); + [smsGetVerifyCodeBtnAttris addObject:sms_getVerifyCodeBtn_cons_R]; + } + if (smsGetVerifyCodeBtnWidth) { + JVLayoutConstraint *sms_getVerifyCodeBtn_cons_W = JVLayoutWidth([smsGetVerifyCodeBtnWidth floatValue]); + [smsGetVerifyCodeBtnAttris addObject:sms_getVerifyCodeBtn_cons_W]; + } + if (smsGetVerifyCodeBtnHeight) { + JVLayoutConstraint *sms_getVerifyCodeBtn_cons_H = JVLayoutHeight([smsGetVerifyCodeBtnHeight floatValue]); + [smsGetVerifyCodeBtnAttris addObject:sms_getVerifyCodeBtn_cons_H]; + } + uiConfig.smsGetCodeBtnConstraints = smsGetVerifyCodeBtnAttris; + uiConfig.smsGetCodeBtnHorizontalConstraints = uiConfig.smsCodeTFConstraints; + + + // SMS登录按钮 + NSNumber *smsLogBtnOffsetX = [self getValue:smsUIConfig key:@"smsLogBtnOffsetX"]; + NSNumber *smsLogBtnOffsetY = [self getValue:smsUIConfig key:@"smsLogBtnOffsetY"]; + NSNumber *smsLogBtnBottomOffsetY = [self getValue:smsUIConfig key:@"smsLogBtnBottomOffsetY"]; + NSNumber *smsLogBtnWidth = [self getValue:smsUIConfig key:@"smsLogBtnWidth"]; + NSNumber *smsLogBtnHeight = [self getValue:smsUIConfig key:@"smsLogBtnHeight"]; + NSNumber *smsLogBtnTextColor = [self getValue:smsUIConfig key:@"smsLogBtnTextColor"]; + NSNumber *smsLogBtnTextSize = [self getValue:smsUIConfig key:@"smsLogBtnTextSize"]; + NSString *smsLogBtnText = [self getValue:smsUIConfig key:@"smsLogBtnText"]; + NSNumber *isSmsLogBtnTextBold = [self getValue:smsUIConfig key:@"isSmsLogBtnTextBold"]; + NSString *smsLogBtnBackgroundPath = [self getValue:smsUIConfig key:@"smsLogBtnBackgroundPath"]; + NSArray *smsLogBtnBackgroundPaths = [self getValue:smsUIConfig key:@"smsLogBtnBackgroundPaths"]; + if (smsLogBtnText) { + NSMutableDictionary *smsLogBtnAttr = [NSMutableDictionary dictionary]; + if (smsLogBtnTextColor) { + [smsLogBtnAttr setValue:UIColorFromRGB([smsLogBtnTextColor integerValue]) forKey:NSForegroundColorAttributeName]; + } + if (smsLogBtnTextSize) { + UIFont *font; + if (!isSmsLogBtnTextBold || (isSmsLogBtnTextBold && [isSmsLogBtnTextBold boolValue] == NO)) { + font = [UIFont systemFontOfSize:[smsLogBtnTextSize floatValue]]; + }else { + font = [UIFont boldSystemFontOfSize:[smsLogBtnTextSize floatValue]]; + } + [smsLogBtnAttr setValue:font forKey:NSFontAttributeName]; + } + uiConfig.smsLogBtnAttributedString = [[NSAttributedString alloc] initWithString:smsLogBtnText attributes:smsLogBtnAttr]; + } + if (smsLogBtnBackgroundPaths) { + UIImage *img = [UIImage imageNamed:smsLogBtnBackgroundPaths[0]]; + UIImage *img1 = [UIImage imageNamed:smsLogBtnBackgroundPaths[1]]; + UIImage *img2 = [UIImage imageNamed:smsLogBtnBackgroundPaths[2]]; + uiConfig.smsLogBtnImgs = @[img, img1, img2]; + }else if (smsLogBtnBackgroundPath) { + UIImage *img = [UIImage imageNamed:smsLogBtnBackgroundPath]; + uiConfig.smsLogBtnImgs = @[img,img,img]; + } + + NSMutableArray *smsLogBtnConstraints = [NSMutableArray array]; + if (smsLogBtnOffsetX) { + JVLayoutConstraint *sms_logBtn_cons_x = JVLayoutLeft([smsLogBtnOffsetX floatValue], JVLayoutItemSuper, NSLayoutAttributeLeft); + [smsLogBtnConstraints addObject:sms_logBtn_cons_x]; + } + if (smsLogBtnOffsetY) { + JVLayoutConstraint *sms_logBtn_cons_y = JVLayoutTop([smsLogBtnOffsetY floatValue],JVLayoutItemSuper,NSLayoutAttributeTop); + [smsLogBtnConstraints addObject:sms_logBtn_cons_y]; + } + if (smsLogBtnBottomOffsetY) { + JVLayoutConstraint *sms_logBtn_cons_B = JVLayoutBottom([smsLogBtnBottomOffsetY floatValue],JVLayoutItemSuper,NSLayoutAttributeBottom); + [smsLogBtnConstraints addObject:sms_logBtn_cons_B]; + } + if (smsLogBtnWidth) { + JVLayoutConstraint *sms_logBtn_cons_W = JVLayoutWidth([smsLogBtnWidth floatValue]); + [smsLogBtnConstraints addObject:sms_logBtn_cons_W]; + } + if (smsLogBtnWidth) { + JVLayoutConstraint *sms_logBtn_cons_H = JVLayoutHeight([smsLogBtnHeight floatValue]); + [smsLogBtnConstraints addObject:sms_logBtn_cons_H]; + } + uiConfig.smsLogBtnConstraints = smsLogBtnConstraints; + uiConfig.smsLogBtnHorizontalConstraints = uiConfig.smsCodeTFConstraints; + + + // SMS隐私条款 + NSArray *smsPrivacyColor = [self getValue:smsUIConfig key:@"smsPrivacyColor"]; + NSNumber *smsPrivacyTextVerAlignment = [self getValue:smsUIConfig key:@"smsPrivacyTextVerAlignment"]; + NSNumber *isSmsPrivacyTextGravityCenter = [self getValue:smsUIConfig key:@"isSmsPrivacyTextGravityCenter"]; + NSString *smsPrivacyCheckboxCheckedImgPath = [self getValue:smsUIConfig key:@"smsPrivacyCheckboxCheckedImgPath"]; + NSString *smsPrivacyCheckboxUncheckedImgPath = [self getValue:smsUIConfig key:@"smsPrivacyCheckboxUncheckedImgPath"]; + NSNumber *smsPrivacyCheckboxState = [self getValue:smsUIConfig key:@"smsPrivacyCheckboxState"]; + NSNumber *smsPrivacyCheckboxSize = [self getValue:smsUIConfig key:@"smsPrivacyCheckboxSize"]; + NSNumber *isSmsPrivacyCheckboxInCenter = [self getValue:smsUIConfig key:@"isSmsPrivacyCheckboxInCenter"]; + NSNumber *smsPrivacyCheckboxOffsetX = [self getValue:smsUIConfig key:@"smsPrivacyCheckboxOffsetX"]; + NSNumber *smsPrivacyOffsetX = [self getValue:smsUIConfig key:@"smsPrivacyOffsetX"]; + NSNumber *smsPrivacyOffsetY = [self getValue:smsUIConfig key:@"smsPrivacyOffsetY"]; + NSNumber *smsPrivacyTopOffsetY = [self getValue:smsUIConfig key:@"smsPrivacyTopOffsetY"]; + NSNumber *smsPrivacyWidth = [self getValue:smsUIConfig key:@"smsPrivacyWidth"]; + NSNumber *smsPrivacyHeight = [self getValue:smsUIConfig key:@"smsPrivacyHeight"]; + if (smsPrivacyColor) { + uiConfig.smsAppPrivacyColor = @[UIColorFromRGB([smsPrivacyColor[0] integerValue]), UIColorFromRGB([smsPrivacyColor[1] integerValue])]; + } + if (smsPrivacyTextVerAlignment) { + uiConfig.smsTextVerAlignment = [smsPrivacyTextVerAlignment integerValue]; + } + if (smsPrivacyCheckboxCheckedImgPath) { + uiConfig.smsCheckedImg = [UIImage imageNamed:smsPrivacyCheckboxCheckedImgPath]; + } + if (smsPrivacyCheckboxUncheckedImgPath) { + uiConfig.smsUncheckedImg = [UIImage imageNamed:smsPrivacyCheckboxUncheckedImgPath]; + } + if (smsPrivacyCheckboxState) { + uiConfig.smsPrivacyState = [smsPrivacyCheckboxState boolValue]; + } + if (isSmsPrivacyTextGravityCenter) { + uiConfig.smsPrivacyTextAlignment = [isSmsPrivacyTextGravityCenter boolValue]? NSTextAlignmentCenter : NSTextAlignmentLeft; + } + NSMutableArray *smsPrivacyConstraints = [NSMutableArray array]; + if (smsPrivacyOffsetX) { + JVLayoutConstraint *sms_privacy_cons_x = JVLayoutLeft([smsPrivacyOffsetX floatValue], JVLayoutItemSuper, NSLayoutAttributeLeft); + [smsPrivacyConstraints addObject:sms_privacy_cons_x]; + } + if (smsPrivacyOffsetY) { + JVLayoutConstraint *sms_privacy_cons_b = JVLayoutBottom([smsPrivacyOffsetY floatValue], JVLayoutItemSuper, NSLayoutAttributeBottom); + [smsPrivacyConstraints addObject:sms_privacy_cons_b]; + } + if (smsPrivacyTopOffsetY) { + JVLayoutConstraint *sms_privacy_cons_y = JVLayoutBottom([smsPrivacyTopOffsetY floatValue], JVLayoutItemSuper, NSLayoutAttributeBottom); + [smsPrivacyConstraints addObject:sms_privacy_cons_y]; + } + if (smsPrivacyWidth) { + JVLayoutConstraint *sms_privacy_cons_w = JVLayoutWidth([smsPrivacyWidth floatValue]); + [smsPrivacyConstraints addObject:sms_privacy_cons_w]; + } + if (smsPrivacyHeight) { + JVLayoutConstraint *sms_privacy_cons_h = JVLayoutHeight([smsPrivacyHeight floatValue]); + [smsPrivacyConstraints addObject:sms_privacy_cons_h]; + } + uiConfig.smsPrivacyConstraints = smsPrivacyConstraints; + uiConfig.smsPrivacyHorizontalConstraints = uiConfig.smsPrivacyConstraints; + + + NSMutableArray *smsPrivacyCheckboxSizeAttris = [NSMutableArray array]; + if (smsPrivacyCheckboxSize) { + JVLayoutConstraint *w = JVLayoutWidth([smsPrivacyCheckboxSize floatValue]); + JVLayoutConstraint *h = JVLayoutHeight([smsPrivacyCheckboxSize floatValue]); + [smsPrivacyCheckboxSizeAttris addObject:w]; + [smsPrivacyCheckboxSizeAttris addObject:h]; + } + if ([isSmsPrivacyCheckboxInCenter boolValue]) { + JVLayoutConstraint *centerY = JVLayoutCenterY(0, JVLayoutItemPrivacy); + [smsPrivacyCheckboxSizeAttris addObject:centerY]; + }else { + JVLayoutConstraint *top = JVLayoutTop(0, JVLayoutItemPrivacy, NSLayoutAttributeTop); + [smsPrivacyCheckboxSizeAttris addObject:top]; + } + if (smsPrivacyCheckboxOffsetX) { + JVLayoutConstraint *x = JVLayoutLeft([smsPrivacyCheckboxOffsetX floatValue], JVLayoutItemSuper, NSLayoutAttributeLeft); + [smsPrivacyCheckboxSizeAttris addObject:x]; + } + + uiConfig.smsCheckViewConstraints = smsPrivacyCheckboxSizeAttris; + + NSMutableArray *smsAppPrivacys = [NSMutableArray array]; + NSString *smsPrivacyClauseStart = [self getValue:smsUIConfig key:@"smsPrivacyClauseStart"]; + [smsAppPrivacys addObject:smsPrivacyClauseStart ?: @""]; + if([[smsUIConfig allKeys] containsObject:@"smsPrivacyBeanList"] && [[smsUIConfig objectForKey:@"smsPrivacyBeanList"] isKindOfClass:[NSString class]]){ + NSString *privacyJson = [smsUIConfig objectForKey:@"smsPrivacyBeanList"]; + NSData *privacyData = [privacyJson dataUsingEncoding:NSUTF8StringEncoding]; + NSArray *privacys= [NSJSONSerialization JSONObjectWithData:privacyData options:0 error:nil]; + for (NSInteger i = 0; i= 4.6.2' + s.dependency 'JVerification', '3.2.1' + s.ios.deployment_target = '11.0' s.static_framework = true end diff --git a/jverify.iml b/jverify.iml index cbba9f9..56f7843 100644 --- a/jverify.iml +++ b/jverify.iml @@ -104,9 +104,9 @@ - - - + + + diff --git a/lib/jverify.dart b/lib/jverify.dart index 0403397..c4a2eab 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'; @@ -21,6 +22,18 @@ typedef JVAuthPageEventListener = void Function(JVAuthPageEvent event); * */ typedef JVLoginAuthCallBackListener = void Function(JVListenerEvent event); +/** + * 短信登录接口的回调监听 + * + * @param event + * code :返回码,6000 代表loginToken获取成功,6001 代表loginToken获取失败,其他返回码详见描述 + * message :返回码的解释信息,若获取成功,内容信息代表loginToken。 + * phone :手机号 + * + * @discussion 调用 smsAuth 接口后,可以通过添加此监听事件来监听接口的返回结果 + * */ +typedef JVSMSListener = void Function(JVSMSEvent event); + /** * SDK 初始接口回调监听 * @@ -44,6 +57,12 @@ class JVEventHandlers { List authPageEvents = []; List loginAuthCallBackEvents = []; JVSDKSetupCallBackListener? sdkSetupCallBackListener; + + int loginAuthIndex = 0; + int smsAuthIndex = 0; + Map authPageEventsMap = {}; + Map loginAuthCallBackEventsMap = {}; + Map smsCallBackEventsMap = {}; } class Jverify { @@ -80,7 +99,7 @@ class Jverify { _eventHanders.authPageEvents.add(callback); } - /// loginAuth 接口回调的监听 + /// loginAuth 接口回调的监听 (旧,用于配合旧版loginAuthSyncApi使用) addLoginAuthCallBackListener(JVLoginAuthCallBackListener callback) { _eventHanders.loginAuthCallBackEvents.add(callback); } @@ -106,24 +125,55 @@ class Jverify { break; case 'onReceiveAuthPageEvent': { + Map json = call.arguments.cast(); + JVAuthPageEvent ev = JVAuthPageEvent.fromJson(json); + int index = json["loginAuthIndex"]; + for (JVAuthPageEventListener cb in _eventHanders.authPageEvents) { - Map json = call.arguments.cast(); - JVAuthPageEvent ev = JVAuthPageEvent.fromJson(json); cb(ev); } + + if (_eventHanders.authPageEventsMap.containsKey(index)) { + _eventHanders.authPageEventsMap[index]!(ev); + } } break; case 'onReceiveLoginAuthCallBackEvent': { + Map json = call.arguments.cast(); + print(json.toString()); + + JVListenerEvent event = JVListenerEvent.fromJson(json); + if (json["loginAuthIndex"] != null) { + int index = json["loginAuthIndex"]; + if (_eventHanders.loginAuthCallBackEventsMap.containsKey(index)) { + _eventHanders.loginAuthCallBackEventsMap[index]!(event); + _eventHanders.loginAuthCallBackEventsMap.remove(index); + } + } + + //老版本callback for (JVLoginAuthCallBackListener cb in _eventHanders.loginAuthCallBackEvents) { - Map json = call.arguments.cast(); - JVListenerEvent event = JVListenerEvent.fromJson(json); cb(event); _eventHanders.loginAuthCallBackEvents.remove(cb); } } break; + case 'onReceiveSMSAuthCallBackEvent': + { + Map json = call.arguments.cast(); + print(json.toString()); + JVSMSEvent event = JVSMSEvent.fromJson(json); + if (json["smsAuthIndex"] != null) { + int index = json["smsAuthIndex"]; + if (_eventHanders.smsCallBackEventsMap.containsKey(index)) { + _eventHanders.smsCallBackEventsMap[index]!(event); + _eventHanders.smsCallBackEventsMap.remove(index); + } + } + } + break; case 'onReceiveSDKSetupCallBackEvent': { if (_eventHanders.sdkSetupCallBackListener != null) { @@ -180,6 +230,12 @@ class Jverify { _channel.invokeMethod("setDebugMode", {"debug": debug}); } + /// 合规采集开关 + void setCollectionAuth(bool auth) { + print("$flutter_log" + "setCollectionAuth"); + _channel.invokeMethod("setCollectionAuth", {"auth": auth}); + } + ///设置前后两次获取验证码的时间间隔,默认 30000ms,有效范围(0,300000) void setGetCodeInternal(int intervalTime) { print("$flutter_log" + "setGetCodeInternal"); @@ -342,7 +398,7 @@ class Jverify { } /* - * SDK请求授权一键登录(同步接口) + * SDK请求授权一键登录(同步接口)(旧) * * @param autoDismiss 设置登录完成后是否自动关闭授权页 * @param timeout 设置超时时间,单位毫秒。 合法范围(0,30000],范围以外默认设置为10000 @@ -367,6 +423,87 @@ class Jverify { } } + /* + * SDK请求授权一键登录(同步接口) + * + * @param autoDismiss 设置登录完成后是否自动关闭授权页 + * @param timeout 设置超时时间,单位毫秒。 合法范围(0,30000],范围以外默认设置为10000 + * @param enableSms 是否开启短信登录切换服务,开启时在授权登录失败时拉起短信登录页面,默认为false + * + * 接口回调返回数据监听:通过添加 JVLoginAuthCallBackListener 监听,来监听接口的返回结果 + * + * 授权页面点击事件监听:通过添加 JVAuthPageEventListener 监听,来监听授权页点击事件 + * + * */ + void loginAuthSyncApi2( + {required bool autoDismiss, + int timeout = 10000, + bool enableSms = false, + JVLoginAuthCallBackListener? loginAuthcallback, + JVAuthPageEventListener? pageEventCallback}) { + print("$flutter_log" + "loginAuthSyncApi"); + + String method = "loginAuthSyncApi"; + var repeatError = isRepeatRequest(method: method); + if (repeatError == null) { + _eventHanders.loginAuthIndex++; + var map = { + "autoDismiss": autoDismiss, + "timeout": timeout, + "enableSms": enableSms, + "loginAuthIndex": _eventHanders.loginAuthIndex + }; + if (loginAuthcallback != null) { + _eventHanders.loginAuthCallBackEventsMap[_eventHanders.loginAuthIndex] = + loginAuthcallback; + } + if (pageEventCallback != null) { + _eventHanders.authPageEventsMap[_eventHanders.loginAuthIndex] = + pageEventCallback; + } + _channel.invokeMethod(method, map); + requestQueue.remove(method); + } else { + print("$flutter_log" + repeatError.toString()); + } + } + + /* + * 短信登录 + * + * @param autoDismiss 设置登录完成后是否自动关闭授权页 + * @param timeout 设置超时时间,单位毫秒。 合法范围(0,10000],若小于等于 0 则取默认值 5000. 大于 10000 则取 10000 + * + * 接口回调返回数据监听:通过添加 JVSMSListener 监听,来监听接口的返回结果 + * + * + * */ + void smsAuth( + {required bool autoDismiss, + int timeout = 5000, + JVSMSListener? smsCallback}) { + print("$flutter_log" + "smsAuth"); + + String method = "smsAuth"; + var repeatError = isRepeatRequest(method: method); + if (repeatError == null) { + _eventHanders.smsAuthIndex++; + var map = { + "autoDismiss": autoDismiss, + "timeout": timeout, + "smsAuthIndex": _eventHanders.smsAuthIndex + }; + if (smsCallback != null) { + _eventHanders.smsCallBackEventsMap[_eventHanders.smsAuthIndex] = + smsCallback; + } + _channel.invokeMethod(method, map); + requestQueue.remove(method); + } else { + print("$flutter_log" + repeatError.toString()); + } + } + /* * 关闭授权页面 * */ @@ -457,6 +594,8 @@ class JVUIConfig { /// 授权页背景图片 String? authBackgroundImage; String? authBGGifPath; // 授权界面gif图片 only android + String? authBGVideoPath; // 授权界面video + String? authBGVideoImgPath; // 授权界面video的第一频图片 /// 导航栏 int? navColor; @@ -466,12 +605,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 +620,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 +676,20 @@ 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; //设置隐私条款文字字体是否加下划线 + bool? isAlertPrivacyVc; //是否在未勾选隐私协议的情况下 弹窗提示窗口 /// 隐私协议 web 页 UI 配置 int? privacyNavColor; // 导航栏颜色 int? privacyNavTitleTextColor; // 标题颜色 int? privacyNavTitleTextSize; // 标题大小 + bool? privacyNavTitleTextBold; // 标题字体加粗 String? privacyNavTitleTitle; //协议0 web页面导航栏标题 only ios String? privacyNavTitleTitle1; // 协议1 web页面导航栏标题 String? privacyNavTitleTitle2; // 协议2 web页面导航栏标题 @@ -569,16 +722,53 @@ class JVUIConfig { /// 授权页弹窗模式 配置,选填 JVPopViewConfig? popViewConfig; + /// Android协议二次弹窗配置,选填 + JVPrivacyCheckDialogConfig? privacyCheckDialogConfig; + JVIOSUIModalTransitionStyle modelTransitionStyle = //弹出方式 only ios JVIOSUIModalTransitionStyle.CoverVertical; + /// 协议二次弹窗-iOS + int agreementAlertViewTitleTexSize = 14; // 协议二次弹窗标题文本样式 + int? agreementAlertViewTitleTextColor; //协议二次弹窗标题文本颜色 + JVTextAlignmentType agreementAlertViewContentTextAlignment = + JVTextAlignmentType.center; //协议二次弹窗内容文本对齐方式 + int agreementAlertViewContentTextFontSize = 12; //协议二次弹窗内容文本字体大小 + String? agreementAlertViewLoginBtnNormalImagePath; // 协议二次弹窗登录按钮背景图片 - 激活状态的图片 + String? + agreementAlertViewLoginBtnPressedImagePath; // 协议二次弹窗登录按钮背景图片 - 高亮状态的图片 + String? agreementAlertViewLoginBtnUnableImagePath; //协议二次弹窗登录按钮背景图片 - 失效状态的图片 + int? agreementAlertViewLogBtnTextColor; //协议二次弹窗登录按钮文本颜色 + List? agreementAlertViewWidgets; //协议二次弹窗自定义视图 + Map>? + agreementAlertViewUIFrames; // 协议二次弹窗各控件的frame设置 { "superViewFrame": [left, top, width, height],"alertViewFrame": [left, top, width, height],"titleFrame": [left, top, width, height],"contentFrame": [left, top, width, height],"buttonFrame": [left, top, width, height]}; + + bool setIsPrivacyViewDarkMode = true; //协议页面是否支持暗黑模式 + + /// sms UI + JVSMSUIConfig? smsUIConfig; + Map toJsonMap() { + var agreementAlertViewWidgetsList = []; + + if (agreementAlertViewWidgets != null) { + for (JVCustomWidget widget in agreementAlertViewWidgets!) { + var para2 = widget.toJsonMap(); + para2.removeWhere((key, value) => value == null); + agreementAlertViewWidgetsList.add(para2); + } + } + 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 +778,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 +810,13 @@ 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, + "isAlertPrivacyVc": isAlertPrivacyVc ??= null, "clauseName": clauseName ??= null, "clauseUrl": clauseUrl ??= null, "clauseBaseColor": clauseBaseColor ??= null, @@ -627,11 +826,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 +841,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 +865,30 @@ class JVUIConfig { "enterAnim": enterAnim, "exitAnim": exitAnim, "privacyNavTitleTitle": privacyNavTitleTitle ??= null, + "textVerAlignment": textVerAlignment, + //ios-协议的二次弹窗 + "agreementAlertViewTitleTexSize": agreementAlertViewTitleTexSize, + "agreementAlertViewTitleTextColor": agreementAlertViewTitleTextColor ??= + Colors.black.value, + "agreementAlertViewContentTextAlignment": + getStringFromEnum(agreementAlertViewContentTextAlignment), + "agreementAlertViewContentTextFontSize": + agreementAlertViewContentTextFontSize, + "agreementAlertViewLoginBtnNormalImagePath": + agreementAlertViewLoginBtnNormalImagePath ??= null, + "agreementAlertViewLoginBtnPressedImagePath": + agreementAlertViewLoginBtnPressedImagePath ??= null, + "agreementAlertViewLoginBtnUnableImagePath": + agreementAlertViewLoginBtnUnableImagePath ??= null, + "agreementAlertViewLogBtnTextColor": agreementAlertViewLogBtnTextColor ??= + Colors.black.value, + "agreementAlertViewWidgets": agreementAlertViewWidgetsList, + "agreementAlertViewUIFrames": agreementAlertViewUIFrames ??= null, + "privacyCheckDialogConfig": privacyCheckDialogConfig != null + ? privacyCheckDialogConfig?.toJsonMap() + : null, + "setIsPrivacyViewDarkMode": setIsPrivacyViewDarkMode, + "smsUIConfig": smsUIConfig != null ? smsUIConfig?.toJsonMap() : null }..removeWhere((key, value) => value == null); } } @@ -702,6 +928,321 @@ class JVPopViewConfig { } } +/* + * 未勾选协议时的二次弹窗提示页面配置 + * + * */ +class JVPrivacyCheckDialogConfig { + int? width; //协议⼆次弹窗本身的宽 + int? height; //协议⼆次弹窗本身的⾼ + int? offsetX; // 窗口相对屏幕中心的x轴偏移量 + int? offsetY; // 窗口相对屏幕中心的y轴偏移量 + String? title; //弹窗标题 + int? titleTextSize; // 弹窗标题字体大小 + int? titleTextColor; // 弹窗标题字体颜色 + String? contentTextGravity; //协议⼆次弹窗协议内容对⻬⽅式 + int? contentTextSize; //协议⼆次弹窗协议内容字体⼤⼩ + String? gravity; //弹窗对齐方式 + bool? enablePrivacyCheckDialog; + List? widgets; + + String? logBtnText; //弹窗登录按钮 + String? logBtnImgPath; //协议⼆次弹窗登录按钮的背景图⽚ + int? logBtnTextColor; //协议⼆次弹窗登录按钮的字体颜⾊ + int? logBtnMarginL; //协议⼆次弹窗登录按钮左边距 + int? logBtnMarginR; //协议⼆次弹窗登录按钮右边距 + int? logBtnMarginT; //协议⼆次弹窗登录按钮上边距 + int? logBtnMarginB; //协议⼆次弹窗登录按钮下边距 + int? logBtnWidth; //协议⼆次弹窗登录按钮宽 + int? logBtnHeight; //协议⼆次弹窗登录按高 + + JVPrivacyCheckDialogConfig() { + this.enablePrivacyCheckDialog = true; + } + + Map toJsonMap() { + var widgetList = []; + + if (widgets != null) { + for (JVCustomWidget widget in widgets!) { + var para2 = widget.toJsonMap(); + para2.removeWhere((key, value) => value == null); + widgetList.add(para2); + } + } + + return { + "width": width, + "height": height, + "offsetX": offsetX, + "offsetY": offsetY, + "gravity": gravity, + "title": title, + "titleTextSize": titleTextSize, + "titleTextColor": titleTextColor, + "contentTextGravity": contentTextGravity, + "contentTextSize": contentTextSize, + "enablePrivacyCheckDialog": enablePrivacyCheckDialog, + "widgets": widgetList, + "logBtnText": logBtnText, + "logBtnImgPath": logBtnImgPath, + "logBtnTextColor": logBtnTextColor, + "logBtnMarginL": logBtnMarginL, + "logBtnMarginR": logBtnMarginR, + "logBtnMarginT": logBtnMarginT, + "logBtnMarginB": logBtnMarginB, + "logBtnWidth": logBtnWidth, + "logBtnHeight": logBtnHeight, + }..removeWhere((key, value) => value == null); + } +} + +/* + * 短信页面的配置 + * + * */ +class JVSMSUIConfig { + String? smsAuthPageBackgroundImagePath; // 登录界面背景图片 + String? smsNavText; //导航栏标题文字 + int? smsNavTextColor; //导航栏标题颜色 only iOS + bool? smsNavTextBold; // 导航栏标题 是否加粗 only iOS + int? smsNavTextSize; //导航栏标题大小 only iOS + int? smsSloganTextSize; //设置 slogan 字体大小 + bool? isSmsSloganHidden; //设置 slogan 字体是否隐藏 only android + bool? isSmsSloganTextBold; //设置 slogan 字体是否加粗 only android + int? smsSloganOffsetX; //设置 slogan 相对于屏幕左边 x 轴偏移 + int? smsSloganOffsetY; //设置 slogan 相对于标题栏下边缘 y 偏移 + int? smsSloganOffsetBottomY; //设置 slogan 相对于屏幕底部下边缘 y 轴偏移 + int? smsSloganWidth; //设置 slogan 宽度 only iOS + int? smsSloganHeight; //设置 slogan 高度 only iOS + int? smsSloganTextColor; //设置移动 slogan 文字颜色 + int? smsLogoWidth; //设置 logo 宽度(单位:dp) + int? smsLogoHeight; //设置 logo 高度(单位:dp) + int? smsLogoOffsetX; //设置 logo 相对于屏幕左边 x 轴偏移 + int? smsLogoOffsetY; //设置 logo 相对于标题栏下边缘 y 偏移 + int? smsLogoOffsetBottomY; // 设置 logo 相对于屏幕底部 y 轴偏移 + bool? isSmsLogoHidden; //隐藏 logo + String? smsLogoResName; //设置 logo 图片 + int? smsPhoneTextViewOffsetX; //设置号码标题相对于屏幕左边 x 轴偏移 only android + int? smsPhoneTextViewOffsetY; //设置号码标题相对于相对于标题栏下边缘 y 偏移 only android + int? smsPhoneTextViewTextSize; //设置号码标题字体大小 only android + int? smsPhoneTextViewTextColor; //设置号码标题文字颜色 only android + int? smsPhoneInputViewOffsetX; //设置号码输入框相对于屏幕左边 x 轴偏移 + int? smsPhoneInputViewOffsetY; //设置号码输入框相对于屏幕底部 y 轴偏移 + int? smsPhoneInputViewWidth; //设置号码输入框宽度 + int? smsPhoneInputViewHeight; //设置号码输入框高度 + int? smsPhoneInputViewTextColor; //设置手机号码输入框字体颜色 + int? smsPhoneInputViewTextSize; //设置手机号码输入框字体大小 + String? smsPhoneInputViewPlaceholderText; // 设置手机号码输入框提示词 only iOS + JVIOSTextBorderStyle? smsPhoneInputViewBorderStyle; //设置手机号码输入框样式 only iOS + int? smsVerifyCodeTextViewOffsetX; //设置验证码标题相对于屏幕左边 x 轴偏移 only android + int? smsVerifyCodeTextViewOffsetY; //设置验证码标题相对于相对于标题栏下边缘 y 偏移 only android + int? smsVerifyCodeTextViewTextSize; //设置验证码标题字体大小 only android + int? smsVerifyCodeTextViewTextColor; //设置验证码标题文字颜色 only android + int? smsVerifyCodeEditTextViewTextSize; //设置验证码输入框字体大小 + int? smsVerifyCodeEditTextViewTextColor; //设置验证码输入框字体颜色 + String? smsVerifyCodeEditTextViewPlaceholderText; // 设置验证码输入框提示词 only iOS + int? smsVerifyCodeEditTextViewOffsetX; //设置验证码输入框相对于屏幕左边 x 轴偏移 + int? smsVerifyCodeEditTextViewOffsetY; //设置验证码输入框相对于标题栏下边缘 y 偏移 + int? smsVerifyCodeEditTextViewOffsetR; //设置验证码输入框相对于屏幕右边偏移 + int? smsVerifyCodeEditTextViewWidth; //设置验证码输入框宽度 + int? smsVerifyCodeEditTextViewHeight; //设置验证码输入框高度 + JVIOSTextBorderStyle? + smsVerifyCodeEditTextViewBorderStyle; //设置验证码输入框样式 only iOS + int? smsGetVerifyCodeTextViewOffsetX; //设置获取验证码按钮相对于屏幕左边 x 轴偏移 + int? smsGetVerifyCodeTextViewOffsetY; //设置获取验证码按钮相对于标题栏下边缘 y 偏移 + int? smsGetVerifyCodeTextViewTextSize; //设置获取验证码按钮字体大小 + int? smsGetVerifyCodeTextViewTextColor; //设置获取验证码按钮文字颜色 + int? smsGetVerifyCodeTextViewOffsetR; //设置获取验证码按钮相对于屏幕右边偏移 + int? smsGetVerifyCodeBtnWidth; //设置获取验证码按钮宽度 only iOS + int? smsGetVerifyCodeBtnHeight; //设置获取验证码按钮高度 only iOS + int? smsGetVerifyCodeBtnCornerRadius; // 设置获取验证码按钮圆角度数 only iOS + String? smsGetVerifyCodeBtnBackgroundPath; //设置获取验证码按钮图片 + List? + smsGetVerifyCodeBtnBackgroundPaths; //设置获取验证码按钮图片 [激活状态的图片,失效状态的图片,高亮状态的图片] only iOS + String? smsGetVerifyCodeBtnText; //设置获取验证码按钮文字 only iOS + //enableSmsGetVerifyCodeDialog; + //smsGetVerifyCodeDialog + int? smsLogBtnOffsetX; //设置登录按钮相对于屏幕左边 x 轴偏移 + int? smsLogBtnOffsetY; //设置登录按钮相对于标题栏下边缘 y 偏移 + int? smsLogBtnWidth; //设置登录按钮宽度 + int? smsLogBtnHeight; //设置登录按钮高度 + int? smsLogBtnTextSize; //设置登录按钮字体大小 + int? smsLogBtnBottomOffsetY; // 设置登录按钮相对屏幕底部 y 轴偏移 + String? smsLogBtnText; //设置登录按钮文字 + int? smsLogBtnTextColor; //设置登录按钮文字颜色 + bool? isSmsLogBtnTextBold; // 设置登录按钮字体是否加粗 + String? smsLogBtnBackgroundPath; //设置授权登录按钮图片 + String? + smsLogBtnBackgroundPaths; //设置授权登录按钮图片 @[激活状态的图片,失效状态的图片,高亮状态的图片] only iOS + int? smsFirstSeperLineOffsetX; //第一分割线相对于屏幕左边 x 轴偏移 only android + int? smsFirstSeperLineOffsetY; //第一分割线相对于标题栏下边缘 y 偏移 only android + int? smsFirstSeperLineOffsetR; //第一分割线相对于屏幕右边偏移 only android + int? smsFirstSeperLineColor; //第一分割线颜色 only android + int? smsSecondSeperLineOffsetX; //第二分割线相对于屏幕左边 x 轴偏移 only android + int? smsSecondSeperLineOffsetY; //第二分割线相对于标题栏下边缘 y 偏移 only android + int? smsSecondSeperLineOffsetR; //第二分割线相对于屏幕右边偏移 only android + int? smsSecondSeperLineColor; //第二分割线颜色 only android + bool? isSmsPrivacyTextGravityCenter; //设置隐私条款文字是否居中对齐(默认左对齐) + List? smsPrivacyColor; // 设置隐私条款名称颜色 [基础文字颜色,协议文字颜色] only iOS + int? + smsPrivacyTextVerAlignment; // 设置隐私条款垂直对齐方式 0:top 1:middle 2:bottom only iOS + int? smsPrivacyOffsetX; //协议相对于屏幕左边 x 轴偏移 + int? smsPrivacyOffsetY; //协议相对于底部 y 偏移 + int? smsPrivacyTopOffsetY; //协议相对于标题栏下边缘 y 偏移 + int? smsPrivacyWidth; //协议宽度 only iOS + int? smsPrivacyHeight; //协议高度 only iOS + int? smsPrivacyMarginL; //设置协议相对于登录页左边的间距 only android + int? smsPrivacyMarginR; //设置协议相对于登录页右边的间距 only android + int? smsPrivacyMarginT; //设置协议相对于登录页顶部的间距 only android + int? smsPrivacyMarginB; //设置协议相对于登录页底部的间距 only android + int? smsPrivacyCheckboxSize; //设置隐私条款 checkbox 尺寸 + int? smsPrivacyCheckboxOffsetX; //设置隐私条款 checkbox 相对于屏幕左边 x 轴偏移 only iOS + bool? isSmsPrivacyCheckboxInCenter; //设置隐私条款 checkbox 是否相对协议文字纵向居中 + bool? smsPrivacyCheckboxState; //设置隐私条款 checkbox 默认状态 : 是否选择 默认:NO + List? smsPrivacyCheckboxMargin; //设置协议相对于登录页的间距 only android + String? smsPrivacyCheckboxUncheckedImgPath; // 设置隐私条款 checkbox 未选中时图片 only iOS + String? smsPrivacyCheckboxCheckedImgPath; // 设置隐私条款 checkbox 选中时图片 only iOS + List? smsPrivacyBeanList; //设置协议内容 + String? smsPrivacyClauseStart; //设置协议条款开头文本 + String? smsPrivacyClauseEnd; //设置协议条款结尾文本 + // List smsCustomViews + bool? enableSMSService; //如果开启了短信服务,在认证服务失败时,短信服务又可用的情况下拉起短信服务 + + //android独占 + String? smsPrivacyUncheckedMsg; //短信协议没有被勾选的提示 + String? smsGetCodeFailMsg; //短信获取失败提示 + String? smsPhoneInvalidMsg; //手机号无效提示 + + Map toJsonMap() { + return { + "smsAuthPageBackgroundImagePath": smsAuthPageBackgroundImagePath ??= null, + "smsNavText": smsNavText ??= null, + "smsNavTextColor": smsNavTextColor ??= null, + "smsNavTextBold": smsNavTextBold ??= null, + "smsNavTextSize": smsNavTextSize ??= null, + "smsSloganTextSize": smsSloganTextSize ??= null, + "isSmsSloganHidden": isSmsSloganHidden ??= null, + "isSmsSloganTextBold": isSmsSloganTextBold ??= null, + "smsSloganOffsetX": smsSloganOffsetX ??= null, + "smsSloganOffsetY": smsSloganOffsetY ??= null, + "smsSloganOffsetBottomY": smsSloganOffsetBottomY ??= null, + "smsSloganWidth": smsSloganWidth ??= null, + "smsSloganHeight": smsSloganHeight ??= null, + "smsSloganTextColor": smsSloganTextColor ??= null, + "smsLogoWidth": smsLogoWidth ??= null, + "smsLogoHeight": smsLogoHeight ??= null, + "smsLogoOffsetX": smsLogoOffsetX ??= null, + "smsLogoOffsetY": smsLogoOffsetY ??= null, + "smsLogoOffsetBottomY": smsLogoOffsetBottomY ??= null, + "isSmsLogoHidden": isSmsLogoHidden ??= null, + "smsLogoResName": smsLogoResName ??= null, + "smsPhoneTextViewOffsetX": smsPhoneTextViewOffsetX ??= null, + "smsPhoneTextViewOffsetY": smsPhoneTextViewOffsetY ??= null, + "smsPhoneTextViewTextSize": smsPhoneTextViewTextSize ??= null, + "smsPhoneTextViewTextColor": smsPhoneTextViewTextColor ??= null, + "smsPhoneInputViewOffsetX": smsPhoneInputViewOffsetX ??= null, + "smsPhoneInputViewOffsetY": smsPhoneInputViewOffsetY ??= null, + "smsPhoneInputViewWidth": smsPhoneInputViewWidth ??= null, + "smsPhoneInputViewHeight": smsPhoneInputViewHeight ??= null, + "smsPhoneInputViewTextColor": smsPhoneInputViewTextColor ??= null, + "smsPhoneInputViewTextSize": smsPhoneInputViewTextSize ??= null, + "smsPhoneInputViewPlaceholderText": smsPhoneInputViewPlaceholderText ??= + null, + "smsPhoneInputViewBorderStyle": + getStringFromEnum(smsPhoneInputViewBorderStyle), + "smsVerifyCodeTextViewOffsetX": smsVerifyCodeTextViewOffsetX ??= null, + "smsVerifyCodeTextViewOffsetY": smsVerifyCodeTextViewOffsetY ??= null, + "smsVerifyCodeTextViewTextSize": smsVerifyCodeTextViewTextSize ??= null, + "smsVerifyCodeTextViewTextColor": smsVerifyCodeTextViewTextColor ??= null, + "smsVerifyCodeEditTextViewTextSize": smsVerifyCodeEditTextViewTextSize ??= + null, + "smsVerifyCodeEditTextViewTextColor": + smsVerifyCodeEditTextViewTextColor ??= null, + "smsVerifyCodeEditTextViewPlaceholderText": + smsVerifyCodeEditTextViewPlaceholderText ??= null, + "smsVerifyCodeEditTextViewOffsetX": smsVerifyCodeEditTextViewOffsetX ??= + null, + "smsVerifyCodeEditTextViewOffsetY": smsVerifyCodeEditTextViewOffsetY ??= + null, + "smsVerifyCodeEditTextViewOffsetR": smsVerifyCodeEditTextViewOffsetR ??= + null, + "smsVerifyCodeEditTextViewWidth": smsVerifyCodeEditTextViewWidth ??= null, + "smsVerifyCodeEditTextViewHeight": smsVerifyCodeEditTextViewHeight ??= + null, + "smsVerifyCodeEditTextViewBorderStyle": + getStringFromEnum(smsVerifyCodeEditTextViewBorderStyle), + "smsGetVerifyCodeTextViewOffsetX": smsGetVerifyCodeTextViewOffsetX ??= + null, + "smsGetVerifyCodeTextViewOffsetY": smsGetVerifyCodeTextViewOffsetY ??= + null, + "smsGetVerifyCodeTextViewTextSize": smsGetVerifyCodeTextViewTextSize ??= + null, + "smsGetVerifyCodeTextViewTextColor": smsGetVerifyCodeTextViewTextColor ??= + null, + "smsGetVerifyCodeTextViewOffsetR": smsGetVerifyCodeTextViewOffsetR ??= + null, + "smsGetVerifyCodeBtnWidth": smsGetVerifyCodeBtnWidth ??= null, + "smsGetVerifyCodeBtnHeight": smsGetVerifyCodeBtnHeight ??= null, + "smsGetVerifyCodeBtnCornerRadius": smsGetVerifyCodeBtnCornerRadius ??= + null, + "smsGetVerifyCodeBtnBackgroundPath": smsGetVerifyCodeBtnBackgroundPath ??= + null, + "smsGetVerifyCodeBtnBackgroundPaths": + smsGetVerifyCodeBtnBackgroundPaths ??= null, + "smsGetVerifyCodeBtnText": smsGetVerifyCodeBtnText ??= null, + "smsLogBtnOffsetX": smsLogBtnOffsetX ??= null, + "smsLogBtnOffsetY": smsLogBtnOffsetY ??= null, + "smsLogBtnWidth": smsLogBtnWidth ??= null, + "smsLogBtnHeight": smsLogBtnHeight ??= null, + "smsLogBtnTextSize": smsLogBtnTextSize ??= null, + "smsLogBtnBottomOffsetY": smsLogBtnBottomOffsetY ??= null, + "smsLogBtnText": smsLogBtnText ??= null, + "smsLogBtnTextColor": smsLogBtnTextColor ??= null, + "isSmsLogBtnTextBold": isSmsLogBtnTextBold ??= null, + "smsLogBtnBackgroundPath": smsLogBtnBackgroundPath ??= null, + "smsLogBtnBackgroundPaths": smsLogBtnBackgroundPaths ??= null, + "smsFirstSeperLineOffsetX": smsFirstSeperLineOffsetX ??= null, + "smsFirstSeperLineOffsetY": smsFirstSeperLineOffsetY ??= null, + "smsFirstSeperLineOffsetR": smsFirstSeperLineOffsetR ??= null, + "smsSecondSeperLineOffsetX": smsSecondSeperLineOffsetX ??= null, + "smsSecondSeperLineOffsetY": smsSecondSeperLineOffsetY ??= null, + "smsSecondSeperLineOffsetR": smsSecondSeperLineOffsetR ??= null, + "smsFirstSeperLineColor": smsFirstSeperLineColor ??= null, + "smsSecondSeperLineColor": smsSecondSeperLineColor ??= null, + "isSmsPrivacyTextGravityCenter": isSmsPrivacyTextGravityCenter ??= null, + "smsPrivacyColor": smsPrivacyColor ??= null, + "smsPrivacyTextVerAlignment": smsPrivacyTextVerAlignment ??= null, + "smsPrivacyOffsetX": smsPrivacyOffsetX ??= null, + "smsPrivacyOffsetY": smsPrivacyOffsetY ??= null, + "smsPrivacyTopOffsetY": smsPrivacyTopOffsetY ??= null, + "smsPrivacyWidth": smsPrivacyWidth ??= null, + "smsPrivacyHeight": smsPrivacyHeight ??= null, + "smsPrivacyMarginL": smsPrivacyMarginL ??= null, + "smsPrivacyMarginR": smsPrivacyMarginR ??= null, + "smsPrivacyMarginT": smsPrivacyMarginT ??= null, + "smsPrivacyMarginB": smsPrivacyMarginB ??= null, + "smsPrivacyCheckboxSize": smsPrivacyCheckboxSize ??= null, + "smsPrivacyCheckboxOffsetX": smsPrivacyCheckboxOffsetX ??= null, + "isSmsPrivacyCheckboxInCenter": isSmsPrivacyCheckboxInCenter ??= null, + "smsPrivacyCheckboxState": smsPrivacyCheckboxState ??= null, + "smsPrivacyCheckboxMargin": smsPrivacyCheckboxMargin ??= null, + "smsPrivacyCheckboxUncheckedImgPath": + smsPrivacyCheckboxUncheckedImgPath ??= null, + "smsPrivacyCheckboxCheckedImgPath": smsPrivacyCheckboxCheckedImgPath ??= + null, + "smsPrivacyBeanList": + smsPrivacyBeanList != null ? json.encode(smsPrivacyBeanList) : null, + "smsPrivacyClauseStart": smsPrivacyClauseStart ??= null, + "smsPrivacyClauseEnd": smsPrivacyClauseEnd ??= null, + "smsPrivacyUncheckedMsg": smsPrivacyUncheckedMsg ??= null, + "smsGetCodeFailMsg": smsGetCodeFailMsg ??= null, + "smsPhoneInvalidMsg": smsPhoneInvalidMsg ??= null, + "enableSMSService": enableSMSService ??= null, + }..removeWhere((key, value) => value == null); + } +} + /// 自定义控件 class JVCustomWidget { String? widgetId; @@ -774,11 +1315,29 @@ enum JVCustomWidgetType { textView, button } /// 文本对齐方式 enum JVTextAlignmentType { left, right, center } +/// SMS监听返回类 +class JVSMSEvent { + int? + code; //返回码,具体事件返回码请查看(https://docs.jiguang.cn/jverification/client/android_api/) + String? message; //事件描述、事件返回值等 + String? phone; //电话号 + + JVSMSEvent.fromJson(Map json) + : code = json['code'], + message = json['message'], + phone = json['phone']; + + Map toMap() { + return {'code': code, 'message': message, 'phone': phone}; + } +} + /// 监听返回类 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'], @@ -846,6 +1405,7 @@ enum JVIOSUIModalTransitionStyle { CrossDissolve, PartialCurl } + /* * * iOS状态栏设置,需要设置info.plist文件中 @@ -859,6 +1419,18 @@ enum JVIOSBarStyle { StatusBarStyleDarkContent // Dark content, for use on light backgrounds iOS 13 以上 } +/* +* +* iOS 输入框边框样式 +* +* */ +enum JVIOSTextBorderStyle { + BorderStyleNone, + BorderStyleLine, + BorderStyleBezel, + BorderStyleRoundedRect +} + String getStringFromEnum(T) { if (T == null) { return ""; @@ -866,3 +1438,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..ed383c2 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.4.4 homepage: https://www.jiguang.cn environment: @@ -11,6 +11,7 @@ environment: dependencies: flutter: sdk: flutter + dev_dependencies: