react-native-flutter-chat 1.0.9 → 1.0.10

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.
Files changed (34) hide show
  1. package/android/build.gradle +5 -4
  2. package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/1/flutter_release-1.aar +0 -0
  3. package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/{13/flutter_release-13.module → 1/flutter_release-1.module} +5 -5
  4. package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/1/flutter_release-1.module.md5 +1 -0
  5. package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/1/flutter_release-1.module.sha1 +1 -0
  6. package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/1/flutter_release-1.module.sha256 +1 -0
  7. package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/1/flutter_release-1.module.sha512 +1 -0
  8. package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/{13/flutter_release-13.pom → 1/flutter_release-1.pom} +1 -1
  9. package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/1/flutter_release-1.pom.md5 +1 -0
  10. package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/1/flutter_release-1.pom.sha1 +1 -0
  11. package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/1/flutter_release-1.pom.sha256 +1 -0
  12. package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/1/flutter_release-1.pom.sha512 +1 -0
  13. package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/maven-metadata.xml +4 -4
  14. package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/maven-metadata.xml.md5 +1 -1
  15. package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/maven-metadata.xml.sha1 +1 -1
  16. package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/maven-metadata.xml.sha256 +1 -1
  17. package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/maven-metadata.xml.sha512 +1 -1
  18. package/package.json +9 -2
  19. package/react-native.config.js +12 -0
  20. package/setup.js +240 -0
  21. package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/13/flutter_release-13.module.md5 +0 -1
  22. package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/13/flutter_release-13.module.sha1 +0 -1
  23. package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/13/flutter_release-13.module.sha256 +0 -1
  24. package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/13/flutter_release-13.module.sha512 +0 -1
  25. package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/13/flutter_release-13.pom.md5 +0 -1
  26. package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/13/flutter_release-13.pom.sha1 +0 -1
  27. package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/13/flutter_release-13.pom.sha256 +0 -1
  28. package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/13/flutter_release-13.pom.sha512 +0 -1
  29. package/tsconfig.json +0 -16
  30. /package/android/libs/{flutter_repo/com/flutterchat/module/flutter_release/13/flutter_release-13.aar → flutter_release-1.aar} +0 -0
  31. /package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/{13/flutter_release-13.aar.md5 → 1/flutter_release-1.aar.md5} +0 -0
  32. /package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/{13/flutter_release-13.aar.sha1 → 1/flutter_release-1.aar.sha1} +0 -0
  33. /package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/{13/flutter_release-13.aar.sha256 → 1/flutter_release-1.aar.sha256} +0 -0
  34. /package/android/libs/flutter_repo/com/flutterchat/module/flutter_release/{13/flutter_release-13.aar.sha512 → 1/flutter_release-1.aar.sha512} +0 -0
