Skip to content

Commit 171e608

Browse files
committedMar 21, 2023
VersionMigrations: add migration steps for v5.8.0
1 parent 6dc921c commit 171e608

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
 

‎SimpleWeather.Common/Migrations/VersionMigrations.cs

+30
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,36 @@ internal static async Task PerformVersionMigrations(SQLiteAsyncConnection weathe
143143
}
144144
}
145145
}
146+
// v5.8.0
147+
// Clear image cache due to file path change
148+
// Windows: unregister all bg tasks
149+
if (SettingsMgr.VersionCode < 5801)
150+
{
151+
var ImageDataContainer = new Preferences.SettingsContainer("images");
152+
ImageDataContainer.Clear();
153+
154+
#if WINDOWS || WINUI
155+
try
156+
{
157+
var tasks = Windows.ApplicationModel.Background.BackgroundTaskRegistration.AllTasks;
158+
159+
foreach (var task in tasks)
160+
{
161+
try
162+
{
163+
task.Value.Unregister(true);
164+
165+
AnalyticsLogger.LogEvent("BGTasks: unregistered task", new Dictionary<string, string>()
166+
{
167+
{ "task", task.Value.Name },
168+
});
169+
}
170+
catch { }
171+
}
172+
}
173+
catch { }
174+
#endif
175+
}
146176
#if !UNIT_TEST
147177
if (SettingsMgr.VersionCode < CurrentVersionCode)
148178
{

0 commit comments

Comments
 (0)
Please sign in to comment.