mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-24 18:38:48 +01:00
Workaround sqlite library not loading on some Android 6 or below devices
This commit is contained in:
parent
af16734fb6
commit
42a8539fb6
1 changed files with 14 additions and 1 deletions
|
@ -37,6 +37,7 @@ import 'package:nc_photos/platform/features.dart' as features;
|
|||
import 'package:nc_photos/platform/k.dart' as platform_k;
|
||||
import 'package:nc_photos/pref.dart';
|
||||
import 'package:nc_photos/pref_util.dart' as pref_util;
|
||||
import 'package:sqlite3_flutter_libs/sqlite3_flutter_libs.dart';
|
||||
import 'package:visibility_detector/visibility_detector.dart';
|
||||
|
||||
enum InitIsolateType {
|
||||
|
@ -54,11 +55,14 @@ Future<void> init(InitIsolateType isolateType) async {
|
|||
}
|
||||
|
||||
initLog();
|
||||
await _initDeviceInfo();
|
||||
initDrift();
|
||||
if (isolateType == InitIsolateType.main) {
|
||||
await _initDriftWorkaround();
|
||||
}
|
||||
_initKiwi();
|
||||
await _initPref();
|
||||
await _initAccountPrefs();
|
||||
await _initDeviceInfo();
|
||||
_initEquatable();
|
||||
if (features.isSupportSelfSignedCert) {
|
||||
_initSelfSignedCertManager();
|
||||
|
@ -117,6 +121,15 @@ void initDrift() {
|
|||
driftRuntimeOptions.debugPrint = (log) => debugPrint(log, wrapWidth: 1024);
|
||||
}
|
||||
|
||||
Future<void> _initDriftWorkaround() async {
|
||||
if (AndroidInfo().sdkInt < 24) {
|
||||
_log.info("[_initDriftWorkaround] Workaround Android 6- bug");
|
||||
// see: https://github.com/flutter/flutter/issues/73318 and
|
||||
// https://github.com/simolus3/drift/issues/895
|
||||
await applyWorkaroundToOpenSqlite3OnOldAndroidVersions();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _initPref() async {
|
||||
final provider = PrefSharedPreferencesProvider();
|
||||
await provider.init();
|
||||
|
|
Loading…
Reference in a new issue