Showing
1 changed file
with
12 additions
and
12 deletions
| @@ -190,27 +190,27 @@ class WatchThemePreviewController extends GetxController { | @@ -190,27 +190,27 @@ class WatchThemePreviewController extends GetxController { | ||
| 190 | } | 190 | } |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | - var syncSuccess = false; | ||
| 194 | try { | 193 | try { |
| 195 | final result = await _themeApi.applyTheme(themeId); | 194 | final result = await _themeApi.applyTheme(themeId); |
| 196 | if (result is! AppSuccess<void>) { | 195 | if (result is! AppSuccess<void>) { |
| 197 | - syncSuccess = | ||
| 198 | - await AppWearEngineHostApi().syncWatchTheme(downloadedTheme); | ||
| 199 | - isApplying.value = false; | ||
| 200 | AppToast.show(l10n.watchThemeApplyFailed); | 196 | AppToast.show(l10n.watchThemeApplyFailed); |
| 201 | return false; | 197 | return false; |
| 202 | } | 198 | } |
| 199 | + | ||
| 200 | + final syncSuccess = | ||
| 201 | + await WearEngineHostApi().syncWatchTheme(downloadedTheme); | ||
| 202 | + if (!syncSuccess) { | ||
| 203 | + AppToast.show(l10n.watchThemeWatchSyncFailed); | ||
| 204 | + return false; | ||
| 205 | + } | ||
| 206 | + | ||
| 203 | selectedThemeItem.value = themeItem; | 207 | selectedThemeItem.value = themeItem; |
| 204 | - isApplying.value = false; | ||
| 205 | return true; | 208 | return true; |
| 206 | } catch (_) { | 209 | } catch (_) { |
| 207 | - // The active theme is already saved on the server. | ||
| 208 | - syncSuccess = false; | ||
| 209 | - } | ||
| 210 | - isApplying.value = false; | ||
| 211 | - if (!syncSuccess) { | ||
| 212 | - AppToast.show(l10n.watchThemeWatchSyncFailed); | 210 | + AppToast.show(l10n.watchThemeApplyFailed); |
| 211 | + return false; | ||
| 212 | + } finally { | ||
| 213 | + isApplying.value = false; | ||
| 213 | } | 214 | } |
| 214 | - return syncSuccess; | ||
| 215 | } | 215 | } |
| 216 | } | 216 | } |
-
Please register or login to post a comment