Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] UI update

Aman Raj Singh Mourya4ad8d0c0fd91
diff --git a/mobile/assets/2.0x/loading_photos_background_fullscreen.png b/mobile/assets/2.0x/loading_photos_background_fullscreen.png
new file mode 100644
index 0000000000..23f53f2b6b
Binary files /dev/null and b/mobile/assets/2.0x/loading_photos_background_fullscreen.png differ
diff --git a/mobile/assets/3.0x/loading_photos_background_fullscreen.png b/mobile/assets/3.0x/loading_photos_background_fullscreen.png
new file mode 100644
index 0000000000..0553815666
Binary files /dev/null and b/mobile/assets/3.0x/loading_photos_background_fullscreen.png differ
diff --git a/mobile/lib/ui/settings/lockscreen/lockscreen_confirm_password.dart b/mobile/lib/ui/settings/lockscreen/lockscreen_confirm_password.dart
index 1ab2861c57..dbf07f5cf6 100644
--- a/mobile/lib/ui/settings/lockscreen/lockscreen_confirm_password.dart
+++ b/mobile/lib/ui/settings/lockscreen/lockscreen_confirm_password.dart
@@ -108,28 +108,49 @@ class _LockScreenConfirmPasswordState extends State<LockScreenConfirmPassword> {
height: 120,
width: 120,
child: Stack(
+ alignment: Alignment.center,
children: [
- Align(
- alignment: Alignment.center,
- child: SizedBox(
- height: 75,
- width: 75,
- child: CircularProgressIndicator(
- backgroundColor: colorTheme.fillStrong,
- value: 1,
- strokeWidth: 1.5,
+ Container(
+ width: 82,
+ height: 82,
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ gradient: LinearGradient(
+ colors: [
+ Colors.grey.shade500.withOpacity(0.2),
+ Colors.grey.shade50.withOpacity(0.1),
+ Colors.grey.shade400.withOpacity(0.2),
+ Colors.grey.shade300.withOpacity(0.4),
+ ],
+ begin: Alignment.topCenter,
+ end: Alignment.bottomCenter,
+ ),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.all(1.0),
+ child: Container(
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ color: colorTheme.backgroundBase,
+ ),
),
),
),
- Align(
- alignment: Alignment.center,
- child: IconButtonWidget(
- size: 30,
- icon: Icons.lock,
- iconButtonType: IconButtonType.primary,
- iconColor: colorTheme.tabIcon,
+ SizedBox(
+ height: 75,
+ width: 75,
+ child: CircularProgressIndicator(
+ backgroundColor: colorTheme.fillStrong,
+ value: 1,
+ strokeWidth: 1.5,
),
),
+ IconButtonWidget(
+ size: 30,
+ icon: Icons.lock,
+ iconButtonType: IconButtonType.primary,
+ iconColor: colorTheme.tabIcon,
+ ),
],
),
),
diff --git a/mobile/lib/ui/settings/lockscreen/lockscreen_confirm_pin.dart b/mobile/lib/ui/settings/lockscreen/lockscreen_confirm_pin.dart
index fae5264c5f..412cfcce84 100644
--- a/mobile/lib/ui/settings/lockscreen/lockscreen_confirm_pin.dart
+++ b/mobile/lib/ui/settings/lockscreen/lockscreen_confirm_pin.dart
@@ -16,7 +16,7 @@ class LockScreenConfirmPin extends StatefulWidget {
class _LockScreenConfirmPinState extends State<LockScreenConfirmPin> {
final _confirmPinController = TextEditingController(text: null);
-
+ bool isConfirmPinValid = false;
final LockscreenSetting _lockscreenSetting = LockscreenSetting.instance;
final _pinPutDecoration = PinTheme(
height: 48,
@@ -55,8 +55,15 @@ class _LockScreenConfirmPinState extends State<LockScreenConfirmPin> {
Navigator.of(context).pop(true);
return;
}
+ setState(() {
+ isConfirmPinValid = true;
+ });
await HapticFeedback.vibrate();
+ await Future.delayed(const Duration(milliseconds: 75));
_confirmPinController.clear();
+ setState(() {
+ isConfirmPinValid = false;
+ });
}
@override
@@ -97,43 +104,64 @@ class _LockScreenConfirmPinState extends State<LockScreenConfirmPin> {
height: 120,
width: 120,
child: Stack(
+ alignment: Alignment.center,
children: [
- Align(
- alignment: Alignment.center,
- child: SizedBox(
- height: 75,
- width: 75,
- child: ValueListenableBuilder(
- valueListenable: _confirmPinController,
- builder: (context, value, child) {
- return TweenAnimationBuilder<double>(
- tween: Tween<double>(
- begin: 0,
- end: _confirmPinController.text.length / 4,
- ),
- curve: Curves.ease,
- duration: const Duration(milliseconds: 250),
- builder: (context, value, _) =>
- CircularProgressIndicator(
- backgroundColor: colorTheme.fillStrong,
- value: value,
- color: colorTheme.primary400,
- strokeWidth: 1.5,
- ),
- );
- },
+ Container(
+ width: 82,
+ height: 82,
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ gradient: LinearGradient(
+ colors: [
+ Colors.grey.shade500.withOpacity(0.2),
+ Colors.grey.shade50.withOpacity(0.1),
+ Colors.grey.shade400.withOpacity(0.2),
+ Colors.grey.shade300.withOpacity(0.4),
+ ],
+ begin: Alignment.topCenter,
+ end: Alignment.bottomCenter,
+ ),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.all(1.0),
+ child: Container(
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ color: colorTheme.backgroundBase,
+ ),
),
),
),
- Align(
- alignment: Alignment.center,
- child: IconButtonWidget(
- size: 30,
- icon: Icons.lock,
- iconButtonType: IconButtonType.primary,
- iconColor: colorTheme.tabIcon,
+ SizedBox(
+ height: 75,
+ width: 75,
+ child: ValueListenableBuilder(
+ valueListenable: _confirmPinController,
+ builder: (context, value, child) {
+ return TweenAnimationBuilder<double>(
+ tween: Tween<double>(
+ begin: 0,
+ end: _confirmPinController.text.length / 4,
+ ),
+ curve: Curves.ease,
+ duration: const Duration(milliseconds: 250),
+ builder: (context, value, _) =>
+ CircularProgressIndicator(
+ backgroundColor: colorTheme.fillStrong,
+ value: value,
+ color: colorTheme.primary400,
+ strokeWidth: 1.5,
+ ),
+ );
+ },
),
),
+ IconButtonWidget(
+ size: 30,
+ icon: Icons.lock,
+ iconButtonType: IconButtonType.primary,
+ iconColor: colorTheme.tabIcon,
+ ),
],
),
),
@@ -144,7 +172,7 @@ class _LockScreenConfirmPinState extends State<LockScreenConfirmPin> {
const Padding(padding: EdgeInsets.all(12)),
Pinput(
length: 4,
- pinputAutovalidateMode: PinputAutovalidateMode.onSubmit,
+ useNativeKeyboard: false,
controller: _confirmPinController,
defaultPinTheme: _pinPutDecoration,
submittedPinTheme: _pinPutDecoration.copyWith(
@@ -169,7 +197,7 @@ class _LockScreenConfirmPinState extends State<LockScreenConfirmPin> {
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
border: Border.all(
- color: colorTheme.fillBase,
+ color: colorTheme.warning400,
),
),
textStyle:
@@ -178,12 +206,7 @@ class _LockScreenConfirmPinState extends State<LockScreenConfirmPin> {
errorText: '',
obscureText: true,
obscuringCharacter: '*',
- validator: (value) {
- if (value == widget.pin) {
- return null;
- }
- return 'PIN does not match';
- },
+ forceErrorState: isConfirmPinValid,
onCompleted: (value) async {
await _confirmPinMatch();
},
diff --git a/mobile/lib/ui/settings/lockscreen/lockscreen_password.dart b/mobile/lib/ui/settings/lockscreen/lockscreen_password.dart
index 935235af13..b3a60d32f5 100644
--- a/mobile/lib/ui/settings/lockscreen/lockscreen_password.dart
+++ b/mobile/lib/ui/settings/lockscreen/lockscreen_password.dart
@@ -161,28 +161,49 @@ class _LockScreenPasswordState extends State<LockScreenPassword> {
height: 120,
width: 120,
child: Stack(
+ alignment: Alignment.center,
children: [
- Align(
- alignment: Alignment.center,
- child: SizedBox(
- height: 75,
- width: 75,
- child: CircularProgressIndicator(
- backgroundColor: colorTheme.fillStrong,
- value: 1,
- strokeWidth: 1.5,
+ Container(
+ width: 82,
+ height: 82,
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ gradient: LinearGradient(
+ colors: [
+ Colors.grey.shade500.withOpacity(0.2),
+ Colors.grey.shade50.withOpacity(0.1),
+ Colors.grey.shade400.withOpacity(0.2),
+ Colors.grey.shade300.withOpacity(0.4),
+ ],
+ begin: Alignment.topCenter,
+ end: Alignment.bottomCenter,
+ ),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.all(1.0),
+ child: Container(
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ color: colorTheme.backgroundBase,
+ ),
),
),
),
- Align(
- alignment: Alignment.center,
- child: IconButtonWidget(
- size: 30,
- icon: Icons.lock,
- iconButtonType: IconButtonType.primary,
- iconColor: colorTheme.tabIcon,
+ SizedBox(
+ height: 75,
+ width: 75,
+ child: CircularProgressIndicator(
+ backgroundColor: colorTheme.fillStrong,
+ value: 1,
+ strokeWidth: 1.5,
),
),
+ IconButtonWidget(
+ size: 30,
+ icon: Icons.lock,
+ iconButtonType: IconButtonType.primary,
+ iconColor: colorTheme.tabIcon,
+ ),
],
),
),
diff --git a/mobile/lib/ui/settings/lockscreen/lockscreen_pin.dart b/mobile/lib/ui/settings/lockscreen/lockscreen_pin.dart
index c96726e246..ee5dc24cd8 100644
--- a/mobile/lib/ui/settings/lockscreen/lockscreen_pin.dart
+++ b/mobile/lib/ui/settings/lockscreen/lockscreen_pin.dart
@@ -172,43 +172,64 @@ class _LockScreenPinState extends State<LockScreenPin> {
height: 120,
width: 120,
child: Stack(
+ alignment: Alignment.center,
children: [
- Align(
- alignment: Alignment.center,
- child: SizedBox(
- height: 75,
- width: 75,
- child: ValueListenableBuilder(
- valueListenable: _pinController,
- builder: (context, value, child) {
- return TweenAnimationBuilder<double>(
- tween: Tween<double>(
- begin: 0,
- end: _pinController.text.length / 4,
- ),
- curve: Curves.ease,
- duration: const Duration(milliseconds: 250),
- builder: (context, value, _) =>
- CircularProgressIndicator(
- backgroundColor: colorTheme.fillStrong,
- value: value,
- color: colorTheme.primary400,
- strokeWidth: 1.5,
- ),
- );
- },
+ Container(
+ width: 82,
+ height: 82,
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ gradient: LinearGradient(
+ colors: [
+ Colors.grey.shade500.withOpacity(0.2),
+ Colors.grey.shade50.withOpacity(0.1),
+ Colors.grey.shade400.withOpacity(0.2),
+ Colors.grey.shade300.withOpacity(0.4),
+ ],
+ begin: Alignment.topCenter,
+ end: Alignment.bottomCenter,
+ ),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.all(1.0),
+ child: Container(
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ color: colorTheme.backgroundBase,
+ ),
),
),
),
- Align(
- alignment: Alignment.center,
- child: IconButtonWidget(
- size: 30,
- icon: Icons.lock,
- iconButtonType: IconButtonType.primary,
- iconColor: colorTheme.tabIcon,
+ SizedBox(
+ height: 75,
+ width: 75,
+ child: ValueListenableBuilder(
+ valueListenable: _pinController,
+ builder: (context, value, child) {
+ return TweenAnimationBuilder<double>(
+ tween: Tween<double>(
+ begin: 0,
+ end: _pinController.text.length / 4,
+ ),
+ curve: Curves.ease,
+ duration: const Duration(milliseconds: 250),
+ builder: (context, value, _) =>
+ CircularProgressIndicator(
+ backgroundColor: colorTheme.fillStrong,
+ value: value,
+ color: colorTheme.primary400,
+ strokeWidth: 1.5,
+ ),
+ );
+ },
),
),
+ IconButtonWidget(
+ size: 30,
+ icon: Icons.lock,
+ iconButtonType: IconButtonType.primary,
+ iconColor: colorTheme.tabIcon,
+ ),
],
),
),
@@ -255,7 +276,6 @@ class _LockScreenPinState extends State<LockScreenPin> {
obscuringCharacter: '*',
errorText: '',
onCompleted: (value) async {
- await Future.delayed(const Duration(milliseconds: 250));
await _confirmPin(_pinController.text);
},
),
diff --git a/mobile/lib/ui/tools/lock_screen.dart b/mobile/lib/ui/tools/lock_screen.dart
index 636a9d5a0e..046abc3fa7 100644
--- a/mobile/lib/ui/tools/lock_screen.dart
+++ b/mobile/lib/ui/tools/lock_screen.dart
@@ -3,13 +3,17 @@ import "dart:io";
import "dart:math";
import 'package:flutter/material.dart';
+import "package:flutter_animate/flutter_animate.dart";
import 'package:logging/logging.dart';
+import "package:photos/core/configuration.dart";
+import "package:photos/ente_theme_data.dart";
+import "package:photos/generated/l10n.dart";
import "package:photos/l10n/l10n.dart";
import "package:photos/theme/ente_theme.dart";
-import 'package:photos/ui/common/gradient_button.dart';
import "package:photos/ui/components/buttons/icon_button_widget.dart";
import 'package:photos/ui/tools/app_lock.dart';
import 'package:photos/utils/auth_util.dart';
+import "package:photos/utils/dialog_util.dart";
import "package:photos/utils/lockscreen_setting.dart";
class LockScreen extends StatefulWidget {
@@ -30,16 +34,7 @@ class _LockScreenState extends State<LockScreen>
int lockedTime = 0;
int invalidAttemptCount = 0;
int remainingTime = 0;
- bool showErrorMessage = true;
final _lockscreenSetting = LockscreenSetting.instance;
- late final AnimationController _controller = AnimationController(
- duration: const Duration(milliseconds: 500),
- vsync: this,
- );
- late final animation = CurvedAnimation(
- parent: _controller,
- curve: Curves.easeInOut,
- );
@override
void initState() {
@@ -59,6 +54,7 @@ class _LockScreenState extends State<LockScreen>
@override
Widget build(BuildContext context) {
final colorTheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
return Scaffold(
body: Container(
decoration: const BoxDecoration(
@@ -70,113 +66,100 @@ class _LockScreenState extends State<LockScreen>
),
),
child: Center(
- child: isTimerRunning
- ? Column(
+ child: Column(
+ children: [
+ const Spacer(),
+ SizedBox(
+ height: 120,
+ width: 120,
+ child: Stack(
+ alignment: Alignment.center,
children: [
- const Spacer(),
- SizedBox(
- height: 120,
- width: 120,
- child: Stack(
- children: [
- Align(
- alignment: Alignment.center,
- child: Container(
- width: 82,
- height: 82,
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- gradient: LinearGradient(
- colors: [
- Colors.white70.withOpacity(0.2),
- Colors.white10.withOpacity(0.2),
- Colors.white70.withOpacity(0.4),
- Colors.white60.withOpacity(0.8),
- ],
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- ),
- ),
- child: Padding(
- padding: const EdgeInsets.all(1.0),
- child: Container(
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- color: colorTheme.backgroundBase,
- ),
- ),
- ),
- ),
- ),
- Align(
- alignment: Alignment.center,
- child: SizedBox(
- height: 75,
- width: 75,
- child: TweenAnimationBuilder<double>(
- tween: Tween<double>(
- begin: 0,
- end: calculateRemainingTime(),
- ),
- curve: Curves.ease,
- duration: const Duration(milliseconds: 50),
- builder: (context, value, _) =>
- CircularProgressIndicator(
- backgroundColor: colorTheme.backdropBase,
- value: value,
- color: colorTheme.primary400,
- strokeWidth: 1.5,
- ),
- ),
- ),
- ),
- Align(
- alignment: Alignment.center,
- child: IconButtonWidget(
- size: 30,
- icon: Icons.lock,
- iconButtonType: IconButtonType.primary,
- iconColor: colorTheme.tabIcon,
- ),
+ Container(
+ width: 82,
+ height: 82,
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ gradient: LinearGradient(
+ colors: [
+ Colors.grey.shade500.withOpacity(0.2),
+ Colors.grey.shade50.withOpacity(0.1),
+ Colors.grey.shade400.withOpacity(0.2),
+ Colors.grey.shade300.withOpacity(0.4),
+ ],
+ begin: Alignment.topCenter,
+ end: Alignment.bottomCenter,
+ ),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.all(1.0),
+ child: Container(
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ color: colorTheme.backgroundBase,
),
- ],
+ ),
),
),
- const Spacer(),
- AnimatedSwitcher(
- duration: const Duration(seconds: 1),
- transitionBuilder:
- (Widget child, Animation<double> animation) {
- return FadeTransition(opacity: animation, child: child);
- },
- child: showErrorMessage
- ? const Text(
- "Too many incorrect attempts",
- key: ValueKey<int>(1),
- )
- : Text(
- formatTime(remainingTime),
- key: const ValueKey<int>(2),
- ),
- ),
- ],
- )
- : Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
SizedBox(
- width: 180,
- child: GradientButton(
- text: context.l10n.unlock,
- iconData: Icons.lock_open_outlined,
- onTap: () async {
- await _showLockScreen(source: "tapUnlock");
- },
+ height: 75,
+ width: 75,
+ child: TweenAnimationBuilder<double>(
+ tween: Tween<double>(
+ begin: 0,
+ end: calculateRemainingTime(),
+ ),
+ curve: Curves.ease,
+ duration: const Duration(milliseconds: 50),
+ builder: (context, value, _) =>
+ CircularProgressIndicator(
+ backgroundColor: colorTheme.fillFaintPressed,
+ value: value,
+ color: colorTheme.primary400,
+ strokeWidth: 1.5,
+ ),
),
),
+ IconButtonWidget(
+ size: 30,
+ icon: Icons.lock,
+ iconButtonType: IconButtonType.primary,
+ iconColor: colorTheme.tabIcon,
+ ),
],
),
+ ),
+ const Spacer(),
+ isTimerRunning
+ ? Stack(
+ alignment: Alignment.center,
+ children: [
+ Text(
+ "Too many incorrect attempts",
+ style: textTheme.body,
+ )
+ .animate(delay: const Duration(milliseconds: 2000))
+ .fadeOut(duration: 400.ms),
+ Text(
+ formatTime(remainingTime),
+ style: textTheme.body,
+ )
+ .animate(delay: const Duration(milliseconds: 2250))
+ .fadeIn(duration: 400.ms),
+ ],
+ )
+ : GestureDetector(
+ onTap: () => _showLockScreen(source: "tap"),
+ child: Text(
+ "Tap to unlock",
+ style: textTheme.body,
+ ),
+ ),
+ const Padding(
+ padding: EdgeInsets.only(bottom: 20),
+ ),
+ ],
+ ),
),
),
);
@@ -190,6 +173,39 @@ class _LockScreenState extends State<LockScreen>
return shortestSide > 600 ? true : false;
}
+ Future<void> _autoLogoutOnMaxInvalidAttempts() async {
+ final AlertDialog alert = AlertDialog(
+ title: const Text("Too many incorrect attempts"),
+ content: Text(S.of(context).pleaseLoginAgain),
+ actions: [
+ TextButton(
+ child: Text(
+ S.of(context).ok,
+ style: TextStyle(
+ color: Theme.of(context).colorScheme.greenAlternative,
+ ),
+ ),
+ onPressed: () async {
+ Navigator.of(context, rootNavigator: true).pop('dialog');
+ Navigator.of(context).popUntil((route) => route.isFirst);
+ final dialog =
+ createProgressDialog(context, S.of(context).loggingOut);
+ await dialog.show();
+ await Configuration.instance.logout();
+ await dialog.hide();
+ },
+ ),
+ ],
+ );
+
+ await showDialog(
+ context: context,
+ builder: (BuildContext context) {
+ return alert;
+ },
+ );
+ }
+
@override
Future<void> didChangeAppLifecycleState(AppLifecycleState state) async {
_logger.info(state.toString());
@@ -230,7 +246,6 @@ class _LockScreenState extends State<LockScreen>
@override
void dispose() {
_logger.info('disposing');
- _controller.dispose();
WidgetsBinding.instance.removeObserver(this);
super.dispose();
}
@@ -314,15 +329,16 @@ class _LockScreenState extends State<LockScreen>
invalidAttemptCount !=
_lockscreenSetting.getInvalidAttemptCount()) {
invalidAttemptCount = _lockscreenSetting.getInvalidAttemptCount();
+
+ if (invalidAttemptCount > 9) {
+ await _autoLogoutOnMaxInvalidAttempts();
+ return;
+ }
+
lockedTime = pow(2, invalidAttemptCount - 5).toInt() * 30;
await _lockscreenSetting.setLastInvalidAttemptTime(
DateTime.now().millisecondsSinceEpoch + lockedTime * 1000,
);
- Timer(const Duration(seconds: 2), () {
- setState(() {
- showErrorMessage = false;
- });
- });
await startLockTimer(lockedTime);
}
_hasAuthenticationFailed = true;