pushConnect function

Future<UpAccount> pushConnect(
  1. BuildContext context,
  2. UniPassConfig config
)

Implementation

Future<UpAccount> pushConnect(BuildContext context, UniPassConfig config) async {
  UpAccount? localAccount = Storage.getUpAccount();
  if (localAccount != null) return localAccount;
  final String url = getWalletUrl(MessageType.upConnect, config.domain, config.protocol, connectType: config.connectType);
  print("[pushConnect: $url]");
  print("[config.authorize: ${config.authorize}]");
  Completer<UpAccount> completer = Completer<UpAccount>();
  Navigator.push(
    context,
    MaterialPageRoute(
      builder: (context) => ConnectPage(
        connectFuture: completer,
        url: url,
        appSetting: config.appSetting,
        returnEmail: config.returnEmail ?? false,
        authorize: config.authorize,
      ),
    ),
  );

  return completer.future;
}