Skip to content

Commit

Permalink
feat: app updater (#200)
Browse files Browse the repository at this point in the history
* feat: tabula rasa

* feat: update pill

* feat: update menu on signed apps cell

* fix: satisfy xcode thread checker

* chore: on second thought that was quite ugly so let's not do that

* feat: update logic

* feat: remove previous version after update finished

* fix: actually fix the nonsense

* fix: actually fix it this time

* fix: fix source url stuff

* chore: update to a circle arrow icon

* chore: while this is cool, sending a notification every time you open the app is quite annoying

* chore: remove team

---------

Co-authored-by: khcrysalis <[email protected]>
  • Loading branch information
castdrian and khcrysalis authored Dec 3, 2024
1 parent a0d3253 commit 33f89fc
Show file tree
Hide file tree
Showing 11 changed files with 843 additions and 336 deletions.
3 changes: 2 additions & 1 deletion Shared/Data/CoreData/CoreDataManager+DownloadedApps.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ extension CoreDataManager {
uuid: String,
appPath: String?,
sourceLocation: String? = "Imported",
sourceURL: URL? = nil,
completion: @escaping (Error?) -> Void) {
let context = context ?? self.context
let newApp = DownloadedApps(context: context)
Expand All @@ -47,7 +48,7 @@ extension CoreDataManager {
newApp.dateAdded = dateAdded
newApp.uuid = uuid
newApp.appPath = appPath
newApp.oSU = sourceLocation
newApp.oSU = sourceURL?.absoluteString ?? sourceLocation

do {
try context.save()
Expand Down
14 changes: 14 additions & 0 deletions Shared/Data/CoreData/CoreDataManager+SignedApps.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ extension CoreDataManager {
appPath: String?,
timeToLive: Date,
teamName: String,
originalSourceURL: URL?,
completion: @escaping (Result<SignedApps, Error>) -> Void) {
let context = context ?? self.context
let newApp = SignedApps(context: context)
Expand All @@ -51,6 +52,7 @@ extension CoreDataManager {
newApp.appPath = appPath
newApp.timeToLive = timeToLive
newApp.teamName = teamName
newApp.originalSourceURL = originalSourceURL

do {
try context.save()
Expand Down Expand Up @@ -106,5 +108,17 @@ extension CoreDataManager {
completion(error)
}
}

func setUpdateAvailable(for app: SignedApps, newVersion: String) {
app.hasUpdate = true
app.updateVersion = newVersion
saveContext()
}

func clearUpdateState(for app: SignedApps) {
app.hasUpdate = false
app.updateVersion = nil
saveContext()
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="22225" systemVersion="23G80" minimumToolsVersion="Automatic" sourceLanguage="Swift" usedWithSwiftData="YES" userDefinedModelVersionIdentifier="">
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="23507" systemVersion="24B91" minimumToolsVersion="Automatic" sourceLanguage="Swift" usedWithSwiftData="YES" userDefinedModelVersionIdentifier="">
<entity name="Certificate" representedClassName="Certificate" syncable="YES" codeGenerationType="class">
<attribute name="certPath" optional="YES" attributeType="String"/>
<attribute name="dateAdded" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
Expand Down Expand Up @@ -39,11 +39,13 @@
<attribute name="bundleidentifier" attributeType="String"/>
<attribute name="dateAdded" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="directory" optional="YES" attributeType="String" defaultValueString="Signed"/>
<attribute name="hasUpdate" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
<attribute name="iconURL" optional="YES" attributeType="String"/>
<attribute name="name" attributeType="String"/>
<attribute name="originalSourceURL" optional="YES" attributeType="URI"/>
<attribute name="teamName" optional="YES" attributeType="String"/>
<attribute name="timeToLive" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="updateVersion" optional="YES" attributeType="String"/>
<attribute name="uuid" attributeType="String"/>
<attribute name="version" attributeType="String"/>
</entity>
Expand Down
3 changes: 2 additions & 1 deletion Shared/Signing/AppSigner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ func signInitialApp(bundle: BundleOptions, mainOptions: SigningMainDataWrapper,
uuid: signedUUID,
appPath: appPath.lastPathComponent,
timeToLive: mainOptions.mainOptions.certificate?.certData?.expirationDate ?? Date(),
teamName: mainOptions.mainOptions.certificate?.certData?.name ?? ""
teamName: mainOptions.mainOptions.certificate?.certData?.name ?? "",
originalSourceURL: bundle.sourceURL
) { result in


Expand Down
12 changes: 12 additions & 0 deletions feather.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
33E5A5AC2CC88BF500532930 /* ResetAlertOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33E5A5AB2CC88BF500532930 /* ResetAlertOptions.swift */; };
33E5A5AE2CC8A41E00532930 /* LogsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33E5A5AD2CC8A41E00532930 /* LogsViewController.swift */; };
33EEDAA42C5D9358009089DC /* CoreDataManager+DownloadedApps.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33EEDAA32C5D9358009089DC /* CoreDataManager+DownloadedApps.swift */; };
3AC770F12CF7250700D9B9E1 /* SourceRefreshOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AC770EF2CF7250700D9B9E1 /* SourceRefreshOperation.swift */; };
AA280D952C76AB7400CAC838 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA280D942C76AB7400CAC838 /* MobileCoreServices.framework */; };
AA280D972C76ABEF00CAC838 /* UIApplication+returnToHomeScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA280D962C76ABEF00CAC838 /* UIApplication+returnToHomeScreen.swift */; };
AF4D46EF2C432CCA003FA335 /* TweakLibraryViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF4D46EE2C432CCA003FA335 /* TweakLibraryViewCell.swift */; };
Expand Down Expand Up @@ -262,6 +263,7 @@
33E5A5AB2CC88BF500532930 /* ResetAlertOptions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResetAlertOptions.swift; sourceTree = "<group>"; };
33E5A5AD2CC8A41E00532930 /* LogsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogsViewController.swift; sourceTree = "<group>"; };
33EEDAA32C5D9358009089DC /* CoreDataManager+DownloadedApps.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CoreDataManager+DownloadedApps.swift"; sourceTree = "<group>"; };
3AC770EF2CF7250700D9B9E1 /* SourceRefreshOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SourceRefreshOperation.swift; sourceTree = "<group>"; };
88DE4CC52CA5A13200D68F1E /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = "<group>"; };
AA280D922C76A60700CAC838 /* LSApplicationWorkspace.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LSApplicationWorkspace.h; sourceTree = "<group>"; };
AA280D942C76AB7400CAC838 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -663,6 +665,7 @@
33BA378D2BF8159F00FF530A /* iOS */ = {
isa = PBXGroup;
children = (
3AC770F02CF7250700D9B9E1 /* Operations */,
33BA37A42BF8165400FF530A /* Delegates */,
33BA37A62BF8167A00FF530A /* Views */,
33BA37AE2BF819D400FF530A /* Extensions */,
Expand Down Expand Up @@ -793,6 +796,14 @@
path = Information;
sourceTree = "<group>";
};
3AC770F02CF7250700D9B9E1 /* Operations */ = {
isa = PBXGroup;
children = (
3AC770EF2CF7250700D9B9E1 /* SourceRefreshOperation.swift */,
);
path = Operations;
sourceTree = "<group>";
};
AFAC50932C48DC8E00EDEAB6 /* zsign */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -980,6 +991,7 @@
33BE877B2C7178180044D245 /* TweakHandler.swift in Sources */,
332476EA2C3E905D008C8EF0 /* AboutViewController.swift in Sources */,
33BA37B02BF819ED00FF530A /* UIColor+hex.swift in Sources */,
3AC770F12CF7250700D9B9E1 /* SourceRefreshOperation.swift in Sources */,
33BA37932BF8159F00FF530A /* SourcesViewController.swift in Sources */,
332476E62C3E8E25008C8EF0 /* SettingsCreditsTableCell.swift in Sources */,
33A305D52C3A858100D650BA /* UIButton+longpress.swift in Sources */,
Expand Down
Loading

0 comments on commit 33f89fc

Please sign in to comment.