mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-19 11:43:24 +01:00
- Fix: Anisette-server-fallback: Try currently selected server first
This commit is contained in:
@@ -69,7 +69,15 @@ final class FetchAnisetteDataOperation: ResultOperation<ALTAnisetteData>, WebSoc
|
|||||||
|
|
||||||
|
|
||||||
func getAnisetteServerUrl(completion: @escaping (String?, Error?) -> Void) {
|
func getAnisetteServerUrl(completion: @escaping (String?, Error?) -> Void) {
|
||||||
let serverUrls = UserDefaults.standard.menuAnisetteServersList
|
var serverUrls = UserDefaults.standard.menuAnisetteServersList
|
||||||
|
let currentServer = UserDefaults.standard.menuAnisetteURL
|
||||||
|
|
||||||
|
// Prioritize the current server by moving it to the top of the list
|
||||||
|
if let currentServerIndex = serverUrls.firstIndex(of: currentServer) {
|
||||||
|
serverUrls.remove(at: currentServerIndex)
|
||||||
|
serverUrls.insert(currentServer, at: 0)
|
||||||
|
}
|
||||||
|
|
||||||
tryNextServer(from: serverUrls, currentIndex: 0, completion: completion)
|
tryNextServer(from: serverUrls, currentIndex: 0, completion: completion)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user