diff --git a/RNCallKeep.podspec b/RNCallKeep.podspec index 821d4a50..be08dc18 100644 --- a/RNCallKeep.podspec +++ b/RNCallKeep.podspec @@ -13,6 +13,6 @@ Pod::Spec.new do |s| s.requires_arc = true s.platform = :ios, "8.0" s.source_files = "ios/RNCallKeep/*.{h,m}" - s.dependency 'React/Core' + s.dependency 'React-Core' end diff --git a/android/src/main/java/io/wazo/callkeep/RNCallKeepModule.java b/android/src/main/java/io/wazo/callkeep/RNCallKeepModule.java index 15b9cce2..aa905b34 100644 --- a/android/src/main/java/io/wazo/callkeep/RNCallKeepModule.java +++ b/android/src/main/java/io/wazo/callkeep/RNCallKeepModule.java @@ -214,7 +214,7 @@ public void endAllCalls() { @ReactMethod public void checkPhoneAccountPermission(ReadableArray optionalPermissions, Promise promise) { - Activity currentActivity = this.getCurrentActivity(); + Activity currentActivity = getCurrentActivity(); if (!isConnectionServiceAvailable()) { promise.reject(E_ACTIVITY_DOES_NOT_EXIST, "ConnectionService not available for this version of Android."); @@ -464,7 +464,7 @@ private String getApplicationName(Context appContext) { } private Boolean hasPermissions() { - Activity currentActivity = this.getCurrentActivity(); + Activity currentActivity = getCurrentActivity(); boolean hasPermissions = true; for (String permission : permissions) { diff --git a/example/package.json b/example/package.json index e3263218..a2c39148 100644 --- a/example/package.json +++ b/example/package.json @@ -14,7 +14,7 @@ "react-native-callkeep": "https://github.com/react-native-webrtc/react-native-callkeep#fix_outgoing_call_ios", "react-native-device-info": "^2.3.2", "react-native-gesture-handler": "~1.3.0", - "react-native-reanimated": "~1.1.0", + "react-native-reanimated": "~1.13.4", "react-native-unimodules": "~0.5.2", "react-native-web": "^0.11.4", "uuid": "^3.3.2" diff --git a/example/yarn.lock b/example/yarn.lock index db370bdb..a7d34fcd 100644 --- a/example/yarn.lock +++ b/example/yarn.lock @@ -4150,10 +4150,12 @@ react-native-gesture-handler@~1.3.0: invariant "^2.2.2" prop-types "^15.5.10" -react-native-reanimated@~1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/react-native-reanimated/-/react-native-reanimated-1.1.0.tgz#ba6864055ec3a206cdd5209a293fe653ce276206" - integrity sha512-UGDVNfvuIkMqYUx6aytSzihuzv6sWubn0MQi8dRcw7BjgezhjJnVnJ/NSOcpL3cO+Ld7lFcRX6GKcskwkHdPkw== +react-native-reanimated@~1.13.4: + version "1.13.4" + resolved "https://registry.yarnpkg.com/react-native-reanimated/-/react-native-reanimated-1.13.4.tgz#f57c65e80ab5d2f60bf7dd21716c0bad8108b84e" + integrity sha512-sFbZFh0WanKTa0Fz7GXCZUjWpk/u04ytprcIs4Kb+ijfQHChXva3m3yQZfvbrhRbABJNHrdeuyDgJxDM2mcBgw== + dependencies: + fbjs "^1.0.0" react-native-unimodules@~0.5.2: version "0.5.2" diff --git a/index.d.ts b/index.d.ts index 65a19e94..f735ddb4 100644 --- a/index.d.ts +++ b/index.d.ts @@ -55,6 +55,10 @@ export default class RNCallKeep { } + static async hasRequiredPermissions(options: IOptions): Promise { + + } + static displayIncomingCall( uuid: string, handle: string, @@ -159,6 +163,10 @@ export default class RNCallKeep { } + static checkPhoneAccountPermission(): Promise { + + } + /** * @description setAvailable method is available only on Android. */ diff --git a/index.js b/index.js index f4613c2d..03eb5740 100644 --- a/index.js +++ b/index.js @@ -43,6 +43,14 @@ class RNCallKeep { return; }; + + hasRequiredPermissions = async (options) => { + if(isIOS) { + return true; + } + RNCallKeepModule.setup(options); + return await this.hasPhoneAccount(); + } displayIncomingCall = (uuid, handle, localizedCallerName, handleType = 'number', hasVideo = false) => { if (!isIOS) { @@ -124,6 +132,9 @@ class RNCallKeep { ? RNCallKeepModule.checkSpeaker() : Promise.reject('RNCallKeep.checkSpeaker was called from unsupported OS'); + + checkPhoneAccountPermission = async (options) => await RNCallKeepModule.checkPhoneAccountPermission(options.additionalPermissions || []); + setAvailable = (state) => { if (isIOS) { return; diff --git a/ios/RNCallKeep/RNCallKeep.m b/ios/RNCallKeep/RNCallKeep.m index 02432a33..d0142e5a 100644 --- a/ios/RNCallKeep/RNCallKeep.m +++ b/ios/RNCallKeep/RNCallKeep.m @@ -466,8 +466,15 @@ + (BOOL)application:(UIApplication *)application // iOS 13 returns an INStartCallIntent userActivity type if (@available(iOS 13, *)) { INStartCallIntent *intent = (INStartCallIntent*)interaction.intent; - isAudioCall = intent.callCapability == INCallCapabilityAudioCall; - isVideoCall = intent.callCapability == INCallCapabilityVideoCall; + // isAudioCall = intent.callCapability == INCallCapabilityAudioCall; + // isVideoCall = intent.callCapability == INCallCapabilityVideoCall; + if ([intent respondsToSelector:@selector(callCapability)]) { + isAudioCall = intent.callCapability == INCallCapabilityAudioCall; + isVideoCall = intent.callCapability == INCallCapabilityVideoCall; + } else { + isAudioCall = [userActivity.activityType isEqualToString:INStartAudioCallIntentIdentifier]; + isVideoCall = [userActivity.activityType isEqualToString:INStartVideoCallIntentIdentifier]; + } } else { isAudioCall = [userActivity.activityType isEqualToString:INStartAudioCallIntentIdentifier]; isVideoCall = [userActivity.activityType isEqualToString:INStartVideoCallIntentIdentifier]; @@ -566,7 +573,7 @@ - (void)provider:(CXProvider *)provider performAnswerCallAction:(CXAnswerCallAct NSLog(@"[RNCallKeep][CXProviderDelegate][provider:performAnswerCallAction]"); #endif [self configureAudioSession]; - [self sendEventWithName:RNCallKeepPerformAnswerCallAction body:@{ @"callUUID": [action.callUUID.UUIDString lowercaseString] }]; + [self sendEventWithName:RNCallKeepPerformAnswerCallAction body:@{ @"callUUID": [action.callUUID.UUIDString lowercaseString], @"isLocked": [[UIApplication sharedApplication] isProtectedDataAvailable] ? @"false" : @"true" }]; [action fulfill]; }