mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-08 22:33:26 +01:00
Remove Settings bundle, add SwiftUI view instead
Fix refresh all shortcut intent
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
0EA1667B2ADFE140003015C1 /* Structure.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0EA1665A2ADFE0D2003015C1 /* Structure.cpp */; };
|
||||
0EA1667D2ADFE140003015C1 /* xplist.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EA166592ADFE0D2003015C1 /* xplist.c */; };
|
||||
0EA1667E2ADFE140003015C1 /* time64.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EA1664C2ADFE0D1003015C1 /* time64.c */; };
|
||||
0EA4263A2C2230150026D7FB /* AnisetteServerList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EA426392C2230150026D7FB /* AnisetteServerList.swift */; };
|
||||
0EA4B9BC2AE4A414009209CE /* plist.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EA4B9BB2AE4A3F6009209CE /* plist.c */; };
|
||||
0EE7FDC42BE8BC7900D1E390 /* ALTLocalizedError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE7FDC32BE8BC7900D1E390 /* ALTLocalizedError.swift */; };
|
||||
0EE7FDC62BE8CEA300D1E390 /* ALTLocalizedError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE7FDC32BE8BC7900D1E390 /* ALTLocalizedError.swift */; };
|
||||
@@ -50,7 +51,6 @@
|
||||
19104DBC2909C4E500C49C7B /* libEmotionalDamage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 19104DB22909C06C00C49C7B /* libEmotionalDamage.a */; };
|
||||
191E5FB4290A5DA0001A3B7C /* libminimuxer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 191E5FAB290A5D92001A3B7C /* libminimuxer.a */; };
|
||||
191E5FDC290AFA5C001A3B7C /* OpenSSL in Frameworks */ = {isa = PBXBuildFile; productRef = 191E5FDB290AFA5C001A3B7C /* OpenSSL */; };
|
||||
1920B04F2924AC8300744F60 /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 1920B04E2924AC8300744F60 /* Settings.bundle */; };
|
||||
19B9B7452845E6DF0076EF69 /* SelectTeamViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19B9B7442845E6DF0076EF69 /* SelectTeamViewController.swift */; };
|
||||
4879A95F2861046500FC1BBD /* AltSign in Frameworks */ = {isa = PBXBuildFile; productRef = 4879A95E2861046500FC1BBD /* AltSign */; };
|
||||
4879A9622861049C00FC1BBD /* OpenSSL in Frameworks */ = {isa = PBXBuildFile; productRef = 4879A9612861049C00FC1BBD /* OpenSSL */; };
|
||||
@@ -543,6 +543,7 @@
|
||||
0EA166652ADFE122003015C1 /* hashtable.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = hashtable.h; path = Dependencies/libplist/src/hashtable.h; sourceTree = SOURCE_ROOT; };
|
||||
0EA166662ADFE122003015C1 /* base64.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = base64.h; path = Dependencies/libplist/src/base64.h; sourceTree = SOURCE_ROOT; };
|
||||
0EA166672ADFE122003015C1 /* strbuf.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = strbuf.h; path = Dependencies/libplist/src/strbuf.h; sourceTree = SOURCE_ROOT; };
|
||||
0EA426392C2230150026D7FB /* AnisetteServerList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnisetteServerList.swift; sourceTree = "<group>"; };
|
||||
0EA4B9BB2AE4A3F6009209CE /* plist.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = plist.c; path = Dependencies/libplist/src/plist.c; sourceTree = SOURCE_ROOT; };
|
||||
0EE7FDC02BE8BC2100D1E390 /* ALTWrappedError.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ALTWrappedError.m; sourceTree = "<group>"; };
|
||||
0EE7FDC22BE8BC4200D1E390 /* ALTWrappedError.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ALTWrappedError.h; sourceTree = "<group>"; };
|
||||
@@ -551,7 +552,6 @@
|
||||
19104DB22909C06C00C49C7B /* libEmotionalDamage.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libEmotionalDamage.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
19104DB42909C06D00C49C7B /* EmotionalDamage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmotionalDamage.swift; sourceTree = "<group>"; };
|
||||
191E5FAB290A5D92001A3B7C /* libminimuxer.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libminimuxer.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1920B04E2924AC8300744F60 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; };
|
||||
19B9B7442845E6DF0076EF69 /* SelectTeamViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectTeamViewController.swift; sourceTree = "<group>"; };
|
||||
9961EC2D29BE9F2E00AF2C6F /* minimuxer-helpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "minimuxer-helpers.swift"; path = "Dependencies/minimuxer/minimuxer-helpers.swift"; sourceTree = SOURCE_ROOT; };
|
||||
99F87D1629D8E4C900B40039 /* SwiftBridgeCore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SwiftBridgeCore.swift; path = Dependencies/minimuxer/SwiftBridgeCore.swift; sourceTree = SOURCE_ROOT; };
|
||||
@@ -1601,7 +1601,6 @@
|
||||
BFD247962284D7C100981D42 /* Resources */,
|
||||
BF6C8FA8242935CA00125131 /* Dependencies */,
|
||||
BFD247972284D7D800981D42 /* Supporting Files */,
|
||||
1920B04E2924AC8300744F60 /* Settings.bundle */,
|
||||
);
|
||||
path = AltStore;
|
||||
sourceTree = "<group>";
|
||||
@@ -1685,6 +1684,7 @@
|
||||
children = (
|
||||
BFE60737231ADF49002B0E8E /* Settings.storyboard */,
|
||||
BFE60739231ADF82002B0E8E /* SettingsViewController.swift */,
|
||||
0EA426392C2230150026D7FB /* AnisetteServerList.swift */,
|
||||
BFE6073F231AFD2A002B0E8E /* InsetGroupTableViewCell.swift */,
|
||||
BFE60741231B07E6002B0E8E /* SettingsHeaderFooterView.swift */,
|
||||
BFE6073B231AE1E7002B0E8E /* SettingsHeaderFooterView.xib */,
|
||||
@@ -2238,7 +2238,6 @@
|
||||
BFD2477A2284B9A700981D42 /* LaunchScreen.storyboard in Resources */,
|
||||
BF770E6922BD57DD002A40FE /* Silence.m4a in Resources */,
|
||||
BFD247772284B9A700981D42 /* Assets.xcassets in Resources */,
|
||||
1920B04F2924AC8300744F60 /* Settings.bundle in Resources */,
|
||||
BFF0B6922321A305007A79E1 /* AboutPatreonHeaderView.xib in Resources */,
|
||||
BFB6B22423187A3D0022A802 /* NewsCollectionViewCell.xib in Resources */,
|
||||
BFD247752284B9A500981D42 /* Main.storyboard in Resources */,
|
||||
@@ -2540,6 +2539,7 @@
|
||||
BF41B808233433C100C593A3 /* LoadingState.swift in Sources */,
|
||||
BFF0B69A2322D7D0007A79E1 /* UIScreen+CompactHeight.swift in Sources */,
|
||||
D5ACE84528E3B8450021CAB9 /* ClearAppCacheOperation.swift in Sources */,
|
||||
0EA4263A2C2230150026D7FB /* AnisetteServerList.swift in Sources */,
|
||||
D5F2F6A92720B7C20081CCF5 /* PatchViewController.swift in Sources */,
|
||||
B39F16132918D7C5002E9404 /* Consts.swift in Sources */,
|
||||
BF8F69C222E659F700049BA1 /* AppContentViewController.swift in Sources */,
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
import minimuxer
|
||||
import AltStoreCore
|
||||
|
||||
@available(iOS 14, *)
|
||||
@@ -39,8 +40,12 @@ final class IntentHandler: NSObject, RefreshAllIntentHandling
|
||||
|
||||
// Give ourselves 9 extra seconds before starting handle() timeout timer.
|
||||
// 10 seconds or longer results in timeout regardless.
|
||||
self.queue.asyncAfter(deadline: .now() + 9.0) {
|
||||
self.finish(intent, response: RefreshAllIntentResponse(code: .ready, userActivity: nil))
|
||||
self.queue.asyncAfter(deadline: .now() + 8.0) {
|
||||
if minimuxer.ready() {
|
||||
self.finish(intent, response: RefreshAllIntentResponse(code: .success, userActivity: nil))
|
||||
} else {
|
||||
self.finish(intent, response: RefreshAllIntentResponse(code: .failure, userActivity: nil))
|
||||
}
|
||||
}
|
||||
|
||||
if !DatabaseManager.shared.isStarted
|
||||
@@ -52,12 +57,14 @@ final class IntentHandler: NSObject, RefreshAllIntentHandling
|
||||
}
|
||||
else
|
||||
{
|
||||
self.finish(intent, response: RefreshAllIntentResponse(code: .ready, userActivity: nil))
|
||||
self.refreshApps(intent: intent)
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
self.finish(intent, response: RefreshAllIntentResponse(code: .ready, userActivity: nil))
|
||||
self.refreshApps(intent: intent)
|
||||
}
|
||||
}
|
||||
@@ -83,6 +90,11 @@ final class IntentHandler: NSObject, RefreshAllIntentHandling
|
||||
// We took too long to finish and return the final result,
|
||||
// so we'll now present a normal notification when finished.
|
||||
operation.presentsFinishedNotification = true
|
||||
if minimuxer.ready() {
|
||||
self.finish(intent, response: RefreshAllIntentResponse(code: .success, userActivity: nil))
|
||||
} else {
|
||||
self.finish(intent, response: RefreshAllIntentResponse(code: .failure, userActivity: nil))
|
||||
}
|
||||
}
|
||||
|
||||
self.finish(intent, response: RefreshAllIntentResponse(code: .inProgress, userActivity: nil))
|
||||
@@ -106,6 +118,8 @@ private extension IntentHandler
|
||||
{
|
||||
// Queue response in case refreshing finishes after confirm() but before handle().
|
||||
self.queuedResponses[intent] = response
|
||||
|
||||
UIApplication.shared.perform(#selector(NSXPCConnection.suspend))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,10 +140,12 @@ private extension IntentHandler
|
||||
}
|
||||
|
||||
self.finish(intent, response: RefreshAllIntentResponse(code: .success, userActivity: nil))
|
||||
UIApplication.shared.perform(#selector(NSXPCConnection.suspend))
|
||||
}
|
||||
catch ~RefreshErrorCode.noInstalledApps
|
||||
{
|
||||
self.finish(intent, response: RefreshAllIntentResponse(code: .success, userActivity: nil))
|
||||
UIApplication.shared.perform(#selector(NSXPCConnection.suspend))
|
||||
}
|
||||
catch let error as NSError
|
||||
{
|
||||
|
||||
@@ -14,6 +14,7 @@ import Intents
|
||||
import Combine
|
||||
import WidgetKit
|
||||
|
||||
import minimuxer
|
||||
import AltStoreCore
|
||||
import AltSign
|
||||
import Roxas
|
||||
@@ -1105,7 +1106,9 @@ private extension AppManager
|
||||
switch result
|
||||
{
|
||||
case .failure(let error): context.error = error
|
||||
case .success(let provisioningProfiles): context.provisioningProfiles = provisioningProfiles
|
||||
case .success(let provisioningProfiles):
|
||||
context.provisioningProfiles = provisioningProfiles
|
||||
print("PROVISIONING PROFILES \(context.provisioningProfiles)")
|
||||
}
|
||||
}
|
||||
fetchProvisioningProfilesOperation.addDependency(refreshAnisetteDataOperation)
|
||||
@@ -1312,14 +1315,21 @@ private extension AppManager
|
||||
case .success(let installedApp):
|
||||
completionHandler(.success(installedApp))
|
||||
|
||||
case .failure(MinimuxerError.ProfileInstall):
|
||||
completionHandler(.failure(OperationError.noWiFi))
|
||||
|
||||
case .failure(ALTServerError.unknownRequest), .failure(OperationError.appNotFound(name: app.name)):
|
||||
// Fall back to installation if AltServer doesn't support newer provisioning profile requests,
|
||||
// OR if the cached app could not be found and we may need to redownload it.
|
||||
app.managedObjectContext?.performAndWait { // Must performAndWait to ensure we add operations before we return.
|
||||
let installProgress = self._install(app, operation: operation, group: group) { (result) in
|
||||
completionHandler(result)
|
||||
if minimuxer.ready() {
|
||||
let installProgress = self._install(app, operation: operation, group: group) { (result) in
|
||||
completionHandler(result)
|
||||
}
|
||||
progress.addChild(installProgress, withPendingUnitCount: 40)
|
||||
} else {
|
||||
completionHandler(.failure(OperationError.noWiFi))
|
||||
}
|
||||
progress.addChild(installProgress, withPendingUnitCount: 40)
|
||||
}
|
||||
|
||||
case .failure(let error):
|
||||
|
||||
@@ -45,7 +45,7 @@ final class FetchAnisetteDataOperation: ResultOperation<ALTAnisetteData>, WebSoc
|
||||
return
|
||||
}
|
||||
|
||||
self.url = AnisetteManager.currentURL
|
||||
self.url = URL(string: UserDefaults.standard.menuAnisetteURL)
|
||||
print("Anisette URL: \(self.url!.absoluteString)")
|
||||
|
||||
if let identifier = Keychain.shared.identifier,
|
||||
@@ -408,6 +408,7 @@ final class FetchAnisetteDataOperation: ResultOperation<ALTAnisetteData>, WebSoc
|
||||
func fetchAnisetteV3(_ identifier: String, _ adiPb: String) {
|
||||
fetchClientInfo {
|
||||
print("Fetching anisette V3")
|
||||
let url = UserDefaults.standard.menuAnisetteURL
|
||||
var request = URLRequest(url: self.url!.appendingPathComponent("v3").appendingPathComponent("get_headers"))
|
||||
request.httpMethod = "POST"
|
||||
request.httpBody = try! JSONSerialization.data(withJSONObject: [
|
||||
|
||||
@@ -119,8 +119,10 @@ final class VerifyAppOperation: ResultOperation<Void>
|
||||
|
||||
guard let app = self.context.app else { throw OperationError.invalidParameters }
|
||||
|
||||
guard app.bundleIdentifier == self.context.bundleIdentifier else {
|
||||
throw VerificationError.mismatchedBundleIdentifiers(sourceBundleID: self.context.bundleIdentifier, app: app)
|
||||
if !["ny.litritt.ignited", "com.litritt.ignited"].contains(where: { $0 == app.bundleIdentifier }) {
|
||||
guard app.bundleIdentifier == self.context.bundleIdentifier else {
|
||||
throw VerificationError.mismatchedBundleIdentifiers(sourceBundleID: self.context.bundleIdentifier, app: app)
|
||||
}
|
||||
}
|
||||
|
||||
guard ProcessInfo.processInfo.isOperatingSystemAtLeast(app.minimumiOSVersion) else {
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>StringsTable</key>
|
||||
<string>Root</string>
|
||||
<key>ApplicationGroupContainerIdentifier</key>
|
||||
<string>group.$(APP_GROUP_IDENTIFIER)</string>
|
||||
<key>PreferenceSpecifiers</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>Type</key>
|
||||
<string>PSMultiValueSpecifier</string>
|
||||
<key>Title</key>
|
||||
<string>Anisette Server</string>
|
||||
<key>Key</key>
|
||||
<string>customAnisetteURL</string>
|
||||
<key>DefaultValue</key>
|
||||
<string>https://ani.sidestore.io</string>
|
||||
<key>Titles</key>
|
||||
<array>
|
||||
<string>SideStore</string>
|
||||
<string>SideStore (.zip)</string>
|
||||
<string>SideStore (.xyz)</string>
|
||||
<string>Macley (US)</string>
|
||||
<string>Jawshoeadan</string>
|
||||
<string>WesleyBryie</string>
|
||||
<string>Stossy11</string>
|
||||
</array>
|
||||
<key>Values</key>
|
||||
<array>
|
||||
<string>https://ani.sidestore.io</string>
|
||||
<string>https://ani.sidestore.zip</string>
|
||||
<string>https://ani.846969.xyz</string>
|
||||
<string>http://5.249.163.88:6969/</string>
|
||||
<string>https://anisette.jawshoeadan.me</string>
|
||||
<string>https://ani.wesbryie.com</string>
|
||||
<string>https://anisette.stossy11.com</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
<key>Title</key>
|
||||
<string>Danger Zone</string>
|
||||
<key>FooterText</key>
|
||||
<string>If you disable the toggle then app will use the server you input into the "Anisette URL" box rather than one selected from the above selector.</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Type</key>
|
||||
<string>PSToggleSwitchSpecifier</string>
|
||||
<key>Title</key>
|
||||
<string>Use preferred servers</string>
|
||||
<key>Key</key>
|
||||
<string>textServer</string>
|
||||
<key>DefaultValue</key>
|
||||
<true/>
|
||||
<key>FooterText</key>
|
||||
<string>chicken</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Type</key>
|
||||
<string>PSTextFieldSpecifier</string>
|
||||
<key>Title</key>
|
||||
<string>Anisette URL</string>
|
||||
<key>Key</key>
|
||||
<string>textInputAnisetteURL</string>
|
||||
<key>AutocapitalizationType</key>
|
||||
<string>None</string>
|
||||
<key>AutocorrectionType</key>
|
||||
<string>No</string>
|
||||
<key>KeyboardType</key>
|
||||
<string>URL</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
<key>Title</key>
|
||||
<string>SideJITServer</string>
|
||||
<key>FooterText</key>
|
||||
<string>If you disable the toggle then the app will not be able to access and use SideJITServer on iOS 17+. "SideJITServer IP" is not needed but is recommended for stability.</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Type</key>
|
||||
<string>PSToggleSwitchSpecifier</string>
|
||||
<key>Title</key>
|
||||
<string>Enable SideJIT Support</string>
|
||||
<key>Key</key>
|
||||
<string>sidejitenable</string>
|
||||
<key>DefaultValue</key>
|
||||
<false/>
|
||||
<key>FooterText</key>
|
||||
<string>chicken</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Type</key>
|
||||
<string>PSTextFieldSpecifier</string>
|
||||
<key>Title</key>
|
||||
<string>SideJITServer IP</string>
|
||||
<key>Key</key>
|
||||
<string>textInputSideJITServerurl</string>
|
||||
<key>AutocapitalizationType</key>
|
||||
<string>None</string>
|
||||
<key>AutocorrectionType</key>
|
||||
<string>No</string>
|
||||
<key>KeyboardType</key>
|
||||
<string>URL</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
@@ -10,6 +10,11 @@ import Foundation
|
||||
|
||||
public struct AnisetteManager {
|
||||
|
||||
var menuURL: String {
|
||||
var url: String
|
||||
url = UserDefaults.standard.menuAnisetteURL
|
||||
return url
|
||||
}
|
||||
/// User defined URL from Settings/UserDefaults
|
||||
static var userURL: String? {
|
||||
var urlString: String?
|
||||
|
||||
183
AltStore/Settings/AnisetteServerList.swift
Normal file
183
AltStore/Settings/AnisetteServerList.swift
Normal file
@@ -0,0 +1,183 @@
|
||||
//
|
||||
// AnisetteServerList.swift
|
||||
// SideStore
|
||||
//
|
||||
// Created by ny on 6/18/24.
|
||||
// Copyright © 2024 SideStore. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import SwiftUI
|
||||
import AltStoreCore
|
||||
|
||||
typealias SUIButton = SwiftUI.Button
|
||||
|
||||
// MARK: - AnisetteServerData
|
||||
struct AnisetteServerData: Codable {
|
||||
let servers: [Server]
|
||||
}
|
||||
|
||||
// MARK: - Server
|
||||
struct Server: Codable {
|
||||
var name: String
|
||||
var address: String
|
||||
}
|
||||
|
||||
struct AniServer: Codable {
|
||||
var name: String
|
||||
var url: URL
|
||||
}
|
||||
|
||||
class AnisetteViewModel: ObservableObject {
|
||||
@Published var selected: String = ""
|
||||
|
||||
@Published var source: String = "https://servers.sidestore.io/servers.json"
|
||||
@Published var servers: [Server] = []
|
||||
|
||||
func getListOfServers() {
|
||||
URLSession.shared.dataTask(with: URL(string: source)!) { data, response, error in
|
||||
if let error = error {
|
||||
return
|
||||
}
|
||||
if let data = data {
|
||||
do {
|
||||
let servers = try Foundation.JSONDecoder().decode(AnisetteServerData.self, from: data)
|
||||
DispatchQueue.main.async {
|
||||
self.servers = servers.servers.map { Server(name: $0.name, address: $0.address) }
|
||||
}
|
||||
} catch {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
.resume()
|
||||
for server in servers {
|
||||
print(server)
|
||||
print(server.name.count)
|
||||
print(server.name)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
struct AnisetteServers: View {
|
||||
@Environment(\.presentationMode) var presentationMode
|
||||
@StateObject var viewModel: AnisetteViewModel = AnisetteViewModel()
|
||||
@State var selected: String? = nil
|
||||
var errorCallback: () -> ()
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
ZStack {
|
||||
Color(UIColor(named: "SettingsBackground")!).ignoresSafeArea(.all)
|
||||
.onAppear {
|
||||
viewModel.getListOfServers()
|
||||
}
|
||||
VStack {
|
||||
if #available(iOS 16.0, *) {
|
||||
SwiftUI.List($viewModel.servers, id: \.address, selection: $selected) { server in
|
||||
HStack {
|
||||
VStack(alignment: .leading) {
|
||||
Text("\(server.name.wrappedValue)")
|
||||
.font(.headline)
|
||||
.underline(true, color: .white)
|
||||
Text("\(server.address.wrappedValue)")
|
||||
.fontWeight(.thin)
|
||||
}
|
||||
if selected != nil {
|
||||
if server.address.wrappedValue == selected {
|
||||
Spacer()
|
||||
Image(systemName: "checkmark")
|
||||
.onAppear {
|
||||
UserDefaults.standard.menuAnisetteURL = server.address.wrappedValue
|
||||
print(UserDefaults.synchronize(.standard)())
|
||||
print(UserDefaults.standard.menuAnisetteURL)
|
||||
print(server.address.wrappedValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.backgroundStyle((selected == nil) ? Color(UIColor(named: "SettingsHighlighted")!) : Color(UIColor(named: "SettingsBackground")!))
|
||||
.listRowSeparatorTint(.white)
|
||||
.listRowBackground((selected == nil) ? Color(UIColor(named: "SettingsHighlighted")!).ignoresSafeArea(.all) : Color(UIColor(named: "SettingsBackground")!).ignoresSafeArea(.all))
|
||||
}
|
||||
.listStyle(.plain)
|
||||
.scrollContentBackground(.hidden)
|
||||
.listRowBackground(Color(UIColor(named: "SettingsBackground")!).ignoresSafeArea(.all))
|
||||
|
||||
} else {
|
||||
List(selection: $selected) {
|
||||
ForEach($viewModel.servers, id: \.name) { server in
|
||||
VStack {
|
||||
HStack {
|
||||
Text("\(server.name.wrappedValue)")
|
||||
.foregroundColor(.white)
|
||||
.frame(alignment: .center)
|
||||
Text("\(server.address.wrappedValue)")
|
||||
.foregroundColor(.white)
|
||||
.frame(alignment: .center)
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
.listStyle(.plain)
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
if #available(iOS 15.0, *) {
|
||||
TextField("Anisette Server List", text: $viewModel.source)
|
||||
.padding(.leading, 5)
|
||||
.padding(.vertical, 10)
|
||||
.frame(alignment: .center)
|
||||
.textFieldStyle(.plain)
|
||||
.border(.white, width: 1)
|
||||
.onSubmit {
|
||||
UserDefaults.standard.menuAnisetteList = viewModel.source
|
||||
viewModel.getListOfServers()
|
||||
}
|
||||
SUIButton(action: {
|
||||
viewModel.getListOfServers()
|
||||
}, label: {
|
||||
Text("Refresh Servers")
|
||||
})
|
||||
.padding(.bottom, 20)
|
||||
SUIButton(role: .destructive, action: {
|
||||
#if !DEBUG
|
||||
if Keychain.shared.adiPb != nil {
|
||||
Keychain.shared.adiPb = nil
|
||||
}
|
||||
#endif
|
||||
print("Cleared adi.pb from keychain")
|
||||
errorCallback()
|
||||
self.presentationMode.wrappedValue.dismiss()
|
||||
}, label: {
|
||||
Text("Reset adi.pb")
|
||||
// if (selected != nil) {
|
||||
// Text("\(selected!.uuidString)")
|
||||
// }
|
||||
})
|
||||
.padding(.bottom, 20)
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.navigationTitle("Anisette Servers")
|
||||
.onAppear {
|
||||
if UserDefaults.standard.menuAnisetteList != "" {
|
||||
viewModel.source = UserDefaults.standard.menuAnisetteList
|
||||
} else {
|
||||
viewModel.source = "https://servers.sidestore.io/servers.json"
|
||||
}
|
||||
print(UserDefaults.standard.menuAnisetteURL)
|
||||
print(UserDefaults.standard.menuAnisetteList)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#Preview {
|
||||
AnisetteServers(selected: "", errorCallback: {})
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22684"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
|
||||
<capability name="Named colors" minToolsVersion="9.0"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
@@ -20,8 +20,8 @@
|
||||
<color key="backgroundColor" name="SettingsBackground"/>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<color key="separatorColor" white="1" alpha="0.25" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<label key="tableFooterView" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="SideStore 1.0" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="bUR-rp-Nw2">
|
||||
<rect key="frame" x="0.0" y="1209" width="375" height="25"/>
|
||||
<label key="tableFooterView" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="SideStore 1.0" textAlignment="center" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" id="bUR-rp-Nw2">
|
||||
<rect key="frame" x="0.0" y="1245" width="375" height="25"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" white="1" alpha="0.69999999999999996" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
@@ -727,8 +727,8 @@
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="51"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Reset adi.pb" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eds-Dj-36y">
|
||||
<rect key="frame" x="30" y="15.5" width="102" height="20.5"/>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Anisette Servers" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eds-Dj-36y">
|
||||
<rect key="frame" x="30" y="15.5" width="135.5" height="20.5"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
@@ -746,39 +746,6 @@
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="1" alpha="0.14999999999999999" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<edgeInsets key="layoutMargins" top="8" left="30" bottom="8" right="30"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="style">
|
||||
<integer key="value" value="2"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="isSelectable" value="YES"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" rowHeight="51" id="fj2-EJ-Z98" customClass="InsetGroupTableViewCell" customModule="SideStore" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="1227" width="375" height="51"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="fj2-EJ-Z98" id="BcT-Fs-KNg">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="51"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Advanced Settings" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="OcM-OM-uDE">
|
||||
<rect key="frame" x="30" y="15.5" width="154" height="20.5"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Next" translatesAutoresizingMaskIntoConstraints="NO" id="Pcu-Sy-yfZ">
|
||||
<rect key="frame" x="327" y="16.5" width="18" height="18"/>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="Pcu-Sy-yfZ" secondAttribute="trailing" id="CFy-IO-4eb"/>
|
||||
<constraint firstItem="OcM-OM-uDE" firstAttribute="centerY" secondItem="BcT-Fs-KNg" secondAttribute="centerY" id="OGl-h4-FPx"/>
|
||||
<constraint firstItem="Pcu-Sy-yfZ" firstAttribute="centerY" secondItem="BcT-Fs-KNg" secondAttribute="centerY" id="R7L-4O-lTn"/>
|
||||
<constraint firstItem="OcM-OM-uDE" firstAttribute="leading" secondItem="BcT-Fs-KNg" secondAttribute="leadingMargin" id="yoh-C6-UC5"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="1" alpha="0.14999999999999999" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<edgeInsets key="layoutMargins" top="8" left="30" bottom="8" right="30"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="style">
|
||||
<integer key="value" value="3"/>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import SwiftUI
|
||||
import SafariServices
|
||||
import MessageUI
|
||||
import Intents
|
||||
@@ -57,7 +58,7 @@ extension SettingsViewController
|
||||
case refreshSideJITServer
|
||||
case clearCache
|
||||
case resetPairingFile
|
||||
case resetAdiPb
|
||||
case anisetteServers
|
||||
case advancedSettings
|
||||
|
||||
}
|
||||
@@ -131,8 +132,14 @@ final class SettingsViewController: UITableViewController
|
||||
{
|
||||
versionString += "SideStore\t"
|
||||
}
|
||||
self.versionLabel.text = NSLocalizedString(versionString, comment: "SideStore Version")
|
||||
versionString += "\n\(Bundle.Info.appbundleIdentifier)"
|
||||
|
||||
self.versionLabel.text = NSLocalizedString(versionString, comment: "SideStore Version")
|
||||
|
||||
self.versionLabel.numberOfLines = 0
|
||||
self.versionLabel.lineBreakMode = .byWordWrapping
|
||||
self.versionLabel.setNeedsUpdateConstraints()
|
||||
|
||||
self.tableView.contentInset.bottom = 40
|
||||
|
||||
self.update()
|
||||
@@ -150,6 +157,18 @@ final class SettingsViewController: UITableViewController
|
||||
|
||||
self.update()
|
||||
}
|
||||
|
||||
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
||||
if segue.identifier == "anisetteServers" {
|
||||
let controller = UIHostingController(rootView: AnisetteServers(selected: UserDefaults.standard.menuAnisetteURL, errorCallback: {
|
||||
ToastView(text: "Cleared adi.pb!", detailText: "You will need to log back into Apple ID in SideStore.").show(in: self)
|
||||
}))
|
||||
self.show(controller, sender: nil)
|
||||
} else {
|
||||
super.prepare(for: segue, sender: sender)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private extension SettingsViewController
|
||||
@@ -447,14 +466,14 @@ extension SettingsViewController
|
||||
{
|
||||
let cell = super.tableView(tableView, cellForRowAt: indexPath)
|
||||
|
||||
// if #available(iOS 14, *) {}
|
||||
// else if let cell = cell as? InsetGroupTableViewCell,
|
||||
// indexPath.section == Section.appRefresh.rawValue,
|
||||
// indexPath.row == AppRefreshRow.backgroundRefresh.rawValue
|
||||
// {
|
||||
// // Only one row is visible pre-iOS 14.
|
||||
// cell.style = .single
|
||||
// }
|
||||
if #available(iOS 14, *) {}
|
||||
else if let cell = cell as? InsetGroupTableViewCell,
|
||||
indexPath.section == Section.appRefresh.rawValue,
|
||||
indexPath.row == AppRefreshRow.backgroundRefresh.rawValue
|
||||
{
|
||||
// Only one row is visible pre-iOS 14.
|
||||
cell.style = .single
|
||||
}
|
||||
|
||||
if AppRefreshRow.AllCases().count == 1
|
||||
{
|
||||
@@ -674,25 +693,11 @@ extension SettingsViewController
|
||||
alertController.popoverPresentationController?.sourceRect = self.tableView.rectForRow(at: indexPath)
|
||||
self.present(alertController, animated: true)
|
||||
self.tableView.deselectRow(at: indexPath, animated: true)
|
||||
case .resetAdiPb:
|
||||
let alertController = UIAlertController(
|
||||
title: NSLocalizedString("Are you sure you want to reset the adi.pb file?", comment: ""),
|
||||
message: NSLocalizedString("The adi.pb file is used to generate anisette data, which is required to log into an Apple ID. If you are having issues with account related things, you can try this. However, you will be required to do 2FA again. This will do nothing if you are using an older anisette server.", comment: ""),
|
||||
preferredStyle: UIAlertController.Style.actionSheet)
|
||||
|
||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("Reset adi.pb", comment: ""), style: .destructive){ _ in
|
||||
if Keychain.shared.adiPb != nil {
|
||||
Keychain.shared.adiPb = nil
|
||||
print("Cleared adi.pb from keychain")
|
||||
}
|
||||
self.tableView.deselectRow(at: indexPath, animated: true)
|
||||
})
|
||||
alertController.addAction(.cancel)
|
||||
//Fix crash on iPad
|
||||
alertController.popoverPresentationController?.sourceView = self.tableView
|
||||
alertController.popoverPresentationController?.sourceRect = self.tableView.rectForRow(at: indexPath)
|
||||
self.present(alertController, animated: true)
|
||||
self.tableView.deselectRow(at: indexPath, animated: true)
|
||||
case .anisetteServers:
|
||||
self.prepare(for: UIStoryboardSegue(identifier: "anisetteServers", source: self, destination: UIHostingController(rootView: AnisetteServers(selected: "", errorCallback: {
|
||||
ToastView(text: "Reset adi.pb", detailText: "Buh").show(in: self)
|
||||
}))), sender: nil)
|
||||
// self.performSegue(withIdentifier: "anisetteServers", sender: nil)
|
||||
case .advancedSettings:
|
||||
// Create the URL that deep links to your app's custom settings.
|
||||
if let url = URL(string: UIApplication.openSettingsURLString) {
|
||||
|
||||
@@ -26,6 +26,8 @@ public extension UserDefaults
|
||||
@NSManaged var textInputSideJITServerurl: String?
|
||||
@NSManaged var textInputAnisetteURL: String?
|
||||
@NSManaged var customAnisetteURL: String?
|
||||
@NSManaged var menuAnisetteURL: String
|
||||
@NSManaged var menuAnisetteList: String
|
||||
@NSManaged var preferredServerID: String?
|
||||
|
||||
@NSManaged var isBackgroundRefreshEnabled: Bool
|
||||
@@ -81,8 +83,9 @@ public extension UserDefaults
|
||||
#keyPath(UserDefaults.isLegacyDeactivationSupported): isLegacyDeactivationSupported,
|
||||
#keyPath(UserDefaults.activeAppLimitIncludesExtensions): activeAppLimitIncludesExtensions,
|
||||
#keyPath(UserDefaults.localServerSupportsRefreshing): localServerSupportsRefreshing,
|
||||
#keyPath(UserDefaults.requiresAppGroupMigration): true
|
||||
]
|
||||
#keyPath(UserDefaults.requiresAppGroupMigration): true,
|
||||
#keyPath(UserDefaults.menuAnisetteURL): "https://ani.sidestore.io"
|
||||
] as [String : Any]
|
||||
|
||||
UserDefaults.standard.register(defaults: defaults)
|
||||
UserDefaults.shared.register(defaults: defaults)
|
||||
|
||||
@@ -275,14 +275,12 @@ public extension InstalledApp
|
||||
|
||||
do { try FileManager.default.createDirectory(at: appsDirectoryURL, withIntermediateDirectories: true, attributes: nil) }
|
||||
catch { print("Creating App Directory Error: \(error)") }
|
||||
print("`appsDirectoryURL` is set to: \(appsDirectoryURL.absoluteString)")
|
||||
return appsDirectoryURL
|
||||
}
|
||||
|
||||
class var legacyAppsDirectoryURL: URL {
|
||||
let baseDirectory = FileManager.default.applicationSupportDirectory
|
||||
let appsDirectoryURL = baseDirectory.appendingPathComponent("Apps")
|
||||
print("legacy `appsDirectoryURL` is set to: \(appsDirectoryURL.absoluteString)")
|
||||
return appsDirectoryURL
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user