@regantis-sdk/react-native-chat 0.1.1 → 0.1.3
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/README.md +34 -2
- package/android/build.gradle +1 -0
- package/android/src/main/AndroidManifest.xml +13 -1
- package/android/src/main/java/technology/regantis/chat/RegantisChatNativeModule.java +109 -56
- package/android/src/main/res/xml/regantis_chat_file_paths.xml +4 -0
- package/index.d.ts +5 -1
- package/ios/RegantisChatNative.h +1 -1
- package/ios/RegantisChatNative.m +81 -31
- package/package.json +1 -1
- package/src/RegantisChat.js +682 -205
- package/src/client.js +3 -3
- package/src/defaults.js +1 -1
- package/src/native.js +5 -5
package/src/client.js
CHANGED
|
@@ -438,10 +438,10 @@ class RegantisChatClient {
|
|
|
438
438
|
}
|
|
439
439
|
|
|
440
440
|
async pickAndUpload(kind) {
|
|
441
|
-
const type = kind === 'image' ? 'image' : 'file';
|
|
442
|
-
const file = kind === '
|
|
441
|
+
const type = kind === 'image' || kind === 'camera' ? 'image' : 'file';
|
|
442
|
+
const file = kind === 'camera' ? await native.takePhoto() : await native.pickAttachment(type);
|
|
443
443
|
if (!file) return null;
|
|
444
|
-
return this.uploadAttachment(file,
|
|
444
|
+
return this.uploadAttachment(file, type);
|
|
445
445
|
}
|
|
446
446
|
|
|
447
447
|
async setTranslationLanguage(languageCode) {
|
package/src/defaults.js
CHANGED
package/src/native.js
CHANGED
|
@@ -32,11 +32,11 @@ async function pickAttachment(kind) {
|
|
|
32
32
|
return native.pickAttachment(kind === 'image' ? 'image' : 'file');
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
async function
|
|
36
|
-
if (!native || !native.
|
|
37
|
-
throw new Error('
|
|
35
|
+
async function takePhoto() {
|
|
36
|
+
if (!native || !native.takePhoto) {
|
|
37
|
+
throw new Error('NATIVE_CAMERA_UNAVAILABLE');
|
|
38
38
|
}
|
|
39
|
-
return native.
|
|
39
|
+
return native.takePhoto();
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
function playIncomingSound() {
|
|
@@ -51,6 +51,6 @@ module.exports = {
|
|
|
51
51
|
removeItem,
|
|
52
52
|
getAppInfo,
|
|
53
53
|
pickAttachment,
|
|
54
|
-
|
|
54
|
+
takePhoto,
|
|
55
55
|
playIncomingSound,
|
|
56
56
|
};
|