-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: extract isSandboxEnabled into util class for testing, added so…
…me tests - WIP
- Loading branch information
1 parent
5aef5ca
commit 3b277fd
Showing
6 changed files
with
78 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Amplitude-Swift.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// SandboxHelper.swift | ||
// Amplitude-Swift | ||
// | ||
// Created by Justin Fiedler on 2/1/24. | ||
// | ||
|
||
import Foundation | ||
|
||
public class SandboxHelper { | ||
static public func isSandboxEnabled() -> Bool { | ||
#if os(iOS) | ||
// iOS is always sandboxed | ||
return true | ||
#else | ||
// this works on macOS (not iOS), need to test on tvOS | ||
let environment = ProcessInfo.processInfo.environment | ||
return environment["APP_SANDBOX_CONTAINER_ID"] != nil | ||
#endif | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// SandboxHelperTests.swift | ||
// Amplitude-SwiftTests | ||
// | ||
// Created by Justin Fiedler on 2/1/24. | ||
// | ||
|
||
import XCTest | ||
|
||
@testable import AmplitudeSwift | ||
|
||
final class SandboxHelperTests: XCTestCase { | ||
|
||
func testIsSandboxEnabled() { | ||
let isSandboxed = SandboxHelper.isSandboxEnabled() | ||
|
||
#if os(iOS) | ||
XCTAssertEqual(isSandboxed, true) | ||
#else | ||
XCTAssertEqual(isSandboxed, false) | ||
#endif | ||
} | ||
|
||
} |