File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
nextcloud/client/jobs/transfer Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ class FileTransferService : Service() {
103
103
return START_NOT_STICKY
104
104
}
105
105
106
- if (! isRunning && MainApp .lifecycle == AppLifecycle .Foreground ) {
106
+ if (! isRunning && MainApp .getAppLifeCycle() == AppLifecycle .Foreground ) {
107
107
ForegroundServiceHelper .startService(
108
108
this ,
109
109
AppNotificationManager .TRANSFER_NOTIFICATION_ID ,
Original file line number Diff line number Diff line change @@ -376,14 +376,22 @@ public void onCreate() {
376
376
registerGlobalPassCodeProtection ();
377
377
}
378
378
379
- public static AppLifecycle lifecycle = AppLifecycle .Foreground ;
379
+ private static AppLifecycle lifecycle = AppLifecycle .Foreground ;
380
+
381
+ public static AppLifecycle getAppLifeCycle () {
382
+ return lifecycle ;
383
+ }
384
+
385
+ private void setAppLifeCycle (AppLifecycle appLifecycle ) {
386
+ lifecycle = appLifecycle ;
387
+ }
380
388
381
389
private final LifecycleEventObserver lifecycleEventObserver = ((lifecycleOwner , event ) -> {
382
390
if (event == Lifecycle .Event .ON_START ) {
383
- lifecycle = AppLifecycle .Foreground ;
391
+ setAppLifeCycle ( AppLifecycle .Foreground ) ;
384
392
Log_OC .d (TAG , "APP IN FOREGROUND" );
385
393
} else if (event == Lifecycle .Event .ON_STOP ) {
386
- lifecycle = AppLifecycle .Background ;
394
+ setAppLifeCycle ( AppLifecycle .Background ) ;
387
395
passCodeManager .setCanAskPin (true );
388
396
Log_OC .d (TAG , "APP IN BACKGROUND" );
389
397
} else if (event == Lifecycle .Event .ON_RESUME ) {
You can’t perform that action at this time.
0 commit comments