From d7915a474651faae43cb7cc49f12d9fb595fa135 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Tue, 24 Oct 2023 12:08:28 +0200 Subject: [PATCH] review --- PostHog/PostHogSDK.swift | 13 +++---------- PostHogObjCExample/AppDelegate.m | 5 ++--- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/PostHog/PostHogSDK.swift b/PostHog/PostHogSDK.swift index e93ea1697..c5a91f89e 100644 --- a/PostHog/PostHogSDK.swift +++ b/PostHog/PostHogSDK.swift @@ -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 @@ -234,7 +234,7 @@ let maxRetryDelay = 30.0 } } - @objc(unregisterProperty:) + @objc(unregisterProperties:) public func unregister(_ key: String) { personPropsLock.withLock { var props = getRegisteredProperties() @@ -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 } @@ -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", diff --git a/PostHogObjCExample/AppDelegate.m b/PostHogObjCExample/AppDelegate.m index d924aecd9..0f8353f95 100644 --- a/PostHogObjCExample/AppDelegate.m +++ b/PostHogObjCExample/AppDelegate.m @@ -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]; @@ -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];