Add column for block all notifications

This commit is contained in:
Jonas L 2019-03-04 00:00:00 +00:00
parent e3bada121d
commit 9dc8a6caab
8 changed files with 673 additions and 10 deletions

View file

@ -0,0 +1,638 @@
{
"formatVersion": 1,
"database": {
"version": 12,
"identityHash": "6634817cfeb16e6c23aced572b2a391e",
"entities": [
{
"tableName": "user",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `password` TEXT NOT NULL, `second_password_salt` TEXT NOT NULL, `type` TEXT NOT NULL, `timezone` TEXT NOT NULL, `disable_limits_until` INTEGER NOT NULL, `mail` TEXT NOT NULL, `current_device` TEXT NOT NULL, `category_for_not_assigned_apps` TEXT NOT NULL, `relax_primary_device` INTEGER NOT NULL, `mail_notification_flags` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "password",
"columnName": "password",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "secondPasswordSalt",
"columnName": "second_password_salt",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "type",
"columnName": "type",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "timeZone",
"columnName": "timezone",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "disableLimitsUntil",
"columnName": "disable_limits_until",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mail",
"columnName": "mail",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "currentDevice",
"columnName": "current_device",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "categoryForNotAssignedApps",
"columnName": "category_for_not_assigned_apps",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "relaxPrimaryDevice",
"columnName": "relax_primary_device",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mailNotificationFlags",
"columnName": "mail_notification_flags",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": false
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "device",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `model` TEXT NOT NULL, `added_at` INTEGER NOT NULL, `current_user_id` TEXT NOT NULL, `apps_version` TEXT NOT NULL, `network_time` TEXT NOT NULL, `current_protection_level` TEXT NOT NULL, `highest_permission_level` TEXT NOT NULL, `current_usage_stats_permission` TEXT NOT NULL, `highest_usage_stats_permission` TEXT NOT NULL, `current_notification_access_permission` TEXT NOT NULL, `highest_notification_access_permission` TEXT NOT NULL, `current_app_version` INTEGER NOT NULL, `highest_app_version` INTEGER NOT NULL, `tried_disabling_device_admin` INTEGER NOT NULL, `did_reboot` INTEGER NOT NULL, `had_manipulation` INTEGER NOT NULL, `did_report_uninstall` INTEGER NOT NULL, `is_user_kept_signed_in` INTEGER NOT NULL, `show_device_connected` INTEGER NOT NULL, `default_user` TEXT NOT NULL, `default_user_timeout` INTEGER NOT NULL, `consider_reboot_manipulation` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "model",
"columnName": "model",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "addedAt",
"columnName": "added_at",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "currentUserId",
"columnName": "current_user_id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "installedAppsVersion",
"columnName": "apps_version",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "networkTime",
"columnName": "network_time",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "currentProtectionLevel",
"columnName": "current_protection_level",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "highestProtectionLevel",
"columnName": "highest_permission_level",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "currentUsageStatsPermission",
"columnName": "current_usage_stats_permission",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "highestUsageStatsPermission",
"columnName": "highest_usage_stats_permission",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "currentNotificationAccessPermission",
"columnName": "current_notification_access_permission",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "highestNotificationAccessPermission",
"columnName": "highest_notification_access_permission",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "currentAppVersion",
"columnName": "current_app_version",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "highestAppVersion",
"columnName": "highest_app_version",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "manipulationTriedDisablingDeviceAdmin",
"columnName": "tried_disabling_device_admin",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "manipulationDidReboot",
"columnName": "did_reboot",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "hadManipulation",
"columnName": "had_manipulation",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "didReportUninstall",
"columnName": "did_report_uninstall",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isUserKeptSignedIn",
"columnName": "is_user_kept_signed_in",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "showDeviceConnected",
"columnName": "show_device_connected",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "defaultUser",
"columnName": "default_user",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "defaultUserTimeout",
"columnName": "default_user_timeout",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "considerRebootManipulation",
"columnName": "consider_reboot_manipulation",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": false
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "app",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`device_id` TEXT NOT NULL, `package_name` TEXT NOT NULL, `title` TEXT NOT NULL, `launchable` INTEGER NOT NULL, `recommendation` TEXT NOT NULL, PRIMARY KEY(`device_id`, `package_name`))",
"fields": [
{
"fieldPath": "deviceId",
"columnName": "device_id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "packageName",
"columnName": "package_name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isLaunchable",
"columnName": "launchable",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "recommendation",
"columnName": "recommendation",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"device_id",
"package_name"
],
"autoGenerate": false
},
"indices": [
{
"name": "index_app_device_id",
"unique": false,
"columnNames": [
"device_id"
],
"createSql": "CREATE INDEX `index_app_device_id` ON `${TABLE_NAME}` (`device_id`)"
},
{
"name": "index_app_package_name",
"unique": false,
"columnNames": [
"package_name"
],
"createSql": "CREATE INDEX `index_app_package_name` ON `${TABLE_NAME}` (`package_name`)"
}
],
"foreignKeys": []
},
{
"tableName": "category_app",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`category_id` TEXT NOT NULL, `package_name` TEXT NOT NULL, PRIMARY KEY(`category_id`, `package_name`))",
"fields": [
{
"fieldPath": "categoryId",
"columnName": "category_id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "packageName",
"columnName": "package_name",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"category_id",
"package_name"
],
"autoGenerate": false
},
"indices": [
{
"name": "index_category_app_category_id",
"unique": false,
"columnNames": [
"category_id"
],
"createSql": "CREATE INDEX `index_category_app_category_id` ON `${TABLE_NAME}` (`category_id`)"
},
{
"name": "index_category_app_package_name",
"unique": false,
"columnNames": [
"package_name"
],
"createSql": "CREATE INDEX `index_category_app_package_name` ON `${TABLE_NAME}` (`package_name`)"
}
],
"foreignKeys": []
},
{
"tableName": "category",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `child_id` TEXT NOT NULL, `title` TEXT NOT NULL, `blocked_times` TEXT NOT NULL, `extra_time` INTEGER NOT NULL, `temporarily_blocked` INTEGER NOT NULL, `block_all_notifications` INTEGER NOT NULL, `base_version` TEXT NOT NULL, `apps_version` TEXT NOT NULL, `rules_version` TEXT NOT NULL, `usedtimes_version` TEXT NOT NULL, `parent_category_id` TEXT NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "childId",
"columnName": "child_id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "blockedMinutesInWeek",
"columnName": "blocked_times",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "extraTimeInMillis",
"columnName": "extra_time",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "temporarilyBlocked",
"columnName": "temporarily_blocked",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "blockAllNotifications",
"columnName": "block_all_notifications",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "baseVersion",
"columnName": "base_version",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "assignedAppsVersion",
"columnName": "apps_version",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "timeLimitRulesVersion",
"columnName": "rules_version",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "usedTimesVersion",
"columnName": "usedtimes_version",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "parentCategoryId",
"columnName": "parent_category_id",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": false
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "used_time",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`day_of_epoch` INTEGER NOT NULL, `used_time` INTEGER NOT NULL, `category_id` TEXT NOT NULL, PRIMARY KEY(`category_id`, `day_of_epoch`))",
"fields": [
{
"fieldPath": "dayOfEpoch",
"columnName": "day_of_epoch",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "usedMillis",
"columnName": "used_time",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "categoryId",
"columnName": "category_id",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"category_id",
"day_of_epoch"
],
"autoGenerate": false
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "time_limit_rule",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `category_id` TEXT NOT NULL, `apply_to_extra_time_usage` INTEGER NOT NULL, `day_mask` INTEGER NOT NULL, `max_time` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "categoryId",
"columnName": "category_id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "applyToExtraTimeUsage",
"columnName": "apply_to_extra_time_usage",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "dayMask",
"columnName": "day_mask",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "maximumTimeInMillis",
"columnName": "max_time",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": false
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "config",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `value` TEXT NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "key",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "value",
"columnName": "value",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": false
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "temporarily_allowed_app",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`device_id` TEXT NOT NULL, `package_name` TEXT NOT NULL, PRIMARY KEY(`device_id`, `package_name`))",
"fields": [
{
"fieldPath": "deviceId",
"columnName": "device_id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "packageName",
"columnName": "package_name",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"device_id",
"package_name"
],
"autoGenerate": false
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "pending_sync_action",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`sequence_number` INTEGER NOT NULL, `action` TEXT NOT NULL, `integrity` TEXT NOT NULL, `scheduled_for_upload` INTEGER NOT NULL, `type` TEXT NOT NULL, `user_id` TEXT NOT NULL, PRIMARY KEY(`sequence_number`))",
"fields": [
{
"fieldPath": "sequenceNumber",
"columnName": "sequence_number",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "encodedAction",
"columnName": "action",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "integrity",
"columnName": "integrity",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "scheduledForUpload",
"columnName": "scheduled_for_upload",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "type",
"columnName": "type",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "userId",
"columnName": "user_id",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"sequence_number"
],
"autoGenerate": false
},
"indices": [
{
"name": "index_pending_sync_action_scheduled_for_upload",
"unique": false,
"columnNames": [
"scheduled_for_upload"
],
"createSql": "CREATE INDEX `index_pending_sync_action_scheduled_for_upload` ON `${TABLE_NAME}` (`scheduled_for_upload`)"
}
],
"foreignKeys": []
}
],
"setupQueries": [
"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, \"6634817cfeb16e6c23aced572b2a391e\")"
]
}
}

