Skip to content

Commit

Permalink
feat: add async audio feature to sample app (#2504)
Browse files Browse the repository at this point in the history
  • Loading branch information
khushal87 committed May 2, 2024
1 parent 871cdd2 commit fa6817d
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 10 deletions.
16 changes: 12 additions & 4 deletions examples/SampleApp/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />

<queries>
<intent>
Expand All @@ -18,12 +19,19 @@
</intent>
</queries>

<application android:usesCleartextTraffic="true" android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="false" android:requestLegacyExternalStorage="true" android:networkSecurityConfig="@xml/network_security_config" android:theme="@style/AppTheme">
<activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode" android:screenOrientation="portrait" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:exported="true">
<application android:usesCleartextTraffic="true" android:name=".MainApplication"
android:label="@string/app_name" android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="false"
android:requestLegacyExternalStorage="true"
android:networkSecurityConfig="@xml/network_security_config" android:theme="@style/AppTheme">
<activity android:name=".MainActivity" android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
android:screenOrientation="portrait" android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
</manifest>
6 changes: 4 additions & 2 deletions examples/SampleApp/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import org.apache.tools.ant.taskdefs.condition.Os
buildscript {
ext {
buildToolsVersion = "34.0.0"
minSdkVersion = 21
// Added 24 for react-native-audio-recorder-player(Value - 24)
minSdkVersion = 24
compileSdkVersion = 34
targetSdkVersion = 34
ndkVersion = "25.1.8937393"
kotlinVersion = "1.8.0"
// Added for react-native-audio-recorder-player(Value - 1.6.10)
kotlinVersion = "1.6.10"
androidXCore = "1.0.2"
}
repositories {
Expand Down
6 changes: 6 additions & 0 deletions examples/SampleApp/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,8 @@ PODS:
- React-jsi (= 0.73.5)
- React-logger (= 0.73.5)
- React-perflogger (= 0.73.5)
- RNAudioRecorderPlayer (3.6.7):
- React-Core
- RNCAsyncStorage (1.22.2):
- React-Core
- RNCMaskedView (0.1.11):
Expand Down Expand Up @@ -1339,6 +1341,7 @@ DEPENDENCIES:
- React-runtimescheduler (from `../node_modules/react-native/ReactCommon/react/renderer/runtimescheduler`)
- React-utils (from `../node_modules/react-native/ReactCommon/react/utils`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- RNAudioRecorderPlayer (from `../node_modules/react-native-audio-recorder-player`)
- "RNCAsyncStorage (from `../node_modules/@react-native-async-storage/async-storage`)"
- "RNCMaskedView (from `../node_modules/@react-native-community/masked-view`)"
- RNFastImage (from `../node_modules/react-native-fast-image`)
Expand Down Expand Up @@ -1491,6 +1494,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/react/utils"
ReactCommon:
:path: "../node_modules/react-native/ReactCommon"
RNAudioRecorderPlayer:
:path: "../node_modules/react-native-audio-recorder-player"
RNCAsyncStorage:
:path: "../node_modules/@react-native-async-storage/async-storage"
RNCMaskedView:
Expand Down Expand Up @@ -1596,6 +1601,7 @@ SPEC CHECKSUMS:
React-runtimescheduler: ed71ec64a3e5cf509d74dfe9e25d72b04c84a3ad
React-utils: 74fc896195fb41a1f7dcd5737d89be59c1fdccc4
ReactCommon: ab6655d0224cf39c997ea634d257c609d345e23d
RNAudioRecorderPlayer: 9b34adc281800e5b19258f1b91d889b1ef3abdd6
RNCAsyncStorage: 014a78b2cc8cc107c9e92ee428dc0c1ac3223416
RNCMaskedView: 0e1bc4bfa8365eba5fbbb71e07fbdc0555249489
RNFastImage: 5c9c9fed9c076e521b3f509fe79e790418a544e8
Expand Down
12 changes: 12 additions & 0 deletions examples/SampleApp/ios/SampleApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,12 @@
" ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
);
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
LD_RUNPATH_SEARCH_PATHS = (
Expand Down Expand Up @@ -726,6 +732,12 @@
" ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
" ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers",
);
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
LD_RUNPATH_SEARCH_PATHS = (
Expand Down
1 change: 1 addition & 0 deletions examples/SampleApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@stream-io/flat-list-mvcp": "0.10.3",
"react": "18.2.0",
"react-native": "^0.73.0",
"react-native-audio-recorder-player": "^3.6.7",
"react-native-document-picker": "9.0.1",
"react-native-fast-image": "^8.6.3",
"react-native-fs": "^2.18.0",
Expand Down
1 change: 1 addition & 0 deletions examples/SampleApp/src/screens/ChannelScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export const ChannelScreen: React.FC<ChannelScreenProps> = ({
return (
<View style={[styles.flex, { backgroundColor: white, paddingBottom: bottom }]}>
<Channel
audioRecordingEnabled={true}
channel={channel}
disableTypingIndicator
enforceUniqueReaction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ export const NewDirectMessagingScreen: React.FC<NewDirectMessagingScreenProps> =
}
},
}}
audioRecordingEnabled={true}
channel={currentChannel.current}
EmptyStateIndicator={EmptyMessagesIndicator}
enforceUniqueReaction
Expand Down
1 change: 1 addition & 0 deletions examples/SampleApp/src/screens/ThreadScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export const ThreadScreen: React.FC<ThreadScreenProps> = ({
return (
<SafeAreaView style={[styles.container, { backgroundColor: white }]}>
<Channel<StreamChatGenerics>
audioRecordingEnabled={true}
channel={channel}
enforceUniqueReaction
keyboardVerticalOffset={0}
Expand Down
20 changes: 16 additions & 4 deletions examples/SampleApp/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3268,6 +3268,11 @@ domutils@^3.0.1:
domelementtype "^2.3.0"
domhandler "^5.0.3"

dooboolab-welcome@^1.3.2:
version "1.3.2"
resolved "https://registry.yarnpkg.com/dooboolab-welcome/-/dooboolab-welcome-1.3.2.tgz#4928595312f0429b4ea1b485ba8767bae6acdab7"
integrity sha512-2NbMaIIURElxEf/UAoVUFlXrO+7n/FRhLCiQlk4fkbGRh9cJ3/f8VEMPveR9m4Ug2l2Zey+UCXjd6EcBqHJ5bw==

ecdsa-sig-formatter@1.0.11:
version "1.0.11"
resolved "https://registry.yarnpkg.com/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz#ae0f0fa2d85045ef14a817daa3ce9acd0489e5bf"
Expand Down Expand Up @@ -6143,6 +6148,13 @@ react-is@^17.0.1:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0"
integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==

react-native-audio-recorder-player@^3.6.7:
version "3.6.7"
resolved "https://registry.yarnpkg.com/react-native-audio-recorder-player/-/react-native-audio-recorder-player-3.6.7.tgz#a80e95a5d14dae4e1aaa25b2a9819f85e7c04853"
integrity sha512-uv6lLNBuyr69NLwDYvoucT+BE675ys5fjHJy1Yjr5Rr1r4MTJks/+P9nAIV+MDZkqfasmLwSpvUEboFyXcCeeQ==
dependencies:
dooboolab-welcome "^1.3.2"

react-native-document-picker@9.0.1:
version "9.0.1"
resolved "https://registry.yarnpkg.com/react-native-document-picker/-/react-native-document-picker-9.0.1.tgz#a5ceec157f84dbadb85fe717c657569755f4c6ca"
Expand Down Expand Up @@ -6813,10 +6825,10 @@ statuses@~1.5.0:
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==

stream-chat-react-native-core@5.27.1:
version "5.27.1"
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-5.27.1.tgz#a748b30fb3b53c575cf1e4f7230ea26e7f994a7b"
integrity sha512-zHOt41uOfeo90iY/lAHU0VA9yxgjnBz94LejXeAT4RqYThuX0hR9rQ3LkQlg99mXlp9I6DzKdf/w/+PrxwQ6nQ==
stream-chat-react-native-core@5.28.1:
version "5.28.1"
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-5.28.1.tgz#9bde6c2af43a24e8a5c9d4ca35da19ccef95cb34"
integrity sha512-+vsLbqFmxm6Xyt4U3f2zfNvTTB9cXWTk8gyyw4b2RJ2qMZ/8wuN/luS5xwKdNbBZZCuaDlwuJpWE/x5/ERbpWg==
dependencies:
"@gorhom/bottom-sheet" "4.4.8"
dayjs "1.10.5"
Expand Down

0 comments on commit fa6817d

Please sign in to comment.