Skip to content

Commit

Permalink
fix(inji-522): enable the location service before initiating the vc s…
Browse files Browse the repository at this point in the history
…haring.

Signed-off-by: Vijay <[email protected]>
  • Loading branch information
vijay151096 committed Nov 14, 2023
1 parent 2152c98 commit fb0a941
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 258 deletions.
12 changes: 5 additions & 7 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
plugins {
plugins {
id 'com.gladed.androidgitversion' version '0.4.14'
}

apply plugin: "com.android.application"
apply plugin: "com.facebook.react"

import com.android.build.OutputFile

react {
/* Folders */
// The root of your project, i.e. where "package.json" lives. Default is '..'
Expand Down Expand Up @@ -104,7 +102,7 @@ android {

namespace 'io.mosip.residentapp'


namespace 'io.mosip.residentapp'

defaultConfig {
Expand All @@ -130,7 +128,7 @@ android {
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}

signingConfigs {
release {
def keystore = file('release.keystore')
Expand Down Expand Up @@ -232,7 +230,7 @@ dependencies {
implementation 'com.facebook.fresco:animated-webp:2.0.0'
}
}

compileOnly project(':react-native-android-location-services-dialog-box')
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
Expand All @@ -252,4 +250,4 @@ dependencies {
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
apply from: "./eas-build.gradle"
apply from: "./eas-build.gradle"
5 changes: 3 additions & 2 deletions android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ rootProject.name = 'Inji'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
includeBuild('../node_modules/react-native-gradle-plugin')

include ':react-native-android-location-services-dialog-box'
project(':react-native-android-location-services-dialog-box').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-android-location-services-dialog-box/android')
apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle")
useExpoModules()
useExpoModules()
41 changes: 34 additions & 7 deletions machines/bleShare/scan/scanMachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ import {subscribe} from '../../../shared/openIdBLE/walletEventHandler';
import {
check,
checkMultiple,
PermissionStatus,
PERMISSIONS,
PermissionStatus,
requestMultiple,
RESULTS,
} from 'react-native-permissions';
import {
checkLocationPermissionStatus,
checkLocationService,
requestLocationPermission,
} from '../../../shared/location';
import {CameraCapturedPicture} from 'expo-camera';
Expand All @@ -40,14 +41,14 @@ import {BLEError} from '../types';
import Storage from '../../../shared/storage';
import {VCMetadata} from '../../../shared/VCMetadata';
import {
getStartEventData,
getEndEventData,
sendStartEvent,
sendEndEvent,
sendImpressionEvent,
getErrorEventData,
getImpressionEventData,
getStartEventData,
sendEndEvent,
sendErrorEvent,
getErrorEventData,
sendImpressionEvent,
sendStartEvent,
} from '../../../shared/telemetry/TelemetryUtils';
import {TelemetryConstants} from '../../../shared/telemetry/TelemetryConstants';

Expand Down Expand Up @@ -679,8 +680,21 @@ export const scanMachine =
},
},
checkingLocationService: {
initial: 'checkingPermissionStatus',
initial: 'checkLocationService',
states: {
checkLocationService: {
invoke: {
src: 'checkLocationStatus',
},
on: {
LOCATION_ENABLED: {
target: 'checkingPermissionStatus',
},
LOCATION_DISABLED: {
target: 'disabled',
},
},
},
checkingPermissionStatus: {
invoke: {
src: 'checkLocationPermission',
Expand Down Expand Up @@ -717,6 +731,13 @@ export const scanMachine =
},
},
},
disabled: {
on: {
LOCATION_REQUEST: {
target: 'checkLocationService',
},
},
},
},
},
},
Expand Down Expand Up @@ -1096,6 +1117,12 @@ export const scanMachine =
() => callback(model.events.LOCATION_DISABLED()),
);
},
checkLocationStatus: () => callback => {
return checkLocationService(
() => callback(model.events.LOCATION_ENABLED()),
() => callback(model.events.LOCATION_DISABLED()),
);
},

