Skip to content
Merged
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
10 changes: 10 additions & 0 deletions android/src/main/java/io/refiner/rn/RNRefinerModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ class RNRefinerModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
Refiner.resetUser()
}

@ReactMethod
fun disableClient() {
Refiner.disableClient()
}

@ReactMethod
fun enableClient() {
Refiner.enableClient()
}

@ReactMethod
fun trackEvent(eventName: String?) {
eventName?.let { name ->
Expand Down
10 changes: 10 additions & 0 deletions android/src/main/java/io/refiner/rn/RNRefinerTurboModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ class RNRefinerTurboModule(
Refiner.resetUser()
}

@ReactMethod
override fun disableClient() {
Refiner.disableClient()
}

@ReactMethod
override fun enableClient() {
Refiner.enableClient()
}

@ReactMethod
override fun trackEvent(eventName: String) {
Refiner.trackEvent(eventName)
Expand Down
10 changes: 5 additions & 5 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1558,7 +1558,7 @@ PODS:
- React-logger
- React-perflogger
- React-utils (= 0.76.9)
- refiner-react-native (1.7.5):
- refiner-react-native (1.8.0):
- DoubleConversion
- glog
- hermes-engine
Expand All @@ -1578,9 +1578,9 @@ PODS:
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- RefinerSDK (~> 1.5.10)
- RefinerSDK (~> 1.7.1)
- Yoga
- RefinerSDK (1.5.10)
- RefinerSDK (1.7.1)
- SocketRocket (0.7.1)
- Yoga (0.0.0)

Expand Down Expand Up @@ -1855,8 +1855,8 @@ SPEC CHECKSUMS:
React-utils: ed818f19ab445000d6b5c4efa9d462449326cc9f
ReactCodegen: f853a20cc9125c5521c8766b4b49375fec20648b
ReactCommon: 300d8d9c5cb1a6cd79a67cf5d8f91e4d477195f9
refiner-react-native: e2e15cae75fc003da5426df34c0227ee4e3d6a03
RefinerSDK: cbae1daf927d3c9fddb22f12a0fcf84548c8c84c
refiner-react-native: 0995ef6944bfc7b5ae69e4229353a0c15b3f895c
RefinerSDK: efc3a318824fc21344b9c5aeb0d4bc365a3b1164
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
Yoga: feb4910aba9742cfedc059e2b2902e22ffe9954a

Expand Down
12 changes: 12 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ export interface RefinerSDKInterface extends NativeModule {
*/
resetUser: () => void;

/**
* Disable the SDK client - stops all survey checks and API communication
*/
disableClient: () => void;

/**
* Enable the SDK client - resumes survey checks and API communication
*/
enableClient: () => void;

/**
* Set the project ID
*/
Expand Down Expand Up @@ -198,6 +208,8 @@ export interface NativeRNRefinerSpec {
signature?: string
): void;
resetUser(): void;
disableClient(): void;
enableClient(): void;
trackEvent(eventName: string): void;
trackScreen(screenName: string): void;
ping(): void;
Expand Down
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ const createStubModule = () => {
identifyUser: stubMethod("identifyUser"),
setUser: stubMethod("setUser"),
resetUser: stubMethod("resetUser"),
disableClient: stubMethod("disableClient"),
enableClient: stubMethod("enableClient"),
trackEvent: stubMethod("trackEvent"),
trackScreen: stubMethod("trackScreen"),
ping: stubMethod("ping"),
Expand Down Expand Up @@ -190,6 +192,8 @@ const createRNRefinerWrapper = (nativeModule) => {
}
},
resetUser: () => nativeModule.resetUser(),
disableClient: () => nativeModule.disableClient(),
enableClient: () => nativeModule.enableClient(),
trackEvent: (eventName) => nativeModule.trackEvent(eventName),
trackScreen: (screenName) => nativeModule.trackScreen(screenName),
ping: () => nativeModule.ping(),
Expand Down
2 changes: 2 additions & 0 deletions ios/RNRefiner.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ @interface RCT_EXTERN_MODULE(RNRefiner, RCTEventEmitter)
withLocale:(NSString * _Nullable)locale
withSignature:(NSString * _Nullable)signature)
RCT_EXTERN_METHOD(resetUser)
RCT_EXTERN_METHOD(disableClient)
RCT_EXTERN_METHOD(enableClient)
RCT_EXTERN_METHOD(trackEvent:(NSString *)eventName)
RCT_EXTERN_METHOD(trackScreen:(NSString *)screenName)
RCT_EXTERN_METHOD(ping)
Expand Down
10 changes: 10 additions & 0 deletions ios/RNRefiner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,16 @@ public class RNRefiner: RCTEventEmitter {
func resetUser() {
Refiner.instance.resetUser()
}

@objc
func disableClient() {
Refiner.instance.disableClient()
}

@objc
func enableClient() {
Refiner.instance.enableClient()
}

@objc(trackEvent:)
func trackEvent(_ eventName: String) {
Expand Down
2 changes: 2 additions & 0 deletions ios/RefinerReactNativeSpec/RefinerReactNativeSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
locale:(NSString * _Nullable)locale
signature:(NSString * _Nullable)signature;
- (void)resetUser;
- (void)disableClient;
- (void)enableClient;
- (void)trackEvent:(NSString *)eventName;
- (void)trackScreen:(NSString *)screenName;
- (void)ping;
Expand Down
10 changes: 10 additions & 0 deletions src/NativeRNRefiner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ export interface Spec extends TurboModule {
*/
resetUser(): void;

/**
* Disable the SDK client - stops all survey checks and API communication
*/
disableClient(): void;

/**
* Enable the SDK client - resumes survey checks and API communication
*/
enableClient(): void;

/**
* Track a custom event
*/
Expand Down
Loading