Android + Time out Resume Logic so files can be requested again
continuous-integration/drone/pr Build is pending
Details
continuous-integration/drone/pr Build is pending
Details
This commit is contained in:
parent
0ea2a2116e
commit
60e822cf12
|
@ -7,8 +7,10 @@ class FileDownloadProgress {
|
|||
String? downloadedTo;
|
||||
DateTime? timeStart;
|
||||
DateTime? timeEnd;
|
||||
DateTime? requested;
|
||||
|
||||
FileDownloadProgress(this.chunksTotal, this.timeStart);
|
||||
|
||||
double progress() {
|
||||
return 1.0 * chunksDownloaded / chunksTotal;
|
||||
}
|
||||
|
|
|
@ -291,12 +291,27 @@ class ProfileInfoState extends ChangeNotifier {
|
|||
}
|
||||
|
||||
bool downloadInterrupted(String fileKey) {
|
||||
return this._downloads.containsKey(fileKey) && this._downloads[fileKey]!.interrupted;
|
||||
if (this._downloads.containsKey(fileKey)) {
|
||||
if (this._downloads[fileKey]!.interrupted) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this._downloads[fileKey]!.requested != null) {
|
||||
if (DateTime.now().difference(this._downloads[fileKey]!.requested!) > Duration(minutes: 1)) {
|
||||
this._downloads[fileKey]!.requested = null;
|
||||
this._downloads[fileKey]!.interrupted = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void downloadMarkResumed(String fileKey) {
|
||||
if (this._downloads.containsKey(fileKey)) {
|
||||
this._downloads[fileKey]!.interrupted = false;
|
||||
this._downloads[fileKey]!.requested = DateTime.now();
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,8 +99,10 @@ class _MessageViewState extends State<MessageView> {
|
|||
var showFileSharing = Provider.of<Settings>(context).isExperimentEnabled(FileSharingExperiment);
|
||||
var appBarButtons = <Widget>[];
|
||||
|
||||
appBarButtons.add(
|
||||
IconButton(splashRadius: Material.defaultSplashRadius / 2, icon: Icon(Icons.folder_shared), tooltip: AppLocalizations.of(context)!.conversationSettings, onPressed: _pushFileSharingSettings));
|
||||
if (showFileSharing) {
|
||||
appBarButtons.add(IconButton(
|
||||
splashRadius: Material.defaultSplashRadius / 2, icon: Icon(Icons.folder_shared), tooltip: AppLocalizations.of(context)!.conversationSettings, onPressed: _pushFileSharingSettings));
|
||||
}
|
||||
|
||||
if (Provider.of<ContactInfoState>(context).isOnline()) {
|
||||
if (showFileSharing) {
|
||||
|
|
Loading…
Reference in New Issue