Showing
5 changed files
with
92 additions
and
22 deletions
| @@ -125,12 +125,16 @@ data class WatchTransformTheme ( | @@ -125,12 +125,16 @@ data class WatchTransformTheme ( | ||
| 125 | val themeName: String, | 125 | val themeName: String, |
| 126 | val energeticDescription: String, | 126 | val energeticDescription: String, |
| 127 | val energeticImage: ByteArray? = null, | 127 | val energeticImage: ByteArray? = null, |
| 128 | + val energeticImageUrl: String? = null, | ||
| 128 | val normalDescription: String, | 129 | val normalDescription: String, |
| 129 | val normalImage: ByteArray? = null, | 130 | val normalImage: ByteArray? = null, |
| 131 | + val normalImageUrl: String? = null, | ||
| 130 | val slightStressfulDescription: String, | 132 | val slightStressfulDescription: String, |
| 131 | val slightStressfulImage: ByteArray? = null, | 133 | val slightStressfulImage: ByteArray? = null, |
| 134 | + val slightStressfulImageUrl: String? = null, | ||
| 132 | val stressfulDescription: String, | 135 | val stressfulDescription: String, |
| 133 | - val stressfulImage: ByteArray? = null | 136 | + val stressfulImage: ByteArray? = null, |
| 137 | + val stressfulImageUrl: String? = null | ||
| 134 | ) | 138 | ) |
| 135 | { | 139 | { |
| 136 | companion object { | 140 | companion object { |
| @@ -139,13 +143,17 @@ data class WatchTransformTheme ( | @@ -139,13 +143,17 @@ data class WatchTransformTheme ( | ||
| 139 | val themeName = pigeonVar_list[1] as String | 143 | val themeName = pigeonVar_list[1] as String |
| 140 | val energeticDescription = pigeonVar_list[2] as String | 144 | val energeticDescription = pigeonVar_list[2] as String |
| 141 | val energeticImage = pigeonVar_list[3] as ByteArray? | 145 | val energeticImage = pigeonVar_list[3] as ByteArray? |
| 142 | - val normalDescription = pigeonVar_list[4] as String | ||
| 143 | - val normalImage = pigeonVar_list[5] as ByteArray? | ||
| 144 | - val slightStressfulDescription = pigeonVar_list[6] as String | ||
| 145 | - val slightStressfulImage = pigeonVar_list[7] as ByteArray? | ||
| 146 | - val stressfulDescription = pigeonVar_list[8] as String | ||
| 147 | - val stressfulImage = pigeonVar_list[9] as ByteArray? | ||
| 148 | - return WatchTransformTheme(themeId, themeName, energeticDescription, energeticImage, normalDescription, normalImage, slightStressfulDescription, slightStressfulImage, stressfulDescription, stressfulImage) | 146 | + val energeticImageUrl = pigeonVar_list[4] as String? |
| 147 | + val normalDescription = pigeonVar_list[5] as String | ||
| 148 | + val normalImage = pigeonVar_list[6] as ByteArray? | ||
| 149 | + val normalImageUrl = pigeonVar_list[7] as String? | ||
| 150 | + val slightStressfulDescription = pigeonVar_list[8] as String | ||
| 151 | + val slightStressfulImage = pigeonVar_list[9] as ByteArray? | ||
| 152 | + val slightStressfulImageUrl = pigeonVar_list[10] as String? | ||
| 153 | + val stressfulDescription = pigeonVar_list[11] as String | ||
| 154 | + val stressfulImage = pigeonVar_list[12] as ByteArray? | ||
| 155 | + val stressfulImageUrl = pigeonVar_list[13] as String? | ||
| 156 | + return WatchTransformTheme(themeId, themeName, energeticDescription, energeticImage, energeticImageUrl, normalDescription, normalImage, normalImageUrl, slightStressfulDescription, slightStressfulImage, slightStressfulImageUrl, stressfulDescription, stressfulImage, stressfulImageUrl) | ||
| 149 | } | 157 | } |
| 150 | } | 158 | } |
| 151 | fun toList(): List<Any?> { | 159 | fun toList(): List<Any?> { |
| @@ -154,12 +162,16 @@ data class WatchTransformTheme ( | @@ -154,12 +162,16 @@ data class WatchTransformTheme ( | ||
| 154 | themeName, | 162 | themeName, |
| 155 | energeticDescription, | 163 | energeticDescription, |
| 156 | energeticImage, | 164 | energeticImage, |
| 165 | + energeticImageUrl, | ||
| 157 | normalDescription, | 166 | normalDescription, |
| 158 | normalImage, | 167 | normalImage, |
| 168 | + normalImageUrl, | ||
| 159 | slightStressfulDescription, | 169 | slightStressfulDescription, |
| 160 | slightStressfulImage, | 170 | slightStressfulImage, |
| 171 | + slightStressfulImageUrl, | ||
| 161 | stressfulDescription, | 172 | stressfulDescription, |
| 162 | stressfulImage, | 173 | stressfulImage, |
| 174 | + stressfulImageUrl, | ||
| 163 | ) | 175 | ) |
| 164 | } | 176 | } |
| 165 | override fun equals(other: Any?): Boolean { | 177 | override fun equals(other: Any?): Boolean { |
| @@ -159,12 +159,16 @@ struct WatchTransformTheme: Hashable { | @@ -159,12 +159,16 @@ struct WatchTransformTheme: Hashable { | ||
| 159 | var themeName: String | 159 | var themeName: String |
| 160 | var energeticDescription: String | 160 | var energeticDescription: String |
| 161 | var energeticImage: FlutterStandardTypedData? = nil | 161 | var energeticImage: FlutterStandardTypedData? = nil |
| 162 | + var energeticImageUrl: String? = nil | ||
| 162 | var normalDescription: String | 163 | var normalDescription: String |
| 163 | var normalImage: FlutterStandardTypedData? = nil | 164 | var normalImage: FlutterStandardTypedData? = nil |
| 165 | + var normalImageUrl: String? = nil | ||
| 164 | var slightStressfulDescription: String | 166 | var slightStressfulDescription: String |
| 165 | var slightStressfulImage: FlutterStandardTypedData? = nil | 167 | var slightStressfulImage: FlutterStandardTypedData? = nil |
| 168 | + var slightStressfulImageUrl: String? = nil | ||
| 166 | var stressfulDescription: String | 169 | var stressfulDescription: String |
| 167 | var stressfulImage: FlutterStandardTypedData? = nil | 170 | var stressfulImage: FlutterStandardTypedData? = nil |
| 171 | + var stressfulImageUrl: String? = nil | ||
| 168 | 172 | ||
| 169 | 173 | ||
| 170 | // swift-format-ignore: AlwaysUseLowerCamelCase | 174 | // swift-format-ignore: AlwaysUseLowerCamelCase |
| @@ -173,24 +177,32 @@ struct WatchTransformTheme: Hashable { | @@ -173,24 +177,32 @@ struct WatchTransformTheme: Hashable { | ||
| 173 | let themeName = pigeonVar_list[1] as! String | 177 | let themeName = pigeonVar_list[1] as! String |
| 174 | let energeticDescription = pigeonVar_list[2] as! String | 178 | let energeticDescription = pigeonVar_list[2] as! String |
| 175 | let energeticImage: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[3]) | 179 | let energeticImage: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[3]) |
| 176 | - let normalDescription = pigeonVar_list[4] as! String | ||
| 177 | - let normalImage: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[5]) | ||
| 178 | - let slightStressfulDescription = pigeonVar_list[6] as! String | ||
| 179 | - let slightStressfulImage: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[7]) | ||
| 180 | - let stressfulDescription = pigeonVar_list[8] as! String | ||
| 181 | - let stressfulImage: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[9]) | 180 | + let energeticImageUrl: String? = nilOrValue(pigeonVar_list[4]) |
| 181 | + let normalDescription = pigeonVar_list[5] as! String | ||
| 182 | + let normalImage: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[6]) | ||
| 183 | + let normalImageUrl: String? = nilOrValue(pigeonVar_list[7]) | ||
| 184 | + let slightStressfulDescription = pigeonVar_list[8] as! String | ||
| 185 | + let slightStressfulImage: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[9]) | ||
| 186 | + let slightStressfulImageUrl: String? = nilOrValue(pigeonVar_list[10]) | ||
| 187 | + let stressfulDescription = pigeonVar_list[11] as! String | ||
| 188 | + let stressfulImage: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[12]) | ||
| 189 | + let stressfulImageUrl: String? = nilOrValue(pigeonVar_list[13]) | ||
| 182 | 190 | ||
| 183 | return WatchTransformTheme( | 191 | return WatchTransformTheme( |
| 184 | themeId: themeId, | 192 | themeId: themeId, |
| 185 | themeName: themeName, | 193 | themeName: themeName, |
| 186 | energeticDescription: energeticDescription, | 194 | energeticDescription: energeticDescription, |
| 187 | energeticImage: energeticImage, | 195 | energeticImage: energeticImage, |
| 196 | + energeticImageUrl: energeticImageUrl, | ||
| 188 | normalDescription: normalDescription, | 197 | normalDescription: normalDescription, |
| 189 | normalImage: normalImage, | 198 | normalImage: normalImage, |
| 199 | + normalImageUrl: normalImageUrl, | ||
| 190 | slightStressfulDescription: slightStressfulDescription, | 200 | slightStressfulDescription: slightStressfulDescription, |
| 191 | slightStressfulImage: slightStressfulImage, | 201 | slightStressfulImage: slightStressfulImage, |
| 202 | + slightStressfulImageUrl: slightStressfulImageUrl, | ||
| 192 | stressfulDescription: stressfulDescription, | 203 | stressfulDescription: stressfulDescription, |
| 193 | - stressfulImage: stressfulImage | 204 | + stressfulImage: stressfulImage, |
| 205 | + stressfulImageUrl: stressfulImageUrl | ||
| 194 | ) | 206 | ) |
| 195 | } | 207 | } |
| 196 | func toList() -> [Any?] { | 208 | func toList() -> [Any?] { |
| @@ -199,12 +211,16 @@ struct WatchTransformTheme: Hashable { | @@ -199,12 +211,16 @@ struct WatchTransformTheme: Hashable { | ||
| 199 | themeName, | 211 | themeName, |
| 200 | energeticDescription, | 212 | energeticDescription, |
| 201 | energeticImage, | 213 | energeticImage, |
| 214 | + energeticImageUrl, | ||
| 202 | normalDescription, | 215 | normalDescription, |
| 203 | normalImage, | 216 | normalImage, |
| 217 | + normalImageUrl, | ||
| 204 | slightStressfulDescription, | 218 | slightStressfulDescription, |
| 205 | slightStressfulImage, | 219 | slightStressfulImage, |
| 220 | + slightStressfulImageUrl, | ||
| 206 | stressfulDescription, | 221 | stressfulDescription, |
| 207 | stressfulImage, | 222 | stressfulImage, |
| 223 | + stressfulImageUrl, | ||
| 208 | ] | 224 | ] |
| 209 | } | 225 | } |
| 210 | static func == (lhs: WatchTransformTheme, rhs: WatchTransformTheme) -> Bool { | 226 | static func == (lhs: WatchTransformTheme, rhs: WatchTransformTheme) -> Bool { |
| @@ -14,15 +14,29 @@ class WatchThemeSyncPayloadBuilder { | @@ -14,15 +14,29 @@ class WatchThemeSyncPayloadBuilder { | ||
| 14 | themeName: item.themeName, | 14 | themeName: item.themeName, |
| 15 | energeticDescription: item.energeticDescription, | 15 | energeticDescription: item.energeticDescription, |
| 16 | energeticImage: await _loadImageBytes(item.energeticImage), | 16 | energeticImage: await _loadImageBytes(item.energeticImage), |
| 17 | + energeticImageUrl: _networkImageUrl(item.energeticImage), | ||
| 17 | normalDescription: item.normalDescription, | 18 | normalDescription: item.normalDescription, |
| 18 | normalImage: await _loadImageBytes(item.normalImage), | 19 | normalImage: await _loadImageBytes(item.normalImage), |
| 20 | + normalImageUrl: _networkImageUrl(item.normalImage), | ||
| 19 | slightStressfulDescription: item.slightStressfulDescription, | 21 | slightStressfulDescription: item.slightStressfulDescription, |
| 20 | slightStressfulImage: await _loadImageBytes(item.slightStressfulImage), | 22 | slightStressfulImage: await _loadImageBytes(item.slightStressfulImage), |
| 23 | + slightStressfulImageUrl: _networkImageUrl(item.slightStressfulImage), | ||
| 21 | stressfulDescription: item.stressfulDescription, | 24 | stressfulDescription: item.stressfulDescription, |
| 22 | stressfulImage: await _loadImageBytes(item.stressfulImage), | 25 | stressfulImage: await _loadImageBytes(item.stressfulImage), |
| 26 | + stressfulImageUrl: _networkImageUrl(item.stressfulImage), | ||
| 23 | ); | 27 | ); |
| 24 | } | 28 | } |
| 25 | 29 | ||
| 30 | + String? _networkImageUrl(String? imagePath) { | ||
| 31 | + final value = imagePath?.trim(); | ||
| 32 | + if (value == null || value.isEmpty) return null; | ||
| 33 | + final uri = Uri.tryParse(value); | ||
| 34 | + if (uri == null || (uri.scheme != 'http' && uri.scheme != 'https')) { | ||
| 35 | + return null; | ||
| 36 | + } | ||
| 37 | + return value; | ||
| 38 | + } | ||
| 39 | + | ||
| 26 | Future<Uint8List?> _loadImageBytes(String? imagePath) async { | 40 | Future<Uint8List?> _loadImageBytes(String? imagePath) async { |
| 27 | final value = imagePath?.trim(); | 41 | final value = imagePath?.trim(); |
| 28 | if (value == null || value.isEmpty) return null; | 42 | if (value == null || value.isEmpty) return null; |
| @@ -97,12 +97,16 @@ class WatchTransformTheme { | @@ -97,12 +97,16 @@ class WatchTransformTheme { | ||
| 97 | required this.themeName, | 97 | required this.themeName, |
| 98 | required this.energeticDescription, | 98 | required this.energeticDescription, |
| 99 | this.energeticImage, | 99 | this.energeticImage, |
| 100 | + this.energeticImageUrl, | ||
| 100 | required this.normalDescription, | 101 | required this.normalDescription, |
| 101 | this.normalImage, | 102 | this.normalImage, |
| 103 | + this.normalImageUrl, | ||
| 102 | required this.slightStressfulDescription, | 104 | required this.slightStressfulDescription, |
| 103 | this.slightStressfulImage, | 105 | this.slightStressfulImage, |
| 106 | + this.slightStressfulImageUrl, | ||
| 104 | required this.stressfulDescription, | 107 | required this.stressfulDescription, |
| 105 | this.stressfulImage, | 108 | this.stressfulImage, |
| 109 | + this.stressfulImageUrl, | ||
| 106 | }); | 110 | }); |
| 107 | 111 | ||
| 108 | int themeId; | 112 | int themeId; |
| @@ -113,30 +117,42 @@ class WatchTransformTheme { | @@ -113,30 +117,42 @@ class WatchTransformTheme { | ||
| 113 | 117 | ||
| 114 | Uint8List? energeticImage; | 118 | Uint8List? energeticImage; |
| 115 | 119 | ||
| 120 | + String? energeticImageUrl; | ||
| 121 | + | ||
| 116 | String normalDescription; | 122 | String normalDescription; |
| 117 | 123 | ||
| 118 | Uint8List? normalImage; | 124 | Uint8List? normalImage; |
| 119 | 125 | ||
| 126 | + String? normalImageUrl; | ||
| 127 | + | ||
| 120 | String slightStressfulDescription; | 128 | String slightStressfulDescription; |
| 121 | 129 | ||
| 122 | Uint8List? slightStressfulImage; | 130 | Uint8List? slightStressfulImage; |
| 123 | 131 | ||
| 132 | + String? slightStressfulImageUrl; | ||
| 133 | + | ||
| 124 | String stressfulDescription; | 134 | String stressfulDescription; |
| 125 | 135 | ||
| 126 | Uint8List? stressfulImage; | 136 | Uint8List? stressfulImage; |
| 127 | 137 | ||
| 138 | + String? stressfulImageUrl; | ||
| 139 | + | ||
| 128 | List<Object?> _toList() { | 140 | List<Object?> _toList() { |
| 129 | return <Object?>[ | 141 | return <Object?>[ |
| 130 | themeId, | 142 | themeId, |
| 131 | themeName, | 143 | themeName, |
| 132 | energeticDescription, | 144 | energeticDescription, |
| 133 | energeticImage, | 145 | energeticImage, |
| 146 | + energeticImageUrl, | ||
| 134 | normalDescription, | 147 | normalDescription, |
| 135 | normalImage, | 148 | normalImage, |
| 149 | + normalImageUrl, | ||
| 136 | slightStressfulDescription, | 150 | slightStressfulDescription, |
| 137 | slightStressfulImage, | 151 | slightStressfulImage, |
| 152 | + slightStressfulImageUrl, | ||
| 138 | stressfulDescription, | 153 | stressfulDescription, |
| 139 | stressfulImage, | 154 | stressfulImage, |
| 155 | + stressfulImageUrl, | ||
| 140 | ]; | 156 | ]; |
| 141 | } | 157 | } |
| 142 | 158 | ||
| @@ -150,12 +166,16 @@ class WatchTransformTheme { | @@ -150,12 +166,16 @@ class WatchTransformTheme { | ||
| 150 | themeName: result[1]! as String, | 166 | themeName: result[1]! as String, |
| 151 | energeticDescription: result[2]! as String, | 167 | energeticDescription: result[2]! as String, |
| 152 | energeticImage: result[3] as Uint8List?, | 168 | energeticImage: result[3] as Uint8List?, |
| 153 | - normalDescription: result[4]! as String, | ||
| 154 | - normalImage: result[5] as Uint8List?, | ||
| 155 | - slightStressfulDescription: result[6]! as String, | ||
| 156 | - slightStressfulImage: result[7] as Uint8List?, | ||
| 157 | - stressfulDescription: result[8]! as String, | ||
| 158 | - stressfulImage: result[9] as Uint8List?, | 169 | + energeticImageUrl: result[4] as String?, |
| 170 | + normalDescription: result[5]! as String, | ||
| 171 | + normalImage: result[6] as Uint8List?, | ||
| 172 | + normalImageUrl: result[7] as String?, | ||
| 173 | + slightStressfulDescription: result[8]! as String, | ||
| 174 | + slightStressfulImage: result[9] as Uint8List?, | ||
| 175 | + slightStressfulImageUrl: result[10] as String?, | ||
| 176 | + stressfulDescription: result[11]! as String, | ||
| 177 | + stressfulImage: result[12] as Uint8List?, | ||
| 178 | + stressfulImageUrl: result[13] as String?, | ||
| 159 | ); | 179 | ); |
| 160 | } | 180 | } |
| 161 | 181 |
| @@ -28,18 +28,26 @@ class WatchTransformTheme { | @@ -28,18 +28,26 @@ class WatchTransformTheme { | ||
| 28 | this.slightStressfulImage, | 28 | this.slightStressfulImage, |
| 29 | required this.stressfulDescription, | 29 | required this.stressfulDescription, |
| 30 | this.stressfulImage, | 30 | this.stressfulImage, |
| 31 | + this.energeticImageUrl, | ||
| 32 | + this.normalImageUrl, | ||
| 33 | + this.slightStressfulImageUrl, | ||
| 34 | + this.stressfulImageUrl, | ||
| 31 | }); | 35 | }); |
| 32 | 36 | ||
| 33 | int themeId; | 37 | int themeId; |
| 34 | final String themeName; | 38 | final String themeName; |
| 35 | final String energeticDescription; | 39 | final String energeticDescription; |
| 36 | final Uint8List? energeticImage; | 40 | final Uint8List? energeticImage; |
| 41 | + final String? energeticImageUrl; | ||
| 37 | final String normalDescription; | 42 | final String normalDescription; |
| 38 | final Uint8List? normalImage; | 43 | final Uint8List? normalImage; |
| 44 | + final String? normalImageUrl; | ||
| 39 | final String slightStressfulDescription; | 45 | final String slightStressfulDescription; |
| 40 | final Uint8List? slightStressfulImage; | 46 | final Uint8List? slightStressfulImage; |
| 47 | + final String? slightStressfulImageUrl; | ||
| 41 | final String stressfulDescription; | 48 | final String stressfulDescription; |
| 42 | final Uint8List? stressfulImage; | 49 | final Uint8List? stressfulImage; |
| 50 | + final String? stressfulImageUrl; | ||
| 43 | } | 51 | } |
| 44 | 52 | ||
| 45 | @ConfigurePigeon( | 53 | @ConfigurePigeon( |
| @@ -73,7 +81,7 @@ abstract class WearEngineHostApi { | @@ -73,7 +81,7 @@ abstract class WearEngineHostApi { | ||
| 73 | @async | 81 | @async |
| 74 | bool addWatchSurface(); | 82 | bool addWatchSurface(); |
| 75 | 83 | ||
| 76 | -/// 添加或者删除主题 | 84 | + /// 添加或者删除主题 |
| 77 | @async | 85 | @async |
| 78 | bool syncWatchTheme(WatchTransformTheme? theme); | 86 | bool syncWatchTheme(WatchTransformTheme? theme); |
| 79 | 87 |
-
Please register or login to post a comment