mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
Fix NPE
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
961754e898
commit
329bccd514
4 changed files with 12 additions and 11 deletions
|
@ -186,7 +186,7 @@ public class MainApp extends MultiDexApplication {
|
|||
|
||||
initiateExistingAutoUploadEntries();
|
||||
|
||||
FilesSyncHelper.scheduleFilesSyncIfNeeded();
|
||||
FilesSyncHelper.scheduleFilesSyncIfNeeded(mContext);
|
||||
FilesSyncHelper.restartJobsIfNeeded();
|
||||
|
||||
ReceiversHelper.registerNetworkChangeReceiver();
|
||||
|
|
|
@ -56,7 +56,7 @@ public class NContentObserverJob extends JobService {
|
|||
.schedule();
|
||||
}
|
||||
|
||||
FilesSyncHelper.scheduleNJobs(true);
|
||||
FilesSyncHelper.scheduleNJobs(true, getApplicationContext());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -502,7 +502,7 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
|
|||
String syncedFolderInitiatedKey = "syncedFolderIntitiated_" + syncedFolderDisplayItem.getId();
|
||||
arbitraryDataProvider.deleteKeyForAccount("global", syncedFolderInitiatedKey);
|
||||
}
|
||||
FilesSyncHelper.scheduleNJobs(false);
|
||||
FilesSyncHelper.scheduleNJobs(false, getApplicationContext());
|
||||
|
||||
}
|
||||
|
||||
|
@ -555,7 +555,7 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
|
|||
String syncedFolderInitiatedKey = "syncedFolderIntitiated_" + newCustomFolder.getId();
|
||||
arbitraryDataProvider.deleteKeyForAccount("global", syncedFolderInitiatedKey);
|
||||
}
|
||||
FilesSyncHelper.scheduleNJobs(false);
|
||||
FilesSyncHelper.scheduleNJobs(false, getApplicationContext());
|
||||
}
|
||||
mAdapter.addSyncFolderItem(newCustomFolder);
|
||||
} else {
|
||||
|
@ -575,7 +575,7 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
|
|||
String syncedFolderInitiatedKey = "syncedFolderIntitiated_" + item.getId();
|
||||
arbitraryDataProvider.deleteKeyForAccount("global", syncedFolderInitiatedKey);
|
||||
}
|
||||
FilesSyncHelper.scheduleNJobs(false);
|
||||
FilesSyncHelper.scheduleNJobs(false, getApplicationContext());
|
||||
}
|
||||
} else {
|
||||
// existing synced folder setup to be updated
|
||||
|
@ -586,7 +586,7 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA
|
|||
String syncedFolderInitiatedKey = "syncedFolderIntitiated_" + item.getId();
|
||||
arbitraryDataProvider.deleteKeyForAccount("global", syncedFolderInitiatedKey);
|
||||
}
|
||||
FilesSyncHelper.scheduleNJobs(false);
|
||||
FilesSyncHelper.scheduleNJobs(false, getApplicationContext());
|
||||
}
|
||||
|
||||
mAdapter.setSyncFolderItem(syncedFolder.getSection(), item);
|
||||
|
|
|
@ -253,9 +253,8 @@ public class FilesSyncHelper {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static void scheduleNJobs(boolean force) {
|
||||
SyncedFolderProvider syncedFolderProvider = new SyncedFolderProvider(MainApp.getAppContext().
|
||||
getContentResolver());
|
||||
public static void scheduleNJobs(boolean force, Context context) {
|
||||
SyncedFolderProvider syncedFolderProvider = new SyncedFolderProvider(context.getContentResolver());
|
||||
|
||||
|
||||
boolean hasVideoFolders = false;
|
||||
|
@ -282,7 +281,7 @@ public class FilesSyncHelper {
|
|||
}
|
||||
}
|
||||
|
||||
public static void scheduleFilesSyncIfNeeded() {
|
||||
public static void scheduleFilesSyncIfNeeded(Context context) {
|
||||
// always run this because it also allows us to perform retries of manual uploads
|
||||
new JobRequest.Builder(FilesSyncJob.TAG)
|
||||
.setPeriodic(900000L, 300000L)
|
||||
|
@ -290,7 +289,9 @@ public class FilesSyncHelper {
|
|||
.build()
|
||||
.schedule();
|
||||
|
||||
scheduleNJobs(false);
|
||||
if (context != null) {
|
||||
scheduleNJobs(false, context);
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
|
|
Loading…
Reference in a new issue