mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-29 15:51:17 +00:00
FolderActivity/DeviceActivity: Fix restApi unavailable in onCreate()
This commit is contained in:
parent
e0dc77d4d1
commit
f9927aa603
2 changed files with 9 additions and 8 deletions
|
@ -223,8 +223,8 @@ public class DeviceActivity extends SyncthingActivity {
|
|||
// Edit mode.
|
||||
String passedId = getIntent().getStringExtra(EXTRA_DEVICE_ID);
|
||||
Log.d(TAG, "Initializing edit mode: deviceID=" + passedId);
|
||||
RestApi restApi = getApi();
|
||||
List<Device> devices = mConfig.getDevices(restApi, false);
|
||||
// getApi() is unavailable (onCreate > onPostCreate > onServiceConnected)
|
||||
List<Device> devices = mConfig.getDevices(null, false);
|
||||
mDevice = null;
|
||||
for (Device currentDevice : devices) {
|
||||
if (currentDevice.deviceID.equals(passedId)) {
|
||||
|
@ -237,9 +237,6 @@ public class DeviceActivity extends SyncthingActivity {
|
|||
finish();
|
||||
return;
|
||||
}
|
||||
if (restApi != null) {
|
||||
restApi.getConnections(this::onReceiveConnections);
|
||||
}
|
||||
mDeviceNeedsToUpdate = false;
|
||||
}
|
||||
}
|
||||
|
@ -276,6 +273,10 @@ public class DeviceActivity extends SyncthingActivity {
|
|||
SyncthingServiceBinder syncthingServiceBinder = (SyncthingServiceBinder) iBinder;
|
||||
SyncthingService syncthingService = (SyncthingService) syncthingServiceBinder.getService();
|
||||
syncthingService.getNotificationHandler().cancelConsentNotification(getIntent().getIntExtra(EXTRA_NOTIFICATION_ID, 0));
|
||||
RestApi restApi = syncthingService.getApi();
|
||||
if (restApi != null) {
|
||||
restApi.getConnections(this::onReceiveConnections);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -235,8 +235,8 @@ public class FolderActivity extends SyncthingActivity {
|
|||
// Edit mode.
|
||||
String passedId = getIntent().getStringExtra(EXTRA_FOLDER_ID);
|
||||
Log.d(TAG, "Initializing edit mode: folder.id=" + passedId);
|
||||
RestApi restApi = getApi();
|
||||
List<Folder> folders = mConfig.getFolders(restApi);
|
||||
// getApi() is unavailable (onCreate > onPostCreate > onServiceConnected)
|
||||
List<Folder> folders = mConfig.getFolders(null);
|
||||
mFolder = null;
|
||||
for (Folder currentFolder : folders) {
|
||||
if (currentFolder.id.equals(passedId)) {
|
||||
|
@ -249,7 +249,7 @@ public class FolderActivity extends SyncthingActivity {
|
|||
finish();
|
||||
return;
|
||||
}
|
||||
mConfig.getFolderIgnoreList(restApi, mFolder, this::onReceiveFolderIgnoreList);
|
||||
mConfig.getFolderIgnoreList(null, mFolder, this::onReceiveFolderIgnoreList);
|
||||
mFolderNeedsToUpdate = false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue