Skip to content

Commit 45c071b

Browse files
committed
replace actionRun Object type with JsonValue
1 parent f5676a2 commit 45c071b

File tree

6 files changed

+38
-8
lines changed

6 files changed

+38
-8
lines changed

android/src/main/java/com/urbanairship/reactnative/AirshipModule.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -455,9 +455,9 @@ class AirshipModule internal constructor(val context: ReactApplicationContext) :
455455
}
456456

457457
@ReactMethod
458-
override fun actionRun(name: String?, value: ReadableMap?, promise: Promise) {
458+
override fun actionRun(name: String?, value: Dynamic?, promise: Promise) {
459459
promise.resolveDeferred<ActionValue> { callback ->
460-
proxy.actions.runAction(requireNotNull(name), Utils.convertMap(value).toJsonValue())
460+
proxy.actions.runAction(requireNotNull(name), Utils.convertDynamic(value))
461461
.addResultCallback { actionResult ->
462462
if (actionResult != null && actionResult.status == ActionResult.STATUS_COMPLETED) {
463463
callback(actionResult.value, null)

android/src/oldarch/java/com/urbanairship/reactnative/AirshipSpec.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ abstract class AirshipSpec internal constructor(context: ReactApplicationContext
241241
@com.facebook.proguard.annotations.DoNotStrip
242242
abstract fun actionRun(
243243
name: String?,
244-
value: ReadableMap?,
244+
value: Dynamic?,
245245
promise: Promise
246246
)
247247

example/ios/Podfile.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ PODS:
964964
- React-Mapbuffer (0.73.4):
965965
- glog
966966
- React-debug
967-
- react-native-airship (17.2.0):
967+
- react-native-airship (17.2.1):
968968
- AirshipFrameworkProxy (= 5.1.1)
969969
- glog
970970
- RCT-Folly (= 2022.05.16.00)
@@ -1407,7 +1407,7 @@ SPEC CHECKSUMS:
14071407
React-jsinspector: 9ac353eccf6ab54d1e0a33862ba91221d1e88460
14081408
React-logger: 0a57b68dd2aec7ff738195f081f0520724b35dab
14091409
React-Mapbuffer: 63913773ed7f96b814a2521e13e6d010282096ad
1410-
react-native-airship: ba50cd2630247d4896f65d6aeb9d7e94ec93ee08
1410+
react-native-airship: 876b0976076f1f85a8dc3722669db2702accfe68
14111411
react-native-safe-area-context: b97eb6f9e3b7f437806c2ce5983f479f8eb5de4b
14121412
React-nativeconfig: d7af5bae6da70fa15ce44f045621cf99ed24087c
14131413
React-NativeModulesApple: 0123905d5699853ac68519607555a9a4f5c7b3ac

example/src/App.tsx

+29
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,40 @@ import MessageCenterScreen from './screens/MessageCenterScreen';
88
import MessageScreen from './screens/MessageScreen';
99
import PreferenceCenterScreen from './screens/PreferenceCenterScreen';
1010
import Airship, { EventType } from '@ua/react-native-airship';
11+
import { CustomEvent } from '@ua/react-native-airship';
1112
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
1213

1314
const Tab = createBottomTabNavigator();
1415
const MessageCenterStack = createStackNavigator();
1516

17+
Airship.takeOff({
18+
default: {
19+
appKey: "VWDwdOFjRTKLRxCeXTVP6g",
20+
appSecret: "5Ifi5rYgTm2QHey9JkP0WA",
21+
logLevel: "verbose"
22+
},
23+
site: "us", // use "eu" for EU cloud projects
24+
urlAllowList: ["*"],
25+
android: {
26+
notificationConfig: {
27+
icon: "ic_notification",
28+
accentColor: "#00ff00"
29+
}
30+
}
31+
});
32+
33+
var customEvent = new CustomEvent("event_name", 123.12);
34+
customEvent.addProperty("my_custom_property", "some custom value");
35+
customEvent.addProperty("is_neat", true);
36+
customEvent.addProperty("any_json", {
37+
"foo": "bar"
38+
});
39+
Airship.analytics.addCustomEvent(customEvent);
40+
41+
42+
var url: string = "ulrich://some-deep-link"
43+
Airship.actions.run("deep_link_action", url);
44+
1645
Airship.addListener(EventType.NotificationResponse, (event) => {
1746
console.log('NotificationResponse:', JSON.stringify(event));
1847
});

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/NativeRTNAirship.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { TurboModule } from 'react-native';
22
import { TurboModuleRegistry } from 'react-native';
3+
import { JsonValue } from './types';
34

45
export interface Spec extends TurboModule {
56
// Airship
@@ -68,7 +69,7 @@ export interface Spec extends TurboModule {
6869
analyticsAssociateIdentifier(key: string, identifier?: string): Promise<void>;
6970

7071
// Action
71-
actionRun(name: string, value?: Object): Promise<Object | Error>;
72+
actionRun(name: string, value?: JsonValue): Promise<Object | Error>;
7273

7374
// Privacy Manager
7475
privacyManagerSetEnabledFeatures(features: string[]): Promise<void>;

0 commit comments

Comments
 (0)