chore: fix mobile device interface
This commit is contained in:
@@ -3,7 +3,6 @@ import {
|
|||||||
AppleIAPProductId,
|
AppleIAPProductId,
|
||||||
AppleIAPReceipt,
|
AppleIAPReceipt,
|
||||||
ApplicationIdentifier,
|
ApplicationIdentifier,
|
||||||
ApplicationInterface,
|
|
||||||
DatabaseKeysLoadChunkResponse,
|
DatabaseKeysLoadChunkResponse,
|
||||||
DatabaseLoadOptions,
|
DatabaseLoadOptions,
|
||||||
Environment,
|
Environment,
|
||||||
@@ -80,14 +79,6 @@ export class MobileDevice implements MobileDeviceInterface {
|
|||||||
await this.removeRawStorageValue(namespacedKey(identifier, RawStorageKey.StorageObject))
|
await this.removeRawStorageValue(namespacedKey(identifier, RawStorageKey.StorageObject))
|
||||||
}
|
}
|
||||||
|
|
||||||
setApplication(_application: ApplicationInterface): void {
|
|
||||||
throw new Error('Method not implemented.')
|
|
||||||
}
|
|
||||||
|
|
||||||
removeApplication(_application: ApplicationInterface): void {
|
|
||||||
throw new Error('Method not implemented.')
|
|
||||||
}
|
|
||||||
|
|
||||||
async authenticateWithU2F(authenticationOptionsJSONString: string): Promise<Record<string, unknown> | null> {
|
async authenticateWithU2F(authenticationOptionsJSONString: string): Promise<Record<string, unknown> | null> {
|
||||||
const { Fido2ApiModule } = NativeModules
|
const { Fido2ApiModule } = NativeModules
|
||||||
|
|
||||||
|
|||||||
@@ -156,8 +156,6 @@ const MobileWebAppContents = ({ destroyAndReload }: { destroyAndReload: () => vo
|
|||||||
this.messageSender = messageSender
|
this.messageSender = messageSender
|
||||||
}
|
}
|
||||||
|
|
||||||
setApplication() {}
|
|
||||||
|
|
||||||
askReactNativeToInvokeInterfaceMethod(functionName, args) {
|
askReactNativeToInvokeInterfaceMethod(functionName, args) {
|
||||||
return this.messageSender.askReactNativeToInvokeInterfaceMethod(functionName, args)
|
return this.messageSender.askReactNativeToInvokeInterfaceMethod(functionName, args)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { ApplicationInterface } from './../Application/ApplicationInterface'
|
|
||||||
import { ApplicationIdentifier } from '@standardnotes/common'
|
import { ApplicationIdentifier } from '@standardnotes/common'
|
||||||
import {
|
import {
|
||||||
FullyFormedTransferPayload,
|
FullyFormedTransferPayload,
|
||||||
@@ -34,9 +33,6 @@ export interface DeviceInterface {
|
|||||||
|
|
||||||
removeRawStorageValuesForIdentifier(identifier: ApplicationIdentifier): Promise<void>
|
removeRawStorageValuesForIdentifier(identifier: ApplicationIdentifier): Promise<void>
|
||||||
|
|
||||||
setApplication(application: ApplicationInterface): void
|
|
||||||
removeApplication(application: ApplicationInterface): void
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On web platforms, databased created may be new.
|
* On web platforms, databased created may be new.
|
||||||
* New databases can be because of new sessions, or if the browser deleted it.
|
* New databases can be because of new sessions, or if the browser deleted it.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { ApplicationInterface } from './../Application/ApplicationInterface'
|
||||||
import { DeviceInterface } from './DeviceInterface'
|
import { DeviceInterface } from './DeviceInterface'
|
||||||
import { RawKeychainValue } from '@standardnotes/models'
|
import { RawKeychainValue } from '@standardnotes/models'
|
||||||
|
|
||||||
@@ -7,4 +8,7 @@ export interface WebOrDesktopDeviceInterface extends DeviceInterface {
|
|||||||
getKeychainValue(): Promise<RawKeychainValue>
|
getKeychainValue(): Promise<RawKeychainValue>
|
||||||
|
|
||||||
setKeychainValue(value: RawKeychainValue): Promise<void>
|
setKeychainValue(value: RawKeychainValue): Promise<void>
|
||||||
|
|
||||||
|
setApplication(application: ApplicationInterface): void
|
||||||
|
removeApplication(application: ApplicationInterface): void
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,7 +106,9 @@ export class WebApplication extends SNApplication implements WebApplicationInter
|
|||||||
dealloced: observable,
|
dealloced: observable,
|
||||||
})
|
})
|
||||||
|
|
||||||
deviceInterface.setApplication(this)
|
if (!this.isNativeMobileWeb()) {
|
||||||
|
deviceInterface.setApplication(this)
|
||||||
|
}
|
||||||
|
|
||||||
this.itemControllerGroup = new ItemGroupController(this)
|
this.itemControllerGroup = new ItemGroupController(this)
|
||||||
this.routeService = new RouteService(this, this.internalEventBus)
|
this.routeService = new RouteService(this, this.internalEventBus)
|
||||||
|
|||||||
@@ -15,7 +15,11 @@ export function getPlatformString() {
|
|||||||
try {
|
try {
|
||||||
const platform = navigator.platform.toLowerCase()
|
const platform = navigator.platform.toLowerCase()
|
||||||
let trimmed = ''
|
let trimmed = ''
|
||||||
if (platform.includes('mac')) {
|
if (platform.includes('iphone')) {
|
||||||
|
trimmed = 'ios'
|
||||||
|
} else if (platform.includes('android')) {
|
||||||
|
trimmed = 'android'
|
||||||
|
} else if (platform.includes('mac')) {
|
||||||
trimmed = 'mac'
|
trimmed = 'mac'
|
||||||
} else if (platform.includes('win')) {
|
} else if (platform.includes('win')) {
|
||||||
trimmed = 'windows'
|
trimmed = 'windows'
|
||||||
@@ -27,7 +31,7 @@ export function getPlatformString() {
|
|||||||
}
|
}
|
||||||
return trimmed + (isDesktopApplication() ? '-desktop' : '-web')
|
return trimmed + (isDesktopApplication() ? '-desktop' : '-web')
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return 'linux-web'
|
return 'unknown-platform'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user