feat: added required notification permission dialog.

This commit is contained in:
ismailnurudeen 2023-05-03 13:13:36 +01:00
parent e63397a4e8
commit 2943b5a618
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()
}
}
}
}