Add setting for enabling/disabling delivery report

This commit is contained in:
Paul Akhamiogu 2021-08-25 17:17:21 +01:00
parent 84c1705078
commit bb7178bee6
6 changed files with 39 additions and 2 deletions

View File

@ -40,6 +40,7 @@ class SettingsActivity : SimpleActivity() {
setupChangeDateTimeFormat()
setupFontSize()
setupShowCharacterCounter()
setupEnableDeliveryReports()
setupLockScreenVisibility()
updateTextColors(settings_scrollview)
@ -131,6 +132,14 @@ class SettingsActivity : SimpleActivity() {
}
}
private fun setupEnableDeliveryReports() {
settings_enable_delivery_reports.isChecked = config.enableDeliveryReports
settings_enable_delivery_reports_holder.setOnClickListener {
settings_enable_delivery_reports.toggle()
config.enableDeliveryReports = settings_enable_delivery_reports.isChecked
}
}
private fun setupLockScreenVisibility() {
settings_lock_screen_visibility.text = getLockScreenVisibilityText(config.lockScreenVisibilitySetting)
settings_lock_screen_visibility_holder.setOnClickListener {

View File

@ -660,7 +660,7 @@ class ThreadActivity : SimpleActivity() {
val settings = Settings()
settings.useSystemSending = true
settings.deliveryReports = true
settings.deliveryReports = config.enableDeliveryReports
val SIMId = availableSIMCards.getOrNull(currentSIMCardIndex)?.subscriptionId
if (SIMId != null) {

View File

@ -18,6 +18,10 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getBoolean(SHOW_CHARACTER_COUNTER, false)
set(showCharacterCounter) = prefs.edit().putBoolean(SHOW_CHARACTER_COUNTER, showCharacterCounter).apply()
var enableDeliveryReports: Boolean
get() = prefs.getBoolean(ENABLE_DELIVERY_REPORTS, true)
set(showCharacterCounter) = prefs.edit().putBoolean(ENABLE_DELIVERY_REPORTS, showCharacterCounter).apply()
var lockScreenVisibilitySetting: Int
get() = prefs.getInt(LOCK_SCREEN_VISIBILITY, LOCK_SCREEN_SENDER_MESSAGE)
set(lockScreenVisibilitySetting) = prefs.edit().putInt(LOCK_SCREEN_VISIBILITY, lockScreenVisibilitySetting).apply()

View File

@ -14,6 +14,7 @@ const val USE_SIM_ID_PREFIX = "use_sim_id_"
const val NOTIFICATION_CHANNEL = "simple_sms_messenger"
const val SHOW_CHARACTER_COUNTER = "show_character_counter"
const val LOCK_SCREEN_VISIBILITY = "lock_screen_visibility"
const val ENABLE_DELIVERY_REPORTS = "enable_delivery_reports"
private const val PATH = "com.simplemobiletools.smsmessenger.action."
const val MARK_AS_READ = PATH + "mark_as_read"

View File

@ -195,6 +195,29 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_enable_delivery_reports_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground"
android:paddingStart="@dimen/normal_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/settings_enable_delivery_reports"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:paddingStart="@dimen/medium_margin"
android:text="@string/enable_delivery_reports"
app:switchPadding="@dimen/medium_margin" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_lock_screen_visibility_holder"
android:layout_width="match_parent"

View File

@ -46,7 +46,7 @@
<!-- Settings -->
<string name="lock_screen_visibility">Meldingen op vergrendelscherm</string>
<string name="sender_and_message">Afzender en bericht/string>
<string name="sender_and_message">Afzender en bericht</string>
<string name="sender_only">Alleen afzender</string>
<string name="enable_delivery_reports">Bezorgingsrapporten inschakelen</string>