TF-1487 Apply linter rule

This commit is contained in:
dab246
2023-02-24 12:12:54 +07:00
committed by Dat Vu
parent 117a8a8fc6
commit 2b71aba278
155 changed files with 798 additions and 1039 deletions
+3 -16
View File
@@ -10,20 +10,7 @@
include: package:flutter_lints/flutter.yaml include: package:flutter_lints/flutter.yaml
linter: linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules: rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule constant_identifier_names: false
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule non_constant_identifier_names: false
unnecessary_string_escapes: false
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
+14 -2
View File
@@ -1,4 +1,16 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml include: package:flutter_lints/flutter.yaml
# Additional information about this file can be found at linter:
# https://dart.dev/guides/language/analysis-options rules:
constant_identifier_names: false
non_constant_identifier_names: false
unnecessary_string_escapes: false
+3 -16
View File
@@ -10,20 +10,7 @@
include: package:flutter_lints/flutter.yaml include: package:flutter_lints/flutter.yaml
linter: linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules: rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule constant_identifier_names: false
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule non_constant_identifier_names: false
unnecessary_string_escapes: false
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
-3
View File
@@ -73,7 +73,6 @@ export 'presentation/views/bottom_popup/confirmation_dialog_action_sheet_builder
export 'presentation/views/modal_sheets/edit_text_modal_sheet_builder.dart'; export 'presentation/views/modal_sheets/edit_text_modal_sheet_builder.dart';
export 'presentation/views/search/search_bar_view.dart'; export 'presentation/views/search/search_bar_view.dart';
export 'presentation/views/popup_menu/popup_menu_item_widget.dart'; export 'presentation/views/popup_menu/popup_menu_item_widget.dart';
export 'presentation/views/tab_bar/custom_tab_indicator.dart';
export 'presentation/views/quick_search/quick_search_input_form.dart'; export 'presentation/views/quick_search/quick_search_input_form.dart';
export 'presentation/views/toast/toast_position.dart'; export 'presentation/views/toast/toast_position.dart';
export 'presentation/views/toast/tmail_toast.dart'; export 'presentation/views/toast/tmail_toast.dart';
@@ -95,8 +94,6 @@ export 'data/network/dio_client.dart';
export 'data/network/download/download_client.dart'; export 'data/network/download/download_client.dart';
export 'data/network/download/download_manager.dart'; export 'data/network/download/download_manager.dart';
export 'data/network/download/downloaded_response.dart'; export 'data/network/download/downloaded_response.dart';
export 'data/network/download/download_client.dart';
export 'domain/exceptions/web_session_exception.dart';
// State // State
export 'presentation/state/success.dart'; export 'presentation/state/success.dart';
@@ -1,5 +1,3 @@
import 'dart:ui' show Color;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
extension AppColor on Color { extension AppColor on Color {
@@ -197,3 +195,12 @@ extension AppColor on Color {
.toUpperCase()}'; .toUpperCase()}';
} }
extension ColorNullableExtension on Color? {
ColorFilter? asFilter({BlendMode? blendMode}) {
if (this == null) {
return null;
} else {
return ColorFilter.mode(this!, blendMode ?? BlendMode.srcIn);
}
}
}
@@ -11,7 +11,7 @@ extension URLExtension on String {
} else if (startsWith(prefixUrlHttp)) { } else if (startsWith(prefixUrlHttp)) {
return kReleaseMode ? replaceAll(prefixUrlHttp, prefixUrlHttps) : this; return kReleaseMode ? replaceAll(prefixUrlHttp, prefixUrlHttps) : this;
} else { } else {
return '$prefixUrlHttps${this}'; return '$prefixUrlHttps$this';
} }
} }
return ''; return '';
+3 -2
View File
@@ -1,7 +1,8 @@
import 'package:core/core.dart'; import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:dartz/dartz.dart'; import 'package:dartz/dartz.dart';
import 'package:meta/meta.dart';
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
@immutable @immutable
abstract class AppState with EquatableMixin { abstract class AppState with EquatableMixin {
+1 -1
View File
@@ -171,7 +171,7 @@ class AppToast {
width: 24, width: 24,
height: 24, height: 24,
fit: BoxFit.fill, fit: BoxFit.fill,
color: iconColor), colorFilter: iconColor.asFilter()),
if (icon != null) if (icon != null)
const SizedBox(width: 10.0), const SizedBox(width: 10.0),
Expanded(child: Text( Expanded(child: Text(
+2 -2
View File
@@ -21,8 +21,8 @@ class ThemeUtils {
static TextTheme get _textTheme { static TextTheme get _textTheme {
return const TextTheme( return const TextTheme(
bodyText1: TextStyle(color: AppColor.baseTextColor), bodyMedium: TextStyle(color: AppColor.baseTextColor),
bodyText2: TextStyle(color: AppColor.baseTextColor), bodySmall: TextStyle(color: AppColor.baseTextColor),
); );
} }
@@ -43,6 +43,7 @@ class BackgroundWidgetBuilder extends StatelessWidget {
return Container( return Container(
color: Colors.transparent, color: Colors.transparent,
padding: const EdgeInsets.symmetric(horizontal: 12), padding: const EdgeInsets.symmetric(horizontal: 12),
height: MediaQuery.of(context).size.height,
child: Column( child: Column(
mainAxisAlignment: responsiveUtils.isLandscapeMobile(context) mainAxisAlignment: responsiveUtils.isLandscapeMobile(context)
? MainAxisAlignment.start ? MainAxisAlignment.start
@@ -83,7 +84,6 @@ class BackgroundWidgetBuilder extends StatelessWidget {
) )
], ],
), ),
height: MediaQuery.of(context).size.height,
); );
} }
} }
@@ -161,7 +161,7 @@ class ButtonBuilder {
width: _size ?? 24, width: _size ?? 24,
height: _size ?? 24, height: _size ?? 24,
fit: BoxFit.fill, fit: BoxFit.fill,
color: _iconColor)); colorFilter: _iconColor.asFilter()));
Widget _buildText() { Widget _buildText() {
return Text( return Text(
@@ -6,7 +6,7 @@ import 'package:flutter_svg/flutter_svg.dart';
typedef IconWebCallback = void Function(); typedef IconWebCallback = void Function();
typedef IconWebHasPositionCallback = void Function(RelativeRect); typedef IconWebHasPositionCallback = void Function(RelativeRect);
typedef OnTapIconButtonCallbackAction = void Function(); typedef OnTapIconButtonCallbackAction = void Function();
typedef OnTapDownIconButtonCallbackAction = void Function(TapDownDetails TapDetails); typedef OnTapDownIconButtonCallbackAction = void Function(TapDownDetails tapDetails);
Widget buildIconWeb({ Widget buildIconWeb({
required Widget icon, required Widget icon,
@@ -51,7 +51,7 @@ Widget buildSVGIconButton({
width: iconSize, width: iconSize,
height: iconSize, height: iconSize,
fit: BoxFit.fill, fit: BoxFit.fill,
color: iconColor, colorFilter: iconColor.asFilter(),
), ),
); );
@@ -107,15 +107,20 @@ Widget buildTextCircleButton(String text, {
shape: const CircleBorder(), shape: const CircleBorder(),
color: Colors.transparent, color: Colors.transparent,
child: TextButton( child: TextButton(
child: Text(
text,
style: textStyle ?? const TextStyle(fontWeight: FontWeight.normal, fontSize: 15, color: AppColor.lineItemListColor)),
style: ButtonStyle( style: ButtonStyle(
overlayColor: MaterialStateProperty.resolveWith<Color>((Set<MaterialState> states) => AppColor.colorFocusButton), overlayColor: MaterialStateProperty.resolveWith<Color>((Set<MaterialState> states) => AppColor.colorFocusButton),
shape: MaterialStateProperty.all(const CircleBorder()), shape: MaterialStateProperty.all(const CircleBorder()),
padding: MaterialStateProperty.resolveWith<EdgeInsets>((Set<MaterialState> states) => EdgeInsets.zero), padding: MaterialStateProperty.resolveWith<EdgeInsets>((Set<MaterialState> states) => EdgeInsets.zero),
elevation: MaterialStateProperty.resolveWith<double>((Set<MaterialState> states) => 0)), elevation: MaterialStateProperty.resolveWith<double>((Set<MaterialState> states) => 0)),
onPressed: () => onTap?.call() onPressed: () => onTap?.call(),
child: Text(
text,
style: textStyle ?? const TextStyle(
fontWeight: FontWeight.normal,
fontSize: 15,
color: AppColor.lineItemListColor
)
)
) )
); );
} }
@@ -166,7 +166,7 @@ class ConfirmDialogBuilder {
height: _heightDialog, height: _heightDialog,
decoration: const BoxDecoration( decoration: const BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: const BorderRadius.all(Radius.circular(16))), borderRadius: BorderRadius.all(Radius.circular(16))),
margin: _margin, margin: _margin,
child: Wrap(children: [ child: Wrap(children: [
if (_onCloseButtonAction != null) if (_onCloseButtonAction != null)
@@ -57,7 +57,7 @@ class ScrollingFloatingButtonAnimated extends StatefulWidget {
: super(key: key); : super(key: key);
@override @override
_ScrollingFloatingButtonAnimatedState createState() => State<ScrollingFloatingButtonAnimated> createState() =>
_ScrollingFloatingButtonAnimatedState(); _ScrollingFloatingButtonAnimatedState();
} }
@@ -93,10 +93,10 @@ class _ScrollingFloatingButtonAnimatedState
/// Function to add listener for scroll /// Function to add listener for scroll
void _handleScroll() { void _handleScroll() {
ScrollController _scrollController = widget.scrollController!; ScrollController scrollController = widget.scrollController!;
_scrollController.addListener(() { scrollController.addListener(() {
if (_scrollController.position.pixels > widget.limitIndicator! && if (scrollController.position.pixels > widget.limitIndicator! &&
_scrollController.position.userScrollDirection == scrollController.position.userScrollDirection ==
ScrollDirection.reverse) { ScrollDirection.reverse) {
if (widget.animateIcon!) _animationController.forward(); if (widget.animateIcon!) _animationController.forward();
if (mounted) { if (mounted) {
@@ -104,8 +104,8 @@ class _ScrollingFloatingButtonAnimatedState
_onTop = false; _onTop = false;
}); });
} }
} else if (_scrollController.position.pixels <= widget.limitIndicator! && } else if (scrollController.position.pixels <= widget.limitIndicator! &&
_scrollController.position.userScrollDirection == scrollController.position.userScrollDirection ==
ScrollDirection.forward) { ScrollDirection.forward) {
if (widget.animateIcon!) _animationController.reverse(); if (widget.animateIcon!) _animationController.reverse();
if (mounted) { if (mounted) {
@@ -145,14 +145,14 @@ class _ScrollingFloatingButtonAnimatedState
Container( Container(
padding: EdgeInsets.only(left: 16, right: _onTop ? 10 : 16), padding: EdgeInsets.only(left: 16, right: _onTop ? 10 : 16),
child: AnimatedBuilder( child: AnimatedBuilder(
child: widget.icon!,
animation: _animationController, animation: _animationController,
builder: (BuildContext context, Widget? _widget) { builder: (BuildContext context, Widget? widget) {
return Transform.rotate( return Transform.rotate(
angle: (_animationController.value * 3 * math.pi) / 180, angle: (_animationController.value * 3 * math.pi) / 180,
child: _widget!, child: widget!,
); );
}), },
child: widget.icon!),
), ),
...(_onTop ...(_onTop
? [ ? [
@@ -1,4 +1,5 @@
import 'package:core/core.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
@@ -28,7 +29,13 @@ class PopupMenuItemWidget extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16), padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16),
child: SizedBox( child: SizedBox(
child: Row(children: [ child: Row(children: [
SvgPicture.asset(icon, width: 20, height: 20, fit: BoxFit.fill, color: iconColor), SvgPicture.asset(
icon,
width: 20,
height: 20,
fit: BoxFit.fill,
colorFilter: iconColor.asFilter()
),
const SizedBox(width: 12), const SizedBox(width: 12),
Expanded(child: Text(name, Expanded(child: Text(name,
style: const TextStyle(fontSize: 15, color: Colors.black, fontWeight: FontWeight.w500))), style: const TextStyle(fontSize: 15, color: Colors.black, fontWeight: FontWeight.w500))),
@@ -156,7 +156,7 @@ class QuickSearchInputForm<T, R> extends FormField<String> {
}); });
@override @override
_TypeAheadFormFieldState<T, R> createState() => _TypeAheadFormFieldState<T, R>(); FormFieldState<String> createState() => _TypeAheadFormFieldState<T, R>();
} }
class _TypeAheadFormFieldState<T, R> extends FormFieldState<String> { class _TypeAheadFormFieldState<T, R> extends FormFieldState<String> {
@@ -567,7 +567,7 @@ class TypeAheadFieldQuickSearch<T, R> extends StatefulWidget {
super(key: key); super(key: key);
@override @override
_TypeAheadFieldQuickSearchState<T, R> createState() => _TypeAheadFieldQuickSearchState<T, R>(); State<TypeAheadFieldQuickSearch<T, R>> createState() => _TypeAheadFieldQuickSearchState<T, R>();
} }
class _TypeAheadFieldQuickSearchState<T, R> extends State<TypeAheadFieldQuickSearch<T, R>> class _TypeAheadFieldQuickSearchState<T, R> extends State<TypeAheadFieldQuickSearch<T, R>>
@@ -678,14 +678,10 @@ class _TypeAheadFieldQuickSearchState<T, R> extends State<TypeAheadFieldQuickSea
void didChangeDependencies() { void didChangeDependencies() {
super.didChangeDependencies(); super.didChangeDependencies();
ScrollableState? scrollableState = Scrollable.of(context); ScrollableState? scrollableState = Scrollable.of(context);
if (scrollableState != null) {
// The TypeAheadFieldQuickSearch is inside a scrollable widget
_scrollPosition = scrollableState.position; _scrollPosition = scrollableState.position;
_scrollPosition!.removeListener(_scrollResizeListener); _scrollPosition!.removeListener(_scrollResizeListener);
_scrollPosition!.isScrollingNotifier.addListener(_scrollResizeListener); _scrollPosition!.isScrollingNotifier.addListener(_scrollResizeListener);
} }
}
void _scrollResizeListener() { void _scrollResizeListener() {
bool isScrolling = _scrollPosition!.isScrollingNotifier.value; bool isScrolling = _scrollPosition!.isScrollingNotifier.value;
@@ -1176,7 +1172,6 @@ class _SuggestionsListState<T, R> extends State<_SuggestionsList<T, R>>
return Padding( return Padding(
padding: const EdgeInsets.only(right: 8, bottom: kIsWeb ? 8 : 0), padding: const EdgeInsets.only(right: 8, bottom: kIsWeb ? 8 : 0),
child: InkWell( child: InkWell(
child: widget.actionButtonBuilder!(context, action),
borderRadius: const BorderRadius.all(Radius.circular(10)), borderRadius: const BorderRadius.all(Radius.circular(10)),
onTap: () { onTap: () {
if (widget.buttonActionCallback != null) { if (widget.buttonActionCallback != null) {
@@ -1184,6 +1179,7 @@ class _SuggestionsListState<T, R> extends State<_SuggestionsList<T, R>>
invalidateSuggestions(); invalidateSuggestions();
} }
}, },
child: widget.actionButtonBuilder!(context, action),
), ),
); );
} else { } else {
@@ -1257,7 +1253,6 @@ class _SuggestionsListState<T, R> extends State<_SuggestionsList<T, R>>
return Padding( return Padding(
padding: const EdgeInsets.only(right: 8, bottom: kIsWeb ? 8 : 0), padding: const EdgeInsets.only(right: 8, bottom: kIsWeb ? 8 : 0),
child: InkWell( child: InkWell(
child: widget.actionButtonBuilder!(context, action),
borderRadius: const BorderRadius.all(Radius.circular(10)), borderRadius: const BorderRadius.all(Radius.circular(10)),
onTap: () { onTap: () {
if (widget.buttonActionCallback != null) { if (widget.buttonActionCallback != null) {
@@ -1265,6 +1260,7 @@ class _SuggestionsListState<T, R> extends State<_SuggestionsList<T, R>>
invalidateSuggestions(); invalidateSuggestions();
} }
}, },
child: widget.actionButtonBuilder!(context, action),
), ),
); );
} else { } else {
@@ -1680,7 +1676,7 @@ class _SuggestionsBox {
if (isOpened) return; if (isOpened) return;
assert(_overlayEntry != null); assert(_overlayEntry != null);
resize(); resize();
Overlay.of(context)!.insert(_overlayEntry!); Overlay.of(context).insert(_overlayEntry!);
isOpened = true; isOpened = true;
} }
@@ -1726,7 +1722,7 @@ class _SuggestionsBox {
await Future<void>.delayed(const Duration(milliseconds: 170)); await Future<void>.delayed(const Duration(milliseconds: 170));
timer += 170; timer += 170;
if (widgetMounted && if (widgetMounted && context.mounted &&
(MediaQuery.of(context).viewInsets != initial || (MediaQuery.of(context).viewInsets != initial ||
_findRootMediaQuery() != initialRootMediaQuery)) { _findRootMediaQuery() != initialRootMediaQuery)) {
return true; return true;
@@ -1,61 +0,0 @@
import 'package:flutter/widgets.dart';
enum CustomIndicatorSize {
tiny,
normal,
full,
}
class CustomIndicator extends Decoration {
final double indicatorHeight;
final Color indicatorColor;
final CustomIndicatorSize indicatorSize;
const CustomIndicator({
required this.indicatorHeight,
required this.indicatorColor,
required this.indicatorSize
});
@override
_CustomPainter createBoxPainter([VoidCallback? onChanged]) {
return _CustomPainter(this, onChanged);
}
}
class _CustomPainter extends BoxPainter {
final CustomIndicator decoration;
_CustomPainter(this.decoration, VoidCallback? onChanged) : super(onChanged);
@override
void paint(Canvas canvas, Offset offset, ImageConfiguration configuration) {
assert(configuration.size != null);
Rect? rect;
if (decoration.indicatorSize == CustomIndicatorSize.full) {
rect = Offset(offset.dx,
(configuration.size!.height - decoration.indicatorHeight)) &
Size(configuration.size!.width, decoration.indicatorHeight);
} else if (decoration.indicatorSize == CustomIndicatorSize.normal) {
rect = Offset(offset.dx + 6,
(configuration.size!.height - decoration.indicatorHeight)) &
Size(configuration.size!.width - 12, decoration.indicatorHeight);
} else if (decoration.indicatorSize == CustomIndicatorSize.tiny) {
rect = Offset(offset.dx + configuration.size!.width / 2 - 8,
(configuration.size!.height - decoration.indicatorHeight)) &
Size(16, decoration.indicatorHeight);
}
if (rect != null) {
final Paint paint = Paint();
paint.color = decoration.indicatorColor;
paint.style = PaintingStyle.fill;
canvas.drawRRect(
RRect.fromRectAndCorners(rect,
topRight: const Radius.circular(8),
topLeft: const Radius.circular(8)),
paint);
}
}
}
+4 -4
View File
@@ -3,17 +3,17 @@ import 'dart:async';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
_Dispatcher logHistory = _Dispatcher(""); final logHistory = _Dispatcher("");
void log(String? value) { void log(String? value) {
String v = value ?? ""; String v = value ?? "";
logHistory.value = v + "\n" + logHistory.value; logHistory.value = "$v\n${logHistory.value}";
if (kReleaseMode == false) { if (kDebugMode) {
print(v); print(v);
} }
} }
void logError(String? value) => log("[ERROR] " + (value ?? "")); void logError(String? value) => log("[ERROR] ${value ?? ""}");
// Take from: https://flutter.dev/docs/testing/errors // Take from: https://flutter.dev/docs/testing/errors
void initLogger(VoidCallback runApp) { void initLogger(VoidCallback runApp) {
+1 -1
View File
@@ -33,4 +33,4 @@ class _Benchmark {
} }
} }
final _Benchmark bench = _Benchmark(); final bench = _Benchmark();
+6 -5
View File
@@ -1,11 +1,12 @@
import 'package:flutter/foundation.dart' as Foundation;
import 'package:flutter/foundation.dart';
abstract class BuildUtils { abstract class BuildUtils {
static const bool isDebugMode = Foundation.kDebugMode; static const bool isDebugMode = kDebugMode;
static const bool isReleaseMode = Foundation.kReleaseMode; static const bool isReleaseMode = kReleaseMode;
static const bool isWeb = Foundation.kIsWeb; static const bool isWeb = kIsWeb;
static const bool isProfileMode = Foundation.kProfileMode; static const bool isProfileMode = kProfileMode;
} }
+3 -3
View File
@@ -34,8 +34,8 @@ class FpsManager {
final List<FpsCallback> _fpsCallbacks = []; final List<FpsCallback> _fpsCallbacks = [];
/// Temporarily save 120 frames /// Temporarily save 120 frames
static const int _queue_capacity = 120; static const int queueCapacity = 120;
final ListQueue framesQueue = ListQueue<FrameTiming>(_queue_capacity); final ListQueue framesQueue = ListQueue<FrameTiming>(queueCapacity);
void addFpsCallback(FpsCallback callback) { void addFpsCallback(FpsCallback callback) {
_fpsCallbacks.add(callback); _fpsCallbacks.add(callback);
@@ -69,7 +69,7 @@ class FpsManager {
for (FrameTiming timing in timings) { for (FrameTiming timing in timings) {
framesQueue.addFirst(timing); framesQueue.addFirst(timing);
} }
while (framesQueue.length > _queue_capacity) { while (framesQueue.length > queueCapacity) {
framesQueue.removeLast(); framesQueue.removeLast();
} }
+14 -2
View File
@@ -1,4 +1,16 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml include: package:flutter_lints/flutter.yaml
# Additional information about this file can be found at linter:
# https://dart.dev/guides/language/analysis-options rules:
constant_identifier_names: false
non_constant_identifier_names: false
unnecessary_string_escapes: false
+14 -2
View File
@@ -1,4 +1,16 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml include: package:flutter_lints/flutter.yaml
# Additional information about this file can be found at linter:
# https://dart.dev/guides/language/analysis-options rules:
constant_identifier_names: false
non_constant_identifier_names: false
unnecessary_string_escapes: false
+7 -7
View File
@@ -78,9 +78,9 @@ abstract class BaseController extends GetxController
return; return;
} }
final _appToast = Get.find<AppToast>(); final appToast = Get.find<AppToast>();
final _imagePaths = Get.find<ImagePaths>(); final imagePaths = Get.find<ImagePaths>();
final _responsiveUtils = Get.find<ResponsiveUtils>(); final responsiveUtils = Get.find<ResponsiveUtils>();
String messageError = ''; String messageError = '';
if (error is MethodLevelErrors) { if (error is MethodLevelErrors) {
@@ -92,19 +92,19 @@ abstract class BaseController extends GetxController
} }
if (messageError.isNotEmpty && currentContext != null && currentOverlayContext != null) { if (messageError.isNotEmpty && currentContext != null && currentOverlayContext != null) {
_appToast.showBottomToast( appToast.showBottomToast(
currentOverlayContext!, currentOverlayContext!,
messageError, messageError,
leadingIcon: SvgPicture.asset( leadingIcon: SvgPicture.asset(
_imagePaths.icNotConnection, imagePaths.icNotConnection,
width: 24, width: 24,
height: 24, height: 24,
color: Colors.white, colorFilter: Colors.white.asFilter(),
fit: BoxFit.fill), fit: BoxFit.fill),
backgroundColor: AppColor.toastErrorBackgroundColor, backgroundColor: AppColor.toastErrorBackgroundColor,
textColor: Colors.white, textColor: Colors.white,
textActionColor: Colors.white, textActionColor: Colors.white,
maxWidth: _responsiveUtils.getMaxWidthToast(currentContext!)); maxWidth: responsiveUtils.getMaxWidthToast(currentContext!));
} }
} }
@@ -26,10 +26,10 @@ mixin MessageDialogActionMixin {
Color? cancelButtonColor, Color? cancelButtonColor,
} }
) { ) {
final _responsiveUtils = Get.find<ResponsiveUtils>(); final responsiveUtils = Get.find<ResponsiveUtils>();
final _imagePaths = Get.find<ImagePaths>(); final imagePaths = Get.find<ImagePaths>();
if (_responsiveUtils.isMobile(context)) { if (responsiveUtils.isMobile(context)) {
if (showAsBottomSheet) { if (showAsBottomSheet) {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
@@ -38,13 +38,13 @@ mixin MessageDialogActionMixin {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
enableDrag: true, enableDrag: true,
builder: (BuildContext context) => PointerInterceptor( builder: (BuildContext context) => PointerInterceptor(
child: (ConfirmDialogBuilder(_imagePaths, showAsBottomSheet: true) child: (ConfirmDialogBuilder(imagePaths, showAsBottomSheet: true)
..key(const Key('confirm_dialog_action')) ..key(const Key('confirm_dialog_action'))
..title(title ?? '') ..title(title ?? '')
..content(message) ..content(message)
..addIcon(icon) ..addIcon(icon)
..margin(const EdgeInsets.symmetric(vertical: 42, horizontal: 16)) ..margin(const EdgeInsets.symmetric(vertical: 42, horizontal: 16))
..widthDialog(_responsiveUtils.getSizeScreenWidth(context)) ..widthDialog(responsiveUtils.getSizeScreenWidth(context))
..colorConfirmButton(actionButtonColor ?? AppColor.colorTextButton) ..colorConfirmButton(actionButtonColor ?? AppColor.colorTextButton)
..colorCancelButton(cancelButtonColor ?? AppColor.colorCancelButton) ..colorCancelButton(cancelButtonColor ?? AppColor.colorCancelButton)
..paddingTitle(icon != null ? const EdgeInsets.only(top: 24) : EdgeInsets.zero) ..paddingTitle(icon != null ? const EdgeInsets.only(top: 24) : EdgeInsets.zero)
@@ -76,7 +76,7 @@ mixin MessageDialogActionMixin {
showDialog( showDialog(
context: context, context: context,
barrierColor: AppColor.colorDefaultCupertinoActionSheet, barrierColor: AppColor.colorDefaultCupertinoActionSheet,
builder: (BuildContext context) => PointerInterceptor(child: (ConfirmDialogBuilder(_imagePaths) builder: (BuildContext context) => PointerInterceptor(child: (ConfirmDialogBuilder(imagePaths)
..key(const Key('confirm_dialog_action')) ..key(const Key('confirm_dialog_action'))
..title(title ?? '') ..title(title ?? '')
..content(message) ..content(message)
@@ -1,4 +1,5 @@
import 'package:core/core.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
@@ -24,7 +25,7 @@ mixin PopupMenuWidgetMixin {
width: iconSize ?? 20, width: iconSize ?? 20,
height: iconSize ?? 20, height: iconSize ?? 20,
fit: BoxFit.fill, fit: BoxFit.fill,
color: colorIcon colorFilter: colorIcon.asFilter()
), ),
const SizedBox(width: 12), const SizedBox(width: 12),
Expanded(child: Text( Expanded(child: Text(
@@ -98,8 +98,8 @@ abstract class ReloadableController extends BaseController {
} else if (success is GetStoredTokenOidcSuccess) { } else if (success is GetStoredTokenOidcSuccess) {
_handleGetStoredTokenOIDCSuccess(success); _handleGetStoredTokenOIDCSuccess(success);
} else if (success is GetFCMSubscriptionLocalSuccess) { } else if (success is GetFCMSubscriptionLocalSuccess) {
final _subscriptionId = success.fcmSubscription.subscriptionId; final subscriptionId = success.fcmSubscription.subscriptionId;
_destroySubscriptionAction(_subscriptionId); _destroySubscriptionAction(subscriptionId);
} else if (success is DestroySubscriptionSuccess) { } else if (success is DestroySubscriptionSuccess) {
_checkAuthenticationTypeWhenLogout(); _checkAuthenticationTypeWhenLogout();
} }
@@ -249,18 +249,18 @@ abstract class ReloadableController extends BaseController {
} }
bool fcmEnabled(Session? session, AccountId? accountId) { bool fcmEnabled(Session? session, AccountId? accountId) {
bool _fcmEnabled = false; bool fcmEnabled = false;
try { try {
requireCapability(session!, accountId!, [FirebaseCapability.fcmIdentifier]); requireCapability(session!, accountId!, [FirebaseCapability.fcmIdentifier]);
if (AppConfig.fcmAvailable) { if (AppConfig.fcmAvailable) {
_fcmEnabled = true; fcmEnabled = true;
} else { } else {
_fcmEnabled = false; fcmEnabled = false;
} }
} catch (e) { } catch (e) {
logError('BaseController::fcmEnabled(): exception: $e'); logError('BaseController::fcmEnabled(): exception: $e');
} }
return _fcmEnabled; return fcmEnabled;
} }
void logout(Session? session, AccountId? accountId) { void logout(Session? session, AccountId? accountId) {
@@ -3,12 +3,12 @@ import 'package:core/presentation/extensions/color_extension.dart';
import 'package:core/presentation/resources/image_paths.dart'; import 'package:core/presentation/resources/image_paths.dart';
import 'package:core/presentation/utils/style_utils.dart'; import 'package:core/presentation/utils/style_utils.dart';
import 'package:dropdown_button2/dropdown_button2.dart'; import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:enough_html_editor/enough_html_editor.dart' as enough_html_editor;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:jmap_dart_client/jmap/identities/identity.dart'; import 'package:jmap_dart_client/jmap/identities/identity.dart';
import 'package:pointer_interceptor/pointer_interceptor.dart'; import 'package:pointer_interceptor/pointer_interceptor.dart';
import 'package:rich_text_composer/rich_text_composer.dart' as rich_text_composer;
import 'package:rule_filter/rule_filter/rule_condition.dart' as rule_condition; import 'package:rule_filter/rule_filter/rule_condition.dart' as rule_condition;
import 'package:tmail_ui_user/features/composer/presentation/model/font_name_type.dart'; import 'package:tmail_ui_user/features/composer/presentation/model/font_name_type.dart';
import 'package:tmail_ui_user/features/manage_account/presentation/language_and_region/extensions/locale_extension.dart'; import 'package:tmail_ui_user/features/manage_account/presentation/language_and_region/extensions/locale_extension.dart';
@@ -54,7 +54,7 @@ class DropDownButtonWidget<T> extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final _imagePaths = Get.find<ImagePaths>(); final imagePaths = Get.find<ImagePaths>();
return DropdownButtonHideUnderline( return DropdownButtonHideUnderline(
child: PointerInterceptor( child: PointerInterceptor(
@@ -91,7 +91,7 @@ class DropDownButtonWidget<T> extends StatelessWidget {
overflow: CommonTextStyle.defaultTextOverFlow, overflow: CommonTextStyle.defaultTextOverFlow,
)), )),
if (supportSelectionIcon && item == itemSelected) if (supportSelectionIcon && item == itemSelected)
SvgPicture.asset(_imagePaths.icChecked, SvgPicture.asset(imagePaths.icChecked,
width: sizeIconChecked, width: sizeIconChecked,
height: sizeIconChecked, height: sizeIconChecked,
fit: BoxFit.fill) fit: BoxFit.fill)
@@ -125,13 +125,13 @@ class DropDownButtonWidget<T> extends StatelessWidget {
softWrap: CommonTextStyle.defaultSoftWrap, softWrap: CommonTextStyle.defaultSoftWrap,
overflow: CommonTextStyle.defaultTextOverFlow, overflow: CommonTextStyle.defaultTextOverFlow,
)), )),
iconArrowDown ?? SvgPicture.asset(_imagePaths.icDropDown) iconArrowDown ?? SvgPicture.asset(imagePaths.icDropDown)
]), ]),
), ),
) )
: null, : null,
onChanged: onChanged, onChanged: onChanged,
icon: iconArrowDown ?? SvgPicture.asset(_imagePaths.icDropDown), icon: iconArrowDown ?? SvgPicture.asset(imagePaths.icDropDown),
buttonPadding: const EdgeInsets.symmetric(horizontal: 12), buttonPadding: const EdgeInsets.symmetric(horizontal: 12),
buttonDecoration: BoxDecoration( buttonDecoration: BoxDecoration(
borderRadius: BorderRadius.circular(radiusButton), borderRadius: BorderRadius.circular(radiusButton),
@@ -173,7 +173,7 @@ class DropDownButtonWidget<T> extends StatelessWidget {
if (item is FontNameType) { if (item is FontNameType) {
return item.fontFamily; return item.fontFamily;
} }
if (item is enough_html_editor.SafeFont) { if (item is rich_text_composer.SafeFont) {
return item.name; return item.name;
} }
if (item is rule_condition.Field) { if (item is rule_condition.Field) {
@@ -1,4 +1,5 @@
import 'package:core/core.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:pointer_interceptor/pointer_interceptor.dart'; import 'package:pointer_interceptor/pointer_interceptor.dart';
@@ -40,7 +41,7 @@ class PopupItemWidget extends StatelessWidget {
width: iconSize ?? 20, width: iconSize ?? 20,
height: iconSize ?? 20, height: iconSize ?? 20,
fit: BoxFit.fill, fit: BoxFit.fill,
color: colorIcon colorFilter: colorIcon.asFilter()
), ),
const SizedBox(width: 12), const SizedBox(width: 12),
Expanded(child: Text( Expanded(child: Text(
@@ -133,7 +133,7 @@ class HiveCacheConfig {
); );
registerCacheAdapter<FCMSubscriptionCache>( registerCacheAdapter<FCMSubscriptionCache>(
FCMSubscriptionCacheAdapter(), FCMSubscriptionCacheAdapter(),
CachingConstants.FCM_SUBSCRIPTION_HIVE_CACHE_INDENTITY CachingConstants.FCM_SUBSCRIPTION_HIVE_CACHE_IDENTITY
); );
} }
@@ -17,17 +17,13 @@ class HiveCacheVersionClient extends CacheVersionClient {
return Future.sync(() { return Future.sync(() {
final latestVersion = _sharedPreferences.getInt(versionKey); final latestVersion = _sharedPreferences.getInt(versionKey);
return latestVersion; return latestVersion;
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<bool> storeVersion(int newVersion) { Future<bool> storeVersion(int newVersion) {
return Future.sync(() async { return Future.sync(() async {
return await _sharedPreferences.setInt(versionKey, newVersion); return await _sharedPreferences.setInt(versionKey, newVersion);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
} }
@@ -13,5 +13,5 @@ class CachingConstants {
static const int AUTHENTICATION_INFO_HIVE_CACHE_IDENTIFY = 11; static const int AUTHENTICATION_INFO_HIVE_CACHE_IDENTIFY = 11;
static const int RECENT_LOGIN_URL_HIVE_CACHE_IDENTITY = 12; static const int RECENT_LOGIN_URL_HIVE_CACHE_IDENTITY = 12;
static const int RECENT_LOGIN_USERNAME_HIVE_CACHE_IDENTITY = 13; static const int RECENT_LOGIN_USERNAME_HIVE_CACHE_IDENTITY = 13;
static const int FCM_SUBSCRIPTION_HIVE_CACHE_INDENTITY = 14; static const int FCM_SUBSCRIPTION_HIVE_CACHE_IDENTITY = 14;
} }
@@ -30,35 +30,27 @@ class CleanupDataSourceImpl extends CleanupDataSource {
Future<void> cleanEmailCache(EmailCleanupRule cleanupRule) { Future<void> cleanEmailCache(EmailCleanupRule cleanupRule) {
return Future.sync(() async { return Future.sync(() async {
return await emailCacheManager.clean(cleanupRule); return await emailCacheManager.clean(cleanupRule);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<void> cleanRecentSearchCache(RecentSearchCleanupRule cleanupRule) { Future<void> cleanRecentSearchCache(RecentSearchCleanupRule cleanupRule) {
return Future.sync(() async { return Future.sync(() async {
return await recentSearchCacheManager.clean(cleanupRule); return await recentSearchCacheManager.clean(cleanupRule);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<void> cleanRecentLoginUrlCache(RecentLoginUrlCleanupRule cleanupRule) { Future<void> cleanRecentLoginUrlCache(RecentLoginUrlCleanupRule cleanupRule) {
return Future.sync(() async { return Future.sync(() async {
return await recentLoginUrlCacheManager.clean(cleanupRule); return await recentLoginUrlCacheManager.clean(cleanupRule);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<void> cleanRecentLoginUsernameCache(RecentLoginUsernameCleanupRule cleanupRule) { Future<void> cleanRecentLoginUsernameCache(RecentLoginUsernameCleanupRule cleanupRule) {
return Future.sync(() async { return Future.sync(() async {
return await recentLoginUsernameCacheManager.clean(cleanupRule); return await recentLoginUsernameCacheManager.clean(cleanupRule);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
} }
@@ -30,8 +30,6 @@ class ComposerDataSourceImpl extends ComposerDataSource {
bytesData: fileInfo.bytes, bytesData: fileInfo.bytes,
maxWidth: maxWidth, maxWidth: maxWidth,
compress: compress); compress: compress);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
} }
@@ -25,9 +25,7 @@ class ContactDataSourceImpl extends ContactDataSource {
return <DeviceContact>[]; return <DeviceContact>[];
} }
} }
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
List<DeviceContact> _toDeviceContact(contact_service.Contact contact) { List<DeviceContact> _toDeviceContact(contact_service.Contact contact) {
@@ -291,13 +291,11 @@ class ComposerController extends BaseController {
void _listenWorker() { void _listenWorker() {
uploadInlineImageWorker = ever(uploadController.uploadInlineViewState, (state) { uploadInlineImageWorker = ever(uploadController.uploadInlineViewState, (state) {
log('ComposerController::_listenWorker(): $state'); log('ComposerController::_listenWorker(): $state');
if (state is Either) {
state.fold((failure) => null, (success) { state.fold((failure) => null, (success) {
if (success is SuccessAttachmentUploadState) { if (success is SuccessAttachmentUploadState) {
_handleUploadInlineSuccess(success); _handleUploadInlineSuccess(success);
} }
}); });
}
}); });
} }
@@ -916,7 +914,10 @@ class ComposerController extends BaseController {
) async { ) async {
final newEmailBody = await _getEmailBodyText(context, changedEmail: true); final newEmailBody = await _getEmailBodyText(context, changedEmail: true);
log('ComposerController::_isEmailChanged(): newEmailBody: $newEmailBody'); log('ComposerController::_isEmailChanged(): newEmailBody: $newEmailBody');
var oldEmailBody = getContentEmail(context) ?? ''; var oldEmailBody = '';
if (context.mounted) {
oldEmailBody = getContentEmail(context) ?? '';
}
log('ComposerController::_isEmailChanged(): getContentEmail: $oldEmailBody'); log('ComposerController::_isEmailChanged(): getContentEmail: $oldEmailBody');
if (arguments.emailActionType != EmailActionType.compose && if (arguments.emailActionType != EmailActionType.compose &&
oldEmailBody.isNotEmpty) { oldEmailBody.isNotEmpty) {
@@ -974,7 +975,7 @@ class ComposerController extends BaseController {
if (arguments != null && userProfile != null && accountId != null) { if (arguments != null && userProfile != null && accountId != null) {
final isChanged = await _isEmailChanged(context, arguments); final isChanged = await _isEmailChanged(context, arguments);
if (isChanged) { if (isChanged && context.mounted) {
final newEmail = await _generateEmail( final newEmail = await _generateEmail(
context, context,
userProfile, userProfile,
@@ -1,5 +1,6 @@
import 'package:core/core.dart';
import 'package:enough_html_editor/enough_html_editor.dart'; import 'package:core/utils/app_logger.dart';
import 'package:rich_text_composer/rich_text_composer.dart';
import 'package:tmail_ui_user/features/composer/presentation/controller/base_rich_text_controller.dart'; import 'package:tmail_ui_user/features/composer/presentation/controller/base_rich_text_controller.dart';
import 'package:tmail_ui_user/features/composer/presentation/model/header_style_type.dart'; import 'package:tmail_ui_user/features/composer/presentation/model/header_style_type.dart';
import 'package:tmail_ui_user/features/composer/presentation/model/image_source.dart'; import 'package:tmail_ui_user/features/composer/presentation/model/image_source.dart';
@@ -96,9 +96,9 @@ mixin RichTextButtonMixin {
return buildIconWeb( return buildIconWeb(
icon: SvgPicture.asset( icon: SvgPicture.asset(
path, path,
color: isSelected == true colorFilter: isSelected == true
? Colors.black.withOpacity(opacity) ? Colors.black.withOpacity(opacity).asFilter()
: AppColor.colorDefaultRichTextButton.withOpacity(opacity), : AppColor.colorDefaultRichTextButton.withOpacity(opacity).asFilter(),
fit: BoxFit.fill), fit: BoxFit.fill),
iconPadding: const EdgeInsets.all(4), iconPadding: const EdgeInsets.all(4),
colorFocus: Colors.white, colorFocus: Colors.white,
@@ -120,12 +120,14 @@ mixin RichTextButtonMixin {
return tooltip?.isNotEmpty == true return tooltip?.isNotEmpty == true
? Tooltip( ? Tooltip(
child: SvgPicture.asset(path, message: tooltip,
color: newColor?.withOpacity(opacity), child: SvgPicture.asset(
fit: BoxFit.fill), path,
message: tooltip) colorFilter: newColor?.withOpacity(opacity).asFilter(),
: SvgPicture.asset(path, fit: BoxFit.fill))
color: newColor?.withOpacity(opacity), : SvgPicture.asset(
path,
colorFilter: newColor?.withOpacity(opacity).asFilter(),
fit: BoxFit.fill); fit: BoxFit.fill);
} }
@@ -138,8 +140,9 @@ mixin RichTextButtonMixin {
? AppColor.colorDefaultRichTextButton ? AppColor.colorDefaultRichTextButton
: color; : color;
return SvgPicture.asset(path, return SvgPicture.asset(
color: newColor?.withOpacity(opacity), path,
colorFilter: newColor?.withOpacity(opacity).asFilter(),
fit: BoxFit.fill); fit: BoxFit.fill);
} }
@@ -166,10 +169,10 @@ mixin RichTextButtonMixin {
? AppColor.colorDefaultRichTextButton ? AppColor.colorDefaultRichTextButton
: colorSelected; : colorSelected;
return Tooltip( return Tooltip(
message: tooltip,
child: Icon(iconData, child: Icon(iconData,
color: (newColor ?? AppColor.colorDefaultRichTextButton).withOpacity(opacity), color: (newColor ?? AppColor.colorDefaultRichTextButton).withOpacity(opacity),
size: 20), size: 20),
message: tooltip,
); );
} }
@@ -223,8 +226,9 @@ mixin RichTextButtonMixin {
DropDownMenuHeaderStyleWidget( DropDownMenuHeaderStyleWidget(
icon: buildWrapIconStyleText( icon: buildWrapIconStyleText(
isSelected: richTextController.isMenuHeaderStyleOpen, isSelected: richTextController.isMenuHeaderStyleOpen,
icon: SvgPicture.asset(RichTextStyleType.headerStyle.getIcon(_imagePaths), icon: SvgPicture.asset(
color: AppColor.colorDefaultRichTextButton, RichTextStyleType.headerStyle.getIcon(_imagePaths),
colorFilter: AppColor.colorDefaultRichTextButton.asFilter(),
fit: BoxFit.fill), fit: BoxFit.fill),
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 5), padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 5),
tooltip: RichTextStyleType.headerStyle.getTooltipButton(context) tooltip: RichTextStyleType.headerStyle.getTooltipButton(context)
@@ -47,8 +47,9 @@ class ToolbarRichTextWebBuilder extends StatelessWidget with RichTextButtonMixin
child: DropDownMenuHeaderStyleWidget( child: DropDownMenuHeaderStyleWidget(
icon: buildWrapIconStyleText( icon: buildWrapIconStyleText(
isSelected: richTextWebController.isMenuHeaderStyleOpen, isSelected: richTextWebController.isMenuHeaderStyleOpen,
icon: SvgPicture.asset(RichTextStyleType.headerStyle.getIcon(_imagePaths), icon: SvgPicture.asset(
color: AppColor.colorDefaultRichTextButton.withOpacity(opacity), RichTextStyleType.headerStyle.getIcon(_imagePaths),
colorFilter: AppColor.colorDefaultRichTextButton.withOpacity(opacity).asFilter(),
fit: BoxFit.fill), fit: BoxFit.fill),
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 5), padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 5),
tooltip: RichTextStyleType.headerStyle.getTooltipButton(context) tooltip: RichTextStyleType.headerStyle.getTooltipButton(context)
@@ -24,8 +24,9 @@ class AppBarContactWidget extends StatelessWidget {
Positioned( Positioned(
left: 0, left: 0,
child: buildIconWeb( child: buildIconWeb(
icon: SvgPicture.asset(_imagePaths.icCloseComposer, icon: SvgPicture.asset(
color: AppColor.colorCloseButton, _imagePaths.icCloseComposer,
colorFilter: AppColor.colorCloseButton.asFilter(),
width: 24, width: 24,
height: 24, height: 24,
fit: BoxFit.fill), fit: BoxFit.fill),
@@ -59,7 +59,7 @@ class ContactInputTagItem extends StatelessWidget {
imagePaths.icClose, imagePaths.icClose,
width: 20, width: 20,
height: 20, height: 20,
color: AppColor.colorDeleteContactIcon, colorFilter: AppColor.colorDeleteContactIcon.asFilter(),
fit: BoxFit.fill) fit: BoxFit.fill)
: null, : null,
labelStyle: const TextStyle(color: Colors.black, fontSize: 14, fontWeight: FontWeight.normal), labelStyle: const TextStyle(color: Colors.black, fontSize: 14, fontWeight: FontWeight.normal),
@@ -325,7 +325,7 @@ class DestinationPickerController extends BaseMailboxController {
_imagePaths.icNotConnection, _imagePaths.icNotConnection,
width: 24, width: 24,
height: 24, height: 24,
color: Colors.white, colorFilter: Colors.white.asFilter(),
fit: BoxFit.fill), fit: BoxFit.fill),
backgroundColor: AppColor.toastErrorBackgroundColor, backgroundColor: AppColor.toastErrorBackgroundColor,
textColor: Colors.white, textColor: Colors.white,
@@ -371,7 +371,7 @@ class DestinationPickerController extends BaseMailboxController {
_imagePaths.icNotConnection, _imagePaths.icNotConnection,
width: 24, width: 24,
height: 24, height: 24,
color: Colors.white, colorFilter: Colors.white.asFilter(),
fit: BoxFit.fill), fit: BoxFit.fill),
backgroundColor: AppColor.toastErrorBackgroundColor, backgroundColor: AppColor.toastErrorBackgroundColor,
textColor: Colors.white, textColor: Colors.white,
@@ -416,7 +416,7 @@ class DestinationPickerController extends BaseMailboxController {
_imagePaths.icNotConnection, _imagePaths.icNotConnection,
width: 24, width: 24,
height: 24, height: 24,
color: Colors.white, colorFilter: Colors.white.asFilter(),
fit: BoxFit.fill), fit: BoxFit.fill),
backgroundColor: AppColor.toastErrorBackgroundColor, backgroundColor: AppColor.toastErrorBackgroundColor,
textColor: Colors.white, textColor: Colors.white,
@@ -536,7 +536,10 @@ class DestinationPickerView extends GetWidget<DestinationPickerController>
child: Row( child: Row(
children: [ children: [
Padding(padding: const EdgeInsets.only(left: 5), child: buildIconWeb( Padding(padding: const EdgeInsets.only(left: 5), child: buildIconWeb(
icon: SvgPicture.asset(_imagePaths.icBack, color: AppColor.colorTextButton, fit: BoxFit.fill), icon: SvgPicture.asset(
_imagePaths.icBack,
colorFilter: AppColor.colorTextButton.asFilter(),
fit: BoxFit.fill),
onTap: () => controller.disableSearch(context))), onTap: () => controller.disableSearch(context))),
Expanded(child: (SearchAppBarWidget( Expanded(child: (SearchAppBarWidget(
_imagePaths, _imagePaths,
@@ -94,7 +94,7 @@ class TopBarDestinationPickerBuilder extends StatelessWidget {
_imagePaths.icBack, _imagePaths.icBack,
width: 14, width: 14,
height: 14, height: 14,
color: AppColor.primaryColor, colorFilter: AppColor.primaryColor.asFilter(),
fit: BoxFit.fill), fit: BoxFit.fill),
const SizedBox(width: 5), const SizedBox(width: 5),
Text( Text(
@@ -117,67 +117,4 @@ class TopBarDestinationPickerBuilder extends StatelessWidget {
), ),
); );
} }
Widget _buildIconCreateButton(BuildContext context) {
return buildIconWeb(
iconSize: 24,
colorSelected: Colors.white,
splashRadius: 15,
iconPadding: const EdgeInsets.all(3),
icon: SvgPicture.asset(
_imagePaths.icCreateNewFolder,
color: mailboxIdDestination != null
? AppColor.colorTextButton
: AppColor.colorDisableMailboxCreateButton,
fit: BoxFit.fill),
tooltip: AppLocalizations.of(context).create,
onTap: onOpenCreateNewMailboxScreenAction
);
}
Widget _buildDoneButton(BuildContext context) {
return Material(
color: Colors.transparent,
child: InkWell(
customBorder: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(8))),
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 8,
horizontal: 8),
child: Text(
AppLocalizations.of(context).done,
style: TextStyle(
fontSize: 15,
color: mailboxIdDestination != null
? AppColor.colorTextButton
: AppColor.colorDisableMailboxCreateButton))),
onTap: onSelectedMailboxDestinationAction
)
);
}
Widget _buildSaveButton(BuildContext context) {
return Material(
color: Colors.transparent,
child: InkWell(
customBorder: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(8))),
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 8,
horizontal: 8),
child: Text(
AppLocalizations.of(context).save,
style: TextStyle(
fontSize: 15,
color: isCreateMailboxValidated
? AppColor.colorTextButton
: AppColor.colorDisableMailboxCreateButton)
)
),
onTap: isCreateMailboxValidated ? onCreateNewMailboxAction : null
)
);
}
} }
@@ -27,27 +27,21 @@ class EmailDataSourceImpl extends EmailDataSource {
Future<Email> getEmailContent(AccountId accountId, EmailId emailId) { Future<Email> getEmailContent(AccountId accountId, EmailId emailId) {
return Future.sync(() async { return Future.sync(() async {
return await emailAPI.getEmailContent(accountId, emailId); return await emailAPI.getEmailContent(accountId, emailId);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<bool> sendEmail(AccountId accountId, EmailRequest emailRequest, {CreateNewMailboxRequest? mailboxRequest}) { Future<bool> sendEmail(AccountId accountId, EmailRequest emailRequest, {CreateNewMailboxRequest? mailboxRequest}) {
return Future.sync(() async { return Future.sync(() async {
return await emailAPI.sendEmail(accountId, emailRequest, mailboxRequest: mailboxRequest); return await emailAPI.sendEmail(accountId, emailRequest, mailboxRequest: mailboxRequest);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<List<Email>> markAsRead(AccountId accountId, List<Email> emails, ReadActions readActions) { Future<List<Email>> markAsRead(AccountId accountId, List<Email> emails, ReadActions readActions) {
return Future.sync(() async { return Future.sync(() async {
return await emailAPI.markAsRead(accountId, emails, readActions); return await emailAPI.markAsRead(accountId, emails, readActions);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
@@ -59,9 +53,7 @@ class EmailDataSourceImpl extends EmailDataSource {
) { ) {
return Future.sync(() async { return Future.sync(() async {
return await emailAPI.downloadAttachments(attachments, accountId, baseDownloadUrl, accountRequest); return await emailAPI.downloadAttachments(attachments, accountId, baseDownloadUrl, accountRequest);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
@@ -74,54 +66,42 @@ class EmailDataSourceImpl extends EmailDataSource {
) { ) {
return Future.sync(() async { return Future.sync(() async {
return await emailAPI.exportAttachment(attachment, accountId, baseDownloadUrl, accountRequest, cancelToken); return await emailAPI.exportAttachment(attachment, accountId, baseDownloadUrl, accountRequest, cancelToken);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<List<EmailId>> moveToMailbox(AccountId accountId, MoveToMailboxRequest moveRequest) { Future<List<EmailId>> moveToMailbox(AccountId accountId, MoveToMailboxRequest moveRequest) {
return Future.sync(() async { return Future.sync(() async {
return await emailAPI.moveToMailbox(accountId, moveRequest); return await emailAPI.moveToMailbox(accountId, moveRequest);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<List<Email>> markAsStar(AccountId accountId, List<Email> emails, MarkStarAction markStarAction) { Future<List<Email>> markAsStar(AccountId accountId, List<Email> emails, MarkStarAction markStarAction) {
return Future.sync(() async { return Future.sync(() async {
return await emailAPI.markAsStar(accountId, emails, markStarAction); return await emailAPI.markAsStar(accountId, emails, markStarAction);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<Email> saveEmailAsDrafts(AccountId accountId, Email email) { Future<Email> saveEmailAsDrafts(AccountId accountId, Email email) {
return Future.sync(() async { return Future.sync(() async {
return await emailAPI.saveEmailAsDrafts(accountId, email); return await emailAPI.saveEmailAsDrafts(accountId, email);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<bool> removeEmailDrafts(AccountId accountId, EmailId emailId) { Future<bool> removeEmailDrafts(AccountId accountId, EmailId emailId) {
return Future.sync(() async { return Future.sync(() async {
return await emailAPI.removeEmailDrafts(accountId, emailId); return await emailAPI.removeEmailDrafts(accountId, emailId);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<Email> updateEmailDrafts(AccountId accountId, Email newEmail, EmailId oldEmailId) { Future<Email> updateEmailDrafts(AccountId accountId, Email newEmail, EmailId oldEmailId) {
return Future.sync(() async { return Future.sync(() async {
return await emailAPI.updateEmailDrafts(accountId, newEmail, oldEmailId); return await emailAPI.updateEmailDrafts(accountId, newEmail, oldEmailId);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
@@ -141,26 +121,20 @@ class EmailDataSourceImpl extends EmailDataSource {
baseDownloadUrl, baseDownloadUrl,
accountRequest, accountRequest,
onReceiveController); onReceiveController);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<List<EmailId>> deleteMultipleEmailsPermanently(AccountId accountId, List<EmailId> emailIds) { Future<List<EmailId>> deleteMultipleEmailsPermanently(AccountId accountId, List<EmailId> emailIds) {
return Future.sync(() async { return Future.sync(() async {
return await emailAPI.deleteMultipleEmailsPermanently(accountId, emailIds); return await emailAPI.deleteMultipleEmailsPermanently(accountId, emailIds);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<bool> deleteEmailPermanently(AccountId accountId, EmailId emailId) { Future<bool> deleteEmailPermanently(AccountId accountId, EmailId emailId) {
return Future.sync(() async { return Future.sync(() async {
return await emailAPI.deleteEmailPermanently(accountId, emailId); return await emailAPI.deleteEmailPermanently(accountId, emailId);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
} }
@@ -19,17 +19,13 @@ class HtmlDataSourceImpl extends HtmlDataSource {
) { ) {
return Future.sync(() async { return Future.sync(() async {
return await _htmlAnalyzer.transformEmailContent(emailContent, mapUrlDownloadCID, _dioClient); return await _htmlAnalyzer.transformEmailContent(emailContent, mapUrlDownloadCID, _dioClient);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<EmailContent> addTooltipWhenHoverOnLink(EmailContent emailContent) { Future<EmailContent> addTooltipWhenHoverOnLink(EmailContent emailContent) {
return Future.sync(() async { return Future.sync(() async {
return await _htmlAnalyzer.addTooltipWhenHoverOnLink(emailContent); return await _htmlAnalyzer.addTooltipWhenHoverOnLink(emailContent);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
} }
@@ -18,8 +18,6 @@ class MdnDataSourceImpl extends MdnDataSource {
Future<MDN?> sendReceiptToSender(AccountId accountId, SendReceiptToSenderRequest request) { Future<MDN?> sendReceiptToSender(AccountId accountId, SendReceiptToSenderRequest request) {
return Future.sync(() async { return Future.sync(() async {
return await _mdnAPI.sendReceiptToSender(accountId, request); return await _mdnAPI.sendReceiptToSender(accountId, request);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
} }
+10 -10
View File
@@ -192,9 +192,9 @@ class EmailView extends GetWidget<SingleEmailController> {
buildIconWeb( buildIconWeb(
icon: SvgPicture.asset( icon: SvgPicture.asset(
imagePaths.icNewer, imagePaths.icNewer,
color: controller.emailSupervisorController.nextEmailActivated colorFilter: controller.emailSupervisorController.nextEmailActivated
? AppColor.primaryColor ? AppColor.primaryColor.asFilter()
: AppColor.colorAttachmentIcon, : AppColor.colorAttachmentIcon.asFilter(),
width: IconUtils.defaultIconSize, width: IconUtils.defaultIconSize,
height: IconUtils.defaultIconSize, height: IconUtils.defaultIconSize,
fit: BoxFit.fill), fit: BoxFit.fill),
@@ -205,9 +205,9 @@ class EmailView extends GetWidget<SingleEmailController> {
imagePaths.icOlder, imagePaths.icOlder,
width: IconUtils.defaultIconSize, width: IconUtils.defaultIconSize,
height: IconUtils.defaultIconSize, height: IconUtils.defaultIconSize,
color: controller.emailSupervisorController.previousEmailActivated colorFilter: controller.emailSupervisorController.previousEmailActivated
? AppColor.primaryColor ? AppColor.primaryColor.asFilter()
: AppColor.colorAttachmentIcon, : AppColor.colorAttachmentIcon.asFilter(),
fit: BoxFit.fill), fit: BoxFit.fill),
tooltip: AppLocalizations.of(context).older, tooltip: AppLocalizations.of(context).older,
onTap: controller.emailSupervisorController.backToPreviousEmail), onTap: controller.emailSupervisorController.backToPreviousEmail),
@@ -341,7 +341,7 @@ class EmailView extends GetWidget<SingleEmailController> {
SvgPicture.asset(imagePaths.icAttachment, SvgPicture.asset(imagePaths.icAttachment,
width: 20, width: 20,
height: 20, height: 20,
color: AppColor.colorAttachmentIcon, colorFilter: AppColor.colorAttachmentIcon.asFilter(),
fit: BoxFit.fill), fit: BoxFit.fill),
const SizedBox(width: 5), const SizedBox(width: 5),
Expanded(child: Text( Expanded(child: Text(
@@ -472,7 +472,7 @@ class EmailView extends GetWidget<SingleEmailController> {
width: 24, width: 24,
height: 24, height: 24,
fit: BoxFit.fill, fit: BoxFit.fill,
color: AppColor.colorTextButton colorFilter: AppColor.colorTextButton.asFilter()
), ),
AppLocalizations.of(context).mark_as_unread, AppLocalizations.of(context).mark_as_unread,
email, email,
@@ -500,7 +500,7 @@ class EmailView extends GetWidget<SingleEmailController> {
width: 24, width: 24,
height: 24, height: 24,
fit: BoxFit.fill, fit: BoxFit.fill,
color: AppColor.colorTextButton colorFilter: AppColor.colorTextButton.asFilter()
), ),
currentMailbox?.isSpam == true currentMailbox?.isSpam == true
? AppLocalizations.of(context).remove_from_spam ? AppLocalizations.of(context).remove_from_spam
@@ -528,7 +528,7 @@ class EmailView extends GetWidget<SingleEmailController> {
width: 24, width: 24,
height: 24, height: 24,
fit: BoxFit.fill, fit: BoxFit.fill,
color: AppColor.colorTextButton), colorFilter: AppColor.colorTextButton.asFilter()),
AppLocalizations.of(context).quickCreatingRule, AppLocalizations.of(context).quickCreatingRule,
email, email,
iconLeftPadding: responsiveUtils.isMobile(context) iconLeftPadding: responsiveUtils.isMobile(context)
@@ -62,7 +62,7 @@ class AppBarMailWidgetBuilder extends StatelessWidget {
_imagePaths.icBack, _imagePaths.icBack,
width: 14, width: 14,
height: 14, height: 14,
color: AppColor.colorTextButton, colorFilter: AppColor.colorTextButton.asFilter(),
fit: BoxFit.fill), fit: BoxFit.fill),
if (!isSearchIsRunning) if (!isSearchIsRunning)
Container( Container(
@@ -134,9 +134,9 @@ class AppBarMailWidgetBuilder extends StatelessWidget {
buildIconWeb( buildIconWeb(
icon: SvgPicture.asset( icon: SvgPicture.asset(
_imagePaths.icDeleteComposer, _imagePaths.icDeleteComposer,
color: mailboxContain?.isTrash == false colorFilter: mailboxContain?.isTrash == false
? AppColor.colorTextButton ? AppColor.colorTextButton.asFilter()
: AppColor.colorDeletePermanentlyButton, : AppColor.colorDeletePermanentlyButton.asFilter(),
width: BuildUtils.isWeb ? 18 : 20, width: BuildUtils.isWeb ? 18 : 20,
height: BuildUtils.isWeb ? 18 : 20, height: BuildUtils.isWeb ? 18 : 20,
fit: BoxFit.fill), fit: BoxFit.fill),
@@ -89,7 +89,7 @@ class AttachmentFileTileBuilder extends StatelessWidget{
imagePaths.icDownloadAttachment, imagePaths.icDownloadAttachment,
width: 24, width: 24,
height: 24, height: 24,
color: AppColor.primaryColor, colorFilter: AppColor.primaryColor.asFilter(),
fit: BoxFit.fill), fit: BoxFit.fill),
onTap: () => onDownloadAttachmentFileActionClick?.call(_attachment) onTap: () => onDownloadAttachmentFileActionClick?.call(_attachment)
), ),
@@ -15,7 +15,7 @@ import 'package:jmap_dart_client/jmap/core/unsigned_int.dart';
import 'package:jmap_dart_client/jmap/identities/identity.dart'; import 'package:jmap_dart_client/jmap/identities/identity.dart';
import 'package:jmap_dart_client/jmap/mail/email/email_address.dart'; import 'package:jmap_dart_client/jmap/mail/email/email_address.dart';
import 'package:model/model.dart'; import 'package:model/model.dart';
import 'package:rich_text_composer/richtext_controller.dart'; import 'package:rich_text_composer/rich_text_composer.dart';
import 'package:tmail_ui_user/features/base/base_controller.dart'; import 'package:tmail_ui_user/features/base/base_controller.dart';
import 'package:tmail_ui_user/features/composer/presentation/controller/rich_text_web_controller.dart'; import 'package:tmail_ui_user/features/composer/presentation/controller/rich_text_web_controller.dart';
import 'package:tmail_ui_user/features/identity_creator/presentation/model/identity_creator_arguments.dart'; import 'package:tmail_ui_user/features/identity_creator/presentation/model/identity_creator_arguments.dart';
@@ -1,15 +1,13 @@
import 'dart:math'; import 'dart:math';
import 'package:core/core.dart'; import 'package:core/core.dart';
import 'package:enough_html_editor/enough_html_editor.dart' as html_editor_mobile;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:html_editor_enhanced/html_editor.dart' as html_editor_browser; import 'package:html_editor_enhanced/html_editor.dart' as html_editor_browser;
import 'package:html_editor_enhanced/html_editor.dart';
import 'package:jmap_dart_client/jmap/mail/email/email_address.dart'; import 'package:jmap_dart_client/jmap/mail/email/email_address.dart';
import 'package:pointer_interceptor/pointer_interceptor.dart'; import 'package:pointer_interceptor/pointer_interceptor.dart';
import 'package:rich_text_composer/views/keyboard_richtext.dart'; import 'package:rich_text_composer/rich_text_composer.dart';
import 'package:rich_text_composer/views/widgets/rich_text_keyboard_toolbar.dart'; import 'package:rich_text_composer/views/widgets/rich_text_keyboard_toolbar.dart';
import 'package:tmail_ui_user/features/composer/presentation/widgets/toolbar_rich_text_builder.dart'; import 'package:tmail_ui_user/features/composer/presentation/widgets/toolbar_rich_text_builder.dart';
import 'package:tmail_ui_user/features/identity_creator/presentation/identity_creator_controller.dart'; import 'package:tmail_ui_user/features/identity_creator/presentation/identity_creator_controller.dart';
@@ -374,7 +372,11 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
Positioned(top: 2, right: 8, Positioned(top: 2, right: 8,
child: buildIconWeb( child: buildIconWeb(
iconSize: 24, iconSize: 24,
icon: SvgPicture.asset(_imagePaths.icComposerClose, fit: BoxFit.fill, color: AppColor.colorDeleteContactIcon), icon: SvgPicture.asset(
_imagePaths.icComposerClose,
fit: BoxFit.fill,
colorFilter: AppColor.colorDeleteContactIcon.asFilter()
),
tooltip: AppLocalizations.of(context).close, tooltip: AppLocalizations.of(context).close,
onTap: () => controller.closeView(context))) onTap: () => controller.closeView(context)))
] ]
@@ -405,16 +407,16 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
child: html_editor_browser.HtmlEditor( child: html_editor_browser.HtmlEditor(
key: const Key('identity_create_editor_web'), key: const Key('identity_create_editor_web'),
controller: controller.richTextWebController.editorController, controller: controller.richTextWebController.editorController,
htmlEditorOptions: const HtmlEditorOptions( htmlEditorOptions: const html_editor_browser.HtmlEditorOptions(
hint: '', hint: '',
darkMode: false, darkMode: false,
customBodyCssStyle: bodyCssStyleForEditor), customBodyCssStyle: bodyCssStyleForEditor),
blockQuotedContent: initContent, blockQuotedContent: initContent,
htmlToolbarOptions: const HtmlToolbarOptions( htmlToolbarOptions: const html_editor_browser.HtmlToolbarOptions(
toolbarType: ToolbarType.hide, toolbarType: html_editor_browser.ToolbarType.hide,
defaultToolbarButtons: []), defaultToolbarButtons: []),
otherOptions: const OtherOptions(height: 150), otherOptions: const html_editor_browser.OtherOptions(height: 150),
callbacks: Callbacks(onBeforeCommand: (currentHtml) { callbacks: html_editor_browser.Callbacks(onBeforeCommand: (currentHtml) {
log('IdentityCreatorView::_buildHtmlEditorWeb(): onBeforeCommand : $currentHtml'); log('IdentityCreatorView::_buildHtmlEditorWeb(): onBeforeCommand : $currentHtml');
controller.updateContentHtmlEditor(currentHtml); controller.updateContentHtmlEditor(currentHtml);
}, onChangeContent: (changed) { }, onChangeContent: (changed) {
@@ -445,7 +447,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
Widget _buildHtmlEditor(BuildContext context, {String? initialContent}) { Widget _buildHtmlEditor(BuildContext context, {String? initialContent}) {
return Padding( return Padding(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
child: html_editor_mobile.HtmlEditor( child: HtmlEditor(
key: controller.htmlKey, key: controller.htmlKey,
minHeight: controller.htmlEditorMinHeight, minHeight: controller.htmlEditorMinHeight,
addDefaultSelectionMenuItems: false, addDefaultSelectionMenuItems: false,
@@ -27,63 +27,49 @@ class AuthenticationOIDCDataSourceImpl extends AuthenticationOIDCDataSource {
return Future.sync(() async { return Future.sync(() async {
final oidcResponse = await _oidcHttpClient.checkOIDCIsAvailable(oidcRequest); final oidcResponse = await _oidcHttpClient.checkOIDCIsAvailable(oidcRequest);
return oidcResponse!; return oidcResponse!;
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<OIDCConfiguration> getOIDCConfiguration(OIDCResponse oidcResponse) { Future<OIDCConfiguration> getOIDCConfiguration(OIDCResponse oidcResponse) {
return Future.sync(() async { return Future.sync(() async {
return await _oidcHttpClient.getOIDCConfiguration(oidcResponse); return await _oidcHttpClient.getOIDCConfiguration(oidcResponse);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<TokenOIDC> getTokenOIDC(String clientId, String redirectUrl, String discoveryUrl, List<String> scopes) { Future<TokenOIDC> getTokenOIDC(String clientId, String redirectUrl, String discoveryUrl, List<String> scopes) {
return Future.sync(() async { return Future.sync(() async {
return await _authenticationClient.getTokenOIDC(clientId, redirectUrl, discoveryUrl, scopes); return await _authenticationClient.getTokenOIDC(clientId, redirectUrl, discoveryUrl, scopes);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<TokenOIDC> getStoredTokenOIDC(String tokenIdHash) { Future<TokenOIDC> getStoredTokenOIDC(String tokenIdHash) {
return Future.sync(() async { return Future.sync(() async {
return await _tokenOidcCacheManager.getTokenOidc(tokenIdHash); return await _tokenOidcCacheManager.getTokenOidc(tokenIdHash);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<void> persistTokenOIDC(TokenOIDC tokenOidc) { Future<void> persistTokenOIDC(TokenOIDC tokenOidc) {
return Future.sync(() async { return Future.sync(() async {
return await _tokenOidcCacheManager.persistOneTokenOidc(tokenOidc); return await _tokenOidcCacheManager.persistOneTokenOidc(tokenOidc);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<OIDCConfiguration> getStoredOidcConfiguration() { Future<OIDCConfiguration> getStoredOidcConfiguration() {
return Future.sync(() async { return Future.sync(() async {
return await _oidcConfigurationCacheManager.getOidcConfiguration(); return await _oidcConfigurationCacheManager.getOidcConfiguration();
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<void> persistAuthorityOidc(String authority) { Future<void> persistAuthorityOidc(String authority) {
return Future.sync(() async { return Future.sync(() async {
return await _oidcConfigurationCacheManager.persistAuthorityOidc(authority); return await _oidcConfigurationCacheManager.persistAuthorityOidc(authority);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
@@ -101,27 +87,21 @@ class AuthenticationOIDCDataSourceImpl extends AuthenticationOIDCDataSource {
discoveryUrl, discoveryUrl,
scopes, scopes,
refreshToken); refreshToken);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<bool> logout(TokenId tokenId, OIDCConfiguration config) { Future<bool> logout(TokenId tokenId, OIDCConfiguration config) {
return Future.sync(() async { return Future.sync(() async {
return await _authenticationClient.logoutOidc(tokenId, config); return await _authenticationClient.logoutOidc(tokenId, config);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<void> deleteAuthorityOidc() { Future<void> deleteAuthorityOidc() {
return Future.sync(() async { return Future.sync(() async {
return await _oidcConfigurationCacheManager.deleteAuthorityOidc(); return await _oidcConfigurationCacheManager.deleteAuthorityOidc();
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
@@ -137,26 +117,20 @@ class AuthenticationOIDCDataSourceImpl extends AuthenticationOIDCDataSource {
redirectUrl, redirectUrl,
discoveryUrl, discoveryUrl,
scopes); scopes);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<String?> getAuthenticationInfo() { Future<String?> getAuthenticationInfo() {
return Future.sync(() async { return Future.sync(() async {
return await _authenticationClient.getAuthenticationInfo(); return await _authenticationClient.getAuthenticationInfo();
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<void> deleteTokenOIDC() { Future<void> deleteTokenOIDC() {
return Future.sync(() async { return Future.sync(() async {
return await _tokenOidcCacheManager.deleteTokenOidc(); return await _tokenOidcCacheManager.deleteTokenOidc();
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
} }
@@ -14,26 +14,20 @@ class HiveAccountDatasourceImpl extends AccountDatasource {
Future<Account> getCurrentAccount() { Future<Account> getCurrentAccount() {
return Future.sync(() async { return Future.sync(() async {
return await _accountCacheManager.getSelectedAccount(); return await _accountCacheManager.getSelectedAccount();
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<void> setCurrentAccount(Account newCurrentAccount) { Future<void> setCurrentAccount(Account newCurrentAccount) {
return Future.sync(() async { return Future.sync(() async {
return await _accountCacheManager.setSelectedAccount(newCurrentAccount); return await _accountCacheManager.setSelectedAccount(newCurrentAccount);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<void> deleteCurrentAccount(String accountId) { Future<void> deleteCurrentAccount(String accountId) {
return Future.sync(() async { return Future.sync(() async {
return await _accountCacheManager.deleteSelectedAccount(accountId); return await _accountCacheManager.deleteSelectedAccount(accountId);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
} }
@@ -24,9 +24,7 @@ class LoginUrlDataSourceImpl implements LoginUrlDataSource {
recentLoginUrl.url, recentLoginUrl.url,
recentLoginUrl.toRecentLoginUrlCache()); recentLoginUrl.toRecentLoginUrlCache());
} }
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
@@ -46,9 +44,7 @@ class LoginUrlDataSourceImpl implements LoginUrlDataSource {
: listRecentUrl; : listRecentUrl;
return newListRecentSUrl; return newListRecentSUrl;
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
bool _filterRecentUrlCache(RecentLoginUrlCache recentLoginUrlCache, String? pattern) { bool _filterRecentUrlCache(RecentLoginUrlCache recentLoginUrlCache, String? pattern) {
@@ -28,9 +28,7 @@ class LoginUsernameDataSourceImpl implements LoginUsernameDataSource {
return listValidRecentUsername.length > newLimit return listValidRecentUsername.length > newLimit
? listValidRecentUsername.sublist(0, newLimit) ? listValidRecentUsername.sublist(0, newLimit)
: listValidRecentUsername; : listValidRecentUsername;
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
@@ -44,9 +42,7 @@ class LoginUsernameDataSourceImpl implements LoginUsernameDataSource {
await _recentLoginUsernameCacheClient.insertItem(recentLoginUsername.username, await _recentLoginUsernameCacheClient.insertItem(recentLoginUsername.username,
recentLoginUsername.toRecentLoginUsernameCache()); recentLoginUsername.toRecentLoginUsernameCache());
} }
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
bool _filterRecentLoginUsernameCache( bool _filterRecentLoginUsernameCache(
@@ -10,7 +10,7 @@ extension OidcConfigurationExtensions on OIDCConfiguration {
if (AppConfig.domainRedirectUrl.endsWith('/')) { if (AppConfig.domainRedirectUrl.endsWith('/')) {
return AppConfig.domainRedirectUrl + loginRedirectOidcWeb; return AppConfig.domainRedirectUrl + loginRedirectOidcWeb;
} else { } else {
return AppConfig.domainRedirectUrl + '/' + loginRedirectOidcWeb; return '${AppConfig.domainRedirectUrl}/$loginRedirectOidcWeb';
} }
} else { } else {
return redirectOidcMobile; return redirectOidcMobile;
@@ -22,7 +22,7 @@ extension OidcConfigurationExtensions on OIDCConfiguration {
if (AppConfig.domainRedirectUrl.endsWith('/')) { if (AppConfig.domainRedirectUrl.endsWith('/')) {
return AppConfig.domainRedirectUrl + logoutRedirectOidcWeb; return AppConfig.domainRedirectUrl + logoutRedirectOidcWeb;
} else { } else {
return AppConfig.domainRedirectUrl + '/' + logoutRedirectOidcWeb; return '${AppConfig.domainRedirectUrl}/$logoutRedirectOidcWeb';
} }
} else { } else {
return redirectOidcMobile; return redirectOidcMobile;
@@ -30,8 +30,8 @@ class LoginView extends BaseLoginView {
child: _supportScrollForm(context) child: _supportScrollForm(context)
? Stack(children: [ ? Stack(children: [
Center(child: SingleChildScrollView( Center(child: SingleChildScrollView(
child: _buildCenterForm(context), scrollDirection: Axis.vertical,
scrollDirection: Axis.vertical)), child: _buildCenterForm(context))),
Obx(() { Obx(() {
if (loginController.loginFormType.value == LoginFormType.credentialForm if (loginController.loginFormType.value == LoginFormType.credentialForm
|| loginController.loginFormType.value == LoginFormType.ssoForm) { || loginController.loginFormType.value == LoginFormType.ssoForm) {
@@ -128,7 +128,7 @@ class LoginView extends BaseLoginView {
icon: SvgPicture.asset( icon: SvgPicture.asset(
imagePaths.icBack, imagePaths.icBack,
alignment: Alignment.center, alignment: Alignment.center,
color: AppColor.primaryColor colorFilter: AppColor.primaryColor.asFilter()
) )
), ),
); );
@@ -13,7 +13,6 @@ class LoginTextInputBuilder {
Key? _key; Key? _key;
String? _title; String? _title;
String? _hintText; String? _hintText;
String? _labelText;
String? _prefixText; String? _prefixText;
SetErrorString? _setErrorString; SetErrorString? _setErrorString;
String? _errorText; String? _errorText;
@@ -44,7 +43,6 @@ class LoginTextInputBuilder {
} }
void labelText(String? labelText) { void labelText(String? labelText) {
_labelText = labelText;
} }
void prefixText(String? prefixText) { void prefixText(String? prefixText) {
@@ -43,9 +43,7 @@ class MailboxCacheDataSourceImpl extends MailboxDataSource {
Future<void> update({List<Mailbox>? updated, List<Mailbox>? created, List<MailboxId>? destroyed}) { Future<void> update({List<Mailbox>? updated, List<Mailbox>? created, List<MailboxId>? destroyed}) {
return Future.sync(() async { return Future.sync(() async {
return await _mailboxCacheManager.update(updated: updated, created: created, destroyed: destroyed); return await _mailboxCacheManager.update(updated: updated, created: created, destroyed: destroyed);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
@@ -53,9 +51,7 @@ class MailboxCacheDataSourceImpl extends MailboxDataSource {
return Future.sync(() async { return Future.sync(() async {
final listMailboxes = await _mailboxCacheManager.getAllMailbox(); final listMailboxes = await _mailboxCacheManager.getAllMailbox();
return listMailboxes; return listMailboxes;
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
@@ -35,18 +35,14 @@ class MailboxDataSourceImpl extends MailboxDataSource {
Future<MailboxResponse> getAllMailbox(Session session, AccountId accountId, {Properties? properties}) { Future<MailboxResponse> getAllMailbox(Session session, AccountId accountId, {Properties? properties}) {
return Future.sync(() async { return Future.sync(() async {
return await mailboxAPI.getAllMailbox(session, accountId, properties: properties); return await mailboxAPI.getAllMailbox(session, accountId, properties: properties);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<MailboxChangeResponse> getChanges(Session session, AccountId accountId, State sinceState) { Future<MailboxChangeResponse> getChanges(Session session, AccountId accountId, State sinceState) {
return Future.sync(() async { return Future.sync(() async {
return await mailboxAPI.getChanges(session, accountId, sinceState); return await mailboxAPI.getChanges(session, accountId, sinceState);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
@@ -63,36 +59,28 @@ class MailboxDataSourceImpl extends MailboxDataSource {
Future<Mailbox?> createNewMailbox(AccountId accountId, CreateNewMailboxRequest newMailboxRequest) { Future<Mailbox?> createNewMailbox(AccountId accountId, CreateNewMailboxRequest newMailboxRequest) {
return Future.sync(() async { return Future.sync(() async {
return await mailboxAPI.createNewMailbox(accountId, newMailboxRequest); return await mailboxAPI.createNewMailbox(accountId, newMailboxRequest);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<Map<Id,SetError>> deleteMultipleMailbox(Session session, AccountId accountId, List<MailboxId> mailboxIds) { Future<Map<Id,SetError>> deleteMultipleMailbox(Session session, AccountId accountId, List<MailboxId> mailboxIds) {
return Future.sync(() async { return Future.sync(() async {
return await mailboxAPI.deleteMultipleMailbox(session, accountId, mailboxIds); return await mailboxAPI.deleteMultipleMailbox(session, accountId, mailboxIds);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<bool> renameMailbox(AccountId accountId, RenameMailboxRequest request) { Future<bool> renameMailbox(AccountId accountId, RenameMailboxRequest request) {
return Future.sync(() async { return Future.sync(() async {
return await mailboxAPI.renameMailbox(accountId, request); return await mailboxAPI.renameMailbox(accountId, request);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<bool> moveMailbox(AccountId accountId, MoveMailboxRequest request) { Future<bool> moveMailbox(AccountId accountId, MoveMailboxRequest request) {
return Future.sync(() async { return Future.sync(() async {
return await mailboxAPI.moveMailbox(accountId, request); return await mailboxAPI.moveMailbox(accountId, request);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
@@ -107,26 +95,20 @@ class MailboxDataSourceImpl extends MailboxDataSource {
mailboxId, mailboxId,
totalEmailUnread, totalEmailUnread,
onProgressController); onProgressController);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<bool> subscribeMailbox(AccountId accountId, SubscribeMailboxRequest request) { Future<bool> subscribeMailbox(AccountId accountId, SubscribeMailboxRequest request) {
return Future.sync(() async { return Future.sync(() async {
return await mailboxAPI.subscribeMailbox(accountId, request); return await mailboxAPI.subscribeMailbox(accountId, request);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<List<MailboxId>> subscribeMultipleMailbox(AccountId accountId, SubscribeMultipleMailboxRequest subscribeRequest) { Future<List<MailboxId>> subscribeMultipleMailbox(AccountId accountId, SubscribeMultipleMailboxRequest subscribeRequest) {
return Future.sync(() async { return Future.sync(() async {
return await mailboxAPI.subscribeMultipleMailbox(accountId, subscribeRequest); return await mailboxAPI.subscribeMultipleMailbox(accountId, subscribeRequest);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
} }
@@ -19,9 +19,7 @@ class StateDataSourceImpl extends StateDataSource {
return Future.sync(() async { return Future.sync(() async {
final stateCache = await _stateCacheClient.getItem(stateType.value); final stateCache = await _stateCacheClient.getItem(stateType.value);
return stateCache?.toState(); return stateCache?.toState();
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
@@ -33,8 +31,6 @@ class StateDataSourceImpl extends StateDataSource {
} else { } else {
return await _stateCacheClient.insertItem(stateCache.type.value, stateCache); return await _stateCacheClient.insertItem(stateCache.type.value, stateCache);
} }
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
} }
@@ -2,7 +2,7 @@ import 'package:core/core.dart';
import 'package:dartz/dartz.dart'; import 'package:dartz/dartz.dart';
import 'package:jmap_dart_client/jmap/account_id.dart'; import 'package:jmap_dart_client/jmap/account_id.dart';
import 'package:jmap_dart_client/jmap/core/session/session.dart'; import 'package:jmap_dart_client/jmap/core/session/session.dart';
import 'package:jmap_dart_client/jmap/core/state.dart' as jmapState; import 'package:jmap_dart_client/jmap/core/state.dart' as jmap_state;
import 'package:model/model.dart'; import 'package:model/model.dart';
import 'package:tmail_ui_user/features/mailbox/domain/model/mailbox_response.dart'; import 'package:tmail_ui_user/features/mailbox/domain/model/mailbox_response.dart';
import 'package:tmail_ui_user/features/mailbox/domain/repository/mailbox_repository.dart'; import 'package:tmail_ui_user/features/mailbox/domain/repository/mailbox_repository.dart';
@@ -13,7 +13,7 @@ class RefreshAllMailboxInteractor {
RefreshAllMailboxInteractor(this._mailboxRepository); RefreshAllMailboxInteractor(this._mailboxRepository);
Stream<Either<Failure, Success>> execute(Session session, AccountId accountId, jmapState.State currentState) async* { Stream<Either<Failure, Success>> execute(Session session, AccountId accountId, jmap_state.State currentState) async* {
try { try {
yield Right<Failure, Success>(RefreshingState()); yield Right<Failure, Success>(RefreshingState());
@@ -207,7 +207,6 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
); );
ever(mailboxDashBoardController.viewState, (state) { ever(mailboxDashBoardController.viewState, (state) {
if (state is Either) {
state.fold((failure) => null, (success) { state.fold((failure) => null, (success) {
if (success is MarkAsMultipleEmailReadAllSuccess) { if (success is MarkAsMultipleEmailReadAllSuccess) {
_refreshMailboxChanges(currentMailboxState: success.currentMailboxState); _refreshMailboxChanges(currentMailboxState: success.currentMailboxState);
@@ -243,7 +242,6 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
_refreshMailboxChanges(currentMailboxState: success.currentMailboxState); _refreshMailboxChanges(currentMailboxState: success.currentMailboxState);
} }
}); });
}
}); });
ever(mailboxDashBoardController.dashBoardAction, (action) { ever(mailboxDashBoardController.dashBoardAction, (action) {
@@ -518,7 +516,7 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
_imagePaths.icFolderMailbox, _imagePaths.icFolderMailbox,
width: 24, width: 24,
height: 24, height: 24,
color: Colors.white, colorFilter: Colors.white.asFilter(),
fit: BoxFit.fill), fit: BoxFit.fill),
backgroundColor: AppColor.toastSuccessBackgroundColor, backgroundColor: AppColor.toastSuccessBackgroundColor,
textColor: Colors.white, textColor: Colors.white,
@@ -544,7 +542,7 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
_imagePaths.icNotConnection, _imagePaths.icNotConnection,
width: 24, width: 24,
height: 24, height: 24,
color: Colors.white, colorFilter: Colors.white.asFilter(),
fit: BoxFit.fill), fit: BoxFit.fill),
backgroundColor: AppColor.toastErrorBackgroundColor, backgroundColor: AppColor.toastErrorBackgroundColor,
textColor: Colors.white, textColor: Colors.white,
@@ -828,7 +826,7 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
_imagePaths.icFolderMailbox, _imagePaths.icFolderMailbox,
width: 24, width: 24,
height: 24, height: 24,
color: Colors.white, colorFilter: Colors.white.asFilter(),
fit: BoxFit.fill), fit: BoxFit.fill),
backgroundColor: AppColor.toastSuccessBackgroundColor, backgroundColor: AppColor.toastSuccessBackgroundColor,
textColor: Colors.white, textColor: Colors.white,
@@ -1029,9 +1027,9 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
} }
void _unsubscribeMailboxAction(MailboxId mailboxId) { void _unsubscribeMailboxAction(MailboxId mailboxId) {
final _accountId = mailboxDashBoardController.accountId.value; final accountId = mailboxDashBoardController.accountId.value;
if (_accountId != null) { if (accountId != null) {
final subscribeRequest = generateSubscribeRequest( final subscribeRequest = generateSubscribeRequest(
mailboxId, mailboxId,
MailboxSubscribeState.disabled, MailboxSubscribeState.disabled,
@@ -1039,9 +1037,9 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
); );
if (subscribeRequest is SubscribeMultipleMailboxRequest) { if (subscribeRequest is SubscribeMultipleMailboxRequest) {
consumeState(_subscribeMultipleMailboxInteractor.execute(_accountId, subscribeRequest)); consumeState(_subscribeMultipleMailboxInteractor.execute(accountId, subscribeRequest));
} else if (subscribeRequest is SubscribeMailboxRequest) { } else if (subscribeRequest is SubscribeMailboxRequest) {
consumeState(_subscribeMailboxInteractor.execute(_accountId, subscribeRequest)); consumeState(_subscribeMailboxInteractor.execute(accountId, subscribeRequest));
} }
} }
} }
@@ -1120,7 +1118,7 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
_imagePaths.icFolderMailbox, _imagePaths.icFolderMailbox,
width: 24, width: 24,
height: 24, height: 24,
color: Colors.white, colorFilter: Colors.white.asFilter(),
fit: BoxFit.fill fit: BoxFit.fill
), ),
backgroundColor: AppColor.toastSuccessBackgroundColor, backgroundColor: AppColor.toastSuccessBackgroundColor,
@@ -1136,9 +1134,9 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
MailboxId mailboxIdSubscribed, MailboxId mailboxIdSubscribed,
{List<MailboxId>? listDescendantMailboxIds} {List<MailboxId>? listDescendantMailboxIds}
) { ) {
final _accountId = mailboxDashBoardController.accountId.value; final accountId = mailboxDashBoardController.accountId.value;
if (_accountId != null) { if (accountId != null) {
SubscribeRequest? subscribeRequest; SubscribeRequest? subscribeRequest;
if (listDescendantMailboxIds != null) { if (listDescendantMailboxIds != null) {
@@ -1157,9 +1155,9 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
} }
if (subscribeRequest is SubscribeMultipleMailboxRequest) { if (subscribeRequest is SubscribeMultipleMailboxRequest) {
consumeState(_subscribeMultipleMailboxInteractor.execute(_accountId, subscribeRequest)); consumeState(_subscribeMultipleMailboxInteractor.execute(accountId, subscribeRequest));
} else if (subscribeRequest is SubscribeMailboxRequest) { } else if (subscribeRequest is SubscribeMailboxRequest) {
consumeState(_subscribeMailboxInteractor.execute(_accountId, subscribeRequest)); consumeState(_subscribeMailboxInteractor.execute(accountId, subscribeRequest));
} }
} }
} }
@@ -221,7 +221,7 @@ class MailboxView extends GetWidget<MailboxController>
iconPadding: EdgeInsets.zero, iconPadding: EdgeInsets.zero,
icon: SvgPicture.asset( icon: SvgPicture.asset(
_imagePaths.icSearchBar, _imagePaths.icSearchBar,
color: AppColor.colorTextButton, colorFilter: AppColor.colorTextButton.asFilter(),
fit: BoxFit.fill fit: BoxFit.fill
), ),
tooltip: AppLocalizations.of(context).searchForMailboxes, tooltip: AppLocalizations.of(context).searchForMailboxes,
@@ -232,7 +232,10 @@ class MailboxView extends GetWidget<MailboxController>
iconSize: 20, iconSize: 20,
iconPadding: EdgeInsets.zero, iconPadding: EdgeInsets.zero,
splashRadius: 15, splashRadius: 15,
icon: SvgPicture.asset(_imagePaths.icAddNewFolder, color: AppColor.colorTextButton, fit: BoxFit.fill), icon: SvgPicture.asset(
_imagePaths.icAddNewFolder,
colorFilter: AppColor.colorTextButton.asFilter(),
fit: BoxFit.fill),
tooltip: AppLocalizations.of(context).new_mailbox, tooltip: AppLocalizations.of(context).new_mailbox,
onTap: () => controller.goToCreateNewMailboxView(context)), onTap: () => controller.goToCreateNewMailboxView(context)),
], ],
@@ -283,7 +286,8 @@ class MailboxView extends GetWidget<MailboxController>
categories.getExpandMode(controller.mailboxCategoriesExpandMode.value) == ExpandMode.EXPAND categories.getExpandMode(controller.mailboxCategoriesExpandMode.value) == ExpandMode.EXPAND
? _imagePaths.icExpandFolder ? _imagePaths.icExpandFolder
: _imagePaths.icCollapseFolder, : _imagePaths.icCollapseFolder,
color: AppColor.primaryColor, fit: BoxFit.fill), colorFilter: AppColor.primaryColor.asFilter(),
fit: BoxFit.fill),
tooltip: AppLocalizations.of(context).collapse, tooltip: AppLocalizations.of(context).collapse,
onTap: () => controller.toggleMailboxCategories(categories)), onTap: () => controller.toggleMailboxCategories(categories)),
Expanded(child: Text(categories.getTitle(context), Expanded(child: Text(categories.getTitle(context),
@@ -151,7 +151,7 @@ class MailboxView extends GetWidget<MailboxController>
iconPadding: EdgeInsets.zero, iconPadding: EdgeInsets.zero,
icon: SvgPicture.asset( icon: SvgPicture.asset(
_imagePaths.icSearchBar, _imagePaths.icSearchBar,
color: AppColor.colorTextButton, colorFilter: AppColor.colorTextButton.asFilter(),
fit: BoxFit.fill fit: BoxFit.fill
), ),
onTap: () => controller.openSearchViewAction(context) onTap: () => controller.openSearchViewAction(context)
@@ -161,7 +161,10 @@ class MailboxView extends GetWidget<MailboxController>
iconSize: 20, iconSize: 20,
iconPadding: EdgeInsets.zero, iconPadding: EdgeInsets.zero,
splashRadius: 15, splashRadius: 15,
icon: SvgPicture.asset(_imagePaths.icAddNewFolder, color: AppColor.colorTextButton, fit: BoxFit.fill), icon: SvgPicture.asset(
_imagePaths.icAddNewFolder,
colorFilter: AppColor.colorTextButton.asFilter(),
fit: BoxFit.fill),
tooltip: AppLocalizations.of(context).new_mailbox, tooltip: AppLocalizations.of(context).new_mailbox,
onTap: () => controller.goToCreateNewMailboxView(context)), onTap: () => controller.goToCreateNewMailboxView(context)),
], ],
@@ -396,7 +399,7 @@ class MailboxView extends GetWidget<MailboxController>
iconSize: 28, iconSize: 28,
icon: SvgPicture.asset( icon: SvgPicture.asset(
_imagePaths.icAppDashboard, _imagePaths.icAppDashboard,
color: AppColor.primaryColor, colorFilter: AppColor.primaryColor.asFilter(),
fit: BoxFit.fill fit: BoxFit.fill
), ),
tooltip: AppLocalizations.of(context).appGridTittle), tooltip: AppLocalizations.of(context).appGridTittle),
@@ -423,7 +426,7 @@ class MailboxView extends GetWidget<MailboxController>
controller.mailboxDashBoardController.appGridDashboardController.appDashboardExpandMode.value == ExpandMode.COLLAPSE controller.mailboxDashBoardController.appGridDashboardController.appDashboardExpandMode.value == ExpandMode.COLLAPSE
? _imagePaths.icCollapseFolder ? _imagePaths.icCollapseFolder
: _imagePaths.icExpandFolder, : _imagePaths.icExpandFolder,
color: AppColor.primaryColor, colorFilter: AppColor.primaryColor.asFilter(),
fit: BoxFit.fill fit: BoxFit.fill
)), )),
tooltip: AppLocalizations.of(context).appGridTittle, tooltip: AppLocalizations.of(context).appGridTittle,
@@ -145,7 +145,7 @@ mixin MailboxWidgetMixin {
Key('${contextMenuItem.action.name}_action'), Key('${contextMenuItem.action.name}_action'),
SvgPicture.asset( SvgPicture.asset(
contextMenuItem.action.getContextMenuIcon(imagePaths), contextMenuItem.action.getContextMenuIcon(imagePaths),
color: contextMenuItem.action.getColorContextMenuIcon(), colorFilter: contextMenuItem.action.getColorContextMenuIcon().asFilter(),
width: 24, width: 24,
height: 24 height: 24
), ),
@@ -298,7 +298,7 @@ mixin MailboxWidgetMixin {
expandMode == ExpandMode.EXPAND expandMode == ExpandMode.EXPAND
? imagePaths.icExpandFolder ? imagePaths.icExpandFolder
: imagePaths.icCollapseFolder, : imagePaths.icCollapseFolder,
color: AppColor.primaryColor, colorFilter: AppColor.primaryColor.asFilter(),
fit: BoxFit.fill fit: BoxFit.fill
), ),
tooltip: expandMode == ExpandMode.EXPAND tooltip: expandMode == ExpandMode.EXPAND
@@ -53,8 +53,8 @@ class MailboxNode with EquatableMixin{
} }
List<MailboxNode>? updateNode(MailboxId mailboxId, MailboxNode newNode, {MailboxNode? parent}) { List<MailboxNode>? updateNode(MailboxId mailboxId, MailboxNode newNode, {MailboxNode? parent}) {
List<MailboxNode>? _children = parent == null ? childrenItems : parent.childrenItems; List<MailboxNode>? children = parent == null ? childrenItems : parent.childrenItems;
return _children?.map((MailboxNode child) { return children?.map((MailboxNode child) {
if (child.item.id == mailboxId) { if (child.item.id == mailboxId) {
return newNode; return newNode;
} else { } else {
@@ -91,8 +91,8 @@ class MailboxNode with EquatableMixin{
} }
List<MailboxNode>? toggleSelectNode(MailboxNode selectedMailboxMode, {MailboxNode? parent}) { List<MailboxNode>? toggleSelectNode(MailboxNode selectedMailboxMode, {MailboxNode? parent}) {
List<MailboxNode>? _children = parent == null ? childrenItems : parent.childrenItems; List<MailboxNode>? children = parent == null ? childrenItems : parent.childrenItems;
return _children?.map((MailboxNode child) { return children?.map((MailboxNode child) {
if (child.item.id == selectedMailboxMode.item.id) { if (child.item.id == selectedMailboxMode.item.id) {
return child.toggleSelectMailboxNode(); return child.toggleSelectMailboxNode();
} else { } else {
@@ -105,8 +105,8 @@ class MailboxNode with EquatableMixin{
} }
List<MailboxNode>? toSelectedNode({required SelectMode selectMode, ExpandMode? newExpandMode, MailboxNode? parent}) { List<MailboxNode>? toSelectedNode({required SelectMode selectMode, ExpandMode? newExpandMode, MailboxNode? parent}) {
List<MailboxNode>? _children = parent == null ? childrenItems : parent.childrenItems; List<MailboxNode>? children = parent == null ? childrenItems : parent.childrenItems;
return _children?.map((MailboxNode child) { return children?.map((MailboxNode child) {
if (child.hasChildren()) { if (child.hasChildren()) {
return child.copyWith( return child.copyWith(
children: toSelectedNode(selectMode: selectMode, newExpandMode: newExpandMode, parent: child), children: toSelectedNode(selectMode: selectMode, newExpandMode: newExpandMode, parent: child),
@@ -49,7 +49,12 @@ class MailboxNewFolderTileBuilder {
leading: Padding( leading: Padding(
padding: const EdgeInsets.only(left: 34), padding: const EdgeInsets.only(left: 34),
child: _icon != null child: _icon != null
? SvgPicture.asset(_icon!, width: 24, height: 24, color: AppColor.mailboxIconColor, fit: BoxFit.fill) ? SvgPicture.asset(
_icon!,
width: 24,
height: 24,
colorFilter: AppColor.mailboxIconColor.asFilter(),
fit: BoxFit.fill)
: const SizedBox.shrink()), : const SizedBox.shrink()),
title: Padding( title: Padding(
padding: const EdgeInsets.only(left: 8), padding: const EdgeInsets.only(left: 8),
@@ -195,9 +195,9 @@ class MailBoxFolderTileBuilder {
_mailboxNode.expandMode == ExpandMode.EXPAND _mailboxNode.expandMode == ExpandMode.EXPAND
? _imagePaths.icExpandFolder ? _imagePaths.icExpandFolder
: _imagePaths.icCollapseFolder, : _imagePaths.icCollapseFolder,
color: _mailboxNode.item.allowedToDisplay colorFilter: _mailboxNode.item.allowedToDisplay
? AppColor.primaryColor ? AppColor.primaryColor.asFilter()
: AppColor.colorIconUnSubscribedMailbox, : AppColor.colorIconUnSubscribedMailbox.asFilter(),
fit: BoxFit.fill fit: BoxFit.fill
), ),
minSize: 12, minSize: 12,
@@ -82,7 +82,10 @@ class UserInformationWidgetBuilder extends StatelessWidget {
Transform( Transform(
transform: Matrix4.translationValues(14.0, 0.0, 0.0), transform: Matrix4.translationValues(14.0, 0.0, 0.0),
child: IconButton( child: IconButton(
icon: SvgPicture.asset(_imagePaths.icCollapseFolder, fit: BoxFit.fill, color: AppColor.colorCollapseMailbox), icon: SvgPicture.asset(
_imagePaths.icCollapseFolder,
fit: BoxFit.fill,
colorFilter: AppColor.colorCollapseMailbox.asFilter()),
onPressed: () => {})) onPressed: () => {}))
]), ]),
); );
@@ -13,9 +13,9 @@ class CompositeNameValidator extends Validator<NewNameRequest> {
CompositeNameValidator(this._listValidator); CompositeNameValidator(this._listValidator);
@override @override
Either<Failure, Success> validate(NewNameRequest newNameRequest) { Either<Failure, Success> validate(NewNameRequest value) {
return _listValidator.isNotEmpty return _listValidator.isNotEmpty
? _listValidator.getValidatorNameViewState(newNameRequest) ? _listValidator.getValidatorNameViewState(value)
: Right<Failure, Success>(VerifyNameViewState()); : Right<Failure, Success>(VerifyNameViewState());
} }
} }
@@ -11,11 +11,11 @@ class DuplicateNameValidator extends Validator<NewNameRequest> {
DuplicateNameValidator(this._listName); DuplicateNameValidator(this._listName);
@override @override
Either<Failure, Success> validate(NewNameRequest newNameRequest) { Either<Failure, Success> validate(NewNameRequest value) {
if (newNameRequest.value != null) { if (value.value != null) {
final nameExist = _listName final nameExist = _listName
.map((nameItem) => nameItem.toLowerCase()) .map((nameItem) => nameItem.toLowerCase())
.contains(newNameRequest.value!.toLowerCase()); .contains(value.value!.toLowerCase());
if (nameExist) { if (nameExist) {
return Left<Failure, Success>(VerifyNameFailure(const DuplicatedNameException())); return Left<Failure, Success>(VerifyNameFailure(const DuplicatedNameException()));
} else { } else {
@@ -10,8 +10,8 @@ import 'package:tmail_ui_user/features/mailbox_creator/domain/state/verify_name_
class EmailAddressValidator extends Validator<NewNameRequest> { class EmailAddressValidator extends Validator<NewNameRequest> {
@override @override
Either<Failure, Success> validate(NewNameRequest newNameRequest) { Either<Failure, Success> validate(NewNameRequest value) {
if (newNameRequest.value != null && GetUtils.isEmail(newNameRequest.value!)) { if (value.value != null && GetUtils.isEmail(value.value!)) {
return Right<Failure, Success>(VerifyNameViewState()); return Right<Failure, Success>(VerifyNameViewState());
} else { } else {
return Left<Failure, Success>(VerifyNameFailure(const EmailAddressInvalidException())); return Left<Failure, Success>(VerifyNameFailure(const EmailAddressInvalidException()));
@@ -9,8 +9,8 @@ import 'package:tmail_ui_user/features/mailbox_creator/domain/state/verify_name_
class EmptyNameValidator extends Validator<NewNameRequest> { class EmptyNameValidator extends Validator<NewNameRequest> {
@override @override
Either<Failure, Success> validate(NewNameRequest newNameRequest) { Either<Failure, Success> validate(NewNameRequest value) {
if (newNameRequest.value == null || newNameRequest.value!.isEmpty) { if (value.value == null || value.value!.isEmpty) {
return Left<Failure, Success>(VerifyNameFailure(const EmptyNameException())); return Left<Failure, Success>(VerifyNameFailure(const EmptyNameException()));
} else { } else {
return Right<Failure, Success>(VerifyNameViewState()); return Right<Failure, Success>(VerifyNameViewState());
@@ -10,8 +10,8 @@ import 'package:tmail_ui_user/features/mailbox_creator/domain/state/verify_name_
class SpecialCharacterValidator extends Validator<NewNameRequest> { class SpecialCharacterValidator extends Validator<NewNameRequest> {
@override @override
Either<Failure, Success> validate(NewNameRequest newNameRequest) { Either<Failure, Success> validate(NewNameRequest value) {
if (newNameRequest.value != null && newNameRequest.value!.hasSpecialCharactersInName()) { if (value.value != null && value.value!.hasSpecialCharactersInName()) {
return Left<Failure, Success>(VerifyNameFailure(const SpecialCharacterException())); return Left<Failure, Success>(VerifyNameFailure(const SpecialCharacterException()));
} else { } else {
return Right<Failure, Success>(VerifyNameViewState()); return Right<Failure, Success>(VerifyNameViewState());
@@ -180,7 +180,7 @@ class MailboxCreatorView extends GetWidget<MailboxCreatorController> {
color: AppColor.primaryColor, color: AppColor.primaryColor,
icon: SvgPicture.asset( icon: SvgPicture.asset(
_imagePaths.icCollapseFolder, _imagePaths.icCollapseFolder,
color: AppColor.colorCollapseMailbox, colorFilter: AppColor.colorCollapseMailbox.asFilter(),
fit: BoxFit.fill), fit: BoxFit.fill),
onPressed: () => controller.selectMailboxLocation(context)) onPressed: () => controller.selectMailboxLocation(context))
])), ])),
@@ -25,9 +25,7 @@ class SearchDataSourceImpl extends SearchDataSource {
recentSearch.value, recentSearch.value,
recentSearch.toRecentSearchCache()); recentSearch.toRecentSearchCache());
} }
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
@@ -47,9 +45,7 @@ class SearchDataSourceImpl extends SearchDataSource {
: listRecentSearch; : listRecentSearch;
return newListRecentSearch; return newListRecentSearch;
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
bool _filterRecentSearchCache(RecentSearchCache recentSearchCache, String? pattern) { bool _filterRecentSearchCache(RecentSearchCache recentSearchCache, String? pattern) {
@@ -16,27 +16,21 @@ class SharePreferenceSpamReportDataSourceImpl extends SpamReportDataSource {
Future<DateTime> getLastTimeDismissedSpamReported() async { Future<DateTime> getLastTimeDismissedSpamReported() async {
return Future.sync(() async { return Future.sync(() async {
return await _sharePreferenceSpamReportDataSource.getLastTimeDismissedSpamReported(); return await _sharePreferenceSpamReportDataSource.getLastTimeDismissedSpamReported();
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<bool> storeLastTimeDismissedSpamReported(DateTime lastTimeDismissedSpamReported) async { Future<bool> storeLastTimeDismissedSpamReported(DateTime lastTimeDismissedSpamReported) async {
return Future.sync(() async { return Future.sync(() async {
return await _sharePreferenceSpamReportDataSource.storeLastTimeDismissedSpamReported(lastTimeDismissedSpamReported); return await _sharePreferenceSpamReportDataSource.storeLastTimeDismissedSpamReported(lastTimeDismissedSpamReported);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<bool> deleteLastTimeDismissedSpamReported() { Future<bool> deleteLastTimeDismissedSpamReported() {
return Future.sync(() async { return Future.sync(() async {
return await _sharePreferenceSpamReportDataSource.deleteLastTimeDismissedSpamReported(); return await _sharePreferenceSpamReportDataSource.deleteLastTimeDismissedSpamReported();
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
@@ -54,26 +48,20 @@ class SharePreferenceSpamReportDataSourceImpl extends SpamReportDataSource {
Future<void> deleteSpamReportState() { Future<void> deleteSpamReportState() {
return Future.sync(() async { return Future.sync(() async {
return await _sharePreferenceSpamReportDataSource.deleteLastTimeDismissedSpamReported(); return await _sharePreferenceSpamReportDataSource.deleteLastTimeDismissedSpamReported();
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<SpamReportState> getSpamReportState() { Future<SpamReportState> getSpamReportState() {
return Future.sync(() async { return Future.sync(() async {
return await _sharePreferenceSpamReportDataSource.getSpamReportState(); return await _sharePreferenceSpamReportDataSource.getSpamReportState();
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<void> storeSpamReportState(SpamReportState spamReportState) { Future<void> storeSpamReportState(SpamReportState spamReportState) {
return Future.sync(() async { return Future.sync(() async {
return await _sharePreferenceSpamReportDataSource.storeSpamReportState(spamReportState); return await _sharePreferenceSpamReportDataSource.storeSpamReportState(spamReportState);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
} }
@@ -28,12 +28,10 @@ class SpamReportDataSourceImpl extends SpamReportDataSource {
} }
) { ) {
return Future.sync(() async { return Future.sync(() async {
final _unreadSpamEmailsResponse = await _spamReportApi.getUnreadSpamEmailbox( final unreadSpamEmailsResponse = await _spamReportApi.getUnreadSpamEmailbox(
accountId, mailboxFilterCondition: mailboxFilterCondition, limit: limit); accountId, mailboxFilterCondition: mailboxFilterCondition, limit: limit);
return _unreadSpamEmailsResponse; return unreadSpamEmailsResponse;
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
@@ -14,15 +14,15 @@ class SharePreferenceSpamReportDataSource extends SpamReportDataSource {
@override @override
Future<DateTime> getLastTimeDismissedSpamReported() async { Future<DateTime> getLastTimeDismissedSpamReported() async {
final _timeStamp = _sharedPreferences.getInt(MailboxDashboardConstant.keyLastTimeDismissedSpamReported) ?? 0; final timeStamp = _sharedPreferences.getInt(MailboxDashboardConstant.keyLastTimeDismissedSpamReported) ?? 0;
final _lastTimeDismissedSpamReported = DateTime.fromMillisecondsSinceEpoch(_timeStamp); final lastTimeDismissedSpamReported = DateTime.fromMillisecondsSinceEpoch(timeStamp);
return _lastTimeDismissedSpamReported; return lastTimeDismissedSpamReported;
} }
@override @override
Future<bool> storeLastTimeDismissedSpamReported(DateTime lastTimeDismissedSpamReported) async { Future<bool> storeLastTimeDismissedSpamReported(DateTime lastTimeDismissedSpamReported) async {
final _timeStamp = lastTimeDismissedSpamReported.millisecondsSinceEpoch; final timeStamp = lastTimeDismissedSpamReported.millisecondsSinceEpoch;
return await _sharedPreferences.setInt(MailboxDashboardConstant.keyLastTimeDismissedSpamReported,_timeStamp); return await _sharedPreferences.setInt(MailboxDashboardConstant.keyLastTimeDismissedSpamReported,timeStamp);
} }
@override @override
@@ -48,13 +48,13 @@ class SharePreferenceSpamReportDataSource extends SpamReportDataSource {
@override @override
Future<SpamReportState> getSpamReportState() async { Future<SpamReportState> getSpamReportState() async {
final _spamReportState = _sharedPreferences.getString(MailboxDashboardConstant.keySpamReportState) ?? ''; final spamReportState = _sharedPreferences.getString(MailboxDashboardConstant.keySpamReportState) ?? '';
return _spamReportState == SpamReportState.disabled.keyValue ? SpamReportState.disabled : SpamReportState.enabled; return spamReportState == SpamReportState.disabled.keyValue ? SpamReportState.disabled : SpamReportState.enabled;
} }
@override @override
Future<bool> storeSpamReportState(SpamReportState spamReportState) async { Future<bool> storeSpamReportState(SpamReportState spamReportState) async {
final _spamReportState = spamReportState.keyValue; final spamReportState0 = spamReportState.keyValue;
return await _sharedPreferences.setString(MailboxDashboardConstant.keySpamReportState, _spamReportState); return await _sharedPreferences.setString(MailboxDashboardConstant.keySpamReportState, spamReportState0);
} }
} }
@@ -40,12 +40,12 @@ class SpamReportApi {
.build() .build()
.execute(); .execute();
final _mailboxResponse = result final mailboxResponse = result
.parse<GetMailboxResponse>(getMailboxInvocation.methodCallId, GetMailboxResponse.deserialize); .parse<GetMailboxResponse>(getMailboxInvocation.methodCallId, GetMailboxResponse.deserialize);
return Future.sync(() async { return Future.sync(() async {
final _unreadSpamMailbox = _mailboxResponse?.list.first; final unreadSpamMailbox = mailboxResponse?.list.first;
return UnreadSpamEmailsResponse(unreadSpamMailbox: _unreadSpamMailbox); return UnreadSpamEmailsResponse(unreadSpamMailbox: unreadSpamMailbox);
}).catchError((error) { }).catchError((error) {
throw error; throw error;
}); });
@@ -23,17 +23,17 @@ class GetUnreadSpamMailboxInteractor {
) async* { ) async* {
try { try {
yield Right(GetUnreadSpamMailboxLoading()); yield Right(GetUnreadSpamMailboxLoading());
final _lastTimeDissmissedSpamReported = await _spamReportRepository.getLastTimeDismissedSpamReported(); final lastTimeDismissedSpamReported = await _spamReportRepository.getLastTimeDismissedSpamReported();
final _timeLast = DateTime.now().difference(_lastTimeDissmissedSpamReported); final timeLast = DateTime.now().difference(lastTimeDismissedSpamReported);
final _checkTimeCondition = (_timeLast.inHours > 0) && (_timeLast.inHours > conditionsForDisplayingSpamReportBanner); final checkTimeCondition = (timeLast.inHours > 0) && (timeLast.inHours > conditionsForDisplayingSpamReportBanner);
if (_checkTimeCondition) { if (checkTimeCondition) {
final _response = await _spamReportRepository.getUnreadSpamMailbox(accountId, mailboxFilterCondition: mailboxFilterCondition, limit: limit); final response = await _spamReportRepository.getUnreadSpamMailbox(accountId, mailboxFilterCondition: mailboxFilterCondition, limit: limit);
final _unreadSpamMailbox = _response.unreadSpamMailbox; final unreadSpamMailbox = response.unreadSpamMailbox;
if (_unreadSpamMailbox!.unreadEmails!.value.value > 0) { if (unreadSpamMailbox!.unreadEmails!.value.value > 0) {
yield Right(GetUnreadSpamMailboxSuccess(_unreadSpamMailbox)); yield Right(GetUnreadSpamMailboxSuccess(unreadSpamMailbox));
} else { } else {
yield Left(InvalidSpamReportCondition()); yield Left(InvalidSpamReportCondition());
} }
@@ -137,12 +137,12 @@ class AdvancedFilterController extends BaseController {
void selectedMailBox(BuildContext context) async { void selectedMailBox(BuildContext context) async {
final accountId = _mailboxDashBoardController.accountId.value; final accountId = _mailboxDashBoardController.accountId.value;
final _session = _mailboxDashBoardController.sessionCurrent; final session = _mailboxDashBoardController.sessionCurrent;
if (accountId != null) { if (accountId != null) {
final arguments = DestinationPickerArguments( final arguments = DestinationPickerArguments(
accountId, accountId,
MailboxActions.select, MailboxActions.select,
_session, session,
mailboxIdSelected: searchController.searchEmailFilter.value.mailbox?.id); mailboxIdSelected: searchController.searchEmailFilter.value.mailbox?.id);
if (BuildUtils.isWeb) { if (BuildUtils.isWeb) {
@@ -573,7 +573,7 @@ class MailboxDashBoardController extends ReloadableController {
_imagePaths.icMailboxDrafts, _imagePaths.icMailboxDrafts,
width: 24, width: 24,
height: 24, height: 24,
color: Colors.white, colorFilter: Colors.white.asFilter(),
fit: BoxFit.fill), fit: BoxFit.fill),
backgroundColor: AppColor.toastSuccessBackgroundColor, backgroundColor: AppColor.toastSuccessBackgroundColor,
textColor: Colors.white, textColor: Colors.white,
@@ -606,7 +606,7 @@ class MailboxDashBoardController extends ReloadableController {
_imagePaths.icFolderMailbox, _imagePaths.icFolderMailbox,
width: 24, width: 24,
height: 24, height: 24,
color: Colors.white, colorFilter: Colors.white.asFilter(),
fit: BoxFit.fill), fit: BoxFit.fill),
backgroundColor: AppColor.toastSuccessBackgroundColor, backgroundColor: AppColor.toastSuccessBackgroundColor,
textColor: Colors.white, textColor: Colors.white,
@@ -939,7 +939,7 @@ class MailboxDashBoardController extends ReloadableController {
_imagePaths.icFolderMailbox, _imagePaths.icFolderMailbox,
width: 24, width: 24,
height: 24, height: 24,
color: Colors.white, colorFilter: Colors.white.asFilter(),
fit: BoxFit.fill), fit: BoxFit.fill),
backgroundColor: AppColor.toastSuccessBackgroundColor, backgroundColor: AppColor.toastSuccessBackgroundColor,
textColor: Colors.white, textColor: Colors.white,
@@ -1553,8 +1553,8 @@ class MailboxDashBoardController extends ReloadableController {
} }
void storeSpamReportStateAction() { void storeSpamReportStateAction() {
final _storeSpamReportState = enableSpamReport ? SpamReportState.disabled : SpamReportState.enabled; final storeSpamReportState = enableSpamReport ? SpamReportState.disabled : SpamReportState.enabled;
spamReportController.storeSpamReportStateAction(_storeSpamReportState); spamReportController.storeSpamReportStateAction(storeSpamReportState);
} }
void onDragMailbox(bool isDragging) { void onDragMailbox(bool isDragging) {
@@ -62,9 +62,9 @@ class SpamReportController extends BaseController {
} }
void getUnreadSpamMailboxAction(AccountId accountId) { void getUnreadSpamMailboxAction(AccountId accountId) {
final _mailboxFilterCondition = MailboxFilterCondition(role: Role('Spam')); final mailboxFilterCondition = MailboxFilterCondition(role: Role('Spam'));
getSpamReportStateAction(); getSpamReportStateAction();
consumeState(_getNumberOfUnreadSpamEmailsInteractor.execute(accountId,mailboxFilterCondition: _mailboxFilterCondition)); consumeState(_getNumberOfUnreadSpamEmailsInteractor.execute(accountId,mailboxFilterCondition: mailboxFilterCondition));
} }
void _storeLastTimeDismissedSpamReportedAction() { void _storeLastTimeDismissedSpamReportedAction() {
@@ -78,9 +78,9 @@ class SpamReportController extends BaseController {
bool get enableSpamReport => _spamReportState.value == SpamReportState.enabled; bool get enableSpamReport => _spamReportState.value == SpamReportState.enabled;
void openMailbox(BuildContext context) { void openMailbox(BuildContext context) {
final _mailboxDashBoardController = Get.find<MailboxDashBoardController>(); final mailboxDashBoardController = Get.find<MailboxDashBoardController>();
dismissSpamReportAction(); dismissSpamReportAction();
_mailboxDashBoardController.openMailboxAction(context, _presentationSpamMailbox.value!); mailboxDashBoardController.openMailboxAction(context, _presentationSpamMailbox.value!);
} }
void storeSpamReportStateAction(SpamReportState spamReportState) { void storeSpamReportStateAction(SpamReportState spamReportState) {
@@ -105,6 +105,7 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView {
Column(children: [ Column(children: [
_buildComposerButton(context), _buildComposerButton(context),
Expanded(child: SizedBox( Expanded(child: SizedBox(
width: ResponsiveUtils.defaultSizeMenu,
child: Obx(() { child: Obx(() {
if (controller.searchMailboxActivated.isTrue) { if (controller.searchMailboxActivated.isTrue) {
return const SearchMailboxView( return const SearchMailboxView(
@@ -113,8 +114,7 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView {
} else { } else {
return MailboxView(); return MailboxView();
} }
}), })
width: ResponsiveUtils.defaultSizeMenu
)) ))
]), ]),
Expanded(child: Column(children: [ Expanded(child: Column(children: [
@@ -204,8 +204,8 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView {
key: controller.scaffoldKey, key: controller.scaffoldKey,
drawer: ResponsiveWidget( drawer: ResponsiveWidget(
responsiveUtils: responsiveUtils, responsiveUtils: responsiveUtils,
mobile: SizedBox(child: MailboxView(), width: ResponsiveUtils.defaultSizeDrawer), mobile: SizedBox(width: ResponsiveUtils.defaultSizeDrawer, child: MailboxView()),
tabletLarge: SizedBox(child: MailboxView(), width: ResponsiveUtils.defaultSizeLeftMenuMobile), tabletLarge: SizedBox(width: ResponsiveUtils.defaultSizeLeftMenuMobile, child: MailboxView()),
desktop: const SizedBox.shrink() desktop: const SizedBox.shrink()
), ),
body: body, body: body,
@@ -306,16 +306,6 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView {
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () => appGridDashboardController.toggleAppGridDashboard()), onTap: () => appGridDashboardController.toggleAppGridDashboard()),
child: PortalTarget( child: PortalTarget(
child: buildIconWeb(
onTap: controller.showAppDashboardAction,
splashRadius: 20,
icon: SvgPicture.asset(
imagePaths.icAppDashboard,
width: 28,
height: 28,
fit: BoxFit.fill
),
),
anchor: const Aligned( anchor: const Aligned(
follower: Alignment.topRight, follower: Alignment.topRight,
target: Alignment.bottomRight target: Alignment.bottomRight
@@ -327,6 +317,16 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView {
return const SizedBox.shrink(); return const SizedBox.shrink();
}), }),
visible: appGridDashboardController.isAppGridDashboardOverlayOpen.isTrue, visible: appGridDashboardController.isAppGridDashboardOverlayOpen.isTrue,
child: buildIconWeb(
onTap: controller.showAppDashboardAction,
splashRadius: 20,
icon: SvgPicture.asset(
imagePaths.icAppDashboard,
width: 28,
height: 28,
fit: BoxFit.fill
),
),
) )
) )
) )
@@ -63,8 +63,8 @@ mixin FilterEmailPopupMenuMixin {
width: 20, width: 20,
height: 20, height: 20,
fit: BoxFit.fill, fit: BoxFit.fill,
color: option != FilterMessageOption.starred colorFilter: option != FilterMessageOption.starred
? AppColor.colorTextButton ? AppColor.colorTextButton.asFilter()
: null), : null),
const SizedBox(width: 12), const SizedBox(width: 12),
Expanded(child: Text( Expanded(child: Text(
@@ -6,7 +6,7 @@ import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/ad
import 'package:tmail_ui_user/main/localizations/app_localizations.dart'; import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
Future<void> showAdvancedSearchFilterBottomSheet(BuildContext context) async { Future<void> showAdvancedSearchFilterBottomSheet(BuildContext context) async {
final ImagePaths _imagePaths = Get.find<ImagePaths>(); final ImagePaths imagePaths = Get.find<ImagePaths>();
await FullScreenActionSheetBuilder( await FullScreenActionSheetBuilder(
context: context, context: context,
@@ -19,8 +19,8 @@ Future<void> showAdvancedSearchFilterBottomSheet(BuildContext context) async {
cancelWidget: Padding( cancelWidget: Padding(
padding: const EdgeInsets.only(right: 16), padding: const EdgeInsets.only(right: 16),
child: SvgPicture.asset( child: SvgPicture.asset(
_imagePaths.icCloseAdvancedSearch, imagePaths.icCloseAdvancedSearch,
color: AppColor.colorHintSearchBar, colorFilter: AppColor.colorHintSearchBar.asFilter(),
width: 24, width: 24,
height: 24, height: 24,
), ),
@@ -18,15 +18,15 @@ class AdvancedSearchFilterFormBottomView extends GetWidget<AdvancedFilterControl
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final _responsiveUtils = Get.find<ResponsiveUtils>(); final responsiveUtils = Get.find<ResponsiveUtils>();
return Padding( return Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: _isMobileAndLandscapeTablet(context, _responsiveUtils) ? 8 : 20), top: _isMobileAndLandscapeTablet(context, responsiveUtils) ? 8 : 20),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
if (_isMobileAndLandscapeTablet(context, _responsiveUtils)) if (_isMobileAndLandscapeTablet(context, responsiveUtils))
...[ ...[
_buildCheckboxHasAttachment( _buildCheckboxHasAttachment(
context, context,
@@ -35,17 +35,17 @@ class AdvancedSearchFilterFormBottomView extends GetWidget<AdvancedFilterControl
const SizedBox(height: 24) const SizedBox(height: 24)
], ],
Row( Row(
mainAxisAlignment: _isMobileAndLandscapeTablet(context, _responsiveUtils) mainAxisAlignment: _isMobileAndLandscapeTablet(context, responsiveUtils)
? MainAxisAlignment.spaceEvenly ? MainAxisAlignment.spaceEvenly
: MainAxisAlignment.center, : MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
if (!_isMobileAndLandscapeTablet(context, _responsiveUtils)) if (!_isMobileAndLandscapeTablet(context, responsiveUtils))
Expanded(child: _buildCheckboxHasAttachment( Expanded(child: _buildCheckboxHasAttachment(
context, context,
currentFocusNode: focusManager?.attachmentCheckboxFocusNode, currentFocusNode: focusManager?.attachmentCheckboxFocusNode,
nextFocusNode: focusManager?.searchButtonFocusNode)), nextFocusNode: focusManager?.searchButtonFocusNode)),
..._buildListButton(context, _responsiveUtils), ..._buildListButton(context, responsiveUtils),
], ],
), ),
], ],
@@ -42,7 +42,7 @@ Widget _buildDropDownButton<T>({
DateTime? startDate, DateTime? startDate,
DateTime? endDate DateTime? endDate
}) { }) {
final ImagePaths _imagePaths = Get.find<ImagePaths>(); final ImagePaths imagePaths = Get.find<ImagePaths>();
return DropdownButtonHideUnderline( return DropdownButtonHideUnderline(
child: DropdownButton2<T>( child: DropdownButton2<T>(
@@ -68,7 +68,7 @@ Widget _buildDropDownButton<T>({
.toList(), .toList(),
value: itemSelected, value: itemSelected,
onChanged: onChanged, onChanged: onChanged,
icon: SvgPicture.asset(_imagePaths.icDropDown), icon: SvgPicture.asset(imagePaths.icDropDown),
buttonPadding: const EdgeInsets.symmetric(horizontal: 12), buttonPadding: const EdgeInsets.symmetric(horizontal: 12),
buttonDecoration: BoxDecoration( buttonDecoration: BoxDecoration(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
@@ -28,9 +28,9 @@ class IconOpenAdvancedSearchWidget extends StatelessWidget {
minSize: 40, minSize: 40,
iconPadding: const EdgeInsets.only(right: 2), iconPadding: const EdgeInsets.only(right: 2),
icon: SvgPicture.asset(_imagePaths.icFilterAdvanced, icon: SvgPicture.asset(_imagePaths.icFilterAdvanced,
color: searchController.isAdvancedSearchViewOpen.isTrue || searchController.advancedSearchIsActivated.isTrue colorFilter: searchController.isAdvancedSearchViewOpen.isTrue || searchController.advancedSearchIsActivated.isTrue
? AppColor.colorFilterMessageEnabled ? AppColor.colorFilterMessageEnabled.asFilter()
: AppColor.colorFilterMessageDisabled, : AppColor.colorFilterMessageDisabled.asFilter(),
width: 16, width: 16,
height: 16), height: 16),
onTap: () { onTap: () {
@@ -19,7 +19,7 @@ class DownloadTaskItemWidget extends StatelessWidget with AppLoaderMixin {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final _imagePaths = Get.find<ImagePaths>(); final imagePaths = Get.find<ImagePaths>();
return Container( return Container(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
@@ -36,7 +36,7 @@ class DownloadTaskItemWidget extends StatelessWidget with AppLoaderMixin {
height: 30, height: 30,
child: Stack(alignment: Alignment.center, children: [ child: Stack(alignment: Alignment.center, children: [
SvgPicture.asset( SvgPicture.asset(
taskState.attachment.getIcon(_imagePaths), taskState.attachment.getIcon(imagePaths),
width: 16, width: 16,
height: 16, height: 16,
fit: BoxFit.fill), fit: BoxFit.fill),
@@ -12,10 +12,10 @@ class SpamReportBannerWebWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context){ Widget build(BuildContext context){
final _spamReportController = Get.find<SpamReportController>(); final spamReportController = Get.find<SpamReportController>();
final _imagePaths = Get.find<ImagePaths>(); final imagePaths = Get.find<ImagePaths>();
return Obx(() { return Obx(() {
if (!_spamReportController.enableSpamReport || _spamReportController.notShowSpamReportBanner) { if (!spamReportController.enableSpamReport || spamReportController.notShowSpamReportBanner) {
return const SizedBox( return const SizedBox(
height: 8, height: 8,
); );
@@ -36,15 +36,15 @@ class SpamReportBannerWebWidget extends StatelessWidget {
Row( Row(
children: [ children: [
SvgPicture.asset( SvgPicture.asset(
_imagePaths.icInfoCircleOutline, imagePaths.icInfoCircleOutline,
width: 28, width: 28,
height: 28, height: 28,
color: AppColor.primaryColor, colorFilter: AppColor.primaryColor.asFilter(),
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
Text( Text(
AppLocalizations.of(context).countNewSpamEmails( AppLocalizations.of(context).countNewSpamEmails(
_spamReportController.numberOfUnreadSpamEmails), spamReportController.numberOfUnreadSpamEmails),
style: const TextStyle( style: const TextStyle(
fontSize: 16, fontSize: 16,
color: AppColor.primaryColor, color: AppColor.primaryColor,
@@ -66,7 +66,7 @@ class SpamReportBannerWebWidget extends StatelessWidget {
fontWeight: FontWeight.w400), fontWeight: FontWeight.w400),
backgroundColor: AppColor.colorCreateNewIdentityButton, backgroundColor: AppColor.colorCreateNewIdentityButton,
radius: 10, radius: 10,
onTap: () => _spamReportController.openMailbox(context), onTap: () => spamReportController.openMailbox(context),
), ),
), ),
], ],
@@ -75,8 +75,8 @@ class SpamReportBannerWebWidget extends StatelessWidget {
top: 16, top: 16,
right: 16, right: 16,
child: buildSVGIconButton( child: buildSVGIconButton(
icon: _imagePaths.icCloseComposer, icon: imagePaths.icCloseComposer,
onTap: () => _spamReportController.dismissSpamReportAction(), onTap: () => spamReportController.dismissSpamReportAction(),
), ),
), ),
], ],
@@ -42,7 +42,7 @@ class TopBarThreadSelection {
buildIconWeb( buildIconWeb(
icon: SvgPicture.asset( icon: SvgPicture.asset(
imagePaths.icCloseComposer, imagePaths.icCloseComposer,
color: AppColor.colorTextButton, colorFilter: AppColor.colorTextButton.asFilter(),
fit: BoxFit.fill), fit: BoxFit.fill),
tooltip: AppLocalizations.of(context).cancel, tooltip: AppLocalizations.of(context).cancel,
onTap: onCancelSelection), onTap: onCancelSelection),
@@ -113,9 +113,9 @@ class TopBarThreadSelection {
canDeletePermanently canDeletePermanently
? imagePaths.icDeleteComposer ? imagePaths.icDeleteComposer
: imagePaths.icDelete, : imagePaths.icDelete,
color: canDeletePermanently colorFilter: canDeletePermanently
? AppColor.colorDeletePermanentlyButton ? AppColor.colorDeletePermanentlyButton.asFilter()
: AppColor.primaryColor, : AppColor.primaryColor.asFilter(),
width: 20, width: 20,
height: 20, height: 20,
fit: BoxFit.fill), fit: BoxFit.fill),
@@ -18,35 +18,27 @@ class ForwardingDataSourceImpl extends ForwardingDataSource {
Future<TMailForward> getForward(AccountId accountId) { Future<TMailForward> getForward(AccountId accountId) {
return Future.sync(() async { return Future.sync(() async {
return await _forwardingAPI.getForward(accountId); return await _forwardingAPI.getForward(accountId);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<TMailForward> deleteRecipientInForwarding(AccountId accountId, DeleteRecipientInForwardingRequest deleteRequest) { Future<TMailForward> deleteRecipientInForwarding(AccountId accountId, DeleteRecipientInForwardingRequest deleteRequest) {
return Future.sync(() async { return Future.sync(() async {
return await _forwardingAPI.updateForward(accountId, deleteRequest.newTMailForward); return await _forwardingAPI.updateForward(accountId, deleteRequest.newTMailForward);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<TMailForward> addRecipientsInForwarding(AccountId accountId, AddRecipientInForwardingRequest addRequest) { Future<TMailForward> addRecipientsInForwarding(AccountId accountId, AddRecipientInForwardingRequest addRequest) {
return Future.sync(() async { return Future.sync(() async {
return await _forwardingAPI.updateForward(accountId, addRequest.newTMailForward); return await _forwardingAPI.updateForward(accountId, addRequest.newTMailForward);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<TMailForward> editLocalCopyInForwarding(AccountId accountId, EditLocalCopyInForwardingRequest editRequest) { Future<TMailForward> editLocalCopyInForwarding(AccountId accountId, EditLocalCopyInForwardingRequest editRequest) {
return Future.sync(() async { return Future.sync(() async {
return await _forwardingAPI.updateForward(accountId, editRequest.newTMailForward); return await _forwardingAPI.updateForward(accountId, editRequest.newTMailForward);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
} }
@@ -20,35 +20,27 @@ class IdentityDataSourceImpl extends IdentityDataSource {
{Properties? properties}) { {Properties? properties}) {
return Future.sync(() async { return Future.sync(() async {
return await _identityAPI.getAllIdentities(accountId, properties: properties); return await _identityAPI.getAllIdentities(accountId, properties: properties);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<Identity> createNewIdentity(AccountId accountId, CreateNewIdentityRequest identityRequest) { Future<Identity> createNewIdentity(AccountId accountId, CreateNewIdentityRequest identityRequest) {
return Future.sync(() async { return Future.sync(() async {
return await _identityAPI.createNewIdentity(accountId, identityRequest); return await _identityAPI.createNewIdentity(accountId, identityRequest);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<bool> deleteIdentity(AccountId accountId, IdentityId identityId) { Future<bool> deleteIdentity(AccountId accountId, IdentityId identityId) {
return Future.sync(() async { return Future.sync(() async {
return await _identityAPI.deleteIdentity(accountId, identityId); return await _identityAPI.deleteIdentity(accountId, identityId);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<bool> editIdentity(AccountId accountId, EditIdentityRequest editIdentityRequest) { Future<bool> editIdentity(AccountId accountId, EditIdentityRequest editIdentityRequest) {
return Future.sync(() async { return Future.sync(() async {
return await _identityAPI.editIdentity(accountId, editIdentityRequest); return await _identityAPI.editIdentity(accountId, editIdentityRequest);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
} }
@@ -18,8 +18,6 @@ class ManageAccountDataSourceImpl extends ManageAccountDataSource {
Future<void> persistLanguage(Locale localeCurrent) { Future<void> persistLanguage(Locale localeCurrent) {
return Future.sync(() async { return Future.sync(() async {
return await _languageCacheManager.persistLanguage(localeCurrent); return await _languageCacheManager.persistLanguage(localeCurrent);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
} }
@@ -22,9 +22,7 @@ class RuleFilterDataSourceImpl extends RuleFilterDataSource {
Future<List<TMailRule>> getAllTMailRule(AccountId accountId) { Future<List<TMailRule>> getAllTMailRule(AccountId accountId) {
return Future.sync(() async { return Future.sync(() async {
return await _ruleFilterAPI.getListTMailRule(accountId); return await _ruleFilterAPI.getListTMailRule(accountId);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
@@ -34,26 +32,20 @@ class RuleFilterDataSourceImpl extends RuleFilterDataSource {
return Future.sync(() async { return Future.sync(() async {
return await _ruleFilterAPI.updateListTMailRule(accountId, deleteEmailRuleRequest.currentEmailRules); return await _ruleFilterAPI.updateListTMailRule(accountId, deleteEmailRuleRequest.currentEmailRules);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<List<TMailRule>> createNewEmailRuleFilter(AccountId accountId, CreateNewEmailRuleFilterRequest ruleFilterRequest) { Future<List<TMailRule>> createNewEmailRuleFilter(AccountId accountId, CreateNewEmailRuleFilterRequest ruleFilterRequest) {
return Future.sync(() async { return Future.sync(() async {
return await _ruleFilterAPI.updateListTMailRule(accountId, ruleFilterRequest.newListTMailRules); return await _ruleFilterAPI.updateListTMailRule(accountId, ruleFilterRequest.newListTMailRules);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<List<TMailRule>> editEmailRuleFilter(AccountId accountId, EditEmailRuleFilterRequest ruleFilterRequest) { Future<List<TMailRule>> editEmailRuleFilter(AccountId accountId, EditEmailRuleFilterRequest ruleFilterRequest) {
return Future.sync(() async { return Future.sync(() async {
return await _ruleFilterAPI.updateListTMailRule(accountId, ruleFilterRequest.listTMailRulesUpdated); return await _ruleFilterAPI.updateListTMailRule(accountId, ruleFilterRequest.listTMailRulesUpdated);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
} }
@@ -15,17 +15,13 @@ class VacationDataSourceImpl extends VacationDataSource {
Future<List<VacationResponse>> getAllVacationResponse(AccountId accountId) { Future<List<VacationResponse>> getAllVacationResponse(AccountId accountId) {
return Future.sync(() async { return Future.sync(() async {
return await _vacationAPI.getAllVacationResponse(accountId); return await _vacationAPI.getAllVacationResponse(accountId);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
@override @override
Future<List<VacationResponse>> updateVacation(AccountId accountId, VacationResponse vacationResponse) { Future<List<VacationResponse>> updateVacation(AccountId accountId, VacationResponse vacationResponse) {
return Future.sync(() async { return Future.sync(() async {
return await _vacationAPI.updateVacation(accountId, vacationResponse); return await _vacationAPI.updateVacation(accountId, vacationResponse);
}).catchError((error) { }).catchError(_exceptionThrower.throwException);
_exceptionThrower.throwException(error);
});
} }
} }

Some files were not shown because too many files have changed in this diff Show More