From fe99ea889a07240b3a2977215018163f6825df3c Mon Sep 17 00:00:00 2001
From: Gustavo Trott <gustavo@trott.com.br>
Date: Thu, 31 Jan 2019 15:17:03 -0200
Subject: [PATCH] Hide Mic and Camera buttons if userAgent contains bbbnative

---
 .../imports/ui/components/audio/audio-modal/component.jsx     | 3 ++-
 .../imports/ui/components/audio/audio-modal/container.jsx     | 1 +
 .../ui/components/video-provider/video-button/container.jsx   | 4 +++-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/bigbluebutton-html5/imports/ui/components/audio/audio-modal/component.jsx b/bigbluebutton-html5/imports/ui/components/audio/audio-modal/component.jsx
index 5bd10c2965..a4257875f9 100755
--- a/bigbluebutton-html5/imports/ui/components/audio/audio-modal/component.jsx
+++ b/bigbluebutton-html5/imports/ui/components/audio/audio-modal/component.jsx
@@ -265,13 +265,14 @@ class AudioModal extends Component {
       forceListenOnlyAttendee,
       skipCheck,
       audioLocked,
+      isMobileNative,
     } = this.props;
 
     const showMicrophone = forceListenOnlyAttendee || audioLocked;
 
     return (
       <span className={styles.audioOptions}>
-        {!showMicrophone
+        {!showMicrophone && !isMobileNative
           ? (
             <Button
               className={styles.audioBtn}
diff --git a/bigbluebutton-html5/imports/ui/components/audio/audio-modal/container.jsx b/bigbluebutton-html5/imports/ui/components/audio/audio-modal/container.jsx
index 0a4f97c786..ea3ab2f2cf 100755
--- a/bigbluebutton-html5/imports/ui/components/audio/audio-modal/container.jsx
+++ b/bigbluebutton-html5/imports/ui/components/audio/audio-modal/container.jsx
@@ -62,5 +62,6 @@ export default withModalMounter(withTracker(({ mountModal }) => {
     joinFullAudioEchoTest: !listenOnlyMode && !skipCheck,
     forceListenOnlyAttendee: listenOnlyMode && forceListenOnly && !Service.isUserModerator(),
     isIOSChrome: browser().name === 'crios',
+    isMobileNative: navigator.userAgent.toLowerCase().includes('bbbnative'),
   });
 })(AudioModalContainer));
diff --git a/bigbluebutton-html5/imports/ui/components/video-provider/video-button/container.jsx b/bigbluebutton-html5/imports/ui/components/video-provider/video-button/container.jsx
index b21d680e1f..a348f1fc48 100755
--- a/bigbluebutton-html5/imports/ui/components/video-provider/video-button/container.jsx
+++ b/bigbluebutton-html5/imports/ui/components/video-provider/video-button/container.jsx
@@ -15,12 +15,13 @@ const JoinVideoOptionsContainer = (props) => {
     baseName,
     intl,
     mountModal,
+    isMobileNative,
     ...restProps
   } = props;
 
   const mountPreview = () => { mountModal(<VideoPreviewContainer />); };
 
-  return <JoinVideoButton {...{ handleJoinVideo: mountPreview, handleCloseVideo, isSharingVideo, isDisabled, ...restProps }} />;
+  return !isMobileNative && <JoinVideoButton {...{ handleJoinVideo: mountPreview, handleCloseVideo, isSharingVideo, isDisabled, ...restProps }} />;
 };
 
 export default withModalMounter(injectIntl(withTracker(() => ({
@@ -28,4 +29,5 @@ export default withModalMounter(injectIntl(withTracker(() => ({
   isSharingVideo: VideoButtonService.isSharingVideo(),
   isDisabled: VideoButtonService.isDisabled(),
   videoShareAllowed: VideoButtonService.videoShareAllowed(),
+  isMobileNative: navigator.userAgent.toLowerCase().includes('bbbnative'),
 }))(JoinVideoOptionsContainer)));
-- 
GitLab