From 4aec8615b90f15a66bf24b73fb3764d67cef3207 Mon Sep 17 00:00:00 2001 From: APPLE Date: Tue, 29 Sep 2020 19:35:16 +0530 Subject: [PATCH 1/3] electron fix: regenerator runtime --- webpack.commons.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/webpack.commons.js b/webpack.commons.js index 212230937..967d9169d 100644 --- a/webpack.commons.js +++ b/webpack.commons.js @@ -17,9 +17,10 @@ module.exports = { new HtmlWebpackPlugin({ template: isElectron ? 'electron/index.html' : 'web/index.html', }), - isDevelopment && new ReactRefreshWebpackPlugin({ - overlay: false, - }), + isDevelopment && + new ReactRefreshWebpackPlugin({ + overlay: false, + }), ].filter(Boolean), resolve: { alias: { @@ -72,7 +73,14 @@ module.exports = { isTSX: true, }, ], - '@babel/preset-env', // smartly transforms js into es5-es6 + [ + '@babel/preset-env', // smartly transforms js into es5-es6 + isElectron && { + targets: { + node: 'current', + }, + }, + ].filter(Boolean), ], plugins: [ // Adds support for class properties From c12d0ef50aa0833523677e9e00003f7a5fe85bac Mon Sep 17 00:00:00 2001 From: Ekaansh Arora Date: Wed, 30 Sep 2020 01:38:00 +0530 Subject: [PATCH 2/3] minor changes share change logo tint removed go back text precall icon bg removal add error handling to precall native add platform variable for electron --- src/components/ParticipantsView.tsx | 30 ++++++----- src/components/Precall.native.tsx | 48 ++++++++++++++++- src/components/Precall.tsx | 4 +- src/components/Share.tsx | 75 +++++++++++++++++--------- src/components/styles.ts | 8 ++- src/pages/Create.tsx | 10 ++-- src/pages/Join.tsx | 2 +- src/subComponents/Logo.tsx | 5 +- src/subComponents/LogoutButton.tsx | 13 ++--- src/subComponents/Platform.electron.ts | 2 + src/subComponents/Platform.native.ts | 2 + src/subComponents/Platform.ts | 2 + 12 files changed, 137 insertions(+), 64 deletions(-) create mode 100644 src/subComponents/Platform.electron.ts create mode 100644 src/subComponents/Platform.native.ts create mode 100644 src/subComponents/Platform.ts diff --git a/src/components/ParticipantsView.tsx b/src/components/ParticipantsView.tsx index 470e3cb9f..4299df352 100644 --- a/src/components/ParticipantsView.tsx +++ b/src/components/ParticipantsView.tsx @@ -21,6 +21,7 @@ import ColorContext from '../components/ColorContext'; import {useParams} from './Router'; import {gql, useQuery} from '@apollo/client'; import icons from '../assets/icons'; +import platform from '../subComponents/Platform'; const SHARE = gql` query share($passphrase: String!) { @@ -47,21 +48,26 @@ const ParticipantView = (props: any) => { variables: {passphrase: phrase}, }); const copyToClipboard = () => { - console.log(data, loading, error); if (data && !loading) { - console.log(data.share); - Clipboard.setString( - data.share.pstn - ? `Meeting - ${data.share.title} + let stringToCopy = ''; + $config.frontEndURL + ? (stringToCopy += `Meeting - ${data.share.title} URL for Attendee: ${$config.frontEndURL}/${data.share.passphrase.view} -URL for Host: ${$config.frontEndURL}/${data.share.passphrase.host} +URL for Host: ${$config.frontEndURL}/${data.share.passphrase.host}`) + : platform === 'web' + ? (stringToCopy += `Meeting - ${data.share.title} +URL for Attendee: ${window.location.origin}/${data.share.passphrase.view} +URL for Host: ${window.location.origin}/${data.share.passphrase.host}`) + : (stringToCopy += `Meeting - ${data.share.title} +Attendee Meeting ID: ${data.share.passphrase.view} +Host Meeting ID: ${data.share.passphrase.host}`); -PSTN Number: ${data.share.pstn.number} -PSTN Pin: ${data.share.pstn.dtmf}` - : `Meeting - ${data.share.title} -URL for Attendee: ${$config.frontEndURL}/${data.share.passphrase.view} -URL for Host: ${$config.frontEndURL}/${data.share.passphrase.host}`, - ); + data.share.pstn + ? (stringToCopy += `PSTN Number: ${data.share.pstn.number} +PSTN Pin: ${data.share.pstn.dtmf}`) + : ''; + console.log(stringToCopy); + Clipboard.setString(stringToCopy); } }; diff --git a/src/components/Precall.native.tsx b/src/components/Precall.native.tsx index a3fda9d31..b2611923b 100644 --- a/src/components/Precall.native.tsx +++ b/src/components/Precall.native.tsx @@ -17,13 +17,15 @@ import { import LocalUserContext from '../../agora-rn-uikit/src/LocalUserContext'; import RtcContext from '../../agora-rn-uikit/src/RtcContext'; import ColorContext from '../components/ColorContext'; +import {useHistory} from './Router'; const Precall = (props: any) => { + const history = useHistory(); const {primaryColor} = useContext(ColorContext); const maxUsers = useContext(MaxUidContext); const rtc = useContext(RtcContext); rtc.RtcEngine.startPreview(); - const {setCallActive, queryComplete, username, setUsername} = props; + const {setCallActive, queryComplete, username, setUsername, error} = props; return ( { Precall + {error ? ( + + + + {error.name + ' - '} + + {error.message} + + history.replace('./')}> + + {'Go back '} + + + + ) : ( + <> + )} diff --git a/src/components/Precall.tsx b/src/components/Precall.tsx index 7890f177f..e73651b7a 100644 --- a/src/components/Precall.tsx +++ b/src/components/Precall.tsx @@ -77,14 +77,14 @@ const Precall = (props: any) => { textAlign: 'center', textDecorationLine: 'underline', }}> - Try Again + Go back ) : ( <> )} - + {/* */} diff --git a/src/components/Share.tsx b/src/components/Share.tsx index a30f2d201..5b5afea89 100644 --- a/src/components/Share.tsx +++ b/src/components/Share.tsx @@ -10,7 +10,7 @@ import ColorContext from '../components/ColorContext'; import {useHistory} from './Router'; import Clipboard from '../subComponents/Clipboard'; import Illustration from '../subComponents/Illustration'; - +import platform from '../subComponents/Platform'; const Share = (props: any) => { const history = useHistory(); const { @@ -30,27 +30,34 @@ const Share = (props: any) => { }; const copyToClipboard = () => { - Clipboard.setString( - pstn - ? hostControlCheckbox - ? `Meeting - ${roomTitle} -URL for Attendee: ${urlView} -URL for Host: ${urlHost} + let stringToCopy = ''; -PSTN Number: ${pstn.number} -PSTN Pin: ${pstn.dtmf}` - : `Meeting - ${roomTitle} -Meeting URL: ${urlHost} + $config.frontEndURL + ? hostControlCheckbox + ? (stringToCopy += `Meeting - ${roomTitle} +URL for Attendee: ${$config.frontEndURL}/${urlView} +URL for Host: ${$config.frontEndURL}/${urlHost}`) + : (stringToCopy += `Meeting - ${roomTitle} +Meeting URL: ${$config.frontEndURL}/${urlHost}`) + : platform === 'web' + ? hostControlCheckbox + ? (stringToCopy += `Meeting - ${roomTitle} +URL for Attendee: ${window.location.origin}/${urlView} +URL for Host: ${window.location.origin}/${urlHost}`) + : (stringToCopy += `Meeting - ${roomTitle} +Meeting URL: ${window.location.origin}/${urlHost}`) + : hostControlCheckbox + ? (stringToCopy += `Meeting - ${roomTitle} +Attendee Meeting ID: ${urlView} +Host Meeting ID: ${urlHost}`) + : (stringToCopy += `Meeting - ${roomTitle} +Meeting URL: ${urlHost}`); -PSTN Number: ${pstn.number} -PSTN Pin: ${pstn.dtmf}` - : hostControlCheckbox - ? `Meeting - ${roomTitle} -URL for Attendee: ${urlView} -URL for Host: ${urlHost}` - : `Meeting - ${roomTitle} -Meeting URL: ${urlHost}`, - ); + pstn + ? (stringToCopy += `PSTN Number: ${pstn.number} +PSTN Pin: ${pstn.dtmf}`) + : ''; + Clipboard.setString(stringToCopy); }; const [dim, setDim] = useState([ @@ -68,19 +75,39 @@ Meeting URL: ${urlHost}`, Meeting Created {hostControlCheckbox ? ( <> - URL for Attendee: + + {!$config.frontEndURL && platform !== 'web' + ? 'Attendee Meeting ID:' + : 'URL for Attendee:'} + - {urlView} + + {$config.frontEndURL + ? `${$config.frontEndURL}/${urlView}` + : platform === 'web' + ? `${window.location.origin}/${urlView}` + : urlView} + ) : ( <> )} - {hostControlCheckbox ? 'URL for Host:' : 'Meeting URL'} + {hostControlCheckbox + ? !$config.frontEndURL && platform !== 'web' + ? 'Host Meeting ID:' + : 'URL for Host:' + : 'Meeting URL'} - {urlHost} + + {$config.frontEndURL + ? `${$config.frontEndURL}/${urlHost}` + : platform === 'web' + ? `${window.location.origin}/${urlHost}` + : urlHost} + {pstn ? ( diff --git a/src/components/styles.ts b/src/components/styles.ts index fa50eac0d..f59fac1c0 100644 --- a/src/components/styles.ts +++ b/src/components/styles.ts @@ -1,6 +1,4 @@ -import {Platform, Dimensions} from 'react-native'; - -const {width} = Dimensions.get('window'); +import {Platform} from 'react-native'; const styles = { temp: { @@ -19,7 +17,7 @@ const styles = { bottom: 0, }, localButton: { - backgroundColor: '#fff', + backgroundColor: '#ffffff00', borderRadius: 2, borderColor: $config.primaryColor, borderWidth: 0, @@ -31,7 +29,7 @@ const styles = { justifyContent: 'center', }, endCall: { - backgroundColor: '#fff', + backgroundColor: '#ffffff00', borderRadius: 2, borderColor: $config.primaryColor, borderWidth: 0, diff --git a/src/pages/Create.tsx b/src/pages/Create.tsx index 2cffe0466..015bdceb3 100644 --- a/src/pages/Create.tsx +++ b/src/pages/Create.tsx @@ -64,12 +64,8 @@ const Create = () => { }) .then((res: any) => { console.log('promise data', res); - setUrlView( - `${$config.frontEndURL}/${res.data.createChannel.passphrase.view}`, - ); - setUrlHost( - `${$config.frontEndURL}/${res.data.createChannel.passphrase.host}`, - ); + setUrlView(res.data.createChannel.passphrase.view); + setUrlHost(res.data.createChannel.passphrase.host); setPstn(res.data.createChannel.pstn); setJoinPhrase(res.data.createChannel.passphrase.host); // setPstnPin(res.data.createChannel.pstn.) @@ -126,7 +122,7 @@ const Create = () => { ) : ( <> )} - + {/* */} {!roomCreated ? ( diff --git a/src/pages/Join.tsx b/src/pages/Join.tsx index d86244b5a..05862d60d 100644 --- a/src/pages/Join.tsx +++ b/src/pages/Join.tsx @@ -84,7 +84,7 @@ const Join = (props: joinProps) => { ) : ( <> )} - + {/* */} diff --git a/src/subComponents/Logo.tsx b/src/subComponents/Logo.tsx index fd0bc062d..d7cb9e938 100644 --- a/src/subComponents/Logo.tsx +++ b/src/subComponents/Logo.tsx @@ -1,11 +1,9 @@ -import React, { useContext } from 'react'; +import React from 'react'; import {Image, TouchableOpacity} from 'react-native'; import {useHistory} from '../components/Router'; -import colorContext from '../components/ColorContext'; export default function Logo() { const history = useHistory(); - const {primaryColor} = useContext(colorContext); return ( history.replace('/')}> @@ -14,7 +12,6 @@ export default function Logo() { style={{ width: 90, height: 30, - tintColor: primaryColor, }} resizeMode="contain" /> diff --git a/src/subComponents/LogoutButton.tsx b/src/subComponents/LogoutButton.tsx index 6b6cfb74a..f075ddd01 100644 --- a/src/subComponents/LogoutButton.tsx +++ b/src/subComponents/LogoutButton.tsx @@ -18,14 +18,11 @@ const LogoutButton = (props: any) => { const [logoutQuery] = useMutation(LOGOUT); const logout = () => { - logoutQuery({variables: {token}}) - .then(() => { - setStore({token: null}); - }) - .catch((e) => { - setError(e); - console.log(e); - }); + setStore({token: null}); + logoutQuery({variables: {token}}).catch((e) => { + // setError(e); + console.log(e); + }); }; const login = () => { diff --git a/src/subComponents/Platform.electron.ts b/src/subComponents/Platform.electron.ts new file mode 100644 index 000000000..565638b2b --- /dev/null +++ b/src/subComponents/Platform.electron.ts @@ -0,0 +1,2 @@ +const platform = 'electron'; +export default platform; diff --git a/src/subComponents/Platform.native.ts b/src/subComponents/Platform.native.ts new file mode 100644 index 000000000..43eb7dbc1 --- /dev/null +++ b/src/subComponents/Platform.native.ts @@ -0,0 +1,2 @@ +const platform = 'native'; +export default platform; diff --git a/src/subComponents/Platform.ts b/src/subComponents/Platform.ts new file mode 100644 index 000000000..2e4c5c658 --- /dev/null +++ b/src/subComponents/Platform.ts @@ -0,0 +1,2 @@ +const platform = 'web'; +export default platform; From ed9edde53ee21a3eb37e454ad36d851973c8b35e Mon Sep 17 00:00:00 2001 From: Vineeth S Date: Wed, 30 Sep 2020 03:25:19 +0530 Subject: [PATCH 3/3] remove production electron issue --- electron/main/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/electron/main/index.js b/electron/main/index.js index 8caf6da23..791d8f208 100644 --- a/electron/main/index.js +++ b/electron/main/index.js @@ -2,7 +2,7 @@ const {app, BrowserWindow, session} = require('electron'); const path = require('path'); const isDevelopment = process.env.NODE_ENV === 'development'; const {format} = require('url'); -const {devServer: {port} = {}} = require('../../webpack.renderer.config'); +const port = 9002; // isDevelopment && require('react-devtools-electron'); // Handle creating/removing shortcuts on Windows when installing/uninstalling.