Skip to content

Commit fd9212d

Browse files
UI Kit Sample App
1 parent 572aa11 commit fd9212d

File tree

384 files changed

+37008
-3842
lines changed

Some content is hidden

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

384 files changed

+37008
-3842
lines changed

.gitignore

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,70 @@
1-
.DS_Store
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# Xcode
6+
#
7+
build/
8+
*.pbxuser
9+
!default.pbxuser
10+
*.mode1v3
11+
!default.mode1v3
12+
*.mode2v3
13+
!default.mode2v3
14+
*.perspectivev3
15+
!default.perspectivev3
16+
xcuserdata
17+
*.xccheckout
18+
*.moved-aside
19+
DerivedData
20+
*.hmap
21+
*.ipa
22+
*.xcuserstate
23+
project.xcworkspace
24+
25+
# Android/IntelliJ
26+
#
27+
CometChatWorkspace/cometchat-app/android/app/build/
28+
cometchat-app/android/app/build/
29+
/android/app/build/
30+
/app/build/
31+
ios/Pods/*
32+
build/
33+
.idea
34+
.gradle
35+
local.properties
36+
*.iml
37+
38+
# node.js
39+
#
40+
node_modules/
41+
package-lock.json # include if you are using npm - don't use both yarn and npm
42+
npm-debug.log
43+
yarn-error.log
44+
yarn.lock # include if you are using yarn - don't use both npm and yarn
45+
46+
# BUCK
47+
buck-out/
48+
\.buckd/
49+
*.keystore
50+
!CometChatWorkspace/cometchat-app/android/app/debug.keystore
51+
52+
# Fastlane
53+
#
54+
# It is recommended to not store the screenshots in the git repo. Instead, use Fastlane to re-generate the
55+
# screenshots whenever they are needed.
56+
# For more information about the recommended setup visit:
57+
# https://docs.fastlane.tools/best-practices/source-control/
58+
59+
*/fastlane/report.xml
60+
*/fastlane/Preview.html
61+
*/fastlane/screenshots
62+
63+
# Pods
64+
CometChatWorkspace/cometchat-app/ios/Pods/
65+
cometchat-app/ios/Pods/
66+
/ios/Pods/
67+
ios/Pods/*
68+
69+
# Bundle artifact
70+
*.jsbundle
File renamed without changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
root: true,
3+
extends: '@react-native-community',
4+
};
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
[ignore]
2+
; We fork some components by platform
3+
.*/*[.]android.js
4+
5+
; Ignore "BUCK" generated dirs
6+
<PROJECT_ROOT>/\.buckd/
7+
8+
; Ignore polyfills
9+
node_modules/react-native/Libraries/polyfills/.*
10+
11+
; These should not be required directly
12+
; require from fbjs/lib instead: require('fbjs/lib/warning')
13+
node_modules/warning/.*
14+
15+
; Flow doesn't support platforms
16+
.*/Libraries/Utilities/LoadingView.js
17+
18+
[untyped]
19+
.*/node_modules/@react-native-community/cli/.*/.*
20+
21+
[include]
22+
23+
[libs]
24+
node_modules/react-native/interface.js
25+
node_modules/react-native/flow/
26+
27+
[options]
28+
emoji=true
29+
30+
esproposal.optional_chaining=enable
31+
esproposal.nullish_coalescing=enable
32+
33+
module.file_ext=.js
34+
module.file_ext=.json
35+
module.file_ext=.ios.js
36+
37+
munge_underscores=true
38+
39+
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
40+
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'
41+
42+
suppress_type=$FlowIssue
43+
suppress_type=$FlowFixMe
44+
suppress_type=$FlowFixMeProps
45+
suppress_type=$FlowFixMeState
46+
47+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
48+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
49+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
50+
51+
[lints]
52+
sketchy-null-number=warn
53+
sketchy-null-mixed=warn
54+
sketchy-number=warn
55+
untyped-type-import=warn
56+
nonstrict-import=warn
57+
deprecated-type=warn
58+
unsafe-getters-setters=warn
59+
unnecessary-invariant=warn
60+
signature-verification-failure=warn
61+
deprecated-utility=error
62+
63+
[strict]
64+
deprecated-type
65+
nonstrict-import
66+
sketchy-null
67+
unclear-type
68+
unsafe-getters-setters
69+
untyped-import
70+
untyped-type-import
71+
72+
[version]
73+
^0.122.0
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
bracketSpacing: false,
3+
jsxBracketSameLine: true,
4+
singleQuote: true,
5+
trailingComma: 'all',
6+
};
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import React, {useEffect} from 'react';
2+
import 'react-native-gesture-handler';
3+
import {CometChat} from '@cometchat-pro/react-native-chat';
4+
import {Provider} from 'react-redux';
5+
import {store, persistor} from './store/store';
6+
import StackNavigator from './StackNavigator';
7+
import {COMETCHAT_CONSTANTS} from './CONSTS';
8+
import {LogBox} from 'react-native';
9+
import {PersistGate} from 'redux-persist/integration/react';
10+
11+
const App = () => {
12+
LogBox.ignoreAllLogs();
13+
var appSetting = new CometChat.AppSettingsBuilder()
14+
.subscribePresenceForAllUsers()
15+
.setRegion(COMETCHAT_CONSTANTS.REGION)
16+
.build();
17+
18+
CometChat.init(COMETCHAT_CONSTANTS.APP_ID, appSetting).catch(() => {
19+
return null;
20+
});
21+
22+
return (
23+
<Provider store={store}>
24+
<PersistGate loading={null} persistor={persistor}>
25+
<StackNavigator />
26+
</PersistGate>
27+
</Provider>
28+
);
29+
};
30+
31+
export default App;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export const COMETCHAT_CONSTANTS = {
2+
APP_ID: "APP_ID",
3+
REGION: "REGION",
4+
AUTH_KEY: "AUTH_KEY",
5+
};
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import {NavigationContainer} from '@react-navigation/native';
2+
import {createStackNavigator} from '@react-navigation/stack';
3+
import React from 'react';
4+
import {connect} from 'react-redux';
5+
6+
import LoginPage from './defaultPages/LoginPage';
7+
import HomePage from './defaultPages/HomePage';
8+
import {
9+
CometChatUserProfile,
10+
CometChatUI,
11+
CometChatMessages,
12+
CometChatUserListWithMessages,
13+
CometChatUserList,
14+
CometChatGroupListWithMessages,
15+
CometChatGroupList,
16+
CometChatConversationListWithMessages,
17+
CometChatConversationList,
18+
} from './react-native-chat-ui-kit';
19+
20+
function StackNavigator(props) {
21+
const Stack = createStackNavigator();
22+
23+
return (
24+
<NavigationContainer>
25+
<Stack.Navigator
26+
headerMode="none"
27+
initialRouteName={props.isLoggedIn ? 'HomePage' : null}>
28+
<Stack.Screen name="LoginPage" component={LoginPage} />
29+
<Stack.Screen name="HomePage" component={HomePage} />
30+
<Stack.Screen name="CometChatUI" component={CometChatUI} />
31+
<Stack.Screen
32+
name="Conversation"
33+
component={CometChatConversationListWithMessages}
34+
/>
35+
<Stack.Screen
36+
name="ConversationComponent"
37+
component={CometChatConversationList}
38+
/>
39+
<Stack.Screen name="Group" component={CometChatGroupListWithMessages} />
40+
<Stack.Screen name="GroupComponent" component={CometChatGroupList} />
41+
<Stack.Screen name="Users" component={CometChatUserListWithMessages} />
42+
<Stack.Screen name="UsersComponent" component={CometChatUserList} />
43+
<Stack.Screen name="CometChatMessages" component={CometChatMessages} />
44+
</Stack.Navigator>
45+
</NavigationContainer>
46+
);
47+
}
48+
49+
const mapStateToProps = ({reducer}) => {
50+
return {
51+
loading: reducer.loading,
52+
error: reducer.error,
53+
isLoggedIn: reducer.isLoggedIn,
54+
};
55+
};
56+
57+
export default connect(mapStateToProps)(StackNavigator);

