Merge pull request #2065 from ismailnurudeen/feat/require-notification-permission

feat: added required notification permission dialog.
This commit is contained in:
Tibor Kaputa 2023-05-05 16:23:15 +02:00 committed by GitHub
commit e681f90dd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 6 deletions

View File

@ -34,6 +34,7 @@ import com.simplemobiletools.calendar.pro.helpers.*
import com.simplemobiletools.calendar.pro.helpers.Formatter
import com.simplemobiletools.calendar.pro.models.*
import com.simplemobiletools.commons.dialogs.ConfirmationAdvancedDialog
import com.simplemobiletools.commons.dialogs.PermissionRequiredDialog
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.*
@ -1271,7 +1272,9 @@ class EventActivity : SimpleActivity() {
storeEvent(wasRepeatable)
}
} else {
toast(R.string.no_post_notifications_permissions)
PermissionRequiredDialog(this, messageId = R.string.no_post_notifications_permissions) {
openNotificationSettings()
}
}
}
} else {

View File

@ -38,6 +38,7 @@ import com.simplemobiletools.calendar.pro.models.ListItem
import com.simplemobiletools.calendar.pro.models.ListSectionDay
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
import com.simplemobiletools.commons.dialogs.FilePickerDialog
import com.simplemobiletools.commons.dialogs.PermissionRequiredDialog
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.*
@ -1066,7 +1067,9 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
}
}
} else {
toast(R.string.no_post_notifications_permissions)
PermissionRequiredDialog(this, messageId = R.string.no_post_notifications_permissions) {
openNotificationSettings()
}
}
}
} else {

View File

@ -10,7 +10,8 @@ import com.simplemobiletools.calendar.pro.extensions.config
import com.simplemobiletools.calendar.pro.extensions.refreshCalDAVCalendars
import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.commons.dialogs.PermissionRequiredDialog
import com.simplemobiletools.commons.extensions.openNotificationSettings
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
open class SimpleActivity : BaseSimpleActivity() {
@ -84,7 +85,9 @@ open class SimpleActivity : BaseSimpleActivity() {
}
}
} else {
toast(R.string.no_post_notifications_permissions)
PermissionRequiredDialog(this, messageId = R.string.no_post_notifications_permissions) {
openNotificationSettings()
}
}
}
}

View File

@ -18,6 +18,7 @@ import com.simplemobiletools.calendar.pro.models.Event
import com.simplemobiletools.calendar.pro.models.EventType
import com.simplemobiletools.calendar.pro.models.Reminder
import com.simplemobiletools.commons.dialogs.ConfirmationAdvancedDialog
import com.simplemobiletools.commons.dialogs.PermissionRequiredDialog
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.*
@ -425,7 +426,9 @@ class TaskActivity : SimpleActivity() {
storeTask(wasRepeatable)
}
} else {
toast(R.string.no_post_notifications_permissions)
PermissionRequiredDialog(this, messageId = R.string.no_post_notifications_permissions) {
openNotificationSettings()
}
}
}
} else {

View File

@ -8,6 +8,7 @@ import com.simplemobiletools.calendar.pro.helpers.ANNIVERSARY_EVENT
import com.simplemobiletools.calendar.pro.helpers.BIRTHDAY_EVENT
import com.simplemobiletools.calendar.pro.helpers.OTHER_EVENT
import com.simplemobiletools.calendar.pro.helpers.REMINDER_OFF
import com.simplemobiletools.commons.dialogs.PermissionRequiredDialog
import com.simplemobiletools.commons.extensions.*
import kotlinx.android.synthetic.main.dialog_set_reminders.view.*
@ -35,7 +36,9 @@ class SetRemindersDialog(val activity: SimpleActivity, val eventType: Int, val c
}
}
} else {
activity.toast(R.string.no_post_notifications_permissions)
PermissionRequiredDialog(activity, messageId = R.string.no_post_notifications_permissions) {
activity.openNotificationSettings()
}
}
}
}