mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
Add service provider (#250)
* optimize android side gradle settings * android minsdk back to 21 * remove unused package, update linter and fix lint error * clean code of 'shared module' with offical dart style guide * restore uploadProfileImage method in UserService * add service provider * fix searchFocusNode init error
This commit is contained in:
@@ -1,13 +1,18 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/modules/search/models/curated_location.model.dart';
|
||||
import 'package:immich_mobile/modules/search/models/curated_object.model.dart';
|
||||
import 'package:immich_mobile/shared/models/immich_asset.model.dart';
|
||||
import 'package:immich_mobile/shared/services/network.service.dart';
|
||||
|
||||
final searchServiceProvider =
|
||||
Provider((ref) => SearchService(ref.watch(networkServiceProvider)));
|
||||
|
||||
class SearchService {
|
||||
final NetworkService _networkService = NetworkService();
|
||||
final NetworkService _networkService;
|
||||
SearchService(this._networkService);
|
||||
|
||||
Future<List<String>?> getUserSuggestedSearchTerms() async {
|
||||
try {
|
||||
@@ -30,7 +35,8 @@ class SearchService {
|
||||
|
||||
List<dynamic> decodedData = jsonDecode(res.toString());
|
||||
|
||||
List<ImmichAsset> result = List.from(decodedData.map((a) => ImmichAsset.fromMap(a)));
|
||||
List<ImmichAsset> result =
|
||||
List.from(decodedData.map((a) => ImmichAsset.fromMap(a)));
|
||||
|
||||
return result;
|
||||
} catch (e) {
|
||||
@@ -45,7 +51,8 @@ class SearchService {
|
||||
|
||||
List<dynamic> decodedData = jsonDecode(res.toString());
|
||||
|
||||
List<CuratedLocation> result = List.from(decodedData.map((a) => CuratedLocation.fromMap(a)));
|
||||
List<CuratedLocation> result =
|
||||
List.from(decodedData.map((a) => CuratedLocation.fromMap(a)));
|
||||
|
||||
return result;
|
||||
} catch (e) {
|
||||
@@ -60,7 +67,8 @@ class SearchService {
|
||||
|
||||
List<dynamic> decodedData = jsonDecode(res.toString());
|
||||
|
||||
List<CuratedObject> result = List.from(decodedData.map((a) => CuratedObject.fromMap(a)));
|
||||
List<CuratedObject> result =
|
||||
List.from(decodedData.map((a) => CuratedObject.fromMap(a)));
|
||||
|
||||
return result;
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user