Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: added interactions for sent items #291

Merged
merged 1 commit into from
Jun 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions lib/view_models/history_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1141,20 +1141,20 @@ class HistoryProvider extends BaseModel {
String fileName,
) async {
var index =
receivedHistoryLogs.indexWhere((element) => element.key == transferId);
var _fileIndex = receivedHistoryLogs[index]
.files!
allFilesHistory.indexWhere((element) => element.fileDetails?.key == transferId);
sachins-geekyants marked this conversation as resolved.
Show resolved Hide resolved
var _fileIndex = allFilesHistory[index].fileDetails
?.files!
.indexWhere((_file) => _file.name == fileName);
try {
if ((index > -1) && (_fileIndex > -1)) {
receivedHistoryLogs[index].files![_fileIndex].isDownloading = true;
receivedHistoryLogs[index].isWidgetOpen = isWidgetOpen;
if ((index > -1) && (_fileIndex! > -1)) {
allFilesHistory[index].fileDetails?.files![_fileIndex].isDownloading = true;
allFilesHistory[index].fileDetails?.isWidgetOpen = isWidgetOpen;
}
notifyListeners();

var files =
await _downloadSingleFileFromWeb(transferId, sharedBy, fileName);
receivedHistoryLogs[index].files![_fileIndex].isDownloading = false;
allFilesHistory[index].fileDetails?.files![_fileIndex!].isDownloading = false;

Provider.of<FileDownloadChecker>(NavService.navKey.currentContext!,
listen: false)
Expand All @@ -1163,7 +1163,7 @@ class HistoryProvider extends BaseModel {
if (files is List<File>) {
await Provider.of<MyFilesProvider>(NavService.navKey.currentContext!,
listen: false)
.saveNewDataInMyFiles(receivedHistoryLogs[index]);
.saveNewDataInMyFiles(allFilesHistory[index].fileDetails!);
setStatus(DOWNLOAD_FILE, Status.Done);
return true;
} else {
Expand All @@ -1175,7 +1175,7 @@ class HistoryProvider extends BaseModel {
Provider.of<FileProgressProvider>(NavService.navKey.currentContext!,
listen: false)
.removeReceiveProgressItem(transferId);
receivedHistoryLogs[index].files![_fileIndex].isDownloading = false;
allFilesHistory[index].fileDetails?.files![_fileIndex!].isDownloading = false;
setStatus(DOWNLOAD_FILE, Status.Error);
return false;
}
Expand Down