@@ -18,7 +18,7 @@ android {
18
18
  namespace 'com.flutterchat.sdk'
19
19
 
20
20
  defaultConfig {
21
- minSdk 21
21
+ minSdk 24
22
22
  targetSdk 34
23
23
  }
24
24
 
@@ -35,9 +35,9 @@ android {
35
35
  repositories {
36
36
  google()
37
37
  mavenCentral()
38
- // Local Flutter AAR repono internet needed
38
+ // uri() is mandatory on Windows raw strings produce invalid Maven URLs
39
39
  maven {
40
- url "$projectDir/libs/flutter_repo"
40
+ url uri("$projectDir/libs/flutter_repo")
41
41
  }
42
42
  // Flutter engine — must come from storage.googleapis.com NOT jitpack
43
43
  maven {
@@ -46,6 +46,7 @@ repositories {
46
46
  }
47
47
 
48
48
  dependencies {
49
- implementation 'com.facebook.react:react-android:0.73.0'
49
+ implementation 'com.facebook.react:react-android:+'
50
+ // Version always matches --build-number 1 in CI
50
51
  implementation 'com.flutterchat.module:flutter_release:1.0'
51
52
  }
@@ -3,7 +3,7 @@
3
3
  "component": {
4
4
  "group": "com.flutterchat.module",
5
5
  "module": "flutter_release",
6
- "version": "13",
6
+ "version": "1",
7
7
  "attributes": {
8
8
  "org.gradle.status": "release"
9
9
  }
@@ -54,8 +54,8 @@
54
54
  ],
55
55
  "files": [
56
56
  {
57
- "name": "flutter_release-13.aar",
58
- "url": "flutter_release-13.aar",
57
+ "name": "flutter_release-1.aar",
58
+ "url": "flutter_release-1.aar",
59
59
  "size": 5411058,
60
60
  "sha512": "e019f49ceb3a962b72ea8978c5d55be6d75bb6718e4970941c6a279f4a9e165c748abb437089ad1bcca1ccaf9cbf0babfa60cfa60786f65b280e2105a9bd3190",
61
61
  "sha256": "715eb1b0a07c3a7219c25c8069d1b96ea1c98b3b0f957a3500b4481762352b88",
@@ -104,8 +104,8 @@
104
104
  ],
105
105
  "files": [
106
106
  {
107
- "name": "flutter_release-13.aar",
108
- "url": "flutter_release-13.aar",
107
+ "name": "flutter_release-1.aar",
108
+ "url": "flutter_release-1.aar",
109
109
  "size": 5411058,
110
110
  "sha512": "e019f49ceb3a962b72ea8978c5d55be6d75bb6718e4970941c6a279f4a9e165c748abb437089ad1bcca1ccaf9cbf0babfa60cfa60786f65b280e2105a9bd3190",
111
111
  "sha256": "715eb1b0a07c3a7219c25c8069d1b96ea1c98b3b0f957a3500b4481762352b88",
@@ -0,0 +1 @@
1
+ 47898f2036c46cb28523c7d8bd2080ead114b98f1f1d84f58cd8d5b780b4ee63
@@ -0,0 +1 @@
1
+ 4839938997a5cec25d1c0febd8b02d450d0bb946684010917f5fa8c3b05ae4befb40fb98e33f7594aa9cfa698f859bbdf7ad3bdbfec9f8a2d5c36f47ed494103
@@ -9,7 +9,7 @@
9
9
  <modelVersion>4.0.0</modelVersion>
10
10
  <groupId>com.flutterchat.module</groupId>
11
11
  <artifactId>flutter_release</artifactId>
12
- <version>13</version>
12
+ <version>1</version>
13
13
  <packaging>aar</packaging>
14
14
  <dependencies>
15
15
  <dependency>
@@ -0,0 +1 @@
1
+ 03380297f69ef66320c27cbfa6b4dc4627d7f006
@@ -0,0 +1 @@
1
+ 24f2e576a4722bd8fbfc6ba43867fdcf6c91370586c632e7d134baa997dbbe93
@@ -0,0 +1 @@
1
+ 074563a9a652f986091e76e9de35187ed2526d42e2e0a2d02c401f0d9a874918fafb1d22d2b44b4eccf7f8e057bb600e754fb6440bf65653ac358cbac2aaca74
@@ -3,11 +3,11 @@
3
3
  <groupId>com.flutterchat.module</groupId>
4
4
  <artifactId>flutter_release</artifactId>
5
5
  <versioning>
6
- <latest>13</latest>
7
- <release>13</release>
6
+ <latest>1</latest>
7
+ <release>1</release>
8
8
  <versions>
9
- <version>13</version>
9
+ <version>1</version>
10
10
  </versions>
11
- <lastUpdated>20260318103347</lastUpdated>
11
+ <lastUpdated>20260318121125</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- 1c3bd47098b852a6b7c7998018739cde
1
+ 56c1f4f98e628ccc7ca49829d736a2a7
@@ -1 +1 @@
1
- 33f6283a7884b1f22accb4cac12bf2cb9b0224d5
1
+ 2a34aad226f5c534400ad89afc0c9220703511c0
@@ -1 +1 @@
1
- e1b997260a195faf5c1d286d3eb36fe8e31051195af792ef2c4938ef2078f720
1
+ 767e499291eba185db364151282bce781d42edb27e739f81ad4c887b42d96a45
@@ -1 +1 @@
1
- 4e72ce1f7888e69edf8994e03ebd5945e8007ca8c4544a569c3129e70240e9d5143bacaddd5389e78a89e7583296f53993057ca1a622fa86ede244ba44535577
1
+ 8e6a99db8d612db44b9ae6e2bb3b1586ceaa4148f78e0c94462e48becc7ad048ccfa9b6326a0d8dd9e6fc2ee3460b10d006350749e0cca2e521db3016c24c31a
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "react-native-flutter-chat",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "React Native SDK that embeds a Flutter-powered chat UI via native Android bridge",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
7
7
  "scripts": {
8
+ "postinstall": "node setup.js",
8
9
  "lint": "eslint src --ext .ts,.tsx",
9
10
  "typecheck": "tsc --noEmit"
10
11
  },
@@ -15,6 +16,13 @@
15
16
  "sdk",
16
17
  "android"
17
18
  ],
19
+ "files": [
20
+ "src",
21
+ "android",
22
+ "setup.js",
23
+ "react-native.config.js",
24
+ "README.md"
25
+ ],
18
26
  "author": "",
19
27
  "license": "MIT",
20
28
  "peerDependencies": {
@@ -24,7 +32,6 @@
24
32
  "devDependencies": {
25
33
  "@types/react": "^18.2.0",
26
34
  "@types/react-native": "^0.73.0",
27
- "react-native": "^0.73.4",
28
35
  "typescript": "^5.3.0"
29
36
  }
30
37
  }
@@ -0,0 +1,12 @@
1
+ module.exports = {
2
+ dependency: {
3
+ platforms: {
4
+ android: {
5
+ sourceDir: './android',
6
+ packageImportPath: 'import com.flutterchat.sdk.FlutterChatPackage;',
7
+ packageInstance: 'new FlutterChatPackage()',
8
+ },
9
+ ios: null,
10
+ },
11
+ },
12
+ };
package/setup.js ADDED
@@ -0,0 +1,240 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * react-native-flutter-chat — postinstall setup
5
+ *
6
+ * Automatically patches the host RN app's Android files.
7
+ * Runs automatically after: npm install react-native-flutter-chat
8
+ *
9
+ * What it does:
10
+ * 1. Fixes sdk.dir backslashes in local.properties
11
+ * 2. Points gradle-wrapper to a cached Gradle version
12
+ * 3. Adds Flutter Maven repos to android/build.gradle (with uri() for Windows)
13
+ * 4. Bumps minSdkVersion to 24 in android/app/build.gradle
14
+ * 5. Adds xmlns:tools + FlutterChatActivity to AndroidManifest.xml
15
+ * 6. Adds :react-native-flutter-chat subproject to android/settings.gradle
16
+ */
17
+
18
+ const fs = require('fs');
19
+ const path = require('path');
20
+ const os = require('os');
21
+
22
+ // Find the host app root (3 levels up from node_modules/react-native-flutter-chat/)
23
+ const PKG_DIR = path.resolve(__dirname);
24
+ const ROOT = path.resolve(PKG_DIR, '..', '..');
25
+ const ANDROID = path.join(ROOT, 'android');
26
+
27
+ const log = (msg) => console.log(`\x1b[36m[flutter-chat]\x1b[0m ${msg}`);
28
+ const ok = (msg) => console.log(`\x1b[32m[flutter-chat] ✔\x1b[0m ${msg}`);
29
+ const warning = (msg) => console.log(`\x1b[33m[flutter-chat] ⚠\x1b[0m ${msg}`);
30
+ const skip = (file) => warning(`${file} not found — skipping`);
31
+
32
+ // ── helpers ──────────────────────────────────────────────────────────────────
33
+
34
+ function read(filePath) {
35
+ return fs.readFileSync(filePath, 'utf8');
36
+ }
37
+
38
+ function write(filePath, content) {
39
+ fs.writeFileSync(filePath, content, 'utf8');
40
+ }
41
+
42
+ function fileExists(filePath) {
43
+ return fs.existsSync(filePath);
44
+ }
45
+
46
+ // ── 1. local.properties — fix backslashes ────────────────────────────────────
47
+
48
+ function fixLocalProperties() {
49
+ const file = path.join(ANDROID, 'local.properties');
50
+ if (!fileExists(file)) { skip('local.properties'); return; }
51
+
52
+ let content = read(file);
53
+ const fixed = content.replace(/sdk\.dir=(.+)/g, (_, p) =>
54
+ `sdk.dir=${p.trim().replace(/\\/g, '/')}`
55
+ );
56
+
57
+ if (fixed === content) { ok('local.properties already clean'); return; }
58
+ write(file, fixed);
59
+ ok('local.properties — backslashes fixed in sdk.dir');
60
+ }
61
+
62
+ // ── 2. gradle-wrapper.properties — point to cached Gradle ────────────────────
63
+
64
+ function fixGradleWrapper() {
65
+ const file = path.join(ANDROID, 'gradle', 'wrapper', 'gradle-wrapper.properties');
66
+ if (!fileExists(file)) { skip('gradle-wrapper.properties'); return; }
67
+
68
+ // Check which Gradle versions are locally cached
69
+ const distsDir = path.join(os.homedir(), '.gradle', 'wrapper', 'dists');
70
+ let bestVersion = null;
71
+
72
+ const preferred = ['gradle-8.6-bin', 'gradle-8.6-all', 'gradle-8.3-all', 'gradle-8.3-bin'];
73
+
74
+ if (fileExists(distsDir)) {
75
+ for (const v of preferred) {
76
+ const vDir = path.join(distsDir, v);
77
+ if (fileExists(vDir)) {
78
+ // Check if it's fully downloaded (has a subdir with gradle-wrapper jar)
79
+ const sub = fs.readdirSync(vDir);
80
+ if (sub.length > 0) {
81
+ bestVersion = v;
82
+ break;
83
+ }
84
+ }
85
+ }
86
+ }
87
+
88
+ if (!bestVersion) {
89
+ warning('No cached Gradle found — keeping existing wrapper version');
90
+ return;
91
+ }
92
+
93
+ const zipType = bestVersion.includes('-all') ? 'all' : 'bin';
94
+ const version = bestVersion.replace('gradle-', '').replace(`-${zipType}`, '');
95
+ const newUrl = `https\\://services.gradle.org/distributions/gradle-${version}-${zipType}.zip`;
96
+
97
+ let content = read(file);
98
+ const updated = content.replace(/distributionUrl=.+/, `distributionUrl=${newUrl}`);
99
+
100
+ if (updated === content) { ok('gradle-wrapper.properties already correct'); return; }
101
+ write(file, updated);
102
+ ok(`gradle-wrapper.properties — using cached Gradle ${version}-${zipType}`);
103
+ }
104
+
105
+ // ── 3. android/settings.gradle — add subproject ──────────────────────────────
106
+
107
+ function fixSettingsGradle() {
108
+ const file = path.join(ANDROID, 'settings.gradle');
109
+ if (!fileExists(file)) { skip('android/settings.gradle'); return; }
110
+
111
+ let content = read(file);
112
+ if (content.includes('react-native-flutter-chat')) {
113
+ ok('android/settings.gradle — subproject already included');
114
+ return;
115
+ }
116
+
117
+ const block = `
118
+ include ':react-native-flutter-chat'
119
+ project(':react-native-flutter-chat').projectDir = new File(
120
+ rootProject.projectDir,
121
+ '../node_modules/react-native-flutter-chat/android'
122
+ )
123
+ `;
124
+ write(file, content + block);
125
+ ok('android/settings.gradle — :react-native-flutter-chat subproject added');
126
+ }
127
+
128
+ // ── 4. android/build.gradle — add Maven repos ────────────────────────────────
129
+
130
+ function fixRootBuildGradle() {
131
+ const file = path.join(ANDROID, 'build.gradle');
132
+ if (!fileExists(file)) { skip('android/build.gradle'); return; }
133
+
134
+ let content = read(file);
135
+ if (content.includes('flutter_repo')) {
136
+ ok('android/build.gradle — Flutter repos already present');
137
+ return;
138
+ }
139
+
140
+ // uri() is mandatory on Windows — raw path strings fail as Maven URLs
141
+ const block = `
142
+ allprojects {
143
+ repositories {
144
+ google()
145
+ mavenCentral()
146
+ maven {
147
+ url uri("$rootDir/../node_modules/react-native-flutter-chat/android/libs/flutter_repo")
148
+ }
149
+ maven {
150
+ url "https://storage.googleapis.com/download.flutter.io"
151
+ }
152
+ }
153
+ }
154
+ `;
155
+ write(file, content + block);
156
+ ok('android/build.gradle — Flutter Maven repos added (with uri() for Windows)');
157
+ }
158
+
159
+ // ── 5. android/app/build.gradle — bump minSdkVersion ────────────────────────
160
+
161
+ function fixAppBuildGradle() {
162
+ const file = path.join(ANDROID, 'app', 'build.gradle');
163
+ if (!fileExists(file)) { skip('android/app/build.gradle'); return; }
164
+
165
+ let content = read(file);
166
+ const match = content.match(/minSdkVersion\s*[=:]?\s*(\d+)/);
167
+ if (!match) { warning('minSdkVersion not found in app/build.gradle'); return; }
168
+
169
+ const current = parseInt(match[1]);
170
+ if (current >= 24) { ok(`android/app/build.gradle — minSdkVersion already ${current}`); return; }
171
+
172
+ const updated = content.replace(
173
+ /minSdkVersion\s*[=:]?\s*\d+/,
174
+ `minSdkVersion = 24`
175
+ );
176
+ write(file, updated);
177
+ ok(`android/app/build.gradle — minSdkVersion bumped ${current} → 24`);
178
+ }
179
+
180
+ // ── 6. AndroidManifest.xml — add tools namespace + FlutterChatActivity ───────
181
+
182
+ function fixAndroidManifest() {
183
+ const file = path.join(ANDROID, 'app', 'src', 'main', 'AndroidManifest.xml');
184
+ if (!fileExists(file)) { skip('AndroidManifest.xml'); return; }
185
+
186
+ let content = read(file);
187
+ let changed = false;
188
+
189
+ // Add xmlns:tools to <manifest> tag
190
+ if (!content.includes('xmlns:tools')) {
191
+ content = content.replace(
192
+ '<manifest ',
193
+ '<manifest xmlns:tools="http://schemas.android.com/tools" '
194
+ );
195
+ changed = true;
196
+ }
197
+
198
+ // Add FlutterChatActivity declaration with tools:replace
199
+ if (!content.includes('FlutterChatActivity')) {
200
+ const activityBlock = `
201
+ <activity
202
+ android:name="com.flutterchat.sdk.FlutterChatActivity"
203
+ android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
204
+ android:hardwareAccelerated="true"
205
+ android:windowSoftInputMode="adjustResize"
206
+ tools:replace="android:configChanges" />`;
207
+
208
+ content = content.replace('</application>', `${activityBlock}\n </application>`);
209
+ changed = true;
210
+ }
211
+
212
+ if (!changed) { ok('AndroidManifest.xml — already patched'); return; }
213
+ write(file, content);
214
+ ok('AndroidManifest.xml — xmlns:tools + FlutterChatActivity added');
215
+ }
216
+
217
+ // ── Run ───────────────────────────────────────────────────────────────────────
218
+
219
+ console.log('');
220
+ log('Setting up react-native-flutter-chat...');
221
+ console.log('');
222
+
223
+ try {
224
+ fixLocalProperties();
225
+ fixGradleWrapper();
226
+ fixSettingsGradle();
227
+ fixRootBuildGradle();
228
+ fixAppBuildGradle();
229
+ fixAndroidManifest();
230
+
231
+ console.log('');
232
+ console.log('\x1b[32m[flutter-chat] 🎉 Setup complete!\x1b[0m');
233
+ console.log('');
234
+ console.log(' ⚡ Autolinking handles FlutterChatPackage registration automatically.');
235
+ console.log(' ⚡ Just run: npx react-native run-android');
236
+ console.log('');
237
+ } catch (err) {
238
+ console.error('\x1b[31m[flutter-chat] Setup failed:\x1b[0m', err.message);
239
+ process.exit(1);
240
+ }
@@ -1 +0,0 @@
1
- 9299c59c9555f59b516c580a38194e4f2d2119ed
@@ -1 +0,0 @@
1
- 2b4389f494790fcc3d6012418cd5ee816353fd57fa4f462aba7ac06080cf51f1
@@ -1 +0,0 @@
1
- ecf74d312b6d9fe19ffb9fe5bc9e8459e82b265eb0f2df2293c8918d377bb65e7bac41e6e496c34c3f1bf5d184e7a838481a23bc1d40275412531eae7e8d08fa
@@ -1 +0,0 @@
1
- 54a563de0c0eb7b121237a51d40d80dbd6867a04
@@ -1 +0,0 @@
1
- 0c8dd1aa2c357b3a20cc38aa7c809ce056c7737998d0ee1b73b0ee29765afc7c
@@ -1 +0,0 @@
1
- 48c5d0a7add32a0b7c5b022d6f9f15591f3cfd831fb29eef9dab97bfd0064f91e00a6ded161b0ffacb9ed1aa0874aa02122806d751242c2b2952300e412c1b18
package/tsconfig.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ESNext",
4
- "module": "CommonJS",
5
- "moduleResolution": "node",
6
- "strict": true,
7
- "jsx": "react-native",
8
- "lib": ["ESNext"],
9
- "allowSyntheticDefaultImports": true,
10
- "esModuleInterop": true,
11
- "declaration": true,
12
- "skipLibCheck": true
13
- },
14
- "include": ["src"],
15
- "exclude": ["node_modules"]
16
- }