@@ -410,60 +410,6 @@ class BackupFragment :
410410 }
411411 // endregion
412412
413- @Deprecated(" Deprecated in Java" )
414- @Suppress(" NestedBlockDepth" )
415- override fun onRequestPermissionsResult (requestCode : Int , permissions : Array <String >, grantResults : IntArray ) {
416- super .onRequestPermissionsResult(requestCode, permissions, grantResults)
417-
418- if (requestCode == PermissionUtil .PERMISSIONS_READ_CONTACTS_AUTOMATIC ) {
419- for (index in permissions.indices) {
420- if (Manifest .permission.READ_CONTACTS .equals(permissions[index], ignoreCase = true )) {
421- if (grantResults[index] >= 0 ) {
422- // if approved, exit for loop
423- isContactsBackupEnabled = true
424- break
425- }
426-
427- // if not accepted, disable again
428- binding.contacts.setOnCheckedChangeListener(null )
429- binding.contacts.isChecked = false
430- binding.contacts.setOnCheckedChangeListener(contactsCheckedListener)
431- }
432- }
433- }
434- if (requestCode == PermissionUtil .PERMISSIONS_READ_CALENDAR_AUTOMATIC ) {
435- var readGranted = false
436- var writeGranted = false
437- for (index in permissions.indices) {
438- if (Manifest .permission.WRITE_CALENDAR .equals(
439- permissions[index],
440- ignoreCase = true
441- ) &&
442- grantResults[index] >= 0
443- ) {
444- writeGranted = true
445- } else if (Manifest .permission.READ_CALENDAR .equals(
446- permissions[index],
447- ignoreCase = true
448- ) &&
449- grantResults[index] >= 0
450- ) {
451- readGranted = true
452- }
453- }
454- if (! readGranted || ! writeGranted) {
455- // if not accepted, disable again
456- binding.calendar.setOnCheckedChangeListener(null )
457- binding.calendar.isChecked = false
458- binding.calendar.setOnCheckedChangeListener(calendarCheckedListener)
459- } else {
460- isCalendarBackupEnabled = true
461- }
462- }
463- setBackupNowButtonVisibility()
464- setAutomaticBackup(binding.dailyBackup.isChecked)
465- }
466-
467413 private fun backupNow () {
468414 val activity = getTypedActivity(ContactsPreferenceActivity ::class .java) ? : return
469415 val user = activity.user?.takeIf { it.isPresent }?.get() ? : return
0 commit comments