mirror of
https://github.com/immich-app/immich.git
synced 2024-11-17 19:08:49 -07:00
d02b97e1c1
* 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
34 lines
1.0 KiB
Dart
34 lines
1.0 KiB
Dart
import 'package:dio/dio.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:immich_mobile/shared/models/server_info.model.dart';
|
|
import 'package:immich_mobile/shared/models/server_version.model.dart';
|
|
import 'package:immich_mobile/shared/services/network.service.dart';
|
|
|
|
final serverInfoServiceProvider =
|
|
Provider((ref) => ServerInfoService(ref.watch(networkServiceProvider)));
|
|
|
|
class ServerInfoService {
|
|
final NetworkService _networkService;
|
|
ServerInfoService(this._networkService);
|
|
|
|
Future<ServerInfo> getServerInfo() async {
|
|
Response response = await _networkService.getRequest(url: 'server-info');
|
|
|
|
return ServerInfo.fromJson(response.toString());
|
|
}
|
|
|
|
Future<ServerVersion?> getServerVersion() async {
|
|
try {
|
|
Response response =
|
|
await _networkService.getRequest(url: 'server-info/version');
|
|
|
|
return ServerVersion.fromJson(response.toString());
|
|
} catch (e) {
|
|
debugPrint("Error getting server info");
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|