adobe / adobe/aepsdk-react-native

Add support for `collectLaunchInfo`

Open
#592 0 comments 0 reactions 0 assignees View on GitHub
triage-required
Dominant language
TypeScript
Stars
24
Forks
40
Avg merge
4d 11h
Merged PRs (30d)
2

Description

### Prerequisites

- [x] This is not a Security Disclosure, otherwise please follow the guidelines in [Security Policy](https://github.com/adobe/aepsdk-react-native/security/policy).
- [x] I have searched in this repository's issues to see if it has already been reported.

### Feature request summary

`collectLaunchInfo` seems to be required in order to configure adobe target mobile preview for iOS.
(See: https://experienceleague.adobe.com/en/docs/target-dev/developer/mobile-apps/target-mobile-preview)

Doesn't seem to be available, but it is there in the SDK.
(See: https://github.com/adobe/aepsdk-core-ios/blob/22f4cd2af843047d3d6e979da359b16000f3369f/AEPCore/Sources/core/MobileCore.swift#L259)

Could it be exposed? Currently have preview working with a patch-package.

Please correct me if i'm wrong or there is a better approach. Appreciated

### Current behavior

No bridge to `collectLaunchInfo`

### Expected behavior

Bridge to `collectLaunchInfo`

### Additional implementation details or code snippets

this is my patch-package (although for reference i am currently on 7.0.0)

```
diff --git a/node_modules/@adobe/react-native-aepcore/android/src/main/java/com/adobe/marketing/mobile/reactnative/RCTAEPCoreModule.java b/node_modules/@adobe/react-native-aepcore/android/src/main/java/com/adobe/marketing/mobile/reactnative/RCTAEPCoreModule.java
index 44d11c0..eda3c64 100644
--- a/node_modules/@adobe/react-native-aepcore/android/src/main/java/com/adobe/marketing/mobile/reactnative/RCTAEPCoreModule.java
+++ b/node_modules/@adobe/react-native-aepcore/android/src/main/java/com/adobe/marketing/mobile/reactnative/RCTAEPCoreModule.java
@@ -259,6 +259,11 @@ public class RCTAEPCoreModule extends ReactContextBaseJavaModule {
MobileCore.collectPii(RCTAEPMapUtil.toStringMap(data));
}

+ @ReactMethod
+ public void collectLaunchInfo(final ReadableMap info) {
+ MobileCore.collectLaunchInfo(RCTAEPMapUtil.toStringMap(info));
+ }
+
@ReactMethod
public static void setSmallIconResourceID(final int resourceID) {
MobileCore.setSmallIconResourceID(resourceID);
diff --git a/node_modules/@adobe/react-native-aepcore/dist/MobileCore.d.ts b/node_modules/@adobe/react-native-aepcore/dist/MobileCore.d.ts
index dc5186d..404326d 100644
--- a/node_modules/@adobe/react-native-aepcore/dist/MobileCore.d.ts
+++ b/node_modules/@adobe/react-native-aepcore/dist/MobileCore.d.ts
@@ -18,6 +18,7 @@ interface IMobileCore {
setAdvertisingIdentifier: (advertisingIdentifier?: string) => void;
setPushIdentifier: (pushIdentifier?: string) => void;
collectPii: (data: Record) => void;
+ collectLaunchInfo: (info: Record) => void;
setSmallIconResourceID: (resourceID: number) => void;
setLargeIconResourceID: (resourceID: number) => void;
setAppGroup: (appGroup?: string) => void;
diff --git a/node_modules/@adobe/react-native-aepcore/dist/MobileCore.js b/node_modules/@adobe/react-native-aepcore/dist/MobileCore.js
index c578261..59e06f9 100644
--- a/node_modules/@adobe/react-native-aepcore/dist/MobileCore.js
+++ b/node_modules/@adobe/react-native-aepcore/dist/MobileCore.js
@@ -221,6 +221,9 @@ const MobileCore = {
collectPii(data) {
RCTAEPCore.collectPii(data);
},
+ collectLaunchInfo(info) {
+ RCTAEPCore.collectLaunchInfo(info);
+ },
/**
* Sets the resource Id for small icon.
* @param resourceID the resource Id of the icon
diff --git a/node_modules/@adobe/react-native-aepcore/ios/src/Core/RCTAEPCore.m b/node_modules/@adobe/react-native-aepcore/ios/src/Core/RCTAEPCore.m
index 8036044..cbbeb5b 100644
--- a/node_modules/@adobe/react-native-aepcore/ios/src/Core/RCTAEPCore.m
+++ b/node_modules/@adobe/react-native-aepcore/ios/src/Core/RCTAEPCore.m
@@ -109,6 +109,10 @@ - (NSData *)dataFromHexString:(NSString *)string {
[AEPMobileCore collectPii:[RCTAEPCoreDataBridge sanitizeDictionaryToContainClass:[NSString class] WithDictionary:data]];
}

+RCT_EXPORT_METHOD(collectLaunchInfo: (nonnull NSDictionary*) info) {
+ [AEPMobileCore collectLaunchInfo:[RCTAEPCoreDataBridge sanitizeDictionaryToContainClass:[NSString class] WithDictionary:info]];
+}
+
RCT_EXPORT_METHOD(setAdvertisingIdentifier: (nullable NSString*) adId) {
[AEPMobileCore setAdvertisingIdentifier:adId];
}
diff --git a/node_modules/@adobe/react-native-aepcore/src/MobileCore.ts b/node_modules/@adobe/react-native-aepcore/src/MobileCore.ts
index 484b1a5..319bacd 100644
--- a/node_modules/@adobe/react-native-aepcore/src/MobileCore.ts
+++ b/node_modules/@adobe/react-native-aepcore/src/MobileCore.ts
@@ -32,6 +32,7 @@ interface IMobileCore {
setAdvertisingIdentifier: (advertisingIdentifier?: string) => void;
setPushIdentifier: (pushIdentifier?: string) => void;
collectPii: (data: Record) => void;
+ collectLaunchInfo: (info: Record) => void;
setSmallIconResourceID: (resourceID: number) => void;
setLargeIconResourceID: (resourceID: number) => void;
setAppGroup: (appGroup?: string) => void;
@@ -269,6 +270,10 @@ const MobileCore: IMobileCore = {
RCTAEPCore.collectPii(data);
},

+ collectLaunchInfo(info: Record) {
+ RCTAEPCore.collectLaunchInfo(info);
+ },
+
/**
* Sets the resource Id for small icon.
* @param resourceID the resource Id of the icon

```

Contributor guide

Open the contributing guide

Research direction

Start with the existing collectPii bridge in src/MobileCore.ts, dist/MobileCore.d.ts, dist/MobileCore.js, android/src/main/java/com/adobe/marketing/mobile/reactnative/RCTAEPCoreModule.java, and ios/src/Core/RCTAEPCore.m. Compare the native SDK calls and the supplied patch across Android and iOS. Done means collectLaunchInfo is exposed through the TypeScript API and both native bridges.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
mobile
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.