Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Add an action within OnboardingPage to access developer settings

vishnukvmd07e48ce31840
diff --git a/auth/lib/l10n/arb/app_en.arb b/auth/lib/l10n/arb/app_en.arb
index 9ac0c98992..b6b8ba7d4c 100644
--- a/auth/lib/l10n/arb/app_en.arb
+++ b/auth/lib/l10n/arb/app_en.arb
@@ -408,5 +408,7 @@
"hearUsExplanation": "We don't track app installs. It'd help if you told us where you found us!",
"waitingForBrowserRequest": "Waiting for browser request...",
"launchPasskeyUrlAgain": "Launch passkey URL again",
- "passkey": "Passkey"
+ "passkey": "Passkey",
+ "developerMode":"Developer mode",
+ "developerModeWarning":"Are you sure that you want to enter Developer mode?"
}
\ No newline at end of file
diff --git a/auth/lib/onboarding/view/onboarding_page.dart b/auth/lib/onboarding/view/onboarding_page.dart
index 78bf4e589d..3c5e8e020b 100644
--- a/auth/lib/onboarding/view/onboarding_page.dart
+++ b/auth/lib/onboarding/view/onboarding_page.dart
@@ -33,8 +33,12 @@ class OnboardingPage extends StatefulWidget {
}
class _OnboardingPageState extends State<OnboardingPage> {
+ static const kDeveloperModeTapCountThreshold = 7;
+
late StreamSubscription<TriggerLogoutEvent> _triggerLogoutEvent;
+ int _developerModeTapCount = 0;
+
@override
void initState() {
_triggerLogoutEvent =
@@ -56,114 +60,134 @@ class _OnboardingPageState extends State<OnboardingPage> {
final l10n = context.l10n;
return Scaffold(
body: SafeArea(
- child: Center(
- child: SingleChildScrollView(
- child: Padding(
- padding:
- const EdgeInsets.symmetric(vertical: 40.0, horizontal: 40),
- child: Column(
- children: [
- Column(
- children: [
- kDebugMode
- ? GestureDetector(
- child: const Align(
- alignment: Alignment.topRight,
- child: Text("Lang"),
- ),
- onTap: () async {
- final locale = await getLocale();
- routeToPage(
- context,
- LanguageSelectorPage(
- appSupportedLocales,
- (locale) async {
- await setLocale(locale);
- App.setLocale(context, locale);
- },
- locale,
+ child: GestureDetector(
+ onTap: () async {
+ _developerModeTapCount++;
+ if (_developerModeTapCount >= kDeveloperModeTapCountThreshold) {
+ _developerModeTapCount = 0;
+ final result = await showChoiceDialog(
+ context,
+ title: l10n.developerMode,
+ firstButtonLabel: l10n.yes,
+ body: l10n.developerModeWarning,
+ isDismissible: false,
+ );
+ if (result?.action == ButtonAction.first) {
+ // TODO: Navigate to developer mode page
+ }
+ }
+ },
+ child: Center(
+ child: SingleChildScrollView(
+ child: Padding(
+ padding:
+ const EdgeInsets.symmetric(vertical: 40.0, horizontal: 40),
+ child: Column(
+ children: [
+ Column(
+ children: [
+ kDebugMode
+ ? GestureDetector(
+ child: const Align(
+ alignment: Alignment.topRight,
+ child: Text("Lang"),
+ ),
+ onTap: () async {
+ final locale = await getLocale();
+ routeToPage(
+ context,
+ LanguageSelectorPage(
+ appSupportedLocales,
+ (locale) async {
+ await setLocale(locale);
+ App.setLocale(context, locale);
+ },
+ locale,
+ ),
+ ).then((value) {
+ setState(() {});
+ });
+ },
+ )
+ : const SizedBox(),
+ Image.asset(
+ "assets/sheild-front-gradient.png",
+ width: 200,
+ height: 200,
+ ),
+ const SizedBox(height: 12),
+ const Text(
+ "ente",
+ style: TextStyle(
+ fontWeight: FontWeight.bold,
+ fontFamily: 'Montserrat',
+ fontSize: 42,
+ ),
+ ),
+ const SizedBox(height: 4),
+ Text(
+ "Authenticator",
+ style: Theme.of(context).textTheme.headlineMedium,
+ ),
+ const SizedBox(height: 32),
+ Text(
+ l10n.onBoardingBody,
+ textAlign: TextAlign.center,
+ style:
+ Theme.of(context).textTheme.titleLarge!.copyWith(
+ color: Colors.white38,
),
- ).then((value) {
- setState(() {});
- });
- },
- )
- : const SizedBox(),
- Image.asset(
- "assets/sheild-front-gradient.png",
- width: 200,
- height: 200,
- ),
- const SizedBox(height: 12),
- const Text(
- "ente",
- style: TextStyle(
- fontWeight: FontWeight.bold,
- fontFamily: 'Montserrat',
- fontSize: 42,
),
+ ],
+ ),
+ const SizedBox(height: 100),
+ Container(
+ width: double.infinity,
+ padding: const EdgeInsets.symmetric(horizontal: 20),
+ child: GradientButton(
+ onTap: _navigateToSignUpPage,
+ text: l10n.newUser,
),
- const SizedBox(height: 4),
- Text(
- "Authenticator",
- style: Theme.of(context).textTheme.headlineMedium,
- ),
- const SizedBox(height: 32),
- Text(
- l10n.onBoardingBody,
- textAlign: TextAlign.center,
- style: Theme.of(context).textTheme.titleLarge!.copyWith(
- color: Colors.white38,
- ),
- ),
- ],
- ),
- const SizedBox(height: 100),
- Container(
- width: double.infinity,
- padding: const EdgeInsets.symmetric(horizontal: 20),
- child: GradientButton(
- onTap: _navigateToSignUpPage,
- text: l10n.newUser,
),
- ),
- const SizedBox(height: 4),
- Container(
- width: double.infinity,
- padding: const EdgeInsets.fromLTRB(20, 12, 20, 0),
- child: Hero(
- tag: "log_in",
- child: ElevatedButton(
- style: Theme.of(context)
- .colorScheme
- .optionalActionButtonStyle,
- onPressed: _navigateToSignInPage,
- child: Text(
- l10n.existingUser,
- style: const TextStyle(
- color: Colors.black, // same for both themes
+ const SizedBox(height: 4),
+ Container(
+ width: double.infinity,
+ padding: const EdgeInsets.fromLTRB(20, 12, 20, 0),
+ child: Hero(
+ tag: "log_in",
+ child: ElevatedButton(
+ style: Theme.of(context)
+ .colorScheme
+ .optionalActionButtonStyle,
+ onPressed: _navigateToSignInPage,
+ child: Text(
+ l10n.existingUser,
+ style: const TextStyle(
+ color: Colors.black, // same for both themes
+ ),
),
),
),
),
- ),
- const SizedBox(height: 4),
- 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,
+ const SizedBox(height: 4),
+ 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,
+ ),
),
),
),
),
- ),
- ],
+ ],
+ ),
),
),
),