Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Rewrite the profile module #155

Merged
merged 13 commits into from
Apr 1, 2024
4 changes: 3 additions & 1 deletion lib/common/consts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.
// coverage:ignore-file

import 'dart:ui';

import '../model/app_reminder_config.dart';
import '../model/habit_display.dart';
import '../model/habit_form.dart';
Expand All @@ -35,7 +37,7 @@ const int appDBVersion = 3;
//#endregion

//#region app-theme
const int appDefaultThemeMainColor = 0xFF006493;
const Color appDefaultThemeMainColor = Color(0xFF006493);
const AppThemeType appDefaultThemeType = AppThemeType.followSystem;
const int appCalendarBarMaxOccupyPrt = 70;
const int appCalendarBarMinOccupyPrt = 20;
Expand Down
2 changes: 2 additions & 0 deletions lib/common/types.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import '../model/habit_form.dart';

typedef DBID = int;

typedef JsonMap = Map<String, dynamic>;

typedef HabitUUID = String;
typedef HabitRecordUUID = String;
typedef HabitDailyGoal = num;
Expand Down
285 changes: 0 additions & 285 deletions lib/db/profile.dart

This file was deleted.

4 changes: 4 additions & 0 deletions lib/logging/logger_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ abstract interface class AppLoggerMananger with FutureInitializationABC {
AppTextLogger get network;
AppTextLogger get json;
AppWidgetLogger get l10n;
AppTextLogger get cache;

Future<bool> changeLogger(l.Logger newLogger);

Expand Down Expand Up @@ -138,6 +139,9 @@ class _AppLoggerManager implements AppLoggerMananger {
buildNewLogger: (t) => AppWidgetLogger(this, t),
);

@override
AppTextLogger get cache => _tryGetAppTextLogger(LoggerType.cache);

@override
Future<bool> changeLogger(l.Logger newLogger) async {
if (newLogger.isClosed()) return false;
Expand Down
3 changes: 3 additions & 0 deletions lib/logging/logger_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,7 @@ enum LoggerType {

/// Localization
l10n,

/// App cache
cache,
}
2 changes: 0 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import 'package:timezone/data/latest_all.dart' as tz;

import 'common/app_info.dart';
import 'common/utils.dart';
import 'db/profile.dart';
import 'logging/logger_manager.dart';
import 'reminders/notification_service.dart';
import 'view/app.dart';
Expand All @@ -26,7 +25,6 @@ Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();

await AppLoggerMananger().init();
await Profile().init();
await AppInfo().init();
await NotificationService().init();

Expand Down
5 changes: 5 additions & 0 deletions lib/model/app_reminder_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,9 @@ class AppReminderConfig implements JsonAdaptor {
@override
int get hashCode =>
hash3(enabled.hashCode, type.hashCode, timeOfDay.hashCode);

@override
String toString() {
return "$runtimeType(${toJson()})";
}
}
Loading
Loading