feat(84): [Pooja|Tilak] remove bluetooth enabled check

This commit is contained in:
Pooja Babusingh
2023-05-23 11:49:06 +05:30
parent ab3261e9ff
commit 94658225aa
7 changed files with 5 additions and 56 deletions

1
.env
View File

@@ -7,4 +7,3 @@ GOOGLE_NEARBY_MESSAGES_API_KEY=
#Application Theme can be ( orange | purple )
APPLICATION_THEME=orange
USE_BLE_SHARE=true

View File

@@ -2,20 +2,11 @@ import SmartshareReactNative from '@idpass/smartshare-react-native';
import OpenIdBle from 'react-native-openid4vp-ble';
import { OpenIDBLEShare } from 'react-native-openid4vp-ble/lib/typescript/types/bleshare';
import { IdpassSmartshare as IdpassSmartshareType } from '@idpass/smartshare-react-native/lib/typescript/IdpassSmartshare';
import { USE_BLE_SHARE } from 'react-native-dotenv';
const { IdpassSmartshare } = SmartshareReactNative;
const { Openid4vpBle } = OpenIdBle;
type ShareProtocol = OpenIDBLEShare | IdpassSmartshareType;
let ShareLib: ShareProtocol;
export const isBLEEnabled = USE_BLE_SHARE === 'true';
export const isGoogleNearbyEnabled = !isBLEEnabled;
if (isBLEEnabled) {
ShareLib = Openid4vpBle;
} else {
ShareLib = IdpassSmartshare;
}
ShareLib = Openid4vpBle;
export default ShareLib;

View File

@@ -31,7 +31,6 @@ import {
import { checkLocation, requestLocation } from '../../../shared/location';
import { CameraCapturedPicture } from 'expo-camera';
import { log } from 'xstate/lib/actions';
import { isBLEEnabled } from '../../../lib/smartshare';
import { createQrLoginMachine, qrLoginMachine } from '../../QrLoginMachine';
import { StoreEvents } from '../../store';
import {
@@ -812,11 +811,7 @@ export const scanMachine =
guards: {
isOpenIdQr: (_context, event) => {
// don't scan if QR is offline and Google Nearby is enabled
if (
Platform.OS === 'ios' &&
!isBLEEnabled &&
!event.params.includes('OPENID4VP://')
)
if (Platform.OS === 'ios' && !event.params.includes('OPENID4VP://'))
return false;
const param: ConnectionParams = Object.create(null);

View File

@@ -8,7 +8,6 @@ import { Button, Text, Row, Column } from '../../components/ui';
import { Theme } from '../../components/ui/styleUtils';
import appMetaData from '../../AppMetaData.md';
import { getVersion } from 'react-native-device-info';
import { isBLEEnabled } from '../../lib/smartshare';
export const AppMetaData: React.FC<AppMetaDataProps> = (props) => {
const { t } = useTranslation('AppMetaData');

View File

@@ -8,7 +8,6 @@ import { VcDetails } from '../../components/VcDetails';
import { useReceiveVcScreen } from './ReceiveVcScreenController';
import { VerifyIdentityOverlay } from '../VerifyIdentityOverlay';
import { MessageOverlay } from '../../components/MessageOverlay';
import { isBLEEnabled } from '../../lib/smartshare';
import { useOverlayVisibleAfterTimeout } from '../../shared/hooks/useOverlayVisibleAfterTimeout';
export const ReceiveVcScreen: React.FC = () => {
@@ -43,35 +42,7 @@ export const ReceiveVcScreen: React.FC = () => {
/>
</Column>
<Column padding="0 24" margin="32 0 0 0">
{!isBLEEnabled ? (
<>
{controller.incomingVc.shouldVerifyPresence ? (
<Button
type="outline"
title={t('verifyAndSave')}
margin="12 0 12 0"
onPress={controller.ACCEPT_AND_VERIFY}
disabled={!controller.isReviewingInIdle}
/>
) : (
<Button
title={t('save', {
vcLabel: controller.vcLabel.singular,
})}
margin="12 0 12 0"
onPress={controller.ACCEPT}
disabled={!controller.isReviewingInIdle}
/>
)}
<Button
type="clear"
title={t('discard')}
margin="0 0 12 0"
onPress={controller.REJECT}
disabled={!controller.isReviewingInIdle}
/>
</>
) : (
{
<Button
title={t('goToReceivedVCTab', {
vcLabel: controller.vcLabel.plural,
@@ -79,7 +50,7 @@ export const ReceiveVcScreen: React.FC = () => {
margin="0 0 12 0"
onPress={controller.GO_TO_RECEIVED_VC_TAB}
/>
)}
}
</Column>
</Column>

View File

@@ -9,7 +9,6 @@ import { Message } from '../../components/Message';
import { ReceiveVcScreen } from './ReceiveVcScreen';
import { Theme } from '../../components/ui/styleUtils';
import { I18nManager, Platform } from 'react-native';
import { isBLEEnabled } from '../../lib/smartshare';
const RequestStack = createNativeStackNavigator();
@@ -52,7 +51,7 @@ export const RequestLayout: React.FC = () => {
/>
</RequestStack.Navigator>
{!isBLEEnabled && controller.isAccepted && (
{controller.isAccepted && (
<Message
title={t('status.accepted.title')}
message={t('status.accepted.message', {

View File

@@ -9,11 +9,6 @@ declare module 'react-native-dotenv' {
*/
export const GOOGLE_NEARBY_MESSAGES_API_KEY: string;
/**
* Flag for using BLE share library
*/
export const USE_BLE_SHARE: string;
/**
* Flag for Toggling Purple Theme and Default Theme
*/