chatApp/android/app/BUCK renamed to CometChatWorkspace/cometchat-app/android/app/_BUCK

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ android_library(
3535

3636
android_build_config(
3737
name = "build_config",
38-
package = "com.chatapp",
38+
package = "com.example",
3939
)
4040

4141
android_resource(
4242
name = "res",
43-
package = "com.chatapp",
43+
package = "com.example",
4444
res = "src/main/res",
4545
)
4646

chatApp/android/app/build.gradle renamed to CometChatWorkspace/cometchat-app/android/app/build.gradle

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ import com.android.build.OutputFile
1515
* // the name of the generated asset file containing your JS bundle
1616
* bundleAssetName: "index.android.bundle",
1717
*
18-
* // the entry file for bundle generation
18+
* // the entry file for bundle generation. If none specified and
19+
* // "index.android.js" exists, it will be used. Otherwise "index.js" is
20+
* // default. Can be overridden with ENTRY_FILE environment variable.
1921
* entryFile: "index.android.js",
2022
*
21-
* // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
23+
* // https://reactnative.dev/docs/performance#enable-the-ram-format
2224
* bundleCommand: "ram-bundle",
2325
*
2426
* // whether to bundle JS and assets in debug mode
@@ -76,11 +78,11 @@ import com.android.build.OutputFile
7678
*/
7779

7880
project.ext.react = [
79-
entryFile: "index.js",
8081
enableHermes: false, // clean and rebuild if changing
8182
]
8283

8384
apply from: "../../node_modules/react-native/react.gradle"
85+
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
8486

8587
/**
8688
* Set this to true to create two separate APKs instead of one:
@@ -90,7 +92,7 @@ apply from: "../../node_modules/react-native/react.gradle"
9092
* Upload all the APKs to the Play Store and people will download
9193
* the correct one based on the CPU architecture of their device.
9294
*/
93-
def enableSeparateBuildPerCPUArchitecture = false
95+
def enableSeparateBuildPerCPUArchitecture = true
9496

9597
/**
9698
* Run Proguard to shrink the Java bytecode in release builds.
@@ -128,22 +130,11 @@ android {
128130
}
129131

130132
defaultConfig {
131-
applicationId "com.chatapp"
133+
applicationId "com.example"
132134
minSdkVersion rootProject.ext.minSdkVersion
133135
targetSdkVersion rootProject.ext.targetSdkVersion
134136
versionCode 1
135137
versionName "1.0"
136-
multiDexEnabled true
137-
}
138-
signingConfigs {
139-
release {
140-
if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
141-
storeFile file(MYAPP_UPLOAD_STORE_FILE)
142-
storePassword MYAPP_UPLOAD_STORE_PASSWORD
143-
keyAlias MYAPP_UPLOAD_KEY_ALIAS
144-
keyPassword MYAPP_UPLOAD_KEY_PASSWORD
145-
}
146-
}
147138
}
148139
splits {
149140
abi {
@@ -167,13 +158,13 @@ android {
167158
}
168159
release {
169160
// Caution! In production, you need to generate your own keystore file.
170-
// see https://facebook.github.io/react-native/docs/signed-apk-android.
161+
// see https://reactnative.dev/docs/signed-apk-android.
171162
signingConfig signingConfigs.debug
172163
minifyEnabled enableProguardInReleaseBuilds
173164
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
174-
signingConfig signingConfigs.release
175165
}
176166
}
167+
177168
// applicationVariants are e.g. debug, release
178169
applicationVariants.all { variant ->
179170
variant.outputs.each { output ->
@@ -192,8 +183,24 @@ android {
192183

193184
dependencies {
194185
implementation fileTree(dir: "libs", include: ["*.jar"])
186+
//noinspection GradleDynamicVersion
195187
implementation "com.facebook.react:react-native:+" // From node_modules
196188

189+
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
190+
191+
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
192+
exclude group:'com.facebook.fbjni'
193+
}
194+
195+
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
196+
exclude group:'com.facebook.flipper'
197+
exclude group:'com.squareup.okhttp3', module:'okhttp'
198+
}
199+
200+
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
201+
exclude group:'com.facebook.flipper'
202+
}
203+
197204
if (enableHermes) {
198205
def hermesPath = "../../node_modules/hermes-engine/android/";
199206
debugImplementation files(hermesPath + "hermes-debug.aar")
Binary file not shown.

chatApp/android/app/proguard-rules.pro renamed to CometChatWorkspace/cometchat-app/android/app/proguard-rules.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
# http://developer.android.com/guide/developing/tools/proguard.html
99

1010
# Add any project specific keep options here:
11+
-keep class com.facebook.react.turbomodule.** { *; }

0 commit comments

Comments
 (0)