Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
marandaneto committed Oct 24, 2023
1 parent 9af3366 commit d7915a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
13 changes: 3 additions & 10 deletions PostHog/PostHogSDK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ let maxRetryDelay = 30.0
}

// register is a reserved word in ObjC
@objc(registerProperty:)
@objc(registerProperties:)
public func register(_ properties: [String: Any]) {
if !isEnabled() {
return
Expand All @@ -234,7 +234,7 @@ let maxRetryDelay = 30.0
}
}

@objc(unregisterProperty:)
@objc(unregisterProperties:)
public func unregister(_ key: String) {
personPropsLock.withLock {
var props = getRegisteredProperties()
Expand Down Expand Up @@ -373,11 +373,6 @@ let maxRetryDelay = 30.0
}

@objc public func alias(_ alias: String) {
self.alias(alias, properties: nil)
}

@objc(aliasWithAlias:properties:)
public func alias(_ alias: String, properties: [String: Any]? = nil) {
if !isEnabled() {
return
}
Expand All @@ -386,9 +381,7 @@ let maxRetryDelay = 30.0
return
}

let props = [
"alias": alias,
].merging(properties ?? [:]) { prop, _ in prop }
let props = ["alias": alias]

queue.add(PostHogEvent(
event: "$create_alias",
Expand Down
5 changes: 2 additions & 3 deletions PostHogObjCExample/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

NSMutableDictionary *registerProps = [NSMutableDictionary dictionary];
props[@"loggedIn"] = @YES;
[[PostHogSDK shared] registerProperty:registerProps];
[[PostHogSDK shared] unregisterProperty:@"test2"];
[[PostHogSDK shared] registerProperties:registerProps];
[[PostHogSDK shared] unregisterProperties:@"test2"];

[[PostHogSDK shared] identify:@"my_new_id"];
[[PostHogSDK shared] identifyWithDistinctId:@"my_new_id" properties:props];
Expand Down Expand Up @@ -79,7 +79,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
[[PostHogSDK shared] groupWithType:@"theType" key:@"theKey" groupProperties:groupProps];

[[PostHogSDK shared] alias:@"theAlias"];
[[PostHogSDK shared] aliasWithAlias:@"theAlias" properties:props];

[[PostHogSDK shared] screen:@"theScreen"];
[[PostHogSDK shared] screenWithTitle:@"theScreen" properties:props];
Expand Down

0 comments on commit d7915a4

Please sign in to comment.