using in call manager to adjust phone during call

This commit is contained in:
Roland Osborne 2023-04-12 13:52:40 -07:00
parent 3efe2f75ab
commit adbb07da30
6 changed files with 34 additions and 6 deletions

View File

@ -516,7 +516,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.10;
MARKETING_VERSION = 1.11;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
@ -549,7 +549,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.10;
MARKETING_VERSION = 1.11;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
@ -571,7 +571,7 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@ -643,7 +643,7 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;

View File

@ -427,6 +427,8 @@ PODS:
- React-jsi (= 0.71.3)
- React-logger (= 0.71.3)
- React-perflogger (= 0.71.3)
- ReactNativeIncallManager (4.0.1):
- React-Core
- RNCClipboard (1.11.1):
- React-Core
- RNDeviceInfo (10.4.0):
@ -528,6 +530,7 @@ DEPENDENCIES:
- React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
- React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- ReactNativeIncallManager (from `../node_modules/react-native-incall-manager`)
- "RNCClipboard (from `../node_modules/@react-native-clipboard/clipboard`)"
- RNDeviceInfo (from `../node_modules/react-native-device-info`)
- "RNFBApp (from `../node_modules/@react-native-firebase/app`)"
@ -637,6 +640,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/runtimeexecutor"
ReactCommon:
:path: "../node_modules/react-native/ReactCommon"
ReactNativeIncallManager:
:path: "../node_modules/react-native-incall-manager"
RNCClipboard:
:path: "../node_modules/@react-native-clipboard/clipboard"
RNDeviceInfo:
@ -712,6 +717,7 @@ SPEC CHECKSUMS:
React-RCTVibration: 5199a180d04873366a83855de55ac33ce60fe4d5
React-runtimeexecutor: 7bf0dafc7b727d93c8cb94eb00a9d3753c446c3e
ReactCommon: 5f9a24e64c1c3e2b719014f07cb2acf628983000
ReactNativeIncallManager: 0d2cf9f4d50359728a30c08549762fe67a2efb81
RNCClipboard: 2834e1c4af68697089cdd455ee4a4cdd198fa7dd
RNDeviceInfo: 749f2e049dcd79e2e44f134f66b73a06951b5066
RNFBApp: 4f8ea53443d52c7db793234d2398a357fc6cfbf1

View File

@ -31,6 +31,7 @@
"react-native-document-picker": "^8.1.3",
"react-native-gesture-handler": "^2.9.0",
"react-native-image-crop-picker": "^0.39.0",
"react-native-incall-manager": "^4.0.1",
"react-native-reanimated": "^2.14.4",
"react-native-reanimated-carousel": "^3.3.0",
"react-native-rsa-native": "^2.0.5",

View File

@ -6,6 +6,7 @@ import { addCall } from 'api/addCall';
import { keepCall } from 'api/keepCall';
import { removeCall } from 'api/removeCall';
import { removeContactCall } from 'api/removeContactCall';
import InCallManager from 'react-native-incall-manager';
import {
ScreenCapturePickerView,
@ -203,6 +204,7 @@ export function useRingContext() {
}
if (event.track.kind === 'video') {
updateState({ remoteVideo: true });
InCallManager.setForceSpeakerphoneOn(true);
}
stream.current.addTrack(event.track, stream.current);
} );
@ -252,6 +254,7 @@ export function useRingContext() {
updateState({ callStatus: "connected" });
if (policy === 'polite') {
connected.current = true;
InCallManager.start({media: 'audio'});
transmit('polite');
polite();
}
@ -289,6 +292,8 @@ export function useRingContext() {
}
clearRing();
clearAlive();
InCallManager.stop();
connected.current = false;
calling.current = null;
if (videoTrack.current) {
videoTrack.current.stop();
@ -304,6 +309,7 @@ export function useRingContext() {
ws.current.send(JSON.stringify({ AppToken: token }));
if (policy === 'impolite') {
connected.current = true;
InCallManager.start({media: 'audio'});
transmit('impolite');
impolite();
}
@ -454,7 +460,9 @@ export function useRingContext() {
if (track.kind === 'video') {
videoTrack.current = track;
pc.current.addTrack(track, stream);
updateState({ localVideo: true });
const localStream = new MediaStream();
localStream.addTrack(track, localStream);
updateState({ localVideo: true, localStream });
}
}
}

View File

@ -1,4 +1,4 @@
import { View, ScrollView, TouchableOpacity, StatusBar, Text, Image, Modal } from 'react-native';
import { Alert, View, ScrollView, TouchableOpacity, StatusBar, Text, Image, Modal } from 'react-native';
import { useState, useEffect, useContext } from 'react';
import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
@ -25,6 +25,7 @@ import { ProfileIcon } from './profileIcon/ProfileIcon';
import { CardsIcon } from './cardsIcon/CardsIcon';
import { Logo } from 'utils/Logo';
import { Call } from './call/Call';
import { DeviceEventEmitter } from 'react-native';
import splash from 'images/session.png';
const ConversationStack = createStackNavigator();
@ -326,6 +327,13 @@ export function Session() {
setDmChannel({ id });
};
useEffect(() => {
const listener = DeviceEventEmitter.addListener('Proximity', function (data) {
Alert.alert("proximity");
});
return () => { listener.remove() }
}, []);
useEffect(() => {
let incoming = [];
for (let i = 0; i < state.ringing.length; i++) {

View File

@ -6326,6 +6326,11 @@ react-native-image-crop-picker@^0.39.0:
resolved "https://registry.yarnpkg.com/react-native-image-crop-picker/-/react-native-image-crop-picker-0.39.0.tgz#9cb8e8ffb0e8ab06f7b3227cadf077169e225eba"
integrity sha512-4aANbQMrmU6zN/4b0rVBA7SbaZ3aa5JESm3Xk751sINybZMt1yz/9h95LkO7U0pbslHDo3ofXjG75PmQRP6a/w==
react-native-incall-manager@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/react-native-incall-manager/-/react-native-incall-manager-4.0.1.tgz#7dae419433383ed31262d811fd549bba7951b2f2"
integrity sha512-Bqq7C+p7vCmCTpM8Xv6l4DJ3UJYzVr60IvkHMw1Ugs0KJswh3veBJrpk+hUPSETPT6J/5oUwxChXlNsymsh7fg==
react-native-reanimated-carousel@^3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/react-native-reanimated-carousel/-/react-native-reanimated-carousel-3.3.0.tgz#e71e9441ee6aaae401c5a023b27bf48a54565d16"