refactor(mobile): move user service to domain (#16782)

* refactor: user entity

* chore: rebase fixes

* refactor(mobile): move user service to domain

* fix: timeline not visible on album selection page

---------

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong 2025-03-14 08:50:26 +05:30 committed by GitHub
parent a65ce2ac55
commit b778a86c99
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 408 additions and 183 deletions

View file

@ -3,8 +3,8 @@ import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:image_picker/image_picker.dart';
import 'package:immich_mobile/services/user.service.dart';
import 'package:immich_mobile/domain/services/user.service.dart';
import 'package:immich_mobile/providers/infrastructure/user.provider.dart';
enum UploadProfileStatus {
idle,
@ -72,7 +72,7 @@ class UploadProfileImageState {
class UploadProfileImageNotifier
extends StateNotifier<UploadProfileImageState> {
UploadProfileImageNotifier(this._userSErvice)
UploadProfileImageNotifier(this._userService)
: super(
UploadProfileImageState(
profileImagePath: '',
@ -80,18 +80,21 @@ class UploadProfileImageNotifier
),
);
final UserService _userSErvice;
final UserService _userService;
Future<bool> upload(XFile file) async {
state = state.copyWith(status: UploadProfileStatus.loading);
var res = await _userSErvice.uploadProfileImage(file);
var profileImagePath = await _userService.createProfileImage(
file.name,
await file.readAsBytes(),
);
if (res != null) {
if (profileImagePath != null) {
debugPrint("Successfully upload profile image");
state = state.copyWith(
status: UploadProfileStatus.success,
profileImagePath: res.profileImagePath,
profileImagePath: profileImagePath,
);
return true;
}