auth method

void auth({
  1. required Map<String, dynamic> arguments,
  2. required AuthorizeCall authorizeCall,
})

Implementation

void auth({required Map<String, dynamic> arguments, required AuthorizeCall authorizeCall}) {
  CloudChannelManager.instance.channel?.setMethodCallHandler((call) {
    String method = call.method;
    var resultArguments = call.arguments;
    if (method == authStatusChannelName &&
        resultArguments is Map<String, dynamic> &&
        resultArguments.containsKey("authType")) {
      var authType = resultArguments.remove("authType");
      var status = resultArguments.remove("authStatus");
      if (authType == AuthType.weChat.name) {
        weChatAuthCall(status, authorizeCall, resultArguments);
      } else if (authType == AuthType.qq.name) {
        qqAuthCall(status, authorizeCall, resultArguments);
      } else if (authType == AuthType.weiBo.name) {
        weiBoAuthCall(status, authorizeCall, resultArguments);
      }
    }
    return Future.value(null);
  });
  CloudChannelManager.instance.send(authChannelName, arguments: arguments);
}