mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
[cleanup]: remove unused code and renamed AltStore to SideStore in sources section
This commit is contained in:
@@ -81,7 +81,7 @@ struct SourceError: ALTLocalizedError
|
|||||||
var errorFailureReason: String {
|
var errorFailureReason: String {
|
||||||
switch self.code
|
switch self.code
|
||||||
{
|
{
|
||||||
case .unsupported: return String(format: NSLocalizedString("The source “%@” is not supported by this version of AltStore.", comment: ""), self.$source.name)
|
case .unsupported: return String(format: NSLocalizedString("The source “%@” is not supported by this version of SideStore.", comment: ""), self.$source.name)
|
||||||
case .duplicateBundleID:
|
case .duplicateBundleID:
|
||||||
let bundleIDFragment = self.bundleID.map { String(format: NSLocalizedString("the bundle identifier %@", comment: ""), $0) } ?? NSLocalizedString("the same bundle identifier", comment: "")
|
let bundleIDFragment = self.bundleID.map { String(format: NSLocalizedString("the bundle identifier %@", comment: ""), $0) } ?? NSLocalizedString("the same bundle identifier", comment: "")
|
||||||
let failureReason = String(format: NSLocalizedString("The source “%@” contains multiple apps with %@.", comment: ""), self.$source.name, bundleIDFragment)
|
let failureReason = String(format: NSLocalizedString("The source “%@” contains multiple apps with %@.", comment: ""), self.$source.name, bundleIDFragment)
|
||||||
@@ -108,7 +108,7 @@ struct SourceError: ALTLocalizedError
|
|||||||
return failureReason
|
return failureReason
|
||||||
|
|
||||||
case .blocked:
|
case .blocked:
|
||||||
let failureReason = String(format: NSLocalizedString("The source “%@” has been blocked by AltStore for security reasons.", comment: ""), self.$source.name)
|
let failureReason = String(format: NSLocalizedString("The source “%@” has been blocked by SideStore for security reasons.", comment: ""), self.$source.name)
|
||||||
return failureReason
|
return failureReason
|
||||||
|
|
||||||
case .changedID:
|
case .changedID:
|
||||||
@@ -141,11 +141,11 @@ struct SourceError: ALTLocalizedError
|
|||||||
return failureReason
|
return failureReason
|
||||||
|
|
||||||
case .marketplaceNotSupported:
|
case .marketplaceNotSupported:
|
||||||
let failureReason = String(format: NSLocalizedString("The source “%@” contains notarized apps, which are not supported by this version of AltStore.", comment: ""), self.$source.name)
|
let failureReason = String(format: NSLocalizedString("The source “%@” contains notarized apps, which are not supported by this version of SideStore.", comment: ""), self.$source.name)
|
||||||
return failureReason
|
return failureReason
|
||||||
|
|
||||||
case .marketplaceRequired:
|
case .marketplaceRequired:
|
||||||
let failureReason = String(format: NSLocalizedString("One or more apps in source “%@” are missing a marketplaceID. This most likely means they are not notarized, which is not supported by this version of AltStore.", comment: ""), self.$source.name)
|
let failureReason = String(format: NSLocalizedString("One or more apps in source “%@” are missing a marketplaceID. This most likely means they are not notarized, which is not supported by this version of SideStore.", comment: ""), self.$source.name)
|
||||||
return failureReason
|
return failureReason
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -186,7 +186,7 @@ struct SourceError: ALTLocalizedError
|
|||||||
return recoverySuggestion
|
return recoverySuggestion
|
||||||
|
|
||||||
case .marketplaceRequired:
|
case .marketplaceRequired:
|
||||||
let failureReason = String(format: NSLocalizedString("AltStore can only install marketplace apps that have been notarized by Apple.", comment: ""), self.$source.name)
|
let failureReason = String(format: NSLocalizedString("SideStore can only install marketplace apps that have been notarized by Apple.", comment: ""), self.$source.name)
|
||||||
return failureReason
|
return failureReason
|
||||||
|
|
||||||
default: return nil
|
default: return nil
|
||||||
|
|||||||
@@ -74,6 +74,10 @@ class UpdateKnownSourcesOperation: ResultOperation<([KnownSource], [KnownSource]
|
|||||||
UserDefaults.shared.recommendedSources = sources.trusted
|
UserDefaults.shared.recommendedSources = sources.trusted
|
||||||
UserDefaults.shared.blockedSources = sources.blocked
|
UserDefaults.shared.blockedSources = sources.blocked
|
||||||
|
|
||||||
|
// Cache trusted source IDs.
|
||||||
|
UserDefaults.shared.trustedSourceIDs = sources.trusted.map { $0.identifier }
|
||||||
|
|
||||||
|
|
||||||
self.finish(.success(sources))
|
self.finish(.success(sources))
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
|||||||
@@ -13,27 +13,6 @@ import AltStoreCore
|
|||||||
import Roxas
|
import Roxas
|
||||||
import Nuke
|
import Nuke
|
||||||
|
|
||||||
//struct SourceError: ALTLocalizedError
|
|
||||||
//{
|
|
||||||
// enum Code: Int, ALTErrorCode
|
|
||||||
// {
|
|
||||||
// typealias Error = SourceError
|
|
||||||
// case unsupported
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// var code: Code
|
|
||||||
// var errorTitle: String?
|
|
||||||
// var errorFailure: String?
|
|
||||||
// @Managed var source: Source
|
|
||||||
//
|
|
||||||
// var errorFailureReason: String {
|
|
||||||
// switch self.code
|
|
||||||
// {
|
|
||||||
// case .unsupported: return String(format: NSLocalizedString("The source “%@” is not supported by this version of SideStore.", comment: ""), self.$source.name)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
@objc(SourcesFooterView)
|
@objc(SourcesFooterView)
|
||||||
private final class SourcesFooterView: TextCollectionReusableView
|
private final class SourcesFooterView: TextCollectionReusableView
|
||||||
{
|
{
|
||||||
@@ -43,8 +22,8 @@ private final class SourcesFooterView: TextCollectionReusableView
|
|||||||
|
|
||||||
private extension UIAction.Identifier
|
private extension UIAction.Identifier
|
||||||
{
|
{
|
||||||
static let showDetails = UIAction.Identifier("io.altstore.showDetails")
|
static let showDetails = UIAction.Identifier("io.sidestore.showDetails")
|
||||||
static let showError = UIAction.Identifier("io.altstore.showError")
|
static let showError = UIAction.Identifier("io.sidestore.showError")
|
||||||
}
|
}
|
||||||
|
|
||||||
final class SourcesViewController: UICollectionViewController
|
final class SourcesViewController: UICollectionViewController
|
||||||
@@ -364,7 +343,7 @@ private extension SourcesViewController
|
|||||||
case .failure(OperationError.cancelled): break
|
case .failure(OperationError.cancelled): break
|
||||||
|
|
||||||
case .failure(var error as SourceError):
|
case .failure(var error as SourceError):
|
||||||
let title = String(format: NSLocalizedString("“%@” could not be added to AltStore.", comment: ""), error.$source.name)
|
let title = String(format: NSLocalizedString("“%@” could not be added to SideStore.", comment: ""), error.$source.name)
|
||||||
error.errorTitle = title
|
error.errorTitle = title
|
||||||
self.present(error)
|
self.present(error)
|
||||||
|
|
||||||
@@ -383,6 +362,10 @@ private extension SourcesViewController
|
|||||||
// strong reference to source.managedObjectContext.
|
// strong reference to source.managedObjectContext.
|
||||||
@Managed var source = try result.get()
|
@Managed var source = try result.get()
|
||||||
|
|
||||||
|
#if !BETA
|
||||||
|
guard let trustedSourceIDs = UserDefaults.shared.trustedSourceIDs, trustedSourceIDs.contains(source.identifier) else { throw SourceError(code: .unsupported, source: source) }
|
||||||
|
#endif
|
||||||
|
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.showSourceDetails(for: source)
|
self.showSourceDetails(for: source)
|
||||||
}
|
}
|
||||||
@@ -432,40 +415,6 @@ private extension SourcesViewController
|
|||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
completionHandler?(false)
|
completionHandler?(false)
|
||||||
|
|
||||||
// let dispatchGroup = DispatchGroup()
|
|
||||||
//
|
|
||||||
// var sourcesByURL = [URL: Source]()
|
|
||||||
// var fetchError: Error?
|
|
||||||
//
|
|
||||||
// for sourceURL in featuredSourceURLs
|
|
||||||
// {
|
|
||||||
// dispatchGroup.enter()
|
|
||||||
//
|
|
||||||
// AppManager.shared.fetchSource(sourceURL: sourceURL, managedObjectContext: context) { result in
|
|
||||||
// // Serialize access to sourcesByURL.
|
|
||||||
// context.performAndWait {
|
|
||||||
// switch result
|
|
||||||
// {
|
|
||||||
// case .failure(let error): fetchError = error
|
|
||||||
// case .success(let source): sourcesByURL[source.sourceURL] = source
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// dispatchGroup.leave()
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// dispatchGroup.notify(queue: .main) {
|
|
||||||
// if let error = fetchError
|
|
||||||
// {
|
|
||||||
// print(error)
|
|
||||||
// // 1 error doesn't mean all trusted sources failed to load! Riley, why did you do this???????
|
|
||||||
//// finish(.failure(error))
|
|
||||||
// }
|
|
||||||
// let sources = featuredSourceURLs.compactMap { sourcesByURL[$0] }
|
|
||||||
// finish(.success(sources))
|
|
||||||
// }
|
|
||||||
self.present(error)
|
self.present(error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user