Skip to content

Commit 73ff6ca

Browse files
authored
Merge pull request #9 from devwaseem/development
v1.1
2 parents d2f6325 + d266796 commit 73ff6ca

File tree

9 files changed

+113
-15
lines changed

9 files changed

+113
-15
lines changed

TempBox.xcodeproj/project.pbxproj

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
7501771C26F38A9E00A47F7D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7501770226F38A9E00A47F7D /* Assets.xcassets */; };
1212
7501772C26F38E0B00A47F7D /* RootNavigationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7501772B26F38E0B00A47F7D /* RootNavigationView.swift */; };
1313
7501772F26F38E4200A47F7D /* SidebarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7501772E26F38E4200A47F7D /* SidebarView.swift */; };
14+
751E7117272AB2AD005EB503 /* Sparkle in Frameworks */ = {isa = PBXBuildFile; productRef = 751E7116272AB2AD005EB503 /* Sparkle */; };
15+
751E711A272AB3B8005EB503 /* CheckForUpdatesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 751E7119272AB3B8005EB503 /* CheckForUpdatesView.swift */; };
16+
751E711C272AB3D3005EB503 /* UpdaterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 751E711B272AB3D3005EB503 /* UpdaterViewController.swift */; };
1417
752D57072711C61C0015D26D /* MessageDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 752D57062711C61C0015D26D /* MessageDetailViewController.swift */; };
1518
752D57092711D7730015D26D /* MessageDownloadManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 752D57082711D7730015D26D /* MessageDownloadManager.swift */; };
1619
7535D98F2708663300D39FAB /* MTMessage+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7535D98E2708663300D39FAB /* MTMessage+Extensions.swift */; };
@@ -101,6 +104,8 @@
101104
7501771226F38A9E00A47F7D /* macOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = macOS.entitlements; sourceTree = "<group>"; };
102105
7501772B26F38E0B00A47F7D /* RootNavigationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootNavigationView.swift; sourceTree = "<group>"; };
103106
7501772E26F38E4200A47F7D /* SidebarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarView.swift; sourceTree = "<group>"; };
107+
751E7119272AB3B8005EB503 /* CheckForUpdatesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckForUpdatesView.swift; sourceTree = "<group>"; };
108+
751E711B272AB3D3005EB503 /* UpdaterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdaterViewController.swift; sourceTree = "<group>"; };
104109
752D57062711C61C0015D26D /* MessageDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageDetailViewController.swift; sourceTree = "<group>"; };
105110
752D57082711D7730015D26D /* MessageDownloadManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageDownloadManager.swift; sourceTree = "<group>"; };
106111
7535D98E2708663300D39FAB /* MTMessage+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MTMessage+Extensions.swift"; sourceTree = "<group>"; };
@@ -170,6 +175,7 @@
170175
isa = PBXFrameworksBuildPhase;
171176
buildActionMask = 2147483647;
172177
files = (
178+
751E7117272AB2AD005EB503 /* Sparkle in Frameworks */,
173179
75C3204D26FBA229009AAB26 /* Resolver in Frameworks */,
174180
75C8D5D327131F1C0013F64A /* MailTMSwift in Frameworks */,
175181
);
@@ -207,6 +213,7 @@
207213
7501771026F38A9E00A47F7D /* macOS */ = {
208214
isa = PBXGroup;
209215
children = (
216+
751E7118272AB3AB005EB503 /* Updater */,
210217
750176FF26F38A9D00A47F7D /* TempBoxApp.swift */,
211218
756E473D2712C1E000E8A439 /* AppDelegate.swift */,
212219
75752EFC26F39C3D004EA6C1 /* AppController.swift */,
@@ -256,6 +263,15 @@
256263
path = Sidebar;
257264
sourceTree = "<group>";
258265
};
266+
751E7118272AB3AB005EB503 /* Updater */ = {
267+
isa = PBXGroup;
268+
children = (
269+
751E7119272AB3B8005EB503 /* CheckForUpdatesView.swift */,
270+
751E711B272AB3D3005EB503 /* UpdaterViewController.swift */,
271+
);
272+
path = Updater;
273+
sourceTree = "<group>";
274+
};
259275
753D3927270050B900911B58 /* Fakes */ = {
260276
isa = PBXGroup;
261277
children = (
@@ -497,6 +513,7 @@
497513
packageProductDependencies = (
498514
75C3204C26FBA229009AAB26 /* Resolver */,
499515
75C8D5D227131F1C0013F64A /* MailTMSwift */,
516+
751E7116272AB2AD005EB503 /* Sparkle */,
500517
);
501518
productName = "TempBox (macOS)";
502519
productReference = 7501770F26F38A9E00A47F7D /* TempBox.app */;
@@ -551,6 +568,7 @@
551568
packageReferences = (
552569
75C3204B26FBA229009AAB26 /* XCRemoteSwiftPackageReference "Resolver" */,
553570
75C8D5D127131F1C0013F64A /* XCRemoteSwiftPackageReference "MailTMSwift" */,
571+
751E7115272AB2AD005EB503 /* XCRemoteSwiftPackageReference "Sparkle" */,
554572
);
555573
productRefGroup = 7501770826F38A9E00A47F7D /* Products */;
556574
projectDirPath = "";
@@ -631,6 +649,7 @@
631649
75DE87472702D8D0008C089B /* MessagesListenerService.swift in Sources */,
632650
75640F2827063A1B00C7BCF6 /* MTLiveMessagesService+Extensions.swift in Sources */,
633651
7501771626F38A9E00A47F7D /* TempBoxApp.swift in Sources */,
652+
751E711A272AB3B8005EB503 /* CheckForUpdatesView.swift in Sources */,
634653
75A3C4D12708CC99004ED1AB /* MessageDetailHeader.swift in Sources */,
635654
7501772F26F38E4200A47F7D /* SidebarView.swift in Sources */,
636655
757EA59B270CE724004793CA /* AttachmentDownloadManager.swift in Sources */,
@@ -643,6 +662,7 @@
643662
75C3202626FB5AEE009AAB26 /* String+Extensions.swift in Sources */,
644663
7575A2B426F472C200A90CFE /* TempBox.xcdatamodeld in Sources */,
645664
75C3205726FBA89D009AAB26 /* Respositories+Injection.swift in Sources */,
665+
751E711C272AB3D3005EB503 /* UpdaterViewController.swift in Sources */,
646666
75752EFD26F39C3D004EA6C1 /* AppController.swift in Sources */,
647667
75DF252526F3D9D9003F69FE /* WebView.swift in Sources */,
648668
75C3204A26FBA1A2009AAB26 /* AccountService.swift in Sources */,
@@ -824,6 +844,7 @@
824844
"@executable_path/../Frameworks",
825845
);
826846
MACOSX_DEPLOYMENT_TARGET = 11.0;
847+
MARKETING_VERSION = 1.1;
827848
PRODUCT_BUNDLE_IDENTIFIER = com.waseem.TempBox;
828849
PRODUCT_NAME = TempBox;
829850
SDKROOT = macosx;
@@ -850,6 +871,7 @@
850871
"@executable_path/../Frameworks",
851872
);
852873
MACOSX_DEPLOYMENT_TARGET = 11.0;
874+
MARKETING_VERSION = 1.1;
853875
PRODUCT_BUNDLE_IDENTIFIER = com.waseem.TempBox;
854876
PRODUCT_NAME = TempBox;
855877
SDKROOT = macosx;
@@ -943,6 +965,14 @@
943965
/* End XCConfigurationList section */
944966

945967
/* Begin XCRemoteSwiftPackageReference section */
968+
751E7115272AB2AD005EB503 /* XCRemoteSwiftPackageReference "Sparkle" */ = {
969+
isa = XCRemoteSwiftPackageReference;
970+
repositoryURL = "https://github.com/sparkle-project/Sparkle";
971+
requirement = {
972+
branch = 2.x;
973+
kind = branch;
974+
};
975+
};
946976
75C3204B26FBA229009AAB26 /* XCRemoteSwiftPackageReference "Resolver" */ = {
947977
isa = XCRemoteSwiftPackageReference;
948978
repositoryURL = "https://github.com/hmlongco/Resolver";
@@ -962,6 +992,11 @@
962992
/* End XCRemoteSwiftPackageReference section */
963993

964994
/* Begin XCSwiftPackageProductDependency section */
995+
751E7116272AB2AD005EB503 /* Sparkle */ = {
996+
isa = XCSwiftPackageProductDependency;
997+
package = 751E7115272AB2AD005EB503 /* XCRemoteSwiftPackageReference "Sparkle" */;
998+
productName = Sparkle;
999+
};
9651000
75C3204C26FBA229009AAB26 /* Resolver */ = {
9661001
isa = XCSwiftPackageProductDependency;
9671002
package = 75C3204B26FBA229009AAB26 /* XCRemoteSwiftPackageReference "Resolver" */;

TempBox.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

macOS/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCent
1515

1616
var window: NSWindow?
1717
@Injected var persistenceManager: PersistenceManager
18-
18+
1919
func applicationDidFinishLaunching(_ notification: Notification) {
2020
registerNotifications()
2121
NSWindow.allowsAutomaticWindowTabbing = false

macOS/Features/Sidebar/SidebarView.swift

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,6 @@
77

88
import SwiftUI
99

10-
let placeholderAddresses = [
11-
12-
13-
14-
]
15-
16-
let placeholderArchivedAddresses = [
17-
18-
19-
20-
]
21-
2210
struct SidebarView: View {
2311

2412
@EnvironmentObject var appController: AppController

macOS/RootNavigationView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct RootNavigationView: View {
3030
}
3131

3232
}
33-
.frame(minWidth: 1000, minHeight: 600, idealHeight: 800)
33+
.frame(minHeight: 600, idealHeight: 800)
3434
.alert(item: $appController.alertData, content: { alertData in
3535
var messageText: Text?
3636
if let messsage = alertData.message {

macOS/Supporting files/Info.plist

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<key>CFBundlePackageType</key>
1818
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>1.0</string>
20+
<string>$(MARKETING_VERSION)</string>
2121
<key>CFBundleURLTypes</key>
2222
<array>
2323
<dict>
@@ -33,5 +33,9 @@
3333
<string>1</string>
3434
<key>LSMinimumSystemVersion</key>
3535
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
36+
<key>SUFeedURL</key>
37+
<string>https://tempbox.waseem.works/appcast.xml</string>
38+
<key>SUPublicEDKey</key>
39+
<string>PT4SSsorf7XqzStOwHacUK94e0TYMueytNvSQWfvPgQ=</string>
3640
</dict>
3741
</plist>

macOS/TempBoxApp.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import SwiftUI
99
import Combine
1010
import Resolver
11+
import Sparkle
1112

1213
@main
1314
struct TempBoxApp: App {
@@ -17,6 +18,7 @@ struct TempBoxApp: App {
1718
// swiftlint:enable weak_delegate
1819

1920
@StateObject var appController = AppController()
21+
@StateObject var updaterViewController = UpdaterViewController()
2022

2123
var body: some Scene {
2224
WindowGroup {
@@ -26,6 +28,16 @@ struct TempBoxApp: App {
2628
.commands {
2729
SidebarCommands()
2830
CommandGroup(replacing: .help) {
31+
Button("Github") {
32+
NSWorkspace.shared.open(URL(string: "https://github.com/devwaseem/TempBox")!)
33+
}
34+
Button("Website") {
35+
NSWorkspace.shared.open(URL(string: "https://tempbox.waseem.works")!)
36+
}
37+
Button("Developer") {
38+
NSWorkspace.shared.open(URL(string: "https://waseem.works")!)
39+
}
40+
Divider()
2941
Button("API") {
3042
NSWorkspace.shared.open(URL(string: "https://docs.mail.tm")!)
3143
}
@@ -47,6 +59,10 @@ struct TempBoxApp: App {
4759
.keyboardShortcut("n")
4860

4961
}
62+
63+
CommandGroup(after: .appInfo) {
64+
CheckForUpdatesView(updaterViewController: updaterViewController)
65+
}
5066
}
5167

5268
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// CheckForUpdatesView.swift
3+
// TempBox (macOS)
4+
//
5+
// Created by Waseem Akram on 28/10/21.
6+
//
7+
8+
import SwiftUI
9+
10+
struct CheckForUpdatesView: View {
11+
@ObservedObject var updaterViewController: UpdaterViewController
12+
13+
var body: some View {
14+
Button("Check For Updates…", action: updaterViewController.checkForUpdates)
15+
.disabled(!updaterViewController.canCheckForUpdates)
16+
}
17+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//
2+
// UpdaterViewController.swift
3+
// TempBox (macOS)
4+
//
5+
// Created by Waseem Akram on 28/10/21.
6+
//
7+
8+
import Foundation
9+
import Sparkle
10+
import SwiftUI
11+
12+
final class UpdaterViewController: ObservableObject {
13+
private let updaterController: SPUStandardUpdaterController
14+
15+
@Published var canCheckForUpdates = false
16+
17+
init() {
18+
// If you want to start the updater manually, pass false to startingUpdater and call .startUpdater() later
19+
// This is where you can also pass an updater delegate if you need one
20+
updaterController = SPUStandardUpdaterController(startingUpdater: true, updaterDelegate: nil, userDriverDelegate: nil)
21+
22+
updaterController.updater.publisher(for: \.canCheckForUpdates)
23+
.assign(to: &$canCheckForUpdates)
24+
}
25+
26+
func checkForUpdates() {
27+
updaterController.checkForUpdates(nil)
28+
}
29+
}

0 commit comments

Comments
 (0)