View file

@ -85,4 +85,10 @@ object DatabaseMigrations {
database.execSQL("ALTER TABLE `user` ADD COLUMN `mail_notification_flags` INTEGER NOT NULL DEFAULT 0") database.execSQL("ALTER TABLE `user` ADD COLUMN `mail_notification_flags` INTEGER NOT NULL DEFAULT 0")
} }
} }
val MIGRATE_TO_V12 = object: Migration(11, 12) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE `category` ADD COLUMN `block_all_notifications` INTEGER NOT NULL DEFAULT 0")
}
}
} }

View file

@ -32,7 +32,7 @@ import io.timelimit.android.data.model.*
ConfigurationItem::class, ConfigurationItem::class,
TemporarilyAllowedApp::class, TemporarilyAllowedApp::class,
PendingSyncAction::class PendingSyncAction::class
], version = 11) ], version = 12)
abstract class RoomDatabase: RoomDatabase(), io.timelimit.android.data.Database { abstract class RoomDatabase: RoomDatabase(), io.timelimit.android.data.Database {
companion object { companion object {
private val lock = Object() private val lock = Object()
@ -77,7 +77,8 @@ abstract class RoomDatabase: RoomDatabase(), io.timelimit.android.data.Database
DatabaseMigrations.MIGRATE_TO_V8, DatabaseMigrations.MIGRATE_TO_V8,
DatabaseMigrations.MIGRATE_TO_V9, DatabaseMigrations.MIGRATE_TO_V9,
DatabaseMigrations.MIGRATE_TO_V10, DatabaseMigrations.MIGRATE_TO_V10,
DatabaseMigrations.MIGRATE_TO_V11 DatabaseMigrations.MIGRATE_TO_V11,
DatabaseMigrations.MIGRATE_TO_V12
) )
.build() .build()
} }

