- Multiple fixes and CI setup

This commit is contained in:
Magesh K
2025-02-08 04:45:22 +05:30
parent e608211f32
commit bf766c1b84
61 changed files with 1631 additions and 1154 deletions

View File

@@ -99,7 +99,8 @@ final class DownloadAppOperation: ResultOperation<ALTApplication>
if let installedApp = storeApp.installedApp
{
guard !installedApp.matches(latestSupportedVersion) else { return self.finish(.failure(error)) }
// guard !installedApp.matches(latestSupportedVersion) else { return self.finish(.failure(error)) }
guard installedApp.hasUpdate else { return self.finish(.failure(error)) }
}
let title = NSLocalizedString("Unsupported iOS Version", comment: "")

View File

@@ -45,8 +45,14 @@ extension VerificationError
VerificationError(code: .mismatchedHash, app: app, hash: hash, expectedHash: expectedHash)
}
static func mismatchedVersion(_ version: String, expectedVersion: String, app: AppProtocol) -> VerificationError {
VerificationError(code: .mismatchedVersion, app: app, version: version, expectedVersion: expectedVersion)
static func mismatchedVersion(version: String,
expectedVersion: String,
app: AppProtocol) -> VerificationError
{
VerificationError(code: .mismatchedVersion, app: app,
version: version,
expectedVersion: expectedVersion
)
}
static func mismatchedBuildVersion(_ version: String, expectedVersion: String, app: AppProtocol) -> VerificationError {

View File

@@ -55,8 +55,23 @@ final class RemoveAppExtensionsOperation: ResultOperation<Void>
try FileManager.default.removeItem(at: appExtension.fileURL)
}
}
private func updateManifest() throws {
guard let app = context.app else {
return
}
let scInfoURL = app.fileURL.appendingPathComponent("SC_Info")
let manifestPlistURL = scInfoURL.appendingPathComponent("Manifest.plist")
if let manifestPlist = NSMutableDictionary(contentsOf: manifestPlistURL),
let sinfReplicationPaths = manifestPlist["SinfReplicationPaths"] as? [String]
{
let replacementPaths = sinfReplicationPaths.filter { !$0.starts(with: "PlugIns/") } // Filter out app extension paths.
manifestPlist["SinfReplicationPaths"] = replacementPaths
try manifestPlist.write(to: manifestPlistURL)
}
}
private func removeAppExtensions(from targetAppBundle: ALTApplication,
localAppExtensions: Set<ALTApplication>?,
@@ -127,6 +142,7 @@ final class RemoveAppExtensionsOperation: ResultOperation<Void>
alertController.addAction(UIAlertAction(title: NSLocalizedString("Remove App Extensions", comment: ""), style: .destructive) { (action) in
do {
try Self.removeExtensions(from: targetAppBundle.appExtensions)
try self.updateManifest()
return self.finish(.success(()))
} catch {
return self.finish(.failure(error))

View File

@@ -82,17 +82,16 @@ final class VerifyAppOperation: ResultOperation<Void>
do
{
guard let ipaURL = self.context.ipaURL else { throw OperationError.appNotFound(name: app.name) }
// TODO: @mahee96: appVersion is instantiated source info as AppVersion incoming from source json
// app is the instantiated ipa downloaded from the specified in the source json in temp dir
//
// For alpha and beta/nightly releases, the CFBundleShortVersionString which is the
// $(MARKETING_VERSION) will be overriden with the commit id before invoking xcode build
//
try await self.verifyHash(of: app, at: ipaURL, matches: appVersion)
try await self.verifyDownloadedVersion(of: app, matches: appVersion)
try await self.verifyPermissions(of: app, match: appVersion)
// process missing permissions check only if the source is V2 or later
if let source = appVersion.app?.source,
source.isSourceAtLeastV2
{
try await self.verifyPermissions(of: app, match: appVersion)
}
self.finish(.success(()))
}
@@ -129,24 +128,17 @@ private extension VerifyAppOperation
{
let (version, buildVersion) = await $appVersion.perform { ($0.version, $0.buildVersion) }
let downloadedIpaRevision = Bundle(url: app.fileURL)!.object(forInfoDictionaryKey: "BuildRevision") as? String ?? ""
let sourceJsonIpaRevision = appVersion.revision
// if not beta but version matches, then accept it, else compare revisions between source and downloaded
// marketplace buildVersion validation
if let buildVersion
{
guard buildVersion == app.buildVersion else {
throw VerificationError.mismatchedBuildVersion(app.buildVersion, expectedVersion: buildVersion, app: app)
}
}
if version != app.version {
throw VerificationError.mismatchedVersion(app.version, expectedVersion: version, app: app)
throw VerificationError.mismatchedVersion(version: app.version, expectedVersion: version, app: app)
}
if (appVersion.isBeta && downloadedIpaRevision != sourceJsonIpaRevision) {
let sourceJsonIpaRevision = sourceJsonIpaRevision ?? "nil"
throw VerificationError.mismatchedVersion(app.version + " - " + downloadedIpaRevision,
expectedVersion: version + " - " + sourceJsonIpaRevision, app: app)
}
// if let buildVersion
// {
// // TODO: @mahee96: requires altsign-marketplace branch release or equivalent
// guard buildVersion == app.buildVersion else { throw VerificationError.mismatchedBuildVersion(app.buildVersion, expectedVersion: buildVersion, app: app) }
// }
}
func verifyPermissions(of app: ALTApplication, @AsyncManaged match appVersion: AppVersion) async throws