Commit Graph

114 Commits

Author SHA1 Message Date
Riley Testut
5a2f32704c Updates SourceError.blocked recovery suggestion to list installed/blocked apps
If source is already added, the error message will list all installed apps from the source.

If adding source for first time, the error message will mention exactly which apps have been blocked from the source (if provided).
2024-12-26 21:15:29 +05:30
Riley Testut
177d453491 [AltStoreCore] Backports iOS 15+ NSManagedObjectContext.performAndWait<T>()
Simplifies returning values and throwing errors from managed object contexts.
2024-12-26 21:15:29 +05:30
Riley Testut
254a9773ec Supports blocking third-party sources
Blocked sources cannot be added by new users, or updated for existing users.
2024-12-26 21:15:29 +05:30
Riley Testut
ee410605e8 Verifies downloaded app’s permissions match source
Renames source JSON permissions key to “appPermissions” in order to preserve backwards compatibility, since we’ve changed the schema for permissions.
2024-12-26 21:15:29 +05:30
Riley Testut
7dfbba9b00 Verifies downloaded app’s SHA-256 checksum (if specified) 2024-12-26 21:15:29 +05:30
Riley Testut
16c71be7f9 [AltStoreCore] Flattens optional values when @Managed/@AsyncManaged.wrappedValue is also optional 2024-12-26 21:15:29 +05:30
Riley Testut
7d380da5d1 [AltStoreCore] Adds Managed.perform() to match AsyncManaged 2024-12-26 21:15:29 +05:30
Riley Testut
a09f4bbd7a [AltStoreCore] Renames AsyncManaged.get() to perform()
Implies it can be used as alternative to managedObject.managedObjectContext.perform() and not just for retrieving values.
2024-12-26 21:15:29 +05:30
Riley Testut
357211e917 [AltStoreCore] Migrates Core Data model from v11 to v12 2024-12-26 21:15:29 +05:30
Riley Testut
bc7311c159 [AltStoreCore] Replaces remaining Bundle.appGroups.first with Bundle.altstoreAppGroup
Ensures we can still find the correct AltStore app group even if it isn’t the first one listed in the Info.plist.
2024-12-26 21:15:29 +05:30
Riley Testut
39f7e60e8b [AltStoreCore] Fixes migration error on launch if AltStore app group does not exist.
Allows falling back to using regular app sandbox instead of app group.
2024-12-26 21:15:29 +05:30
Riley Testut
b88044757f [AltStoreCore] Fixes incorrectly merging app versions for same app from different sources 2024-12-26 21:15:29 +05:30
Riley Testut
f44c3c18a2 [AltStoreCore] Adds async wrappers for presenting UIAlertControllers 2024-12-26 21:15:29 +05:30
Riley Testut
654f73f4ee Shows detailed source “About” page when adding 3rd-party sources
Allows users to preview sources before adding them to their AltStore.
2024-12-26 21:15:29 +05:30
Riley Testut
20cd6d98fc [AltStoreCore] Adds Source.isAdded
Convenience property to determine whether a source has been added to the user’s AltStore.
2024-12-26 21:15:29 +05:30
Riley Testut
12ca34f40f [AltStoreCore] Adds @AsyncManaged property wrapper
Same as @Managed, except it supports using Swift Concurrency to fetch values from its managedObject’s managedObjectContext.
2024-12-26 21:15:29 +05:30
Riley Testut
fc99fb32a4 [AltStoreCore] Adds NSManagedObjectContext.performAsync() to wrap iOS 15+ async perform()
Allows us to use Swift Concurrency with Core Data pre-iOS 15.
2024-12-26 21:15:29 +05:30
Riley Testut
779887e582 [AltStoreCore] Fixes incorrect Source.featuredApps relationship post-merging 2024-12-26 21:15:29 +05:30
Riley Testut
bdb1d68b6b [AltStoreCore] Supports additional source JSON values for detailed “About” page 2024-12-26 21:15:29 +05:30
Riley Testut
404bd1450b Fixes error fetching Friend Zone patrons due to unexpected nil name 2024-12-26 21:15:29 +05:30
Riley Testut
06d28ca663 Removes unnecessary @available annotations 2024-12-26 21:15:29 +05:30
Riley Testut
ed1365281f Removes unnecessary #available checks 2024-12-26 21:15:29 +05:30
Riley Testut
e4dfe1125a Fixes UIApplication.keyWindow deprecation warning 2024-12-26 21:15:29 +05:30
Riley Testut
589ece3860 Fixes Scanner.scanHexInt32 deprecation warning 2024-12-26 21:15:29 +05:30
Riley Testut
aa2409178b [AltStoreCore] Fixes Core Data “Using nil or insecure value transformer” warnings 2024-12-26 21:15:29 +05:30
Riley Testut
65598e2cd5 Fixes triggering false positives with some malware detectors
Renames UserDefaults.isMacDirtyCowSupported to .isCowExploitSupported
2024-12-26 21:15:29 +05:30
Riley Testut
9df4026ed4 Hides MacDirtyCow settings on iOS 15.7.2
MacDirtyCow supports iOS 14.0 - 15.7.1 and 16.0 - 16.1.2, but not 15.7.2
2024-12-26 21:15:29 +05:30
Riley Testut
f9c22ff617 Force-enables “Enforce 3-App Limit” if iOS version does not support MacDirtyCow exploit
Prevents “Enforce 3-App Limit” remaining enabled after updating iOS version without a way to disable it.
2024-12-26 21:15:29 +05:30
Riley Testut
66a17bc27f Supports sideloading more than 3 apps via MacDirtyCow exploit
The MacDirtyCow exploit allows users to remove the 3 active apps limit on iOS 16.1.2 and earlier. To support this, we’ve added a new (hidden) “Enforce 3-App Limit” setting that can be disabled to allow sideloading more than 3 apps.
2024-12-26 21:15:29 +05:30
Riley Testut
a8f0d9da9b Caches MergeErrors when refreshing sources to view later in SourcesViewController 2024-12-26 21:15:29 +05:30
Riley Testut
4a3dbc20d6 Fixes incorrect StoreApp.versions order post-merge 2024-12-26 21:15:29 +05:30
Riley Testut
8f1a91df1b Replaces StoreApp.setVersions() preconditionFailure with runtime error
It’s more common than expected for apps to not have any app versions, so better to fail gracefully than crash.
2024-12-26 21:15:29 +05:30
Riley Testut
2a7926539f Moves @Managed to AltStoreCore 2024-12-26 21:15:29 +05:30
Riley Testut
2f9f3e6c72 [Shared] Adds OperatingSystemVersion+Comparable to AltServer target 2024-12-26 21:15:29 +05:30
Riley Testut
0965299e6f Fixes missing app icon for update errors in Error Log 2024-12-26 21:15:29 +05:30
Riley Testut
83d39666d2 Fixes potentially incorrect versions order when merging StoreApp 2024-12-26 21:15:29 +05:30
Riley Testut
9f38601102 Hides app updates that don’t support device’s OS version 2024-12-26 21:15:29 +05:30
Riley Testut
5d87650553 Replaces StoreApp.latestVersion with latestSupportedVersion + latestAvailableVersion
We now store the latest supported version as a relationship on StoreApp, rather than the latest available version. This allows us to reference the latest supported version in predicates and sort descriptors.

