mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-26 22:31:16 +00:00
Dont allow adding duplicate folder via notification (fixes #617)
This commit is contained in:
parent
6d6c6beac0
commit
1df103cb0f
2 changed files with 8 additions and 5 deletions
|
@ -229,6 +229,10 @@ public class FolderActivity extends SyncthingActivity
|
|||
return;
|
||||
}
|
||||
}
|
||||
if (getIntent().hasExtra(EXTRA_DEVICE_ID)) {
|
||||
mFolder.addDevice(getIntent().getStringExtra(EXTRA_DEVICE_ID));
|
||||
mFolderNeedsToUpdate = true;
|
||||
}
|
||||
|
||||
updateViewsAndSetListeners();
|
||||
}
|
||||
|
@ -345,10 +349,6 @@ public class FolderActivity extends SyncthingActivity
|
|||
mFolder.rescanIntervalS = 60;
|
||||
}
|
||||
mFolder.versioning = new Folder.Versioning();
|
||||
String deviceId = getIntent().getStringExtra(EXTRA_DEVICE_ID);
|
||||
if (deviceId != null) {
|
||||
mFolder.addDevice(deviceId);
|
||||
}
|
||||
}
|
||||
|
||||
private void prepareEditMode() {
|
||||
|
|
|
@ -13,6 +13,7 @@ import android.preference.PreferenceManager;
|
|||
import android.support.v4.app.NotificationCompat;
|
||||
import android.util.Log;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.nutomic.syncthingandroid.R;
|
||||
import com.nutomic.syncthingandroid.activities.DeviceActivity;
|
||||
import com.nutomic.syncthingandroid.activities.FolderActivity;
|
||||
|
@ -112,8 +113,10 @@ public class EventProcessor implements SyncthingService.OnWebGuiAvailableListene
|
|||
String folderLabel = (String) event.data.get("folderLabel");
|
||||
Log.d(TAG, "Device " + deviceId + " wants to share folder " + folderId);
|
||||
|
||||
boolean isNewFolder = Stream.of(mApi.getFolders())
|
||||
.noneMatch(f -> f.id.equals(folderId));
|
||||
intent = new Intent(mContext, FolderActivity.class)
|
||||
.putExtra(FolderActivity.EXTRA_IS_CREATE, true)
|
||||
.putExtra(FolderActivity.EXTRA_IS_CREATE, isNewFolder)
|
||||
.putExtra(FolderActivity.EXTRA_DEVICE_ID, deviceId)
|
||||
.putExtra(FolderActivity.EXTRA_FOLDER_ID, folderId)
|
||||
.putExtra(FolderActivity.EXTRA_FOLDER_LABEL, folderLabel);
|
||||
|
|
Loading…
Reference in a new issue