fix(rn,util) avoid 'clipboard-copy' being bundled in native
The copyText wrapper is used in the `showStartedRecordingNotification` action, which is common for web and native. Provide a native implementation so the right one is bundled.
This commit is contained in:
parent
d2a36ea3a8
commit
a2d39ca5b1
|
@ -7,7 +7,7 @@ import React, { useEffect, useState } from 'react';
|
||||||
import Icon from '../icons/components/Icon';
|
import Icon from '../icons/components/Icon';
|
||||||
import { IconCheck, IconCopy } from '../icons/svg';
|
import { IconCheck, IconCopy } from '../icons/svg';
|
||||||
import { withPixelLineHeight } from '../styles/functions.web';
|
import { withPixelLineHeight } from '../styles/functions.web';
|
||||||
import { copyText } from '../util/copyText';
|
import { copyText } from '../util/copyText.web';
|
||||||
|
|
||||||
const styles = (theme: Theme) => {
|
const styles = (theme: Theme) => {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
import Clipboard from '@react-native-community/clipboard';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to copy a given text to the clipboard.
|
||||||
|
* Returns true if the action succeeds.
|
||||||
|
*
|
||||||
|
* @param {string} textToCopy - Text to be copied.
|
||||||
|
* @returns {Promise<boolean>}
|
||||||
|
*/
|
||||||
|
export function copyText(textToCopy: string) {
|
||||||
|
try {
|
||||||
|
Clipboard.setString(textToCopy);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,7 +4,7 @@ import React, { Component } from 'react';
|
||||||
|
|
||||||
import { translate } from '../../../../base/i18n';
|
import { translate } from '../../../../base/i18n';
|
||||||
import { Icon, IconCopy } from '../../../../base/icons';
|
import { Icon, IconCopy } from '../../../../base/icons';
|
||||||
import { copyText } from '../../../../base/util/copyText';
|
import { copyText } from '../../../../base/util/copyText.web';
|
||||||
import { _formatConferenceIDPin } from '../../../_utils';
|
import { _formatConferenceIDPin } from '../../../_utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,7 +16,7 @@ import {
|
||||||
IconYahoo
|
IconYahoo
|
||||||
} from '../../../../base/icons';
|
} from '../../../../base/icons';
|
||||||
import { Tooltip } from '../../../../base/tooltip';
|
import { Tooltip } from '../../../../base/tooltip';
|
||||||
import { copyText } from '../../../../base/util/copyText';
|
import { copyText } from '../../../../base/util/copyText.web';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import React, { useState } from 'react';
|
||||||
|
|
||||||
import { translate } from '../../../../base/i18n';
|
import { translate } from '../../../../base/i18n';
|
||||||
import { Icon, IconCheck, IconCopy } from '../../../../base/icons';
|
import { Icon, IconCheck, IconCopy } from '../../../../base/icons';
|
||||||
import { copyText } from '../../../../base/util/copyText';
|
import { copyText } from '../../../../base/util/copyText.web';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import Clipboard from '@react-native-community/clipboard';
|
|
||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
import {
|
import {
|
||||||
Text,
|
Text,
|
||||||
|
@ -16,6 +15,7 @@ import Button from '../../../../base/ui/components/native/Button';
|
||||||
import Input from '../../../../base/ui/components/native/Input';
|
import Input from '../../../../base/ui/components/native/Input';
|
||||||
import Switch from '../../../../base/ui/components/native/Switch';
|
import Switch from '../../../../base/ui/components/native/Switch';
|
||||||
import { BUTTON_TYPES } from '../../../../base/ui/constants';
|
import { BUTTON_TYPES } from '../../../../base/ui/constants';
|
||||||
|
import { copyText } from '../../../../base/util/copyText.native';
|
||||||
import { isInBreakoutRoom } from '../../../../breakout-rooms/functions';
|
import { isInBreakoutRoom } from '../../../../breakout-rooms/functions';
|
||||||
import { toggleLobbyMode } from '../../../../lobby/actions.any';
|
import { toggleLobbyMode } from '../../../../lobby/actions.any';
|
||||||
import { LOCKED_LOCALLY, LOCKED_REMOTELY } from '../../../../room-lock';
|
import { LOCKED_LOCALLY, LOCKED_REMOTELY } from '../../../../room-lock';
|
||||||
|
@ -475,7 +475,7 @@ class SecurityDialog extends PureComponent<Props, State> {
|
||||||
_onCopy() {
|
_onCopy() {
|
||||||
const { passwordInputValue } = this.state;
|
const { passwordInputValue } = this.state;
|
||||||
|
|
||||||
Clipboard.setString(passwordInputValue);
|
copyText(passwordInputValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
_onSubmit: () => void;
|
_onSubmit: () => void;
|
||||||
|
|
|
@ -3,7 +3,7 @@ import React, { useRef, useState } from 'react';
|
||||||
import { WithTranslation } from 'react-i18next';
|
import { WithTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { translate } from '../../../../base/i18n/functions';
|
import { translate } from '../../../../base/i18n/functions';
|
||||||
import { copyText } from '../../../../base/util/copyText';
|
import { copyText } from '../../../../base/util/copyText.web';
|
||||||
import { LOCKED_LOCALLY } from '../../../../room-lock/constants';
|
import { LOCKED_LOCALLY } from '../../../../room-lock/constants';
|
||||||
import { NOTIFY_CLICK_MODE } from '../../../../toolbox/constants';
|
import { NOTIFY_CLICK_MODE } from '../../../../toolbox/constants';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue