Skip to content

Commit 4b5b996

Browse files
committed
Support opening extension manager
1 parent 078c258 commit 4b5b996

3 files changed

Lines changed: 28 additions & 2 deletions

File tree

Core/Sources/HostApp/General.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import ComposableArchitecture
33
import Foundation
44
import LaunchAgentManager
55
import SwiftUI
6+
import XPCShared
67

78
struct General: ReducerProtocol {
89
struct State: Equatable {
@@ -14,6 +15,7 @@ struct General: ReducerProtocol {
1415
enum Action: Equatable {
1516
case appear
1617
case setupLaunchAgentIfNeeded
18+
case openExtensionManager
1719
case reloadStatus
1820
case finishReloading(xpcServiceVersion: String, permissionGranted: Bool)
1921
case failedReloading
@@ -28,6 +30,7 @@ struct General: ReducerProtocol {
2830
return .run { send in
2931
await send(.setupLaunchAgentIfNeeded)
3032
}
33+
3134
case .setupLaunchAgentIfNeeded:
3235
return .run { send in
3336
#if DEBUG
@@ -44,6 +47,19 @@ struct General: ReducerProtocol {
4447
#endif
4548
await send(.reloadStatus)
4649
}
50+
51+
case .openExtensionManager:
52+
return .run { send in
53+
let service = try getService()
54+
do {
55+
_ = try await service
56+
.send(requestBody: ExtensionServiceRequests.OpenExtensionManager())
57+
} catch {
58+
toast(error.localizedDescription, .error)
59+
await send(.failedReloading)
60+
}
61+
}
62+
4763
case .reloadStatus:
4864
state.isReloading = true
4965
return .run { send in

Core/Sources/HostApp/GeneralView.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct GeneralView: View {
1212
var body: some View {
1313
ScrollView {
1414
VStack(alignment: .leading, spacing: 0) {
15-
AppInfoView()
15+
AppInfoView(store: store)
1616
SettingsDivider()
1717
ExtensionServiceView(store: store)
1818
SettingsDivider()
@@ -30,6 +30,7 @@ struct GeneralView: View {
3030
struct AppInfoView: View {
3131
@State var appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
3232
@Environment(\.updateChecker) var updateChecker
33+
let store: StoreOf<General>
3334

3435
var body: some View {
3536
VStack(alignment: .leading) {
@@ -45,6 +46,15 @@ struct AppInfoView: View {
4546
.foregroundColor(.secondary)
4647

4748
Spacer()
49+
50+
Button(action: {
51+
store.send(.openExtensionManager)
52+
}) {
53+
HStack(spacing: 2) {
54+
Image(systemName: "puzzlepiece.extension.fill")
55+
Text("Extensions")
56+
}
57+
}
4858

4959
Button(action: {
5060
updateChecker.checkForUpdates()

Pro

Submodule Pro updated from fca9339 to d57e90f

0 commit comments

Comments
 (0)