Skip to content

Commit

Permalink
Merge branch 'dev' into fix-apple-dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
tisfeng authored Oct 23, 2024
2 parents 65d85d0 + f79813c commit 20d36e0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
11 changes: 9 additions & 2 deletions Easydict/Swift/Utility/GlobalContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,26 @@ import Sparkle
class GlobalContext: NSObject {
// MARK: Lifecycle

override init() {
private override init() {
self.updaterHelper = SPUUpdaterHelper()
self.userDriverHelper = SPUUserDriverHelper()
self.updaterController = SPUStandardUpdaterController(
startingUpdater: true,
updaterDelegate: updaterHelper,
userDriverDelegate: userDriverHelper
)

super.init()

reloadLLMServicesSubscribers()
}

// MARK: Internal

class SPUUpdaterHelper: NSObject, SPUUpdaterDelegate {
func feedURLString(for _: SPUUpdater) -> String? {
var feedURLString = "https://raw.githubusercontent.com/tisfeng/Easydict/main/appcast.xml"
var feedURLString =
"https://raw.githubusercontent.com/tisfeng/Easydict/main/appcast.xml"
#if DEBUG
feedURLString = "http://localhost:8000/appcast.xml"
#endif
Expand All @@ -47,6 +52,8 @@ class GlobalContext: NSObject {

// refresh subscribed services after duplicate service
func reloadLLMServicesSubscribers() {
logInfo("reloadLLMServicesSubscribers")

for service in services {
if let llmService = service as? LLMStreamService {
llmService.cancelSubscribers()
Expand Down
3 changes: 0 additions & 3 deletions Easydict/Swift/View/SettingView/Tabs/TabView/ServiceTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ struct ServiceTab: View {
}
.layoutPriority(1)
}
.onAppear {
GlobalContext.shared.reloadLLMServicesSubscribers()
}
.environmentObject(viewModel)
}

Expand Down

0 comments on commit 20d36e0

Please sign in to comment.