Skip to content

Commit 57fa2ca

Browse files
committed
Move the setup to TabContainer
1 parent f27c3a1 commit 57fa2ca

File tree

4 files changed

+14
-37
lines changed

4 files changed

+14
-37
lines changed

Copilot for Xcode.xcodeproj/project.pbxproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
C87B03AC293B2CF300C77EAE /* XcodeKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C81458902939EFDC00135263 /* XcodeKit.framework */; };
4040
C87B03AD293B2CF300C77EAE /* XcodeKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C81458902939EFDC00135263 /* XcodeKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
4141
C882175C294187EF00A22FD3 /* Client in Frameworks */ = {isa = PBXBuildFile; productRef = C882175B294187EF00A22FD3 /* Client */; };
42-
C89A37162A12728200BE3C16 /* LaunchAgentManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = C89A37152A12728200BE3C16 /* LaunchAgentManager.swift */; };
4342
C8C8B60929AFA35F00034BEE /* CopilotForXcodeExtensionService.app in Embed XPCService */ = {isa = PBXBuildFile; fileRef = C861E60E2994F6070056CB02 /* CopilotForXcodeExtensionService.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
4443
C8DCF00029CE11D500FDDDD7 /* ChatWithSelection.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8DCEFFF29CE11D500FDDDD7 /* ChatWithSelection.swift */; };
4544
/* End PBXBuildFile section */
@@ -177,7 +176,6 @@
177176
C87B03A8293B262600C77EAE /* NextSuggestionCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NextSuggestionCommand.swift; sourceTree = "<group>"; };
178177
C87B03AA293B262E00C77EAE /* PreviousSuggestionCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreviousSuggestionCommand.swift; sourceTree = "<group>"; };
179178
C887BC832965D96000931567 /* DEVELOPMENT.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = DEVELOPMENT.md; sourceTree = "<group>"; };
180-
C89A37152A12728200BE3C16 /* LaunchAgentManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LaunchAgentManager.swift; sourceTree = "<group>"; };
181179
C8CD828229B88006008D044D /* TestPlan.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = TestPlan.xctestplan; sourceTree = "<group>"; };
182180
C8DCEFFF29CE11D500FDDDD7 /* ChatWithSelection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatWithSelection.swift; sourceTree = "<group>"; };
183181
/* End PBXFileReference section */
@@ -288,7 +286,6 @@
288286
children = (
289287
C87B03A3293B24AB00C77EAE /* Copilot-for-Xcode-Info.plist */,
290288
C8189B192938972F00C9DCDA /* App.swift */,
291-
C89A37152A12728200BE3C16 /* LaunchAgentManager.swift */,
292289
C8189B1D2938973000C9DCDA /* Assets.xcassets */,
293290
C8189B222938973000C9DCDA /* Copilot_for_Xcode.entitlements */,
294291
C8189B1F2938973000C9DCDA /* Preview Content */,
@@ -519,7 +516,6 @@
519516
isa = PBXSourcesBuildPhase;
520517
buildActionMask = 2147483647;
521518
files = (
522-
C89A37162A12728200BE3C16 /* LaunchAgentManager.swift in Sources */,
523519
C8189B1A2938972F00C9DCDA /* App.swift in Sources */,
524520
);
525521
runOnlyForDeploymentPostprocessing = 0;

Copilot for Xcode/App.swift

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,6 @@ struct CopilotForXcodeApp: App {
1515
UserDefaults.setupDefaultSettings()
1616
}
1717
.environment(\.updateChecker, UpdateChecker(hostBundle: Bundle.main))
18-
.onAppear {
19-
#if DEBUG
20-
// do not auto install on debug build
21-
#else
22-
Task {
23-
do {
24-
try await LaunchAgentManager()
25-
.setupLaunchAgentForTheFirstTimeIfNeeded()
26-
} catch {
27-
errorMessage = error.localizedDescription
28-
}
29-
}
30-
#endif
31-
}
3218
}
3319
}
3420
}

Copilot for Xcode/LaunchAgentManager.swift

Lines changed: 0 additions & 19 deletions
This file was deleted.

Core/Sources/HostApp/TabContainer.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,20 @@ public struct TabContainer: View {
6767
.environment(\.toast) { [toastController] content, type in
6868
toastController.toast(content: content, type: type)
6969
}
70+
.onAppear {
71+
#if DEBUG
72+
// do not auto install on debug build
73+
#else
74+
Task {
75+
do {
76+
try await LaunchAgentManager()
77+
.setupLaunchAgentForTheFirstTimeIfNeeded()
78+
} catch {
79+
toastController.toast(content: error.localizedDescription, type: .error)
80+
}
81+
}
82+
#endif
83+
}
7084
}
7185
}
7286

0 commit comments

Comments
 (0)