Skip to content

Commit

Permalink
Initial Sparkle support
Browse files Browse the repository at this point in the history
  • Loading branch information
jmshrv committed Apr 26, 2024
1 parent ea5b255 commit 2b72690
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 23 deletions.
35 changes: 30 additions & 5 deletions MacIguana.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
1A401C292AE81995003EB398 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1A401C282AE81995003EB398 /* Assets.xcassets */; };
1A401C2C2AE81995003EB398 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1A401C2B2AE81995003EB398 /* Preview Assets.xcassets */; };
1A480F7E2BA9FEAB0016A17D /* AssemblyLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A480F7D2BA9FEAB0016A17D /* AssemblyLoader.swift */; };
1A4ACDC72BD9957A005DFCC3 /* UInt8+JimulatorConvert.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A4ACDC62BD9957A005DFCC3 /* UInt8+JimulatorConvert.swift */; };
1A4ACDCA2BD99788005DFCC3 /* Sparkle in Frameworks */ = {isa = PBXBuildFile; productRef = 1A4ACDC92BD99788005DFCC3 /* Sparkle */; };
1A5391DF2BBB18FA003CBD84 /* MemoryList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A5391DE2BBB18FA003CBD84 /* MemoryList.swift */; };
1A5ACF6D2BBDA03300D66C3B /* KmdparseWord+isInstruction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A5ACF6C2BBDA03300D66C3B /* KmdparseWord+isInstruction.swift */; };
1A679F8E2BDC09E00017FCC2 /* UInt8+JimulatorConvert.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A679F8D2BDC09E00017FCC2 /* UInt8+JimulatorConvert.swift */; };
1A679F902BDC47FA0017FCC2 /* appcast.xml in Resources */ = {isa = PBXBuildFile; fileRef = 1A679F8F2BDC47FA0017FCC2 /* appcast.xml */; };
1A6D60F42BB8A5530077C04D /* LibiguanaError+LocalizedError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A6D60F32BB8A5530077C04D /* LibiguanaError+LocalizedError.swift */; };
1A742BA72B979F5900BFB27A /* BoardStatePane.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A742BA62B979F5900BFB27A /* BoardStatePane.swift */; };
1A742BA92B97A06D00BFB27A /* Status+CustomStringConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A742BA82B97A06D00BFB27A /* Status+CustomStringConvertible.swift */; };
Expand Down Expand Up @@ -49,10 +51,11 @@
1A401C2B2AE81995003EB398 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
1A401C2D2AE81995003EB398 /* MacIguana.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = MacIguana.entitlements; sourceTree = "<group>"; };
1A480F7D2BA9FEAB0016A17D /* AssemblyLoader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AssemblyLoader.swift; sourceTree = "<group>"; };
1A4ACDC62BD9957A005DFCC3 /* UInt8+JimulatorConvert.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "UInt8+JimulatorConvert.swift"; path = "../../../../../.Trash/UInt8+JimulatorConvert.swift"; sourceTree = "<group>"; };
1A5391DE2BBB18FA003CBD84 /* MemoryList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoryList.swift; sourceTree = "<group>"; };
1A5ACF6C2BBDA03300D66C3B /* KmdparseWord+isInstruction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "KmdparseWord+isInstruction.swift"; sourceTree = "<group>"; };
1A64AE402BC42FB0008E53DB /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
1A679F8D2BDC09E00017FCC2 /* UInt8+JimulatorConvert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UInt8+JimulatorConvert.swift"; sourceTree = "<group>"; };
1A679F8F2BDC47FA0017FCC2 /* appcast.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = appcast.xml; sourceTree = "<group>"; };
1A6D60F32BB8A5530077C04D /* LibiguanaError+LocalizedError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "LibiguanaError+LocalizedError.swift"; sourceTree = "<group>"; };
1A742BA62B979F5900BFB27A /* BoardStatePane.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoardStatePane.swift; sourceTree = "<group>"; };
1A742BA82B97A06D00BFB27A /* Status+CustomStringConvertible.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Status+CustomStringConvertible.swift"; sourceTree = "<group>"; };
Expand All @@ -73,6 +76,7 @@
buildActionMask = 2147483647;
files = (
1AFCEA8D2B86292A000FE4C1 /* Libiguana in Frameworks */,
1A4ACDCA2BD99788005DFCC3 /* Sparkle in Frameworks */,
1AFCEA902B862966000FE4C1 /* Libiguana in Frameworks */,
1AFCEA842B86219C000FE4C1 /* Libiguana in Frameworks */,
1A84188D2B9F1C59006CC42C /* Libiguana in Frameworks */,
Expand All @@ -88,6 +92,7 @@
1A401C182AE81994003EB398 = {
isa = PBXGroup;
children = (
1A679F8F2BDC47FA0017FCC2 /* appcast.xml */,
1A64AE402BC42FB0008E53DB /* README.md */,
1A401C232AE81994003EB398 /* MacIguana */,
1A401C222AE81994003EB398 /* Products */,
Expand Down Expand Up @@ -150,7 +155,7 @@
1A948C362B880EF3001515F0 /* Registers+list.swift */,
1AB33E452B9698F3007468AA /* Registers+zero.swift */,
1A742BA82B97A06D00BFB27A /* Status+CustomStringConvertible.swift */,
1A4ACDC62BD9957A005DFCC3 /* UInt8+JimulatorConvert.swift */,
1A679F8D2BDC09E00017FCC2 /* UInt8+JimulatorConvert.swift */,
);
path = Extensions;
sourceTree = "<group>";
Expand Down Expand Up @@ -189,6 +194,7 @@
1A12D2CA2B87C06600639258 /* Libiguana */,
1A8418892B9F1BF8006CC42C /* Libiguana */,
1A84188C2B9F1C59006CC42C /* Libiguana */,
1A4ACDC92BD99788005DFCC3 /* Sparkle */,
);
productName = MacIguana;
productReference = 1A401C212AE81994003EB398 /* MacIguana.app */;
Expand All @@ -202,7 +208,7 @@
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1500;
LastUpgradeCheck = 1500;
LastUpgradeCheck = 1530;
TargetAttributes = {
1A401C202AE81994003EB398 = {
CreatedOnToolsVersion = 15.0.1;
Expand All @@ -220,6 +226,7 @@
mainGroup = 1A401C182AE81994003EB398;
packageReferences = (
1A84188B2B9F1C59006CC42C /* XCRemoteSwiftPackageReference "libiguana-swift" */,
1A4ACDC82BD99788005DFCC3 /* XCRemoteSwiftPackageReference "Sparkle" */,
);
productRefGroup = 1A401C222AE81994003EB398 /* Products */;
projectDirPath = "";
Expand All @@ -237,6 +244,7 @@
files = (
1A401C2C2AE81995003EB398 /* Preview Assets.xcassets in Resources */,
1A401C292AE81995003EB398 /* Assets.xcassets in Resources */,
1A679F902BDC47FA0017FCC2 /* appcast.xml in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -253,7 +261,7 @@
1AFCEA8A2B86264C000FE4C1 /* SwiftIguanaEnvironment.swift in Sources */,
1A401C272AE81994003EB398 /* ContentView.swift in Sources */,
1A742BA72B979F5900BFB27A /* BoardStatePane.swift in Sources */,
1A4ACDC72BD9957A005DFCC3 /* UInt8+JimulatorConvert.swift in Sources */,
1A679F8E2BDC09E00017FCC2 /* UInt8+JimulatorConvert.swift in Sources */,
1A480F7E2BA9FEAB0016A17D /* AssemblyLoader.swift in Sources */,
1A401C252AE81994003EB398 /* MacIguanaApp.swift in Sources */,
1A5391DF2BBB18FA003CBD84 /* MemoryList.swift in Sources */,
Expand Down Expand Up @@ -307,6 +315,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand Down Expand Up @@ -370,6 +379,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand Down Expand Up @@ -400,6 +410,7 @@
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"MacIguana/Preview Content\"";
DEVELOPMENT_TEAM = PFNS8PTRM7;
ENABLE_HARDENED_RUNTIME = YES;
Expand Down Expand Up @@ -429,6 +440,7 @@
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"MacIguana/Preview Content\"";
DEVELOPMENT_TEAM = PFNS8PTRM7;
ENABLE_HARDENED_RUNTIME = YES;
Expand Down Expand Up @@ -473,6 +485,14 @@
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
1A4ACDC82BD99788005DFCC3 /* XCRemoteSwiftPackageReference "Sparkle" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/sparkle-project/Sparkle";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 2.6.0;
};
};
1A84188B2B9F1C59006CC42C /* XCRemoteSwiftPackageReference "libiguana-swift" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/iguana-debugger/libiguana-swift";
Expand All @@ -488,6 +508,11 @@
isa = XCSwiftPackageProductDependency;
productName = Libiguana;
};
1A4ACDC92BD99788005DFCC3 /* Sparkle */ = {
isa = XCSwiftPackageProductDependency;
package = 1A4ACDC82BD99788005DFCC3 /* XCRemoteSwiftPackageReference "Sparkle" */;
productName = Sparkle;
};
1A8418892B9F1BF8006CC42C /* Libiguana */ = {
isa = XCSwiftPackageProductDependency;
productName = Libiguana;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "9d1e0708ec0134e497f0fd9d95907d62b5eb34fba6e26fa9e80eece008b9a685",
"originHash" : "4d61b311e8d5ef7674d97f2bc43b4bbdb200c601483bbfd976ba28c4b4b50f6a",
"pins" : [
{
"identity" : "libiguana-swift",
Expand All @@ -9,6 +9,15 @@
"branch" : "main",
"revision" : "20cd1a090a52fa3082e176c9000f8f5d357b9b36"
}
},
{
"identity" : "sparkle",
"kind" : "remoteSourceControl",
"location" : "https://github.com/sparkle-project/Sparkle",
"state" : {
"revision" : "0a4caaf7a81eea2cece651ef4b17331fa0634dff",
"version" : "2.6.0"
}
}
],
"version" : 3
Expand Down
15 changes: 0 additions & 15 deletions MacIguana/Extensions/UInt8+JimulatorConvert.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
//

import Foundation
import SwiftTerm

/// Functions for converting to/from Jimulator for SwiftTerm
extension UInt8 {
Expand All @@ -21,18 +20,4 @@ extension UInt8 {
return self
}
}

/// Converts a Jimulator keycode to a terminal keycode
func terminal(_ xpos: Int) -> [UInt8] {
switch self {
case 8: // Backspace
if xpos == 0 {
return [27, 77] + EscapeSequences.moveEndNormal + [8, 127, 8] // ESC M, end, followed by backspace
} else {
return [8, 127, 8]
}
default:
return [self]
}
}
}
7 changes: 6 additions & 1 deletion MacIguana/Info.plist
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<?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/>
<dict>
<key>SUFeedURL</key>
<string>https://raw.githubusercontent.com/iguana-debugger/MacIguana/main/appcast.xml</string>
<key>SUPublicEDKey</key>
<string>i++WpK0lLKWG8hhIqjYXHVg5a1+cxJxRQSE1dNF/9AY=</string>
</dict>
</plist>
44 changes: 44 additions & 0 deletions MacIguana/MacIguanaApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,48 @@

import SwiftUI
import Libiguana
import Sparkle

// This view model class publishes when new updates can be checked by the user
final class CheckForUpdatesViewModel: ObservableObject {
@Published var canCheckForUpdates = false

init(updater: SPUUpdater) {
updater.publisher(for: \.canCheckForUpdates)
.assign(to: &$canCheckForUpdates)
}
}

// This is the view for the Check for Updates menu item
// Note this intermediate view is necessary for the disabled state on the menu item to work properly before Monterey.
// See https://stackoverflow.com/questions/68553092/menu-not-updating-swiftui-bug for more info
struct CheckForUpdatesView: View {
@ObservedObject private var checkForUpdatesViewModel: CheckForUpdatesViewModel
private let updater: SPUUpdater

init(updater: SPUUpdater) {
self.updater = updater

// Create our view model for our CheckForUpdatesView
self.checkForUpdatesViewModel = CheckForUpdatesViewModel(updater: updater)
}

var body: some View {
Button("Check for Updates…", action: updater.checkForUpdates)
.disabled(!checkForUpdatesViewModel.canCheckForUpdates)
}
}

@main
struct MacIguanaApp: App {
private let updaterController: SPUStandardUpdaterController

init() {
// If you want to start the updater manually, pass false to startingUpdater and call .startUpdater() later
// This is where you can also pass an updater delegate if you need one
updaterController = SPUStandardUpdaterController(startingUpdater: true, updaterDelegate: nil, userDriverDelegate: nil)
}

var body: some Scene {
DocumentGroup(viewing: KomodoDocument.self) { document in
if let url = document.fileURL {
Expand All @@ -19,5 +58,10 @@ struct MacIguanaApp: App {
}
}
.defaultSize(width: 1200, height: 800)
.commands {
CommandGroup(after: .appInfo) {
CheckForUpdatesView(updater: updaterController.updater)
}
}
}
}
2 changes: 1 addition & 1 deletion MacIguana/Views/TerminalTextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct TerminalTextView: NSViewRepresentable {
}

func textView(_ textView: NSTextView, shouldChangeTextIn affectedCharRange: NSRange, replacementString: String?) -> Bool {
let documentLength = textView.textStorage?.length ?? 0
// let documentLength = textView.textStorage?.length ?? 0

// If the location isn't at the end of the document, don't allow the input. This also stops stuff like
// selecting text to overwrite the document.
Expand Down
14 changes: 14 additions & 0 deletions appcast.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" standalone="yes"?>
<rss xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" version="2.0">
<channel>
<title>MacIguana</title>
<item>
<title>1.0</title>
<pubDate>Fri, 26 Apr 2024 17:58:01 +0100</pubDate>
<sparkle:version>1</sparkle:version>
<sparkle:shortVersionString>1.0</sparkle:shortVersionString>
<sparkle:minimumSystemVersion>14.0</sparkle:minimumSystemVersion>
<enclosure url="https://github.com/Iguana-Debugger/MacIguana/releases/download/1.0/MacIguana.zip" length="2349301" type="application/octet-stream" sparkle:edSignature="41M5BYJ1aO7Yiy6VbH6vX8/6F62HvSbEAfwFraECrjHe7RXVOtQjftSvJ1qm/+gei4JyWzD4iWSm2r3ua3koAw=="/>
</item>
</channel>
</rss>

0 comments on commit 2b72690

Please sign in to comment.