Skip to content

Commit

Permalink
dismiss only after delay to remove stuck notification
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Nüsse <felix.nuesse@t-online.de>
  • Loading branch information
newhinton committed Mar 18, 2021
1 parent f8e9601 commit d48ffc7
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ public class FileDownloader extends Service

private long conflictUploadId;

public boolean mStartedDownload = false;

@Inject UserAccountManager accountManager;
@Inject UploadsStorageManager uploadsStorageManager;
@Inject LocalBroadcastManager localBroadcastManager;
Expand Down Expand Up @@ -420,6 +422,15 @@ public void handleMessage(Message msg) {
mService.downloadFile(next);
}
}
mService.mStartedDownload=false;
(new Handler()).postDelayed(new Runnable(){
public void run() {
if(!mService.mStartedDownload){
mService.mNotificationManager.cancel(R.string.downloader_download_in_progress_ticker);
}
}}, 2000);


Log_OC.d(TAG, "Stopping after command with id " + msg.arg1);
mService.mNotificationManager.cancel(FOREGROUND_SERVICE_ID);
mService.stopForeground(true);
Expand All @@ -435,6 +446,7 @@ public void handleMessage(Message msg) {
*/
private void downloadFile(String downloadKey) {

mStartedDownload = true;
mCurrentDownload = mPendingDownloads.get(downloadKey);

if (mCurrentDownload != null) {
Expand Down

0 comments on commit d48ffc7

Please sign in to comment.