View file

@ -52,8 +52,10 @@ data class Category(
@ColumnInfo(name = "usedtimes_version") @ColumnInfo(name = "usedtimes_version")
val usedTimesVersion: String, val usedTimesVersion: String,
@ColumnInfo(name = "parent_category_id") @ColumnInfo(name = "parent_category_id")
val parentCategoryId: String val parentCategoryId: String,
): JsonSerializable { @ColumnInfo(name = "block_all_notifications")
val blockAllNotifications: Boolean
): JsonSerializable {
companion object { companion object {
const val MINUTES_PER_DAY = 60 * 24 const val MINUTES_PER_DAY = 60 * 24
const val BLOCKED_MINUTES_IN_WEEK_LENGTH = MINUTES_PER_DAY * 7 const val BLOCKED_MINUTES_IN_WEEK_LENGTH = MINUTES_PER_DAY * 7
@ -69,6 +71,7 @@ data class Category(
private const val RULES_VERSION = "vr" private const val RULES_VERSION = "vr"
private const val USED_TIMES_VERSION = "vu" private const val USED_TIMES_VERSION = "vu"
private const val PARENT_CATEGORY_ID = "pc" private const val PARENT_CATEGORY_ID = "pc"
private const val BlOCK_ALL_NOTIFICATIONS = "ban"
fun parse(reader: JsonReader): Category { fun parse(reader: JsonReader): Category {
var id: String? = null var id: String? = null
@ -83,6 +86,7 @@ data class Category(
var usedTimesVersion: String? = null var usedTimesVersion: String? = null
// this field was added later so it has got a default value // this field was added later so it has got a default value
var parentCategoryId = "" var parentCategoryId = ""
var blockAllNotifications = false
reader.beginObject() reader.beginObject()
@ -99,6 +103,7 @@ data class Category(
RULES_VERSION -> timeLimitRulesVersion = reader.nextString() RULES_VERSION -> timeLimitRulesVersion = reader.nextString()
USED_TIMES_VERSION -> usedTimesVersion = reader.nextString() USED_TIMES_VERSION -> usedTimesVersion = reader.nextString()
PARENT_CATEGORY_ID -> parentCategoryId = reader.nextString() PARENT_CATEGORY_ID -> parentCategoryId = reader.nextString()
BlOCK_ALL_NOTIFICATIONS -> blockAllNotifications = reader.nextBoolean()
else -> reader.skipValue() else -> reader.skipValue()
} }
} }
@ -116,7 +121,8 @@ data class Category(
assignedAppsVersion = assignedAppsVersion!!, assignedAppsVersion = assignedAppsVersion!!,
timeLimitRulesVersion = timeLimitRulesVersion!!, timeLimitRulesVersion = timeLimitRulesVersion!!,
usedTimesVersion = usedTimesVersion!!, usedTimesVersion = usedTimesVersion!!,
parentCategoryId = parentCategoryId parentCategoryId = parentCategoryId,
blockAllNotifications = blockAllNotifications
) )
} }
} }
@ -148,6 +154,7 @@ data class Category(
writer.name(RULES_VERSION).value(timeLimitRulesVersion) writer.name(RULES_VERSION).value(timeLimitRulesVersion)
writer.name(USED_TIMES_VERSION).value(usedTimesVersion) writer.name(USED_TIMES_VERSION).value(usedTimesVersion)
writer.name(PARENT_CATEGORY_ID).value(parentCategoryId) writer.name(PARENT_CATEGORY_ID).value(parentCategoryId)
writer.name(BlOCK_ALL_NOTIFICATIONS).value(blockAllNotifications)
writer.endObject() writer.endObject()
} }

