Skip to content

Commit bead391

Browse files
authored
chore: v4 (#77)
2 parents 104cdd8 + d47d353 commit bead391

36 files changed

+1291
-1325
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Xcode Select Version
3333
uses: maxim-lobanov/setup-xcode@v1
3434
with:
35-
xcode-version: '15'
35+
xcode-version: '16'
3636

3737
- name: Setup Certificate
3838
uses: apple-actions/import-codesign-certs@v2
@@ -69,7 +69,7 @@ jobs:
6969
to: HEAD
7070

7171
- name: Build macOS app
72-
run: xcodebuild archive -scheme "ishare (external)" -configuration "Release" -archivePath "build/ishare.xcarchive" -destination "generic/platform=macOS,name=Any Mac" | xcbeautify
72+
run: xcodebuild archive -scheme "ishare" -configuration "Release" -archivePath "build/ishare.xcarchive" -destination "generic/platform=macOS,name=Any Mac" "OTHER_SWIFT_FLAGS=${inherited} -D NOT_APP_STORE" | xcbeautify
7373

7474
- name: Commit & Push changes
7575
uses: EndBug/add-and-commit@v9

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
</a>
5252
</p>
5353

54+
[Translate on Crowdin](https://crowdin.com/project/isharemac)
55+
5456
## 🚀 Features
5557

5658
<details markdown="block">

crowdin.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
files:
2+
- source: ishare/Localizable.xcstrings
3+
translation: ishare/Localizable.xcstrings
4+
multilingual: 1

ishare.xcodeproj/project.pbxproj

Lines changed: 110 additions & 314 deletions
Large diffs are not rendered by default.

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

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

ishare.xcodeproj/xcshareddata/xcschemes/ishare.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1500"
3+
LastUpgradeVersion = "1600"
44
version = "1.7">
55
<BuildAction
66
parallelizeBuildables = "YES"

ishare.xcodeproj/xcuserdata/adrian.xcuserdatad/xcschemes/xcschememanagement.plist

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,31 @@
99
<key>isShown</key>
1010
<false/>
1111
<key>orderHint</key>
12-
<integer>2</integer>
12+
<integer>4</integer>
1313
</dict>
1414
<key>Playground (Playground) 2.xcscheme</key>
1515
<dict>
1616
<key>isShown</key>
1717
<false/>
1818
<key>orderHint</key>
19-
<integer>3</integer>
19+
<integer>5</integer>
2020
</dict>
2121
<key>Playground (Playground).xcscheme</key>
2222
<dict>
2323
<key>isShown</key>
2424
<false/>
2525
<key>orderHint</key>
26-
<integer>1</integer>
26+
<integer>3</integer>
2727
</dict>
28-
<key>ishare (external).xcscheme_^#shared#^_</key>
28+
<key>ishare.xcscheme_^#shared#^_</key>
2929
<dict>
3030
<key>orderHint</key>
31-
<integer>1</integer>
31+
<integer>0</integer>
3232
</dict>
33-
<key>ishare.xcscheme_^#shared#^_</key>
33+
<key>sharemenuext.xcscheme_^#shared#^_</key>
3434
<dict>
3535
<key>orderHint</key>
36-
<integer>0</integer>
36+
<integer>1</integer>
3737
</dict>
3838
</dict>
3939
<key>SuppressBuildableAutocreation</key>

ishare/App.swift

Lines changed: 113 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -5,107 +5,151 @@
55
// Created by Adrian Castro on 10.07.23.
66
//
77

8-
import SwiftUI
98
import Defaults
109
import MenuBarExtraAccess
10+
import SwiftUI
11+
1112
#if NOT_APP_STORE
12-
import Sparkle
13+
import Sparkle
1314
#endif
1415

1516
@main
1617
struct ishare: App {
1718
@Default(.menuBarIcon) var menubarIcon
1819
@Default(.showMainMenu) var showMainMenu
1920
@StateObject private var appState = AppState()
20-
@NSApplicationDelegateAdaptor private var appDelegate : AppDelegate
21-
21+
@NSApplicationDelegateAdaptor private var appDelegate: AppDelegate
22+
2223
var body: some Scene {
23-
MenuBarExtra() {
24+
MenuBarExtra {
2425
MainMenuView()
2526
}
26-
label: {
27-
switch menubarIcon {
28-
case .DEFAULT: Image(nsImage: GlyphIcon)
29-
case .APPICON: Image(nsImage: AppIcon)
30-
case .SYSTEM: Image(systemName: "photo.on.rectangle.angled")
27+
label: {
28+
switch menubarIcon {
29+
case .DEFAULT: Image(nsImage: GlyphIcon)
30+
case .APPICON: Image(nsImage: AppIcon)
31+
case .SYSTEM: Image(systemName: "photo.on.rectangle.angled")
32+
}
3133
}
32-
}
33-
.menuBarExtraAccess(isPresented: $showMainMenu)
34+
.menuBarExtraAccess(isPresented: $showMainMenu)
3435
Settings {
3536
SettingsMenuView()
3637
}
3738
}
3839
}
3940

4041
#if NOT_APP_STORE
41-
class AppDelegate: NSObject, NSApplicationDelegate, SPUUpdaterDelegate {
42-
static private(set) var shared: AppDelegate! = nil
43-
var recordGif = false
44-
var screenRecorder: ScreenRecorder!
45-
var updaterController: SPUStandardUpdaterController!
46-
47-
func application(_ application: NSApplication, open urls: [URL]) {
48-
if urls.count == 1 {
49-
importIscu(urls.first!)
42+
class AppDelegate: NSObject, NSApplicationDelegate, SPUUpdaterDelegate {
43+
private(set) static var shared: AppDelegate! = nil
44+
var recordGif = false
45+
var screenRecorder: ScreenRecorder!
46+
var updaterController: SPUStandardUpdaterController!
47+
48+
func application(_: NSApplication, open urls: [URL]) {
49+
if urls.first!.isFileURL {
50+
importIscu(urls.first!)
51+
}
52+
53+
if let url = urls.first {
54+
let path = url.host
55+
let queryItems = URLComponents(url: url, resolvingAgainstBaseURL: false)?.queryItems
56+
57+
if path == "upload" {
58+
if let fileItem = queryItems?.first(where: { $0.name == "file" }) {
59+
if let encodedFileURLString = fileItem.value, let decodedFileURLString = encodedFileURLString.removingPercentEncoding, let fileURL = URL(string: decodedFileURLString) {
60+
print("Received file URL: \(fileURL.absoluteString)")
61+
62+
@Default(.uploadType) var uploadType
63+
64+
uploadFile(fileURL: fileURL, uploadType: uploadType) {
65+
showToast(fileURL: fileURL) {
66+
NSSound.beep()
67+
}
68+
}
69+
}
70+
}
71+
}
72+
}
5073
}
51-
}
52-
53-
func applicationDidFinishLaunching(_ notification: Notification) {
54-
AppDelegate.shared = self
55-
56-
Task {
57-
screenRecorder = ScreenRecorder()
74+
75+
func applicationDidFinishLaunching(_: Notification) {
76+
AppDelegate.shared = self
77+
78+
Task {
79+
screenRecorder = ScreenRecorder()
80+
}
81+
82+
updaterController = SPUStandardUpdaterController(startingUpdater: true, updaterDelegate: self, userDriverDelegate: nil)
5883
}
59-
60-
updaterController = SPUStandardUpdaterController(startingUpdater: true, updaterDelegate: self, userDriverDelegate: nil)
61-
}
62-
63-
func stopRecording() {
64-
Task {
65-
await screenRecorder.stop { [self] result in
66-
switch result {
67-
case .success(let url):
68-
print("Recording stopped successfully. URL: \(url)")
69-
postRecordingTasks(url, recordGif)
70-
case .failure(let error):
71-
print("Error while stopping recording: \(error.localizedDescription)")
84+
85+
func stopRecording() {
86+
Task {
87+
await screenRecorder.stop { [self] result in
88+
switch result {
89+
case let .success(url):
90+
print("Recording stopped successfully. URL: \(url)")
91+
postRecordingTasks(url, recordGif)
92+
case let .failure(error):
93+
print("Error while stopping recording: \(error.localizedDescription)")
94+
}
7295
}
7396
}
7497
}
7598
}
76-
}
7799
#else
78-
class AppDelegate: NSObject, NSApplicationDelegate {
79-
static private(set) var shared: AppDelegate! = nil
80-
var recordGif = false
81-
var screenRecorder: ScreenRecorder!
82-
83-
func application(_ application: NSApplication, open urls: [URL]) {
84-
if urls.count == 1 {
85-
importIscu(urls.first!)
100+
101+
class AppDelegate: NSObject, NSApplicationDelegate {
102+
private(set) static var shared: AppDelegate! = nil
103+
var recordGif = false
104+
var screenRecorder: ScreenRecorder!
105+
106+
func application(_: NSApplication, open urls: [URL]) {
107+
if urls.first!.isFileURL {
108+
importIscu(urls.first!)
109+
}
110+
111+
if let url = urls.first {
112+
let path = url.host
113+
let queryItems = URLComponents(url: url, resolvingAgainstBaseURL: false)?.queryItems
114+
115+
if path == "upload" {
116+
if let fileItem = queryItems?.first(where: { $0.name == "file" }) {
117+
if let encodedFileURLString = fileItem.value, let decodedFileURLString = encodedFileURLString.removingPercentEncoding, let fileURL = URL(string: decodedFileURLString) {
118+
print("Received file URL: \(fileURL.absoluteString)")
119+
120+
@Default(.uploadType) var uploadType
121+
122+
uploadFile(fileURL: fileURL, uploadType: uploadType) {
123+
showToast(fileURL: fileURL) {
124+
NSSound.beep()
125+
}
126+
}
127+
}
128+
}
129+
}
130+
}
86131
}
87-
}
88-
89-
func applicationDidFinishLaunching(_ notification: Notification) {
90-
AppDelegate.shared = self
91-
92-
Task {
93-
screenRecorder = ScreenRecorder()
132+
133+
func applicationDidFinishLaunching(_: Notification) {
134+
AppDelegate.shared = self
135+
136+
Task {
137+
screenRecorder = ScreenRecorder()
138+
}
94139
}
95-
}
96-
97-
func stopRecording() {
98-
Task {
99-
await screenRecorder.stop { [self] result in
100-
switch result {
101-
case .success(let url):
102-
print("Recording stopped successfully. URL: \(url)")
103-
postRecordingTasks(url, recordGif)
104-
case .failure(let error):
105-
print("Error while stopping recording: \(error.localizedDescription)")
140+
141+
func stopRecording() {
142+
Task {
143+
await screenRecorder.stop { [self] result in
144+
switch result {
145+
case let .success(url):
146+
print("Recording stopped successfully. URL: \(url)")
147+
postRecordingTasks(url, recordGif)
148+
case let .failure(error):
149+
print("Error while stopping recording: \(error.localizedDescription)")
150+
}
106151
}
107152
}
108153
}
109154
}
110-
}
111155
#endif

0 commit comments

Comments
 (0)