TF-3894 Fix blank email content when opening email
This commit is contained in:
+7
-1
@@ -1,5 +1,6 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:model/extensions/session_extension.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/profile_setting/profile_setting_action_type.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/manage_account_dashboard_controller.dart';
|
||||
|
||||
@@ -10,7 +11,12 @@ extension HandleProfileSettingActionTypeClickExtension on ManageAccountDashBoard
|
||||
}) {
|
||||
switch (actionType) {
|
||||
case ProfileSettingActionType.signOut:
|
||||
logout(context, sessionCurrent, accountId.value);
|
||||
String accountDisplayName = ownEmailAddress.value;
|
||||
if (accountDisplayName.trim().isEmpty) {
|
||||
accountDisplayName =
|
||||
sessionCurrent?.getOwnEmailAddressOrUsername() ?? '';
|
||||
}
|
||||
logout(context, sessionCurrent, accountId.value, accountDisplayName);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
|
||||
import 'package:core/utils/app_logger.dart';
|
||||
import 'package:jmap_dart_client/jmap/identities/identity.dart';
|
||||
import 'package:model/extensions/session_extension.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/manage_account_dashboard_controller.dart';
|
||||
|
||||
extension UpdateOwnEmailAddressExtension on ManageAccountDashBoardController {
|
||||
|
||||
void synchronizeOwnEmailAddress(String emailAddress) {
|
||||
log('UpdateOwnEmailAddressExtension::synchronizeOwnEmailAddress:OwnEmailAddress = ${ownEmailAddress.value}, NewEmailAddress = $emailAddress');
|
||||
if (ownEmailAddress.value.isNotEmpty || emailAddress.isEmpty) return;
|
||||
ownEmailAddress.value = emailAddress;
|
||||
}
|
||||
|
||||
void updateOwnEmailAddressFromIdentities(List<Identity> listIdentities) {
|
||||
final identityEmailAddress = listIdentities.firstOrNull?.email ?? '';
|
||||
|
||||
if (identityEmailAddress.isNotEmpty) {
|
||||
synchronizeOwnEmailAddress(identityEmailAddress);
|
||||
} else {
|
||||
synchronizeOwnEmailAddress(sessionCurrent?.getUserDisplayName() ?? '');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,6 @@ import 'package:jmap_dart_client/jmap/core/capability/capability_identifier.dart
|
||||
import 'package:jmap_dart_client/jmap/core/session/session.dart';
|
||||
import 'package:jmap_dart_client/jmap/identities/identity.dart';
|
||||
import 'package:model/extensions/identity_request_dto_extension.dart';
|
||||
import 'package:model/extensions/session_extension.dart';
|
||||
import 'package:tmail_ui_user/features/base/before_reconnect_handler.dart';
|
||||
import 'package:tmail_ui_user/features/base/before_reconnect_manager.dart';
|
||||
import 'package:tmail_ui_user/features/base/mixin/message_dialog_action_manager.dart';
|
||||
@@ -40,7 +39,6 @@ import 'package:tmail_ui_user/features/manage_account/domain/usecases/edit_ident
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/get_all_identities_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/transform_list_signature_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/identity_extension.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/update_own_email_address_extension.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/list_identity_extension.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/manage_account_dashboard_controller.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/identity_action_type.dart';
|
||||
@@ -142,6 +140,7 @@ class IdentitiesController extends ReloadableController implements BeforeReconne
|
||||
void handleFailureViewState(Failure failure) {
|
||||
if (failure is GetAllIdentitiesFailure) {
|
||||
identitiesViewState.value = Left(failure);
|
||||
accountDashBoardController.updateOwnEmailAddressFromIdentities([]);
|
||||
} else if (failure is DeleteIdentityFailure) {
|
||||
_deleteIdentityFailure(failure);
|
||||
} else if (failure is RemoveIdentityFromPublicAssetsFailureState) {
|
||||
@@ -150,10 +149,6 @@ class IdentitiesController extends ReloadableController implements BeforeReconne
|
||||
_deleteIdentityAction(failure.identityId);
|
||||
} else if (failure is GetIdentityCacheOnWebFailure) {
|
||||
_removeIdentityCache();
|
||||
} else if (failure is GetAllIdentitiesFailure) {
|
||||
accountDashBoardController.synchronizeOwnEmailAddress(
|
||||
accountDashBoardController.sessionCurrent?.getUserDisplayName() ?? '',
|
||||
);
|
||||
} else if (failure is TransformListSignatureFailure) {
|
||||
signatureViewState.value = Left(failure);
|
||||
_syncMapIdentitySignatures(failure.identitySignatures);
|
||||
@@ -204,7 +199,7 @@ class IdentitiesController extends ReloadableController implements BeforeReconne
|
||||
|
||||
_transformSignature();
|
||||
}
|
||||
|
||||
|
||||
bool _validateIdentity(Identity identity) {
|
||||
return identity.mayDelete == true &&
|
||||
identity.name?.trim().isNotEmpty == true;
|
||||
@@ -228,7 +223,11 @@ class IdentitiesController extends ReloadableController implements BeforeReconne
|
||||
final accountId = accountDashBoardController.accountId.value;
|
||||
final session = accountDashBoardController.sessionCurrent;
|
||||
if (accountId != null && session != null) {
|
||||
final arguments = IdentityCreatorArguments(accountId, session);
|
||||
final arguments = IdentityCreatorArguments(
|
||||
accountId,
|
||||
session,
|
||||
accountDashBoardController.ownEmailAddress.value,
|
||||
);
|
||||
|
||||
newIdentityArguments = PlatformInfo.isWeb
|
||||
? await DialogRouter.pushGeneralDialog(routeName: AppRoutes.identityCreator, arguments: arguments)
|
||||
@@ -378,6 +377,7 @@ class IdentitiesController extends ReloadableController implements BeforeReconne
|
||||
final arguments = IdentityCreatorArguments(
|
||||
accountId,
|
||||
session,
|
||||
accountDashBoardController.ownEmailAddress.value,
|
||||
identity: identity,
|
||||
actionType: IdentityActionType.edit);
|
||||
|
||||
@@ -474,6 +474,7 @@ class IdentitiesController extends ReloadableController implements BeforeReconne
|
||||
final arguments = IdentityCreatorArguments(
|
||||
accountId,
|
||||
session,
|
||||
accountDashBoardController.ownEmailAddress.value,
|
||||
identity: identityCache.identity,
|
||||
isDefault: identityCache.isDefault,
|
||||
publicAssetsInIdentityArguments: identityCache.publicAssetsInIdentityArguments,
|
||||
|
||||
@@ -14,6 +14,7 @@ import 'package:model/model.dart';
|
||||
import 'package:rule_filter/rule_filter/capability_rule_filter.dart';
|
||||
import 'package:server_settings/server_settings/capability_server_settings.dart';
|
||||
import 'package:tmail_ui_user/features/base/action/ui_action.dart';
|
||||
import 'package:tmail_ui_user/features/base/mixin/own_email_address_mixin.dart';
|
||||
import 'package:tmail_ui_user/features/base/reloadable/reloadable_controller.dart';
|
||||
import 'package:tmail_ui_user/features/base/widget/dialog_picker/color_dialog_picker.dart';
|
||||
import 'package:tmail_ui_user/features/base/widget/dialog_picker/date_time_dialog_picker.dart';
|
||||
@@ -26,7 +27,6 @@ import 'package:tmail_ui_user/features/manage_account/domain/usecases/update_vac
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/action/dashboard_setting_action.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/email_rules/bindings/email_rules_bindings.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/export_trace_log_extension.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/update_own_email_address_extension.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/vacation_response_extension.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/forward/bindings/forward_bindings.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/identities/identity_bindings.dart';
|
||||
@@ -46,7 +46,8 @@ import 'package:tmail_ui_user/main/routes/route_navigation.dart';
|
||||
import 'package:tmail_ui_user/main/routes/route_utils.dart';
|
||||
import 'package:tmail_ui_user/main/utils/app_config.dart';
|
||||
|
||||
class ManageAccountDashBoardController extends ReloadableController {
|
||||
class ManageAccountDashBoardController extends ReloadableController
|
||||
with OwnEmailAddressMixin {
|
||||
|
||||
GetAllVacationInteractor? _getAllVacationInteractor;
|
||||
UpdateVacationInteractor? _updateVacationInteractor;
|
||||
@@ -56,9 +57,7 @@ class ManageAccountDashBoardController extends ReloadableController {
|
||||
final settingsPageLevel = SettingsPageLevel.universal.obs;
|
||||
final vacationResponse = Rxn<VacationResponse>();
|
||||
final dashboardSettingAction = Rxn<UIAction>();
|
||||
final ownEmailAddress = Rx<String>('');
|
||||
|
||||
Session? sessionCurrent;
|
||||
Uri? previousUri;
|
||||
int minInputLengthAutocomplete = AppConfig.defaultMinInputLengthAutocomplete;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:cozy/cozy_config_manager/cozy_config_manager.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_portal/flutter_portal.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:model/extensions/session_extension.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/profile_setting/profile_setting_action_type.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/navigation_bar/navigation_bar_widget.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/email_rules/email_rules_view.dart';
|
||||
@@ -40,25 +41,36 @@ class ManageAccountDashBoardView extends GetWidget<ManageAccountDashBoardControl
|
||||
responsiveUtils: controller.responsiveUtils,
|
||||
desktop: Column(children: [
|
||||
FutureBuilder(
|
||||
future: CozyConfigManager().isInsideCozy,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.data == true) return const SizedBox.shrink();
|
||||
future: CozyConfigManager().isInsideCozy,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.data == true) return const SizedBox.shrink();
|
||||
|
||||
return Obx(() => NavigationBarWidget(
|
||||
imagePaths: controller.imagePaths,
|
||||
accountId: controller.accountId.value,
|
||||
ownEmailAddress: controller.ownEmailAddress.value,
|
||||
onTapApplicationLogoAction: () =>
|
||||
controller.backToMailboxDashBoard(context: context),
|
||||
settingActionTypes: const [ProfileSettingActionType.signOut],
|
||||
onProfileSettingActionTypeClick: (actionType) =>
|
||||
controller.handleProfileSettingActionTypeClick(
|
||||
context: context,
|
||||
actionType: actionType,
|
||||
),
|
||||
));
|
||||
}
|
||||
),
|
||||
return Obx(() {
|
||||
final accountId = controller.accountId.value;
|
||||
String accountDisplayName = controller.ownEmailAddress.value;
|
||||
|
||||
if (accountDisplayName.trim().isEmpty) {
|
||||
accountDisplayName = controller
|
||||
.sessionCurrent
|
||||
?.getOwnEmailAddressOrUsername() ?? '';
|
||||
}
|
||||
|
||||
return NavigationBarWidget(
|
||||
imagePaths: controller.imagePaths,
|
||||
accountId: accountId,
|
||||
ownEmailAddress: accountDisplayName,
|
||||
onTapApplicationLogoAction: () =>
|
||||
controller.backToMailboxDashBoard(context: context),
|
||||
settingActionTypes: const [ProfileSettingActionType.signOut],
|
||||
onProfileSettingActionTypeClick: (actionType) =>
|
||||
controller.handleProfileSettingActionTypeClick(
|
||||
context: context,
|
||||
actionType: actionType,
|
||||
),
|
||||
);
|
||||
});
|
||||
},
|
||||
),
|
||||
Expanded(child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
@@ -6,6 +6,8 @@ import 'package:core/utils/direction_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/home/domain/extensions/session_extensions.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/profile_setting/profile_setting_action_type.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/handle_profile_setting_action_type_click_extension.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/menu/manage_account_menu_controller.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/menu/widgets/account_menu_item_tile_builder.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/account_menu_item.dart';
|
||||
@@ -140,11 +142,11 @@ class ManageAccountMenuView extends GetWidget<ManageAccountMenuController> {
|
||||
top: 4,
|
||||
),
|
||||
onSelectAccountMenuItemAction: (_) {
|
||||
controller.dashBoardController.logout(
|
||||
context,
|
||||
controller.dashBoardController.sessionCurrent,
|
||||
controller.dashBoardController.accountId.value,
|
||||
);
|
||||
controller.dashBoardController
|
||||
.handleProfileSettingActionTypeClick(
|
||||
context: context,
|
||||
actionType: ProfileSettingActionType.signOut,
|
||||
);
|
||||
}
|
||||
),
|
||||
]
|
||||
|
||||
+28
-13
@@ -2,8 +2,11 @@ import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/utils/platform_info.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:model/extensions/session_extension.dart';
|
||||
import 'package:tmail_ui_user/features/home/domain/extensions/session_extensions.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/widgets/user_information_widget.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/profile_setting/profile_setting_action_type.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/handle_profile_setting_action_type_click_extension.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/menu/settings/settings_controller.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/menu/settings_utils.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/menu/widgets/setting_first_level_tile_builder.dart';
|
||||
@@ -19,17 +22,27 @@ class SettingsFirstLevelView extends GetWidget<SettingsController> {
|
||||
return SingleChildScrollView(
|
||||
key: const Key('setting_menu'),
|
||||
child: Column(children: [
|
||||
Obx(() => UserInformationWidget(
|
||||
ownEmailAddress: controller
|
||||
Obx(() {
|
||||
String accountDisplayName = controller
|
||||
.manageAccountDashboardController
|
||||
.ownEmailAddress
|
||||
.value,
|
||||
padding: SettingsUtils.getPaddingInFirstLevel(
|
||||
context,
|
||||
controller.responsiveUtils,
|
||||
),
|
||||
titlePadding: const EdgeInsetsDirectional.only(start: 16),
|
||||
)),
|
||||
.value;
|
||||
|
||||
if (accountDisplayName.trim().isEmpty) {
|
||||
accountDisplayName = controller
|
||||
.manageAccountDashboardController
|
||||
.sessionCurrent
|
||||
?.getOwnEmailAddressOrUsername() ?? '';
|
||||
}
|
||||
return UserInformationWidget(
|
||||
ownEmailAddress: accountDisplayName,
|
||||
padding: SettingsUtils.getPaddingInFirstLevel(
|
||||
context,
|
||||
controller.responsiveUtils,
|
||||
),
|
||||
titlePadding: const EdgeInsetsDirectional.only(start: 16),
|
||||
);
|
||||
}),
|
||||
Divider(
|
||||
color: AppColor.colorDividerHorizontal,
|
||||
height: 1,
|
||||
@@ -222,10 +235,12 @@ class SettingsFirstLevelView extends GetWidget<SettingsController> {
|
||||
SettingFirstLevelTileBuilder(
|
||||
AppLocalizations.of(context).sign_out,
|
||||
controller.imagePaths.icSignOut,
|
||||
() => controller.manageAccountDashboardController.logout(
|
||||
context,
|
||||
controller.manageAccountDashboardController.sessionCurrent,
|
||||
controller.manageAccountDashboardController.accountId.value)
|
||||
() => controller
|
||||
.manageAccountDashboardController
|
||||
.handleProfileSettingActionTypeClick(
|
||||
context: context,
|
||||
actionType: ProfileSettingActionType.signOut,
|
||||
)
|
||||
),
|
||||
]),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user