├── .buckconfig
├── .gitattributes
├── .github
├── FUNDING.yml
└── workflows
│ └── main.yml
├── .gitignore
├── App.tsx
├── README.md
├── android
├── app
│ ├── BUCK
│ ├── build.gradle
│ ├── build_defs.bzl
│ ├── debug.keystore
│ ├── proguard-rules.pro
│ └── src
│ │ ├── debug
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── clubhouseapp
│ │ │ └── ReactNativeFlipper.java
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ └── com
│ │ │ └── clubhouseapp
│ │ │ ├── MainActivity.java
│ │ │ ├── MainApplication.java
│ │ │ └── generated
│ │ │ └── BasePackageList.java
│ │ └── res
│ │ ├── drawable
│ │ ├── splashscreen.xml
│ │ └── splashscreen_image.png
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
├── app.json
├── babel.config.js
├── desktop
├── .editorconfig
├── .gitattributes
├── .gitignore
├── build.js
├── config.js
├── index.js
├── menu.js
├── resources
│ ├── icons
│ │ ├── 1024x1024.png
│ │ ├── 128x128.png
│ │ ├── 16x16.png
│ │ ├── 24x24.png
│ │ ├── 256x256.png
│ │ ├── 32x32.png
│ │ ├── 48x48.png
│ │ ├── 512x512.png
│ │ ├── 64x64.png
│ │ ├── icon.icns
│ │ └── icon.ico
│ └── icons2
│ │ └── icons
│ │ ├── mac
│ │ └── icon.icns
│ │ ├── png
│ │ ├── 1024x1024.png
│ │ ├── 128x128.png
│ │ ├── 16x16.png
│ │ ├── 24x24.png
│ │ ├── 256x256.png
│ │ ├── 32x32.png
│ │ ├── 48x48.png
│ │ ├── 512x512.png
│ │ └── 64x64.png
│ │ └── win
│ │ └── icon.ico
├── static
│ └── Icon.png
├── webpack.config.main.prod.js
└── webpack.config.renderer.dev.js
├── index.js
├── ios
├── File.swift
├── Podfile
├── Podfile.lock
├── clubhouseapp-Bridging-Header.h
├── clubhouseapp.xcodeproj
│ ├── project.pbxproj
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── clubhouseapp.xcscheme
├── clubhouseapp.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
└── clubhouseapp
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Base.lproj
│ └── LaunchScreen.xib
│ ├── Images.xcassets
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ ├── Contents.json
│ ├── SplashScreen.imageset
│ │ ├── Contents.json
│ │ └── splashscreen.png
│ └── SplashScreenBackground.imageset
│ │ ├── Contents.json
│ │ └── background.png
│ ├── Info.plist
│ ├── SplashScreen.storyboard
│ ├── Supporting
│ └── Expo.plist
│ └── main.m
├── metro.config.js
├── package.json
├── src
├── assets
│ ├── default-avatar.ts
│ └── fonts
│ │ └── Nunito
│ │ ├── Nunito-Black.ttf
│ │ ├── Nunito-BlackItalic.ttf
│ │ ├── Nunito-Bold.ttf
│ │ ├── Nunito-BoldItalic.ttf
│ │ ├── Nunito-ExtraBold.ttf
│ │ ├── Nunito-ExtraBoldItalic.ttf
│ │ ├── Nunito-ExtraLight.ttf
│ │ ├── Nunito-ExtraLightItalic.ttf
│ │ ├── Nunito-Italic.ttf
│ │ ├── Nunito-Light.ttf
│ │ ├── Nunito-LightItalic.ttf
│ │ ├── Nunito-Regular.ttf
│ │ ├── Nunito-SemiBold.ttf
│ │ ├── Nunito-SemiBoldItalic.ttf
│ │ └── OFL.txt
├── components
│ ├── flex.tsx
│ ├── room-mini-player.tsx
│ ├── screen.tsx
│ └── touchable.tsx
├── contexts
│ ├── room
│ │ ├── context.ts
│ │ └── provider.tsx
│ ├── rtcContext.tsx
│ └── theme
│ │ ├── context.ts
│ │ ├── provider.tsx
│ │ └── themes.ts
├── index.d.ts
├── models
│ ├── api.ts
│ ├── channel.ts
│ └── user.ts
├── navigator.tsx
├── screens
│ ├── home.tsx
│ ├── is-waitlisted.tsx
│ ├── login.tsx
│ ├── room
│ │ ├── index.tsx
│ │ ├── room-recycler-list.tsx
│ │ └── user-cell.tsx
│ ├── signup.tsx
│ ├── user-profile.tsx
│ └── verification-code.tsx
├── slices
│ ├── authSlice.ts
│ ├── authThunks.ts
│ └── roomSlice.ts
├── store
│ ├── persistConfig.ts
│ └── store.ts
└── utils
│ ├── mock.js
│ ├── req.ts
│ └── useInteractionManager.ts
├── tsconfig.json
├── web
├── expo-service-worker.js
├── index.html
├── register-service-worker.js
└── serve.json
├── webpack.config.js
└── yarn.lock
/.buckconfig:
--------------------------------------------------------------------------------
1 |
2 | [android]
3 | target = Google Inc.:Google APIs:23
4 |
5 | [maven_repositories]
6 | central = https://repo1.maven.org/maven2
7 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.pbxproj -text
2 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: arnnis
5 | open_collective: #Open
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
13 |
--------------------------------------------------------------------------------
/.github/workflows/main.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 |
3 | on:
4 | push:
5 | tags:
6 | - "v*.*.*"
7 |
8 | jobs:
9 | build:
10 | runs-on: ubuntu-latest
11 |
12 | steps:
13 | - uses: actions/checkout@v2
14 |
15 | - name: Setup Node.js 12
16 | uses: actions/setup-node@v1
17 | with:
18 | node-version: 12.x
19 |
20 | - name: node_modules Cache
21 | uses: actions/cache@v1
22 | with:
23 | path: ~/.cache/yarn
24 | key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
25 | restore-keys: |
26 | ${{ runner.os }}-yarn-
27 |
28 | - name: Install dependencies
29 | run: yarn install
30 |
31 | - name: Patch workers (fixes android build)
32 | run: sudo sysctl fs.inotify.max_user_instances=524288 && sudo sysctl fs.inotify.max_user_watches=524288 && sudo sysctl fs.inotify.max_queued_events=524288 && sudo sysctl -p
33 |
34 | - name: Setup java 8
35 | uses: actions/setup-java@v1.4.3
36 | with:
37 | java-version: "1.8"
38 |
39 | - name: Build android
40 | run: yarn android:release
41 |
42 | - name: Build web
43 | run: npx expo build:web
44 |
45 | - name: Deploy to github pages
46 | if: success()
47 | uses: crazy-max/ghaction-github-pages@v1
48 | with:
49 | target_branch: gh-pages
50 | build_dir: web-build
51 | env:
52 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53 | - name: Release artifacts
54 | uses: softprops/action-gh-release@v1
55 | with:
56 | files: |
57 | android/app/build/outputs/apk/release/*.apk
58 | env:
59 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
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 | build/
28 | .idea
29 | .gradle
30 | local.properties
31 | *.iml
32 | *.hprof
33 |
34 | # node.js
35 | #
36 | node_modules/
37 | npm-debug.log
38 | yarn-error.log
39 |
40 | # BUCK
41 | buck-out/
42 | \.buckd/
43 | *.keystore
44 | !debug.keystore
45 |
46 | # fastlane
47 | #
48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
49 | # screenshots whenever they are needed.
50 | # For more information about the recommended setup visit:
51 | # https://docs.fastlane.tools/best-practices/source-control/
52 |
53 | */fastlane/report.xml
54 | */fastlane/Preview.html
55 | */fastlane/screenshots
56 |
57 | # Bundle artifacts
58 | *.jsbundle
59 |
60 | # CocoaPods
61 | /ios/Pods/
62 |
63 | # Expo
64 | .expo/*
65 | web-build/
66 |
--------------------------------------------------------------------------------
/App.tsx:
--------------------------------------------------------------------------------
1 | import { StatusBar } from "expo-status-bar";
2 | import { useFonts } from "expo-font";
3 | import React from "react";
4 | import { Platform, StyleSheet, View } from "react-native";
5 | import Navigator from "./src/navigator";
6 | import { LogBox } from "react-native";
7 | import Toast from "react-native-fast-toast";
8 | import RoomMiniPlayer from "./src/components/room-mini-player";
9 |
10 | // This log comes from rtc/pubnub depencency
11 | Platform.OS !== "web" &&
12 | LogBox.ignoreLogs(["Setting a timer for a long period of time"]);
13 |
14 | export default function App() {
15 | const [loaded, error] = useFonts({
16 | "Nunito-Regular": require("./src/assets/fonts/Nunito/Nunito-Regular.ttf"),
17 | "Nunito-SemiBold": require("./src/assets/fonts/Nunito/Nunito-SemiBold.ttf"),
18 | "Nunito-Bold": require("./src/assets/fonts/Nunito/Nunito-Bold.ttf"),
19 | "Nunito-Light": require("./src/assets/fonts/Nunito/Nunito-Light.ttf"),
20 | });
21 | if (!loaded) return null;
22 |
23 | return (
24 |
25 |
26 |
27 | (global["toast"] = ref)} />
28 |
29 | );
30 | }
31 |
32 | const styles = StyleSheet.create({
33 | container: {
34 | flex: 1,
35 | backgroundColor: "#fff",
36 | },
37 | });
38 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Clubreact
2 |
3 | Unofficial Clubhouse app, Written in React Native.
4 |
5 | ## Screenshots
6 |
7 | | Light theme | Night theme |
8 | | ----------- | ----------- |
9 | | ![][light] | ![][dark] |
10 |
11 | ## Install
12 |
13 | - [Android](https://github.com/arnnis/clubreact/releases/latest) - Android apk download
14 | - IOS - No export for ios, but you can build it from source yourself.
15 | - [Web demo](https://arnnis.github.io/Clubreact) - Web version using react-native-web & expo-web (login broken due to CORS).
16 |
18 |
19 | [dark]: https://user-images.githubusercontent.com/61647712/114277408-bc69ec00-9a33-11eb-9c9a-775772e73fbc.jpg
20 | [light]: https://user-images.githubusercontent.com/61647712/114277409-be33af80-9a33-11eb-97ba-b905ad096bb7.jpg
21 |
22 | ## Features
23 |
24 | - [x] Login
25 | - [x] List of rooms
26 | - [x] Joining & Listening to room
27 | - [x] Audience realtime change (pubnub)
28 | - [x] User profiles
29 | - [x] Night theme
30 | - [x] Registeration
31 | - [ ] Create room
32 | - [ ] Raising hand & speaking
33 | - [ ] Follow & unfollow & lists
34 | - [ ] Update bio
35 | - [ ] Upload avatar
36 | - [ ] Explore page
37 |
38 | ## Contributing
39 |
40 | Run the following to start webpack development server:
41 |
42 | ```sh
43 | yarn web
44 | ```
45 |
46 | To run android:
47 |
48 | ```sh
49 | yarn android
50 | ```
51 |
52 | To run ios:
53 |
54 | ```sh
55 | yarn ios
56 | ```
57 |
58 | To build for android:
59 |
60 | ```sh
61 | yarn android:release
62 | ```
63 |
64 | To build for web:
65 |
66 | ```sh
67 | yarn web:release
68 | ```
69 |
70 | ## Hire
71 |
72 | Looking for a React/React-Native Expert? Email at alirezarzna@gmail.com
73 |
74 | ## License
75 |
76 | MIT
77 |
--------------------------------------------------------------------------------
/android/app/BUCK:
--------------------------------------------------------------------------------
1 | # To learn about Buck see [Docs](https://buckbuild.com/).
2 | # To run your application with Buck:
3 | # - install Buck
4 | # - `npm start` - to start the packager
5 | # - `cd android`
6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
8 | # - `buck install -r android/app` - compile, install and run application
9 | #
10 |
11 | load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
12 |
13 | lib_deps = []
14 |
15 | create_aar_targets(glob(["libs/*.aar"]))
16 |
17 | create_jar_targets(glob(["libs/*.jar"]))
18 |
19 | android_library(
20 | name = "all-libs",
21 | exported_deps = lib_deps,
22 | )
23 |
24 | android_library(
25 | name = "app-code",
26 | srcs = glob([
27 | "src/main/java/**/*.java",
28 | ]),
29 | deps = [
30 | ":all-libs",
31 | ":build_config",
32 | ":res",
33 | ],
34 | )
35 |
36 | android_build_config(
37 | name = "build_config",
38 | package = "com.clubhouseapp",
39 | )
40 |
41 | android_resource(
42 | name = "res",
43 | package = "com.clubhouseapp",
44 | res = "src/main/res",
45 | )
46 |
47 | android_binary(
48 | name = "app",
49 | keystore = "//android/keystores:debug",
50 | manifest = "src/main/AndroidManifest.xml",
51 | package_type = "debug",
52 | deps = [
53 | ":app-code",
54 | ],
55 | )
56 |
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "com.android.application"
2 |
3 | import com.android.build.OutputFile
4 |
5 | /**
6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7 | * and bundleReleaseJsAndAssets).
8 | * These basically call `react-native bundle` with the correct arguments during the Android build
9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10 | * bundle directly from the development server. Below you can see all the possible configurations
11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the
12 | * `apply from: "../../node_modules/react-native/react.gradle"` line.
13 | *
14 | * project.ext.react = [
15 | * // the name of the generated asset file containing your JS bundle
16 | * bundleAssetName: "index.android.bundle",
17 | *
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.
21 | * entryFile: "index.android.js",
22 | *
23 | * // https://reactnative.dev/docs/performance#enable-the-ram-format
24 | * bundleCommand: "ram-bundle",
25 | *
26 | * // whether to bundle JS and assets in debug mode
27 | * bundleInDebug: false,
28 | *
29 | * // whether to bundle JS and assets in release mode
30 | * bundleInRelease: true,
31 | *
32 | * // whether to bundle JS and assets in another build variant (if configured).
33 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
34 | * // The configuration property can be in the following formats
35 | * // 'bundleIn${productFlavor}${buildType}'
36 | * // 'bundleIn${buildType}'
37 | * // bundleInFreeDebug: true,
38 | * // bundleInPaidRelease: true,
39 | * // bundleInBeta: true,
40 | *
41 | * // whether to disable dev mode in custom build variants (by default only disabled in release)
42 | * // for example: to disable dev mode in the staging build type (if configured)
43 | * devDisabledInStaging: true,
44 | * // The configuration property can be in the following formats
45 | * // 'devDisabledIn${productFlavor}${buildType}'
46 | * // 'devDisabledIn${buildType}'
47 | *
48 | * // the root of your project, i.e. where "package.json" lives
49 | * root: "../../",
50 | *
51 | * // where to put the JS bundle asset in debug mode
52 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
53 | *
54 | * // where to put the JS bundle asset in release mode
55 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release",
56 | *
57 | * // where to put drawable resources / React Native assets, e.g. the ones you use via
58 | * // require('./image.png')), in debug mode
59 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
60 | *
61 | * // where to put drawable resources / React Native assets, e.g. the ones you use via
62 | * // require('./image.png')), in release mode
63 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
64 | *
65 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means
66 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
67 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle
68 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
69 | * // for example, you might want to remove it from here.
70 | * inputExcludes: ["android/**", "ios/**"],
71 | *
72 | * // override which node gets called and with what additional arguments
73 | * nodeExecutableAndArgs: ["node"],
74 | *
75 | * // supply additional arguments to the packager
76 | * extraPackagerArgs: []
77 | * ]
78 | */
79 |
80 | project.ext.react = [
81 | enableHermes: true
82 | ]
83 |
84 | apply from: '../../node_modules/react-native-unimodules/gradle.groovy'
85 | apply from: "../../node_modules/react-native/react.gradle"
86 | apply from: "../../node_modules/expo-constants/scripts/get-app-config-android.gradle"
87 | apply from: "../../node_modules/expo-updates/scripts/create-manifest-android.gradle"
88 |
89 | /**
90 | * Set this to true to create two separate APKs instead of one:
91 | * - An APK that only works on ARM devices
92 | * - An APK that only works on x86 devices
93 | * The advantage is the size of the APK is reduced by about 4MB.
94 | * Upload all the APKs to the Play Store and people will download
95 | * the correct one based on the CPU architecture of their device.
96 | */
97 | def enableSeparateBuildPerCPUArchitecture = false
98 |
99 | /**
100 | * Run Proguard to shrink the Java bytecode in release builds.
101 | */
102 | def enableProguardInReleaseBuilds = false
103 |
104 | /**
105 | * The preferred build flavor of JavaScriptCore.
106 | *
107 | * For example, to use the international variant, you can use:
108 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
109 | *
110 | * The international variant includes ICU i18n library and necessary data
111 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
112 | * give correct results when using with locales other than en-US. Note that
113 | * this variant is about 6MiB larger per architecture than default.
114 | */
115 | def jscFlavor = 'org.webkit:android-jsc:+'
116 |
117 | /**
118 | * Whether to enable the Hermes VM.
119 | *
120 | * This should be set on project.ext.react and mirrored here. If it is not set
121 | * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
122 | * and the benefits of using Hermes will therefore be sharply reduced.
123 | */
124 | def enableHermes = project.ext.react.get("enableHermes", false);
125 |
126 | android {
127 | compileSdkVersion rootProject.ext.compileSdkVersion
128 |
129 | compileOptions {
130 | sourceCompatibility JavaVersion.VERSION_1_8
131 | targetCompatibility JavaVersion.VERSION_1_8
132 | }
133 |
134 | defaultConfig {
135 | applicationId "com.clubhouseapp"
136 | minSdkVersion rootProject.ext.minSdkVersion
137 | targetSdkVersion rootProject.ext.targetSdkVersion
138 | versionCode 2
139 | versionName "0.2.0"
140 | setProperty("archivesBaseName", "Clubreact-$versionName") // appends version to output apk name.
141 | }
142 | splits {
143 | abi {
144 | reset()
145 | enable enableSeparateBuildPerCPUArchitecture
146 | universalApk false // If true, also generate a universal APK
147 | include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
148 | }
149 | }
150 | signingConfigs {
151 | debug {
152 | storeFile file('debug.keystore')
153 | storePassword 'android'
154 | keyAlias 'androiddebugkey'
155 | keyPassword 'android'
156 | }
157 | }
158 | buildTypes {
159 | debug {
160 | signingConfig signingConfigs.debug
161 | }
162 | release {
163 | // Caution! In production, you need to generate your own keystore file.
164 | // see https://reactnative.dev/docs/signed-apk-android.
165 | signingConfig signingConfigs.debug
166 | minifyEnabled enableProguardInReleaseBuilds
167 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
168 | }
169 | }
170 |
171 | // applicationVariants are e.g. debug, release
172 | applicationVariants.all { variant ->
173 | variant.outputs.each { output ->
174 | // For each separate APK per architecture, set a unique version code as described here:
175 | // https://developer.android.com/studio/build/configure-apk-splits.html
176 | def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
177 | def abi = output.getFilter(OutputFile.ABI)
178 | if (abi != null) { // null for the universal-debug, universal-release variants
179 | output.versionCodeOverride =
180 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
181 | }
182 |
183 | }
184 | }
185 | }
186 |
187 | dependencies {
188 | implementation fileTree(dir: "libs", include: ["*.jar"])
189 | //noinspection GradleDynamicVersion
190 | implementation "com.facebook.react:react-native:+" // From node_modules
191 | implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
192 | debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
193 | exclude group:'com.facebook.fbjni'
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 | debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
200 | exclude group:'com.facebook.flipper'
201 | }
202 | addUnimodulesDependencies()
203 |
204 | if (enableHermes) {
205 | def hermesPath = "../../node_modules/hermes-engine/android/";
206 | debugImplementation files(hermesPath + "hermes-debug.aar")
207 | releaseImplementation files(hermesPath + "hermes-release.aar")
208 | } else {
209 | implementation jscFlavor
210 | }
211 | }
212 |
213 | // Run this once to be able to run the application with BUCK
214 | // puts all compile dependencies into folder libs for BUCK to use
215 | task copyDownloadableDepsToLibs(type: Copy) {
216 | from configurations.compile
217 | into 'libs'
218 | }
219 |
220 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
221 |
--------------------------------------------------------------------------------
/android/app/build_defs.bzl:
--------------------------------------------------------------------------------
1 | """Helper definitions to glob .aar and .jar targets"""
2 |
3 | def create_aar_targets(aarfiles):
4 | for aarfile in aarfiles:
5 | name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")]
6 | lib_deps.append(":" + name)
7 | android_prebuilt_aar(
8 | name = name,
9 | aar = aarfile,
10 | )
11 |
12 | def create_jar_targets(jarfiles):
13 | for jarfile in jarfiles:
14 | name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")]
15 | lib_deps.append(":" + name)
16 | prebuilt_jar(
17 | name = name,
18 | binary_jar = jarfile,
19 | )
20 |
--------------------------------------------------------------------------------
/android/app/debug.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/android/app/debug.keystore
--------------------------------------------------------------------------------
/android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/app/src/debug/java/com/clubhouseapp/ReactNativeFlipper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Facebook, Inc. and its affiliates.
3 | *
4 | *
This source code is licensed under the MIT license found in the LICENSE file in the root
5 | * directory of this source tree.
6 | */
7 | package com.clubhouseapp;
8 |
9 | import android.content.Context;
10 | import com.facebook.flipper.android.AndroidFlipperClient;
11 | import com.facebook.flipper.android.utils.FlipperUtils;
12 | import com.facebook.flipper.core.FlipperClient;
13 | import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
14 | import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
15 | import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
16 | import com.facebook.flipper.plugins.inspector.DescriptorMapping;
17 | import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
18 | import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
19 | import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
20 | import com.facebook.flipper.plugins.react.ReactFlipperPlugin;
21 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
22 | import com.facebook.react.ReactInstanceManager;
23 | import com.facebook.react.bridge.ReactContext;
24 | import com.facebook.react.modules.network.NetworkingModule;
25 | import okhttp3.OkHttpClient;
26 |
27 | public class ReactNativeFlipper {
28 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
29 | if (FlipperUtils.shouldEnableFlipper(context)) {
30 | final FlipperClient client = AndroidFlipperClient.getInstance(context);
31 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
32 | client.addPlugin(new ReactFlipperPlugin());
33 | client.addPlugin(new DatabasesFlipperPlugin(context));
34 | client.addPlugin(new SharedPreferencesFlipperPlugin(context));
35 | client.addPlugin(CrashReporterPlugin.getInstance());
36 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
37 | NetworkingModule.setCustomClientBuilder(
38 | new NetworkingModule.CustomClientBuilder() {
39 | @Override
40 | public void apply(OkHttpClient.Builder builder) {
41 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
42 | }
43 | });
44 | client.addPlugin(networkFlipperPlugin);
45 | client.start();
46 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
47 | // Hence we run if after all native modules have been initialized
48 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
49 | if (reactContext == null) {
50 | reactInstanceManager.addReactInstanceEventListener(
51 | new ReactInstanceManager.ReactInstanceEventListener() {
52 | @Override
53 | public void onReactContextInitialized(ReactContext reactContext) {
54 | reactInstanceManager.removeReactInstanceEventListener(this);
55 | reactContext.runOnNativeModulesQueueThread(
56 | new Runnable() {
57 | @Override
58 | public void run() {
59 | client.addPlugin(new FrescoFlipperPlugin());
60 | }
61 | });
62 | }
63 | });
64 | } else {
65 | client.addPlugin(new FrescoFlipperPlugin());
66 | }
67 | }
68 | }
69 | }
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
32 |
33 |
34 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/android/app/src/main/java/com/clubhouseapp/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.clubhouseapp;
2 |
3 | import android.os.Bundle;
4 |
5 | import com.facebook.react.ReactActivity;
6 | import com.facebook.react.ReactActivityDelegate;
7 | import com.facebook.react.ReactRootView;
8 | import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
9 |
10 | import expo.modules.splashscreen.singletons.SplashScreen;
11 | import expo.modules.splashscreen.SplashScreenImageResizeMode;
12 |
13 | public class MainActivity extends ReactActivity {
14 | @Override
15 | protected void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(null);
17 | // SplashScreen.show(...) has to be called after super.onCreate(...)
18 | // Below line is handled by '@expo/configure-splash-screen' command and it's discouraged to modify it manually
19 | SplashScreen.show(this, SplashScreenImageResizeMode.CONTAIN, ReactRootView.class, false);
20 | }
21 |
22 |
23 | /**
24 | * Returns the name of the main component registered from JavaScript.
25 | * This is used to schedule rendering of the component.
26 | */
27 | @Override
28 | protected String getMainComponentName() {
29 | return "main";
30 | }
31 |
32 | @Override
33 | protected ReactActivityDelegate createReactActivityDelegate() {
34 | return new ReactActivityDelegate(this, getMainComponentName()) {
35 | @Override
36 | protected ReactRootView createRootView() {
37 | return new RNGestureHandlerEnabledRootView(MainActivity.this);
38 | }
39 | };
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/android/app/src/main/java/com/clubhouseapp/MainApplication.java:
--------------------------------------------------------------------------------
1 | package com.clubhouseapp;
2 |
3 | import android.app.Application;
4 | import android.content.Context;
5 | import android.net.Uri;
6 |
7 | import com.facebook.react.PackageList;
8 | import com.facebook.react.ReactApplication;
9 | import com.facebook.react.ReactInstanceManager;
10 | import com.facebook.react.ReactNativeHost;
11 | import com.facebook.react.ReactPackage;
12 | import com.facebook.react.shell.MainReactPackage;
13 | import com.facebook.soloader.SoLoader;
14 | import com.clubhouseapp.generated.BasePackageList;
15 |
16 | import org.unimodules.adapters.react.ReactAdapterPackage;
17 | import org.unimodules.adapters.react.ModuleRegistryAdapter;
18 | import org.unimodules.adapters.react.ReactModuleRegistryProvider;
19 | import org.unimodules.core.interfaces.Package;
20 | import org.unimodules.core.interfaces.SingletonModule;
21 | import expo.modules.constants.ConstantsPackage;
22 | import expo.modules.permissions.PermissionsPackage;
23 | import expo.modules.filesystem.FileSystemPackage;
24 | import expo.modules.updates.UpdatesController;
25 |
26 | import java.lang.reflect.InvocationTargetException;
27 | import java.util.Arrays;
28 | import java.util.List;
29 | import javax.annotation.Nullable;
30 |
31 | public class MainApplication extends Application implements ReactApplication {
32 | private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(
33 | new BasePackageList().getPackageList()
34 | );
35 |
36 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
37 | @Override
38 | public boolean getUseDeveloperSupport() {
39 | return BuildConfig.DEBUG;
40 | }
41 |
42 | @Override
43 | protected List getPackages() {
44 | List packages = new PackageList(this).getPackages();
45 | packages.add(new ModuleRegistryAdapter(mModuleRegistryProvider));
46 | return packages;
47 | }
48 |
49 | @Override
50 | protected String getJSMainModuleName() {
51 | return "index";
52 | }
53 |
54 | @Override
55 | protected @Nullable String getJSBundleFile() {
56 | if (BuildConfig.DEBUG) {
57 | return super.getJSBundleFile();
58 | } else {
59 | return UpdatesController.getInstance().getLaunchAssetFile();
60 | }
61 | }
62 |
63 | @Override
64 | protected @Nullable String getBundleAssetName() {
65 | if (BuildConfig.DEBUG) {
66 | return super.getBundleAssetName();
67 | } else {
68 | return UpdatesController.getInstance().getBundleAssetName();
69 | }
70 | }
71 | };
72 |
73 | @Override
74 | public ReactNativeHost getReactNativeHost() {
75 | return mReactNativeHost;
76 | }
77 |
78 | @Override
79 | public void onCreate() {
80 | super.onCreate();
81 | SoLoader.init(this, /* native exopackage */ false);
82 |
83 | if (!BuildConfig.DEBUG) {
84 | UpdatesController.initialize(this);
85 | }
86 |
87 | initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
88 | }
89 |
90 | /**
91 | * Loads Flipper in React Native templates. Call this in the onCreate method with something like
92 | * initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
93 | *
94 | * @param context
95 | * @param reactInstanceManager
96 | */
97 | private static void initializeFlipper(
98 | Context context, ReactInstanceManager reactInstanceManager) {
99 | if (BuildConfig.DEBUG) {
100 | try {
101 | /*
102 | We use reflection here to pick up the class that initializes Flipper,
103 | since Flipper library is not available in release mode
104 | */
105 | Class> aClass = Class.forName("com.clubhouseapp.ReactNativeFlipper");
106 | aClass
107 | .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
108 | .invoke(null, context, reactInstanceManager);
109 | } catch (ClassNotFoundException e) {
110 | e.printStackTrace();
111 | } catch (NoSuchMethodException e) {
112 | e.printStackTrace();
113 | } catch (IllegalAccessException e) {
114 | e.printStackTrace();
115 | } catch (InvocationTargetException e) {
116 | e.printStackTrace();
117 | }
118 | }
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/android/app/src/main/java/com/clubhouseapp/generated/BasePackageList.java:
--------------------------------------------------------------------------------
1 | package com.clubhouseapp.generated;
2 |
3 | import java.util.Arrays;
4 | import java.util.List;
5 | import org.unimodules.core.interfaces.Package;
6 |
7 | public class BasePackageList {
8 | public List getPackageList() {
9 | return Arrays.asList(
10 | new expo.modules.application.ApplicationPackage(),
11 | new expo.modules.constants.ConstantsPackage(),
12 | new expo.modules.errorrecovery.ErrorRecoveryPackage(),
13 | new expo.modules.filesystem.FileSystemPackage(),
14 | new expo.modules.font.FontLoaderPackage(),
15 | new expo.modules.imageloader.ImageLoaderPackage(),
16 | new expo.modules.keepawake.KeepAwakePackage(),
17 | new expo.modules.lineargradient.LinearGradientPackage(),
18 | new expo.modules.location.LocationPackage(),
19 | new expo.modules.permissions.PermissionsPackage(),
20 | new expo.modules.securestore.SecureStorePackage(),
21 | new expo.modules.splashscreen.SplashScreenPackage(),
22 | new expo.modules.sqlite.SQLitePackage(),
23 | new expo.modules.updates.UpdatesPackage()
24 | );
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/splashscreen.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/splashscreen_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/android/app/src/main/res/drawable/splashscreen_image.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #FFFFFF
5 |
6 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Clubreact
3 |
4 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext {
5 | buildToolsVersion = "29.0.2"
6 | minSdkVersion = 21
7 | compileSdkVersion = 29
8 | targetSdkVersion = 29
9 | }
10 | repositories {
11 | google()
12 | jcenter()
13 | }
14 | dependencies {
15 | classpath("com.android.tools.build:gradle:3.5.3")
16 |
17 | // NOTE: Do not place your application dependencies here; they belong
18 | // in the individual module build.gradle files
19 | }
20 | }
21 |
22 | allprojects {
23 | repositories {
24 | mavenLocal()
25 | maven {
26 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
27 | url("$rootDir/../node_modules/react-native/android")
28 | }
29 | maven {
30 | // Android JSC is installed from npm
31 | url("$rootDir/../node_modules/jsc-android/dist")
32 | }
33 |
34 | google()
35 | jcenter()
36 | maven { url 'https://www.jitpack.io' }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
20 | # AndroidX package structure to make it clearer which packages are bundled with the
21 | # Android operating system, and which are packaged with your app's APK
22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
23 | android.useAndroidX=true
24 |
25 | # Automatically convert third-party libraries to use AndroidX
26 | android.enableJetifier=true
27 |
28 | # Version of flipper SDK to use with React Native
29 | FLIPPER_VERSION=0.54.0
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 | # Determine the Java command to use to start the JVM.
86 | if [ -n "$JAVA_HOME" ] ; then
87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
88 | # IBM's JDK on AIX uses strange locations for the executables
89 | JAVACMD="$JAVA_HOME/jre/sh/java"
90 | else
91 | JAVACMD="$JAVA_HOME/bin/java"
92 | fi
93 | if [ ! -x "$JAVACMD" ] ; then
94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
95 |
96 | Please set the JAVA_HOME variable in your environment to match the
97 | location of your Java installation."
98 | fi
99 | else
100 | JAVACMD="java"
101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
102 |
103 | Please set the JAVA_HOME variable in your environment to match the
104 | location of your Java installation."
105 | fi
106 |
107 | # Increase the maximum file descriptors if we can.
108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
109 | MAX_FD_LIMIT=`ulimit -H -n`
110 | if [ $? -eq 0 ] ; then
111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
112 | MAX_FD="$MAX_FD_LIMIT"
113 | fi
114 | ulimit -n $MAX_FD
115 | if [ $? -ne 0 ] ; then
116 | warn "Could not set maximum file descriptor limit: $MAX_FD"
117 | fi
118 | else
119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
120 | fi
121 | fi
122 |
123 | # For Darwin, add options to specify how the application appears in the dock
124 | if $darwin; then
125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
126 | fi
127 |
128 | # For Cygwin or MSYS, switch paths to Windows format before running java
129 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
132 | JAVACMD=`cygpath --unix "$JAVACMD"`
133 |
134 | # We build the pattern for arguments to be converted via cygpath
135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
136 | SEP=""
137 | for dir in $ROOTDIRSRAW ; do
138 | ROOTDIRS="$ROOTDIRS$SEP$dir"
139 | SEP="|"
140 | done
141 | OURCYGPATTERN="(^($ROOTDIRS))"
142 | # Add a user-defined pattern to the cygpath arguments
143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
145 | fi
146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
147 | i=0
148 | for arg in "$@" ; do
149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
151 |
152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
154 | else
155 | eval `echo args$i`="\"$arg\""
156 | fi
157 | i=`expr $i + 1`
158 | done
159 | case $i in
160 | 0) set -- ;;
161 | 1) set -- "$args0" ;;
162 | 2) set -- "$args0" "$args1" ;;
163 | 3) set -- "$args0" "$args1" "$args2" ;;
164 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
165 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
166 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
167 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
168 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
169 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
170 | esac
171 | fi
172 |
173 | # Escape application args
174 | save () {
175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
176 | echo " "
177 | }
178 | APP_ARGS=`save "$@"`
179 |
180 | # Collect all arguments for the java command, following the shell quoting and substitution rules
181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
182 |
183 | exec "$JAVACMD" "$@"
184 |
--------------------------------------------------------------------------------
/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto init
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto init
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :init
68 | @rem Get command-line arguments, handling Windows variants
69 |
70 | if not "%OS%" == "Windows_NT" goto win9xME_args
71 |
72 | :win9xME_args
73 | @rem Slurp the command line arguments.
74 | set CMD_LINE_ARGS=
75 | set _SKIP=2
76 |
77 | :win9xME_args_slurp
78 | if "x%~1" == "x" goto execute
79 |
80 | set CMD_LINE_ARGS=%*
81 |
82 | :execute
83 | @rem Setup the command line
84 |
85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
86 |
87 | @rem Execute Gradle
88 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
89 |
90 | :end
91 | @rem End local scope for the variables with windows NT shell
92 | if "%ERRORLEVEL%"=="0" goto mainEnd
93 |
94 | :fail
95 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
96 | rem the _cmd.exe /c_ return code!
97 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
98 | exit /b 1
99 |
100 | :mainEnd
101 | if "%OS%"=="Windows_NT" endlocal
102 |
103 | :omega
104 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'clubhouseapp'
2 |
3 | apply from: '../node_modules/react-native-unimodules/gradle.groovy'
4 | includeUnimodulesProjects()
5 |
6 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle");
7 | applyNativeModulesSettingsGradle(settings)
8 |
9 | include ':app'
10 |
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "clubhouse-app",
3 | "displayName": "clubhouse-app",
4 | "expo": {
5 | "name": "clubhouse-app",
6 | "slug": "clubhouse-app",
7 | "version": "0.1.0",
8 | "assetBundlePatterns": [
9 | "**/*"
10 | ],
11 | "android": {
12 | "versionCode": 1
13 | },
14 | "ios": {
15 | "buildNumber": "1"
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = function(api) {
2 | api.cache(true);
3 | return {
4 | presets: ['babel-preset-expo'],
5 | };
6 | };
7 |
--------------------------------------------------------------------------------
/desktop/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = tab
5 | end_of_line = lf
6 | charset = utf-8
7 | trim_trailing_whitespace = true
8 | insert_final_newline = true
9 |
10 | [*.yml]
11 | indent_style = space
12 | indent_size = 2
13 |
--------------------------------------------------------------------------------
/desktop/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto eol=lf
2 |
--------------------------------------------------------------------------------
/desktop/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | yarn.lock
3 | /dist
4 |
--------------------------------------------------------------------------------
/desktop/build.js:
--------------------------------------------------------------------------------
1 | const shell = require("shelljs");
2 | const chalk = require("chalk").default;
3 |
4 | try {
5 | // build electron-main js bundle
6 | shell.exec(
7 | "cross-env NODE_ENV=production webpack --config ./desktop/webpack.config.main.prod.js --color"
8 | );
9 |
10 | if (shell.ls().some((item) => item.includes("temp"))) {
11 | console.log(chalk.bgYellow("Removing old temp folder"));
12 | shell.rm("-rf", "temp");
13 | }
14 |
15 | console.log(chalk.bgCyan("Moving necessary files to temp folder..."));
16 | shell.mkdir("temp");
17 | shell.cp("-r", "./web-build", "./temp/www");
18 | console.log(chalk.bgYellow("Removing old dist folder if exists..."));
19 | shell.rm("-rf", "./desktop/dist");
20 | shell.cp("-r", "./desktop/build/*", "./temp");
21 | shell.cp("-r", "./desktop/resources", "./temp");
22 | shell.cp("package.json", "./temp/");
23 | shell.mkdir("temp/node_modules");
24 | shell.cp("-r", "./node_modules/electron*", "./temp/node_modules");
25 | shell.cd("temp");
26 |
27 | console.log(chalk.bgCyan("Starting desktop pack..."));
28 | shell.exec("electron-builder . -mwl");
29 | console.log(chalk.bgGreen("Desktop build done..."));
30 |
31 | console.log(chalk.bgYellow("Removing temp folder..."));
32 | shell.cd("..");
33 | shell.rm("-rf", "temp");
34 |
35 | console.log(chalk.bgGreen("All done"));
36 | } catch (err) {
37 | console.log(chalk.bgRed(err));
38 | }
39 |
--------------------------------------------------------------------------------
/desktop/config.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | const Store = require('electron-store');
3 |
4 | module.exports = new Store({
5 | defaults: {
6 | favoriteAnimal: '🦄'
7 | }
8 | });
9 |
--------------------------------------------------------------------------------
/desktop/index.js:
--------------------------------------------------------------------------------
1 | const path = require("path");
2 | const { app, BrowserWindow, Menu, ipcMain } = require("electron");
3 | const { is } = require("electron-util");
4 | const unhandled = require("electron-unhandled");
5 | const debug = require("electron-debug");
6 | const contextMenu = require("electron-context-menu");
7 | const electronDL = require("electron-dl");
8 | const menu = require("./menu");
9 |
10 | electronDL();
11 | unhandled();
12 | debug();
13 | contextMenu();
14 |
15 | // Note: Must match `build.appId` in package.json
16 | app.setAppUserModelId("com.arnnis.sup");
17 |
18 | // Prevent window from being garbage collected
19 | let mainWindow;
20 |
21 | const createMainWindow = async () => {
22 | const win = new BrowserWindow({
23 | title: app.getName(),
24 | show: false,
25 | width: 1280,
26 | height: 720,
27 | webPreferences: {
28 | devTools: is.development,
29 | nodeIntegration: true,
30 | },
31 | });
32 |
33 | win.on("ready-to-show", () => {
34 | win.show();
35 | });
36 |
37 | win.on("closed", () => {
38 | // Dereference the window
39 | // For multiple windows store them in an array
40 | mainWindow = undefined;
41 | });
42 |
43 | if (is.development) {
44 | await win.loadURL("http://localhost:19006/index.html");
45 | } else {
46 | await win.loadFile("./www/index.html");
47 | }
48 |
49 | return win;
50 | };
51 |
52 | // Prevent multiple instances of the app
53 | if (!app.requestSingleInstanceLock()) {
54 | app.quit();
55 | }
56 |
57 | app.on("second-instance", () => {
58 | if (mainWindow) {
59 | if (mainWindow.isMinimized()) {
60 | mainWindow.restore();
61 | }
62 |
63 | mainWindow.show();
64 | }
65 | });
66 |
67 | app.on("window-all-closed", () => {
68 | if (!is.macos) {
69 | app.quit();
70 | }
71 | });
72 |
73 | app.on("activate", async () => {
74 | if (!mainWindow) {
75 | mainWindow = await createMainWindow();
76 | }
77 | ipcMain.on("resize-main-window", ({ width, height }) => {
78 | let [currentWidth, currentHeight] = mainWindow.getSize();
79 | console.log("dsd", res);
80 | if (currentWidth < 1280) {
81 | mainWindow.setSize(width, currentHeight);
82 | }
83 | });
84 | });
85 |
86 | (async () => {
87 | await app.whenReady();
88 | Menu.setApplicationMenu(menu);
89 | mainWindow = await createMainWindow();
90 | })();
91 |
--------------------------------------------------------------------------------
/desktop/menu.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const {app, Menu, shell} = require('electron');
3 | const {
4 | is,
5 | appMenu,
6 | aboutMenuItem,
7 | openUrlMenuItem,
8 | openNewGitHubIssue,
9 | debugInfo,
10 | } = require('electron-util');
11 | const config = require('./config');
12 |
13 | const showPreferences = () => {
14 | // Show the app's preferences here
15 | };
16 |
17 | const helpSubmenu = [
18 | openUrlMenuItem({
19 | label: 'Source Code',
20 | url: 'https://github.com/arnnis/sup',
21 | }),
22 | {
23 | label: 'Report an Issue…',
24 | click() {
25 | const body = `
26 |
27 |
28 |
29 | ---
30 |
31 | ${debugInfo()}
32 | Sup ${app.getVersion()}
33 | `;
34 |
35 | openNewGitHubIssue({
36 | user: 'arnnis',
37 | repo: 'sup',
38 | body,
39 | });
40 | },
41 | },
42 | ];
43 |
44 | if (!is.macos) {
45 | helpSubmenu.push(
46 | {
47 | type: 'separator',
48 | },
49 | aboutMenuItem({
50 | icon: path.join(__dirname, 'static', 'icon.png'),
51 | text: 'Created by Your Name',
52 | }),
53 | );
54 | }
55 |
56 | const debugSubmenu = [
57 | {
58 | label: 'Show Settings',
59 | click() {
60 | config.openInEditor();
61 | },
62 | },
63 | {
64 | label: 'Show App Data',
65 | click() {
66 | shell.openItem(app.getPath('userData'));
67 | },
68 | },
69 | {
70 | type: 'separator',
71 | },
72 | {
73 | label: 'Delete Settings',
74 | click() {
75 | config.clear();
76 | app.relaunch();
77 | app.quit();
78 | },
79 | },
80 | {
81 | label: 'Delete App Data',
82 | click() {
83 | shell.moveItemToTrash(app.getPath('userData'));
84 | app.relaunch();
85 | app.quit();
86 | },
87 | },
88 | ];
89 |
90 | const macosTemplate = [
91 | appMenu([
92 | {
93 | label: 'Preferences…',
94 | accelerator: 'Command+,',
95 | click() {
96 | showPreferences();
97 | },
98 | },
99 | ]),
100 | {
101 | role: 'viewMenu',
102 | },
103 | {
104 | role: 'windowMenu',
105 | },
106 | {
107 | role: 'help',
108 | submenu: helpSubmenu,
109 | },
110 | ];
111 |
112 | // Linux and Windows
113 | const otherTemplate = [
114 | {
115 | role: 'editMenu',
116 | },
117 | {
118 | role: 'viewMenu',
119 | },
120 | {
121 | role: 'help',
122 | submenu: helpSubmenu,
123 | },
124 | ];
125 |
126 | const template = process.platform === 'darwin' ? macosTemplate : otherTemplate;
127 |
128 | if (is.development) {
129 | template.push({
130 | label: 'Debug',
131 | submenu: debugSubmenu,
132 | });
133 | }
134 |
135 | module.exports = Menu.buildFromTemplate(template);
136 |
--------------------------------------------------------------------------------
/desktop/resources/icons/1024x1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/desktop/resources/icons/1024x1024.png
--------------------------------------------------------------------------------
/desktop/resources/icons/128x128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/desktop/resources/icons/128x128.png
--------------------------------------------------------------------------------
/desktop/resources/icons/16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/desktop/resources/icons/16x16.png
--------------------------------------------------------------------------------
/desktop/resources/icons/24x24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/desktop/resources/icons/24x24.png
--------------------------------------------------------------------------------
/desktop/resources/icons/256x256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/desktop/resources/icons/256x256.png
--------------------------------------------------------------------------------
/desktop/resources/icons/32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/desktop/resources/icons/32x32.png
--------------------------------------------------------------------------------
/desktop/resources/icons/48x48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/desktop/resources/icons/48x48.png
--------------------------------------------------------------------------------
/desktop/resources/icons/512x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/desktop/resources/icons/512x512.png
--------------------------------------------------------------------------------
/desktop/resources/icons/64x64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/desktop/resources/icons/64x64.png
--------------------------------------------------------------------------------
/desktop/resources/icons/icon.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/desktop/resources/icons/icon.icns
--------------------------------------------------------------------------------
/desktop/resources/icons/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/desktop/resources/icons/icon.ico
--------------------------------------------------------------------------------
/desktop/resources/icons2/icons/mac/icon.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/desktop/resources/icons2/icons/mac/icon.icns
--------------------------------------------------------------------------------
/desktop/resources/icons2/icons/png/1024x1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/desktop/resources/icons2/icons/png/1024x1024.png
--------------------------------------------------------------------------------
/desktop/resources/icons2/icons/png/128x128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/desktop/resources/icons2/icons/png/128x128.png
--------------------------------------------------------------------------------
/desktop/resources/icons2/icons/png/16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/desktop/resources/icons2/icons/png/16x16.png
--------------------------------------------------------------------------------
/desktop/resources/icons2/icons/png/24x24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/desktop/resources/icons2/icons/png/24x24.png
--------------------------------------------------------------------------------
/desktop/resources/icons2/icons/png/256x256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/desktop/resources/icons2/icons/png/256x256.png
--------------------------------------------------------------------------------
/desktop/resources/icons2/icons/png/32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/desktop/resources/icons2/icons/png/32x32.png
--------------------------------------------------------------------------------
/desktop/resources/icons2/icons/png/48x48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/desktop/resources/icons2/icons/png/48x48.png
--------------------------------------------------------------------------------
/desktop/resources/icons2/icons/png/512x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/desktop/resources/icons2/icons/png/512x512.png
--------------------------------------------------------------------------------
/desktop/resources/icons2/icons/png/64x64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/desktop/resources/icons2/icons/png/64x64.png
--------------------------------------------------------------------------------
/desktop/resources/icons2/icons/win/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/desktop/resources/icons2/icons/win/icon.ico
--------------------------------------------------------------------------------
/desktop/static/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/desktop/static/Icon.png
--------------------------------------------------------------------------------
/desktop/webpack.config.main.prod.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 |
3 | const config = {
4 | target: 'electron-main',
5 | entry: [path.resolve(__dirname, 'index.js')],
6 | output: {
7 | filename: 'index.js',
8 | path: path.resolve(__dirname, 'build'),
9 | },
10 | mode: 'production',
11 | module: {
12 | rules: [
13 | {
14 | test: /\.(tsx|ts|js)$/,
15 | include: [path.resolve(__dirname, '.')],
16 | use: {
17 | loader: 'babel-loader',
18 | options: {
19 | cacheDirectory: true,
20 | presets: ['module:metro-react-native-babel-preset'],
21 | },
22 | },
23 | },
24 | ],
25 | },
26 | resolve: {
27 | extensions: ['.js', '.ts', '.json'],
28 | },
29 | };
30 |
31 | module.exports = config;
32 |
--------------------------------------------------------------------------------
/desktop/webpack.config.renderer.dev.js:
--------------------------------------------------------------------------------
1 | const merge = require("webpack-merge");
2 | const { spawn } = require("child_process");
3 | const webConfigs = require("../webpack.config");
4 |
5 | const config = merge(webConfigs, {
6 | target: "electron-renderer",
7 | devServer: {
8 | open: false,
9 | before: function () {
10 | spawn("electron", ["./desktop"], {
11 | shell: true,
12 | env: process.env,
13 | stdio: "inherit",
14 | })
15 | .on("close", (code) => process.exit(0))
16 | .on("error", (spawnError) => console.error(spawnError));
17 | },
18 | },
19 | });
20 |
21 | module.exports = config;
22 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { registerRootComponent } from "expo";
3 | import { Provider as ReduxProvider } from "react-redux";
4 | import { QueryClient, QueryClientProvider } from "react-query";
5 | import PubNub from "pubnub";
6 | import { PubNubProvider, usePubNub } from "pubnub-react";
7 | import { ToastProvider } from "react-native-fast-toast";
8 | import App from "./App";
9 | import { store, persistor } from "./src/store/store";
10 | import { PersistGate } from "redux-persist/integration/react";
11 | import RtcProvider from "./src/contexts/rtcContext";
12 | import { ThemeProvider } from "./src/contexts/theme/provider";
13 | import { RoomProvider } from "./src/contexts/room/provider";
14 |
15 | const queryClient = new QueryClient({
16 | defaultConfig: {
17 | queries: {
18 | cacheTime: 0,
19 | },
20 | },
21 | });
22 |
23 | const Root = () => (
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | );
40 |
41 | registerRootComponent(Root);
42 |
--------------------------------------------------------------------------------
/ios/File.swift:
--------------------------------------------------------------------------------
1 | //
2 | // File.swift
3 | // clubhouseapp
4 | //
5 | // Created by Alireza Rezania on 4/6/21.
6 | //
7 |
8 | import Foundation
9 |
--------------------------------------------------------------------------------
/ios/Podfile:
--------------------------------------------------------------------------------
1 | require_relative '../node_modules/react-native/scripts/react_native_pods'
2 | require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
3 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
4 |
5 | platform :ios, '11.0'
6 |
7 | target 'clubhouseapp' do
8 | use_unimodules!
9 | config = use_native_modules!
10 |
11 | use_react_native!(:path => config["reactNativePath"])
12 |
13 | # Uncomment the code below to enable Flipper.
14 | #
15 | # You should not install Flipper in CI environments when creating release
16 | # builds, this will lead to significantly slower build times.
17 | #
18 | # Note that if you have use_frameworks! enabled, Flipper will not work.
19 | #
20 | # use_flipper!
21 | # post_install do |installer|
22 | # flipper_post_install(installer)
23 | # end
24 | end
25 |
--------------------------------------------------------------------------------
/ios/clubhouseapp-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | //
2 | // Use this file to import your target's public headers that you would like to expose to Swift.
3 | //
4 |
5 |
--------------------------------------------------------------------------------
/ios/clubhouseapp.xcodeproj/xcshareddata/xcschemes/clubhouseapp.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
53 |
55 |
61 |
62 |
63 |
64 |
70 |
72 |
78 |
79 |
80 |
81 |
83 |
84 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/ios/clubhouseapp.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ios/clubhouseapp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/clubhouseapp/AppDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | #import
4 | #import
5 |
6 | #import
7 |
8 | @interface AppDelegate : UMAppDelegateWrapper
9 |
10 | @end
11 |
--------------------------------------------------------------------------------
/ios/clubhouseapp/AppDelegate.m:
--------------------------------------------------------------------------------
1 | #import "AppDelegate.h"
2 |
3 | #import
4 | #import
5 | #import
6 | #import
7 |
8 | #import
9 | #import
10 | #import
11 | #import
12 | #import
13 |
14 | #if defined(FB_SONARKIT_ENABLED) && __has_include()
15 | #import
16 | #import
17 | #import
18 | #import
19 | #import
20 | #import
21 |
22 | static void InitializeFlipper(UIApplication *application) {
23 | FlipperClient *client = [FlipperClient sharedClient];
24 | SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
25 | [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
26 | [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
27 | [client addPlugin:[FlipperKitReactPlugin new]];
28 | [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
29 | [client start];
30 | }
31 | #endif
32 |
33 | @interface AppDelegate ()
34 |
35 | @property (nonatomic, strong) UMModuleRegistryAdapter *moduleRegistryAdapter;
36 | @property (nonatomic, strong) NSDictionary *launchOptions;
37 |
38 | @end
39 |
40 | @implementation AppDelegate
41 |
42 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
43 | {
44 | #if defined(FB_SONARKIT_ENABLED) && __has_include()
45 | InitializeFlipper(application);
46 | #endif
47 |
48 | self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]];
49 | self.launchOptions = launchOptions;
50 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
51 | #ifdef DEBUG
52 | [self initializeReactNativeApp];
53 | #else
54 | EXUpdatesAppController *controller = [EXUpdatesAppController sharedInstance];
55 | controller.delegate = self;
56 | [controller startAndShowLaunchScreen:self.window];
57 | #endif
58 |
59 | [super application:application didFinishLaunchingWithOptions:launchOptions];
60 |
61 | return YES;
62 | }
63 |
64 | - (RCTBridge *)initializeReactNativeApp
65 | {
66 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:self.launchOptions];
67 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"main" initialProperties:nil];
68 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
69 |
70 | UIViewController *rootViewController = [UIViewController new];
71 | rootViewController.view = rootView;
72 | self.window.rootViewController = rootViewController;
73 | [self.window makeKeyAndVisible];
74 |
75 | return bridge;
76 | }
77 |
78 | - (NSArray> *)extraModulesForBridge:(RCTBridge *)bridge
79 | {
80 | NSArray> *extraModules = [_moduleRegistryAdapter extraModulesForBridge:bridge];
81 | // If you'd like to export some custom RCTBridgeModules that are not Expo modules, add them here!
82 | return extraModules;
83 | }
84 |
85 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
86 | #ifdef DEBUG
87 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
88 | #else
89 | return [[EXUpdatesAppController sharedInstance] launchAssetUrl];
90 | #endif
91 | }
92 |
93 | - (void)appController:(EXUpdatesAppController *)appController didStartWithSuccess:(BOOL)success {
94 | appController.bridge = [self initializeReactNativeApp];
95 | EXSplashScreenService *splashScreenService = (EXSplashScreenService *)[UMModuleRegistryProvider getSingletonModuleForClass:[EXSplashScreenService class]];
96 | [splashScreenService showSplashScreenFor:self.window.rootViewController];
97 | }
98 |
99 | // Linking API
100 | - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary *)options {
101 | return [RCTLinkingManager application:application openURL:url options:options];
102 | }
103 |
104 | // Universal Links
105 | - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray> * _Nullable))restorationHandler {
106 | return [RCTLinkingManager application:application
107 | continueUserActivity:userActivity
108 | restorationHandler:restorationHandler];
109 | }
110 |
111 | @end
112 |
--------------------------------------------------------------------------------
/ios/clubhouseapp/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
21 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/ios/clubhouseapp/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | }
33 | ],
34 | "info" : {
35 | "version" : 1,
36 | "author" : "xcode"
37 | }
38 | }
--------------------------------------------------------------------------------
/ios/clubhouseapp/Images.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/ios/clubhouseapp/Images.xcassets/SplashScreen.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images": [
3 | {
4 | "idiom": "universal",
5 | "filename": "splashscreen.png",
6 | "scale": "1x"
7 | },
8 | {
9 | "idiom": "universal",
10 | "scale": "2x"
11 | },
12 | {
13 | "idiom": "universal",
14 | "scale": "3x"
15 | }
16 | ],
17 | "info": {
18 | "version": 1,
19 | "author": "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/ios/clubhouseapp/Images.xcassets/SplashScreen.imageset/splashscreen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/ios/clubhouseapp/Images.xcassets/SplashScreen.imageset/splashscreen.png
--------------------------------------------------------------------------------
/ios/clubhouseapp/Images.xcassets/SplashScreenBackground.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images": [
3 | {
4 | "idiom": "universal",
5 | "filename": "background.png",
6 | "scale": "1x"
7 | },
8 | {
9 | "idiom": "universal",
10 | "scale": "2x"
11 | },
12 | {
13 | "idiom": "universal",
14 | "scale": "3x"
15 | }
16 | ],
17 | "info": {
18 | "version": 1,
19 | "author": "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/ios/clubhouseapp/Images.xcassets/SplashScreenBackground.imageset/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/ios/clubhouseapp/Images.xcassets/SplashScreenBackground.imageset/background.png
--------------------------------------------------------------------------------
/ios/clubhouseapp/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | clubhouse-app
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1
25 | LSRequiresIPhoneOS
26 |
27 | NSAppTransportSecurity
28 |
29 | NSAllowsArbitraryLoads
30 |
31 | NSExceptionDomains
32 |
33 | localhost
34 |
35 | NSExceptionAllowsInsecureHTTPLoads
36 |
37 |
38 |
39 |
40 | NSLocationWhenInUseUsageDescription
41 |
42 | UILaunchStoryboardName
43 | SplashScreen
44 | UIRequiredDeviceCapabilities
45 |
46 | armv7
47 |
48 | UISupportedInterfaceOrientations
49 |
50 | UIInterfaceOrientationPortrait
51 | UIInterfaceOrientationLandscapeLeft
52 | UIInterfaceOrientationLandscapeRight
53 |
54 | UIViewControllerBasedStatusBarAppearance
55 |
56 | UIStatusBarStyle
57 | UIStatusBarStyleDefault
58 |
59 |
60 |
--------------------------------------------------------------------------------
/ios/clubhouseapp/SplashScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
31 |
39 |
40 |
41 |
42 |
53 |
54 |
55 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/ios/clubhouseapp/Supporting/Expo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | EXUpdatesSDKVersion
6 | YOUR-APP-SDK-VERSION-HERE
7 | EXUpdatesURL
8 | YOUR-APP-URL-HERE
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ios/clubhouseapp/main.m:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | #import "AppDelegate.h"
4 |
5 | int main(int argc, char * argv[]) {
6 | @autoreleasepool {
7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
8 | }
9 | }
10 |
11 |
--------------------------------------------------------------------------------
/metro.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | transformer: {
3 | assetPlugins: ['expo-asset/tools/hashAssetFiles'],
4 | },
5 | };
6 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "main": "index.js",
3 | "version": "0.2.0",
4 | "homepage": "https://arnnis.github.io/Clubreact",
5 | "scripts": {
6 | "android": "react-native run-android",
7 | "android:release": "npx jetifier && cd android && ./gradlew assembleRelease",
8 | "ios": "react-native run-ios",
9 | "web": "expo start --web",
10 | "start": "react-native start",
11 | "test": "jest",
12 | "desktop": "cross-env NODE_ENV=development webpack serve --config ./desktop/webpack.config.renderer.dev.js --color --progress",
13 | "desktop:release": "yarn web:release && node ./desktop/build.js",
14 | "postversion": "react-native-version --never-amend",
15 | "deploy": "gh-pages -d web-build"
16 | },
17 | "dependencies": {
18 | "@expo/webpack-config": "^0.12.65",
19 | "@react-native-async-storage/async-storage": "^1.15.1",
20 | "@react-navigation/native": "^5.9.4",
21 | "@react-navigation/stack": "^5.14.4",
22 | "@reduxjs/toolkit": "^1.5.1",
23 | "dayjs": "^1.10.4",
24 | "expo": "~40.0.0",
25 | "expo-splash-screen": "~0.8.0",
26 | "expo-status-bar": "~1.0.3",
27 | "expo-updates": "~0.4.0",
28 | "pubnub": "^4.30.1",
29 | "pubnub-react": "^2.1.0",
30 | "react": "16.13.1",
31 | "react-dom": "16.13.1",
32 | "react-native": "~0.63.4",
33 | "react-native-agora": "^3.3.2",
34 | "react-native-country-picker-modal": "^2.0.0",
35 | "react-native-fast-image": "^8.3.4",
36 | "react-native-fast-toast": "^2.2.0",
37 | "react-native-gesture-handler": "~1.8.0",
38 | "react-native-reanimated": "~1.13.0",
39 | "react-native-safe-area-context": "3.1.9",
40 | "react-native-screens": "~2.15.0",
41 | "react-native-unimodules": "~0.12.0",
42 | "react-native-web": "~0.13.12",
43 | "react-query": "^3.13.4",
44 | "react-redux": "^7.2.3",
45 | "recyclerlistview": "^3.0.5",
46 | "redux-logger": "^3.0.6",
47 | "redux-persist": "^6.0.0"
48 | },
49 | "devDependencies": {
50 | "@babel/core": "^7.9.0",
51 | "@types/pubnub": "^4.29.2",
52 | "@types/react": "~16.9.35",
53 | "@types/react-dom": "~16.9.8",
54 | "@types/react-native": "~0.63.2",
55 | "@types/redux-logger": "^3.0.8",
56 | "babel-preset-expo": "~8.3.0",
57 | "cross-env": "^7.0.3",
58 | "expo-cli": "^4.3.5",
59 | "jest-expo": "~40.0.0",
60 | "react-native-version": "^4.0.0",
61 | "typescript": "~4.0.0"
62 | },
63 | "jest": {
64 | "preset": "react-native"
65 | },
66 | "private": true
67 | }
68 |
--------------------------------------------------------------------------------
/src/assets/default-avatar.ts:
--------------------------------------------------------------------------------
1 | export default "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBw8HEA0QDw4PERAODw4QEA4NDQ8ODw4QFxEXFhgSExUYHSggGBolGxUVITEhJSkrLjIuFx8zODMtNygtLisBCgoKBQUFDgUFDisZExkrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrK//AABEIAOEA4QMBIgACEQEDEQH/xAAaAAEAAwEBAQAAAAAAAAAAAAAABAUGAwIB/8QANRABAAIAAwMICQQDAQAAAAAAAAECAwQRBSExEhMyQVFhcaEGIlKBkbHB0eFCQ2JyFDPCov/EABQBAQAAAAAAAAAAAAAAAAAAAAD/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwDegAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAnZXZeLj6TpyYnrt9IBBGgwdiYdelNre/kx5JVdnYNf26+/f8AMGVfWpnZ+DP7VfdGiPi7Gwb8OVXwnWPMGdFlmdj4mFvrMXju3W+CumJrundMdU7pB8AAAAAAAAAAAAAAAAAAAAe8HCtjTFaxrMvNazaYiI1md0RHW0+zclGUr/OelP0gHPIbMrltJt61+2eFfBYAAAAAAiZ3I0zcb40t1WjjH3SwGSzeVtlbcm0eE9UuDW5vLVzVZrb3T1xPbDL5jBtl7TW3GPOO2AcgAAAAAAAAAAAAAAAAAXGwcrypnEn9O6vj1yvHDJ4PMYdK9kb/AB4y7gAAAAAAAAKzbmV52nLjpU499Vm+WiLRMTwmNJ8AYwdMxhcze1fZmYcwAAAAAAAAAAAAAAHbJU5zEw47bx83FK2X/uwv7fSQaoAAAAAAAAAAAGb23Tk4098RPlor1n6Qf7K/1VgAAAAAAAAAAAAAADtlL83iYc9lo+biA2gj5DG/yMOluvTSfGN0pAAAAAAAAAAPOJeKRMzwiJmQZzbV+XjW/jEQgPeNic7a1p/VMy8AAAAAAAAAAAAAAAAAtdhZvm7Thzwvvjusv2MidGj2Vn4zUaW6dY3/AMu8FgAAAAAAAAqdu5vkV5uONul3VTc9m65Sus75no17ZZfFxJxrTa06zM6yDwAAAAAAAAAAAAAAAAAA9UvOHMTEzExwmN0vKbk9m4mZ0nTk19q30gFlkNrVxdK4nq29rhW32WkTqhZbZWFgaTMcqe22/wAuCbEaA+gAAAIGe2nTLbo0tbsjhHinoeZ2dhZjWZrpM/qrun8gzmYx7Zi02tOsz5d0OSwzeysTA1mvr17uMe5XgAAAAAAAAAAAAAAAAPVKzeYiI1meER1mHScSYiI1md0RDSbN2fGUjWd95jfPZ3QDhs/ZMYWlsTfbqrxrX7ytQAAAAAAAAAV+f2XXM62r6t+2OFvFYAMdjYVsGZraNJh4arPZOubjSd1o6NuuJZnHwbYFpraNJjz74BzAAAAAAAAAAAABZ7EyfPW5do9WnDvt+AT9kZH/AB68q0evb/zHZ4rIAAAAAAAAAAAAAEPaWSjN13dOOjP0lMAYy1ZpMxMaTE6TE9T4utu5P92sd19PKVKAAAAAAAAAAD3hYc4sxWOMzo1mWwYy9K1jqj4z2qXYGBy7WvPCu6P7T+PmvwAAAAAAAAAAAAAAAAecSkYkTE74mJiYZPN4E5a9qz1Tu74a5T+kGBrFcSOr1beHUCjAAAAAAAAB0y+Hzt6V9q0R5g0uy8HmMKkdcxyp8ZS3yI0fQAAAAAAAAAAAAAAAAHHNYXP0vXtifi7AMZMabuzc+JW08LmsXEjv1+O9FAAAAAAATti05eNX+MWny/KCtfR6ut7z2U0+Mx9gX4AAAAAAAAAAAAAAAAAAAKD0gpyb0n2q+cT+YVS79Iq7sKeybR8Yj7KQAAAAAABcejvHF8K/OQBeAAAAAAAAAAAAAAAAAAAAqfSHoU/v/wAyoQAAAAB//9k=";
2 |
--------------------------------------------------------------------------------
/src/assets/fonts/Nunito/Nunito-Black.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/src/assets/fonts/Nunito/Nunito-Black.ttf
--------------------------------------------------------------------------------
/src/assets/fonts/Nunito/Nunito-BlackItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/src/assets/fonts/Nunito/Nunito-BlackItalic.ttf
--------------------------------------------------------------------------------
/src/assets/fonts/Nunito/Nunito-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/src/assets/fonts/Nunito/Nunito-Bold.ttf
--------------------------------------------------------------------------------
/src/assets/fonts/Nunito/Nunito-BoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/src/assets/fonts/Nunito/Nunito-BoldItalic.ttf
--------------------------------------------------------------------------------
/src/assets/fonts/Nunito/Nunito-ExtraBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/src/assets/fonts/Nunito/Nunito-ExtraBold.ttf
--------------------------------------------------------------------------------
/src/assets/fonts/Nunito/Nunito-ExtraBoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/src/assets/fonts/Nunito/Nunito-ExtraBoldItalic.ttf
--------------------------------------------------------------------------------
/src/assets/fonts/Nunito/Nunito-ExtraLight.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/src/assets/fonts/Nunito/Nunito-ExtraLight.ttf
--------------------------------------------------------------------------------
/src/assets/fonts/Nunito/Nunito-ExtraLightItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/src/assets/fonts/Nunito/Nunito-ExtraLightItalic.ttf
--------------------------------------------------------------------------------
/src/assets/fonts/Nunito/Nunito-Italic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/src/assets/fonts/Nunito/Nunito-Italic.ttf
--------------------------------------------------------------------------------
/src/assets/fonts/Nunito/Nunito-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/src/assets/fonts/Nunito/Nunito-Light.ttf
--------------------------------------------------------------------------------
/src/assets/fonts/Nunito/Nunito-LightItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/src/assets/fonts/Nunito/Nunito-LightItalic.ttf
--------------------------------------------------------------------------------
/src/assets/fonts/Nunito/Nunito-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/src/assets/fonts/Nunito/Nunito-Regular.ttf
--------------------------------------------------------------------------------
/src/assets/fonts/Nunito/Nunito-SemiBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/src/assets/fonts/Nunito/Nunito-SemiBold.ttf
--------------------------------------------------------------------------------
/src/assets/fonts/Nunito/Nunito-SemiBoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arnnis/Clubreact/a2c71242142c7e42113fba6dd30acaa8671f5a5f/src/assets/fonts/Nunito/Nunito-SemiBoldItalic.ttf
--------------------------------------------------------------------------------
/src/assets/fonts/Nunito/OFL.txt:
--------------------------------------------------------------------------------
1 | Copyright 2014 The Nunito Project Authors (https://github.com/googlefonts/nunito)
2 |
3 | This Font Software is licensed under the SIL Open Font License, Version 1.1.
4 | This license is copied below, and is also available with a FAQ at:
5 | http://scripts.sil.org/OFL
6 |
7 |
8 | -----------------------------------------------------------
9 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10 | -----------------------------------------------------------
11 |
12 | PREAMBLE
13 | The goals of the Open Font License (OFL) are to stimulate worldwide
14 | development of collaborative font projects, to support the font creation
15 | efforts of academic and linguistic communities, and to provide a free and
16 | open framework in which fonts may be shared and improved in partnership
17 | with others.
18 |
19 | The OFL allows the licensed fonts to be used, studied, modified and
20 | redistributed freely as long as they are not sold by themselves. The
21 | fonts, including any derivative works, can be bundled, embedded,
22 | redistributed and/or sold with any software provided that any reserved
23 | names are not used by derivative works. The fonts and derivatives,
24 | however, cannot be released under any other type of license. The
25 | requirement for fonts to remain under this license does not apply
26 | to any document created using the fonts or their derivatives.
27 |
28 | DEFINITIONS
29 | "Font Software" refers to the set of files released by the Copyright
30 | Holder(s) under this license and clearly marked as such. This may
31 | include source files, build scripts and documentation.
32 |
33 | "Reserved Font Name" refers to any names specified as such after the
34 | copyright statement(s).
35 |
36 | "Original Version" refers to the collection of Font Software components as
37 | distributed by the Copyright Holder(s).
38 |
39 | "Modified Version" refers to any derivative made by adding to, deleting,
40 | or substituting -- in part or in whole -- any of the components of the
41 | Original Version, by changing formats or by porting the Font Software to a
42 | new environment.
43 |
44 | "Author" refers to any designer, engineer, programmer, technical
45 | writer or other person who contributed to the Font Software.
46 |
47 | PERMISSION & CONDITIONS
48 | Permission is hereby granted, free of charge, to any person obtaining
49 | a copy of the Font Software, to use, study, copy, merge, embed, modify,
50 | redistribute, and sell modified and unmodified copies of the Font
51 | Software, subject to the following conditions:
52 |
53 | 1) Neither the Font Software nor any of its individual components,
54 | in Original or Modified Versions, may be sold by itself.
55 |
56 | 2) Original or Modified Versions of the Font Software may be bundled,
57 | redistributed and/or sold with any software, provided that each copy
58 | contains the above copyright notice and this license. These can be
59 | included either as stand-alone text files, human-readable headers or
60 | in the appropriate machine-readable metadata fields within text or
61 | binary files as long as those fields can be easily viewed by the user.
62 |
63 | 3) No Modified Version of the Font Software may use the Reserved Font
64 | Name(s) unless explicit written permission is granted by the corresponding
65 | Copyright Holder. This restriction only applies to the primary font name as
66 | presented to the users.
67 |
68 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69 | Software shall not be used to promote, endorse or advertise any
70 | Modified Version, except to acknowledge the contribution(s) of the
71 | Copyright Holder(s) and the Author(s) or with their explicit written
72 | permission.
73 |
74 | 5) The Font Software, modified or unmodified, in part or in whole,
75 | must be distributed entirely under this license, and must not be
76 | distributed under any other license. The requirement for fonts to
77 | remain under this license does not apply to any document created
78 | using the Font Software.
79 |
80 | TERMINATION
81 | This license becomes null and void if any of the above conditions are
82 | not met.
83 |
84 | DISCLAIMER
85 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93 | OTHER DEALINGS IN THE FONT SOFTWARE.
94 |
--------------------------------------------------------------------------------
/src/components/flex.tsx:
--------------------------------------------------------------------------------
1 | import React, { FC } from "react";
2 | import { View, ViewProps, ViewStyle } from "react-native";
3 |
4 | interface Props extends ViewProps {
5 | justify?: ViewStyle["justifyContent"];
6 | align?: ViewStyle["alignItems"];
7 | direction?: ViewStyle["flexDirection"];
8 | flex?: ViewStyle["flex"];
9 | }
10 |
11 | const Flex: FC = ({
12 | justify,
13 | align,
14 | direction,
15 | style,
16 | flex,
17 | children,
18 | ...rest
19 | }) => (
20 |
32 | {children}
33 |
34 | );
35 |
36 | export default Flex;
37 |
--------------------------------------------------------------------------------
/src/components/room-mini-player.tsx:
--------------------------------------------------------------------------------
1 | import { useNavigation } from "@react-navigation/core";
2 | import React from "react";
3 | import { Image, StyleSheet, Text, View } from "react-native";
4 | import { useSelector } from "react-redux";
5 | import defaultAvatar from "../assets/default-avatar";
6 | import { useRoom } from "../contexts/room/context";
7 | import { useTheme } from "../contexts/theme/context";
8 | import { RootState } from "../store/store";
9 | import Touchable from "./touchable";
10 |
11 | const RoomMiniPlayer = () => {
12 | const room = useSelector((state: RootState) => state.room.currentRoom);
13 | const { navigate } = useNavigation();
14 | const { theme } = useTheme();
15 |
16 | if (!room) return null;
17 |
18 | return (
19 |
22 | navigate("Room", {
23 | channel_id: room?.channel_id,
24 | channel: room?.channel,
25 | })
26 | }
27 | >
28 |
29 |
33 |
37 |
41 |
42 |
43 | {room?.topic}
44 |
45 |
46 | );
47 | };
48 |
49 | const styles = StyleSheet.create({
50 | container: {
51 | position: "absolute",
52 | bottom: 0,
53 | right: 0,
54 | left: 0,
55 | height: 64,
56 | backgroundColor: "red",
57 | borderTopRightRadius: 40,
58 | borderTopLeftRadius: 40,
59 | paddingHorizontal: 16,
60 | flexDirection: "row",
61 | alignItems: "center",
62 | width: "100%",
63 | elevation: 10,
64 | },
65 | avatar: {
66 | height: 36,
67 | width: 36,
68 | borderRadius: 20,
69 | },
70 | avatarsContainer: {
71 | height: "100%",
72 | flexDirection: "row",
73 | alignItems: "center",
74 | marginRight: 16,
75 | },
76 | topic: {
77 | fontFamily: "Nunito-Regular",
78 | flex: 1,
79 | },
80 | });
81 |
82 | export default RoomMiniPlayer;
83 |
--------------------------------------------------------------------------------
/src/components/screen.tsx:
--------------------------------------------------------------------------------
1 | import React, { FC } from "react";
2 | import { Platform, SafeAreaView, StyleSheet, ViewProps } from "react-native";
3 | import { useTheme } from "../contexts/theme/context";
4 |
5 | interface Props extends ViewProps {}
6 |
7 | const Screen: FC = ({ children, style, ...rest }) => {
8 | const { theme } = useTheme();
9 | console.log("theme", theme);
10 | return (
11 |
15 | {children}
16 |
17 | );
18 | };
19 |
20 | const styles = StyleSheet.create({
21 | container: {
22 | width: "100%",
23 | height: "100%",
24 | },
25 | });
26 |
27 | export default Screen;
28 |
--------------------------------------------------------------------------------
/src/components/touchable.tsx:
--------------------------------------------------------------------------------
1 | import React, { FC } from "react";
2 | import {
3 | Platform,
4 | StyleSheet,
5 | TouchableNativeFeedback,
6 | TouchableOpacity,
7 | TouchableOpacityProps,
8 | View,
9 | } from "react-native";
10 |
11 | const Touchable: FC = ({
12 | children,
13 | style,
14 | ...props
15 | }) => {
16 | if (Platform.OS === "android") {
17 | return (
18 |
22 | {children}
23 |
24 | );
25 | }
26 | return ;
27 | };
28 |
29 | const styles = StyleSheet.create({
30 | container: {},
31 | });
32 |
33 | export default Touchable;
34 |
--------------------------------------------------------------------------------
/src/contexts/room/context.ts:
--------------------------------------------------------------------------------
1 | import Pubnub from "pubnub";
2 | import React, { useContext } from "react";
3 | import RtcEngine from "react-native-agora";
4 | import { Channel } from "../../models/channel";
5 |
6 | export interface ContextValue {
7 | rtc: RtcEngine | null;
8 | pubnub: Pubnub | null;
9 | room: Channel | null;
10 | loading: boolean;
11 | join?(channel: string): Promise;
12 | leave?(): void;
13 | }
14 |
15 | export const RoomContext = React.createContext({
16 | rtc: null,
17 | pubnub: null,
18 | room: null,
19 | loading: true,
20 | } as ContextValue);
21 |
22 | export const useRoom = () => useContext(RoomContext);
23 |
--------------------------------------------------------------------------------
/src/contexts/room/provider.tsx:
--------------------------------------------------------------------------------
1 | import React, { FC, useState } from "react";
2 | import { useDispatch, useSelector } from "react-redux";
3 | import PubNub from "pubnub";
4 | import { Channel } from "../../models/channel";
5 | import { RootState } from "../../store/store";
6 | import req from "../../utils/req";
7 | import { useRtc } from "../rtcContext";
8 | import { RoomContext, ContextValue } from "./context";
9 | import { APIResult } from "../../models/api";
10 | import { roomActions } from "../../slices/roomSlice";
11 |
12 | export const RoomProvider: FC = ({ children }) => {
13 | const room = useSelector((state: RootState) => state.room.currentRoom);
14 | const [loading, setLoading] = useState(false);
15 | const { engine } = useRtc();
16 | const [pubnub, setPubnub] = useState(null);
17 | const authState = useSelector((state: RootState) => state.auth);
18 | const dispatch = useDispatch();
19 |
20 | const joinRoom = async (channel: string) => {
21 | if (room?.channel === channel) return;
22 | if (room) {
23 | leaveRoom();
24 | }
25 | setLoading(true);
26 | const res = await req("/join_channel", {
27 | method: "POST",
28 | body: {
29 | channel: channel,
30 | attribution_source: "feed",
31 | attribution_details: "eyJpc19leHBsb3JlIjpmYWxzZSwicmFuayI6MX0=",
32 | },
33 | });
34 | const resJson: APIResult = await res.json();
35 | console.log("joined channel result", resJson);
36 | setLoading(false);
37 | dispatch(roomActions.setRoom(resJson));
38 | initRTC(resJson);
39 | initPubnub(resJson);
40 | return resJson;
41 | };
42 |
43 | const leaveRoom = async () => {
44 | const _channel = room?.channel;
45 | dispatch(roomActions.setRoom(null));
46 | engine?.leaveChannel();
47 | engine?.removeAllListeners();
48 | pubnub?.unsubscribeAll();
49 | pubnub?.stop();
50 | const res = await req("/leave_channel", {
51 | method: "POST",
52 | body: {
53 | channel: _channel,
54 | },
55 | });
56 | const resJson = await res.json();
57 | dispatch(roomActions.setSpeakingUsers([]));
58 |
59 | console.log("leave channel result", resJson);
60 | return resJson;
61 | };
62 |
63 | const initRTC = async (_channel: Channel) => {
64 | joinChannel(_channel);
65 |
66 | // engine?.addListener("Warning", (warn) => {
67 | // console.log("Warning", warn);
68 | // });
69 |
70 | // engine?.addListener("Warning", (warn) => {
71 | // console.log("Warning", warn);
72 | // });
73 |
74 | // engine?.addListener("Error", (err) => {
75 | // console.log("Error", err);
76 | // });
77 |
78 | // engine?.addListener("UserJoined", (uid, elapsed) => {
79 | // console.log("UserJoined", uid, elapsed);
80 | // });
81 |
82 | // engine?.addListener("UserOffline", (uid, reason) => {
83 | // console.log("UserOffline", uid, reason);
84 | // });
85 |
86 | // // If Local user joins RTC channel
87 | // engine?.addListener("JoinChannelSuccess", (channel, uid, elapsed) => {
88 | // console.log("JoinChannelSuccess", channel, uid, elapsed);
89 | // });
90 |
91 | engine?.addListener("AudioVolumeIndication", (speakers) => {
92 | console.log("loadest spkears", speakers);
93 | // setSpeakingUsers(speakers.map((s) => s.uid));
94 | dispatch(roomActions.setSpeakingUsers(speakers.map((s) => s.uid)));
95 | });
96 | };
97 |
98 | const joinChannel = async (_channel: Channel) => {
99 | // Join Channel using null token and channel name
100 | console.log("channel token", _channel.token);
101 | if (!_channel || !_channel.token) return;
102 | await engine?.joinChannel(
103 | _channel.token,
104 | _channel.channel,
105 | null,
106 | authState.user_profile?.user_id ?? 0
107 | );
108 | };
109 |
110 | const initPubnub = (_channel: Channel) => {
111 | console.log("pubnub token", _channel.pubnub_token);
112 | const _pubnub = new PubNub({
113 | publishKey: "pub-c-6878d382-5ae6-4494-9099-f930f938868b",
114 | subscribeKey: "sub-c-a4abea84-9ca3-11ea-8e71-f2b83ac9263d",
115 | authKey: _channel.pubnub_token,
116 | uuid: authState.user_profile?.user_id.toString(),
117 | origin: "clubhouse.pubnub.com",
118 | presenceTimeout: _channel.pubnub_heartbeat_value,
119 | heartbeatInterval: room?.pubnub_heartbeat_interval,
120 | });
121 | setPubnub(_pubnub);
122 |
123 | _pubnub?.subscribe({
124 | channels: [
125 | "users." + authState.user_profile?.user_id,
126 | "channel_user." +
127 | _channel.channel +
128 | "." +
129 | authState.user_profile?.user_id,
130 | "channel_all." + _channel.channel,
131 | ],
132 | });
133 |
134 | _pubnub?.addListener({
135 | message: handlePubnubMessage,
136 | status: (event) => console.log("pubnub status", event),
137 | });
138 | };
139 |
140 | const handlePubnubMessage = (msg: any) => {
141 | console.log("pubnub message:", msg);
142 | const { message } = msg;
143 | // if (message.channel !== room?.channel) return;
144 | if (message.action === "join_channel") {
145 | onPubnubUserJoined(message);
146 | }
147 | if (message.action === "leave_channel") {
148 | onPubnubUserLeaved(message);
149 | }
150 | };
151 |
152 | const onPubnubUserJoined = (message: any) => {
153 | const user = message.user_profile;
154 |
155 | dispatch(roomActions.addRoomUser(user));
156 | };
157 |
158 | const onPubnubUserLeaved = (message: any) => {
159 | dispatch(roomActions.removeRoomUser({ user_id: message.user_id }));
160 | };
161 |
162 | const value: ContextValue = {
163 | loading,
164 | rtc: engine,
165 | pubnub,
166 | join: joinRoom,
167 | leave: leaveRoom,
168 | };
169 |
170 | return {children};
171 | };
172 |
--------------------------------------------------------------------------------
/src/contexts/rtcContext.tsx:
--------------------------------------------------------------------------------
1 | import React, { Component, ComponentType, FC, useContext } from "react";
2 | import RtcEngine, { RtcEngineConfig } from "react-native-agora";
3 | import { connect } from "react-redux";
4 | import { RootState } from "../store/store";
5 |
6 | interface ContextValue {
7 | engine: null | RtcEngine;
8 | }
9 |
10 | export const RtcContext = React.createContext({ engine: null } as ContextValue);
11 |
12 | type RtcProviderProps = ReturnType;
13 |
14 | class RtcProvider extends Component {
15 | state = {
16 | rtcEngine: null as null | RtcEngine,
17 | };
18 |
19 | componentDidMount() {
20 | if (this.props.authState.auth_token) this.initRtc();
21 | }
22 |
23 | componentDidUpdate(prevProps: RtcProviderProps) {
24 | // on login
25 | if (!prevProps.authState.auth_token && this.props.authState.auth_token) {
26 | this.initRtc();
27 | }
28 |
29 | // on logout
30 | if (prevProps.authState.auth_token && !this.props.authState.auth_token) {
31 | this.state.rtcEngine?.destroy();
32 | console.log("destroyed rtc engine, reason: logout");
33 | }
34 | }
35 |
36 | initRtc = async () => {
37 | console.log("connecting to rtc engine");
38 | try {
39 | let rtcEngine = await RtcEngine.createWithConfig(
40 | new RtcEngineConfig("938de3e8055e42b281bb8c6f69c21f78")
41 | );
42 | rtcEngine.setDefaultAudioRoutetoSpeakerphone(true);
43 | rtcEngine.enableAudioVolumeIndication(1500, 3, false);
44 | rtcEngine.muteLocalAudioStream(true);
45 |
46 | this.setState({ rtcEngine });
47 | console.log("rtc engine initialized");
48 | } catch (err) {
49 | console.log("error initializing rtc engine", err);
50 | }
51 | };
52 |
53 | render() {
54 | return (
55 |
56 | {this.props.children}
57 |
58 | );
59 | }
60 | }
61 |
62 | const mapStateToProps = (state: RootState) => ({
63 | authState: state.auth,
64 | });
65 |
66 | export default connect(mapStateToProps)(RtcProvider);
67 |
68 | export const useRtc = () => useContext(RtcContext);
69 |
70 | export interface WithRtcProp {
71 | rtc: ContextValue;
72 | }
73 |
74 | export const withRtc = (C: any) => {
75 | return class extends Component {
76 | render() {
77 | return (
78 |
79 | {(value) => }
80 |
81 | );
82 | }
83 | };
84 | };
85 |
--------------------------------------------------------------------------------
/src/contexts/theme/context.ts:
--------------------------------------------------------------------------------
1 | import React, { useContext } from "react";
2 | import { Theme, themes } from "./themes";
3 |
4 | interface ContextValue {
5 | theme: Theme;
6 | toggleTheme(): void;
7 | }
8 |
9 | export const ThemeContext = React.createContext({
10 | theme: themes["nightTheme"],
11 | toggleTheme: () => {},
12 | } as ContextValue);
13 |
14 | export const useTheme = () => useContext(ThemeContext);
15 |
--------------------------------------------------------------------------------
/src/contexts/theme/provider.tsx:
--------------------------------------------------------------------------------
1 | import AsyncStorage from "@react-native-async-storage/async-storage";
2 | import React, { FC, useEffect, useState } from "react";
3 | import { StatusBar } from "react-native";
4 | import { ThemeContext } from "./context";
5 | import { themes } from "./themes";
6 |
7 | export const ThemeProvider: FC = ({ children }) => {
8 | const [currentThemeName, setCurrentThemeName] = useState(
9 | "defaultTheme"
10 | );
11 | const [loadingTheme, setLoadingTheme] = useState(true);
12 |
13 | useEffect(() => {
14 | loadThemeFromStorage();
15 | }, []);
16 |
17 | useEffect(() => {
18 | AsyncStorage.setItem("theme", currentThemeName);
19 | if (currentThemeName === "defaultTheme")
20 | StatusBar.setBarStyle("dark-content");
21 | if (currentThemeName === "nightTheme")
22 | StatusBar.setBarStyle("light-content");
23 | }, [currentThemeName]);
24 |
25 | const loadThemeFromStorage = async () => {
26 | setLoadingTheme(true);
27 | const themeName = (await AsyncStorage.getItem("theme")) as
28 | | keyof typeof themes
29 | | undefined;
30 | if (themeName) {
31 | setCurrentThemeName(themeName);
32 | }
33 | setLoadingTheme(false);
34 | };
35 |
36 | const toggleTheme = () => {
37 | if (currentThemeName === "defaultTheme") {
38 | setCurrentThemeName("nightTheme");
39 | } else {
40 | setCurrentThemeName("defaultTheme");
41 | }
42 | };
43 |
44 | if (loadingTheme) return null;
45 |
46 | return (
47 |
50 | {children}
51 |
52 | );
53 | };
54 |
--------------------------------------------------------------------------------
/src/contexts/theme/themes.ts:
--------------------------------------------------------------------------------
1 | export interface Theme {
2 | name: string;
3 | bg: string;
4 | bg2: string;
5 | fg: string;
6 | fg2: string;
7 | }
8 |
9 | const defaultTheme: Theme = {
10 | name: "defaultTheme",
11 | bg: "#F0F0E3",
12 | bg2: "#FFFFFF",
13 | fg: "#454245",
14 | fg2: "#9c9c9c",
15 | };
16 |
17 | const nightTheme: Theme = {
18 | name: "nightTheme",
19 | bg: "#16171C",
20 | bg2: "#202126",
21 | fg: "#eee",
22 | fg2: "#ccc",
23 | };
24 |
25 | export const themes = {
26 | defaultTheme,
27 | nightTheme,
28 | };
29 |
--------------------------------------------------------------------------------
/src/index.d.ts:
--------------------------------------------------------------------------------
1 | type Toast = React.RefObject<
2 | import("react-native-fast-toast").default
3 | >["current"];
4 |
5 | declare global {
6 | const toast: Toast;
7 | }
8 |
9 | declare var toast: Toast;
10 |
--------------------------------------------------------------------------------
/src/models/api.ts:
--------------------------------------------------------------------------------
1 | export type APIResult = T & {
2 | success: boolean;
3 | error_message?: string;
4 | };
5 |
--------------------------------------------------------------------------------
/src/models/channel.ts:
--------------------------------------------------------------------------------
1 | export interface GetChannelsResult {
2 | channels: Channel[];
3 | events: any[];
4 | success: boolean;
5 | }
6 |
7 | export interface Channel {
8 | creator_user_profile_id: number;
9 | channel_id: number;
10 | channel: string;
11 | topic: null | string;
12 | is_private: boolean;
13 | is_social_mode: boolean;
14 | url: string;
15 | feature_flags: FeatureFlag[];
16 | club: Club | null;
17 | club_name: null | string;
18 | club_id: number | null;
19 | welcome_for_user_profile: null;
20 | num_other: number;
21 | has_blocked_speakers: boolean;
22 | is_explore_channel: boolean;
23 | num_speakers: number;
24 | num_all: number;
25 | users: User[];
26 | logging_context: LoggingContext;
27 | is_handraise_enabled?: boolean;
28 | handraise_permission?: number;
29 | is_club_member?: boolean;
30 | is_club_admin?: boolean;
31 | should_leave?: boolean;
32 |
33 | is_empty?: boolean;
34 | token?: string;
35 | rtm_token?: string;
36 | pubnub_token?: string;
37 | pubnub_origin?: string;
38 | pubnub_heartbeat_value?: number;
39 | pubnub_heartbeat_interval?: number;
40 | pubnub_enable?: boolean;
41 | agora_native_mute?: boolean;
42 |
43 | error_message?: string;
44 | success: boolean;
45 | }
46 |
47 | export interface Club {
48 | club_id: number;
49 | name: string;
50 | description: string;
51 | photo_url: string;
52 | num_members: number;
53 | num_followers: number;
54 | enable_private: boolean;
55 | is_follow_allowed: boolean;
56 | is_membership_private: boolean;
57 | is_community: boolean;
58 | rules: Rule[];
59 | url: string;
60 | num_online: number;
61 | }
62 |
63 | export interface Rule {
64 | desc: string;
65 | title: string;
66 | }
67 |
68 | export enum FeatureFlag {
69 | AgoraAudioProfileSpeechStandard = "AGORA_AUDIO_PROFILE_SPEECH_STANDARD",
70 | }
71 |
72 | export interface LoggingContext {
73 | channel_id: number;
74 | batch_id: string;
75 | reasons?: string[];
76 | }
77 |
78 | export interface User {
79 | user_id: number;
80 | name: string;
81 | photo_url: null | string;
82 | is_speaker: boolean;
83 | is_moderator: boolean;
84 | time_joined_as_speaker: null | string;
85 | username?: string;
86 | first_name?: string;
87 | skintone?: number;
88 | is_new?: boolean;
89 |
90 | is_followed_by_speaker?: boolean;
91 | is_invited_as_speaker?: boolean;
92 | }
93 |
94 | // Generated by https://quicktype.io
95 |
--------------------------------------------------------------------------------
/src/models/user.ts:
--------------------------------------------------------------------------------
1 | export interface UserProfile {
2 | user_id: number;
3 | name: string;
4 | displayname: null;
5 | photo_url: null;
6 | username: string;
7 | bio: null;
8 | twitter: null;
9 | instagram: null;
10 | num_followers: number;
11 | num_following: number;
12 | time_created: string;
13 | follows_me: boolean;
14 | is_blocked_by_network: boolean;
15 | mutual_follows_count: number;
16 | mutual_follows: any[];
17 | notification_type: null;
18 | invited_by_user_profile: InvitedByUserProfile;
19 | invited_by_club: null;
20 | clubs: any[];
21 | url: string;
22 | can_receive_direct_payment: boolean;
23 | direct_payment_fee_rate: number;
24 | direct_payment_fee_fixed: number;
25 | has_verified_email: boolean;
26 | can_edit_username: boolean;
27 | can_edit_name: boolean;
28 | can_edit_displayname: boolean;
29 | topics: any[];
30 | }
31 |
32 | export interface InvitedByUserProfile {
33 | user_id: number;
34 | name: string;
35 | photo_url: string;
36 | username: string;
37 | }
38 |
39 | export interface LoginResult {
40 | success: boolean;
41 | error_message?: string;
42 | is_verified: boolean;
43 | user_profile: LoginUserProfile;
44 | auth_token: string;
45 | refresh_token: string;
46 | access_token: string;
47 | is_waitlisted: boolean;
48 | is_onboarding: boolean;
49 | }
50 |
51 | export interface LoginUserProfile {
52 | user_id: number;
53 | name: string;
54 | photo_url: null;
55 | username: string;
56 | }
57 |
--------------------------------------------------------------------------------
/src/navigator.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import {
3 | CardStyleInterpolators,
4 | createStackNavigator,
5 | } from "@react-navigation/stack";
6 | import { NavigationContainer } from "@react-navigation/native";
7 | import Login from "./screens/login";
8 | import VerificationCode from "./screens/verification-code";
9 | import Home from "./screens/home";
10 | import { useSelector } from "react-redux";
11 | import { RootState } from "./store/store";
12 | import Room from "./screens/room";
13 | import { useTheme } from "./contexts/theme/context";
14 | import UserProfile from "./screens/user-profile";
15 | import { User } from "./models/channel";
16 | import IsWaitlisted from "./screens/is-waitlisted";
17 | import Register from "./screens/signup";
18 |
19 | export type StackParamList = {
20 | Login: undefined;
21 | VerificationCode: { phonenumber: string };
22 | Home: undefined;
23 | Room: { channel_id: number; channel: string };
24 | UserProfile: { user_id: number; user: User };
25 | IsWaitlisted: undefined;
26 | Register: undefined;
27 | };
28 |
29 | const Stack = createStackNavigator();
30 |
31 | const Navigator = () => {
32 | const authState = useSelector((state: RootState) => state.auth);
33 | const { theme } = useTheme();
34 |
35 | return (
36 |
37 |
55 | {authState.auth_token ? (
56 | authState.is_waitlisted ? (
57 |
62 | ) : authState.is_onboarding ? (
63 |
68 | ) : (
69 | <>
70 |
75 |
80 |
85 | >
86 | )
87 | ) : (
88 | <>
89 |
94 |
99 | >
100 | )}
101 |
102 |
103 | );
104 | };
105 |
106 | export default Navigator;
107 |
--------------------------------------------------------------------------------
/src/screens/home.tsx:
--------------------------------------------------------------------------------
1 | import React, { FC, useEffect, useState } from "react";
2 | import {
3 | Image,
4 | StyleSheet,
5 | Text,
6 | View,
7 | FlatList,
8 | RefreshControl,
9 | Platform,
10 | StatusBar,
11 | TouchableOpacity,
12 | TouchableNativeFeedback,
13 | processColor,
14 | } from "react-native";
15 | import { MaterialCommunityIcons } from "@expo/vector-icons";
16 | import Screen from "../components/screen";
17 | import { Channel, GetChannelsResult } from "../models/channel";
18 | import req from "../utils/req";
19 | import Flex from "../components/flex";
20 | import { useQuery } from "react-query";
21 | import { CommonActions, useNavigation } from "@react-navigation/core";
22 | import { authActions } from "../slices/authSlice";
23 | import { StackNavigationProp } from "@react-navigation/stack";
24 | import { StackParamList } from "../navigator";
25 | import { useDispatch, useSelector } from "react-redux";
26 | import Touchable from "../components/touchable";
27 | import { useTheme } from "../contexts/theme/context";
28 | import { RootState } from "../store/store";
29 | import RoomMiniPlayer from "../components/room-mini-player";
30 | import defaultAvatar from "../assets/default-avatar";
31 | import { getMe } from "../slices/authThunks";
32 |
33 | interface Props {
34 | navigation: StackNavigationProp;
35 | }
36 |
37 | const Home: FC = ({ navigation }) => {
38 | const { isLoading, error, data, refetch } = useQuery("channels", () =>
39 | getChannels()
40 | );
41 | const authState = useSelector((state: RootState) => state.auth);
42 | const { navigate, reset } = useNavigation();
43 | const dispatch = useDispatch();
44 | const { theme, toggleTheme } = useTheme();
45 | useEffect(() => {
46 | dispatch(getMe());
47 | }, []);
48 |
49 | const getChannels = async () => {
50 | const res = await req("/get_channels");
51 | const resJson: GetChannelsResult = await res.json();
52 | return resJson;
53 | };
54 |
55 | const renderChannel = ({ item, index }: { item: Channel; index: number }) => (
56 |
59 | navigate("Room", { channel_id: item.channel_id, channel: item.channel })
60 | }
61 | style={[styles.channel, { backgroundColor: theme.bg2 }]}
62 | >
63 |
64 | {item.topic}
65 |
66 |
67 |
68 |
72 |
73 |
77 |
78 |
79 | {item.users.map((user) => (
80 |
81 |
82 | {user.name}
83 |
84 | {false && (
85 |
90 | )}
91 |
92 | ))}
93 |
94 |
95 | {item.num_all}{" "}
96 |
101 | {" " + "/" + " "}
102 | {item.num_speakers}{" "}
103 |
109 |
110 |
111 |
112 |
113 |
114 | );
115 |
116 | return (
117 |
125 |
126 |
127 |
132 |
133 |
135 | navigate("UserProfile", {
136 | user_id: authState.user_profile?.user_id,
137 | user: authState.user_profile,
138 | })
139 | }
140 | >
141 |
147 |
148 |
149 | item.channel}
154 | refreshControl={
155 |
156 | }
157 | />
158 |
159 |
160 | );
161 | };
162 |
163 | const styles = StyleSheet.create({
164 | header: {
165 | height: 64,
166 | width: "100%",
167 | flexDirection: "row",
168 | alignItems: "center",
169 | justifyContent: "flex-end",
170 | },
171 | avatar: {
172 | height: 32,
173 | width: 32,
174 | backgroundColor: "#fff",
175 | borderRadius: 22,
176 | marginLeft: "auto",
177 | marginRight: 16,
178 | },
179 | channelsContainer: {
180 | paddingHorizontal: 16,
181 | },
182 | channel: {
183 | width: "100%",
184 | backgroundColor: "#FEFCFF",
185 | marginBottom: 16,
186 | borderRadius: 16,
187 | padding: 16,
188 | shadowColor: "rgba(0,0,0,5)",
189 | shadowOffset: {
190 | width: 0,
191 | height: 1,
192 | },
193 | shadowOpacity: 0.1,
194 | shadowRadius: 0.1,
195 |
196 | elevation: 1,
197 | },
198 | channelTopic: {
199 | fontFamily: "Nunito-Bold",
200 | color: "#454245",
201 | fontSize: 15,
202 | },
203 | channelBodyContainer: {
204 | flexDirection: "row",
205 | marginTop: 16,
206 | },
207 | channelUserAvatar: {
208 | height: 40,
209 | width: 40,
210 | borderRadius: 16,
211 | },
212 | channelUser1Avatar: {
213 | position: "absolute",
214 | top: 16,
215 | right: 0,
216 | },
217 | channelUser2Avatar: {
218 | position: "absolute",
219 | bottom: 16,
220 | left: 0,
221 | },
222 | channelUserName: {
223 | fontFamily: "Nunito-SemiBold",
224 | fontSize: 17,
225 | color: "#49464A",
226 | },
227 | channelUsersStatsContainer: {
228 | marginTop: 8,
229 | },
230 | channelUsersStats: {
231 | fontFamily: "Nunito-SemiBold",
232 | color: "#49464A",
233 | },
234 | });
235 |
236 | export default Home;
237 |
--------------------------------------------------------------------------------
/src/screens/is-waitlisted.tsx:
--------------------------------------------------------------------------------
1 | import React, { useEffect } from "react";
2 | import { Button, StyleSheet, Text } from "react-native";
3 | import { useDispatch } from "react-redux";
4 | import Screen from "../components/screen";
5 | import { APIResult } from "../models/api";
6 | import { authActions } from "../slices/authSlice";
7 | import req from "../utils/req";
8 |
9 | const IsWaitlisted = () => {
10 | const dispatch = useDispatch();
11 | useEffect(() => {
12 | checkWaitlistStatus();
13 | }, []);
14 |
15 | const checkWaitlistStatus = async () => {
16 | const res = await req("/check_waitlist_status", { method: "POST" });
17 | const resJson: APIResult<{
18 | is_waitlisted: boolean;
19 | is_onboarding: boolean;
20 | }> = await res.json();
21 | console.log("waitlist status", resJson);
22 | dispatch(
23 | authActions.setAuth({
24 | is_waitlisted: resJson.is_waitlisted,
25 | is_onboarding: resJson.is_onboarding,
26 | })
27 | );
28 | return resJson;
29 | };
30 |
31 | const logout = () => {
32 | dispatch(authActions.logout());
33 | };
34 | return (
35 |
36 |
37 | Someone must invite you to Clubhouse first. Ask your friends to invite
38 | you by phone number.
39 |
40 |
41 |
42 | );
43 | };
44 |
45 | const styles = StyleSheet.create({
46 | container: { justifyContent: "center", alignItems: "center", padding: 16 },
47 | invitation: {
48 | fontFamily: "Nunito-SemiBold",
49 | textAlign: "center",
50 | marginBottom: 16,
51 | fontSize: 16,
52 | },
53 | });
54 |
55 | export default IsWaitlisted;
56 |
--------------------------------------------------------------------------------
/src/screens/login.tsx:
--------------------------------------------------------------------------------
1 | import React, { useState } from "react";
2 | import {
3 | ActivityIndicator,
4 | StyleSheet,
5 | Text,
6 | TextInput,
7 | TouchableOpacity,
8 | View,
9 | } from "react-native";
10 | import { MaterialCommunityIcons } from "@expo/vector-icons";
11 | import Screen from "../components/screen";
12 | import req from "../utils/req";
13 | import { useNavigation } from "@react-navigation/core";
14 | import CountryPicker, {
15 | Country,
16 | DEFAULT_THEME,
17 | } from "react-native-country-picker-modal";
18 | import { useToast } from "react-native-fast-toast";
19 |
20 | const Login = () => {
21 | const [phonenumber, setPhonenumber] = useState("");
22 | const [country, setCountry] = useState({
23 | callingCode: ["1"],
24 | cca2: "US",
25 | currency: ["USD"],
26 | flag: "flag-us",
27 | name: "United States",
28 | region: "Americas",
29 | subregion: "North America",
30 | });
31 | const { navigate } = useNavigation();
32 | const [submitting, setSubmitting] = useState(false);
33 | const toast = useToast();
34 |
35 | const requestCode = async () => {
36 | let fullPhoneNumber = "";
37 | if (phonenumber.startsWith("0")) {
38 | fullPhoneNumber = phonenumber.slice(1, phonenumber.length);
39 | } else {
40 | fullPhoneNumber = phonenumber;
41 | }
42 | fullPhoneNumber = `+${country.callingCode[0]}${fullPhoneNumber}`;
43 | console.log("fullPhoneNumber", fullPhoneNumber);
44 |
45 | setSubmitting(true);
46 | let res = await req("/start_phone_number_auth", {
47 | method: "POST",
48 | body: { phone_number: fullPhoneNumber },
49 | });
50 | console.log(res);
51 | const resJson = await res.json();
52 | if (res.ok) {
53 | if (resJson.is_waitlisted) {
54 | return toast?.show("You need to get invited by someone first");
55 | }
56 | navigate("VerificationCode", { phonenumber: fullPhoneNumber });
57 | } else {
58 | resJson?.error_message && toast?.show(resJson?.error_message);
59 | resJson?.is_blocked &&
60 | toast?.show("You are blocked from using clubhouse");
61 | }
62 | setSubmitting(false);
63 | };
64 |
65 | return (
66 |
67 | Enter your phone
68 |
69 | {
76 | console.log("selected country", country);
77 | setCountry(country);
78 | }}
79 | containerButtonStyle={{
80 | marginTop: -6,
81 | marginBottom: -8,
82 | marginRight: -4,
83 | }}
84 | visible={false}
85 | theme={{ ...DEFAULT_THEME, backgroundColor: "#f2efe4" }}
86 | />
87 |
88 | +{country.callingCode[0]}
89 |
90 |
97 |
98 |
99 | {submitting ? (
100 |
101 | ) : (
102 | <>
103 | Next
104 |
109 | >
110 | )}
111 |
112 |
113 | );
114 | };
115 |
116 | const styles = StyleSheet.create({
117 | title: {
118 | fontSize: 25,
119 | fontFamily: "Nunito-Light",
120 | marginTop: 100,
121 | },
122 | inputContainer: {
123 | backgroundColor: "#fff",
124 | width: "70%",
125 | height: 40,
126 | marginTop: 56,
127 | borderRadius: 4,
128 | flexDirection: "row",
129 | alignItems: "center",
130 | paddingHorizontal: 8,
131 | },
132 | input: {
133 | fontSize: 15,
134 | fontFamily: "Nunito-Regular",
135 | width: "100%",
136 | height: "100%",
137 | textAlignVertical: "center",
138 | marginTop: 4,
139 | },
140 | button: {
141 | width: 175,
142 | backgroundColor: "#5576AB",
143 | height: 46,
144 | justifyContent: "center",
145 | alignItems: "center",
146 | flexDirection: "row",
147 | marginTop: 72,
148 | borderRadius: 24,
149 | },
150 | buttonTitle: {
151 | color: "#fff",
152 | fontFamily: "Nunito-SemiBold",
153 | fontSize: 18,
154 | },
155 | });
156 |
157 | export default Login;
158 |
--------------------------------------------------------------------------------
/src/screens/room/index.tsx:
--------------------------------------------------------------------------------
1 | import { RouteProp, useNavigation } from "@react-navigation/native";
2 | import React, { FC, useEffect, useMemo } from "react";
3 | import { ActivityIndicator, StyleSheet, Text, View } from "react-native";
4 | import { MaterialCommunityIcons } from "@expo/vector-icons";
5 | import Screen from "../../components/screen";
6 | import { User } from "../../models/channel";
7 | import { StackParamList } from "../../navigator";
8 | import { FlatList, TouchableOpacity } from "react-native-gesture-handler";
9 | import { useTheme } from "../../contexts/theme/context";
10 | import { useRoom } from "../../contexts/room/context";
11 | import UserCell from "./user-cell";
12 | import useInteractionManger from "../../utils/useInteractionManager";
13 | import { useSelector } from "react-redux";
14 | import { RootState } from "../../store/store";
15 |
16 | interface Props {
17 | route: RouteProp;
18 | }
19 |
20 | const Room: FC = ({ route }) => {
21 | const { loading, rtc, pubnub, join, leave } = useRoom();
22 | const room = useSelector((state: RootState) => state.room.currentRoom);
23 | const isMounting = useInteractionManger();
24 |
25 | useEffect(() => {
26 | join && join(route.params.channel);
27 | }, []);
28 | const { goBack, navigate } = useNavigation();
29 | const { theme } = useTheme();
30 |
31 | const renderUser = (user: User) => ;
32 |
33 | // const speakers = useMemo(
34 | // () => room?.users.filter((user) => user.is_speaker),
35 | // [room?.users.length]
36 | // );
37 | // const followedBySpeakers = useMemo(
38 | // () =>
39 | // room?.users.filter(
40 | // (user) => !user.is_speaker && user.is_followed_by_speaker
41 | // ),
42 | // [room?.users.length]
43 | // );
44 | const audience = useMemo(
45 | () =>
46 | room?.users.filter(
47 | (user) => !user.is_speaker && !user.is_followed_by_speaker
48 | ),
49 | [room?.users.length]
50 | );
51 |
52 | const renderItem = ({ item }: any) => renderUser(item);
53 |
54 | const getItemLayout = (data, index) => ({
55 | length: 110,
56 | offset: 110 * index,
57 | index,
58 | });
59 |
60 | return (
61 |
62 |
63 | {loading || isMounting ? (
64 |
65 | ) : (
66 |
71 |
72 | {room?.topic}
73 |
74 |
75 | {room?.users?.map((u) => u.is_speaker && renderUser(u))}
76 |
77 |
78 | Followed by speakers
79 |
80 |
81 | {room?.users?.map(
82 | (u) => u.is_followed_by_speaker && renderUser(u)
83 | )}
84 |
85 |
91 | Audience ({audience?.length})
92 |
93 | >
94 | )
95 | }
96 | data={audience}
97 | renderItem={renderItem}
98 | numColumns={4}
99 | keyExtractor={(item) => item.user_id.toString()}
100 | removeClippedSubviews
101 | getItemLayout={getItemLayout}
102 | />
103 | )}
104 |
105 |
106 | {/*
110 | }
111 | removeClippedSubviews={Platform.OS === "android"}
112 | >
113 | {!loading && (
114 | <>
115 | {channel?.topic}
116 |
117 |
118 | {speakers?.map(renderUser)}
119 |
120 | Followed by speakers
121 |
122 | {followedBySpeakers?.map(renderUser)}
123 |
124 | Audience
125 |
126 | {audience?.map(renderUser)}
127 |
128 | >
129 | )}
130 | */}
131 |
132 | {
136 | leave && leave();
137 | goBack();
138 | }}
139 | >
140 | ✌️ Leave quietly
141 |
142 |
143 |
149 |
150 |
151 |
152 | );
153 | };
154 |
155 | const styles = StyleSheet.create({
156 | container: {
157 | width: "100%",
158 | },
159 | body: {
160 | borderTopRightRadius: 40,
161 | borderTopLeftRadius: 40,
162 | width: "100%",
163 | justifyContent: "center",
164 | alignItems: "center",
165 | flex: 1,
166 | },
167 | list: {
168 | padding: 24,
169 | },
170 | topic: {
171 | fontFamily: "Nunito-Bold",
172 | color: "#454245",
173 | fontSize: 15,
174 | },
175 |
176 | usersContainer: {
177 | flexDirection: "row",
178 | flexWrap: "wrap",
179 | paddingVertical: 16,
180 | },
181 |
182 | sectionTitle: {
183 | color: "#d7d5d8",
184 | marginLeft: 16,
185 | fontFamily: "Nunito-Bold",
186 | },
187 |
188 | footer: {
189 | height: 72,
190 | width: "100%",
191 | flexDirection: "row",
192 | alignItems: "center",
193 | paddingHorizontal: 16,
194 | },
195 | leaveButton: {
196 | paddingHorizontal: 16,
197 | paddingVertical: 8,
198 | backgroundColor: "#B8B7B9",
199 | borderRadius: 24,
200 | alignItems: "center",
201 | justifyContent: "center",
202 | },
203 | leaveButtonTitle: {
204 | fontFamily: "Nunito-Bold",
205 | color: "#8E4B60",
206 | },
207 | raiseHandButton: {
208 | padding: 8,
209 | backgroundColor: "#B8B7B9",
210 | borderRadius: 24,
211 | alignItems: "center",
212 | justifyContent: "center",
213 | marginLeft: "auto",
214 | },
215 | });
216 |
217 | export default Room;
218 |
--------------------------------------------------------------------------------
/src/screens/room/room-recycler-list.tsx:
--------------------------------------------------------------------------------
1 | import { RouteProp } from "@react-navigation/native";
2 | import React, { Component } from "react";
3 | import { StyleSheet, Text, View, Image, Dimensions } from "react-native";
4 | import { MaterialCommunityIcons } from "@expo/vector-icons";
5 | import Screen from "../../components/screen";
6 | import { Channel, User } from "../../models/channel";
7 | import { StackParamList } from "../../navigator";
8 | import req from "../../utils/req";
9 | import { connect } from "react-redux";
10 | import { RootState } from "../../store/store";
11 | import { withRtc, WithRtcProp } from "../../contexts/rtcContext";
12 | import { TouchableOpacity } from "react-native-gesture-handler";
13 | import PubNub from "pubnub";
14 | import {
15 | DataProvider,
16 | LayoutProvider,
17 | RecyclerListView,
18 | } from "recyclerlistview";
19 | import Flex from "../../components/flex";
20 | import { StackNavigationProp } from "@react-navigation/stack";
21 |
22 | let { width } = Dimensions.get("window");
23 | const ViewTypes = {
24 | ROOM_TITLE: 0,
25 | TRIPLE: 1,
26 | QUAD: 2,
27 | SECTION_TITLE: 3,
28 | };
29 |
30 | interface Props extends WithRtcProp, ReturnType {
31 | route: RouteProp;
32 | navigation: StackNavigationProp;
33 | }
34 |
35 | interface State {
36 | dataProvider: DataProvider;
37 | speakingUsers: number[];
38 | loading: boolean;
39 | channel: Channel | null;
40 | }
41 |
42 | class RoomRecyclerClass extends Component {
43 | constructor(props: Props) {
44 | super(props);
45 | this.state = {
46 | dataProvider: new DataProvider(
47 | (r1, r2) => r1.user_id !== r2.user_id
48 | ).cloneWithRows([]),
49 | speakingUsers: [],
50 | loading: false,
51 | channel: null,
52 | };
53 | }
54 |
55 | layoutProvider = new LayoutProvider(
56 | (index) => {
57 | let data = this.state.dataProvider.getDataForIndex(index);
58 | // console.log("index", index, "data", data);
59 | if (data["type"] === "room_title") {
60 | return ViewTypes.ROOM_TITLE;
61 | } else if (data["type"] === "title") {
62 | return ViewTypes.SECTION_TITLE;
63 | } else if (data.is_speaker || data.is_followed_by_speaker) {
64 | return ViewTypes.TRIPLE;
65 | } else {
66 | return ViewTypes.QUAD;
67 | }
68 | },
69 | (type, dim) => {
70 | switch (type) {
71 | case ViewTypes.ROOM_TITLE:
72 | dim.width = width;
73 | dim.height = 64;
74 | break;
75 | case ViewTypes.TRIPLE:
76 | dim.width = width / 3 - 12;
77 | dim.height = 128;
78 | break;
79 | case ViewTypes.QUAD:
80 | dim.width = width / 4 - 8;
81 | dim.height = 128;
82 | break;
83 |
84 | case ViewTypes.SECTION_TITLE:
85 | dim.width = width;
86 | dim.height = 40;
87 | break;
88 | default:
89 | dim.width = 0;
90 | dim.height = 0;
91 | }
92 | }
93 | );
94 |
95 | pubnub: null | PubNub = null;
96 |
97 | componentDidMount() {
98 | this.joinRoom();
99 | }
100 |
101 | componentWillUnmount() {
102 | this.leaveRoom();
103 | }
104 |
105 | componentDidUpdate(prevProps: Props, prevState: State) {
106 | if (
107 | prevState.channel?.users?.length !== this.state.channel?.users?.length
108 | ) {
109 | this.setState({
110 | dataProvider: this.state.dataProvider.cloneWithRows(
111 | this.normalizeUsersList(this.state.channel?.users ?? [])
112 | ),
113 | });
114 | }
115 | }
116 |
117 | joinRoom = async () => {
118 | this.setState({ loading: true });
119 | const res = await req("/join_channel", {
120 | method: "POST",
121 | body: {
122 | channel: this.props.route.params.channel,
123 | attribution_source: "feed",
124 | attribution_details: "eyJpc19leHBsb3JlIjpmYWxzZSwicmFuayI6MX0=",
125 | },
126 | });
127 | const resJson: Channel = await res.json();
128 | console.log("joined channel result", resJson);
129 | if (resJson.success === false) {
130 | toast?.show(resJson.error_message, { type: "normal", duration: 8000 });
131 | this.props.navigation.goBack();
132 | return;
133 | }
134 | await this.setState({
135 | channel: resJson,
136 | loading: false,
137 | });
138 | this.initRTC(resJson.token);
139 | this.initPubnub(resJson);
140 |
141 | return resJson;
142 | };
143 |
144 | leaveRoom = async () => {
145 | this.props.rtc?.engine?.leaveChannel();
146 | this.props.rtc?.engine?.removeAllListeners();
147 | this.pubnub?.unsubscribeAll();
148 | this.pubnub?.stop();
149 | const res = await req("/leave_channel", {
150 | method: "POST",
151 | body: {
152 | channel: this.props.route.params.channel,
153 | },
154 | });
155 | const resJson = await res.json();
156 |
157 | console.log("leave channel result", resJson);
158 | return resJson;
159 | };
160 |
161 | normalizeUsersList = (users: User[]) => {
162 | const speakers =
163 | users.filter((user) => user.is_speaker && !user.is_followed_by_speaker) ??
164 | [];
165 | const followedBySpeakers =
166 | users.filter((user) => !user.is_speaker && user.is_followed_by_speaker) ??
167 | [];
168 | const audience =
169 | users.filter(
170 | (user) => !user.is_speaker && !user.is_followed_by_speaker
171 | ) ?? [];
172 | let res = [];
173 | res = [{ type: "room_title", title: this.state.channel?.topic }];
174 |
175 | if (speakers.length > 0) {
176 | res = [...res, ...speakers];
177 | }
178 |
179 | if (followedBySpeakers.length > 0) {
180 | res = [
181 | ...res,
182 | { type: "title", title: "Followed by speakers" },
183 | ...followedBySpeakers,
184 | ];
185 | }
186 |
187 | if (audience.length > 0) {
188 | res = [
189 | ...res,
190 | { type: "title", title: "Audience", num: audience.length },
191 | ...audience,
192 | ];
193 | }
194 | console.log("normalized users", res);
195 | return res;
196 | };
197 |
198 | initPubnub = (_channel: Channel) => {
199 | console.log("pubnub token", _channel.pubnub_token);
200 | this.pubnub = new PubNub({
201 | publishKey: "pub-c-6878d382-5ae6-4494-9099-f930f938868b",
202 | subscribeKey: "sub-c-a4abea84-9ca3-11ea-8e71-f2b83ac9263d",
203 | authKey: _channel.pubnub_token,
204 | uuid: this.props.authState.user_profile?.user_id.toString(),
205 | origin: "clubhouse.pubnub.com",
206 | presenceTimeout: _channel.pubnub_heartbeat_value,
207 | heartbeatInterval: _channel?.pubnub_heartbeat_interval,
208 | });
209 |
210 | this.pubnub.addListener({
211 | message: this.handlePubnubMessage,
212 | status: (event) => console.log("pubnub status", event),
213 | });
214 |
215 | this.pubnub.subscribe({
216 | channels: [
217 | "users." + this.props.authState.user_profile?.user_id,
218 | "channel_user." +
219 | _channel.channel +
220 | "." +
221 | this.props.authState.user_profile?.user_id,
222 | "channel_all." + _channel.channel,
223 | ],
224 | });
225 | };
226 |
227 | handlePubnubMessage = (msg: any) => {
228 | console.log("pubnub message:", msg);
229 | const { message } = msg;
230 | if (message.channel !== this.props.route.params.channel) return;
231 | if (message.action === "join_channel") {
232 | this.onPubnubUserJoined(message);
233 | }
234 | if (message.action === "leave_channel") {
235 | this.onPubnubUserLeaved(message);
236 | }
237 | };
238 |
239 | onPubnubUserJoined = async (message: any) => {
240 | const user = message.user_profile;
241 | // @ts-ignore
242 |
243 | this.setState({
244 | channel: {
245 | ...this.state.channel,
246 | users: [...(this.state.channel?.users ?? []), user],
247 | },
248 | });
249 | };
250 |
251 | onPubnubUserLeaved = (message: any) => {
252 | this.setState({
253 | channel: {
254 | ...this.state.channel,
255 | users:
256 | this.state.channel?.users?.filter(
257 | (u) => u.user_id !== message.user_id
258 | ) ?? [],
259 | },
260 | });
261 | };
262 |
263 | initRTC = async (token: string | undefined) => {
264 | this.joinChannel(token);
265 |
266 | const engine = this.props.rtc.engine;
267 | engine?.setDefaultAudioRoutetoSpeakerphone(true);
268 | engine?.addListener("Warning", (warn) => {
269 | console.log("Warning", warn);
270 | });
271 |
272 | engine?.addListener("Warning", (warn) => {
273 | console.log("Warning", warn);
274 | });
275 |
276 | engine?.addListener("Error", (err) => {
277 | console.log("Error", err);
278 | });
279 |
280 | engine?.addListener("UserJoined", (uid, elapsed) => {
281 | console.log("UserJoined", uid, elapsed);
282 | });
283 |
284 | engine?.addListener("UserOffline", (uid, reason) => {
285 | console.log("UserOffline", uid, reason);
286 | });
287 |
288 | // If Local user joins RTC channel
289 | engine?.addListener("JoinChannelSuccess", (channel, uid, elapsed) => {
290 | console.log("JoinChannelSuccess", channel, uid, elapsed);
291 | });
292 |
293 | engine?.addListener("AudioVolumeIndication", (speakers) => {
294 | console.log("loadest spkears", speakers);
295 | this.setState({ speakingUsers: speakers.map((s) => s.uid) });
296 | });
297 | };
298 |
299 | joinChannel = async (token: string | undefined) => {
300 | // Join Channel using null token and channel name
301 | console.log("channel token", token);
302 | await this.props.rtc?.engine?.joinChannel(
303 | token,
304 | this.props.route.params.channel,
305 | null,
306 | this.props.authState.user_profile?.user_id ?? 0
307 | );
308 | };
309 |
310 | renderUser = (user: User, extendedState: any) => {
311 | const isAudience = !user.is_speaker && !user.is_followed_by_speaker;
312 | const isSpeaking = extendedState?.speakingUsers?.includes(user.user_id);
313 | return (
314 |
315 |
316 |
324 | {user.is_speaker && (
325 |
326 |
327 |
328 | )}
329 |
330 |
331 | {user.name}
332 |
333 | );
334 | };
335 |
336 | rowRenderer = (type: any, data: any, index: number, extendedState: any) => {
337 | //You can return any view here, CellContainer has no special significance
338 | switch (type) {
339 | case ViewTypes.ROOM_TITLE:
340 | return (
341 |
342 | {this.state.channel?.topic}
343 |
344 | );
345 | case ViewTypes.TRIPLE:
346 | return (
347 |
348 | {this.renderUser(data, extendedState)}
349 |
350 | );
351 | case ViewTypes.QUAD:
352 | return (
353 |
354 | {this.renderUser(data, extendedState)}
355 |
356 | );
357 |
358 | case ViewTypes.SECTION_TITLE:
359 | return (
360 |
366 |
367 | {data.title} {data["num"] ? `( ${data["num"]} )` : ""}
368 |
369 |
370 | );
371 | default:
372 | return null;
373 | }
374 | };
375 |
376 | render() {
377 | return (
378 |
379 |
380 | {!this.state.loading && (
381 |
388 | )}
389 |
390 |
391 |
392 | {}}>
393 | ✌️ Leave quietly
394 |
395 |
396 |
401 |
402 |
403 |
404 | );
405 | }
406 | }
407 |
408 | const styles = StyleSheet.create({
409 | container: {
410 | width: "100%",
411 | },
412 | body: {
413 | backgroundColor: "#FEFCFF",
414 | borderTopRightRadius: 40,
415 | borderTopLeftRadius: 40,
416 | marginTop: 16,
417 | minHeight: "100%",
418 | paddingLeft: 16,
419 | paddingBottom: 16,
420 | },
421 | topic: {
422 | fontFamily: "Nunito-Bold",
423 | color: "#454245",
424 | fontSize: 15,
425 | },
426 |
427 | usersContainer: {
428 | flexDirection: "row",
429 | flexWrap: "wrap",
430 | paddingVertical: 16,
431 | },
432 |
433 | sectionTitle: {
434 | color: "#d7d5d8",
435 | marginLeft: 16,
436 | fontFamily: "Nunito-Bold",
437 | },
438 |
439 | user: {
440 | flex: 1,
441 | alignItems: "center",
442 | paddingTop: 16,
443 | },
444 | userSmall: {
445 | width: 100 / 4 + "%",
446 | },
447 | userName: {
448 | fontFamily: "Nunito-Bold",
449 | color: "#4e4b4e",
450 | fontSize: 13,
451 | marginTop: 8,
452 | textAlign: "center",
453 | },
454 | userAvatar: {
455 | borderRadius: 72 / 2.5,
456 | width: 72,
457 | height: 72,
458 | },
459 | userAvatarSmall: {
460 | borderRadius: 28,
461 | width: 54,
462 | height: 54,
463 | },
464 | userAvatarSpeaking: {
465 | borderWidth: 3,
466 | borderColor: "#CCCBC5",
467 | padding: 3,
468 | borderRadius: 34,
469 | },
470 | userMicContainer: {
471 | position: "absolute",
472 | bottom: 0,
473 | right: 0,
474 | backgroundColor: "#FEFCFF",
475 | width: 24,
476 | height: 24,
477 | borderRadius: 12,
478 | alignItems: "center",
479 | justifyContent: "center",
480 | },
481 |
482 | footer: {
483 | height: 72,
484 | width: "100%",
485 | backgroundColor: "#FEFCFF",
486 | flexDirection: "row",
487 | alignItems: "center",
488 | paddingHorizontal: 16,
489 | },
490 | leaveButton: {
491 | paddingHorizontal: 16,
492 | paddingVertical: 8,
493 | backgroundColor: "#B8B7B9",
494 | borderRadius: 24,
495 | alignItems: "center",
496 | justifyContent: "center",
497 | },
498 | leaveButtonTitle: {
499 | fontFamily: "Nunito-Bold",
500 | color: "#8E4B60",
501 | },
502 | raiseHandButton: {
503 | padding: 8,
504 | backgroundColor: "#B8B7B9",
505 | borderRadius: 24,
506 | alignItems: "center",
507 | justifyContent: "center",
508 | marginLeft: "auto",
509 | },
510 | });
511 |
512 | const mapStateToProps = (state: RootState) => ({
513 | authState: state.auth,
514 | });
515 |
516 | export default connect(mapStateToProps)(withRtc(RoomRecyclerClass));
517 |
--------------------------------------------------------------------------------
/src/screens/room/user-cell.tsx:
--------------------------------------------------------------------------------
1 | import { useNavigation } from "@react-navigation/native";
2 | import React, { FC, memo, useMemo } from "react";
3 | import { View, Image, StyleSheet, Text } from "react-native";
4 | import { MaterialCommunityIcons } from "@expo/vector-icons";
5 | import defaultAvatar from "../../assets/default-avatar";
6 | import Touchable from "../../components/touchable";
7 | import { useRoom } from "../../contexts/room/context";
8 | import { User } from "../../models/channel";
9 | import { useTheme } from "../../contexts/theme/context";
10 | import { useSelector } from "react-redux";
11 | import { RootState } from "../../store/store";
12 |
13 | interface Props {
14 | user: User;
15 | }
16 |
17 | const UserCell: FC = ({ user }) => {
18 | const { goBack, navigate } = useNavigation();
19 | const isSpeaking = useSelector((state: RootState) =>
20 | state.room.speakingUsers.includes(user.user_id)
21 | );
22 | const { theme } = useTheme();
23 |
24 | const isAudience = !user.is_speaker && !user.is_followed_by_speaker;
25 | return (
26 |
33 | navigate("UserProfile", { user_id: user.user_id, user: user })
34 | }
35 | key={user.user_id.toString()}
36 | >
37 |
44 |
57 | {user.is_speaker && (
58 |
61 |
66 |
67 | )}
68 |
69 |
70 | {user.name}
71 |
72 | );
73 | };
74 |
75 | const styles = StyleSheet.create({
76 | user: {
77 | width: 100 / 3 + "%",
78 | alignItems: "center",
79 | marginBottom: 24,
80 | height: 110,
81 | },
82 | userSmall: {
83 | width: 100 / 4 + "%",
84 | height: 110,
85 | },
86 | userName: {
87 | fontFamily: "Nunito-Bold",
88 | color: "#4e4b4e",
89 | fontSize: 13,
90 | marginTop: 8,
91 | textAlign: "center",
92 | },
93 | userAvatar: {
94 | borderRadius: 72 / 2.5,
95 | width: 72,
96 | height: 72,
97 | },
98 | userAvatarSmall: {
99 | borderRadius: 28,
100 | width: 54,
101 | height: 54,
102 | },
103 | userAvatarSpeaking: {
104 | borderWidth: 3,
105 | borderColor: "#CCCBC5",
106 | padding: 3,
107 | borderRadius: 34,
108 | },
109 | userMicContainer: {
110 | position: "absolute",
111 | bottom: 0,
112 | right: 0,
113 | backgroundColor: "#FEFCFF",
114 | width: 24,
115 | height: 24,
116 | borderRadius: 12,
117 | alignItems: "center",
118 | justifyContent: "center",
119 | },
120 | });
121 |
122 | export default memo(UserCell);
123 |
--------------------------------------------------------------------------------
/src/screens/signup.tsx:
--------------------------------------------------------------------------------
1 | import React, { FC, useState } from "react";
2 | import {
3 | StyleSheet,
4 | Text,
5 | TextInput,
6 | TouchableOpacity,
7 | View,
8 | } from "react-native";
9 | import { MaterialCommunityIcons } from "@expo/vector-icons";
10 | import Screen from "../components/screen";
11 | import req from "../utils/req";
12 | import { RouteProp } from "@react-navigation/native";
13 | import { StackNavigationProp } from "@react-navigation/stack";
14 | import { StackParamList } from "../navigator";
15 |
16 | import { useDispatch } from "react-redux";
17 | import { authActions } from "../slices/authSlice";
18 | import { ActivityIndicator } from "react-native";
19 | import { useToast } from "react-native-fast-toast";
20 | import { LoginResult } from "../models/user";
21 | import Flex from "../components/flex";
22 |
23 | interface Props {
24 | route: RouteProp;
25 | navigation: StackNavigationProp;
26 | }
27 |
28 | const Register: FC = ({ route }) => {
29 | const [firstName, setFirstName] = useState("");
30 | const [lastName, setLastName] = useState("");
31 | const [username, setUsername] = useState("");
32 | const dispatch = useDispatch();
33 | const [submitting, setSubmitting] = useState(false);
34 | const toast = useToast();
35 |
36 | const register = async () => {
37 | if (!firstName || !lastName || !username)
38 | return toast?.show("Please fill all the requested fields");
39 | if (firstName.length < 2 || lastName.length < 2 || username.length < 2)
40 | return toast?.show("All fields should be bigger than 2 characters");
41 | if (username.length > 16)
42 | return toast?.show("Username can not be bigger than 16 characters");
43 | setSubmitting(true);
44 | const resName = await req("/update_name", {
45 | method: "POST",
46 | body: {
47 | name: firstName + " " + lastName,
48 | },
49 | });
50 | const resUsername = await req("/update_username", {
51 | method: "POST",
52 | body: {
53 | username,
54 | },
55 | });
56 | const resNameJson = await resName.json();
57 | const resUsernameJson: LoginResult = await resUsername.json();
58 | console.log("signup result", { resNameJson, resUsernameJson });
59 | if (resNameJson?.success && resUsernameJson?.success) {
60 | dispatch(authActions.setAuth({ is_onboarding: false }));
61 | } else {
62 | const errMsg =
63 | resNameJson?.error_message || resUsernameJson.error_message;
64 | errMsg && toast?.show(errMsg);
65 | }
66 | setSubmitting(false);
67 | };
68 |
69 | return (
70 |
71 |
72 |
73 |
78 |
79 |
80 |
85 |
86 |
87 |
88 |
89 |
94 |
95 |
96 | {submitting ? (
97 |
98 | ) : (
99 | <>
100 | Signup
101 |
106 | >
107 | )}
108 |
109 |
110 | );
111 | };
112 |
113 | const styles = StyleSheet.create({
114 | container: {
115 | paddingTop: 54,
116 | alignItems: "center",
117 | },
118 | inputContainer: {
119 | backgroundColor: "#fff",
120 | width: "70%",
121 | height: 40,
122 | marginBottom: 16,
123 | borderRadius: 4,
124 | flexDirection: "row",
125 | alignItems: "center",
126 | paddingHorizontal: 8,
127 | },
128 | input: {
129 | fontSize: 17,
130 | fontFamily: "Nunito-Regular",
131 | width: "100%",
132 | },
133 | button: {
134 | width: 175,
135 | backgroundColor: "#5576AB",
136 | height: 45,
137 | justifyContent: "center",
138 | alignItems: "center",
139 | flexDirection: "row",
140 | marginTop: 72,
141 | borderRadius: 24,
142 | },
143 | buttonTitle: {
144 | color: "#fff",
145 | fontFamily: "Nunito-SemiBold",
146 | fontSize: 18,
147 | },
148 | });
149 |
150 | export default Register;
151 |
--------------------------------------------------------------------------------
/src/screens/user-profile.tsx:
--------------------------------------------------------------------------------
1 | import { RouteProp } from "@react-navigation/native";
2 | import { StackNavigationProp } from "@react-navigation/stack";
3 | import React, { FC } from "react";
4 | import {
5 | ActivityIndicator,
6 | Image,
7 | RefreshControl,
8 | ScrollView,
9 | StyleSheet,
10 | Text,
11 | View,
12 | } from "react-native";
13 | import { useQuery } from "react-query";
14 | import defaultAvatar from "../assets/default-avatar";
15 | import Flex from "../components/flex";
16 | import Screen from "../components/screen";
17 | import { MaterialCommunityIcons } from "@expo/vector-icons";
18 | import { useTheme } from "../contexts/theme/context";
19 | import { APIResult } from "../models/api";
20 | import { UserProfile } from "../models/user";
21 | import { StackParamList } from "../navigator";
22 | import req from "../utils/req";
23 | import dayjs from "dayjs";
24 | import { useRoom } from "../contexts/room/context";
25 | import { authActions } from "../slices/authSlice";
26 | import { useDispatch, useSelector } from "react-redux";
27 | import Touchable from "../components/touchable";
28 | import { RootState } from "../store/store";
29 |
30 | interface Props {
31 | route: RouteProp;
32 | navigation: StackNavigationProp;
33 | }
34 |
35 | const UserProfileScreen: FC = ({ route }) => {
36 | const { isLoading, error, data, refetch } = useQuery(
37 | "user_profile" + route.params.user_id,
38 | () => getUser()
39 | );
40 | const { theme } = useTheme();
41 | const { leave } = useRoom();
42 | const dispatch = useDispatch();
43 | const isCurrentUser = useSelector(
44 | (state: RootState) =>
45 | state.auth.user_profile?.user_id === route.params.user_id
46 | );
47 |
48 | const getUser = async () => {
49 | const res = await req("/get_profile", {
50 | method: "POST",
51 | body: { user_id: route.params.user_id },
52 | });
53 | const resJson: APIResult<{ user_profile: UserProfile }> = await res.json();
54 | console.log("user profile", resJson);
55 | return resJson.user_profile;
56 | };
57 |
58 | const logout = () => {
59 | dispatch(authActions.logout());
60 | };
61 |
62 | return (
63 |
64 | {isLoading ? (
65 |
66 |
67 |
68 | ) : (
69 |
72 | }
73 | contentContainerStyle={styles.container}
74 | >
75 |
79 |
80 | {data?.name}
81 |
82 |
83 | @{data?.username}
84 |
85 |
86 |
87 |
88 | {data?.num_followers}
89 | {" "}
90 | followers
91 |
92 |
93 |
96 |
97 | {data?.num_following}
98 | {" "}
99 | followings
100 |
101 |
102 | {data?.bio}
103 | {(data?.twitter || data?.instagram) && (
104 |
105 | {data?.twitter && (
106 |
112 | {" "}
117 | {data?.twitter}
118 |
119 | )}
120 | {data?.instagram && (
121 |
122 | {" "}
127 | {data?.instagram}
128 |
129 | )}
130 |
131 | )}
132 |
133 |
134 |
140 |
141 |
142 | Joined {dayjs(data?.time_created).format("MMM DD, YYYY")}
143 |
144 |
145 | Nominated by{" "}
146 |
147 | {data?.invited_by_user_profile.name}
148 |
149 |
150 |
151 |
152 | {isCurrentUser && (
153 |
154 | Logout
155 |
156 | )}
157 |
158 | )}
159 |
160 | );
161 | };
162 |
163 | const styles = StyleSheet.create({
164 | container: { padding: 16 },
165 | avatar: {
166 | width: 72,
167 | height: 72,
168 | borderRadius: 32,
169 | },
170 | userName: {
171 | fontFamily: "Nunito-Bold",
172 | fontSize: 16,
173 | marginTop: 16,
174 | },
175 | username: {
176 | fontFamily: "Nunito-Regular",
177 | fontSize: 14,
178 | marginTop: 8,
179 | },
180 | followCount: {
181 | fontFamily: "Nunito-Regular",
182 | fontSize: 15,
183 | },
184 | followCountNumber: {
185 | fontFamily: "Nunito-Bold",
186 | fontSize: 17,
187 | },
188 | bio: {
189 | marginTop: 16,
190 | fontFamily: "Nunito-SemiBold",
191 | fontSize: 14,
192 | },
193 | inviterContainer: {
194 | marginTop: 40,
195 | flexDirection: "row",
196 | },
197 | inviterAvatar: {
198 | width: 40,
199 | height: 40,
200 | borderRadius: 16,
201 | },
202 | joinDate: {
203 | fontFamily: "Nunito-SemiBold",
204 | },
205 | inviter: {
206 | fontFamily: "Nunito-SemiBold",
207 | },
208 |
209 | button: {
210 | width: 135,
211 | backgroundColor: "#5576AB",
212 | height: 40,
213 | justifyContent: "center",
214 | alignItems: "center",
215 | flexDirection: "row",
216 | marginTop: 24,
217 | borderRadius: 24,
218 | },
219 | buttonTitle: {
220 | color: "#fff",
221 | fontFamily: "Nunito-SemiBold",
222 | fontSize: 16,
223 | },
224 | });
225 |
226 | export default UserProfileScreen;
227 |
--------------------------------------------------------------------------------
/src/screens/verification-code.tsx:
--------------------------------------------------------------------------------
1 | import React, { FC, useState } from "react";
2 | import {
3 | StyleSheet,
4 | Text,
5 | TextInput,
6 | TouchableOpacity,
7 | View,
8 | } from "react-native";
9 | import { MaterialCommunityIcons } from "@expo/vector-icons";
10 | import Screen from "../components/screen";
11 | import req from "../utils/req";
12 | import AsyncStorage from "@react-native-async-storage/async-storage";
13 | import { RouteProp, useNavigation } from "@react-navigation/native";
14 | import { StackNavigationProp } from "@react-navigation/stack";
15 | import { StackParamList } from "../navigator";
16 |
17 | import { useDispatch } from "react-redux";
18 | import { authActions } from "../slices/authSlice";
19 | import { ActivityIndicator } from "react-native";
20 | import { useToast } from "react-native-fast-toast";
21 | import { LoginResult } from "../models/user";
22 |
23 | interface Props {
24 | route: RouteProp;
25 | navigation: StackNavigationProp;
26 | }
27 |
28 | const VerificationCode: FC = ({ route }) => {
29 | const [verificationCode, setVerificationCode] = useState("");
30 | const navigation = useNavigation();
31 | const dispatch = useDispatch();
32 | const [submitting, setSubmitting] = useState(false);
33 | const toast = useToast();
34 |
35 | const verifyCode = async () => {
36 | console.log("phonenumber", route.params.phonenumber);
37 | if (!verificationCode)
38 | return toast?.show("Please enter the verification code");
39 | setSubmitting(true);
40 | const res = await req("/complete_phone_number_auth", {
41 | method: "POST",
42 | body: {
43 | phone_number: route.params.phonenumber,
44 | verification_code: verificationCode,
45 | },
46 | });
47 | const resJson: LoginResult = await res.json();
48 | console.log("login result", resJson);
49 | if (res.ok) {
50 | dispatch(authActions.setAuth(resJson));
51 | } else {
52 | !resJson.is_verified &&
53 | toast?.show(
54 | "The code you entered was incorrect, remaining attempts: " +
55 | // @ts-ignore
56 | resJson.number_of_attempts_remaining
57 | );
58 | }
59 | setSubmitting(false);
60 | };
61 |
62 | return (
63 |
64 | {`Enter the code \n we just texted you`}
65 |
66 |
72 |
73 |
74 | {submitting ? (
75 |
76 | ) : (
77 | <>
78 | Next
79 |
84 | >
85 | )}
86 |
87 |
88 | );
89 | };
90 |
91 | const styles = StyleSheet.create({
92 | title: {
93 | fontSize: 25,
94 | fontFamily: "Nunito-Light",
95 | marginTop: "25%",
96 | textAlign: "center",
97 | },
98 | inputContainer: {
99 | backgroundColor: "#fff",
100 | width: "70%",
101 | height: 40,
102 | marginTop: 56,
103 | borderRadius: 4,
104 | flexDirection: "row",
105 | alignItems: "center",
106 | paddingHorizontal: 8,
107 | },
108 | input: {
109 | fontSize: 17,
110 | fontFamily: "Nunito-Regular",
111 | width: "100%",
112 | },
113 | button: {
114 | width: 175,
115 | backgroundColor: "#5576AB",
116 | height: 45,
117 | justifyContent: "center",
118 | alignItems: "center",
119 | flexDirection: "row",
120 | marginTop: 72,
121 | borderRadius: 24,
122 | },
123 | buttonTitle: {
124 | color: "#fff",
125 | fontFamily: "Nunito-SemiBold",
126 | fontSize: 18,
127 | },
128 | });
129 |
130 | export default VerificationCode;
131 |
--------------------------------------------------------------------------------
/src/slices/authSlice.ts:
--------------------------------------------------------------------------------
1 | import { createSlice, PayloadAction } from "@reduxjs/toolkit";
2 | import { LoginUserProfile, LoginResult } from "../models/user";
3 |
4 | export interface AuthState {
5 | user_profile: LoginUserProfile | null;
6 | access_token: string | null;
7 | auth_token: string | null;
8 | refresh_token: string | null;
9 | is_verified: boolean;
10 | is_waitlisted: boolean;
11 | is_onboarding: boolean;
12 | }
13 |
14 | const initialState: AuthState = {
15 | user_profile: null,
16 | access_token: null,
17 | auth_token: null,
18 | refresh_token: null,
19 | is_verified: false,
20 | is_waitlisted: false,
21 | is_onboarding: false,
22 | };
23 |
24 | const authSlice = createSlice({
25 | name: "app",
26 | initialState,
27 | reducers: {
28 | setAuth(state, action: PayloadAction>) {
29 | if (action.payload.user_profile !== undefined)
30 | state.user_profile = action.payload.user_profile;
31 | if (action.payload.access_token !== undefined)
32 | state.access_token = action.payload.access_token;
33 | if (action.payload.auth_token !== undefined)
34 | state.auth_token = action.payload.auth_token;
35 | if (action.payload.refresh_token !== undefined)
36 | state.refresh_token = action.payload.refresh_token;
37 | if (action.payload.is_verified !== undefined)
38 | state.is_verified = action.payload.is_verified;
39 | if (action.payload.is_waitlisted !== undefined)
40 | state.is_waitlisted = action.payload.is_waitlisted;
41 | if (action.payload.is_onboarding !== undefined)
42 | state.is_onboarding = action.payload.is_onboarding;
43 | },
44 |
45 | logout(state) {
46 | state.user_profile = null;
47 | state.access_token = null;
48 | state.auth_token = null;
49 | state.refresh_token = null;
50 | state.is_verified = false;
51 | state.is_waitlisted = false;
52 | state.is_onboarding = false;
53 | },
54 | },
55 | });
56 |
57 | export const authReducer = authSlice.reducer;
58 |
59 | export const authActions = authSlice.actions;
60 |
--------------------------------------------------------------------------------
/src/slices/authThunks.ts:
--------------------------------------------------------------------------------
1 | import { APIResult } from "../models/api";
2 | import req from "../utils/req";
3 | import { authActions } from "./authSlice";
4 |
5 | export const getMe = () => async (dispatch) => {
6 | const res = await req("/me", {
7 | method: "POST",
8 | body: {
9 | return_blocked_ids: false,
10 | timezone_identifier: "Asia/Tokyo",
11 | return_following_ids: false,
12 | },
13 | });
14 | const resJson: APIResult = await res.json();
15 | if (resJson.success) {
16 | dispatch(
17 | authActions.setAuth({
18 | user_profile: resJson.user_profile,
19 | is_waitlisted: false,
20 | })
21 | );
22 | }
23 | console.log("me", resJson);
24 | return resJson;
25 | };
26 |
--------------------------------------------------------------------------------
/src/slices/roomSlice.ts:
--------------------------------------------------------------------------------
1 | import { createSlice, PayloadAction } from "@reduxjs/toolkit";
2 | import { Channel, User } from "../models/channel";
3 |
4 | export interface AuthState {
5 | currentRoom: Channel | null;
6 | speakingUsers: number[];
7 | }
8 |
9 | const initialState: AuthState = {
10 | currentRoom: null,
11 | speakingUsers: [],
12 | };
13 |
14 | const roomSlice = createSlice({
15 | name: "room",
16 | initialState,
17 | reducers: {
18 | setSpeakingUsers(state, action: PayloadAction) {
19 | state.speakingUsers = action.payload;
20 | },
21 | setRoom(state, action: PayloadAction) {
22 | state.currentRoom = action.payload;
23 | },
24 | addRoomUser(state, action: PayloadAction) {
25 | state.currentRoom?.users.push(action.payload);
26 | },
27 | removeRoomUser(state, action: PayloadAction<{ user_id: number }>) {
28 | if (state.currentRoom?.users)
29 | state.currentRoom.users = state.currentRoom?.users.filter(
30 | (u) => u.user_id !== action.payload.user_id
31 | );
32 | },
33 | },
34 | });
35 |
36 | export const roomReducer = roomSlice.reducer;
37 |
38 | export const roomActions = roomSlice.actions;
39 |
--------------------------------------------------------------------------------
/src/store/persistConfig.ts:
--------------------------------------------------------------------------------
1 | import AsyncStorage from "@react-native-async-storage/async-storage";
2 | import { createMigrate } from "redux-persist";
3 | import autoMergeLevel2 from "redux-persist/lib/stateReconciler/autoMergeLevel2";
4 |
5 | const migrations = {};
6 |
7 | export default {
8 | key: "root",
9 | version: 1,
10 | storage: AsyncStorage,
11 | whitelist: ["auth"],
12 | migrate: createMigrate(migrations, { debug: false }),
13 | stateReconciler: autoMergeLevel2,
14 | timeout: null,
15 | };
16 |
--------------------------------------------------------------------------------
/src/store/store.ts:
--------------------------------------------------------------------------------
1 | import {
2 | combineReducers,
3 | configureStore,
4 | getDefaultMiddleware,
5 | } from "@reduxjs/toolkit";
6 | import { createLogger } from "redux-logger";
7 | import { persistReducer, persistStore } from "redux-persist";
8 | import persistConfig from "./persistConfig";
9 | import { authReducer } from "../slices/authSlice";
10 | import { roomReducer } from "../slices/roomSlice";
11 |
12 | const logger = createLogger();
13 | const middleware = [
14 | ...getDefaultMiddleware({ serializableCheck: false }),
15 | logger,
16 | ];
17 |
18 | const rootReducer = combineReducers({
19 | auth: authReducer,
20 | room: roomReducer,
21 | });
22 |
23 | export type RootState = ReturnType;
24 | export type AppDispatch = typeof store.dispatch;
25 |
26 | const persistedReducer = persistReducer(persistConfig, rootReducer);
27 |
28 | export const store = configureStore({
29 | reducer: persistedReducer,
30 | middleware,
31 | });
32 |
33 | export const persistor = persistStore(store);
34 |
--------------------------------------------------------------------------------
/src/utils/mock.js:
--------------------------------------------------------------------------------
1 | export default {};
2 |
--------------------------------------------------------------------------------
/src/utils/req.ts:
--------------------------------------------------------------------------------
1 | import { store } from "../store/store";
2 | import { getToken } from "./token";
3 |
4 | export const API_URL = "https://www.clubhouseapi.com/api";
5 | const API_BUILD_ID = "304";
6 | const API_BUILD_VERSION = "0.1.28";
7 | const API_UA = `clubhouse/${API_BUILD_ID} (iPhone; iOS 14.4; Scale/2.00)`;
8 |
9 | export const HEADERS = {
10 | "CH-Languages": "en-JP,ja-JP",
11 | "CH-Locale": "en_JP",
12 | Accept: "application/json",
13 | "Accept-Language": "en-JP;q=1, ja-JP;q=0.9",
14 | "Accept-Encoding": "gzip, deflate",
15 | "CH-AppBuild": API_BUILD_ID,
16 | "CH-AppVersion": API_BUILD_VERSION,
17 | "User-Agent": API_UA,
18 | Connection: "close",
19 | "Content-Type": "application/json; charset=utf-8",
20 | Host: "www.clubhouseapi.com",
21 | // "Cookie": __cfduid={secrets.token_hex(21)}{random.randint(1, 9)}
22 | };
23 |
24 | interface Opts {
25 | method?: "GET" | "POST";
26 | body?: object;
27 | }
28 |
29 | const req = (path: string, opts?: Opts) => {
30 | const token = store.getState().auth.auth_token;
31 | if (token) {
32 | // @ts-ignore
33 | HEADERS["Authorization"] = `Token ${token}`;
34 | }
35 | return fetch(API_URL + path, {
36 | method: opts?.method ?? "GET",
37 | headers: HEADERS,
38 | body: opts?.body ? JSON.stringify(opts?.body) : undefined,
39 | });
40 | };
41 |
42 | export default req;
43 |
--------------------------------------------------------------------------------
/src/utils/useInteractionManager.ts:
--------------------------------------------------------------------------------
1 | import React, { useEffect, useState } from "react";
2 | import { InteractionManager } from "react-native";
3 |
4 | const useInteractionManger = () => {
5 | const [loading, setLoading] = useState(true);
6 | useEffect(() => {
7 | InteractionManager.runAfterInteractions().then(() => {
8 | setLoading(false);
9 | });
10 | }, []);
11 | return loading;
12 | };
13 |
14 | export default useInteractionManger;
15 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "allowSyntheticDefaultImports": true,
4 | "jsx": "react-native",
5 | "lib": ["dom", "esnext"],
6 | "moduleResolution": "node",
7 | "noEmit": true,
8 | "skipLibCheck": true,
9 | "resolveJsonModule": true,
10 | "strict": true
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/web/expo-service-worker.js:
--------------------------------------------------------------------------------
1 | /* eslint-env serviceworker */
2 |
3 | /**
4 | * Store notification icon string in service worker.
5 | * Ref: https://stackoverflow.com/a/35729334/2603230
6 | */
7 | self.addEventListener('message', event => {
8 | let data;
9 | if (typeof event.data === 'string') {
10 | try {
11 | data = JSON.parse(event.data);
12 | } catch (e) {}
13 | }
14 |
15 | if (data && data.fromExpoWebClient) {
16 | self.notificationIcon = data.fromExpoWebClient.notificationIcon;
17 | }
18 | });
19 |
20 | /**
21 | * Add support for push notification.
22 | */
23 | self.addEventListener('push', event => {
24 | let payload = {};
25 | try {
26 | payload = event.data.json();
27 | } catch (e) {
28 | // If `event.data.text()` is not a JSON object, we just treat it
29 | // as a plain string and display it as the body.
30 | payload = { title: '', body: event.data.text() };
31 | }
32 |
33 | const title = payload.title;
34 | const data = payload.data || payload.custom || {};
35 | const options = {
36 | body: payload.body,
37 | data,
38 | };
39 | options.icon = data._icon || payload.icon || self.notificationIcon || null;
40 | options.image =
41 | data._richContent && data._richContent.image ? options.data._richContent.image : payload.image;
42 | options.tag = data._tag || payload.collapseKey;
43 | if (options.tag) {
44 | options.renotify = data._renotify;
45 | }
46 |
47 | event.waitUntil(self.registration.showNotification(title, options));
48 | });
49 |
50 | // https://developer.mozilla.org/en-US/docs/Web/API/Clients
51 | self.addEventListener('notificationclick', event => {
52 | event.notification.close();
53 |
54 | event.waitUntil(
55 | (async () => {
56 | const allClients = await self.clients.matchAll({
57 | includeUncontrolled: true,
58 | });
59 |
60 | let appClient;
61 |
62 | const path = event.notification.data._webPath || '/';
63 |
64 | // If we already have a window open, use it.
65 | for (const client of allClients) {
66 | const url = new URL(client.url);
67 |
68 | if (url.pathname === path) {
69 | client.focus();
70 | appClient = client;
71 | break;
72 | }
73 | }
74 |
75 | // If there is no existing window, open a new one.
76 | if (!appClient) {
77 | appClient = await self.clients.openWindow(path);
78 | }
79 |
80 | // Message the client:
81 | // `origin` will always be `'selected'` in this case.
82 | // https://docs.expo.io/versions/latest/sdk/notifications/#notification
83 | appClient.postMessage({
84 | origin: 'selected',
85 | data: event.notification.data,
86 | remote: !event.notification._isLocal,
87 | });
88 | })()
89 | );
90 | });
91 |
92 | // TODO: Consider cache: https://github.com/expo/expo-cli/pull/844#issuecomment-515619883
93 | // Import the script generated by workbox.
94 | self.importScripts('service-worker.js');
95 |
--------------------------------------------------------------------------------
/web/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
10 |
14 | %WEB_TITLE%
15 |
63 |
64 |
65 |
66 |
70 |
114 |
115 |
116 |
117 |
118 |
--------------------------------------------------------------------------------
/web/register-service-worker.js:
--------------------------------------------------------------------------------
1 | /* eslint-env browser */
2 |
3 | if ('serviceWorker' in navigator) {
4 | window.addEventListener('load', function () {
5 | navigator.serviceWorker
6 | .register('SW_PUBLIC_URL/expo-service-worker.js', { scope: 'SW_PUBLIC_SCOPE' })
7 | .then(function (info) {
8 | // console.info('Registered service-worker', info);
9 | })
10 | .catch(function (error) {
11 | console.info('Failed to register service-worker', error);
12 | });
13 | });
14 | }
15 |
--------------------------------------------------------------------------------
/web/serve.json:
--------------------------------------------------------------------------------
1 | {
2 | "headers": [
3 | {
4 | "source": "static/**/*.js",
5 | "headers": [
6 | {
7 | "key": "Cache-Control",
8 | "value": "public, max-age=31536000, immutable"
9 | }
10 | ]
11 | }
12 | ]
13 | }
14 |
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | const createExpoWebpackConfigAsync = require("@expo/webpack-config");
2 | const path = require("path");
3 |
4 | // Expo CLI will await this method so you can optionally return a promise.
5 | module.exports = async function (env, argv) {
6 | const config = await createExpoWebpackConfigAsync(env, argv);
7 | // If you want to add a new alias to the config.
8 | config.resolve.alias["react-native-agora"] = path.resolve(
9 | __dirname,
10 | "./src/utils/mock.js"
11 | );
12 |
13 | // turn off compression in dev mode.
14 | if (config.mode === "development") {
15 | config.devServer.compress = false;
16 | }
17 | return config;
18 | };
19 |
--------------------------------------------------------------------------------