rename "own notification channels" to "dedicated channels"
This commit is contained in:
parent
accf3ccf38
commit
d295f08449
13 changed files with 42 additions and 48 deletions
|
@ -2,11 +2,11 @@
|
||||||
"formatVersion": 1,
|
"formatVersion": 1,
|
||||||
"database": {
|
"database": {
|
||||||
"version": 12,
|
"version": 12,
|
||||||
"identityHash": "2be334bfcfa91ab5ffde61a5b295565d",
|
"identityHash": "d230005f4d9824ba9aa34c61003bdcbb",
|
||||||
"entities": [
|
"entities": [
|
||||||
{
|
{
|
||||||
"tableName": "Subscription",
|
"tableName": "Subscription",
|
||||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `baseUrl` TEXT NOT NULL, `topic` TEXT NOT NULL, `instant` INTEGER NOT NULL, `mutedUntil` INTEGER NOT NULL, `minPriority` INTEGER NOT NULL, `autoDelete` INTEGER NOT NULL, `lastNotificationId` TEXT, `icon` TEXT, `upAppId` TEXT, `upConnectorToken` TEXT, `displayName` TEXT, `ownNotificationChannels` INTEGER NOT NULL, PRIMARY KEY(`id`))",
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `baseUrl` TEXT NOT NULL, `topic` TEXT NOT NULL, `instant` INTEGER NOT NULL, `mutedUntil` INTEGER NOT NULL, `minPriority` INTEGER NOT NULL, `autoDelete` INTEGER NOT NULL, `lastNotificationId` TEXT, `icon` TEXT, `upAppId` TEXT, `upConnectorToken` TEXT, `displayName` TEXT, PRIMARY KEY(`id`))",
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"fieldPath": "id",
|
"fieldPath": "id",
|
||||||
|
@ -79,12 +79,6 @@
|
||||||
"columnName": "displayName",
|
"columnName": "displayName",
|
||||||
"affinity": "TEXT",
|
"affinity": "TEXT",
|
||||||
"notNull": false
|
"notNull": false
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldPath": "ownNotificationChannels",
|
|
||||||
"columnName": "ownNotificationChannels",
|
|
||||||
"affinity": "INTEGER",
|
|
||||||
"notNull": true
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"primaryKey": {
|
"primaryKey": {
|
||||||
|
@ -344,7 +338,7 @@
|
||||||
"views": [],
|
"views": [],
|
||||||
"setupQueries": [
|
"setupQueries": [
|
||||||
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
||||||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '2be334bfcfa91ab5ffde61a5b295565d')"
|
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'd230005f4d9824ba9aa34c61003bdcbb')"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,11 +2,11 @@
|
||||||
"formatVersion": 1,
|
"formatVersion": 1,
|
||||||
"database": {
|
"database": {
|
||||||
"version": 13,
|
"version": 13,
|
||||||
"identityHash": "2be334bfcfa91ab5ffde61a5b295565d",
|
"identityHash": "39849793e1ed04fe89f0d71a59a56956",
|
||||||
"entities": [
|
"entities": [
|
||||||
{
|
{
|
||||||
"tableName": "Subscription",
|
"tableName": "Subscription",
|
||||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `baseUrl` TEXT NOT NULL, `topic` TEXT NOT NULL, `instant` INTEGER NOT NULL, `mutedUntil` INTEGER NOT NULL, `minPriority` INTEGER NOT NULL, `autoDelete` INTEGER NOT NULL, `lastNotificationId` TEXT, `icon` TEXT, `upAppId` TEXT, `upConnectorToken` TEXT, `displayName` TEXT, `ownNotificationChannels` INTEGER NOT NULL, PRIMARY KEY(`id`))",
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `baseUrl` TEXT NOT NULL, `topic` TEXT NOT NULL, `instant` INTEGER NOT NULL, `mutedUntil` INTEGER NOT NULL, `minPriority` INTEGER NOT NULL, `autoDelete` INTEGER NOT NULL, `lastNotificationId` TEXT, `icon` TEXT, `upAppId` TEXT, `upConnectorToken` TEXT, `displayName` TEXT, `dedicatedChannels` INTEGER NOT NULL, PRIMARY KEY(`id`))",
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"fieldPath": "id",
|
"fieldPath": "id",
|
||||||
|
@ -81,8 +81,8 @@
|
||||||
"notNull": false
|
"notNull": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldPath": "ownNotificationChannels",
|
"fieldPath": "dedicatedChannels",
|
||||||
"columnName": "ownNotificationChannels",
|
"columnName": "dedicatedChannels",
|
||||||
"affinity": "INTEGER",
|
"affinity": "INTEGER",
|
||||||
"notNull": true
|
"notNull": true
|
||||||
}
|
}
|
||||||
|
@ -344,7 +344,7 @@
|
||||||
"views": [],
|
"views": [],
|
||||||
"setupQueries": [
|
"setupQueries": [
|
||||||
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
||||||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '2be334bfcfa91ab5ffde61a5b295565d')"
|
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '39849793e1ed04fe89f0d71a59a56956')"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -99,7 +99,7 @@ class Backuper(val context: Context) {
|
||||||
baseUrl = s.baseUrl,
|
baseUrl = s.baseUrl,
|
||||||
topic = s.topic,
|
topic = s.topic,
|
||||||
instant = s.instant,
|
instant = s.instant,
|
||||||
ownNotificationChannels = s.ownNotificationChannels,
|
dedicatedChannels = s.dedicatedChannels,
|
||||||
mutedUntil = s.mutedUntil,
|
mutedUntil = s.mutedUntil,
|
||||||
minPriority = s.minPriority ?: Repository.MIN_PRIORITY_USE_GLOBAL,
|
minPriority = s.minPriority ?: Repository.MIN_PRIORITY_USE_GLOBAL,
|
||||||
autoDelete = s.autoDelete ?: Repository.AUTO_DELETE_USE_GLOBAL,
|
autoDelete = s.autoDelete ?: Repository.AUTO_DELETE_USE_GLOBAL,
|
||||||
|
@ -237,7 +237,7 @@ class Backuper(val context: Context) {
|
||||||
baseUrl = s.baseUrl,
|
baseUrl = s.baseUrl,
|
||||||
topic = s.topic,
|
topic = s.topic,
|
||||||
instant = s.instant,
|
instant = s.instant,
|
||||||
ownNotificationChannels = s.ownNotificationChannels,
|
dedicatedChannels = s.dedicatedChannels,
|
||||||
mutedUntil = s.mutedUntil,
|
mutedUntil = s.mutedUntil,
|
||||||
minPriority = s.minPriority,
|
minPriority = s.minPriority,
|
||||||
autoDelete = s.autoDelete,
|
autoDelete = s.autoDelete,
|
||||||
|
@ -355,7 +355,7 @@ data class Subscription(
|
||||||
val baseUrl: String,
|
val baseUrl: String,
|
||||||
val topic: String,
|
val topic: String,
|
||||||
val instant: Boolean,
|
val instant: Boolean,
|
||||||
val ownNotificationChannels: Boolean,
|
val dedicatedChannels: Boolean,
|
||||||
val mutedUntil: Long,
|
val mutedUntil: Long,
|
||||||
val minPriority: Int?,
|
val minPriority: Int?,
|
||||||
val autoDelete: Long?,
|
val autoDelete: Long?,
|
||||||
|
|
|
@ -23,14 +23,14 @@ data class Subscription(
|
||||||
@ColumnInfo(name = "upAppId") val upAppId: String?, // UnifiedPush application package name
|
@ColumnInfo(name = "upAppId") val upAppId: String?, // UnifiedPush application package name
|
||||||
@ColumnInfo(name = "upConnectorToken") val upConnectorToken: String?, // UnifiedPush connector token
|
@ColumnInfo(name = "upConnectorToken") val upConnectorToken: String?, // UnifiedPush connector token
|
||||||
@ColumnInfo(name = "displayName") val displayName: String?,
|
@ColumnInfo(name = "displayName") val displayName: String?,
|
||||||
@ColumnInfo(name = "ownNotificationChannels") val ownNotificationChannels: Boolean,
|
@ColumnInfo(name = "dedicatedChannels") val dedicatedChannels: Boolean,
|
||||||
@Ignore val totalCount: Int = 0, // Total notifications
|
@Ignore val totalCount: Int = 0, // Total notifications
|
||||||
@Ignore val newCount: Int = 0, // New notifications
|
@Ignore val newCount: Int = 0, // New notifications
|
||||||
@Ignore val lastActive: Long = 0, // Unix timestamp
|
@Ignore val lastActive: Long = 0, // Unix timestamp
|
||||||
@Ignore val state: ConnectionState = ConnectionState.NOT_APPLICABLE
|
@Ignore val state: ConnectionState = ConnectionState.NOT_APPLICABLE
|
||||||
) {
|
) {
|
||||||
constructor(id: Long, baseUrl: String, topic: String, instant: Boolean, mutedUntil: Long, minPriority: Int, autoDelete: Long, lastNotificationId: String, icon: String, upAppId: String, upConnectorToken: String, displayName: String?, ownNotificationChannels: Boolean?) :
|
constructor(id: Long, baseUrl: String, topic: String, instant: Boolean, mutedUntil: Long, minPriority: Int, autoDelete: Long, lastNotificationId: String, icon: String, upAppId: String, upConnectorToken: String, displayName: String?, dedicatedChannels: Boolean?) :
|
||||||
this(id, baseUrl, topic, instant, mutedUntil, minPriority, autoDelete, lastNotificationId, icon, upAppId, upConnectorToken, displayName, ownNotificationChannels == true, 0, 0, 0, ConnectionState.NOT_APPLICABLE)
|
this(id, baseUrl, topic, instant, mutedUntil, minPriority, autoDelete, lastNotificationId, icon, upAppId, upConnectorToken, displayName, dedicatedChannels == true, 0, 0, 0, ConnectionState.NOT_APPLICABLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class ConnectionState {
|
enum class ConnectionState {
|
||||||
|
@ -50,7 +50,7 @@ data class SubscriptionWithMetadata(
|
||||||
val upAppId: String?,
|
val upAppId: String?,
|
||||||
val upConnectorToken: String?,
|
val upConnectorToken: String?,
|
||||||
val displayName: String?,
|
val displayName: String?,
|
||||||
val ownNotificationChannels: Boolean,
|
val dedicatedChannels: Boolean,
|
||||||
val totalCount: Int,
|
val totalCount: Int,
|
||||||
val newCount: Int,
|
val newCount: Int,
|
||||||
val lastActive: Long
|
val lastActive: Long
|
||||||
|
@ -289,7 +289,7 @@ abstract class Database : RoomDatabase() {
|
||||||
|
|
||||||
private val MIGRATION_12_13 = object : Migration(12, 13) {
|
private val MIGRATION_12_13 = object : Migration(12, 13) {
|
||||||
override fun migrate(db: SupportSQLiteDatabase) {
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
db.execSQL("ALTER TABLE Subscription ADD COLUMN ownNotificationChannels INTEGER NOT NULL DEFAULT('0')")
|
db.execSQL("ALTER TABLE Subscription ADD COLUMN dedicatedChannels INTEGER NOT NULL DEFAULT('0')")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -299,7 +299,7 @@ abstract class Database : RoomDatabase() {
|
||||||
interface SubscriptionDao {
|
interface SubscriptionDao {
|
||||||
@Query("""
|
@Query("""
|
||||||
SELECT
|
SELECT
|
||||||
s.id, s.baseUrl, s.topic, s.instant, s.mutedUntil, s.minPriority, s.autoDelete, s.lastNotificationId, s.icon, s.upAppId, s.upConnectorToken, s.displayName, s.ownNotificationChannels,
|
s.id, s.baseUrl, s.topic, s.instant, s.mutedUntil, s.minPriority, s.autoDelete, s.lastNotificationId, s.icon, s.upAppId, s.upConnectorToken, s.displayName, s.dedicatedChannels,
|
||||||
COUNT(n.id) totalCount,
|
COUNT(n.id) totalCount,
|
||||||
COUNT(CASE n.notificationId WHEN 0 THEN NULL ELSE n.id END) newCount,
|
COUNT(CASE n.notificationId WHEN 0 THEN NULL ELSE n.id END) newCount,
|
||||||
IFNULL(MAX(n.timestamp),0) AS lastActive
|
IFNULL(MAX(n.timestamp),0) AS lastActive
|
||||||
|
@ -312,7 +312,7 @@ interface SubscriptionDao {
|
||||||
|
|
||||||
@Query("""
|
@Query("""
|
||||||
SELECT
|
SELECT
|
||||||
s.id, s.baseUrl, s.topic, s.instant, s.mutedUntil, s.minPriority, s.autoDelete, s.lastNotificationId, s.icon, s.upAppId, s.upConnectorToken, s.displayName, s.ownNotificationChannels,
|
s.id, s.baseUrl, s.topic, s.instant, s.mutedUntil, s.minPriority, s.autoDelete, s.lastNotificationId, s.icon, s.upAppId, s.upConnectorToken, s.displayName, s.dedicatedChannels,
|
||||||
COUNT(n.id) totalCount,
|
COUNT(n.id) totalCount,
|
||||||
COUNT(CASE n.notificationId WHEN 0 THEN NULL ELSE n.id END) newCount,
|
COUNT(CASE n.notificationId WHEN 0 THEN NULL ELSE n.id END) newCount,
|
||||||
IFNULL(MAX(n.timestamp),0) AS lastActive
|
IFNULL(MAX(n.timestamp),0) AS lastActive
|
||||||
|
@ -325,7 +325,7 @@ interface SubscriptionDao {
|
||||||
|
|
||||||
@Query("""
|
@Query("""
|
||||||
SELECT
|
SELECT
|
||||||
s.id, s.baseUrl, s.topic, s.instant, s.mutedUntil, s.minPriority, s.autoDelete, s.lastNotificationId, s.icon, s.upAppId, s.upConnectorToken, s.displayName, s.ownNotificationChannels,
|
s.id, s.baseUrl, s.topic, s.instant, s.mutedUntil, s.minPriority, s.autoDelete, s.lastNotificationId, s.icon, s.upAppId, s.upConnectorToken, s.displayName, s.dedicatedChannels,
|
||||||
COUNT(n.id) totalCount,
|
COUNT(n.id) totalCount,
|
||||||
COUNT(CASE n.notificationId WHEN 0 THEN NULL ELSE n.id END) newCount,
|
COUNT(CASE n.notificationId WHEN 0 THEN NULL ELSE n.id END) newCount,
|
||||||
IFNULL(MAX(n.timestamp),0) AS lastActive
|
IFNULL(MAX(n.timestamp),0) AS lastActive
|
||||||
|
@ -338,7 +338,7 @@ interface SubscriptionDao {
|
||||||
|
|
||||||
@Query("""
|
@Query("""
|
||||||
SELECT
|
SELECT
|
||||||
s.id, s.baseUrl, s.topic, s.instant, s.mutedUntil, s.minPriority, s.autoDelete, s.lastNotificationId, s.icon, s.upAppId, s.upConnectorToken, s.displayName, s.ownNotificationChannels,
|
s.id, s.baseUrl, s.topic, s.instant, s.mutedUntil, s.minPriority, s.autoDelete, s.lastNotificationId, s.icon, s.upAppId, s.upConnectorToken, s.displayName, s.dedicatedChannels,
|
||||||
COUNT(n.id) totalCount,
|
COUNT(n.id) totalCount,
|
||||||
COUNT(CASE n.notificationId WHEN 0 THEN NULL ELSE n.id END) newCount,
|
COUNT(CASE n.notificationId WHEN 0 THEN NULL ELSE n.id END) newCount,
|
||||||
IFNULL(MAX(n.timestamp),0) AS lastActive
|
IFNULL(MAX(n.timestamp),0) AS lastActive
|
||||||
|
@ -351,7 +351,7 @@ interface SubscriptionDao {
|
||||||
|
|
||||||
@Query("""
|
@Query("""
|
||||||
SELECT
|
SELECT
|
||||||
s.id, s.baseUrl, s.topic, s.instant, s.mutedUntil, s.minPriority, s.autoDelete, s.lastNotificationId, s.icon, s.upAppId, s.upConnectorToken, s.displayName, s.ownNotificationChannels,
|
s.id, s.baseUrl, s.topic, s.instant, s.mutedUntil, s.minPriority, s.autoDelete, s.lastNotificationId, s.icon, s.upAppId, s.upConnectorToken, s.displayName, s.dedicatedChannels,
|
||||||
COUNT(n.id) totalCount,
|
COUNT(n.id) totalCount,
|
||||||
COUNT(CASE n.notificationId WHEN 0 THEN NULL ELSE n.id END) newCount,
|
COUNT(CASE n.notificationId WHEN 0 THEN NULL ELSE n.id END) newCount,
|
||||||
IFNULL(MAX(n.timestamp),0) AS lastActive
|
IFNULL(MAX(n.timestamp),0) AS lastActive
|
||||||
|
|
|
@ -385,7 +385,7 @@ class Repository(private val sharedPrefs: SharedPreferences, private val databas
|
||||||
baseUrl = s.baseUrl,
|
baseUrl = s.baseUrl,
|
||||||
topic = s.topic,
|
topic = s.topic,
|
||||||
instant = s.instant,
|
instant = s.instant,
|
||||||
ownNotificationChannels = s.ownNotificationChannels,
|
dedicatedChannels = s.dedicatedChannels,
|
||||||
mutedUntil = s.mutedUntil,
|
mutedUntil = s.mutedUntil,
|
||||||
minPriority = s.minPriority,
|
minPriority = s.minPriority,
|
||||||
autoDelete = s.autoDelete,
|
autoDelete = s.autoDelete,
|
||||||
|
@ -411,7 +411,7 @@ class Repository(private val sharedPrefs: SharedPreferences, private val databas
|
||||||
baseUrl = s.baseUrl,
|
baseUrl = s.baseUrl,
|
||||||
topic = s.topic,
|
topic = s.topic,
|
||||||
instant = s.instant,
|
instant = s.instant,
|
||||||
ownNotificationChannels = s.ownNotificationChannels,
|
dedicatedChannels = s.dedicatedChannels,
|
||||||
mutedUntil = s.mutedUntil,
|
mutedUntil = s.mutedUntil,
|
||||||
minPriority = s.minPriority,
|
minPriority = s.minPriority,
|
||||||
autoDelete = s.autoDelete,
|
autoDelete = s.autoDelete,
|
||||||
|
|
|
@ -87,7 +87,7 @@ class NotificationService(val context: Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun groupId(subscription: Subscription): String? {
|
fun groupId(subscription: Subscription): String? {
|
||||||
if (subscription.ownNotificationChannels) {
|
if (subscription.dedicatedChannels) {
|
||||||
return "" + subscription.id
|
return "" + subscription.id
|
||||||
} else {
|
} else {
|
||||||
return null
|
return null
|
||||||
|
@ -96,7 +96,7 @@ class NotificationService(val context: Context) {
|
||||||
|
|
||||||
private fun displayInternal(subscription: Subscription, notification: Notification, update: Boolean = false) {
|
private fun displayInternal(subscription: Subscription, notification: Notification, update: Boolean = false) {
|
||||||
val title = formatTitle(subscription, notification)
|
val title = formatTitle(subscription, notification)
|
||||||
val scope = if (subscription.ownNotificationChannels) dedicatedNotificationScope(subscription) else DEFAULT_NOTIFICATION_SCOPE
|
val scope = if (subscription.dedicatedChannels) dedicatedNotificationScope(subscription) else DEFAULT_NOTIFICATION_SCOPE
|
||||||
val builder = NotificationCompat.Builder(context, toChannelId(scope, notification.priority))
|
val builder = NotificationCompat.Builder(context, toChannelId(scope, notification.priority))
|
||||||
.setSmallIcon(R.drawable.ic_notification)
|
.setSmallIcon(R.drawable.ic_notification)
|
||||||
.setColor(ContextCompat.getColor(context, Colors.notificationIcon(context)))
|
.setColor(ContextCompat.getColor(context, Colors.notificationIcon(context)))
|
||||||
|
|
|
@ -110,7 +110,7 @@ class DetailActivity : AppCompatActivity(), ActionMode.Callback, NotificationFra
|
||||||
baseUrl = baseUrl,
|
baseUrl = baseUrl,
|
||||||
topic = topic,
|
topic = topic,
|
||||||
instant = instant,
|
instant = instant,
|
||||||
ownNotificationChannels = false,
|
dedicatedChannels = false,
|
||||||
mutedUntil = 0,
|
mutedUntil = 0,
|
||||||
minPriority = Repository.MIN_PRIORITY_USE_GLOBAL,
|
minPriority = Repository.MIN_PRIORITY_USE_GLOBAL,
|
||||||
autoDelete = Repository.AUTO_DELETE_USE_GLOBAL,
|
autoDelete = Repository.AUTO_DELETE_USE_GLOBAL,
|
||||||
|
|
|
@ -112,7 +112,7 @@ class DetailSettingsActivity : AppCompatActivity() {
|
||||||
private fun loadView() {
|
private fun loadView() {
|
||||||
if (subscription.upAppId == null) {
|
if (subscription.upAppId == null) {
|
||||||
loadInstantPref()
|
loadInstantPref()
|
||||||
loadOwnNotificationChannelsPref()
|
loadDedicatedChannelsPrefs()
|
||||||
loadMutedUntilPref()
|
loadMutedUntilPref()
|
||||||
loadMinPriorityPref()
|
loadMinPriorityPref()
|
||||||
loadAutoDeletePref()
|
loadAutoDeletePref()
|
||||||
|
@ -151,14 +151,14 @@ class DetailSettingsActivity : AppCompatActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadOwnNotificationChannelsPref() {
|
private fun loadDedicatedChannelsPrefs() {
|
||||||
val prefId = context?.getString(R.string.detail_settings_notifications_own_notification_channels_key) ?: return
|
val prefId = context?.getString(R.string.detail_settings_notifications_dedicated_channels_key) ?: return
|
||||||
val pref: SwitchPreference? = findPreference(prefId)
|
val pref: SwitchPreference? = findPreference(prefId)
|
||||||
pref?.isVisible = true
|
pref?.isVisible = true
|
||||||
pref?.isChecked = subscription.ownNotificationChannels
|
pref?.isChecked = subscription.dedicatedChannels
|
||||||
pref?.preferenceDataStore = object : PreferenceDataStore() {
|
pref?.preferenceDataStore = object : PreferenceDataStore() {
|
||||||
override fun putBoolean(key: String?, value: Boolean) {
|
override fun putBoolean(key: String?, value: Boolean) {
|
||||||
save(subscription.copy(ownNotificationChannels = value))
|
save(subscription.copy(dedicatedChannels = value))
|
||||||
if(value) {
|
if(value) {
|
||||||
notificationService.createSubscriptionNotificationChannels(subscription)
|
notificationService.createSubscriptionNotificationChannels(subscription)
|
||||||
} else {
|
} else {
|
||||||
|
@ -167,14 +167,14 @@ class DetailSettingsActivity : AppCompatActivity() {
|
||||||
|
|
||||||
}
|
}
|
||||||
override fun getBoolean(key: String?, defValue: Boolean): Boolean {
|
override fun getBoolean(key: String?, defValue: Boolean): Boolean {
|
||||||
return subscription.ownNotificationChannels
|
return subscription.dedicatedChannels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pref?.summaryProvider = Preference.SummaryProvider<SwitchPreference> { preference ->
|
pref?.summaryProvider = Preference.SummaryProvider<SwitchPreference> { preference ->
|
||||||
if (preference.isChecked) {
|
if (preference.isChecked) {
|
||||||
getString(R.string.detail_settings_notifications_own_notification_channels_summay_on)
|
getString(R.string.detail_settings_notifications_dedicated_channels_summay_on)
|
||||||
} else {
|
} else {
|
||||||
getString(R.string.detail_settings_notifications_own_notification_channels_summay_off)
|
getString(R.string.detail_settings_notifications_dedicated_channels_summay_off)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -452,7 +452,7 @@ class MainActivity : AppCompatActivity(), ActionMode.Callback, AddFragment.Subsc
|
||||||
baseUrl = baseUrl,
|
baseUrl = baseUrl,
|
||||||
topic = topic,
|
topic = topic,
|
||||||
instant = instant,
|
instant = instant,
|
||||||
ownNotificationChannels = false,
|
dedicatedChannels = false,
|
||||||
mutedUntil = 0,
|
mutedUntil = 0,
|
||||||
minPriority = Repository.MIN_PRIORITY_USE_GLOBAL,
|
minPriority = Repository.MIN_PRIORITY_USE_GLOBAL,
|
||||||
autoDelete = Repository.AUTO_DELETE_USE_GLOBAL,
|
autoDelete = Repository.AUTO_DELETE_USE_GLOBAL,
|
||||||
|
|
|
@ -72,7 +72,7 @@ class BroadcastReceiver : android.content.BroadcastReceiver() {
|
||||||
baseUrl = baseUrl,
|
baseUrl = baseUrl,
|
||||||
topic = topic,
|
topic = topic,
|
||||||
instant = true, // No Firebase, always instant!
|
instant = true, // No Firebase, always instant!
|
||||||
ownNotificationChannels = false,
|
dedicatedChannels = false,
|
||||||
mutedUntil = 0,
|
mutedUntil = 0,
|
||||||
minPriority = Repository.MIN_PRIORITY_USE_GLOBAL,
|
minPriority = Repository.MIN_PRIORITY_USE_GLOBAL,
|
||||||
autoDelete = Repository.AUTO_DELETE_USE_GLOBAL,
|
autoDelete = Repository.AUTO_DELETE_USE_GLOBAL,
|
||||||
|
|
|
@ -349,9 +349,9 @@
|
||||||
<string name="detail_settings_notifications_instant_title">Instant delivery</string>
|
<string name="detail_settings_notifications_instant_title">Instant delivery</string>
|
||||||
<string name="detail_settings_notifications_instant_summary_on">Notifications are delivered instantly. Requires a foreground service and consumes more battery.</string>
|
<string name="detail_settings_notifications_instant_summary_on">Notifications are delivered instantly. Requires a foreground service and consumes more battery.</string>
|
||||||
<string name="detail_settings_notifications_instant_summary_off">Notifications are delivered using Firebase. Delivery may be delayed, but consumes less battery.</string>
|
<string name="detail_settings_notifications_instant_summary_off">Notifications are delivered using Firebase. Delivery may be delayed, but consumes less battery.</string>
|
||||||
<string name="detail_settings_notifications_own_notification_channels_title">Own notification channels</string>
|
<string name="detail_settings_notifications_dedicated_channels_title">Use dedicated channels</string>
|
||||||
<string name="detail_settings_notifications_own_notification_channels_summay_on">Use own notification channels for this subscription</string>
|
<string name="detail_settings_notifications_dedicated_channels_summay_on">Use dedicated notification channels for this subscription</string>
|
||||||
<string name="detail_settings_notifications_own_notification_channels_summay_off">Use default notification channels</string>
|
<string name="detail_settings_notifications_dedicated_channels_summay_off">Use default notification channels</string>
|
||||||
<string name="detail_settings_appearance_header">Appearance</string>
|
<string name="detail_settings_appearance_header">Appearance</string>
|
||||||
<string name="detail_settings_appearance_icon_set_title">Subscription icon</string>
|
<string name="detail_settings_appearance_icon_set_title">Subscription icon</string>
|
||||||
<string name="detail_settings_appearance_icon_set_summary">Set an icon to be displayed in notifications</string>
|
<string name="detail_settings_appearance_icon_set_summary">Set an icon to be displayed in notifications</string>
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<string name="detail_settings_notifications_header_key" translatable="false">SubscriptionNotifications</string>
|
<string name="detail_settings_notifications_header_key" translatable="false">SubscriptionNotifications</string>
|
||||||
<string name="detail_settings_notifications_instant_key" translatable="false">SubscriptionInstant</string>
|
<string name="detail_settings_notifications_instant_key" translatable="false">SubscriptionInstant</string>
|
||||||
<string name="detail_settings_notifications_muted_until_key" translatable="false">SubscriptionMutedUntil</string>
|
<string name="detail_settings_notifications_muted_until_key" translatable="false">SubscriptionMutedUntil</string>
|
||||||
<string name="detail_settings_notifications_own_notification_channels_key" translatable="false">SubscriptionOwnNotificationChannels</string>
|
<string name="detail_settings_notifications_dedicated_channels_key" translatable="false">SubscriptionDedicatedChannels</string>
|
||||||
<string name="detail_settings_notifications_min_priority_key" translatable="false">SubscriptionMinPriority</string>
|
<string name="detail_settings_notifications_min_priority_key" translatable="false">SubscriptionMinPriority</string>
|
||||||
<string name="detail_settings_notifications_auto_delete_key" translatable="false">SubscriptionAutoDelete</string>
|
<string name="detail_settings_notifications_auto_delete_key" translatable="false">SubscriptionAutoDelete</string>
|
||||||
<string name="detail_settings_appearance_header_key" translatable="false">SubscriptionAppearance</string>
|
<string name="detail_settings_appearance_header_key" translatable="false">SubscriptionAppearance</string>
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
app:defaultValue="0"
|
app:defaultValue="0"
|
||||||
app:isPreferenceVisible="false"/>
|
app:isPreferenceVisible="false"/>
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
app:key="@string/detail_settings_notifications_own_notification_channels_key"
|
app:key="@string/detail_settings_notifications_dedicated_channels_key"
|
||||||
app:title="@string/detail_settings_notifications_own_notification_channels_title"
|
app:title="@string/detail_settings_notifications_dedicated_channels_title"
|
||||||
app:isPreferenceVisible="false"/>
|
app:isPreferenceVisible="false"/>
|
||||||
<ListPreference
|
<ListPreference
|
||||||
app:key="@string/detail_settings_notifications_min_priority_key"
|
app:key="@string/detail_settings_notifications_min_priority_key"
|
||||||
|
|
Loading…
Reference in a new issue