From 7cd9776f5a59636501f612475487c093bce7fd6a Mon Sep 17 00:00:00 2001 From: Simone Date: Tue, 29 Mar 2022 16:39:00 +0200 Subject: [PATCH 1/4] separate reset functions IOS --- ios/RNZendeskChat.m | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ios/RNZendeskChat.m b/ios/RNZendeskChat.m index f9c789a..691629a 100644 --- a/ios/RNZendeskChat.m +++ b/ios/RNZendeskChat.m @@ -93,12 +93,18 @@ - (void)executeOnMainThread:(void (^)(void))block #define MAX_TAGS_LENGTH 100 #endif -RCT_EXPORT_METHOD(reset) { +RCT_EXPORT_METHOD(resetCustomFields) { [self initGlobals]; - [mutableLog setString:@""]; [customFields removeAllObjects]; +} +RCT_EXPORT_METHOD(resetTags) { + [self initGlobals]; [tags removeAllObjects]; } +RCT_EXPORT_METHOD(resetLog) { + [self initGlobals]; + [mutableLog setString:@""]; +} // dismiss the current controller shown, if any RCT_EXPORT_METHOD(dismiss) { From d622f0ec8e11dc37c71a27d4df14d4864ad07437 Mon Sep 17 00:00:00 2001 From: Simone Date: Tue, 29 Mar 2022 16:39:22 +0200 Subject: [PATCH 2/4] separate reset functions Android --- .../saranshmalik/rnzendeskchat/RNZendeskChat.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/com/saranshmalik/rnzendeskchat/RNZendeskChat.java b/android/src/main/java/com/saranshmalik/rnzendeskchat/RNZendeskChat.java index 7eb03c7..e426af8 100644 --- a/android/src/main/java/com/saranshmalik/rnzendeskchat/RNZendeskChat.java +++ b/android/src/main/java/com/saranshmalik/rnzendeskchat/RNZendeskChat.java @@ -67,12 +67,20 @@ public RNZendeskChat(ReactApplicationContext reactContext) { } @ReactMethod - public void reset() { - log.delete(0, log.length()); + public void resetCustomFields() { customFields.clear(); + } + + @ReactMethod + public void resetTags() { tags.clear(); } + @ReactMethod + public void resetLog() { + log.delete(0, log.length()); + } + @Override public String getName() { return "RNZendeskChat"; From 4cb673e86e44ef6522eeed6fdc4c68f3a123e417 Mon Sep 17 00:00:00 2001 From: Simone Date: Tue, 29 Mar 2022 16:51:00 +0200 Subject: [PATCH 3/4] update definitions --- index.d.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/index.d.ts b/index.d.ts index 7e0f241..f2c5766 100644 --- a/index.d.ts +++ b/index.d.ts @@ -24,8 +24,14 @@ declare module 'io-react-native-zendesk' { // add a new tag to the ticket export function addTicketTag(tag: string) - // remove log data and custom fields - export function reset(): void; + // remove custom fields + export function resetCustomFields(): void; + + // remove tags + export function resetTags(): void; + + // remove log data + export function resetLog(): void; // iOS only - close the current zendesk view (ticket creation, tickets list) if any export function dismiss(): void; From d249e3adb3991f24e55d589492742ea01466980c Mon Sep 17 00:00:00 2001 From: Simone Date: Tue, 29 Mar 2022 17:03:41 +0200 Subject: [PATCH 4/4] update package version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8b9fd9d..4d566c0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "io-react-native-zendesk", - "version": "0.3.20", + "version": "0.3.21", "description": "React native wrapper for Zendesk Unified SDK", "main": "index.js", "scripts": {