However, we kept the underlying Core Data property name the same to avoid extra migration.
2024-12-26 21:15:29 +05:30
Riley Testut
f294f1045a Limits quitting other AltStore processes to database migrations only
Previously, AltStore would quit all other processes when first accessing the database no matter what. However, this unintentionally caused the widget extension to quit the main app after refreshing apps.

Now, we only quit other AltStore processes if a database migration is required. This still prevents multiple AltStores with different database schemas from accessing database concurrently, but also allows extensions to access database without quitting main app.
2024-12-26 21:15:29 +05:30
Riley Testut
b458e75098 [Shared] Refactors error handling based on ALTLocalizedError protocol (#1115)
* [Shared] Revises ALTLocalizedError protocol

* Refactors errors to conform to revised ALTLocalizedError protocol

* [Missing Commit] Remaining changes for ALTLocalizedError

* [AltServer] Refactors errors to conform to revised ALTLocalizedError protocol

* [Missing Commit] Declares ALTLocalizedTitleErrorKey + ALTLocalizedDescriptionKey

* Updates Objective-C errors to match revised ALTLocalizedError

* [Missing Commit] Unnecessary ALTLocalizedDescription logic

* [Shared] Refactors NSError.withLocalizedFailure to properly support ALTLocalizedError

* [Shared] Supports adding localized titles to errors via NSError.withLocalizedTitle()

* Revises ErrorResponse logic to support arbitrary errors and user info values

* [Missed Commit] Renames CodableServerError to CodableError

* Merges ConnectionError into OperationError

* [Missed Commit] Doesn’t check ALTWrappedError’s userInfo for localizedDescription

* [Missed] Fixes incorrect errorDomain for ALTErrorEnums

* [Missed] Removes nonexistent ALTWrappedError.h

* Includes source file and line number in OperationError.unknown failureReason

* Adds localizedTitle to AppManager operation errors

* Fixes adding localizedTitle + localizedFailure to ALTWrappedError

* Updates ToastView to use error’s localizedTitle as title

* [Shared] Adds NSError.formattedDetailedDescription(with:)

Returns formatted NSAttributedString containing all user info values intended for displaying to the user.

* [Shared] Updates Error.localizedErrorCode to say “code” instead of “error”

* Conforms ALTLocalizedError to CustomStringConvertible

* Adds “View More Details” option to Error Log context menu to view detailed error description

* [Shared] Fixes NSError.formattedDetailedDescription appearing black in dark mode

* [AltServer] Updates error alert to match revised error logic

Uses error’s localizedTitle as alert title.

* [AltServer] Adds “View More Details” button to error alert to view detailed error info

* [AltServer] Renames InstallError to OperationError and conforms to ALTErrorEnum

* [Shared] Removes CodableError support for Date user info values

Not currently used, and we don’t want to accidentally parse a non-Date as a Date in the meantime.

* [Shared] Includes dynamic UserInfoValueProvider values in NSError.formattedDetailedDescription()

* [Shared] Includes source file + line in NSError.formattedDetailedDescription()

Automatically captures source file + line when throwing ALTErrorEnums.

* [Shared] Captures source file + line for unknown errors

* Removes sourceFunction from OperationError

* Adds localizedTitle to AuthenticationViewController errors

* [Shared] Moves nested ALTWrappedError logic to ALTWrappedError initializer

* [AltServer] Removes now-redundant localized failure from JIT errors

All JIT errors now have a localizedTitle which effectively says the same thing.

* Makes OperationError.Code start at 1000

“Connection errors” subsection starts at 1200.

* [Shared] Updates Error domains to revised [Source].[ErrorType] format

* Updates ALTWrappedError.localizedDescription to prioritize using wrapped NSLocalizedDescription as failure reason

* Makes ALTAppleAPIError codes start at 3000

* [AltServer] Adds relevant localizedFailures to ALTDeviceManager.installApplication() errors

* Revises OperationError failureReasons and recovery suggestions

All failure reasons now read correctly when preceded by a failure reason and “because”.

* Revises ALTServerError error messages
All failure reasons now read correctly when preceded by a failure reason and “because”.

* Most failure reasons now read correctly when preceded by a failure reason and “because”.
* ALTServerErrorUnderlyingError forwards all user info provider calls to underlying error.

* Revises error messages for ALTAppleAPIErrorIncorrectCredentials

* [Missed] Removes NSError+AltStore.swift from AltStore target

* [Shared] Updates AltServerErrorDomain to revised [Source].[ErrorType] format

* [Shared] Removes “code” from Error.localizedErrorCode

* [Shared] Makes ALTServerError codes (appear to) start at 2000

We can’t change the actual error codes without breaking backwards compatibility, so instead we just add 2000 whenever we display ALTServerError codes to the user.

* Moves VerificationError.errorFailure to VerifyAppOperation

* Supports custom failure reason for OperationError.unknown

* [Shared] Changes AltServerErrorDomain to “AltServer.ServerError”

* [Shared] Converts ALTWrappedError to Objective-C class

NSError subclasses must be written in ObjC for Swift.Error <-> NSError bridging to work correctly.

* Fixes decoding CodableError nested user info values
2024-12-26 21:15:29 +05:30
Riley Testut
40855063c9 Migrates Core Data model from v10 to v11 2024-12-26 21:15:29 +05:30
Riley Testut
41a68a1897 Supports new “versions” key in source JSON
Allows sources to list multiple versions of an app.

Preserves backwards compatibility by assigning legacy version values when assigning AppVersions.
2024-12-26 21:15:29 +05:30
Riley Testut
9c8c1b4311 Adds AppVersion Core Data entity
Preserves redundant fields on StoreApp in database model for backwards compatibility.
2024-12-26 21:15:29 +05:30
Riley Testut
dd88e03b4c Adds LoggedError Core Data entity
Allows us to save certain errors to disk so that they can be viewed again later from an error log.
2024-12-26 21:15:29 +05:30
June
62c655c927 fix build 2024-12-24 14:33:50 +09:00
Rose
09902a3f71 Update StoreApp.swift
Signed-off-by: Rose <cool5tarXV@gmail.com>
2024-12-24 14:26:10 +09:00
Rose
3db004c733 added fix + todo
Signed-off-by: Rose <cool5tarXV@gmail.com>
2024-12-24 14:26:10 +09:00
Magesh K
2bb2eea226 -[Feature]: client-side: Anisette server fallback impl when current server is unreachable (#773) 2024-11-27 18:38:54 -05:00
Magesh K
a2bb26a86e - Fix: DatabaseManager.migrateDatabaseToAppGroupIfNeeded() src and dest for replaceAt() cannot be same 2024-11-28 02:47:01 +05:30
Magesh K
3682b65a4a restore changes dropped from altstore by 1713fcc 2024-11-10 03:04:24 +05:30