3333import cn .jiguang .verifysdk .api .JVerificationInterface ;
3434import cn .jiguang .verifysdk .api .JVerifyUIClickCallback ;
3535import cn .jiguang .verifysdk .api .JVerifyUIConfig ;
36+ import cn .jiguang .verifysdk .api .LoginSettings ;
3637import cn .jiguang .verifysdk .api .PreLoginListener ;
38+ import cn .jiguang .verifysdk .api .RequestCallback ;
3739import cn .jiguang .verifysdk .api .VerifyListener ;
3840import io .flutter .plugin .common .MethodCall ;
3941import io .flutter .plugin .common .MethodChannel ;
@@ -116,7 +118,18 @@ public void onMethodCall(MethodCall call, Result result) {
116118 /** SDK 初始换 */
117119 private void setup (MethodCall call ,Result result ){
118120 Log .d (TAG ,"Action - setup:" );
119- JVerificationInterface .init (context );
121+
122+ Object timeout = getValueByKey (call ,"timeout" );
123+ JVerificationInterface .init (context , (Integer )timeout , new RequestCallback <String >() {
124+ @ Override
125+ public void onResult (int code , String message ) {
126+ Map <String ,Object > map = new HashMap <>();
127+ map .put (j_code_key ,code );
128+ map .put (j_msg_key ,message );
129+ // 通过 channel 返回
130+ channel .invokeMethod ("onReceiveSDKSetupCallBackEvent" ,map );
131+ }
132+ });
120133 }
121134
122135 /** SDK设置debug模式 */
@@ -286,8 +299,24 @@ private void loginAuthInterface(final Boolean isSync, MethodCall call, final Res
286299 Log .d (TAG ,"Action - loginAuthInterface:" );
287300
288301 Object autoFinish = getValueByKey (call ,"autoDismiss" );
302+ Integer timeOut = call .argument ("timeout" );
303+
304+ LoginSettings settings = new LoginSettings ();
305+ settings .setAutoFinish ((Boolean )autoFinish );
306+ settings .setTimeout (timeOut );
307+ settings .setAuthPageEventListener (new AuthPageEventListener () {
308+ @ Override
309+ public void onEvent (int cmd , String msg ) {
310+ Log .d (TAG ,"Action - AuthPageEventListener: cmd = " + cmd );
311+ /// 事件
312+ final HashMap jsonMap = new HashMap ();
313+ jsonMap .put (j_code_key , cmd );
314+ jsonMap .put (j_msg_key , msg );
315+ channel .invokeMethod ("onReceiveAuthPageEvent" , jsonMap );
316+ }
317+ });
289318
290- JVerificationInterface .loginAuth (context , ( Boolean ) autoFinish , new VerifyListener () {
319+ JVerificationInterface .loginAuth (context , settings , new VerifyListener () {
291320 @ Override
292321 public void onResult (int code , String content , String operator ) {
293322 if (code == 6000 ){
@@ -307,16 +336,6 @@ public void onResult(int code, String content, String operator) {
307336 result .success (map );
308337 }
309338 }
310- }, new AuthPageEventListener () {
311- @ Override
312- public void onEvent (int cmd , String msg ) {
313- Log .d (TAG ,"Action - AuthPageEventListener: cmd = " + cmd );
314- /// 事件
315- final HashMap jsonMap = new HashMap ();
316- jsonMap .put (j_code_key , cmd );
317- jsonMap .put (j_msg_key , msg );
318- channel .invokeMethod ("onReceiveAuthPageEvent" , jsonMap );
319- }
320339 });
321340 }
322341
@@ -325,6 +344,12 @@ private void dismissLoginAuthView(MethodCall call, Result result) {
325344 Log .d (TAG ,"Action - dismissLoginAuthView:" );
326345
327346 JVerificationInterface .dismissLoginAuthActivity ();
347+ JVerificationInterface .dismissLoginAuthActivity (true , new RequestCallback <String >() {
348+ @ Override
349+ public void onResult (int i , String s ) {
350+
351+ }
352+ });
328353 }
329354
330355 /** 自定义授权界面 UI 、添加自定义控件*/
@@ -474,8 +499,10 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder
474499 Object privacyNavTitleTextColor = valueForKey (uiconfig ,"privacyNavTitleTextColor" );
475500 Object privacyNavTitleTextSize = valueForKey (uiconfig ,"privacyNavTitleTextSize" );
476501 Object privacyNavReturnBtnImage = valueForKey (uiconfig ,"privacyNavReturnBtnImage" );
502+ Object privacyNavTitleTitle1 = valueForKey (uiconfig ,"privacyNavTitleTitle1" );
503+ Object privacyNavTitleTitle2 = valueForKey (uiconfig ,"privacyNavTitleTitle2" );
477504
478-
505+ Object popViewConfig = valueForKey ( uiconfig , "popViewConfig" );
479506
480507 /************** 背景 ***************/
481508 if (authBackgroundImage != null ){
@@ -677,6 +704,12 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder
677704 if (privacyNavTitleTextColor != null ){
678705 builder .setPrivacyNavTitleTextColor (exchangeObject (privacyNavTitleTextColor ));
679706 }
707+ if (privacyNavTitleTitle1 != null ) {
708+ builder .setAppPrivacyNavTitle1 ((String ) privacyNavTitleTitle1 );
709+ }
710+ if (privacyNavTitleTitle2 != null ) {
711+ builder .setAppPrivacyNavTitle2 ((String ) privacyNavTitleTitle2 );
712+ }
680713
681714 if (privacyNavReturnBtnImage != null ){
682715 int res_id = getResourceByReflect ((String )privacyNavReturnBtnImage );
@@ -686,6 +719,23 @@ private void layoutOriginOuthView(Map uiconfig, JVerifyUIConfig.Builder builder
686719 builder .setPrivacyNavReturnBtn (view );
687720 }
688721 }
722+
723+ builder .enableHintToast (true ,null );
724+ /************** 授权页弹窗模式 ***************/
725+ if (popViewConfig != null ) {
726+ Map popViewConfigMap = (Map )popViewConfig ;
727+ Object isPopViewTheme = valueForKey (popViewConfigMap ,"isPopViewTheme" );
728+ if ((Boolean ) isPopViewTheme ) {
729+ Object width = valueForKey (popViewConfigMap ,"width" );
730+ Object height = valueForKey (popViewConfigMap ,"height" );
731+ Object offsetCenterX = valueForKey (popViewConfigMap ,"offsetCenterX" );
732+ Object offsetCenterY = valueForKey (popViewConfigMap ,"offsetCenterY" );
733+ Object isBottom = valueForKey (popViewConfigMap ,"isBottom" );
734+
735+ builder .setDialogTheme ((int )width , (int )height , (int )offsetCenterX , (int )offsetCenterY , (Boolean )isBottom );
736+
737+ }
738+ }
689739 }
690740
691741 /** 添加自定义 widget 到 SDK 原有的授权界面里 */
0 commit comments