mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-03-29 09:35:47 +00:00
Add isTesting to make NSTestCase check more clear
This commit is contained in:
parent
89143b8751
commit
482b32e4e0
4 changed files with 9 additions and 2 deletions
|
|
@ -43,6 +43,7 @@
|
|||
CAA1CB49255A5C97003FD669 /* SignInSMSView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAA1CB48255A5C97003FD669 /* SignInSMSView.swift */; };
|
||||
CAA1CB4D255A5CFD003FD669 /* SignInPhoneListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAA1CB4C255A5CFD003FD669 /* SignInPhoneListView.swift */; };
|
||||
CAA858CD25A3D8BC00ACF8C0 /* ErrorHandling in Frameworks */ = {isa = PBXBuildFile; productRef = CAA858CC25A3D8BC00ACF8C0 /* ErrorHandling */; };
|
||||
CAA8587C25A2B37900ACF8C0 /* IsTesting.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAA8587B25A2B37900ACF8C0 /* IsTesting.swift */; };
|
||||
CABFA9BB2592EEEA00380FEE /* DateFormatter+.swift in Sources */ = {isa = PBXBuildFile; fileRef = CABFA9BA2592EEEA00380FEE /* DateFormatter+.swift */; };
|
||||
CABFA9BD2592EEEA00380FEE /* Environment.swift in Sources */ = {isa = PBXBuildFile; fileRef = CABFA9A92592EEE900380FEE /* Environment.swift */; };
|
||||
CABFA9BF2592EEEA00380FEE /* URLSession+DownloadTaskPublisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = CABFA9B32592EEEA00380FEE /* URLSession+DownloadTaskPublisher.swift */; };
|
||||
|
|
@ -172,6 +173,7 @@
|
|||
CAA1CB44255A5B60003FD669 /* SignIn2FAView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignIn2FAView.swift; sourceTree = "<group>"; };
|
||||
CAA1CB48255A5C97003FD669 /* SignInSMSView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInSMSView.swift; sourceTree = "<group>"; };
|
||||
CAA1CB4C255A5CFD003FD669 /* SignInPhoneListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInPhoneListView.swift; sourceTree = "<group>"; };
|
||||
CAA8587B25A2B37900ACF8C0 /* IsTesting.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IsTesting.swift; sourceTree = "<group>"; };
|
||||
CABFA9A02592EAF500380FEE /* R&PLogo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "R&PLogo.png"; sourceTree = "<group>"; };
|
||||
CABFA9A12592EAFB00380FEE /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
|
||||
CABFA9A32592ED5700380FEE /* Apple.paw */ = {isa = PBXFileReference; lastKnownFileType = file; name = Apple.paw; path = ../xcodes/Apple.paw; sourceTree = "<group>"; };
|
||||
|
|
@ -380,6 +382,7 @@
|
|||
CA9FF9352595B44700E47BAF /* HelperClient.swift */,
|
||||
CAC281D9259F985100B8AB0B /* InstallationStep.swift */,
|
||||
CA9FF8862595607900E47BAF /* InstalledXcode.swift */,
|
||||
CAA8587B25A2B37900ACF8C0 /* IsTesting.swift */,
|
||||
CAE4248B259A68B800B8B246 /* Optional+IsNotNil.swift */,
|
||||
CABFA9AE2592EEE900380FEE /* Path+.swift */,
|
||||
CABFA9B42592EEEA00380FEE /* Process.swift */,
|
||||
|
|
@ -681,6 +684,7 @@
|
|||
CA9FF8662595130600E47BAF /* View+IsHidden.swift in Sources */,
|
||||
CAE4248C259A68B800B8B246 /* Optional+IsNotNil.swift in Sources */,
|
||||
CA9FF9362595B44700E47BAF /* HelperClient.swift in Sources */,
|
||||
CAA8587C25A2B37900ACF8C0 /* IsTesting.swift in Sources */,
|
||||
CABFA9CA2592EEEA00380FEE /* AppState+Update.swift in Sources */,
|
||||
CA44901F2463AD34003D8213 /* Tag.swift in Sources */,
|
||||
CABFA9BF2592EEEA00380FEE /* URLSession+DownloadTaskPublisher.swift in Sources */,
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class AppState: ObservableObject {
|
|||
// MARK: - Init
|
||||
|
||||
init() {
|
||||
guard NSClassFromString("XCTestCase") == nil else { return }
|
||||
guard !isTesting else { return }
|
||||
try? loadCachedAvailableXcodes()
|
||||
checkIfHelperIsInstalled()
|
||||
}
|
||||
|
|
|
|||
3
Xcodes/Backend/IsTesting.swift
Normal file
3
Xcodes/Backend/IsTesting.swift
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import Foundation
|
||||
|
||||
let isTesting = NSClassFromString("XCTestCase") != nil
|
||||
|
|
@ -16,7 +16,7 @@ struct XcodesApp: App {
|
|||
// When used on a View it's also invoked on launch, which doesn't occur with a WindowGroup.
|
||||
// FB8954581 ScenePhase read from App doesn't return a value on launch
|
||||
.onChange(of: scenePhase) { newScenePhase in
|
||||
guard NSClassFromString("XCTestCase") == nil else { return }
|
||||
guard !isTesting else { return }
|
||||
if case .active = newScenePhase {
|
||||
appState.updateIfNeeded()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue