From e032e90957deb156a924d7661bfbe36de75d501e Mon Sep 17 00:00:00 2001 From: julian Date: Fri, 12 May 2023 10:19:15 -0600 Subject: [PATCH] update theme schema to add support for preview assets --- lib/models/isar/stack_theme.dart | 3 + lib/models/isar/stack_theme.g.dart | 182 ++++++++++++++++-- .../appearance_settings.dart | 2 +- 3 files changed, 168 insertions(+), 19 deletions(-) diff --git a/lib/models/isar/stack_theme.dart b/lib/models/isar/stack_theme.dart index 273ec0c39..d91e61cd3 100644 --- a/lib/models/isar/stack_theme.dart +++ b/lib/models/isar/stack_theme.dart @@ -1992,6 +1992,7 @@ class ThemeAssets { late final String send; late final String sendPending; late final String sendCancelled; + late final String themeSelector; late final String themePreview; late final String txExchange; late final String txExchangePending; @@ -2068,6 +2069,8 @@ class ThemeAssets { "$applicationThemesDirectoryPath/$themeId/assets/${json["send_pending"] as String}" ..sendCancelled = "$applicationThemesDirectoryPath/$themeId/assets/${json["send_cancelled"] as String}" + ..themeSelector = + "$applicationThemesDirectoryPath/$themeId/assets/${json["theme_selector"] as String}" ..themePreview = "$applicationThemesDirectoryPath/$themeId/assets/${json["theme_preview"] as String}" ..txExchange = diff --git a/lib/models/isar/stack_theme.g.dart b/lib/models/isar/stack_theme.g.dart index 91a589b13..33646c12e 100644 --- a/lib/models/isar/stack_theme.g.dart +++ b/lib/models/isar/stack_theme.g.dart @@ -17877,33 +17877,38 @@ const ThemeAssetsSchema = Schema( name: r'themePreview', type: IsarType.string, ), - r'txExchange': PropertySchema( + r'themeSelector': PropertySchema( id: 46, + name: r'themeSelector', + type: IsarType.string, + ), + r'txExchange': PropertySchema( + id: 47, name: r'txExchange', type: IsarType.string, ), r'txExchangeFailed': PropertySchema( - id: 47, + id: 48, name: r'txExchangeFailed', type: IsarType.string, ), r'txExchangePending': PropertySchema( - id: 48, + id: 49, name: r'txExchangePending', type: IsarType.string, ), r'wownero': PropertySchema( - id: 49, + id: 50, name: r'wownero', type: IsarType.string, ), r'wowneroImage': PropertySchema( - id: 50, + id: 51, name: r'wowneroImage', type: IsarType.string, ), r'wowneroImageSecondary': PropertySchema( - id: 51, + id: 52, name: r'wowneroImageSecondary', type: IsarType.string, ) @@ -17976,6 +17981,7 @@ int _themeAssetsEstimateSize( bytesCount += 3 + object.stack.length * 3; bytesCount += 3 + object.stackIcon.length * 3; bytesCount += 3 + object.themePreview.length * 3; + bytesCount += 3 + object.themeSelector.length * 3; bytesCount += 3 + object.txExchange.length * 3; bytesCount += 3 + object.txExchangeFailed.length * 3; bytesCount += 3 + object.txExchangePending.length * 3; @@ -18037,12 +18043,13 @@ void _themeAssetsSerialize( writer.writeString(offsets[43], object.stack); writer.writeString(offsets[44], object.stackIcon); writer.writeString(offsets[45], object.themePreview); - writer.writeString(offsets[46], object.txExchange); - writer.writeString(offsets[47], object.txExchangeFailed); - writer.writeString(offsets[48], object.txExchangePending); - writer.writeString(offsets[49], object.wownero); - writer.writeString(offsets[50], object.wowneroImage); - writer.writeString(offsets[51], object.wowneroImageSecondary); + writer.writeString(offsets[46], object.themeSelector); + writer.writeString(offsets[47], object.txExchange); + writer.writeString(offsets[48], object.txExchangeFailed); + writer.writeString(offsets[49], object.txExchangePending); + writer.writeString(offsets[50], object.wownero); + writer.writeString(offsets[51], object.wowneroImage); + writer.writeString(offsets[52], object.wowneroImageSecondary); } ThemeAssets _themeAssetsDeserialize( @@ -18098,12 +18105,13 @@ ThemeAssets _themeAssetsDeserialize( object.stack = reader.readString(offsets[43]); object.stackIcon = reader.readString(offsets[44]); object.themePreview = reader.readString(offsets[45]); - object.txExchange = reader.readString(offsets[46]); - object.txExchangeFailed = reader.readString(offsets[47]); - object.txExchangePending = reader.readString(offsets[48]); - object.wownero = reader.readString(offsets[49]); - object.wowneroImage = reader.readString(offsets[50]); - object.wowneroImageSecondary = reader.readString(offsets[51]); + object.themeSelector = reader.readString(offsets[46]); + object.txExchange = reader.readString(offsets[47]); + object.txExchangeFailed = reader.readString(offsets[48]); + object.txExchangePending = reader.readString(offsets[49]); + object.wownero = reader.readString(offsets[50]); + object.wowneroImage = reader.readString(offsets[51]); + object.wowneroImageSecondary = reader.readString(offsets[52]); return object; } @@ -18218,6 +18226,8 @@ P _themeAssetsDeserializeProp

( return (reader.readString(offset)) as P; case 51: return (reader.readString(offset)) as P; + case 52: + return (reader.readString(offset)) as P; default: throw IsarError('Unknown property with id $propertyId'); } @@ -24496,6 +24506,142 @@ extension ThemeAssetsQueryFilter }); } + QueryBuilder + themeSelectorEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'themeSelector', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'themeSelector', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'themeSelector', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'themeSelector', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'themeSelector', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'themeSelector', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'themeSelector', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'themeSelector', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'themeSelector', + value: '', + )); + }); + } + + QueryBuilder + themeSelectorIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'themeSelector', + value: '', + )); + }); + } + QueryBuilder txExchangeEqualTo( String value, { diff --git a/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/appearance_settings.dart b/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/appearance_settings.dart index 7b165395a..2cc79df71 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/appearance_settings.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/appearance_settings.dart @@ -270,7 +270,7 @@ class _ThemeToggle extends ConsumerState { installedThemeIdNames = ref .read(pThemeService) .installedThemes - .map((e) => Tuple3(e.themeId, e.name, e.assets.themePreview)) + .map((e) => Tuple3(e.themeId, e.name, e.assets.themeSelector)) .toList(); }