mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-12-23 19:31:30 +00:00
Merge pull request #675 from Unrud/folder_label
Use folderLabel from FolderRejected events
This commit is contained in:
commit
ea96011c39
2 changed files with 9 additions and 2 deletions
|
@ -55,6 +55,9 @@ public class FolderFragment extends Fragment
|
|||
public static final String EXTRA_FOLDER_ID =
|
||||
"com.nutomic.syncthingandroid.fragments.FolderFragment.FOLDER_ID";
|
||||
|
||||
public static final String EXTRA_FOLDER_LABEL =
|
||||
"com.nutomic.syncthingandroid.fragments.FolderFragment.FOLDER_LABEL";
|
||||
|
||||
public static final String EXTRA_DEVICE_ID =
|
||||
"com.nutomic.syncthingandroid.fragments.FolderFragment.DEVICE_ID";
|
||||
|
||||
|
@ -362,6 +365,7 @@ public class FolderFragment extends Fragment
|
|||
private void initFolder() {
|
||||
mFolder = new RestApi.Folder();
|
||||
mFolder.id = getActivity().getIntent().getStringExtra(EXTRA_FOLDER_ID);
|
||||
mFolder.label = getActivity().getIntent().getStringExtra(EXTRA_FOLDER_LABEL);;
|
||||
mFolder.path = "";
|
||||
mFolder.rescanIntervalS = 259200; // Scan every 3 days (in case inotify dropped some changes)
|
||||
mFolder.deviceIds = new ArrayList<>();
|
||||
|
|
|
@ -109,13 +109,15 @@ public class EventProcessor implements SyncthingService.OnWebGuiAvailableListene
|
|||
case "FolderRejected":
|
||||
deviceId = data.getString("device");
|
||||
String folderId = data.getString("folder");
|
||||
String folderLabel = data.getString("folderLabel");
|
||||
Log.d(TAG, "Device " + deviceId + " wants to share folder " + folderId);
|
||||
|
||||
intent = new Intent(mContext, SettingsActivity.class)
|
||||
.setAction(SettingsActivity.ACTION_FOLDER_SETTINGS)
|
||||
.putExtra(SettingsActivity.EXTRA_IS_CREATE, true)
|
||||
.putExtra(FolderFragment.EXTRA_DEVICE_ID, deviceId)
|
||||
.putExtra(FolderFragment.EXTRA_FOLDER_ID, folderId);
|
||||
.putExtra(FolderFragment.EXTRA_FOLDER_ID, folderId)
|
||||
.putExtra(FolderFragment.EXTRA_FOLDER_LABEL, folderLabel);
|
||||
pi = PendingIntent.getActivity(mContext, 0, intent, 0);
|
||||
|
||||
String deviceName = null;
|
||||
|
@ -123,7 +125,8 @@ public class EventProcessor implements SyncthingService.OnWebGuiAvailableListene
|
|||
if (d.deviceID.equals(deviceId))
|
||||
deviceName = RestApi.getDeviceDisplayName(d);
|
||||
}
|
||||
title = mContext.getString(R.string.folder_rejected, deviceName, folderId);
|
||||
title = mContext.getString(R.string.folder_rejected, deviceName,
|
||||
folderLabel.isEmpty() ? folderId : folderLabel + " (" + folderId + ")");
|
||||
|
||||
notify(title, pi);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue