Skip to content

Commit f1b9cbe

Browse files
committed
v5.0.2
1 parent 3432103 commit f1b9cbe

File tree

193 files changed

+43058
-25142
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+43058
-25142
lines changed

examples/SampleApp/.prettierrc.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
module.exports = {
22
arrowParens: 'avoid',
3-
bracketSameLine: true,
4-
bracketSpacing: false,
53
singleQuote: true,
64
trailingComma: 'all',
75
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"workbench.colorCustomizations": {
3+
"activityBar.activeBackground": "#fa1b49",
4+
"activityBar.background": "#fa1b49",
5+
"activityBar.foreground": "#e7e7e7",
6+
"activityBar.inactiveForeground": "#e7e7e799",
7+
"activityBarBadge.background": "#155e02",
8+
"activityBarBadge.foreground": "#e7e7e7",
9+
"commandCenter.border": "#e7e7e799",
10+
"sash.hoverBorder": "#fa1b49",
11+
"statusBar.background": "#dd0531",
12+
"statusBar.foreground": "#e7e7e7",
13+
"statusBarItem.hoverBackground": "#fa1b49",
14+
"statusBarItem.remoteBackground": "#dd0531",
15+
"statusBarItem.remoteForeground": "#e7e7e7",
16+
"titleBar.activeBackground": "#dd0531",
17+
"titleBar.activeForeground": "#e7e7e7",
18+
"titleBar.inactiveBackground": "#dd053199",
19+
"titleBar.inactiveForeground": "#e7e7e799"
20+
},
21+
"peacock.color": "#dd0531"
22+
}

examples/SampleApp/App.tsx

Lines changed: 46 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1+
import { StatusBar, useColorScheme } from 'react-native';
12
import './gesture-handler';
2-
import React, {useState, useEffect, useRef} from 'react';
3+
import React, { useState, useEffect, useRef } from 'react';
34
import {
45
Platform,
56
View,
67
PlatformColor,
78
AppState,
89
AppStateStatus,
910
} from 'react-native';
11+
import { enableScreens } from 'react-native-screens';
12+
enableScreens();
1013
import {
1114
CometChatIncomingCall,
1215
CometChatThemeProvider,
@@ -16,19 +19,25 @@ import {
1619
UIKitSettings,
1720
} from '@cometchat/chat-uikit-react-native';
1821

19-
import {SafeAreaProvider, SafeAreaView} from 'react-native-safe-area-context';
20-
import {CometChat} from '@cometchat/chat-sdk-react-native';
22+
import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
23+
import { CometChat } from '@cometchat/chat-sdk-react-native';
2124
import RootStackNavigator from './src/navigation/RootStackNavigator';
22-
import {AppConstants} from './src/utils/AppConstants';
23-
import {
24-
requestAndroidPermissions,
25-
} from './src/utils/helper';
25+
import { AppConstants } from './src/utils/AppConstants';
26+
import { requestAndroidPermissions } from './src/utils/helper';
2627
import AsyncStorage from '@react-native-async-storage/async-storage';
2728

28-
// Listener ID for registering and removing CometChat listeners.
29-
const listenerId = 'app';
29+
function App() {
30+
const isDarkMode = useColorScheme() === 'dark';
31+
32+
return (
33+
<SafeAreaProvider>
34+
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
35+
<AppContent />
36+
</SafeAreaProvider>
37+
);
38+
}
3039

31-
const App = (): React.ReactElement => {
40+
const AppContent = (): React.ReactElement => {
3241
const [callReceived, setCallReceived] = useState(false);
3342
const incomingCall = useRef<CometChat.Call | CometChat.CustomMessage | null>(
3443
null,
@@ -37,9 +46,11 @@ const App = (): React.ReactElement => {
3746
const [isLoggedIn, setIsLoggedIn] = useState(false);
3847
const [userLoggedIn, setUserLoggedIn] = useState(false);
3948
const [hasValidAppCredentials, setHasValidAppCredentials] = useState(false);
49+
// Listener ID for registering and removing CometChat listeners.
50+
const listenerId = 'app';
4051

4152
/**
42-
* Initialize CometChat UIKit.
53+
* Initialize CometChat UIKit and configure Google Sign-In.
4354
* Retrieves credentials from AsyncStorage and uses fallback constants if needed.
4455
*/
4556
useEffect(() => {
@@ -74,7 +85,6 @@ const App = (): React.ReactElement => {
7485
if (loggedInUser) {
7586
setIsLoggedIn(true);
7687
}
77-
7888
} catch (error) {
7989
console.log('Error during initialization', error);
8090
} finally {
@@ -242,28 +252,31 @@ const App = (): React.ReactElement => {
242252

243253
// Once initialization is complete, render the main app UI.
244254
return (
245-
<SafeAreaProvider>
246-
<SafeAreaView edges={['top']} style={{flex: 1}}>
247-
<CometChatThemeProvider>
248-
{/* Render the incoming call UI if the user is logged in and a call is received */}
249-
{isLoggedIn && callReceived && incomingCall.current ? (
250-
<CometChatIncomingCall
251-
call={incomingCall.current}
252-
onDecline={() => {
253-
// Handle call decline by clearing the incoming call state.
254-
incomingCall.current = null;
255-
setCallReceived(false);
256-
}}
257-
/>
258-
) : null}
259-
{/* Render the main navigation stack, passing the login status as a prop */}
260-
<RootStackNavigator
261-
isLoggedIn={isLoggedIn}
262-
hasValidAppCredentials={hasValidAppCredentials}
255+
<SafeAreaView edges={['top', 'bottom']} style={{ flex: 1 }}>
256+
<CometChatThemeProvider>
257+
{/* Render the incoming call UI if the user is logged in and a call is received */}
258+
{isLoggedIn && callReceived && incomingCall.current ? (
259+
<CometChatIncomingCall
260+
call={incomingCall.current}
261+
onDecline={() => {
262+
// Handle call decline by clearing the incoming call state.
263+
incomingCall.current = null;
264+
setCallReceived(false);
265+
}}
266+
style={{
267+
containerStyle: {
268+
marginTop: Platform.OS === 'android' ? 40 : 0,
269+
},
270+
}}
263271
/>
264-
</CometChatThemeProvider>
265-
</SafeAreaView>
266-
</SafeAreaProvider>
272+
) : null}
273+
{/* Render the main navigation stack, passing the login status as a prop */}
274+
<RootStackNavigator
275+
isLoggedIn={isLoggedIn}
276+
hasValidAppCredentials={hasValidAppCredentials}
277+
/>
278+
</CometChatThemeProvider>
279+
</SafeAreaView>
267280
);
268281
};
269282

examples/SampleApp/Gemfile.lock

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,27 @@ GEM
55
base64
66
nkf
77
rexml
8-
activesupport (6.1.7.10)
9-
concurrent-ruby (~> 1.0, >= 1.0.2)
8+
activesupport (7.2.2.2)
9+
base64
10+
benchmark (>= 0.3)
11+
bigdecimal
12+
concurrent-ruby (~> 1.0, >= 1.3.1)
13+
connection_pool (>= 2.2.5)
14+
drb
1015
i18n (>= 1.6, < 2)
16+
logger (>= 1.4.2)
1117
minitest (>= 5.1)
12-
tzinfo (~> 2.0)
13-
zeitwerk (~> 2.3)
18+
securerandom (>= 0.3)
19+
tzinfo (~> 2.0, >= 2.0.5)
1420
addressable (2.8.7)
1521
public_suffix (>= 2.0.2, < 7.0)
1622
algoliasearch (1.27.5)
1723
httpclient (~> 2.8, >= 2.8.3)
1824
json (>= 1.5.1)
1925
atomos (0.1.3)
20-
base64 (0.2.0)
26+
base64 (0.3.0)
27+
benchmark (0.4.1)
28+
bigdecimal (3.2.3)
2129
claide (1.1.0)
2230
cocoapods (1.15.2)
2331
addressable (~> 2.8)
@@ -58,28 +66,34 @@ GEM
5866
cocoapods-try (1.2.0)
5967
colored2 (3.1.2)
6068
concurrent-ruby (1.3.3)
69+
connection_pool (2.5.4)
70+
drb (2.2.3)
6171
escape (0.0.4)
62-
ethon (0.16.0)
72+
ethon (0.15.0)
6373
ffi (>= 1.15.0)
64-
ffi (1.17.1)
74+
ffi (1.17.2)
6575
fourflusher (2.3.1)
6676
fuzzy_match (2.0.4)
6777
gh_inspector (1.1.3)
68-
httpclient (2.8.3)
78+
httpclient (2.9.0)
79+
mutex_m
6980
i18n (1.14.7)
7081
concurrent-ruby (~> 1.0)
71-
json (2.7.6)
72-
minitest (5.25.4)
82+
json (2.15.0)
83+
logger (1.7.0)
84+
minitest (5.25.5)
7385
molinillo (0.8.0)
86+
mutex_m (0.3.0)
7487
nanaimo (0.3.0)
7588
nap (1.1.0)
7689
netrc (0.11.0)
7790
nkf (0.2.0)
7891
public_suffix (4.0.7)
79-
rexml (3.4.0)
92+
rexml (3.4.4)
8093
ruby-macho (2.5.1)
81-
typhoeus (1.4.1)
82-
ethon (>= 0.9.0)
94+
securerandom (0.4.1)
95+
typhoeus (1.5.0)
96+
ethon (>= 0.9.0, < 0.16.0)
8397
tzinfo (2.0.6)
8498
concurrent-ruby (~> 1.0)
8599
xcodeproj (1.25.1)
@@ -89,19 +103,22 @@ GEM
89103
colored2 (~> 3.1)
90104
nanaimo (~> 0.3.0)
91105
rexml (>= 3.3.6, < 4.0)
92-
zeitwerk (2.6.18)
93106

94107
PLATFORMS
95108
ruby
96109

97110
DEPENDENCIES
98111
activesupport (>= 6.1.7.5, != 7.1.0)
112+
benchmark
113+
bigdecimal
99114
cocoapods (>= 1.13, != 1.15.1, != 1.15.0)
100115
concurrent-ruby (< 1.3.4)
116+
logger
117+
mutex_m
101118
xcodeproj (< 1.26.0)
102119

103120
RUBY VERSION
104-
ruby 2.6.10p210
121+
ruby 3.2.0p0
105122

106123
BUNDLED WITH
107124
2.6.3

examples/SampleApp/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,11 @@ Sign up for a [CometChat](https://app.cometchat.com/) account to obtain your app
3737
git clone https://github.com/cometchat/cometchat-uikit-react-native.git
3838
```
3939

40-
1. Run `npm install` to install the dependencies.
41-
4240
1. Change into the specific app's directory (e.g., SampleApp).
4341
```sh
4442
cd examples/SampleApp
4543
```
44+
1. Run `npm install` to install the dependencies.
4645

4746
1. `[Optional]` Configure CometChat credentials:
4847
- Open the `AppConstants.tsx` file located at `examples/SampleApp/src/utils/AppConstants.tsx` and enter your CometChat _`appId`_, _`region`_, and _`authKey`_:

examples/SampleApp/android/app/build.gradle

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ react {
1111
// The root of your project, i.e. where "package.json" lives. Default is '../..'
1212
// root = file("../../")
1313
// The folder where the react-native NPM package is. Default is ../../node_modules/react-native
14-
reactNativeDir = file("../../../../node_modules/react-native")
14+
// reactNativeDir = file("../../node_modules/react-native")
1515
// The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
16-
codegenDir = file("../../../../node_modules/@react-native/codegen")
16+
// codegenDir = file("../../node_modules/@react-native/codegen")
1717
// The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
18-
cliFile = file("../../../../node_modules/react-native/cli.js")
18+
// cliFile = file("../../node_modules/react-native/cli.js")
1919

2020
/* Variants */
2121
// The list of variants to that are debuggable. For those we're going to
@@ -46,7 +46,6 @@ react {
4646
/* Hermes Commands */
4747
// The hermes compiler command to run. By default it is 'hermesc'
4848
// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
49-
hermesCommand = file("../../../../node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc").absolutePath
5049
//
5150
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
5251
// hermesFlags = ["-O", "-output-source-map"]
@@ -84,7 +83,15 @@ android {
8483
minSdkVersion rootProject.ext.minSdkVersion
8584
targetSdkVersion rootProject.ext.targetSdkVersion
8685
versionCode 1
87-
versionName rootProject.ext.version
86+
versionName "1.0"
87+
}
88+
signingConfigs {
89+
debug {
90+
storeFile file('debug.keystore')
91+
storePassword 'android'
92+
keyAlias 'androiddebugkey'
93+
keyPassword 'android'
94+
}
8895
}
8996
buildTypes {
9097
debug {
@@ -100,17 +107,6 @@ android {
100107
}
101108
}
102109

103-
dependencies {
104-
// The version of react-native is set by the React Native Gradle Plugin
105-
implementation("com.facebook.react:react-android")
106-
107-
if (hermesEnabled.toBoolean()) {
108-
implementation("com.facebook.react:hermes-android")
109-
} else {
110-
implementation jscFlavor
111-
}
112-
}
113-
114110
dependencies {
115111
// The version of react-native is set by the React Native Gradle Plugin
116112
implementation("com.facebook.react:react-android")

examples/SampleApp/android/app/src/debug/AndroidManifest.xml

Lines changed: 0 additions & 9 deletions
This file was deleted.

examples/SampleApp/android/app/src/main/AndroidManifest.xml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
xmlns:tools="http://schemas.android.com/tools">
3-
<!-- package='com.cometchat.sampleapp.reactnative.android'> -->
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package='com.cometchat.sampleapp.reactnative.android'>
42

53
<uses-permission android:name="android.permission.INTERNET" />
64
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
75
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
86
<uses-permission android:name="android.permission.VIBRATE" />
9-
<uses-permission android:name="android.permission.CAMERA" />
107
<uses-permission android:name="android.permission.RECORD_AUDIO" />
8+
<uses-permission android:name="android.permission.CAMERA" />
9+
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
10+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
1111
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
1212
<uses-permission android:name="android.permission.BIND_TELECOM_CONNECTION_SERVICE"/>
1313
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
@@ -22,9 +22,8 @@
2222
android:roundIcon="@mipmap/ic_launcher_round"
2323
android:allowBackup="false"
2424
android:theme="@style/AppTheme"
25+
android:usesCleartextTraffic="${usesCleartextTraffic}"
2526
android:supportsRtl="true">
26-
27-
2827
<activity
2928
android:name=".MainActivity"
3029
android:label="@string/app_name"
@@ -37,6 +36,5 @@
3736
<category android:name="android.intent.category.LAUNCHER" />
3837
</intent-filter>
3938
</activity>
40-
4139
</application>
4240
</manifest>

0 commit comments

Comments
 (0)