From a327a5d80460be11ff66f73f261be2e079df0c67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Tue, 4 Sep 2018 23:43:10 +0200 Subject: [PATCH] [RN] Drop the react-native-permissions dependency It causes false positives when submitting the app to the Store. Use the new permissions API in react-native-webrtc instead. --- ios/Podfile | 2 -- ios/Podfile.lock | 8 +------- package-lock.json | 4 ---- package.json | 1 - .../base/lib-jitsi-meet/native/polyfills-webrtc.js | 6 +++++- react/features/welcome/components/WelcomePage.native.js | 5 ++--- 6 files changed, 8 insertions(+), 18 deletions(-) diff --git a/ios/Podfile b/ios/Podfile index fb2199877..f05124501 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -35,8 +35,6 @@ target 'JitsiMeet' do pod 'react-native-locale-detector', :path => '../node_modules/react-native-locale-detector' pod 'react-native-webrtc', :path => '../node_modules/react-native-webrtc' - pod 'ReactNativePermissions', - :path => '../node_modules/react-native-permissions' pod 'RNSound', :path => '../node_modules/react-native-sound' pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons' pod 'react-native-calendar-events', diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 5c0e7e370..281cfed2b 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -63,8 +63,6 @@ PODS: - React/Core - React/fishhook - React/RCTBlob - - ReactNativePermissions (1.1.1): - - React - RNSound (0.10.9): - React/Core - RNSound/Core (= 0.10.9) @@ -98,7 +96,6 @@ DEPENDENCIES: - React/RCTNetwork (from `../node_modules/react-native`) - React/RCTText (from `../node_modules/react-native`) - React/RCTWebSocket (from `../node_modules/react-native`) - - ReactNativePermissions (from `../node_modules/react-native-permissions`) - RNSound (from `../node_modules/react-native-sound`) - RNVectorIcons (from `../node_modules/react-native-vector-icons`) - yoga (from `../node_modules/react-native/ReactCommon/yoga`) @@ -130,8 +127,6 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native-locale-detector" react-native-webrtc: :path: "../node_modules/react-native-webrtc" - ReactNativePermissions: - :path: "../node_modules/react-native-permissions" RNSound: :path: "../node_modules/react-native-sound" RNVectorIcons: @@ -152,12 +147,11 @@ SPEC CHECKSUMS: react-native-keep-awake: 0de4bd66de0c23178107dce0c2fcc3354b2a8e94 react-native-locale-detector: d1b2c6fe5abb56e3a1efb6c2d6f308c05c4251f1 react-native-webrtc: 31b6d3f1e3e2ce373aa43fd682b04367250f807d - ReactNativePermissions: 9ef3f0c74a373fdbfae21c067098a8348d9aa15f RNSound: b360b3862d3118ed1c74bb9825696b5957686ac4 RNVectorIcons: c0dbfbf6068fefa240c37b0f71bd03b45dddac44 SDWebImage: 624d6e296c69b244bcede364c72ae0430ac14681 yoga: a23273df0088bf7f2bb7e5d7b00044ea57a2a54a -PODFILE CHECKSUM: 1d5c8382f73d9540fac68d93b32e1d3b58d069ee +PODFILE CHECKSUM: 69d3df0b8baa54d636bd653b412ed45db771a3b6 COCOAPODS: 1.5.3 diff --git a/package-lock.json b/package-lock.json index 1a77a5473..858b28d0b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12785,10 +12785,6 @@ "version": "github:jitsi/react-native-locale-detector#845281e9fd4af756f6d0f64afe5cce08c63e5ee9", "from": "github:jitsi/react-native-locale-detector#845281e9fd4af756f6d0f64afe5cce08c63e5ee9" }, - "react-native-permissions": { - "version": "github:lyubomir/react-native-permissions#3462430addce3f2c8297c15da14182568194a216", - "from": "github:lyubomir/react-native-permissions#3462430addce3f2c8297c15da14182568194a216" - }, "react-native-prompt": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/react-native-prompt/-/react-native-prompt-1.0.0.tgz", diff --git a/package.json b/package.json index 71f54e389..a37b3177c 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,6 @@ "react-native-keep-awake": "2.0.6", "react-native-linear-gradient": "2.4.0", "react-native-locale-detector": "github:jitsi/react-native-locale-detector#845281e9fd4af756f6d0f64afe5cce08c63e5ee9", - "react-native-permissions": "github:lyubomir/react-native-permissions#3462430addce3f2c8297c15da14182568194a216", "react-native-prompt": "1.0.0", "react-native-sound": "0.10.9", "react-native-vector-icons": "4.4.2", diff --git a/react/features/base/lib-jitsi-meet/native/polyfills-webrtc.js b/react/features/base/lib-jitsi-meet/native/polyfills-webrtc.js index a990f8b77..705f048f4 100644 --- a/react/features/base/lib-jitsi-meet/native/polyfills-webrtc.js +++ b/react/features/base/lib-jitsi-meet/native/polyfills-webrtc.js @@ -3,7 +3,8 @@ import { MediaStreamTrack, RTCSessionDescription, RTCIceCandidate, - mediaDevices + mediaDevices, + permissions } from 'react-native-webrtc'; import RTCPeerConnection from './RTCPeerConnection'; @@ -34,6 +35,9 @@ import RTCPeerConnection from './RTCPeerConnection'; if (typeof navigator.mediaDevices === 'undefined') { navigator.mediaDevices = mediaDevices; } + if (typeof navigator.permissions === 'undefined') { + navigator.permissions = permissions; + } } })(global || window || this); // eslint-disable-line no-invalid-this diff --git a/react/features/welcome/components/WelcomePage.native.js b/react/features/welcome/components/WelcomePage.native.js index 700157690..b9afe2250 100644 --- a/react/features/welcome/components/WelcomePage.native.js +++ b/react/features/welcome/components/WelcomePage.native.js @@ -8,7 +8,6 @@ import { TouchableOpacity, View } from 'react-native'; -import Permissions from 'react-native-permissions'; import { connect } from 'react-redux'; import { translate } from '../../base/i18n'; @@ -76,8 +75,8 @@ class WelcomePage extends AbstractWelcomePage { // Make sure we don't request the permission for the camera from // the start. We will, however, create a video track iff the user // already granted the permission. - Permissions.check('camera').then(response => { - response === 'authorized' + navigator.permissions.query({ name: 'camera' }).then(response => { + response === 'granted' && dispatch(createDesiredLocalTracks(MEDIA_TYPE.VIDEO)); }); }