-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨feat!: implementation of all functionalities (#59)
* ✨feat: implementation of all functionalities (#58) * refactor: change types * feat: datasources and repo using by Upload and checkFile (#39) * feat: get and view files added (#41) * feat: go to folder & view files in subfolder (#41) * feat: upload in location state * feat: views folders create in the file * fix: error state location & refactor all states files - generate sync provider (#42) * feat: added create new directory (#45) * feat!: file download and notification download added (#46) * feat: rename file added (#48) & create handler erros for download file (#49) * feat: create controllers for file move (#50) * feat: create states for file move/moving (#50) * feat!: file move added (#50) * feat: view file move in the files view (#50) * feat: add controllers for (#51) - shareListWithWho & shareFile * feat!: added share file (#52) & share list with who (#51) - refactoring * 🎨feat: size file text added in list files * 💄feat(style): list view files change style Delete card styles Change route storage for share * 💄feat: change UI for stateCrossAxis * ✨feat: controllers for share list added * ✨feat!: view share list with me added * 🎨refactor: Improve structure - format exports providers & mappers * 🐛fix: no show error message when using share file Only shown when a user needs to be confirmed * ✨feat: controllers & models added for account password * ✨feat!: account password change added (#40) * 🥅feat(catchErrors): generate CustomsErros and showSnackbar for view errors * ✨feat: controllers & models for unShareFile added * ✨feat: unShareFileAdded (#56) & using (#54) * ✨feat!: file delete added (#57) & using (#54) * ♻️refactor: state for more vert turn off #55 change name folders widgets * 💄feat(style): update the UI buttons * ♻️refactor(http): add network security & include messages (#49)
- Loading branch information
1 parent
5d4a796
commit e74f6cc
Showing
65 changed files
with
2,902 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<network-security-config> | ||
<domain-config cleartextTrafficPermitted="true"> | ||
<domain includeSubdomains="true">capyfile1.bucaramanga.upb.edu.co</domain> | ||
</domain-config> | ||
</network-security-config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,9 @@ | ||
class User { | ||
//final String uuid; | ||
String? username; | ||
//final int statusCode; | ||
//final String? message; | ||
final String token; | ||
|
||
//TODO?: add required | ||
User({ | ||
//required this.uuid, | ||
required this.username, | ||
//required this.statusCode, | ||
//required this.message, | ||
required this.token, | ||
}); | ||
} | ||
// id | ||
// username | ||
// isActive bool | ||
// roles | ||
// token | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
134 changes: 134 additions & 0 deletions
134
lib/features/auth/presentation/providers/share_provider.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
import 'package:login_mobile/features/auth/infrastructure/infrastructure.dart'; | ||
import 'package:login_mobile/features/drive/domain/entities/file.dart'; | ||
import 'package:login_mobile/features/drive/domain/repositories/file_repository.dart'; | ||
import 'package:login_mobile/features/drive/presentation/providers/files_upload_repository_provider.dart'; | ||
|
||
final shareProvider = StateNotifierProvider<ShareNotifier, ShareState>((ref) { | ||
final fileRepository = ref.watch(filesRepositoryProvider); | ||
return ShareNotifier(fileRepository: fileRepository); | ||
}); | ||
|
||
class ShareNotifier extends StateNotifier<ShareState> { | ||
final FilesRepository fileRepository; | ||
|
||
ShareNotifier({required this.fileRepository}) : super(ShareState.initial()); | ||
|
||
shareFile(String fileUUID, String otherUsername) async { | ||
state = state.copyWith(isSharing: true); | ||
try { | ||
await fileRepository.shareFile(fileUUID, otherUsername); | ||
state = state.copyWith(isSharing: false, isShared: true); | ||
getShareListWithWho(fileUUID); | ||
} on CustomError catch (e) { | ||
state = state.copyWith( | ||
isSharing: false, isShared: false, errorMessage: e.message); | ||
} catch (e) { | ||
state = state.copyWith( | ||
isSharing: false, | ||
isShared: false, | ||
errorMessage: 'Invalid user or user not found'); | ||
} | ||
} | ||
|
||
shareListWithWho(String fileUUID) async { | ||
state = state.copyWith(isLoading: true); | ||
try { | ||
final shareListWithWho = await fileRepository.shareListWithWho(fileUUID); | ||
state = state.copyWith(isLoading: false, fileUUID: fileUUID); | ||
return shareListWithWho; | ||
} on CustomError catch (e) { | ||
state = state.copyWith( | ||
isLoading: false, errorMessage: e.message, fileUUID: fileUUID); | ||
} catch (e) { | ||
state = state.copyWith( | ||
isLoading: false, | ||
errorMessage: 'Error when using ShareListWithWho $e', | ||
fileUUID: fileUUID); | ||
} | ||
} | ||
|
||
Future<List<String>> getShareListWithWho(String fileUUID) async { | ||
final response = await fileRepository.shareListWithWho(fileUUID); | ||
final shareListWithWho = response.usernames; | ||
state = | ||
state.copyWith(shareListWithWho: shareListWithWho, errorMessage: ''); | ||
return shareListWithWho; | ||
} | ||
|
||
Future<bool> unShareFile(String fileUUID, String otherUsername) async { | ||
try { | ||
final response = | ||
await fileRepository.unShareFile(fileUUID, otherUsername); | ||
if (response) { | ||
removeUserFromShareList(otherUsername); | ||
state = state.copyWith(errorMessage: ''); | ||
return true; | ||
} else { | ||
state = state.copyWith( | ||
errorMessage: 'Error when using unShareFile, response is false'); | ||
} | ||
return false; | ||
} on CustomError catch (e) { | ||
state = state.copyWith(errorMessage: e.message); | ||
return false; | ||
} catch (e) { | ||
state = state.copyWith(errorMessage: 'Error when using unShareFile $e'); | ||
return false; | ||
} | ||
} | ||
|
||
void removeUserFromShareList(String username) { | ||
final updatedList = List<String>.from(state.shareListWithWho); | ||
updatedList.remove(username); | ||
state = state.copyWith(shareListWithWho: updatedList); | ||
} | ||
} | ||
|
||
class ShareState { | ||
final bool isLoading; | ||
final bool isSharing; | ||
final bool isShared; | ||
final String errorMessage; | ||
final String? fileUUID; | ||
final List<String> shareListWithWho; | ||
|
||
ShareState({ | ||
this.isLoading = false, | ||
this.isSharing = false, | ||
this.isShared = false, | ||
this.errorMessage = '', | ||
this.fileUUID, | ||
this.shareListWithWho = const [], | ||
}); | ||
|
||
factory ShareState.initial() { | ||
return ShareState( | ||
isLoading: false, | ||
isSharing: false, | ||
isShared: false, | ||
errorMessage: '', | ||
fileUUID: null, | ||
shareListWithWho: [], | ||
); | ||
} | ||
|
||
ShareState copyWith({ | ||
bool? isLoading, | ||
bool? isSharing, | ||
bool? isShared, | ||
String? errorMessage, | ||
String? fileUUID, | ||
List<String>? shareListWithWho, | ||
List<File>? filesShareList, | ||
}) { | ||
return ShareState( | ||
isLoading: isLoading ?? this.isLoading, | ||
isSharing: isSharing ?? this.isSharing, | ||
isShared: isShared ?? this.isShared, | ||
errorMessage: errorMessage ?? this.errorMessage, | ||
fileUUID: fileUUID ?? this.fileUUID, | ||
shareListWithWho: shareListWithWho ?? this.shareListWithWho, | ||
); | ||
} | ||
} |
Oops, something went wrong.