Skip to content

Commit d21d38c

Browse files
committed
优化 更新检测
1 parent be49277 commit d21d38c

File tree

55 files changed

+17
-9
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+17
-9
lines changed

Core.Window/ApplicationService.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public bool ChangeAutoStart(bool autoStart)
142142
return true;
143143
}
144144

145-
public async Task CheckUpdate()
145+
public async Task CheckUpdate(bool toastIfNoUpdate)
146146
{
147147
var gitHubUpdateService = ServiceManager.Services.GetService<GitHubUpdateService>();
148148
var (hasUpdate, latestVersion, downloadUrl, releaseNotes) = await gitHubUpdateService!.CheckForUpdatesAsync();
@@ -214,8 +214,12 @@ public async Task CheckUpdate()
214214
}
215215
else
216216
{
217-
var toastService = ServiceManager.Services.GetService<IToastService>();
218-
toastService.Show("更新", "无更新", NotificationType.Information);
217+
if (toastIfNoUpdate)
218+
{
219+
var toastService = ServiceManager.Services.GetService<IToastService>()!;
220+
toastService.Show("更新", "无更新", NotificationType.Information);
221+
}
222+
219223
}
220224
}
221225
}

Core/Services/Config/KitopiaConfig.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public class KitopiaConfig : ConfigBase
150150
[ConfigField("检查更新", "立即检查更新", 0xE974, ConfigFieldType.按钮,actionName: "检查更新")]
151151
public async Task CheckUpdate()
152152
{
153-
await ServiceManager.Services.GetService<IApplicationService>()!.CheckUpdate();
153+
await ServiceManager.Services.GetService<IApplicationService>()!.CheckUpdate(true);
154154
}
155155

156156
public override void BeforeLoad()

Core/Services/Interfaces/IApplicationService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ public interface IApplicationService
77
public bool ChangeAutoStart(bool autoStart);
88
public void Restart();
99
public void Stop();
10-
public Task CheckUpdate();
10+
public Task CheckUpdate(bool toastIfNoUpdate);
1111
}
13 KB
17.5 KB
22.3 KB
31.6 KB
75.7 KB
2.85 KB
4.12 KB

0 commit comments

Comments
 (0)