startConnection: context => callback => {
wallet.startConnection(context.openId4VpUri);
Expand Down
236 changes: 0 additions & 236 deletions machines/bleShare/scan/scanMachine.typegen.ts
Original file line number Diff line number Diff line change
@@ -1,236 +0,0 @@
// This file was automatically generated. Edits will be overwritten

export interface Typegen0 {
'@@xstate/typegen': true;
internalEvents: {
'': {type: ''};
'done.invoke.QrLogin': {
type: 'done.invoke.QrLogin';
data: unknown;
__tip: 'See the XState TS docs to learn how to strongly type this.';
};
'done.invoke.scan.checkStorage:invocation[0]': {
type: 'done.invoke.scan.checkStorage:invocation[0]';
data: unknown;
__tip: 'See the XState TS docs to learn how to strongly type this.';
};
'done.invoke.scan.reviewing.creatingVp:invocation[0]': {
type: 'done.invoke.scan.reviewing.creatingVp:invocation[0]';
data: unknown;
__tip: 'See the XState TS docs to learn how to strongly type this.';
};
'xstate.after(CONNECTION_TIMEOUT)#scan.connecting.inProgress': {
type: 'xstate.after(CONNECTION_TIMEOUT)#scan.connecting.inProgress';
};
'xstate.after(DESTROY_TIMEOUT)#scan.clearingConnection': {
type: 'xstate.after(DESTROY_TIMEOUT)#scan.clearingConnection';
};
'xstate.after(SHARING_TIMEOUT)#scan.reviewing.sendingVc.inProgress': {
type: 'xstate.after(SHARING_TIMEOUT)#scan.reviewing.sendingVc.inProgress';
};
'xstate.init': {type: 'xstate.init'};
'xstate.stop': {type: 'xstate.stop'};
};
invokeSrcNameMap: {
checkBluetoothPermission: 'done.invoke.scan.checkBluetoothPermission.checking:invocation[0]';
checkBluetoothState:
| 'done.invoke.scan.checkBluetoothState.checking:invocation[0]'
| 'done.invoke.scan.recheckBluetoothState.checking:invocation[0]';
checkLocationPermission: 'done.invoke.scan.checkingLocationService.checkingPermissionStatus:invocation[0]';
checkNearByDevicesPermission: 'done.invoke.scan.checkNearbyDevicesPermission.checking:invocation[0]';
checkStorageAvailability: 'done.invoke.scan.checkStorage:invocation[0]';
createVp: 'done.invoke.scan.reviewing.creatingVp:invocation[0]';
disconnect:
| 'done.invoke.scan.clearingConnection:invocation[0]'
| 'done.invoke.scan.disconnectDevice:invocation[0]';
monitorConnection: 'done.invoke.scan:invocation[0]';
requestBluetooth: 'done.invoke.scan.checkBluetoothState.requesting:invocation[0]';
requestNearByDevicesPermission: 'done.invoke.scan.checkNearbyDevicesPermission.requesting:invocation[0]';
requestToEnableLocationPermission: 'done.invoke.scan.checkingLocationService.requestToEnableLocation:invocation[0]';
sendVc: 'done.invoke.scan.reviewing.sendingVc:invocation[0]';
startConnection: 'done.invoke.scan.connecting:invocation[0]';
};
missingImplementations: {
actions: never;
delays: never;
guards: never;
services: never;
};
eventsCausingActions: {
clearCreatedVp:
| ''
| 'BLE_ERROR'
| 'DISCONNECT'
| 'DISMISS'
| 'RESET'
| 'SCREEN_BLUR'
| 'SCREEN_FOCUS'
| 'xstate.stop';
clearReason:
| ''
| 'BLE_ERROR'
| 'DISCONNECT'
| 'DISMISS'
| 'RESET'
| 'SCREEN_BLUR'
| 'SCREEN_FOCUS'
| 'xstate.stop';
clearUri:
| 'DISCONNECT'
| 'DISMISS'
| 'xstate.after(DESTROY_TIMEOUT)#scan.clearingConnection';
logFailedVerification: 'FACE_INVALID';
logShared: 'VC_ACCEPTED';
openAppPermission: 'GOTO_SETTINGS' | 'LOCATION_REQUEST';
openBluetoothSettings: 'GOTO_SETTINGS';
registerLoggers:
| 'DISCONNECT'
| 'DISMISS'
| 'xstate.after(DESTROY_TIMEOUT)#scan.clearingConnection';
removeLoggers:
| 'DISCONNECT'
| 'DISMISS'
| 'SCREEN_BLUR'
| 'xstate.after(DESTROY_TIMEOUT)#scan.clearingConnection'
| 'xstate.init';
resetShouldVerifyPresence: 'CANCEL' | 'CONNECTED' | 'DISMISS' | 'RETRY';
sendScanData: 'SCAN';
setBleError: 'BLE_ERROR';
setChildRef:
| 'DISCONNECT'
| 'DISMISS'
| 'xstate.after(DESTROY_TIMEOUT)#scan.clearingConnection';
setCreatedVp: 'done.invoke.scan.reviewing.creatingVp:invocation[0]';
setLinkCode: 'SCAN';
setPromptHint: 'CANCEL' | 'RETRY';
setReadyForBluetoothStateCheck: 'BLUETOOTH_PERMISSION_ENABLED';
setReason: 'UPDATE_REASON';
setReceiverInfo: 'CONNECTED';
setSelectedVc: 'SELECT_VC';
setSenderInfo: 'CONNECTED';
setShareLogTypeUnverified: 'ACCEPT_REQUEST';
setShareLogTypeVerified: 'FACE_VALID';
setStayInProgress:
| 'STAY_IN_PROGRESS'
| 'xstate.after(CONNECTION_TIMEOUT)#scan.connecting.inProgress'
| 'xstate.after(SHARING_TIMEOUT)#scan.reviewing.sendingVc.inProgress';
setUri: 'SCAN';
storeLoginItem: 'done.invoke.QrLogin';
storingActivityLog: 'STORE_RESPONSE';
toggleShouldVerifyPresence: 'TOGGLE_USER_CONSENT';
};
eventsCausingDelays: {
CONNECTION_TIMEOUT: 'SCAN';
DESTROY_TIMEOUT: '' | 'DISMISS' | 'LOCATION_ENABLED';
SHARING_TIMEOUT:
| 'ACCEPT_REQUEST'
| 'FACE_VALID'
| 'done.invoke.scan.reviewing.creatingVp:invocation[0]';
};
eventsCausingGuards: {
isIOS: 'BLUETOOTH_STATE_DISABLED' | 'START_PERMISSION_CHECK';
isMinimumStorageRequiredForAuditEntryReached: 'done.invoke.scan.checkStorage:invocation[0]';
isOpenIdQr: 'SCAN';
isQrLogin: 'SCAN';
uptoAndroid11: '' | 'START_PERMISSION_CHECK';
};
eventsCausingServices: {
QrLogin: 'SCAN';
checkBluetoothPermission:
| ''
| 'BLUETOOTH_STATE_DISABLED'
| 'NEARBY_ENABLED'
| 'START_PERMISSION_CHECK';
checkBluetoothState: '' | 'APP_ACTIVE';
checkLocationPermission: '' | 'APP_ACTIVE';
checkNearByDevicesPermission: 'APP_ACTIVE' | 'START_PERMISSION_CHECK';
checkStorageAvailability: 'RESET' | 'SCREEN_FOCUS';
createVp: never;
disconnect: '' | 'DISMISS' | 'LOCATION_ENABLED' | 'SCREEN_BLUR';
monitorConnection: 'DISMISS' | 'SCREEN_BLUR' | 'xstate.init';
requestBluetooth: 'BLUETOOTH_STATE_DISABLED';
requestNearByDevicesPermission: 'NEARBY_DISABLED';
requestToEnableLocationPermission: 'LOCATION_DISABLED';
sendVc:
| 'ACCEPT_REQUEST'
| 'FACE_VALID'
| 'done.invoke.scan.reviewing.creatingVp:invocation[0]';
startConnection: 'SCAN';
};
matchesStates:
| 'bluetoothDenied'
| 'bluetoothPermissionDenied'
| 'checkBluetoothPermission'
| 'checkBluetoothPermission.checking'
| 'checkBluetoothPermission.enabled'
| 'checkBluetoothState'
| 'checkBluetoothState.checking'
| 'checkBluetoothState.enabled'
| 'checkBluetoothState.requesting'
| 'checkNearbyDevicesPermission'
| 'checkNearbyDevicesPermission.checking'
| 'checkNearbyDevicesPermission.enabled'
| 'checkNearbyDevicesPermission.requesting'
| 'checkStorage'
| 'checkingLocationService'
| 'checkingLocationService.checkingPermissionStatus'
| 'checkingLocationService.denied'
| 'checkingLocationService.requestToEnableLocation'
| 'clearingConnection'
| 'connecting'
| 'connecting.inProgress'
| 'connecting.timeout'
| 'disconnectDevice'
| 'disconnected'
| 'findingConnection'
| 'handlingBleError'
| 'inactive'
| 'invalid'
| 'nearByDevicesPermissionDenied'
| 'recheckBluetoothState'
| 'recheckBluetoothState.checking'
| 'recheckBluetoothState.enabled'
| 'restrictSharingVc'
| 'reviewing'
| 'reviewing.accepted'
| 'reviewing.cancelling'
| 'reviewing.creatingVp'
| 'reviewing.invalidIdentity'
| 'reviewing.navigatingToHome'
| 'reviewing.rejected'
| 'reviewing.selectingVc'
| 'reviewing.sendingVc'
| 'reviewing.sendingVc.inProgress'
| 'reviewing.sendingVc.sent'
| 'reviewing.sendingVc.timeout'
| 'reviewing.verifyingIdentity'
| 'showQrLogin'
| 'showQrLogin.idle'
| 'showQrLogin.navigatingToHistory'
| 'showQrLogin.storing'
| 'startPermissionCheck'
| {
checkBluetoothPermission?: 'checking' | 'enabled';
checkBluetoothState?: 'checking' | 'enabled' | 'requesting';
checkNearbyDevicesPermission?: 'checking' | 'enabled' | 'requesting';
checkingLocationService?:
| 'checkingPermissionStatus'
| 'denied'
| 'requestToEnableLocation';
connecting?: 'inProgress' | 'timeout';
recheckBluetoothState?: 'checking' | 'enabled';
reviewing?:
| 'accepted'
| 'cancelling'
| 'creatingVp'
| 'invalidIdentity'
| 'navigatingToHome'
| 'rejected'
| 'selectingVc'
| 'sendingVc'
| 'verifyingIdentity'
| {sendingVc?: 'inProgress' | 'sent' | 'timeout'};
showQrLogin?: 'idle' | 'navigatingToHistory' | 'storing';
};
tags: never;
}
Loading

0 comments on commit fb0a941

Please sign in to comment.