mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
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:
parent
a65ce2ac55
commit
b778a86c99
23 changed files with 408 additions and 183 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue