carenation-react-native-component
v4.7.2
Published
React native component for Carenation patient app
Readme
Carenation React Native Custom Component
Dependencies
- https://www.npmjs.com/package/react-native-webview
- https://www.npmjs.com/package/@react-native-firebase/messaging
- https://www.npmjs.com/package/@notifee/react-native
- https://www.npmjs.com/package/react-native-sound-player
- https://www.npmjs.com/package/react-native-volume-manager
- https://www.npmjs.com/package/react-native-incall-manager
- https://www.npmjs.com/package/react-native-fs
- https://www.npmjs.com/package/react-native-file-viewer
- https://www.npmjs.com/package/react-native-toast-message
- https://www.npmjs.com/package/@notifee/react-native
Installation
To use the Carenation React Native Custom Component in your project, follow these steps:
- Install the component package using npm:
npm install carenation-react-native-componentUsage
Import Carenation components
import { Carenation, CarenationAiRinger } from 'carenation-react-native-component';Component usage
<SafeAreaView >
//hierarchy of this component should be higher so it can appear on all screens
<View style={{height: '100%', width: '100%', zIndex: 2}}>
<CarenationAiRinger
onAccept={handleAccept}
onDecline={handleDecline}
onMissed={handleMissed}
/>
</View>
<View style={{ flex: 1 }}>
<Carenation
ref={carenationCompRef}
apiKey="your_api_key"
identifier="your_identifier"
notificationData="your_notificationData"
setNotificationData={setNotificationData}
triggerAiCheckin={triggerAiCheckin}
domain={domain}
appointmentCallId={appointmentCallId}
OnResetAppointmentCallId={resetAppointmentCallId}
/>
</View>
</SafeAreaView>Things to add in app
A SampleApp.js is included in the repo to understand the component implementation
Props
Carenation
apiKey (string, required): Your API key for authentication.
identifier (string, required): The identifier for the user or session.
notificationData (optional): Data to be injected into the WebView.
setNotificationData (function, required): Function to update notification data.
domain (string, optional): The domain of the web application.
triggerAiCheckin (Boolean, required): Determine careanation called from notification.
appPath (string, optional): The path to the specific application.
appointmentCallId (string, required): To get appointment call ID from Provider, Trainer or Nutritionist Calls
OnResetAppointmentCallId (function, required): Handle resetting appointment call ID.
CarenationAiRinger
onAccept (function, required): Handle call accepted event.
onDecline (function, required): Handle call declined event.
onMissed (function, required): Returns a event with message is check-in is missed.
Handling Errors
The Carenation component logs errors encountered by the WebView to the console for debugging purposes.
Refs
Carenation
- carenationCompRef (required): Used Handle call mechanism for Carenation component.
Assets
Copy the ringtone.wav file into the project to use it as the notification tone.
Andriod path
android/app/src/main/res/raw/ringtone.wav
IOS path
ios/Resources/ringtone.wav
Permissions
Android
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-feature android:name="android.hardware.audio.output" />
<uses-feature android:name="android.hardware.microphone" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />IOS
info.plist
<key>NSCameraUsageDescription</key>
<string>App required camera access</string>
<key>NSMicrophoneUsageDescription</key>
<string>App required microphone access</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>App requires Speech Recognition access</string>Podfile
setup_permissions([
'Camera',
'Microphone'
])To force play audio in speakers add this code in AppDelegate.m
#import <AVFoundation/AVFoundation.h>
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
[[AVAudioSession sharedInstance] setActive:YES error:nil];License
Teslon Technologies Pvt. Ltd. (the "Company") Proprietary License
License Grant: The Company grants you a non-exclusive, non-transferable, revocable license to use the software provided in this package solely for your internal business purposes.
Restrictions: You may not distribute, sublicense, or transfer the software to any third party without the prior written consent of the Company. You may not reverse engineer, decompile, disassemble, or attempt to derive the source code of the software.
No Warranty: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
