Allow delete other device only if remote device support that (Desktop)

Allow delete other device only if remote device support that (Android)
This commit is contained in:
AlexeyBarabash
2020-10-29 10:30:15 +02:00
parent c26d08b532
commit 37a87c827f
7 changed files with 14 additions and 4 deletions
@@ -313,14 +313,18 @@ public class BraveSyncScreensPreference extends BravePreferenceFragment
}
// mRemoveDeviceButton is always visible, we can leave the chain
// in any time with sync v2 (except we are now doing reset)
} else {
} else if (device.mSupportsSelfDelete) {
deleteButton.setTag(device);
deleteButton.setOnClickListener(v -> {
BraveSyncDevices.SyncDeviceInfo deviceToDelete =
(BraveSyncDevices.SyncDeviceInfo) v.getTag();
deleteDeviceDialog(deviceToDelete);
});
} else {
// Current device does not support self-delete
deleteButton.setVisibility(View.GONE);
}
insertPoint.addView(separator, index++);
insertPoint.addView(listItemView, index++);
}
@@ -100,6 +100,7 @@ public class BraveSyncDevices {
public class SyncDeviceInfo {
public String mName;
public boolean mIsCurrentDevice;
public boolean mSupportsSelfDelete;
public String mType;
public Date mLastUpdatedTimestamp;
public String mGuid;
@@ -123,6 +124,7 @@ public class BraveSyncDevices {
long lastUpdatedTimestamp = device.getLong("lastUpdatedTimestamp");
deviceInfo.mLastUpdatedTimestamp = new Date(lastUpdatedTimestamp);
deviceInfo.mGuid = device.getString("guid");
deviceInfo.mSupportsSelfDelete = device.getBoolean("supportsSelfDelete");
deviceList.add(deviceInfo);
}
} catch (JSONException e) {