Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Start SDK from RN context #130

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
5 changes: 5 additions & 0 deletions iOS/AppboyReactBridge/AppboyReactBridge/AppboyReactBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,11 @@ - (ABKCardCategory)getCardCategoryForString:(NSString *)category {
[Appboy requestEnableSDKOnNextAppRun];
}

RCT_EXPORT_METHOD(startWithApiKey:(NSString *)brazeKey withLaunchOptions:(nullable NSDictionary *)launchOptions) {
UIApplication *application = [UIApplication sharedApplication];
[Appboy startWithApiKey:brazeKey inApplication:application withLaunchOptions:launchOptions];
}

RCT_EXPORT_METHOD(requestLocationInitialization) {
RCTLogInfo(@"Warning: This is an Android only feature.");
}
Expand Down
5 changes: 5 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,11 @@ export function disableSDK(): void;
*/
export function enableSDK(): void;

/**
* Starts the Braze SDK.
*/
export function startWithApiKey(apiKey: string, options: Record<string, string> | undefined): void;

/**
* Call this method once a user grants location permissions on Android
* to initialize Braze location features. Calling this method is a no-op on
Expand Down
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,13 @@ var ReactAppboy = {
AppboyReactBridge.enableSDK();
},

/**
* Starts the Braze SDK with an API key
*/
startWithApiKey: function(apiKey, options) {
AppboyReactBridge.startWithApiKey(apiKey, options);
},

/**
* Call this method once a user grants location permissions on Android
* to initialize Braze location features. Calling this method is a no-op on
Expand Down