Skip to content

Commit 539f4b2

Browse files
committed
refactor: update disableDeviceForCurrentUser method to public in ReactIterableAPI and enhance Objective-C bridge for improved device management functionality
1 parent e5774bc commit 539f4b2

5 files changed

Lines changed: 23 additions & 13 deletions

File tree

example/src/components/Utility/Utility.tsx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,20 @@ export const Utility = () => {
2929
}}>
3030
<Text style={styles.buttonText}>Iterable.getAttributionInfo()</Text>
3131
</TouchableOpacity>
32-
<TouchableOpacity style={styles.button} onPress={() => {
33-
Iterable.setAttributionInfo({
34-
campaignId: 123,
35-
templateId: 456,
36-
messageId: '789',
37-
});
38-
}}>
39-
<Text style={styles.buttonText}>Iterable.setAttributionInfo()</Text>
40-
</TouchableOpacity>
32+
<TouchableOpacity style={styles.button} onPress={() => {
33+
Iterable.setAttributionInfo({
34+
campaignId: 123,
35+
templateId: 456,
36+
messageId: '789',
37+
});
38+
}}>
39+
<Text style={styles.buttonText}>Iterable.setAttributionInfo()</Text>
40+
</TouchableOpacity>
41+
<TouchableOpacity style={styles.button} onPress={() => {
42+
Iterable.disableDeviceForCurrentUser();
43+
}}>
44+
<Text style={styles.buttonText}>Iterable.disableDeviceForCurrentUser()</Text>
45+
</TouchableOpacity>
4146
</View>
4247
);
4348
};

ios/RNIterableAPI/RNIterableAPI.mm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,11 @@ - (void)setAttributionInfo:(NSDictionary *)attributionInfo
245245
[_swiftAPI setAttributionInfo:attributionInfo];
246246
}
247247

248+
- (void)disableDeviceForCurrentUser
249+
{
250+
NSLog(@"ReactNativeSdk disableDeviceForCurrentUser");
251+
[_swiftAPI disableDeviceForCurrentUser];
252+
}
248253

249254
@end
250255

ios/RNIterableAPI/ReactIterableAPI.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ open class ReactIterableAPI: RCTEventEmitter {
153153
}
154154

155155
@objc(disableDeviceForCurrentUser)
156-
func disableDeviceForCurrentUser() {
156+
public func disableDeviceForCurrentUser() {
157157
ITBInfo()
158158
IterableAPI.disableDeviceForCurrentUser()
159159
}

src/api/NativeRNIterableAPI.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ export interface Spec extends TurboModule {
102102
dict: { [key: string]: string | number | boolean } | null
103103
): void;
104104

105-
// // Device management
106-
// disableDeviceForCurrentUser(): void;
105+
// Device management
106+
disableDeviceForCurrentUser(): void;
107107
// getLastPushPayload(): Promise<{
108108
// [key: string]: string | number | boolean;
109109
// } | null>;

src/core/classes/Iterable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ export class Iterable {
281281
static disableDeviceForCurrentUser() {
282282
Iterable?.logger?.log('disableDeviceForCurrentUser');
283283

284-
RNIterableAPI.disableDeviceForCurrentUser();
284+
api.disableDeviceForCurrentUser();
285285
}
286286

287287
/**

0 commit comments

Comments
 (0)