Skip to content

Commit

Permalink
setup react native callkeep
Browse files Browse the repository at this point in the history
  • Loading branch information
aldhosutra committed Aug 27, 2022
1 parent b99a3f8 commit 3e3aebb
Show file tree
Hide file tree
Showing 8 changed files with 290 additions and 9 deletions.
17 changes: 17 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.BIND_TELECOM_CONNECTION_SERVICE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />

<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.front" android:required="false" />
Expand Down Expand Up @@ -64,6 +67,20 @@

<service android:name="com.asterinet.react.bgactions.RNBackgroundActionsTask" />

<service android:name="io.wazo.callkeep.RNCallKeepBackgroundMessagingService" />

<service
android:exported="true"
android:name="io.wazo.callkeep.VoiceConnectionService"
android:label="Wazo"
android:permission="android.permission.BIND_TELECOM_CONNECTION_SERVICE"
android:foregroundServiceType="camera|microphone">
<!-- NOTE: 👆 for android < 11 use:android:foregroundServiceType="phoneCall" (https://github.com/react-native-webrtc/react-native-callkeep/blob/master/docs/android-installation.md) -->
<intent-filter>
<action android:name="android.telecom.ConnectionService" />
</intent-filter>
</service>

</application>

<queries>
Expand Down
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,9 @@ function HeadlessCheck({ isHeadless }) {
return <App />;
}

AppRegistry.registerHeadlessTask('RNCallKeepBackgroundMessage', () => ({ name, callUUID, handle }) => {
// TODO: Make your call here
return Promise.resolve();
});

AppRegistry.registerComponent(appName, () => HeadlessCheck);
238 changes: 238 additions & 0 deletions ios/Enevti.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

18 changes: 13 additions & 5 deletions ios/Enevti/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#import <React/RCTLinkingManager.h>
#import "RNSplashScreen.h"
#import <Firebase.h>
#import "RNCallKeep.h"

#ifdef FB_SONARKIT_ENABLED
#import <FlipperKit/FlipperClient.h>
Expand Down Expand Up @@ -76,12 +77,19 @@ - (BOOL)application:(UIApplication *)application
return [RCTLinkingManager application:application openURL:url options:options];
}

- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity
restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler
- (BOOL)application:(UIApplication *)application
continueUserActivity:(nonnull NSUserActivity *)userActivity
restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler
{
return [RCTLinkingManager application:application
continueUserActivity:userActivity
restorationHandler:restorationHandler];
BOOL handledCK = [RNCallKeep application:application
continueUserActivity:userActivity
restorationHandler:restorationHandler];

BOOL handledLM = [RCTLinkingManager application:application
continueUserActivity:userActivity
restorationHandler:restorationHandler];

return handledCK || handledLM;
}

@end
9 changes: 5 additions & 4 deletions ios/Enevti/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
Expand Down Expand Up @@ -104,6 +108,7 @@
<string>fetch</string>
<string>processing</string>
<string>remote-notification</string>
<string>voip</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
Expand All @@ -117,9 +122,5 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
</array>
</dict>
</plist>
6 changes: 6 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,8 @@ PODS:
- React-perflogger (= 0.66.4)
- RNCalendarEvents (2.2.0):
- React
- RNCallKeep (4.3.3):
- React
- RNCAsyncStorage (1.15.15):
- React-Core
- RNCClipboard (1.8.5):
Expand Down Expand Up @@ -717,6 +719,7 @@ DEPENDENCIES:
- React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- RNCalendarEvents (from `../node_modules/react-native-calendar-events`)
- RNCallKeep (from `../node_modules/react-native-callkeep`)
- "RNCAsyncStorage (from `../node_modules/@react-native-async-storage/async-storage`)"
- "RNCClipboard (from `../node_modules/@react-native-clipboard/clipboard`)"
- "RNCMaskedView (from `../node_modules/@react-native-masked-view/masked-view`)"
Expand Down Expand Up @@ -883,6 +886,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon"
RNCalendarEvents:
:path: "../node_modules/react-native-calendar-events"
RNCallKeep:
:path: "../node_modules/react-native-callkeep"
RNCAsyncStorage:
:path: "../node_modules/@react-native-async-storage/async-storage"
RNCClipboard:
Expand Down Expand Up @@ -1019,6 +1024,7 @@ SPEC CHECKSUMS:
React-runtimeexecutor: dec32ee6f2e2a26e13e58152271535fadff5455a
ReactCommon: 57b69f6383eafcbd7da625bfa6003810332313c4
RNCalendarEvents: 99a07d9a74a62b5b423d8c9df04dc0b8f8b94faf
RNCallKeep: fff3a0edab4c710de5e7c12d78dc71b06d78c8a4
RNCAsyncStorage: 69b1e4d51107f5f0847d086c23513465869d046e
RNCClipboard: 471860adba60079ac22058c663c91b3a875a7609
RNCMaskedView: d367b2a8df3992114e31b32b091a0c00dc800827
Expand Down
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"react-native-bg-thread": "^1.2.0",
"react-native-blob-util": "^0.14.0",
"react-native-calendar-events": "^2.2.0",
"react-native-callkeep": "^4.3.3",
"react-native-circular-progress-indicator": "^3.2.0",
"react-native-config": "^1.4.5",
"react-native-controlled-mentions": "^2.2.5",
Expand Down

0 comments on commit 3e3aebb

Please sign in to comment.