@developer_tribe/react-native-comnyx 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/app/build/generated/source/codegen/RCTAppDependencyProvider.h +25 -0
- package/android/app/build/generated/source/codegen/RCTAppDependencyProvider.mm +55 -0
- package/android/app/build/generated/source/codegen/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/android/app/build/generated/source/codegen/RCTModulesConformingToProtocolsProvider.mm +33 -0
- package/android/app/build/generated/source/codegen/RCTThirdPartyComponentsProvider.h +16 -0
- package/android/app/build/generated/source/codegen/RCTThirdPartyComponentsProvider.mm +23 -0
- package/android/app/build/generated/source/codegen/ReactAppDependencyProvider.podspec +34 -0
- package/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeAsyncStorageModuleSpec.java +59 -0
- package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +36 -0
- package/android/app/build/generated/source/codegen/jni/RNComnyxSpec-generated.cpp +22 -0
- package/android/app/build/generated/source/codegen/jni/RNComnyxSpec.h +24 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNComnyxSpec/RNComnyxSpecJSI-generated.cpp +17 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNComnyxSpec/RNComnyxSpecJSI.h +19 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/rnasyncstorage/rnasyncstorageJSI-generated.cpp +72 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/rnasyncstorage/rnasyncstorageJSI.h +116 -0
- package/android/app/build/generated/source/codegen/jni/rnasyncstorage-generated.cpp +62 -0
- package/android/app/build/generated/source/codegen/jni/rnasyncstorage.h +31 -0
- package/android/src/main/java/com/comnyx/ComnyxModule.kt +125 -19
- package/android/src/main/java/com/comnyx/src/messaging/ComnyxMessaging.kt +1 -21
- package/android/src/main/java/com/comnyx/src/messaging/notifications/NotificationsService.kt +36 -19
- package/ios/Comnyx.m +3 -0
- package/ios/Comnyx.swift +44 -4
- package/lib/commonjs/NativeComnyx.js +7 -1
- package/lib/commonjs/NativeComnyx.js.map +1 -1
- package/lib/commonjs/components/ChatList.js +5 -1
- package/lib/commonjs/components/ChatList.js.map +1 -1
- package/lib/commonjs/components/CustomerForm.js +1 -13
- package/lib/commonjs/components/CustomerForm.js.map +1 -1
- package/lib/commonjs/components/EmptyList.js +1 -1
- package/lib/commonjs/components/EmptyList.js.map +1 -1
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/notifications/index.js +1 -0
- package/lib/commonjs/notifications/index.js.map +1 -1
- package/lib/commonjs/register/Accumulator.js +5 -0
- package/lib/commonjs/register/Accumulator.js.map +1 -1
- package/lib/commonjs/register/login.js +1 -0
- package/lib/commonjs/register/login.js.map +1 -1
- package/lib/commonjs/register/logout.js +1 -2
- package/lib/commonjs/register/logout.js.map +1 -1
- package/lib/commonjs/support/ComnyxSupport.js +15 -0
- package/lib/commonjs/support/ComnyxSupport.js.map +1 -1
- package/lib/module/NativeComnyx.js +6 -0
- package/lib/module/NativeComnyx.js.map +1 -1
- package/lib/module/components/ChatList.js +5 -1
- package/lib/module/components/ChatList.js.map +1 -1
- package/lib/module/components/CustomerForm.js +2 -14
- package/lib/module/components/CustomerForm.js.map +1 -1
- package/lib/module/components/EmptyList.js +1 -1
- package/lib/module/components/EmptyList.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/notifications/index.js +1 -0
- package/lib/module/notifications/index.js.map +1 -1
- package/lib/module/register/Accumulator.js +5 -0
- package/lib/module/register/Accumulator.js.map +1 -1
- package/lib/module/register/login.js +1 -0
- package/lib/module/register/login.js.map +1 -1
- package/lib/module/register/logout.js +1 -2
- package/lib/module/register/logout.js.map +1 -1
- package/lib/module/support/ComnyxSupport.js +16 -1
- package/lib/module/support/ComnyxSupport.js.map +1 -1
- package/lib/typescript/src/NativeComnyx.d.ts +8 -2
- package/lib/typescript/src/NativeComnyx.d.ts.map +1 -1
- package/lib/typescript/src/components/ChatList.d.ts +2 -1
- package/lib/typescript/src/components/ChatList.d.ts.map +1 -1
- package/lib/typescript/src/components/CustomerForm.d.ts +2 -1
- package/lib/typescript/src/components/CustomerForm.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/notifications/index.d.ts.map +1 -1
- package/lib/typescript/src/register/Accumulator.d.ts.map +1 -1
- package/lib/typescript/src/register/login.d.ts.map +1 -1
- package/lib/typescript/src/register/logout.d.ts.map +1 -1
- package/lib/typescript/src/support/ComnyxSupport.d.ts.map +1 -1
- package/package.json +14 -1
- package/src/NativeComnyx.ts +9 -2
- package/src/components/ChatList.tsx +12 -2
- package/src/components/CustomerForm.tsx +9 -16
- package/src/components/EmptyList.tsx +1 -1
- package/src/index.ts +1 -0
- package/src/notifications/index.ts +1 -0
- package/src/register/Accumulator.ts +5 -1
- package/src/register/login.ts +1 -0
- package/src/register/logout.ts +1 -2
- package/src/support/ComnyxSupport.tsx +16 -4
- package/android/src/main/java/com/comnyx/src/messaging/permissions/Permissions.kt +0 -64
|
@@ -86,7 +86,12 @@ export class Accumulator {
|
|
|
86
86
|
}
|
|
87
87
|
clear() {
|
|
88
88
|
this.registerData = null;
|
|
89
|
+
if (this.__select_time) {
|
|
90
|
+
clearTimeout(this.__select_time);
|
|
91
|
+
}
|
|
92
|
+
this._isListenerCalledOnce = false;
|
|
89
93
|
}
|
|
94
|
+
//TODO: fix naming -- for testing
|
|
90
95
|
empty() {
|
|
91
96
|
this.registerData = {};
|
|
92
97
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ACCUMULATOR_DEBOUNCE_TIME_IN_MS","Accumulator","registerData","__select_time","undefined","listener","_isListenerCalledOnce","constructor","register","customParameters","integrationParameters","debounce","add","data","Error","customParamsMap","Map","forEach","param","set","name","value","mergedCustomParameters","Array","from","entries","map","flush","reset","setTimeout","clearTimeout","clear","empty","get","isListenerCalledOnce","accumulator"],"sourceRoot":"../../../src","sources":["register/Accumulator.ts"],"mappings":";;AAEA,MAAMA,+BAA+B,GAAG,IAAI;AAE5C,OAAO,MAAMC,WAAW,CAAC;EACfC,YAAY,GAAiC,IAAI;EACjDC,aAAa,GAA+BC,SAAS;EACrDC,QAAQ,GACd,IAAI;EACEC,qBAAqB,GAAY,KAAK;EAC9CC,WAAWA,CAAA,EAAG,CAAC;EAEfC,QAAQA,CAACH,QAAwD,EAAE;IACjE,IAAI,CAACH,YAAY,GAAG;MAClBO,gBAAgB,EAAE,EAAE;MACpBC,qBAAqB,EAAE,CAAC;IAC1B,CAAC;IACD,IAAI,CAACL,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACM,QAAQ,CAAC,CAAC;EACjB;EAEAC,GAAGA,CAACC,IAAwD,EAAE;IAC5D,IAAI,CAAC,IAAI,CAACX,YAAY,EAAE;MACtB,MAAM,IAAIY,KAAK,CAAC,0BAA0B,CAAC;IAC7C;;IAEA;IACA,MAAMC,eAAe,GAAG,IAAIC,GAAG,CAAiB,CAAC;;IAEjD;IACA,CAAC,IAAI,CAACd,YAAY,CAACO,gBAAgB,IAAI,EAAE,EAAEQ,OAAO,CAAEC,KAAK,IAAK;MAC5DH,eAAe,CAACI,GAAG,CAACD,KAAK,CAACE,IAAI,EAAEF,KAAK,CAACG,KAAK,CAAC;IAC9C,CAAC,CAAC;;IAEF;IACA,CAACR,IAAI,CAACJ,gBAAgB,IAAI,EAAE,EAAEQ,OAAO,CAAEC,KAAK,IAAK;MAC/CH,eAAe,CAACI,GAAG,CAACD,KAAK,CAACE,IAAI,EAAEF,KAAK,CAACG,KAAK,CAAC;IAC9C,CAAC,CAAC;;IAEF;IACA,MAAMC,sBAAsB,GAAGC,KAAK,CAACC,IAAI,CAACT,eAAe,CAACU,OAAO,CAAC,CAAC,CAAC,CAACC,GAAG,CACtE,CAAC,CAACN,IAAI,EAAEC,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BAA+B,CAAC;EACrC;EAEA4B,KAAKA,CAAA,EAAG;IACN,IAAI,IAAI,CAACzB,aAAa,EAAE;MACtB2B,YAAY,CAAC,IAAI,CAAC3B,aAAa,CAAC;IAClC;EACF;EAEA4B,KAAKA,CAAA,EAAG;IACN,IAAI,CAAC7B,YAAY,GAAG,IAAI;
|
|
1
|
+
{"version":3,"names":["ACCUMULATOR_DEBOUNCE_TIME_IN_MS","Accumulator","registerData","__select_time","undefined","listener","_isListenerCalledOnce","constructor","register","customParameters","integrationParameters","debounce","add","data","Error","customParamsMap","Map","forEach","param","set","name","value","mergedCustomParameters","Array","from","entries","map","flush","reset","setTimeout","clearTimeout","clear","empty","get","isListenerCalledOnce","accumulator"],"sourceRoot":"../../../src","sources":["register/Accumulator.ts"],"mappings":";;AAEA,MAAMA,+BAA+B,GAAG,IAAI;AAE5C,OAAO,MAAMC,WAAW,CAAC;EACfC,YAAY,GAAiC,IAAI;EACjDC,aAAa,GAA+BC,SAAS;EACrDC,QAAQ,GACd,IAAI;EACEC,qBAAqB,GAAY,KAAK;EAC9CC,WAAWA,CAAA,EAAG,CAAC;EAEfC,QAAQA,CAACH,QAAwD,EAAE;IACjE,IAAI,CAACH,YAAY,GAAG;MAClBO,gBAAgB,EAAE,EAAE;MACpBC,qBAAqB,EAAE,CAAC;IAC1B,CAAC;IACD,IAAI,CAACL,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACM,QAAQ,CAAC,CAAC;EACjB;EAEAC,GAAGA,CAACC,IAAwD,EAAE;IAC5D,IAAI,CAAC,IAAI,CAACX,YAAY,EAAE;MACtB,MAAM,IAAIY,KAAK,CAAC,0BAA0B,CAAC;IAC7C;;IAEA;IACA,MAAMC,eAAe,GAAG,IAAIC,GAAG,CAAiB,CAAC;;IAEjD;IACA,CAAC,IAAI,CAACd,YAAY,CAACO,gBAAgB,IAAI,EAAE,EAAEQ,OAAO,CAAEC,KAAK,IAAK;MAC5DH,eAAe,CAACI,GAAG,CAACD,KAAK,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tB,MAAM,IAAIY,KAAK,CAAC,0BAA0B,CAAC;IAC7C;IACA,IAAI,CAACc,KAAK,CAAC,CAAC;IACZ,IAAI,CAACzB,aAAa,GAAG0B,UAAU,CAAC,MAAM;MACpC,IAAI,IAAI,CAACxB,QAAQ,EAAE;QACjB,IAAI,CAACA,QAAQ,CAAC,IAAI,CAACH,YAAa,CAAC;QACjC,IAAI,CAACA,YAAY,GAAG;UAClB,GAAG,IAAI,CAACA,YAAa;UACrBO,gBAAgB,EAAE;QACpB,CAAC;QACD,IAAI,CAACH,qBAAqB,GAAG,IAAI;MACnC;IACF,CAAC,EAAEN,+BAA+B,CAAC;EACrC;EAEA4B,KAAKA,CAAA,EAAG;IACN,IAAI,IAAI,CAACzB,aAAa,EAAE;MACtB2B,YAAY,CAAC,IAAI,CAAC3B,aAAa,CAAC;IAClC;EACF;EAEA4B,KAAKA,CAAA,EAAG;IACN,IAAI,CAAC7B,YAAY,GAAG,IAAI;IACxB,IAAI,IAAI,CAACC,aAAa,EAAE;MACtB2B,YAAY,CAAC,IAAI,CAAC3B,aAAa,CAAC;IAClC;IACA,IAAI,CAACG,qBAAqB,GAAG,KAAK;EACpC;EACA;EACA0B,KAAKA,CAAA,EAAG;IACN,IAAI,CAAC9B,YAAY,GAAG,CAAC,CAAC;EACxB;EAEA+B,GAAGA,CAAA,EAAG;IACJ,OAAO,IAAI,CAAC/B,YAAY;EAC1B;EAEAgC,oBAAoBA,CAAA,EAAG;IACrB,OAAO,IAAI,CAAC5B,qBAAqB;EACnC;AACF;AAEA,OAAO,MAAM6B,WAAW,GAAG,IAAIlC,WAAW,CAAC,CAAC","ignoreList":[]}
|
|
@@ -11,6 +11,7 @@ export function login(loginOptions) {
|
|
|
11
11
|
if (!loginOptions.externalId) {
|
|
12
12
|
throw new Error('External ID is required for initialization');
|
|
13
13
|
}
|
|
14
|
+
accumulator.clear();
|
|
14
15
|
accumulator.register(async accumulatedData => {
|
|
15
16
|
const data = await updateCustomer(accumulatedData, loginOptions.externalId);
|
|
16
17
|
setLoginForAxios(loginOptions.externalId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["accumulator","isInitCalled","setLoginForAxios","useAppStore","updateCustomer","login","loginOptions","Error","externalId","register","accumulatedData","data","getState","setCustomer","customer"],"sourceRoot":"../../../src","sources":["register/login.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,kBAAe;AAC3C,SAASC,YAAY,EAAEC,gBAAgB,QAAQ,eAAY;AAE3D,SAASC,WAAW,QAAQ,mBAAgB;AAC5C,SAASC,cAAc,QAAQ,qBAAkB;AAMjD,OAAO,SAASC,KAAKA,CAACC,YAA0B,EAAE;EAChD,IAAI,CAACL,YAAY,CAAC,CAAC,EAAE;IACnB,MAAM,IAAIM,KAAK,CAAC,wCAAwC,CAAC;EAC3D;EACA,IAAI,CAACD,YAAY,CAACE,UAAU,EAAE;IAC5B,MAAM,IAAID,KAAK,CAAC,4CAA4C,CAAC;EAC/D;EACAP,WAAW,CAACS,QAAQ,CAAC,MAAOC,eAAsC,IAAK;IACrE,MAAMC,IAAI,GAAG,
|
|
1
|
+
{"version":3,"names":["accumulator","isInitCalled","setLoginForAxios","useAppStore","updateCustomer","login","loginOptions","Error","externalId","clear","register","accumulatedData","data","getState","setCustomer","customer"],"sourceRoot":"../../../src","sources":["register/login.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,kBAAe;AAC3C,SAASC,YAAY,EAAEC,gBAAgB,QAAQ,eAAY;AAE3D,SAASC,WAAW,QAAQ,mBAAgB;AAC5C,SAASC,cAAc,QAAQ,qBAAkB;AAMjD,OAAO,SAASC,KAAKA,CAACC,YAA0B,EAAE;EAChD,IAAI,CAACL,YAAY,CAAC,CAAC,EAAE;IACnB,MAAM,IAAIM,KAAK,CAAC,wCAAwC,CAAC;EAC3D;EACA,IAAI,CAACD,YAAY,CAACE,UAAU,EAAE;IAC5B,MAAM,IAAID,KAAK,CAAC,4CAA4C,CAAC;EAC/D;EACAP,WAAW,CAACS,KAAK,CAAC,CAAC;EACnBT,WAAW,CAACU,QAAQ,CAAC,MAAOC,eAAsC,IAAK;IACrE,MAAMC,IAAI,GAAG,MAAMR,cAAc,CAACO,eAAe,EAAEL,YAAY,CAACE,UAAU,CAAC;IAC3EN,gBAAgB,CAACI,YAAY,CAACE,UAAU,CAAC;IACzCL,WAAW,CAACU,QAAQ,CAAC,CAAC,CAACC,WAAW,CAACF,IAAI,CAACG,QAAQ,CAAC;EACnD,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -4,8 +4,7 @@ import { setLogoutForAxios } from "../api/api.js";
|
|
|
4
4
|
import { useAppStore } from "../store/store.js";
|
|
5
5
|
import { accumulator } from "./Accumulator.js";
|
|
6
6
|
export async function logout() {
|
|
7
|
-
accumulator.
|
|
8
|
-
await accumulator.flush();
|
|
7
|
+
accumulator.clear();
|
|
9
8
|
setLogoutForAxios();
|
|
10
9
|
//TODO: state
|
|
11
10
|
useAppStore.setState({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["setLogoutForAxios","useAppStore","accumulator","logout","
|
|
1
|
+
{"version":3,"names":["setLogoutForAxios","useAppStore","accumulator","logout","clear","setState","customer","formSubmitted"],"sourceRoot":"../../../src","sources":["register/logout.ts"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,eAAY;AAC9C,SAASC,WAAW,QAAQ,mBAAgB;AAC5C,SAASC,WAAW,QAAQ,kBAAe;AAE3C,OAAO,eAAeC,MAAMA,CAAA,EAAG;EAC7BD,WAAW,CAACE,KAAK,CAAC,CAAC;EACnBJ,iBAAiB,CAAC,CAAC;EACnB;EACAC,WAAW,CAACI,QAAQ,CAAC;IACnBC,QAAQ,EAAE,IAAI;IACdC,aAAa,EAAE;EACjB,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
import { View, TouchableOpacity, Image } from 'react-native';
|
|
4
4
|
import { ChatList } from "../components/ChatList.js";
|
|
5
5
|
import { CustomerForm } from "../components/CustomerForm.js";
|
|
6
|
-
import { useEffect } from 'react';
|
|
6
|
+
import { useEffect, useState } from 'react';
|
|
7
7
|
import { AppText } from "../components/AppText.js";
|
|
8
8
|
import { useThemeColors } from "../hooks/useThemeColors.js";
|
|
9
9
|
import { usePolling } from "../hooks/usePolling.js";
|
|
10
10
|
import { useAppStore } from "../store/store.js";
|
|
11
11
|
import { ScaledSheet } from "../components/ScaledSheet.js";
|
|
12
|
+
import { accumulator } from "../register/Accumulator.js";
|
|
12
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
14
|
const closeIcon = require('../assets/x-close.png');
|
|
14
15
|
export function ComnyxSupport({
|
|
@@ -27,6 +28,18 @@ export function ComnyxSupport({
|
|
|
27
28
|
}));
|
|
28
29
|
const themeColors = useThemeColors();
|
|
29
30
|
usePolling();
|
|
31
|
+
const [initLoading, setInitLoading] = useState(true);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (!accumulator.isListenerCalledOnce()) {
|
|
34
|
+
accumulator.flush().then(() => {
|
|
35
|
+
setTimeout(() => {
|
|
36
|
+
setInitLoading(false);
|
|
37
|
+
}, 100);
|
|
38
|
+
});
|
|
39
|
+
} else {
|
|
40
|
+
setInitLoading(false);
|
|
41
|
+
}
|
|
42
|
+
}, []);
|
|
30
43
|
useEffect(() => {
|
|
31
44
|
if (customer === null || !customer.external_id) {
|
|
32
45
|
useAppStore.setState({
|
|
@@ -70,6 +83,7 @@ export function ComnyxSupport({
|
|
|
70
83
|
} else if (!formSubmitted) {
|
|
71
84
|
//NOTE: customer var ama forSubmitted false (name===null)
|
|
72
85
|
return /*#__PURE__*/_jsx(CustomerForm, {
|
|
86
|
+
loading: initLoading,
|
|
73
87
|
onBack: onBack
|
|
74
88
|
});
|
|
75
89
|
}
|
|
@@ -78,6 +92,7 @@ export function ComnyxSupport({
|
|
|
78
92
|
backgroundColor: themeColors.background
|
|
79
93
|
}],
|
|
80
94
|
children: /*#__PURE__*/_jsx(ChatList, {
|
|
95
|
+
initLoading: initLoading,
|
|
81
96
|
onBack: onBack
|
|
82
97
|
})
|
|
83
98
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["View","TouchableOpacity","Image","ChatList","CustomerForm","useEffect","AppText","useThemeColors","usePolling","useAppStore","ScaledSheet","jsx","_jsx","jsxs","_jsxs","closeIcon","require","ComnyxSupport","language","theme","fake","onBack","themes","customer","formSubmitted","s","themeColors","external_id","setState","data","getState","setLanguage","setTheme","setFake","setThemes","style","styles","container","backgroundColor","background","justifyContent","children","activeOpacity","iconContainer","onPress","source","tintColor","text","textAlign","localization","create","flex","position","top","left","width","height"],"sourceRoot":"../../../src","sources":["support/ComnyxSupport.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,gBAAgB,EAAEC,KAAK,QAAQ,cAAc;AAC5D,SAASC,QAAQ,QAAQ,2BAAwB;AACjD,SAASC,YAAY,QAAQ,+BAA4B;AAEzD,SAASC,SAAS,QAAQ,OAAO;
|
|
1
|
+
{"version":3,"names":["View","TouchableOpacity","Image","ChatList","CustomerForm","useEffect","useState","AppText","useThemeColors","usePolling","useAppStore","ScaledSheet","accumulator","jsx","_jsx","jsxs","_jsxs","closeIcon","require","ComnyxSupport","language","theme","fake","onBack","themes","customer","formSubmitted","s","themeColors","initLoading","setInitLoading","isListenerCalledOnce","flush","then","setTimeout","external_id","setState","data","getState","setLanguage","setTheme","setFake","setThemes","style","styles","container","backgroundColor","background","justifyContent","children","activeOpacity","iconContainer","onPress","source","tintColor","text","textAlign","localization","loading","create","flex","position","top","left","width","height"],"sourceRoot":"../../../src","sources":["support/ComnyxSupport.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,gBAAgB,EAAEC,KAAK,QAAQ,cAAc;AAC5D,SAASC,QAAQ,QAAQ,2BAAwB;AACjD,SAASC,YAAY,QAAQ,+BAA4B;AAEzD,SAASC,SAAS,EAAEC,QAAQ,QAAQ,OAAO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C;IAAA,CACE,CAAC;EAEX,CAAC,MAAM,IAAI,CAAC/B,aAAa,EAAE;IACzB;IACA,oBAAOZ,IAAA,CAACV,YAAY;MAACsD,OAAO,EAAE7B,WAAY;MAACN,MAAM,EAAEA;IAAO,CAAE,CAAC;EAC/D;EAEA,oBACET,IAAA,CAACd,IAAI;IACH2C,KAAK,EAAE,CAACC,MAAM,CAACC,SAAS,EAAE;MAAEC,eAAe,EAAElB,WAAW,CAACmB;IAAW,CAAC,CAAE;IAAAE,QAAA,eAEvEnC,IAAA,CAACX,QAAQ;MAAC0B,WAAW,EAAEA,WAAY;MAACN,MAAM,EAAEA;IAAO,CAAE;EAAC,CAClD,CAAC;AAEX;AAEA,MAAMqB,MAAM,GAAGjC,WAAW,CAACgD,MAAM,CAAC;EAChCd,SAAS,EAAE;IACTe,IAAI,EAAE;EACR,CAAC;EACDT,aAAa,EAAE;IACbU,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,OAAO;IACZC,IAAI,EAAE;EACR,CAAC;EACD9C,SAAS,EAAE;IACT+C,KAAK,EAAE,OAAO;IACdC,MAAM,EAAE;EACV;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
export declare enum NotificationPermissionStatus {
|
|
2
|
+
GRANTED = "granted",
|
|
3
|
+
DENIED = "denied",
|
|
4
|
+
BLOCKED = "blocked"
|
|
5
|
+
}
|
|
1
6
|
export interface NativeComnyx {
|
|
2
7
|
initialize(): Promise<boolean>;
|
|
3
|
-
checkOptIn(): Promise<
|
|
4
|
-
optIn(): Promise<
|
|
8
|
+
checkOptIn(): Promise<NotificationPermissionStatus>;
|
|
9
|
+
optIn(): Promise<NotificationPermissionStatus>;
|
|
10
|
+
linkToSettings(): Promise<boolean>;
|
|
5
11
|
}
|
|
6
12
|
export declare const nativeComnyx: NativeComnyx;
|
|
7
13
|
//# sourceMappingURL=NativeComnyx.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeComnyx.d.ts","sourceRoot":"","sources":["../../../src/NativeComnyx.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/B,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/
|
|
1
|
+
{"version":3,"file":"NativeComnyx.d.ts","sourceRoot":"","sources":["../../../src/NativeComnyx.ts"],"names":[],"mappings":"AAEA,oBAAY,4BAA4B;IACtC,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/B,UAAU,IAAI,OAAO,CAAC,4BAA4B,CAAC,CAAC;IACpD,KAAK,IAAI,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAC/C,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CACpC;AAED,eAAO,MAAM,YAAY,cAAuC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatList.d.ts","sourceRoot":"","sources":["../../../../src/components/ChatList.tsx"],"names":[],"mappings":"AAwCA,wBAAgB,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"ChatList.d.ts","sourceRoot":"","sources":["../../../../src/components/ChatList.tsx"],"names":[],"mappings":"AAwCA,wBAAgB,QAAQ,CAAC,EACvB,WAAW,EACX,MAAM,GACP,EAAE;IACD,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB,2CA+nBA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomerForm.d.ts","sourceRoot":"","sources":["../../../../src/components/CustomerForm.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CustomerForm.d.ts","sourceRoot":"","sources":["../../../../src/components/CustomerForm.tsx"],"names":[],"mappings":"AAqCA,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,MAAM,GACP,EAAE;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,2CAuSA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { Comnyx } from './register';
|
|
2
2
|
export { ComnyxSupport } from './support';
|
|
3
3
|
export { ComnyxNotifications } from './notifications';
|
|
4
|
+
export { NotificationPermissionStatus } from './NativeComnyx';
|
|
4
5
|
export { registerOneSignalForComnyx } from './register/collectData';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAG9D,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/notifications/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGlE,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAOlE,KAAK,4BAA4B,GAC7B,YAAY,GACZ,cAAc,GACd,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8BAA8B,CAAC,CAAC,CAAC,KAAK,IAAI,GAC3D,mBAAmB,CAAC;CACxB;AAED,eAAO,MAAM,mBAAmB,EAAE,uBAajC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accumulator.d.ts","sourceRoot":"","sources":["../../../../src/register/Accumulator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAI/D,qBAAa,WAAW;IACtB,OAAO,CAAC,YAAY,CAAsC;IAC1D,OAAO,CAAC,aAAa,CAAyC;IAC9D,OAAO,CAAC,QAAQ,CACT;IACP,OAAO,CAAC,qBAAqB,CAAkB;;IAG/C,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,qBAAqB,KAAK,OAAO,CAAC,IAAI,CAAC;IASjE,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,YAAY,CAAC,CAAC;IAsCtD,KAAK;IAeX,QAAQ;IAiBR,KAAK;IAML,KAAK;
|
|
1
|
+
{"version":3,"file":"Accumulator.d.ts","sourceRoot":"","sources":["../../../../src/register/Accumulator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAI/D,qBAAa,WAAW;IACtB,OAAO,CAAC,YAAY,CAAsC;IAC1D,OAAO,CAAC,aAAa,CAAyC;IAC9D,OAAO,CAAC,QAAQ,CACT;IACP,OAAO,CAAC,qBAAqB,CAAkB;;IAG/C,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,qBAAqB,KAAK,OAAO,CAAC,IAAI,CAAC;IASjE,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,YAAY,CAAC,CAAC;IAsCtD,KAAK;IAeX,QAAQ;IAiBR,KAAK;IAML,KAAK;IAQL,KAAK;IAIL,GAAG;IAIH,oBAAoB;CAGrB;AAED,eAAO,MAAM,WAAW,aAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../../src/register/login.ts"],"names":[],"mappings":"AAMA,UAAU,YAAY;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,KAAK,CAAC,YAAY,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../../src/register/login.ts"],"names":[],"mappings":"AAMA,UAAU,YAAY;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,KAAK,CAAC,YAAY,EAAE,YAAY,QAa/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../../src/register/logout.ts"],"names":[],"mappings":"AAIA,wBAAsB,MAAM,
|
|
1
|
+
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../../src/register/logout.ts"],"names":[],"mappings":"AAIA,wBAAsB,MAAM,kBAQ3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComnyxSupport.d.ts","sourceRoot":"","sources":["../../../../src/support/ComnyxSupport.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"ComnyxSupport.d.ts","sourceRoot":"","sources":["../../../../src/support/ComnyxSupport.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAUtD,UAAU,kBAAkB;IAC1B,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAe,EACf,KAAc,EACd,IAAY,EACZ,MAAM,EACN,MAAM,GACP,EAAE,kBAAkB,2CAwEpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@developer_tribe/react-native-comnyx",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "React Native chat component with integrated support panel, enabling real-time customer communication and efficient agent workflow management.",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./lib/commonjs/index.js",
|
|
@@ -38,6 +38,19 @@
|
|
|
38
38
|
"!**/__mocks__",
|
|
39
39
|
"!**/.*"
|
|
40
40
|
],
|
|
41
|
+
"codegenConfig": {
|
|
42
|
+
"name": "RNComnyxSpec",
|
|
43
|
+
"type": "modules",
|
|
44
|
+
"jsSrcsDir": "src",
|
|
45
|
+
"outputDir": {
|
|
46
|
+
"ios": "ios/generated",
|
|
47
|
+
"android": "android/generated"
|
|
48
|
+
},
|
|
49
|
+
"android": {
|
|
50
|
+
"javaPackageName": "com.comnyx"
|
|
51
|
+
},
|
|
52
|
+
"includesGeneratedCode": true
|
|
53
|
+
},
|
|
41
54
|
"scripts": {
|
|
42
55
|
"test": "jest --config jest.config.ts",
|
|
43
56
|
"typecheck": "tsc",
|
package/src/NativeComnyx.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { NativeModules } from 'react-native';
|
|
2
2
|
|
|
3
|
+
export enum NotificationPermissionStatus {
|
|
4
|
+
GRANTED = 'granted',
|
|
5
|
+
DENIED = 'denied',
|
|
6
|
+
BLOCKED = 'blocked',
|
|
7
|
+
}
|
|
8
|
+
|
|
3
9
|
export interface NativeComnyx {
|
|
4
10
|
initialize(): Promise<boolean>;
|
|
5
|
-
checkOptIn(): Promise<
|
|
6
|
-
optIn(): Promise<
|
|
11
|
+
checkOptIn(): Promise<NotificationPermissionStatus>;
|
|
12
|
+
optIn(): Promise<NotificationPermissionStatus>;
|
|
13
|
+
linkToSettings(): Promise<boolean>;
|
|
7
14
|
}
|
|
8
15
|
|
|
9
16
|
export const nativeComnyx = NativeModules.Comnyx as NativeComnyx;
|
|
@@ -38,7 +38,13 @@ function LoadingItem() {
|
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
export function ChatList({
|
|
41
|
+
export function ChatList({
|
|
42
|
+
initLoading,
|
|
43
|
+
onBack,
|
|
44
|
+
}: {
|
|
45
|
+
initLoading: boolean;
|
|
46
|
+
onBack?: () => void;
|
|
47
|
+
}) {
|
|
42
48
|
const themeColors = useThemeColors();
|
|
43
49
|
const { height: windowHeight } = useWindowDimensions();
|
|
44
50
|
const MESSAGE_MIN_HEIGHT = 60;
|
|
@@ -46,7 +52,11 @@ export function ChatList({ onBack }: { onBack?: () => void }) {
|
|
|
46
52
|
const MESSAGES_PER_PAGE = Math.ceil(
|
|
47
53
|
(windowHeight - FLATLIST_PADDING) / MESSAGE_MIN_HEIGHT
|
|
48
54
|
);
|
|
49
|
-
const [loading, setLoading] = useState(
|
|
55
|
+
const [loading, setLoading] = useState(initLoading);
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
setLoading((l) => l && initLoading);
|
|
58
|
+
}, [initLoading]);
|
|
59
|
+
|
|
50
60
|
const { data, setData, customer, language } = useAppStore((s) => ({
|
|
51
61
|
data: s.data,
|
|
52
62
|
setData: s.setData,
|
|
@@ -14,11 +14,10 @@ import { AppText } from './AppText';
|
|
|
14
14
|
import { useLocalize } from '../hooks/useLocalize';
|
|
15
15
|
import { useThemeColors } from '../hooks/useThemeColors';
|
|
16
16
|
import CustomPopup from './CustomAlert';
|
|
17
|
-
import {
|
|
17
|
+
import { useState } from 'react';
|
|
18
18
|
import { ScaledSheet } from './ScaledSheet';
|
|
19
19
|
import type { LocalizationKeys } from '../types/LocalizationKeys';
|
|
20
20
|
import { activeOpacity } from '../constants/activeOpacity';
|
|
21
|
-
import { accumulator } from '../register/Accumulator';
|
|
22
21
|
import { useAppStore } from '../store/store';
|
|
23
22
|
|
|
24
23
|
interface CustomerFormData {
|
|
@@ -36,13 +35,19 @@ interface InfoButtonProps {
|
|
|
36
35
|
description: string;
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
export function CustomerForm({
|
|
38
|
+
export function CustomerForm({
|
|
39
|
+
loading,
|
|
40
|
+
onBack,
|
|
41
|
+
}: {
|
|
42
|
+
loading: boolean;
|
|
43
|
+
onBack: () => void;
|
|
44
|
+
}) {
|
|
40
45
|
const {
|
|
41
46
|
control,
|
|
42
47
|
handleSubmit,
|
|
43
48
|
formState: { errors },
|
|
44
49
|
} = useForm<CustomerFormData>();
|
|
45
|
-
|
|
50
|
+
|
|
46
51
|
const themeColors = useThemeColors();
|
|
47
52
|
const localize = useLocalize();
|
|
48
53
|
|
|
@@ -58,18 +63,6 @@ export function CustomerForm({ onBack }: { onBack: () => void }) {
|
|
|
58
63
|
description: 'null',
|
|
59
64
|
});
|
|
60
65
|
|
|
61
|
-
useEffect(() => {
|
|
62
|
-
if (!accumulator.isListenerCalledOnce()) {
|
|
63
|
-
accumulator.flush().then(() => {
|
|
64
|
-
setTimeout(() => {
|
|
65
|
-
setLoading(false);
|
|
66
|
-
}, 100);
|
|
67
|
-
});
|
|
68
|
-
} else {
|
|
69
|
-
setLoading(false);
|
|
70
|
-
}
|
|
71
|
-
}, []);
|
|
72
|
-
|
|
73
66
|
const onSubmit = async (data: CustomerFormData) => {
|
|
74
67
|
try {
|
|
75
68
|
const res = await createCustomer(
|
package/src/index.ts
CHANGED
|
@@ -38,6 +38,7 @@ export const ComnyxNotifications: ComnyxNotificationsType = {
|
|
|
38
38
|
initialize: nativeComnyx.initialize,
|
|
39
39
|
optIn: nativeComnyx.optIn,
|
|
40
40
|
checkOptIn: nativeComnyx.checkOptIn,
|
|
41
|
+
linkToSettings: nativeComnyx.linkToSettings,
|
|
41
42
|
addEventListener: function <T extends ComnyxNotificationsEventType>(
|
|
42
43
|
eventType: T,
|
|
43
44
|
listener: (event: ComnyxNotificationsEventResult[T]) => void
|
|
@@ -97,8 +97,12 @@ export class Accumulator {
|
|
|
97
97
|
|
|
98
98
|
clear() {
|
|
99
99
|
this.registerData = null;
|
|
100
|
+
if (this.__select_time) {
|
|
101
|
+
clearTimeout(this.__select_time);
|
|
102
|
+
}
|
|
103
|
+
this._isListenerCalledOnce = false;
|
|
100
104
|
}
|
|
101
|
-
|
|
105
|
+
//TODO: fix naming -- for testing
|
|
102
106
|
empty() {
|
|
103
107
|
this.registerData = {};
|
|
104
108
|
}
|
package/src/register/login.ts
CHANGED
|
@@ -15,6 +15,7 @@ export function login(loginOptions: LoginOptions) {
|
|
|
15
15
|
if (!loginOptions.externalId) {
|
|
16
16
|
throw new Error('External ID is required for initialization');
|
|
17
17
|
}
|
|
18
|
+
accumulator.clear();
|
|
18
19
|
accumulator.register(async (accumulatedData: CreateCustomerRequest) => {
|
|
19
20
|
const data = await updateCustomer(accumulatedData, loginOptions.externalId);
|
|
20
21
|
setLoginForAxios(loginOptions.externalId);
|
package/src/register/logout.ts
CHANGED
|
@@ -3,8 +3,7 @@ import { useAppStore } from '../store/store';
|
|
|
3
3
|
import { accumulator } from './Accumulator';
|
|
4
4
|
|
|
5
5
|
export async function logout() {
|
|
6
|
-
accumulator.
|
|
7
|
-
await accumulator.flush();
|
|
6
|
+
accumulator.clear();
|
|
8
7
|
setLogoutForAxios();
|
|
9
8
|
//TODO: state
|
|
10
9
|
useAppStore.setState({
|
|
@@ -2,12 +2,13 @@ import { View, TouchableOpacity, Image } from 'react-native';
|
|
|
2
2
|
import { ChatList } from '../components/ChatList';
|
|
3
3
|
import { CustomerForm } from '../components/CustomerForm';
|
|
4
4
|
import type { LanguageCode } from '../types/Language';
|
|
5
|
-
import { useEffect } from 'react';
|
|
5
|
+
import { useEffect, useState } from 'react';
|
|
6
6
|
import { AppText } from '../components/AppText';
|
|
7
7
|
import { useThemeColors } from '../hooks/useThemeColors';
|
|
8
8
|
import { usePolling } from '../hooks/usePolling';
|
|
9
9
|
import { useAppStore } from '../store/store';
|
|
10
10
|
import { ScaledSheet } from '../components/ScaledSheet';
|
|
11
|
+
import { accumulator } from '../register/Accumulator';
|
|
11
12
|
const closeIcon = require('../assets/x-close.png');
|
|
12
13
|
|
|
13
14
|
interface SupportComnyxProps {
|
|
@@ -32,7 +33,18 @@ export function ComnyxSupport({
|
|
|
32
33
|
}));
|
|
33
34
|
const themeColors = useThemeColors();
|
|
34
35
|
usePolling();
|
|
35
|
-
|
|
36
|
+
const [initLoading, setInitLoading] = useState(true);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (!accumulator.isListenerCalledOnce()) {
|
|
39
|
+
accumulator.flush().then(() => {
|
|
40
|
+
setTimeout(() => {
|
|
41
|
+
setInitLoading(false);
|
|
42
|
+
}, 100);
|
|
43
|
+
});
|
|
44
|
+
} else {
|
|
45
|
+
setInitLoading(false);
|
|
46
|
+
}
|
|
47
|
+
}, []);
|
|
36
48
|
useEffect(() => {
|
|
37
49
|
if (customer === null || !customer.external_id) {
|
|
38
50
|
useAppStore.setState({ data: [] });
|
|
@@ -76,14 +88,14 @@ export function ComnyxSupport({
|
|
|
76
88
|
);
|
|
77
89
|
} else if (!formSubmitted) {
|
|
78
90
|
//NOTE: customer var ama forSubmitted false (name===null)
|
|
79
|
-
return <CustomerForm onBack={onBack} />;
|
|
91
|
+
return <CustomerForm loading={initLoading} onBack={onBack} />;
|
|
80
92
|
}
|
|
81
93
|
|
|
82
94
|
return (
|
|
83
95
|
<View
|
|
84
96
|
style={[styles.container, { backgroundColor: themeColors.background }]}
|
|
85
97
|
>
|
|
86
|
-
<ChatList onBack={onBack} />
|
|
98
|
+
<ChatList initLoading={initLoading} onBack={onBack} />
|
|
87
99
|
</View>
|
|
88
100
|
);
|
|
89
101
|
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
package com.comnyx.src.messaging.permissions
|
|
2
|
-
|
|
3
|
-
import android.Manifest
|
|
4
|
-
import android.app.Activity
|
|
5
|
-
import android.content.Context
|
|
6
|
-
import android.content.pm.PackageManager
|
|
7
|
-
import android.os.Build
|
|
8
|
-
import androidx.core.app.ActivityCompat
|
|
9
|
-
import androidx.core.content.ContextCompat
|
|
10
|
-
|
|
11
|
-
class NotificationPermission(private val context: Context) {
|
|
12
|
-
companion object {
|
|
13
|
-
private const val PERMISSION_REQUEST_CODE = 100
|
|
14
|
-
private var pendingPromise: ((isGranted: Boolean) -> Unit?)? = null
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
public fun isPermissionGranted(): Boolean {
|
|
19
|
-
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
20
|
-
ContextCompat.checkSelfPermission(context, Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED
|
|
21
|
-
} else {
|
|
22
|
-
// On Android 12 and below, notification permission is granted by default
|
|
23
|
-
true
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
public fun requestPermission(onSuccess: (isGranted: Boolean) -> Unit, onError: (exception: Exception) -> Unit) {
|
|
28
|
-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
29
|
-
if (!isPermissionGranted()) {
|
|
30
|
-
val activity = context as? Activity
|
|
31
|
-
if (activity == null) {
|
|
32
|
-
onError(Exception("Could not find valid activity"))
|
|
33
|
-
return
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
pendingPromise = onSuccess
|
|
37
|
-
|
|
38
|
-
ActivityCompat.requestPermissions(
|
|
39
|
-
activity,
|
|
40
|
-
arrayOf(Manifest.permission.POST_NOTIFICATIONS),
|
|
41
|
-
PERMISSION_REQUEST_CODE
|
|
42
|
-
)
|
|
43
|
-
return
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
onSuccess(true)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
public fun onRequestPermissionsResult(
|
|
52
|
-
requestCode: Int,
|
|
53
|
-
permissions: Array<out String>,
|
|
54
|
-
grantResults: IntArray
|
|
55
|
-
) {
|
|
56
|
-
if (requestCode == PERMISSION_REQUEST_CODE) {
|
|
57
|
-
val isGranted = grantResults.isNotEmpty() &&
|
|
58
|
-
grantResults[0] == PackageManager.PERMISSION_GRANTED
|
|
59
|
-
|
|
60
|
-
pendingPromise?.invoke(isGranted)
|
|
61
|
-
pendingPromise = null
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|