Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Upgrade to use swift 4.2 #6

Merged
merged 4 commits into from
Apr 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
language: objective-c
osx_image: xcode8.3
script: xcodebuild clean test -project MMPixelSDK.xcodeproj -scheme MMPixelSDK -destination 'platform=iOS Simulator,name=iPhone 7' CODE_SIGNING_REQUIRED=NO
osx_image: xcode10.2
script: xcodebuild clean test -project MMPixelSDK.xcodeproj -scheme MMPixelSDK -destination 'platform=iOS Simulator,name=iPhone 7' CODE_SIGNING_REQUIRED=NO
4 changes: 2 additions & 2 deletions MMPixelExampleApp/MMPixelExampleApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = mediamath.MMPixelExampleApp;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -312,7 +312,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = mediamath.MMPixelExampleApp;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion MMPixelExampleApp/MMPixelExampleApp/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
Expand Down
12 changes: 6 additions & 6 deletions MMPixelSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@
SKIP_INSTALL = YES;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -453,7 +453,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand All @@ -467,7 +467,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = mediamath.MMPixelSDKTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -481,7 +481,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = mediamath.MMPixelSDKTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand All @@ -502,7 +502,7 @@
PRODUCT_BUNDLE_IDENTIFIER = mediamath.CommonCrypto;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -523,7 +523,7 @@
PRODUCT_BUNDLE_IDENTIFIER = mediamath.CommonCrypto;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
8 changes: 8 additions & 0 deletions MMPixelSDK.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
4 changes: 2 additions & 2 deletions MMPixelSDK/MMPixelConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ struct UserAgent {
static func getHardwareString() -> String {
var name: [Int32] = [CTL_HW, HW_MACHINE]
var size: Int = 2
sysctl(&name, 2, nil, &size, &name, 0)
sysctl(&name, 2, nil, &size, nil, 0)
var hw_machine = [CChar](repeating: 0, count: Int(size))
sysctl(&name, 2, &hw_machine, &size, &name, 0)
sysctl(&name, 2, &hw_machine, &size, nil, 0)

let hardware: String = String.init(validatingUTF8: hw_machine)!
return hardware
Expand Down
10 changes: 2 additions & 8 deletions MMPixelSDK/MMPixelSDK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,9 @@ public class MMPixel {
}
else {
// use the IDFA
if let idfaUuuid = ASIdentifierManager.shared().advertisingIdentifier {
idfa = idfaUuuid.uuidString
}
else {
idfa = NSUUID().uuidString
}
idfa = ASIdentifierManager.shared().advertisingIdentifier.uuidString
}



return "?mt_uuid=" + idfa
}

Expand Down
15 changes: 10 additions & 5 deletions MMPixelSDKTests/MMPixelSDKTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,21 @@ class MMPixelSDKTests: XCTestCase {
func testGetAddlParamsString() {
let addlParams = ["test1":"val1", "test2":"val2"]
let str = MMPixel.getAddlParamsString(addlParams: addlParams)
let expected = "test1=val1&test2=val2"

XCTAssertEqual(str, expected, "AddlParams should be url stringified")
let params = str.split(separator: "&")

XCTAssertEqual(params.count, 2, "url should contain the same number of params as AddlParams")
XCTAssertTrue(params.contains("test1=val1"), "AddlParams should be url stringified")
XCTAssertTrue(params.contains("test2=val2"), "AddlParams should be url stringified")
}

func testGetAddlParamsStringWithHashedEmail() {
let addlParams = ["test1":"val1", "test2":"val2", "mt_exem":"test@email.com"]
let str = MMPixel.getAddlParamsString(addlParams: addlParams)
let expected = "test1=val1&test2=val2&mt_exem=73062d872926c2a556f17b36f50e328ddf9bff9d403939bd14b6c3b7f5a33fc2"
let params = str.split(separator: "&")

XCTAssertEqual(str, expected, "AddlParams should be url stringified and include hash")
XCTAssertEqual(params.count, 3, "url should contain the same number of params as AddlParams")
XCTAssertTrue(params.contains("test1=val1"), "AddlParams should be url stringified")
XCTAssertTrue(params.contains("test2=val2"), "AddlParams should be url stringified")
XCTAssertTrue(params.contains("mt_exem=73062d872926c2a556f17b36f50e328ddf9bff9d403939bd14b6c3b7f5a33fc2"), "AddlParams should be url stringified")
}
}