Commit 23e3ab2d170ce818bce91c801578f625da9fc9f2

Authored by 权海
1 parent 6810f127

feat(ui):先应用主题, 后向watch传输

@@ -227,25 +227,20 @@ class CustomWatchThemePreviewController extends GetxController { @@ -227,25 +227,20 @@ class CustomWatchThemePreviewController extends GetxController {
227 } 227 }
228 } 228 }
229 229
230 - var syncSuccess = true; 230 + var syncSuccess = false;
231 try { 231 try {
232 - final success = await WearEngineHostApi().syncWatchTheme(downloadedTheme);  
233 - if (success) {  
234 final result = await _themeApi.applyTheme(themeId); 232 final result = await _themeApi.applyTheme(themeId);
235 if (result is! AppSuccess<void>) { 233 if (result is! AppSuccess<void>) {
  234 + syncSuccess = await WearEngineHostApi().syncWatchTheme(downloadedTheme);
236 isApplying.value = false; 235 isApplying.value = false;
237 AppToast.show(l10n.watchThemeApplyFailed); 236 AppToast.show(l10n.watchThemeApplyFailed);
238 return false; 237 return false;
239 - }  
240 - syncSuccess = success; 238 + }
241 selectedThemeItem.value = themeItem; 239 selectedThemeItem.value = themeItem;
242 isApplying.value = false; 240 isApplying.value = false;
243 - return true;  
244 - }  
245 - syncSuccess = success; 241 + return true;
246 } catch (_) { 242 } catch (_) {
247 // The active theme is already saved on the server. 243 // The active theme is already saved on the server.
248 - syncSuccess = false;  
249 } 244 }
250 isApplying.value = false; 245 isApplying.value = false;
251 if (!syncSuccess) { 246 if (!syncSuccess) {
@@ -198,22 +198,18 @@ class WatchThemePreviewController extends GetxController { @@ -198,22 +198,18 @@ class WatchThemePreviewController extends GetxController {
198 } 198 }
199 } 199 }
200 200
201 - var syncSuccess = true; 201 + var syncSuccess = false;
202 try { 202 try {
203 - final success = await WearEngineHostApi().syncWatchTheme(downloadedTheme);  
204 - if (success) {  
205 final result = await _themeApi.applyTheme(themeId); 203 final result = await _themeApi.applyTheme(themeId);
206 if (result is! AppSuccess<void>) { 204 if (result is! AppSuccess<void>) {
  205 + syncSuccess = await WearEngineHostApi().syncWatchTheme(downloadedTheme);
207 isApplying.value = false; 206 isApplying.value = false;
208 AppToast.show(l10n.watchThemeApplyFailed); 207 AppToast.show(l10n.watchThemeApplyFailed);
209 return false; 208 return false;
210 - }  
211 - syncSuccess = success; 209 + }
212 selectedThemeItem.value = themeItem; 210 selectedThemeItem.value = themeItem;
213 isApplying.value = false; 211 isApplying.value = false;
214 - return true;  
215 - }  
216 - syncSuccess = success; 212 + return true;
217 } catch (_) { 213 } catch (_) {
218 // The active theme is already saved on the server. 214 // The active theme is already saved on the server.
219 syncSuccess = false; 215 syncSuccess = false;