| 1 | import 'package:cake_wallet/core/secure_storage.dart'; |
| 2 | import 'package:cake_wallet/generated/i18n.dart'; |
| 3 | import 'package:cake_wallet/new-ui/widgets/receive_page/receive_top_bar.dart'; |
| 4 | import 'package:cake_wallet/src/screens/support_chat/widgets/chatwoot_widget.dart'; |
| 5 | import 'package:cake_wallet/view_model/support_view_model.dart'; |
| 6 | import 'package:flutter/material.dart'; |
| 7 | |
| 8 | class SupportChatPage extends StatelessWidget { |
| 9 | SupportChatPage(this.supportViewModel, {required this.secureStorage}); |
| 10 | |
| 11 | final SupportViewModel supportViewModel; |
| 12 | final SecureStorage secureStorage; |
| 13 | |
| 14 | @override |
| 15 | Widget build(BuildContext context) => Container( |
| 16 | color: Theme.of(context).colorScheme.surface, |
| 17 | child: SafeArea( |
| 18 | child: Padding( |
| 19 | padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), |
| 20 | child: Column( |
| 21 | children: [ |
| 22 | ModalTopBar( |
| 23 | title: S.current.settings_support, |
| 24 | leadingIcon: Icon(Icons.arrow_back_ios_new), |
| 25 | leadingSemanticLabel: S.current.seed_alert_back, |
| 26 | onLeadingPressed: Navigator.of(context).pop), |
| 27 | FutureBuilder<String>( |
| 28 | future: getCookie(), |
| 29 | builder: (BuildContext context, AsyncSnapshot<String> snapshot) { |
| 30 | if (snapshot.hasData) |
| 31 | return Expanded( |
| 32 | child: ChatwootWidget( |
| 33 | secureStorage, |
| 34 | supportUrl: supportViewModel.fetchUrl(authToken: snapshot.data!), |
| 35 | appVersion: supportViewModel.appVersion, |
| 36 | fiatApiMode: supportViewModel.fiatApiMode, |
| 37 | walletType: supportViewModel.walletType, |
| 38 | walletSyncState: supportViewModel.walletSyncState, |
| 39 | builtInTorState: supportViewModel.builtInTorState, |
| 40 | ), |
| 41 | ); |
| 42 | return Container(); |
| 43 | }, |
| 44 | ), |
| 45 | ], |
| 46 | ), |
| 47 | ), |
| 48 | ), |
| 49 | ); |
| 50 | |
| 51 | Future<String> getCookie() async => await secureStorage.read(key: COOKIE_KEY) ?? ""; |
| 52 | } |