Skip to content

Commit

Permalink
Added database admin interface
Browse files Browse the repository at this point in the history
  • Loading branch information
thePeras committed Jan 4, 2025
1 parent be6b586 commit e88d8a9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
9 changes: 9 additions & 0 deletions packages/uni_app/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,16 @@ flutter {
source "../.."
}

configurations {
debugImplementation {
exclude group: 'io.objectbox', module: 'objectbox-android'
}
}

dependencies {
implementation "io.objectbox:objectbox-android:4.0.3"
debugImplementation("io.objectbox:objectbox-android-objectbrowser:4.0.3")

// The following 3 lines are a workaround for the Flutter issue.
// Learn more: https://github.com/flutter/flutter/issues/110658
implementation "androidx.window:window:1.3.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Database {
static final Database _instance = Database._internal();

late final Store _store;
Admin? _admin;

late final Box<Exam> _examBox;
late final Box<Lecture> _lectureBox;
Expand Down Expand Up @@ -103,6 +104,11 @@ class Database {
}
} finally {
_boxesInitialization();

//TODO(thePeras): Check if is only runned in debug mode
if (Admin.isAvailable()) {
_admin = Admin(_store);
}
}
}

Expand Down Expand Up @@ -132,6 +138,7 @@ class Database {

void close() {
_store.close();
_admin?.close();
}

Future<void> remove() async {
Expand Down
8 changes: 5 additions & 3 deletions packages/uni_app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,17 @@ Future<void> main() async {
ReferenceProvider(),
);

//unawaited(cleanupCachedFiles());
unawaited(cleanupCachedFiles());

// Initialize WorkManager for background tasks
await Workmanager().initialize(
workerStartCallback,
isInDebugMode: !kReleaseMode,
);

// NoSQL database initialization
await Database().init();

// Read environment, which may include app tokens
await dotenv
.load(fileName: 'assets/env/.env', isOptional: true)
Expand All @@ -124,8 +127,7 @@ Future<void> main() async {
Logger().w('Plausible is not enabled');
}

// NoSQL database initialization
await Database().init();


final savedTheme = PreferencesController.getThemeMode();
final savedLocale = PreferencesController.getLocale();
Expand Down

0 comments on commit e88d8a9

Please sign in to comment.