Skip to content

Commit 337a3ff

Browse files
fixup! Fix back button when app is inside Cozy
1 parent 45b40cf commit 337a3ff

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2937,13 +2937,10 @@ class MailboxDashBoardController extends ReloadableController
29372937
log('MailboxDashBoardController::_navigateToScreen: dashboardRoute: $dashboardRoute');
29382938
switch(dashboardRoute.value) {
29392939
case DashboardRoutes.threadDetailed:
2940-
if (PlatformInfo.isMobile) {
2941-
if (currentContext != null && canBack(currentContext!)) {
2942-
return false;
2943-
} else {
2944-
clearSelectedEmail();
2945-
return true;
2946-
}
2940+
if (PlatformInfo.isMobile &&
2941+
currentContext != null &&
2942+
canBack(currentContext!)) {
2943+
return false;
29472944
} else {
29482945
clearSelectedEmail();
29492946
return true;
@@ -3302,8 +3299,15 @@ class MailboxDashBoardController extends ReloadableController
33023299
}
33033300

33043301
Future<void> registerCozyPopState() async {
3305-
final isInsideCozy = await CozyConfigManager().isInsideCozy;
3306-
if (!isInsideCozy) return;
3302+
if (!PlatformInfo.isWeb) return;
3303+
3304+
try {
3305+
final isInsideCozy = await CozyConfigManager().isInsideCozy;
3306+
if (!isInsideCozy) return;
3307+
} catch (e) {
3308+
logError('MailboxDashBoardController::registerCozyPopState::isInsideCozy:Exception = $e');
3309+
return;
3310+
}
33073311

33083312
_popStateDebouncer = Debouncer(
33093313
const Duration(milliseconds: 100),

lib/features/manage_account/presentation/manage_account_dashboard_controller.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,15 @@ class ManageAccountDashBoardController extends ReloadableController {
411411
}
412412

413413
Future<void> registerCozyPopState() async {
414-
final isInsideCozy = await CozyConfigManager().isInsideCozy;
415-
if (!isInsideCozy) return;
414+
if (!PlatformInfo.isWeb) return;
415+
416+
try {
417+
final isInsideCozy = await CozyConfigManager().isInsideCozy;
418+
if (!isInsideCozy) return;
419+
} catch (e) {
420+
logError('ManageAccountDashBoardController::registerCozyPopState::isInsideCozy:Exception = $e');
421+
return;
422+
}
416423

417424
_popStateDebouncer = Debouncer(
418425
const Duration(milliseconds: 100),

0 commit comments

Comments
 (0)