Skip to content

Commit 4fb239b

Browse files
DVC-2073 use CFBundleShortVersionString and CFBundleVersion to auto populate appVersion / appBuild
1 parent 62dfc36 commit 4fb239b

File tree

5 files changed

+4
-20
lines changed

5 files changed

+4
-20
lines changed

DevCycle/DVCUser.swift

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,6 @@ public class UserBuilder {
6060
return self
6161
}
6262

63-
public func appVersion(_ appVersion: String) -> UserBuilder {
64-
self.user.appVersion = appVersion
65-
return self
66-
}
67-
68-
public func appBuild(_ appBuild: Int) -> UserBuilder {
69-
self.user.appBuild = appBuild
70-
return self
71-
}
72-
7363
public func customData(_ customData: [String: Any]) -> UserBuilder {
7464
self.customData = customData
7565
return self
@@ -132,6 +122,10 @@ public class DVCUser: Codable {
132122
self.deviceModel = platform.deviceModel
133123
self.sdkType = platform.sdkType
134124
self.sdkVersion = platform.sdkVersion
125+
self.appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
126+
if let appBuildStr = Bundle.main.infoDictionary?["CFBundleVersion"] as? String {
127+
self.appBuild = Int(appBuildStr)
128+
}
135129
}
136130

137131
enum CodingKeys: String, CodingKey {

DevCycle/ObjC/ObjCDVCUser.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ public class ObjCUser: NSObject {
1414
@objc public var name: String?
1515
@objc public var language: String?
1616
@objc public var country: String?
17-
@objc public var appVersion: String?
1817
@objc public var customData: [String: Any]?
1918
@objc public var privateCustomData: [String: Any]?
2019

@@ -47,9 +46,6 @@ public class ObjCUser: NSObject {
4746
if let country = self.country {
4847
userBuilder = userBuilder.country(country)
4948
}
50-
if let appVersion = self.appVersion {
51-
userBuilder = userBuilder.appVersion(appVersion)
52-
}
5349
if let customData = self.customData {
5450
userBuilder = userBuilder.customData(customData)
5551
}

DevCycleTests/ObjC/ObjcDVCUserTests.m

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ - (void)testNonUserIdPropertiesAreNil {
3838
XCTAssertNil(user.email);
3939
XCTAssertNil(user.name);
4040
XCTAssertNil(user.country);
41-
XCTAssertNil(user.appVersion);
4241
XCTAssertNil(user.customData);
4342
XCTAssertNil(user.privateCustomData);
4443
}];
@@ -50,7 +49,6 @@ - (void)testNonUserIdPropertiesAreNotNil {
5049
user.email = @"email.com";
5150
user.name = @"Jason Smith";
5251
user.country = @"CAN";
53-
user.appVersion = @"1.0.0";
5452
DVCClient *client = [DVCClient initialize:@"my_env_key" user:user options:nil onInitialized:^(NSError * _Nullable err) {
5553
XCTAssertNil(err);
5654
XCTAssertNotNil(user);
@@ -59,7 +57,6 @@ - (void)testNonUserIdPropertiesAreNotNil {
5957
XCTAssertEqual(user.email, @"email.com");
6058
XCTAssertEqual(user.name, @"Jason Smith");
6159
XCTAssertEqual(user.country, @"CAN");
62-
XCTAssertEqual(user.appVersion, @"1.0.0");
6360
}];
6461
}
6562

Examples/DevCycle-Example-App-ObjC/DevCycle-Example-App-ObjC/ViewController.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ - (IBAction)loginButtonPressed:(id)sender {
3131
user.userId = @"my-user";
3232
user.name = @"My Name";
3333
user.language = @"EN-CA";
34-
user.appVersion = @"1.0.0";
3534
user.country = @"CA";
3635
user.email = @"[email protected]";
3736

Examples/DevCycle-Example-App/DevCycle-Example-App/ViewController.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ class ViewController: UIViewController {
2727
let user = try? DVCUser.builder()
2828
.userId("my-user1")
2929
30-
.appBuild(1005)
31-
.appVersion("1.1.1")
3230
.country("CA")
3331
.name("Ash Ketchum")
3432
.language("EN")

0 commit comments

Comments
 (0)