mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
refactor(mobile): migrate all Hive boxes to Isar database (#2036)
This commit is contained in:
parent
0616a66b05
commit
eccde8fa07
33 changed files with 1540 additions and 383 deletions
|
|
@ -1,8 +1,7 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:immich_mobile/constants/hive_box.dart';
|
||||
import 'package:immich_mobile/shared/models/store.dart';
|
||||
import 'package:immich_mobile/utils/url_helper.dart';
|
||||
import 'package:openapi/api.dart';
|
||||
import 'package:http/http.dart';
|
||||
|
|
@ -19,13 +18,9 @@ class ApiService {
|
|||
late DeviceInfoApi deviceInfoApi;
|
||||
|
||||
ApiService() {
|
||||
if (Hive.isBoxOpen(userInfoBox)) {
|
||||
final endpoint = Hive.box(userInfoBox).get(serverEndpointKey) as String?;
|
||||
if (endpoint != null && endpoint.isNotEmpty) {
|
||||
setEndpoint(endpoint);
|
||||
}
|
||||
} else {
|
||||
debugPrint("Cannot init ApiServer endpoint, userInfoBox not open yet.");
|
||||
final endpoint = Store.tryGet(StoreKey.serverEndpoint);
|
||||
if (endpoint != null && endpoint.isNotEmpty) {
|
||||
setEndpoint(endpoint);
|
||||
}
|
||||
}
|
||||
String? _authToken;
|
||||
|
|
@ -49,7 +44,7 @@ class ApiService {
|
|||
setEndpoint(endpoint);
|
||||
|
||||
// Save in hivebox for next startup
|
||||
Hive.box(userInfoBox).put(serverEndpointKey, endpoint);
|
||||
Store.put(StoreKey.serverEndpoint, endpoint);
|
||||
return endpoint;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue