getTwitterConnectionUrl method

Future<void> getTwitterConnectionUrl()

Gets twitter initial connection url before linking.

Implementation

Future<void> getTwitterConnectionUrl() async {
  _incomingLinkHandler();
  try {
    _loadingService.show(status: 'Processing...');
    final response = await _linkingRepository.getTwitterConnectionUrl();
    if (response.status == 'success') {
      _loadingService.dismiss();

      log('Twitter connection test');

      ///Twitter connection is not active in the sdk
      /// and webview flutter was removed hence this.
      ///
      //log(response.data.toString());

      // final TwitterData? twitterData = await Navigator.push(
      //     context,
      //     MaterialPageRoute(
      //         builder: (context) => const SocialMediaConnectWebviewView(),
      //         settings: RouteSettings(arguments: response.data)));
      // if (twitterData != null) {
      //   //log('twitter data: ${twitterData.toString()}');

      //   final AddTwitterChannelRequest addTwitterChannelRequest =
      //       AddTwitterChannelRequest(
      //           authToken: twitterData.oAuthToken ?? '',
      //           authVerifier: twitterData.oAuthVerifier ?? '');

      //   addTwitterAccount(addTwitterChannelRequest);
      // }
    }
  } catch (e) {
    if (e is DioError) {
      _loadingService.showError(
          e.response?.data['message'] ?? 'Error connecting account');
    } else {
      _loadingService.showError('Error connecting account');
    }

    _loadingService.dismiss();
  }
}