Skip to content

Commit

Permalink
add comments as documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
KennyHuRadar committed Sep 11, 2024
1 parent 1d7baee commit 041bc57
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
7 changes: 4 additions & 3 deletions Example/Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UIWindowSceneDelegate, UN

// Replace with a valid test publishable key
let radarInitializeOptions = RadarInitializeOptions()
//radarInitializeOptions.autoSetupNotificationConversion = true
// Uncomment to enable automatic setup for notification conversions
// radarInitializeOptions.autoSetupNotificationConversion = true
Radar.initialize(publishableKey: "prj_test_pk_0000000000000000000000000000000000000000", radarInitializeOptions: radarInitializeOptions )
Radar.setUserId("testUserId")
Radar.setMetadata([ "foo": "bar" ])
Expand Down Expand Up @@ -317,8 +318,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UIWindowSceneDelegate, UN
}

func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse) async {
// Do nothing
Radar.logConversion(response: response)
// Uncomment for manual setup for notification conversions
// Radar.logConversion(response: response)
}

func notify(_ body: String) {
Expand Down
24 changes: 23 additions & 1 deletion RadarSDK/Include/Radar.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,17 @@ typedef void (^_Nullable RadarLogConversionCompletionHandler)(RadarStatus status
*/
+ (void)initializeWithPublishableKey:(NSString *_Nonnull)publishableKey NS_SWIFT_NAME(initialize(publishableKey:));

/**
Initializes the Radar SDK.
@warning Call this method from the main thread in your `AppDelegate` class before calling any other Radar methods.
@param publishableKey Your publishable API key.
@param radarInitializeOptions Radar SDK initialization options.
@see https://radar.com/documentation/sdk/ios#initialize-sdk
*/

+ (void)initializeWithPublishableKey:(NSString *)publishableKey radarInitializeOptions:(RadarInitializeOptions *)radarInitializeOptions NS_SWIFT_NAME(initialize(publishableKey:radarInitializeOptions:));
#pragma mark - Properties

Expand Down Expand Up @@ -651,13 +662,20 @@ typedef void (^_Nullable RadarLogConversionCompletionHandler)(RadarStatus status
completionHandler:(RadarLogConversionCompletionHandler)completionHandler NS_SWIFT_NAME(logConversion(name:revenue:metadata:completionHandler:));

/**
logConversionWithNotification
Logs a conversion with a notification
@param request The request associated with the notification
@see https://radar.com/documentation/api#send-a-custom-event
*/
+ (void)logConversionWithNotification:(UNNotificationRequest *_Nullable)request NS_SWIFT_NAME(logConversion(request:));

/**
Logs a conversion with a notification. This should only be used to manually setup logging of notification conversions.
@param response The response associated with user interaction with the notification.
@see https://radar.com/documentation/api#send-a-custom-event
*/

+ (void)logConversionWithNotificationResponse:(UNNotificationResponse *)response NS_SWIFT_NAME(logConversion(response:));

#pragma mark - Trips
Expand Down Expand Up @@ -1208,6 +1226,10 @@ logConversionWithNotification
+ (NSDictionary *)dictionaryForLocation:(CLLocation *)location NS_SWIFT_NAME(dictionaryForLocation(_:));


/**
Perform optional setup for Radar SDK within the app delegate. This method only needs to be called if Radar is initalized in cross platform code.
*/
+ (void) nativeSetup NS_SWIFT_NAME(nativeSetup());

@end
Expand Down

0 comments on commit 041bc57

Please sign in to comment.