mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-12-23 11:21:29 +00:00
Make multiple PendingIntents distinguishable
If notifications for multiple new devices or folders are shown, the last Intent was used for all of them.
This commit is contained in:
parent
ea96011c39
commit
af8ec86843
1 changed files with 8 additions and 2 deletions
|
@ -99,7 +99,10 @@ public class EventProcessor implements SyncthingService.OnWebGuiAvailableListene
|
|||
.setAction(SettingsActivity.ACTION_DEVICE_SETTINGS)
|
||||
.putExtra(SettingsActivity.EXTRA_IS_CREATE, true)
|
||||
.putExtra(DeviceFragment.EXTRA_DEVICE_ID, deviceId);
|
||||
PendingIntent pi = PendingIntent.getActivity(mContext, 0, intent, 0);
|
||||
// HACK: Use a random, deterministic ID to make multiple PendingIntents
|
||||
// distinguishable
|
||||
int requestCode = deviceId.hashCode();
|
||||
PendingIntent pi = PendingIntent.getActivity(mContext, requestCode, intent, 0);
|
||||
|
||||
String title = mContext.getString(R.string.device_rejected,
|
||||
deviceId.substring(0, 7));
|
||||
|
@ -118,7 +121,10 @@ public class EventProcessor implements SyncthingService.OnWebGuiAvailableListene
|
|||
.putExtra(FolderFragment.EXTRA_DEVICE_ID, deviceId)
|
||||
.putExtra(FolderFragment.EXTRA_FOLDER_ID, folderId)
|
||||
.putExtra(FolderFragment.EXTRA_FOLDER_LABEL, folderLabel);
|
||||
pi = PendingIntent.getActivity(mContext, 0, intent, 0);
|
||||
// HACK: Use a random, deterministic ID to make multiple PendingIntents
|
||||
// distinguishable
|
||||
requestCode = (deviceId + folderId + folderLabel).hashCode();
|
||||
pi = PendingIntent.getActivity(mContext, requestCode, intent, 0);
|
||||
|
||||
String deviceName = null;
|
||||
for (RestApi.Device d : mApi.getDevices(false)) {
|
||||
|
|
Loading…
Reference in a new issue