File tree Expand file tree Collapse file tree 5 files changed +29
-13
lines changed
Examples/apps/ObjCExample/ObjCExample Expand file tree Collapse file tree 5 files changed +29
-13
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ @implementation AppDelegate
19
19
- (BOOL )application : (UIApplication *)application didFinishLaunchingWithOptions : (NSDictionary *)launchOptions {
20
20
// Override point for customization after application launch.
21
21
SEGConfiguration *config = [[SEGConfiguration alloc ] initWithWriteKey: @" WRITE_KEY" ];
22
- config.trackApplicationLifecycleEvents = TRUE ;
22
+ config.trackApplicationLifecycleEvents = YES ;
23
23
24
24
SEGAnalytics *analytics = [[SEGAnalytics alloc ] initWithConfiguration: config];
25
25
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ let package = Package(
23
23
. package (
24
24
name: " Sovran " ,
25
25
url: " https://github.com/segmentio/Sovran-Swift.git " ,
26
- from: " 1.0.1 "
26
+ from: " 1.0.2 "
27
27
)
28
28
] ,
29
29
targets: [
Original file line number Diff line number Diff line change 853
853
repositoryURL = "
[email protected] :segmentio/Sovran-Swift.git";
854
854
requirement = {
855
855
kind = upToNextMajorVersion;
856
- minimumVersion = 1.0.0 ;
856
+ minimumVersion = 1.0.2 ;
857
857
};
858
858
};
859
859
/* End XCRemoteSwiftPackageReference section */
Original file line number Diff line number Diff line change @@ -104,6 +104,7 @@ extension Analytics {
104
104
}
105
105
106
106
internal func checkSettings( ) {
107
+ #if DEBUG
107
108
if isUnitTesting {
108
109
// we don't really wanna wait for this network call during tests...
109
110
// but we should make it work similarly.
@@ -116,6 +117,7 @@ extension Analytics {
116
117
}
117
118
return
118
119
}
120
+ #endif
119
121
120
122
let writeKey = self . configuration. values. writeKey
121
123
let httpClient = HTTPClient ( analytics: self , cdnHost: configuration. values. cdnHost)
Original file line number Diff line number Diff line change 7
7
8
8
import Foundation
9
9
10
+ /// Inquire as to whether we are within a Unit Testing environment.
11
+ #if DEBUG
10
12
internal var isUnitTesting : Bool = {
11
- let env = ProcessInfo . processInfo. environment
12
- let value = ( env [ " XCTestConfigurationFilePath " ] != nil )
13
- return value
13
+ // this will work on apple platforms, but fail on linux.
14
+ if NSClassFromString ( " XCTestCase " ) != nil {
15
+ return true
16
+ }
17
+ // this will work on linux and apple platforms, but not in anything with a UI
18
+ // because XCTest doesn't come into the call stack till much later.
19
+ let matches = Thread . callStackSymbols. filter { line in
20
+ return line. contains ( " XCTest " ) || line. contains ( " xctest " )
21
+ }
22
+ if matches. count > 0 {
23
+ return true
24
+ }
25
+ // this will work on CircleCI to correctly detect test running.
26
+ if ProcessInfo . processInfo. environment [ " CIRCLE_WORKFLOW_WORKSPACE_ID " ] != nil {
27
+ return true
28
+ }
29
+ // couldn't see anything that indicated we were testing.
30
+ return false
14
31
} ( )
32
+ #endif
15
33
16
34
internal var isAppExtension : Bool = {
17
35
if Bundle . main. bundlePath. hasSuffix ( " .appex " ) {
@@ -21,11 +39,7 @@ internal var isAppExtension: Bool = {
21
39
} ( )
22
40
23
41
internal func exceptionFailure( _ message: String ) {
24
- if isUnitTesting {
25
- assertionFailure ( message)
26
- } else {
27
- #if DEBUG
28
- assertionFailure ( message)
29
- #endif
30
- }
42
+ #if DEBUG
43
+ assertionFailure ( message)
44
+ #endif
31
45
}
You can’t perform that action at this time.
0 commit comments