Skip to content

Commit

Permalink
feat: Rename profile name of the enterprise #2143
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Dec 13, 2023
1 parent 0399cbd commit 3acbf18
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/app/shared/enum/type/profile/profile_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ enum ProfileType {
extension ProfileTypeX on ProfileType {
String getTitle({
required AppLocalizations l10n,
String? name,
required String name,
}) {
switch (this) {
case ProfileType.custom:
Expand All @@ -20,7 +20,7 @@ extension ProfileTypeX on ProfileType {
case ProfileType.dutch:
return l10n.profileDutchBlockchainCoalition;
case ProfileType.enterprise:
return name ?? 'Enterprise';
return name.isEmpty ? 'Enterprise' : name;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,7 @@ class ProfileSelectorWidget extends StatelessWidget {
title: Text(
profileType.getTitle(
l10n: l10n,
name: isEnterprise
? profile.profileSetting.generalOptions
.companyName
: null,
name: profile.enterpriseWalletName ?? '',
),
style: Theme.of(context)
.textTheme
Expand Down
5 changes: 5 additions & 0 deletions lib/dashboard/profile/cubit/profile_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ class ProfileCubit extends Cubit<ProfileState> {
isDeveloperMode: isDeveloperMode,
profileType: profileType,
profileSetting: profileSetting,
enterpriseWalletName: profileSetting.generalOptions.companyName,
);
}
await update(profileModel);
Expand Down Expand Up @@ -466,6 +467,7 @@ class ProfileCubit extends Cubit<ProfileState> {
walletProtectionType: state.model.walletProtectionType,
isDeveloperMode: state.model.isDeveloperMode,
walletType: state.model.walletType,
enterpriseWalletName: state.model.enterpriseWalletName,
),
);
case ProfileType.dutch:
Expand All @@ -475,6 +477,7 @@ class ProfileCubit extends Cubit<ProfileState> {
walletProtectionType: state.model.walletProtectionType,
isDeveloperMode: state.model.isDeveloperMode,
walletType: state.model.walletType,
enterpriseWalletName: state.model.enterpriseWalletName,
),
);
case ProfileType.custom:
Expand Down Expand Up @@ -507,6 +510,8 @@ class ProfileCubit extends Cubit<ProfileState> {
state.model.copyWith(
profileType: profileType,
profileSetting: enterpriseProfileSetting,
enterpriseWalletName:
enterpriseProfileSetting.generalOptions.companyName,
),
);
}
Expand Down
11 changes: 10 additions & 1 deletion lib/dashboard/profile/models/profile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class ProfileModel extends Equatable {
required this.isDeveloperMode,
required this.profileType,
required this.profileSetting,
this.enterpriseWalletName,
});

factory ProfileModel.fromJson(Map<String, dynamic> json) =>
Expand All @@ -34,8 +35,10 @@ class ProfileModel extends Equatable {
required WalletType walletType,
required WalletProtectionType walletProtectionType,
required bool isDeveloperMode,
String? enterpriseWalletName,
}) =>
ProfileModel(
enterpriseWalletName: enterpriseWalletName,
polygonIdNetwork: polygonIdNetwork,
walletType: walletType,
walletProtectionType: walletProtectionType,
Expand Down Expand Up @@ -75,8 +78,10 @@ class ProfileModel extends Equatable {
required WalletType walletType,
required WalletProtectionType walletProtectionType,
required bool isDeveloperMode,
String? enterpriseWalletName,
}) =>
ProfileModel(
enterpriseWalletName: enterpriseWalletName,
polygonIdNetwork: polygonIdNetwork,
walletType: walletType,
walletProtectionType: walletProtectionType,
Expand Down Expand Up @@ -117,14 +122,16 @@ class ProfileModel extends Equatable {
final bool isDeveloperMode;
final ProfileSetting profileSetting;
final ProfileType profileType;
final String? enterpriseWalletName;

@override
List<Object> get props => [
List<Object?> get props => [
polygonIdNetwork,
walletType,
walletProtectionType,
isDeveloperMode,
profileType,
enterpriseWalletName,
profileSetting,
];

Expand All @@ -137,6 +144,7 @@ class ProfileModel extends Equatable {
bool? isDeveloperMode,
ProfileType? profileType,
ProfileSetting? profileSetting,
String? enterpriseWalletName,
}) {
return ProfileModel(
polygonIdNetwork: polygonIdNetwork ?? this.polygonIdNetwork,
Expand All @@ -145,6 +153,7 @@ class ProfileModel extends Equatable {
isDeveloperMode: isDeveloperMode ?? this.isDeveloperMode,
profileType: profileType ?? this.profileType,
profileSetting: profileSetting ?? this.profileSetting,
enterpriseWalletName: enterpriseWalletName ?? this.enterpriseWalletName,
);
}
}
6 changes: 3 additions & 3 deletions lib/dashboard/profile/models/profile_setting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ class GeneralOptions extends Equatable {

factory GeneralOptions.empty() => GeneralOptions(
walletType: WalletAppType.altme,
companyName: 'Altme',
companyWebsite: 'https://altme.io',
companyLogo: 'https://talao.co/static/img/icon.png',
companyName: '',
companyWebsite: '',
companyLogo: '',
tagLine: '',
profileName: '',
profileVersion: '',
Expand Down

0 comments on commit 3acbf18

Please sign in to comment.