refactor(web): dependency management (#2386)
This commit is contained in:
@@ -22,7 +22,7 @@ const BiometricsPrompt = ({ application, onValueChange, prompt, buttonRef }: Pro
|
||||
fullWidth
|
||||
colorStyle={authenticated ? 'success' : 'info'}
|
||||
onClick={async () => {
|
||||
const authenticated = await application.mobileDevice().authenticateWithBiometrics()
|
||||
const authenticated = await application.mobileDevice.authenticateWithBiometrics()
|
||||
setAuthenticated(authenticated)
|
||||
onValueChange(authenticated, prompt)
|
||||
}}
|
||||
|
||||
@@ -15,7 +15,6 @@ import Icon from '@/Components/Icon/Icon'
|
||||
import ChallengeModalPrompt from './ChallengePrompt'
|
||||
import LockscreenWorkspaceSwitcher from './LockscreenWorkspaceSwitcher'
|
||||
import { WebApplicationGroup } from '@/Application/WebApplicationGroup'
|
||||
import { ViewControllerManager } from '@/Controllers/ViewControllerManager'
|
||||
import { ChallengeModalValues } from './ChallengeModalValues'
|
||||
import { InputValue } from './InputValue'
|
||||
import { classNames } from '@standardnotes/utils'
|
||||
@@ -26,7 +25,6 @@ import { useAutoElementRect } from '@/Hooks/useElementRect'
|
||||
|
||||
type Props = {
|
||||
application: WebApplication
|
||||
viewControllerManager: ViewControllerManager
|
||||
mainApplicationGroup: WebApplicationGroup
|
||||
challenge: Challenge
|
||||
onDismiss?: (challenge: Challenge) => void
|
||||
@@ -48,13 +46,7 @@ const validateValues = (values: ChallengeModalValues, prompts: ChallengePrompt[]
|
||||
return undefined
|
||||
}
|
||||
|
||||
const ChallengeModal: FunctionComponent<Props> = ({
|
||||
application,
|
||||
viewControllerManager,
|
||||
mainApplicationGroup,
|
||||
challenge,
|
||||
onDismiss,
|
||||
}) => {
|
||||
const ChallengeModal: FunctionComponent<Props> = ({ application, mainApplicationGroup, challenge, onDismiss }) => {
|
||||
const promptsContainerRef = useRef<HTMLFormElement>(null)
|
||||
|
||||
const [values, setValues] = useState<ChallengeModalValues>(() => {
|
||||
@@ -341,12 +333,7 @@ const ChallengeModal: FunctionComponent<Props> = ({
|
||||
Forgot passcode?
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowWorkspaceSwitcher && (
|
||||
<LockscreenWorkspaceSwitcher
|
||||
mainApplicationGroup={mainApplicationGroup}
|
||||
viewControllerManager={viewControllerManager}
|
||||
/>
|
||||
)}
|
||||
{shouldShowWorkspaceSwitcher && <LockscreenWorkspaceSwitcher mainApplicationGroup={mainApplicationGroup} />}
|
||||
</div>
|
||||
</Modal>
|
||||
</ModalOverlay>
|
||||
|
||||
@@ -39,7 +39,7 @@ const ChallengeModalPrompt: FunctionComponent<Props> = ({
|
||||
const activatePrompt = useCallback(async () => {
|
||||
if (prompt.validation === ChallengeValidation.Biometric) {
|
||||
if (application.isNativeMobileWeb()) {
|
||||
const appState = await application.mobileDevice().getAppState()
|
||||
const appState = await application.mobileDevice.getAppState()
|
||||
|
||||
if (appState !== 'active') {
|
||||
return
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { WebApplicationGroup } from '@/Application/WebApplicationGroup'
|
||||
import { ViewControllerManager } from '@/Controllers/ViewControllerManager'
|
||||
import { FunctionComponent, useCallback, useRef, useState } from 'react'
|
||||
import WorkspaceSwitcherMenu from '@/Components/AccountMenu/WorkspaceSwitcher/WorkspaceSwitcherMenu'
|
||||
import Button from '@/Components/Button/Button'
|
||||
@@ -8,10 +7,9 @@ import Popover from '../Popover/Popover'
|
||||
|
||||
type Props = {
|
||||
mainApplicationGroup: WebApplicationGroup
|
||||
viewControllerManager: ViewControllerManager
|
||||
}
|
||||
|
||||
const LockscreenWorkspaceSwitcher: FunctionComponent<Props> = ({ mainApplicationGroup, viewControllerManager }) => {
|
||||
const LockscreenWorkspaceSwitcher: FunctionComponent<Props> = ({ mainApplicationGroup }) => {
|
||||
const buttonRef = useRef<HTMLButtonElement>(null)
|
||||
const containerRef = useRef<HTMLDivElement>(null)
|
||||
const [isOpen, setIsOpen] = useState(false)
|
||||
@@ -38,7 +36,6 @@ const LockscreenWorkspaceSwitcher: FunctionComponent<Props> = ({ mainApplication
|
||||
>
|
||||
<WorkspaceSwitcherMenu
|
||||
mainApplicationGroup={mainApplicationGroup}
|
||||
viewControllerManager={viewControllerManager}
|
||||
isOpen={isOpen}
|
||||
hideWorkspaceOptions={true}
|
||||
/>
|
||||
|
||||
@@ -3,13 +3,13 @@ import { ChallengePrompt } from '@standardnotes/services'
|
||||
import { RefObject, useState } from 'react'
|
||||
|
||||
import { WebApplication } from '@/Application/WebApplication'
|
||||
import { isAndroid } from '@/Utils'
|
||||
|
||||
import Button from '../Button/Button'
|
||||
import Icon from '../Icon/Icon'
|
||||
|
||||
import { InputValue } from './InputValue'
|
||||
import U2FPromptIframeContainer from './U2FPromptIframeContainer'
|
||||
import { isAndroid } from '@standardnotes/ui-services'
|
||||
|
||||
type Props = {
|
||||
application: WebApplication
|
||||
@@ -27,7 +27,7 @@ const U2FPrompt = ({ application, onValueChange, prompt, buttonRef, contextData
|
||||
return (
|
||||
<U2FPromptIframeContainer
|
||||
contextData={contextData}
|
||||
apiHost={application.getHost() || window.defaultSyncServer}
|
||||
apiHost={application.getHost.execute().getValue() || window.defaultSyncServer}
|
||||
onResponse={(response) => {
|
||||
onValueChange(response, prompt)
|
||||
}}
|
||||
@@ -60,9 +60,9 @@ const U2FPrompt = ({ application, onValueChange, prompt, buttonRef, contextData
|
||||
}
|
||||
const authenticatorOptions = authenticatorOptionsOrError.getValue()
|
||||
|
||||
authenticatorResponse = await application
|
||||
.mobileDevice()
|
||||
.authenticateWithU2F(JSON.stringify(authenticatorOptions))
|
||||
authenticatorResponse = await application.mobileDevice.authenticateWithU2F(
|
||||
JSON.stringify(authenticatorOptions),
|
||||
)
|
||||
} else {
|
||||
const authenticatorResponseOrError = await application.getAuthenticatorAuthenticationResponse.execute({
|
||||
username: username.value,
|
||||
|
||||
Reference in New Issue
Block a user