View file

@ -164,7 +164,8 @@ class AppSetupLogic(private val appLogic: AppLogic) {
assignedAppsVersion = "", assignedAppsVersion = "",
timeLimitRulesVersion = "", timeLimitRulesVersion = "",
usedTimesVersion = "", usedTimesVersion = "",
parentCategoryId = "" parentCategoryId = "",
blockAllNotifications = false
)) ))
appLogic.database.category().addCategory(Category( appLogic.database.category().addCategory(Category(
@ -178,7 +179,8 @@ class AppSetupLogic(private val appLogic: AppLogic) {
assignedAppsVersion = "", assignedAppsVersion = "",
timeLimitRulesVersion = "", timeLimitRulesVersion = "",
usedTimesVersion = "", usedTimesVersion = "",
parentCategoryId = "" parentCategoryId = "",
blockAllNotifications = false
)) ))
// add default allowed apps // add default allowed apps

View file

@ -274,6 +274,7 @@ object ApplyServerDataStatus {
blockedMinutesInWeek = newCategory.blockedMinutesInWeek, blockedMinutesInWeek = newCategory.blockedMinutesInWeek,
extraTimeInMillis = newCategory.extraTimeInMillis, extraTimeInMillis = newCategory.extraTimeInMillis,
temporarilyBlocked = newCategory.temporarilyBlocked, temporarilyBlocked = newCategory.temporarilyBlocked,
blockAllNotifications = newCategory.blockAllNotifications,
baseVersion = newCategory.baseDataVersion, baseVersion = newCategory.baseDataVersion,
assignedAppsVersion = "", assignedAppsVersion = "",
timeLimitRulesVersion = "", timeLimitRulesVersion = "",
@ -287,6 +288,7 @@ object ApplyServerDataStatus {
blockedMinutesInWeek = newCategory.blockedMinutesInWeek, blockedMinutesInWeek = newCategory.blockedMinutesInWeek,
extraTimeInMillis = newCategory.extraTimeInMillis, extraTimeInMillis = newCategory.extraTimeInMillis,
temporarilyBlocked = newCategory.temporarilyBlocked, temporarilyBlocked = newCategory.temporarilyBlocked,
blockAllNotifications = newCategory.blockAllNotifications,
baseVersion = newCategory.baseDataVersion, baseVersion = newCategory.baseDataVersion,
parentCategoryId = newCategory.parentCategoryId parentCategoryId = newCategory.parentCategoryId
) )

View file

@ -78,7 +78,8 @@ object LocalDatabaseParentActionDispatcher {
assignedAppsVersion = "", assignedAppsVersion = "",
timeLimitRulesVersion = "", timeLimitRulesVersion = "",
usedTimesVersion = "", usedTimesVersion = "",
parentCategoryId = "" parentCategoryId = "",
blockAllNotifications = false
)) ))
} }
is DeleteCategoryAction -> { is DeleteCategoryAction -> {

View file

@ -300,7 +300,8 @@ data class ServerUpdatedCategoryBaseData(
val extraTimeInMillis: Long, val extraTimeInMillis: Long,
val temporarilyBlocked: Boolean, val temporarilyBlocked: Boolean,
val baseDataVersion: String, val baseDataVersion: String,
val parentCategoryId: String val parentCategoryId: String,
val blockAllNotifications: Boolean
) { ) {
companion object { companion object {
private const val CATEGORY_ID = "categoryId" private const val CATEGORY_ID = "categoryId"
@ -311,6 +312,7 @@ data class ServerUpdatedCategoryBaseData(
private const val TEMPORARILY_BLOCKED = "tempBlocked" private const val TEMPORARILY_BLOCKED = "tempBlocked"
private const val BASE_DATA_VERSION = "version" private const val BASE_DATA_VERSION = "version"
private const val PARENT_CATEGORY_ID = "parentCategoryId" private const val PARENT_CATEGORY_ID = "parentCategoryId"
private const val BLOCK_ALL_NOTIFICATIONS = "blockAllNotifications"
fun parse(reader: JsonReader): ServerUpdatedCategoryBaseData { fun parse(reader: JsonReader): ServerUpdatedCategoryBaseData {
var categoryId: String? = null var categoryId: String? = null
@ -321,6 +323,8 @@ data class ServerUpdatedCategoryBaseData(
var temporarilyBlocked: Boolean? = null var temporarilyBlocked: Boolean? = null
var baseDataVersion: String? = null var baseDataVersion: String? = null
var parentCategoryId: String? = null var parentCategoryId: String? = null
// added later -> default values
var blockAllNotifications = false
reader.beginObject() reader.beginObject()
while (reader.hasNext()) { while (reader.hasNext()) {
@ -333,6 +337,7 @@ data class ServerUpdatedCategoryBaseData(
TEMPORARILY_BLOCKED -> temporarilyBlocked = reader.nextBoolean() TEMPORARILY_BLOCKED -> temporarilyBlocked = reader.nextBoolean()
BASE_DATA_VERSION -> baseDataVersion = reader.nextString() BASE_DATA_VERSION -> baseDataVersion = reader.nextString()
PARENT_CATEGORY_ID -> parentCategoryId = reader.nextString() PARENT_CATEGORY_ID -> parentCategoryId = reader.nextString()
BLOCK_ALL_NOTIFICATIONS -> blockAllNotifications = reader.nextBoolean()
else -> reader.skipValue() else -> reader.skipValue()
} }
} }
@ -346,7 +351,8 @@ data class ServerUpdatedCategoryBaseData(
extraTimeInMillis = extraTimeInMillis!!, extraTimeInMillis = extraTimeInMillis!!,
temporarilyBlocked = temporarilyBlocked!!, temporarilyBlocked = temporarilyBlocked!!,
baseDataVersion = baseDataVersion!!, baseDataVersion = baseDataVersion!!,
parentCategoryId = parentCategoryId!! parentCategoryId = parentCategoryId!!,
blockAllNotifications = blockAllNotifications
) )
} }