@@ -91,10 +91,12 @@ public void onMethodCall(MethodCall call, Result result) {
9191 getToken (call ,result );
9292 }else if (call .method .equals ("verifyNumber" )) {
9393 verifyNumber (call ,result );
94+ }else if (call .method .equals ("preLogin" )) {
95+ preLogin (call , result );
9496 }else if (call .method .equals ("loginAuth" )) {
9597 loginAuth (call , result );
96- }else if (call .method .equals ("preLogin " )) {
97- preLogin (call , result );
98+ }else if (call .method .equals ("loginAuthSyncApi " )) {
99+ loginAuthSyncApi (call , result );
98100 }else if (call .method .equals ("dismissLoginAuthView" )) {
99101 dismissLoginAuthView (call , result );
100102 }else if (call .method .equals ("setCustomUI" )) {
@@ -270,9 +272,18 @@ private void clearPreLoginCache(MethodCall call,final Result result) {
270272 }
271273
272274
273- /** SDK请求授权一键登录 */
275+ /** SDK请求授权一键登录,异步 */
274276 private void loginAuth (MethodCall call ,final Result result ){
275277 Log .d (TAG ,"Action - loginAuth:" );
278+ loginAuthInterface (false ,call ,result );
279+ }
280+ /** SDK请求授权一键登录,同步 */
281+ private void loginAuthSyncApi (MethodCall call ,final Result result ) {
282+ Log .d (TAG ,"Action - loginAuthSyncApi:" );
283+ loginAuthInterface (true ,call ,result );
284+ }
285+ private void loginAuthInterface (final Boolean isSync , MethodCall call , final Result result ) {
286+ Log .d (TAG ,"Action - loginAuthInterface:" );
276287
277288 Object autoFinish = getValueByKey (call ,"autoDismiss" );
278289
@@ -288,12 +299,13 @@ public void onResult(int code, String content, String operator) {
288299 map .put (j_code_key ,code );
289300 map .put (j_msg_key ,content );
290301 map .put (j_opr_key ,operator );
291-
292- // 通过 channel 返回
293- channel .invokeMethod ("onReceiveLoginAuthCallBackEvent" ,map );
294-
295- // 通过回调返回
296- result .success (map );
302+ if (isSync ) {
303+ // 通过 channel 返回
304+ channel .invokeMethod ("onReceiveLoginAuthCallBackEvent" ,map );
305+ }else {
306+ // 通过回调返回
307+ result .success (map );
308+ }
297309 }
298310 }, new AuthPageEventListener () {
299311 @ Override
0 commit comments