smartech-base-expo-plugin
Version:
Smartech Base Expo SDK's React Native Plugin For React Native Projects.
35 lines (34 loc) • 2.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.deepLinkHandlerSnippet = exports.smartechBaseSnippet = exports.appdelegateSnippet = exports.appdelegate_header_snippet = void 0;
exports.appdelegate_header_snippet = `#import <Smartech/Smartech.h>`;
exports.appdelegateSnippet = {
fileName: 'AppDelegate.h',
smartechHeaderSnippet: '#import <Smartech/Smartech.h>',
hanselHeaderSnippet: '#import <SmartechNudges/Hansel.h>'
};
exports.smartechBaseSnippet = {
smartechInit: `[[Smartech sharedInstance] initSDKWithDelegate:self withLaunchOptions:launchOptions];`,
debugLevel: `[[Smartech sharedInstance] setDebugLevel:SMTLogLevelVerbose];`,
trackAppInstallUpdateBySmartech: `[[Smartech sharedInstance] trackAppInstallUpdateBySmartech];`,
hanselLogSnippet: `[Hansel enableDebugLogs];`,
didfinishRegex: /\(\s*BOOL\s*\)\s*application:(UIApplication\s*)application\s*didFinishLaunchingWithOptions:\s*\(NSDictionary\s*\*\)\s*launchOptions/,
regexPattern: /application\s*:\s*\(UIApplication\s*\*\)\s*application\s*didFinishLaunchingWithOptions\s*:\s*\(NSDictionary\s*\*\)\s*launchOptions/
// // didfinishRegex: /\[super application:application didFinishLaunchingWithOptions/
};
const deepLinkHandlerSnippet = (delayInSeconds) => {
const delayValue = typeof delayInSeconds === 'number' && delayInSeconds > 0
? delayInSeconds
: 1.5;
return [
"#pragma mark - SmartechDelegate Method",
"- (void)handleDeeplinkActionWithURLString:(NSString *)deeplinkURLString andNotificationPayload:(NSDictionary *_Nullable)notificationPayload {",
`dispatch_after(dispatch_time(DISPATCH_TIME_NOW, ${delayValue} * NSEC_PER_SEC), dispatch_get_main_queue(), ^{`,
'NSLog(@"SMTLOGGER DEEPLINK: %@",deeplinkURLString);',
'[[NSNotificationCenter defaultCenter] postNotificationName:kSMTDeeplinkNotificationIdentifier object:nil userInfo:notificationPayload];',
"});",
"}",
"\n",
].join("\n");
};
exports.deepLinkHandlerSnippet = deepLinkHandlerSnippet;