@@ -70,9 +70,6 @@ struct TailscaleIntegrationSection: View {
7070 let isPaused : Bool
7171
7272 @ Environment ( TailscaleService . self ) private var tailscaleService
73- #if DEBUG
74- private var testingService : TailscaleService ?
75- #endif
7673
7774 @ State private var hasLoaded = false
7875 @ State private var tailscaleMode : GatewayTailscaleMode = . serve
@@ -86,17 +83,6 @@ struct TailscaleIntegrationSection: View {
8683 init ( connectionMode : AppState . ConnectionMode , isPaused : Bool ) {
8784 self . connectionMode = connectionMode
8885 self . isPaused = isPaused
89- #if DEBUG
90- self . testingService = nil
91- #endif
92- }
93-
94- private var effectiveService : TailscaleService {
95- #if DEBUG
96- return self . testingService ?? self . tailscaleService
97- #else
98- return self . tailscaleService
99- #endif
10086 }
10187
10288 var body : some View {
@@ -106,7 +92,7 @@ struct TailscaleIntegrationSection: View {
10692
10793 self . statusRow
10894
109- if ! self . effectiveService . isInstalled {
95+ if ! self . tailscaleService . isInstalled {
11096 self . installButtons
11197 } else {
11298 self . modePicker
@@ -145,7 +131,7 @@ struct TailscaleIntegrationSection: View {
145131 guard ! self . hasLoaded else { return }
146132 await self . loadConfig ( )
147133 self . hasLoaded = true
148- await self . effectiveService . checkTailscaleStatus ( )
134+ await self . tailscaleService . checkTailscaleStatus ( )
149135 self . startStatusTimer ( )
150136 }
151137 . onDisappear {
@@ -168,32 +154,32 @@ struct TailscaleIntegrationSection: View {
168154 . font ( . callout )
169155 Spacer ( )
170156 Button ( " Refresh " ) {
171- Task { await self . effectiveService . checkTailscaleStatus ( ) }
157+ Task { await self . tailscaleService . checkTailscaleStatus ( ) }
172158 }
173159 . buttonStyle ( . bordered )
174160 . controlSize ( . small )
175161 }
176162 }
177163
178164 private var statusColor : Color {
179- if ! self . effectiveService . isInstalled { return . yellow }
180- if self . effectiveService . isRunning { return . green }
165+ if ! self . tailscaleService . isInstalled { return . yellow }
166+ if self . tailscaleService . isRunning { return . green }
181167 return . orange
182168 }
183169
184170 private var statusText : String {
185- if ! self . effectiveService . isInstalled { return " Tailscale is not installed " }
186- if self . effectiveService . isRunning { return " Tailscale is installed and running " }
171+ if ! self . tailscaleService . isInstalled { return " Tailscale is not installed " }
172+ if self . tailscaleService . isRunning { return " Tailscale is installed and running " }
187173 return " Tailscale is installed but not running "
188174 }
189175
190176 private var installButtons : some View {
191177 HStack ( spacing : 12 ) {
192- Button ( " App Store " ) { self . effectiveService . openAppStore ( ) }
178+ Button ( " App Store " ) { self . tailscaleService . openAppStore ( ) }
193179 . buttonStyle ( . link )
194- Button ( " Direct Download " ) { self . effectiveService . openDownloadPage ( ) }
180+ Button ( " Direct Download " ) { self . tailscaleService . openDownloadPage ( ) }
195181 . buttonStyle ( . link )
196- Button ( " Setup Guide " ) { self . effectiveService . openSetupGuide ( ) }
182+ Button ( " Setup Guide " ) { self . tailscaleService . openSetupGuide ( ) }
197183 . buttonStyle ( . link )
198184 }
199185 . controlSize ( . small )
@@ -217,7 +203,7 @@ struct TailscaleIntegrationSection: View {
217203
218204 @ ViewBuilder
219205 private var accessURLRow : some View {
220- if let host = self . effectiveService . tailscaleHostname {
206+ if let host = self . tailscaleService . tailscaleHostname {
221207 let url = " https:// \( host ) /ui/ "
222208 HStack ( spacing : 8 ) {
223209 Text ( " Dashboard URL: " )
@@ -231,14 +217,14 @@ struct TailscaleIntegrationSection: View {
231217 . font ( . system ( . caption , design : . monospaced ) )
232218 }
233219 }
234- } else if ! self . effectiveService . isRunning {
220+ } else if ! self . tailscaleService . isRunning {
235221 Text ( " Start Tailscale to get your tailnet hostname. " )
236222 . font ( . caption )
237223 . foregroundStyle ( . secondary )
238224 }
239225
240- if self . effectiveService . isAppInstalled , ! self . effectiveService . isRunning {
241- Button ( " Start Tailscale " ) { self . effectiveService . openTailscaleApp ( ) }
226+ if self . tailscaleService . isAppInstalled , ! self . tailscaleService . isRunning {
227+ Button ( " Start Tailscale " ) { self . tailscaleService . openTailscaleApp ( ) }
242228 . buttonStyle ( . borderedProminent )
243229 . controlSize ( . small )
244230 }
@@ -510,7 +496,7 @@ struct TailscaleIntegrationSection: View {
510496 self . stopStatusTimer ( )
511497 if ProcessInfo . processInfo . isRunningTests { return }
512498 self . statusTimer = Timer . scheduledTimer ( withTimeInterval : 5 , repeats : true ) { _ in
513- Task { await self . effectiveService . checkTailscaleStatus ( ) }
499+ Task { await self . tailscaleService . checkTailscaleStatus ( ) }
514500 }
515501 }
516502
@@ -522,26 +508,6 @@ struct TailscaleIntegrationSection: View {
522508
523509#if DEBUG
524510extension TailscaleIntegrationSection {
525- mutating func setTestingState (
526- mode : String ,
527- requireCredentials : Bool ,
528- password : String = " secret " ,
529- statusMessage : String ? = nil ,
530- validationMessage : String ? = nil )
531- {
532- if let mode = GatewayTailscaleMode ( rawValue : mode ) {
533- self . tailscaleMode = mode
534- }
535- self . requireCredentialsForServe = requireCredentials
536- self . password = password
537- self . statusMessage = statusMessage
538- self . validationMessage = validationMessage
539- }
540-
541- mutating func setTestingService ( _ service : TailscaleService ? ) {
542- self . testingService = service
543- }
544-
545511 static func simulateHydrationApplyForTesting (
546512 root : [ String : Any ] ,
547513 connectionMode : AppState . ConnectionMode ,
0 commit comments