feat: revert removed features
This commit is contained in:
parent
4b3ba41159
commit
47d7238f2b
2 changed files with 122 additions and 116 deletions
|
@ -1,4 +1,5 @@
|
|||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:ente_auth/app/view/app.dart';
|
||||
import 'package:ente_auth/core/configuration.dart';
|
||||
|
@ -7,15 +8,23 @@ import 'package:ente_auth/ente_theme_data.dart';
|
|||
import 'package:ente_auth/events/trigger_logout_event.dart';
|
||||
import "package:ente_auth/l10n/l10n.dart";
|
||||
import 'package:ente_auth/locale.dart';
|
||||
import 'package:ente_auth/theme/text_style.dart';
|
||||
import 'package:ente_auth/ui/account/email_entry_page.dart';
|
||||
import 'package:ente_auth/ui/account/login_page.dart';
|
||||
import 'package:ente_auth/ui/account/logout_dialog.dart';
|
||||
import 'package:ente_auth/ui/account/password_entry_page.dart';
|
||||
import 'package:ente_auth/ui/account/password_reentry_page.dart';
|
||||
import 'package:ente_auth/ui/common/gradient_button.dart';
|
||||
import 'package:ente_auth/ui/components/buttons/button_widget.dart';
|
||||
import 'package:ente_auth/ui/components/models/button_result.dart';
|
||||
import 'package:ente_auth/ui/home_page.dart';
|
||||
import 'package:ente_auth/ui/settings/language_picker.dart';
|
||||
import 'package:ente_auth/utils/dialog_util.dart';
|
||||
import 'package:ente_auth/utils/navigation_util.dart';
|
||||
import 'package:ente_auth/utils/toast_util.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import "package:flutter/material.dart";
|
||||
import 'package:local_auth/local_auth.dart';
|
||||
|
||||
class OnboardingPage extends StatefulWidget {
|
||||
const OnboardingPage({super.key});
|
||||
|
@ -120,16 +129,15 @@ class _OnboardingPageState extends State<OnboardingPage> {
|
|||
],
|
||||
),
|
||||
const SizedBox(height: 100),
|
||||
// TODO: Remove After Stable
|
||||
// Container(
|
||||
// width: double.infinity,
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
// child: GradientButton(
|
||||
// onTap: _navigateToSignUpPage,
|
||||
// text: l10n.newUser,
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(height: 24),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: GradientButton(
|
||||
onTap: _navigateToSignUpPage,
|
||||
text: l10n.newUser,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
Container(
|
||||
height: 56,
|
||||
width: double.infinity,
|
||||
|
@ -151,23 +159,22 @@ class _OnboardingPageState extends State<OnboardingPage> {
|
|||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
// TODO: Remove After Stable
|
||||
// Container(
|
||||
// width: double.infinity,
|
||||
// padding: const EdgeInsets.only(top: 20, bottom: 20),
|
||||
// child: GestureDetector(
|
||||
// onTap: _optForOfflineMode,
|
||||
// child: Center(
|
||||
// child: Text(
|
||||
// l10n.useOffline,
|
||||
// style: body.copyWith(
|
||||
// color:
|
||||
// Theme.of(context).colorScheme.mutedTextColor,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.only(top: 20, bottom: 20),
|
||||
child: GestureDetector(
|
||||
onTap: _optForOfflineMode,
|
||||
child: Center(
|
||||
child: Text(
|
||||
l10n.useOffline,
|
||||
style: body.copyWith(
|
||||
color:
|
||||
Theme.of(context).colorScheme.mutedTextColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -178,69 +185,68 @@ class _OnboardingPageState extends State<OnboardingPage> {
|
|||
);
|
||||
}
|
||||
|
||||
// TODO: Remove After Stable
|
||||
// Future<void> _optForOfflineMode() async {
|
||||
// final canContinue = Platform.isMacOS || Platform.isLinux
|
||||
// ? true
|
||||
// : await LocalAuthentication().canCheckBiometrics;
|
||||
Future<void> _optForOfflineMode() async {
|
||||
final canContinue = Platform.isMacOS || Platform.isLinux
|
||||
? true
|
||||
: await LocalAuthentication().canCheckBiometrics;
|
||||
|
||||
// if (!canContinue) {
|
||||
// showToast(
|
||||
// context,
|
||||
// "Sorry, biometric authentication is not supported on this device.",
|
||||
// );
|
||||
// return;
|
||||
// }
|
||||
// final bool hasOptedBefore = Configuration.instance.hasOptedForOfflineMode();
|
||||
// ButtonResult? result;
|
||||
// if (!hasOptedBefore) {
|
||||
// result = await showChoiceActionSheet(
|
||||
// context,
|
||||
// title: context.l10n.warning,
|
||||
// body: context.l10n.offlineModeWarning,
|
||||
// secondButtonLabel: context.l10n.cancel,
|
||||
// firstButtonLabel: context.l10n.ok,
|
||||
// );
|
||||
// }
|
||||
// if (hasOptedBefore || result?.action == ButtonAction.first) {
|
||||
// await Configuration.instance.optForOfflineMode();
|
||||
// Navigator.of(context).push(
|
||||
// MaterialPageRoute(
|
||||
// builder: (BuildContext context) {
|
||||
// return const HomePage();
|
||||
// },
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
if (!canContinue) {
|
||||
showToast(
|
||||
context,
|
||||
"Sorry, biometric authentication is not supported on this device.",
|
||||
);
|
||||
return;
|
||||
}
|
||||
final bool hasOptedBefore = Configuration.instance.hasOptedForOfflineMode();
|
||||
ButtonResult? result;
|
||||
if (!hasOptedBefore) {
|
||||
result = await showChoiceActionSheet(
|
||||
context,
|
||||
title: context.l10n.warning,
|
||||
body: context.l10n.offlineModeWarning,
|
||||
secondButtonLabel: context.l10n.cancel,
|
||||
firstButtonLabel: context.l10n.ok,
|
||||
);
|
||||
}
|
||||
if (hasOptedBefore || result?.action == ButtonAction.first) {
|
||||
await Configuration.instance.optForOfflineMode();
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return const HomePage();
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// void _navigateToSignUpPage() {
|
||||
// Widget page;
|
||||
// if (Configuration.instance.getEncryptedToken() == null) {
|
||||
// page = const EmailEntryPage();
|
||||
// } else {
|
||||
// // No key
|
||||
// if (Configuration.instance.getKeyAttributes() == null) {
|
||||
// // Never had a key
|
||||
// page = const PasswordEntryPage(
|
||||
// mode: PasswordEntryMode.set,
|
||||
// );
|
||||
// } else if (Configuration.instance.getKey() == null) {
|
||||
// // Yet to decrypt the key
|
||||
// page = const PasswordReentryPage();
|
||||
// } else {
|
||||
// // All is well, user just has not subscribed
|
||||
// page = const HomePage();
|
||||
// }
|
||||
// }
|
||||
// Navigator.of(context).push(
|
||||
// MaterialPageRoute(
|
||||
// builder: (BuildContext context) {
|
||||
// return page;
|
||||
// },
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
void _navigateToSignUpPage() {
|
||||
Widget page;
|
||||
if (Configuration.instance.getEncryptedToken() == null) {
|
||||
page = const EmailEntryPage();
|
||||
} else {
|
||||
// No key
|
||||
if (Configuration.instance.getKeyAttributes() == null) {
|
||||
// Never had a key
|
||||
page = const PasswordEntryPage(
|
||||
mode: PasswordEntryMode.set,
|
||||
);
|
||||
} else if (Configuration.instance.getKey() == null) {
|
||||
// Yet to decrypt the key
|
||||
page = const PasswordReentryPage();
|
||||
} else {
|
||||
// All is well, user just has not subscribed
|
||||
page = const HomePage();
|
||||
}
|
||||
}
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return page;
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _navigateToSignInPage() {
|
||||
Widget page;
|
||||
|
|
|
@ -4,6 +4,7 @@ import 'package:ente_auth/services/user_service.dart';
|
|||
import 'package:ente_auth/theme/ente_theme.dart';
|
||||
import 'package:ente_auth/ui/account/change_email_dialog.dart';
|
||||
import 'package:ente_auth/ui/account/delete_account_page.dart';
|
||||
import 'package:ente_auth/ui/account/password_entry_page.dart';
|
||||
import 'package:ente_auth/ui/components/captioned_text_widget.dart';
|
||||
import 'package:ente_auth/ui/components/expandable_menu_item_widget.dart';
|
||||
import 'package:ente_auth/ui/components/menu_item_widget.dart';
|
||||
|
@ -58,34 +59,33 @@ class AccountSectionWidget extends StatelessWidget {
|
|||
},
|
||||
),
|
||||
sectionOptionSpacing,
|
||||
// TODO: Remove After Stable
|
||||
// MenuItemWidget(
|
||||
// captionedTextWidget: CaptionedTextWidget(
|
||||
// title: l10n.changePassword,
|
||||
// ),
|
||||
// pressedColor: getEnteColorScheme(context).fillFaint,
|
||||
// trailingIcon: Icons.chevron_right_outlined,
|
||||
// trailingIconIsMuted: true,
|
||||
// onTap: () async {
|
||||
// final hasAuthenticated = await LocalAuthenticationService.instance
|
||||
// .requestLocalAuthentication(
|
||||
// context,
|
||||
// l10n.authToChangeYourPassword,
|
||||
// );
|
||||
// if (hasAuthenticated) {
|
||||
// Navigator.of(context).push(
|
||||
// MaterialPageRoute(
|
||||
// builder: (BuildContext context) {
|
||||
// return const PasswordEntryPage(
|
||||
// mode: PasswordEntryMode.update,
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// sectionOptionSpacing,
|
||||
MenuItemWidget(
|
||||
captionedTextWidget: CaptionedTextWidget(
|
||||
title: l10n.changePassword,
|
||||
),
|
||||
pressedColor: getEnteColorScheme(context).fillFaint,
|
||||
trailingIcon: Icons.chevron_right_outlined,
|
||||
trailingIconIsMuted: true,
|
||||
onTap: () async {
|
||||
final hasAuthenticated = await LocalAuthenticationService.instance
|
||||
.requestLocalAuthentication(
|
||||
context,
|
||||
l10n.authToChangeYourPassword,
|
||||
);
|
||||
if (hasAuthenticated) {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return const PasswordEntryPage(
|
||||
mode: PasswordEntryMode.update,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
sectionOptionSpacing,
|
||||
MenuItemWidget(
|
||||
captionedTextWidget: CaptionedTextWidget(
|
||||
title: context.l10n.logout,
|
||||
|
|
Loading…
Add table
Reference in a new issue