Cleanup dead code
This commit is contained in:
parent
e6f89b0b22
commit
5fa22fedbb
|
@ -239,9 +239,6 @@ class VectorSettingsSecurityPrivacyFragment @Inject constructor(
|
|||
}
|
||||
|
||||
override fun bindPref() {
|
||||
// Push target
|
||||
refreshPushersList()
|
||||
|
||||
// Refresh Key Management section
|
||||
refreshKeysManagementSection()
|
||||
|
||||
|
@ -584,103 +581,8 @@ class VectorSettingsSecurityPrivacyFragment @Inject constructor(
|
|||
})
|
||||
}
|
||||
|
||||
// ==============================================================================================================
|
||||
// pushers list management
|
||||
// ==============================================================================================================
|
||||
|
||||
/**
|
||||
* Refresh the pushers list
|
||||
*/
|
||||
private fun refreshPushersList() {
|
||||
activity?.let { _ ->
|
||||
/* TODO
|
||||
val pushManager = Matrix.getInstance(activity).pushManager
|
||||
val pushersList = ArrayList(pushManager.mPushersList)
|
||||
|
||||
if (pushersList.isEmpty()) {
|
||||
preferenceScreen.removePreference(mPushersSettingsCategory)
|
||||
preferenceScreen.removePreference(mPushersSettingsDivider)
|
||||
return
|
||||
}
|
||||
|
||||
// check first if there is an update
|
||||
var isNewList = true
|
||||
if (pushersList.size == mDisplayedPushers.size) {
|
||||
isNewList = !mDisplayedPushers.containsAll(pushersList)
|
||||
}
|
||||
|
||||
if (isNewList) {
|
||||
// remove the displayed one
|
||||
mPushersSettingsCategory.removeAll()
|
||||
|
||||
// add new emails list
|
||||
mDisplayedPushers = pushersList
|
||||
|
||||
var index = 0
|
||||
|
||||
for (pushRule in mDisplayedPushers) {
|
||||
if (null != pushRule.lang) {
|
||||
val isThisDeviceTarget = TextUtils.equals(pushManager.currentRegistrationToken, pushRule.pushkey)
|
||||
|
||||
val preference = VectorPreference(activity).apply {
|
||||
mTypeface = if (isThisDeviceTarget) Typeface.BOLD else Typeface.NORMAL
|
||||
}
|
||||
preference.title = pushRule.deviceDisplayName
|
||||
preference.summary = pushRule.appDisplayName
|
||||
preference.key = PUSHER_PREFERENCE_KEY_BASE + index
|
||||
index++
|
||||
mPushersSettingsCategory.addPreference(preference)
|
||||
|
||||
// the user cannot remove the self device target
|
||||
if (!isThisDeviceTarget) {
|
||||
preference.onPreferenceLongClickListener = object : VectorPreference.OnPreferenceLongClickListener {
|
||||
override fun onPreferenceLongClick(preference: Preference): Boolean {
|
||||
AlertDialog.Builder(activity)
|
||||
.setTitle(R.string.dialog_title_confirmation)
|
||||
.setMessage(R.string.settings_delete_notification_targets_confirmation)
|
||||
.setPositiveButton(R.string.remove)
|
||||
{ _, _ ->
|
||||
displayLoadingView()
|
||||
pushManager.unregister(session, pushRule, object : MatrixCallback<Unit> {
|
||||
override fun onSuccess(info: Void?) {
|
||||
refreshPushersList()
|
||||
onCommonDone(null)
|
||||
}
|
||||
|
||||
override fun onNetworkError(e: Exception) {
|
||||
onCommonDone(e.localizedMessage)
|
||||
}
|
||||
|
||||
override fun onMatrixError(e: MatrixError) {
|
||||
onCommonDone(e.localizedMessage)
|
||||
}
|
||||
|
||||
override fun onUnexpectedError(e: Exception) {
|
||||
onCommonDone(e.localizedMessage)
|
||||
}
|
||||
})
|
||||
}
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.show()
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val REQUEST_E2E_FILE_REQUEST_CODE = 123
|
||||
private const val REQUEST_CODE_SAVE_MEGOLM_EXPORT = 124
|
||||
|
||||
private const val PUSHER_PREFERENCE_KEY_BASE = "PUSHER_PREFERENCE_KEY_BASE"
|
||||
private const val DEVICES_PREFERENCE_KEY_BASE = "DEVICES_PREFERENCE_KEY_BASE"
|
||||
|
||||
// TODO i18n
|
||||
const val LABEL_UNAVAILABLE_DATA = "none"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue