Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit 60b8688

Browse files
committed
fix: unable to view the injection running window
1 parent 032a842 commit 60b8688

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

InjectGUI/View/StatusView.swift

+14-20
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ struct StatusView: View {
1212
@Environment(\.dismiss) var dismiss // dismiss the sheet
1313

1414
@StateObject var injector = Injector.shared
15-
@State var appDetail: AppDetail = .init(name: "", identifier: "", version: "", path: "", executable: "", icon: NSImage())
16-
15+
1716
var body: some View {
1817
VStack(alignment: .leading, spacing: 10) {
19-
if appDetail.name.isEmpty {
18+
if self.injector.appDetail?.name == nil {
2019
Text("Why you are seeing this?")
2120
.font(.title)
2221
.bold()
@@ -45,18 +44,18 @@ struct StatusView: View {
4544
// MARK: - App Info Display Box
4645

4746
HStack(spacing: 20) {
48-
Image(nsImage: appDetail.icon)
47+
Image(nsImage: self.injector.appDetail!.icon)
4948
.resizable()
5049
.frame(width: 64, height: 64)
5150
.cornerRadius(4)
5251
// Spacer()
5352
VStack(alignment: .leading, spacing: 4) {
54-
Text(appDetail.name)
53+
Text(self.injector.appDetail!.name)
5554
.font(.headline)
56-
Text(appDetail.identifier)
55+
Text(self.injector.appDetail!.identifier)
5756
.font(.subheadline)
5857
.foregroundColor(.secondary)
59-
Text("Version: \(appDetail.version)")
58+
Text("Version: \(self.injector.appDetail!.version)")
6059
.font(.caption)
6160
.foregroundColor(.secondary)
6261
}
@@ -155,20 +154,15 @@ struct StatusView: View {
155154
.frame(maxWidth: .infinity)
156155
}
157156
}
158-
.onChange(of: injector.stage.appId) { appId in
159-
guard let appDetail = softwareManager.appListCache[appId] else {
160-
return
161-
}
162-
self.appDetail = appDetail
163-
}
164-
.frame(minWidth: 350, minHeight: appDetail.name.isEmpty ? 200 : 400)
157+
// .onChange(of: injector.isRunning) { _ in
158+
// let appId = injector.stage.appId
159+
// guard let self.injector.appDetail = softwareManager.appListCache[appId] else {
160+
// return
161+
// }
162+
// self.self.injector.appDetail = self.injector.appDetail
163+
// }
164+
.frame(minWidth: 350, minHeight: 400)
165165
.padding()
166-
.onAppear {
167-
guard let appDetail = softwareManager.appListCache[injector.stage.appId] else {
168-
return
169-
}
170-
self.appDetail = appDetail
171-
}
172166
.background(Color(.windowBackgroundColor))
173167
}
174168
}

0 commit comments

Comments
 (0)