feat: Add fiat api and last used wallet type to support chat ()

This commit is contained in:
Konstantin Ullrich 2025-03-11 14:27:50 +01:00 committed by GitHub
parent 1c8af1afae
commit dcde3fd253
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 22 additions and 6 deletions

View file

@ -1260,7 +1260,8 @@ Future<void> setup({
getIt.registerFactoryParam<OrderDetailsPage, Order, void>(
(Order order, _) => OrderDetailsPage(getIt.get<OrderDetailsViewModel>(param1: order)));
getIt.registerFactory(() => SupportViewModel(getIt.get<SettingsStore>()));
getIt.registerFactory(() =>
SupportViewModel(getIt.get<SettingsStore>(), getIt.get<AppStore>()));
getIt.registerFactory(() => SupportPage(getIt.get<SupportViewModel>()));

View file

@ -26,6 +26,8 @@ class SupportChatPage extends BasePage {
secureStorage,
supportUrl: supportViewModel.fetchUrl(authToken: snapshot.data!),
appVersion: supportViewModel.appVersion,
fiatApiMode: supportViewModel.fiatApiMode,
walletType: supportViewModel.walletType,
);
return Container();
},

View file

@ -11,11 +11,15 @@ class ChatwootWidget extends StatefulWidget {
this.secureStorage, {
required this.supportUrl,
required this.appVersion,
required this.fiatApiMode,
required this.walletType,
});
final SecureStorage secureStorage;
final String supportUrl;
final String appVersion;
final String fiatApiMode;
final String walletType;
@override
ChatwootWidgetState createState() => ChatwootWidgetState();
@ -43,8 +47,11 @@ class ChatwootWidgetState extends State<ChatwootWidget> {
if (eventType == 'loaded') {
final authToken = parsedMessage["config"]["authToken"];
_storeCookie(authToken as String);
_setCustomAttributes(
controller, {"app_version": widget.appVersion});
_setCustomAttributes(controller, {
"app_version": widget.appVersion,
"fiat_api_mode": widget.fiatApiMode,
"wallet_type": widget.walletType,
});
}
}
},

View file

@ -1,5 +1,6 @@
import 'package:cake_wallet/.secrets.g.dart' as secrets;
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/store/app_store.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/view_model/settings/link_list_item.dart';
import 'package:cake_wallet/view_model/settings/settings_list_item.dart';
@ -11,9 +12,10 @@ part 'support_view_model.g.dart';
class SupportViewModel = SupportViewModelBase with _$SupportViewModel;
abstract class SupportViewModelBase with Store {
final SettingsStore settingsStore;
final SettingsStore _settingsStore;
final AppStore _appStore;
SupportViewModelBase(this.settingsStore)
SupportViewModelBase(this._settingsStore, this._appStore)
: items = [
LinkListItem(
title: 'Email',
@ -120,7 +122,11 @@ abstract class SupportViewModelBase with Store {
}
String get appVersion =>
"${isMoneroOnly ? "Monero.com" : "Cake Wallet"} - ${settingsStore.appVersion}";
"${isMoneroOnly ? "Monero.com" : "Cake Wallet"} - ${_settingsStore.appVersion}";
String get fiatApiMode => _settingsStore.fiatApiMode.title;
String get walletType => _appStore.wallet?.type.name ?? 'Unknown';
List<SettingsListItem> items;
}