movius-chats 1.3.10 → 1.3.11
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 +1 -29
- package/package.json +4 -2
- package/scripts/patchSound.js +66 -0
package/README.md
CHANGED
|
@@ -794,6 +794,7 @@ import type {
|
|
|
794
794
|
|
|
795
795
|
| Symptom | Fix |
|
|
796
796
|
|---------|-----|
|
|
797
|
+
| `resolveAssetSource is not a function` | Auto-patched by movius-chats `postinstall`. If it still occurs, delete `node_modules`, reinstall, then rebuild native code |
|
|
797
798
|
| `Native module not found` | Rebuild the app after install — run `pod install` (iOS) and rebuild Android |
|
|
798
799
|
| Crashes in Expo Go | Use a development build — this package uses native modules not in Expo Go |
|
|
799
800
|
| Audio silent on iOS | Add `[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil]` in your `AppDelegate` |
|
|
@@ -812,35 +813,6 @@ import type {
|
|
|
812
813
|
|
|
813
814
|
---
|
|
814
815
|
|
|
815
|
-
## Publishing a new version
|
|
816
|
-
|
|
817
|
-
```bash
|
|
818
|
-
# 1. Bump version in package.json (follow semver)
|
|
819
|
-
npm version patch # or minor / major
|
|
820
|
-
|
|
821
|
-
# 2. Build
|
|
822
|
-
yarn build # runs rollup + tsc
|
|
823
|
-
|
|
824
|
-
# 3. Dry run to confirm what's included
|
|
825
|
-
npm pack --dry-run
|
|
826
|
-
|
|
827
|
-
# 4. Publish (use --otp if 2FA is on)
|
|
828
|
-
npm publish --access public --otp=YOUR_CODE
|
|
829
|
-
|
|
830
|
-
# 5. Tag the release
|
|
831
|
-
git push && git push --tags
|
|
832
|
-
```
|
|
833
|
-
|
|
834
|
-
After publishing, update the package in your consumer app:
|
|
835
|
-
|
|
836
|
-
```bash
|
|
837
|
-
npm install movius-chats@latest
|
|
838
|
-
```
|
|
839
|
-
|
|
840
|
-
If native dependencies changed, run `pod install` and rebuild the app.
|
|
841
|
-
|
|
842
|
-
---
|
|
843
|
-
|
|
844
816
|
## License
|
|
845
817
|
|
|
846
818
|
ISC — see [package.json](./package.json).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "movius-chats",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.11",
|
|
4
4
|
"description": "A highly customizable, feature-rich chat interface component for React Native applications",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"src",
|
|
12
12
|
"lib",
|
|
13
|
+
"scripts",
|
|
13
14
|
"!**/__tests__",
|
|
14
15
|
"!**/__fixtures__",
|
|
15
16
|
"!**/__mocks__"
|
|
@@ -24,7 +25,8 @@
|
|
|
24
25
|
"build:js": "rollup -c rollup.config.mjs",
|
|
25
26
|
"clean": "rimraf lib",
|
|
26
27
|
"release": "release-it",
|
|
27
|
-
"example": "yarn --cwd example"
|
|
28
|
+
"example": "yarn --cwd example",
|
|
29
|
+
"postinstall": "node scripts/patchSound.js"
|
|
28
30
|
},
|
|
29
31
|
"repository": {
|
|
30
32
|
"type": "git",
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
|
|
8
|
+
const candidates = [
|
|
9
|
+
// standard flat node_modules layout
|
|
10
|
+
path.resolve(__dirname, '..', '..', 'react-native-sound', 'Sound.js'),
|
|
11
|
+
// hoisted monorepo layout (yarn workspaces / pnpm)
|
|
12
|
+
path.resolve(__dirname, '..', '..', '..', 'react-native-sound', 'Sound.js'),
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
const OLD_IMPORT =
|
|
16
|
+
"var resolveAssetSource = require('react-native/Libraries/Image/resolveAssetSource');";
|
|
17
|
+
|
|
18
|
+
const NEW_IMPORT = [
|
|
19
|
+
"var _ras = require('react-native/Libraries/Image/resolveAssetSource');",
|
|
20
|
+
'// movius-chats patch: support New Architecture (resolveAssetSource moved to Image)',
|
|
21
|
+
"var resolveAssetSource = typeof _ras === 'function'",
|
|
22
|
+
" ? _ras",
|
|
23
|
+
" : (_ras && typeof _ras.default === 'function'",
|
|
24
|
+
" ? _ras.default",
|
|
25
|
+
" : require('react-native').Image.resolveAssetSource.bind(require('react-native').Image));",
|
|
26
|
+
].join('\n');
|
|
27
|
+
|
|
28
|
+
const PATCH_MARKER = '// movius-chats patch:';
|
|
29
|
+
|
|
30
|
+
let patched = false;
|
|
31
|
+
|
|
32
|
+
for (const soundPath of candidates) {
|
|
33
|
+
if (!fs.existsSync(soundPath)) continue;
|
|
34
|
+
|
|
35
|
+
let src = fs.readFileSync(soundPath, 'utf8');
|
|
36
|
+
|
|
37
|
+
if (src.includes(PATCH_MARKER)) {
|
|
38
|
+
console.log('[movius-chats] react-native-sound already patched — skipping.');
|
|
39
|
+
patched = true;
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (!src.includes(OLD_IMPORT)) {
|
|
44
|
+
// Different version of react-native-sound; the import line changed.
|
|
45
|
+
console.warn(
|
|
46
|
+
'[movius-chats] Could not locate the resolveAssetSource import in ' +
|
|
47
|
+
soundPath +
|
|
48
|
+
'.\n' +
|
|
49
|
+
'If you see a "resolveAssetSource is not a function" error, apply the\n' +
|
|
50
|
+
'patch manually — see the movius-chats README Troubleshooting section.'
|
|
51
|
+
);
|
|
52
|
+
patched = true; // don't repeat the warning for every candidate
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
src = src.replace(OLD_IMPORT, NEW_IMPORT);
|
|
57
|
+
fs.writeFileSync(soundPath, src, 'utf8');
|
|
58
|
+
console.log('[movius-chats] ✅ react-native-sound patched for New Architecture compatibility.');
|
|
59
|
+
patched = true;
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (!patched) {
|
|
64
|
+
// react-native-sound is not installed yet (peer dep, optional dep, etc.)
|
|
65
|
+
// Silently skip — the patch will run again if the user installs it later.
|
|
66
|
+
}
|