fix: use API v0 on iOS (#2858) [skip e2e]
This commit is contained in:
@@ -15,7 +15,10 @@ import { AuthApiServiceInterface } from './AuthApiServiceInterface'
|
||||
export class AuthApiService implements AuthApiServiceInterface {
|
||||
private operationsInProgress: Map<AuthApiOperations, boolean>
|
||||
|
||||
constructor(private authServer: AuthServerInterface) {
|
||||
constructor(
|
||||
private authServer: AuthServerInterface,
|
||||
private apiVersion: ApiVersion,
|
||||
) {
|
||||
this.operationsInProgress = new Map()
|
||||
}
|
||||
|
||||
@@ -50,7 +53,7 @@ export class AuthApiService implements AuthApiServiceInterface {
|
||||
|
||||
try {
|
||||
const response = await this.authServer.recoveryKeyParams({
|
||||
api_version: ApiVersion.v1,
|
||||
api_version: this.apiVersion,
|
||||
code_challenge: dto.codeChallenge,
|
||||
recovery_codes: dto.recoveryCodes,
|
||||
username: dto.username,
|
||||
@@ -78,7 +81,7 @@ export class AuthApiService implements AuthApiServiceInterface {
|
||||
|
||||
try {
|
||||
const response = await this.authServer.signInWithRecoveryCodes({
|
||||
api_version: ApiVersion.v1,
|
||||
api_version: this.apiVersion,
|
||||
code_verifier: dto.codeVerifier,
|
||||
password: dto.password,
|
||||
recovery_codes: dto.recoveryCodes,
|
||||
|
||||
@@ -23,7 +23,10 @@ import { GetUserSubscriptionRequestParams } from '../../Request/Subscription/Get
|
||||
export class SubscriptionApiService implements SubscriptionApiServiceInterface {
|
||||
private operationsInProgress: Map<SubscriptionApiOperations, boolean>
|
||||
|
||||
constructor(private subscriptionServer: SubscriptionServerInterface) {
|
||||
constructor(
|
||||
private subscriptionServer: SubscriptionServerInterface,
|
||||
private apiVersion: ApiVersion,
|
||||
) {
|
||||
this.operationsInProgress = new Map()
|
||||
}
|
||||
|
||||
@@ -36,7 +39,7 @@ export class SubscriptionApiService implements SubscriptionApiServiceInterface {
|
||||
|
||||
try {
|
||||
const response = await this.subscriptionServer.listInvites({
|
||||
[ApiEndpointParam.ApiVersion]: ApiVersion.v1,
|
||||
[ApiEndpointParam.ApiVersion]: this.apiVersion,
|
||||
})
|
||||
|
||||
return response
|
||||
@@ -56,7 +59,7 @@ export class SubscriptionApiService implements SubscriptionApiServiceInterface {
|
||||
|
||||
try {
|
||||
const response = await this.subscriptionServer.cancelInvite({
|
||||
[ApiEndpointParam.ApiVersion]: ApiVersion.v1,
|
||||
[ApiEndpointParam.ApiVersion]: this.apiVersion,
|
||||
inviteUuid,
|
||||
})
|
||||
|
||||
@@ -77,7 +80,7 @@ export class SubscriptionApiService implements SubscriptionApiServiceInterface {
|
||||
|
||||
try {
|
||||
const response = await this.subscriptionServer.invite({
|
||||
[ApiEndpointParam.ApiVersion]: ApiVersion.v1,
|
||||
[ApiEndpointParam.ApiVersion]: this.apiVersion,
|
||||
identifier: inviteeEmail,
|
||||
})
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ export class UserApiService implements UserApiServiceInterface {
|
||||
constructor(
|
||||
private userServer: UserServerInterface,
|
||||
private userRequestServer: UserRequestServerInterface,
|
||||
private apiVersion: ApiVersion,
|
||||
) {
|
||||
this.operationsInProgress = new Map()
|
||||
}
|
||||
@@ -72,7 +73,7 @@ export class UserApiService implements UserApiServiceInterface {
|
||||
|
||||
try {
|
||||
const response = await this.userServer.register({
|
||||
[ApiEndpointParam.ApiVersion]: ApiVersion.v1,
|
||||
[ApiEndpointParam.ApiVersion]: this.apiVersion,
|
||||
password: registerDTO.serverPassword,
|
||||
email: registerDTO.email,
|
||||
ephemeral: registerDTO.ephemeral,
|
||||
@@ -92,7 +93,7 @@ export class UserApiService implements UserApiServiceInterface {
|
||||
|
||||
try {
|
||||
const response = await this.userServer.update({
|
||||
[ApiEndpointParam.ApiVersion]: ApiVersion.v1,
|
||||
[ApiEndpointParam.ApiVersion]: this.apiVersion,
|
||||
user_uuid: updateDTO.userUuid,
|
||||
})
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ export class HttpService implements HttpServiceInterface {
|
||||
private environment: Environment,
|
||||
private appVersion: string,
|
||||
private snjsVersion: string,
|
||||
private apiVersion: ApiVersion,
|
||||
private logger: LoggerInterface,
|
||||
) {
|
||||
this.requestHandler = new FetchRequestHandler(this.snjsVersion, this.appVersion, this.environment, this.logger)
|
||||
@@ -247,7 +248,7 @@ export class HttpService implements HttpServiceInterface {
|
||||
const params = {
|
||||
...inParams,
|
||||
...{
|
||||
[ApiEndpointParam.ApiVersion]: ApiVersion.v1,
|
||||
[ApiEndpointParam.ApiVersion]: this.apiVersion,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -736,7 +736,7 @@ EXTERNAL SOURCES:
|
||||
:path: "../node_modules/react-native/ReactCommon/yoga"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
boost: 57d2868c099736d80fcd648bf211b4431e51a558
|
||||
boost: a7c83b31436843459a1961bfd74b96033dc77234
|
||||
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
|
||||
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
|
||||
FBLazyVector: 71803c074f6325f10b5ec891c443b6bbabef0ca7
|
||||
@@ -756,7 +756,7 @@ SPEC CHECKSUMS:
|
||||
MMKV: 9c6c3fa4ddd849f28c7b9a5c9d23aab84f14ee35
|
||||
MMKVCore: 9bb7440b170181ac5b81f542ac258103542e693d
|
||||
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
|
||||
RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1
|
||||
RCT-Folly: 0080d0a6ebf2577475bda044aa59e2ca1f909cda
|
||||
RCTRequired: df81ab637d35fac9e6eb94611cfd20f0feb05455
|
||||
RCTTypeSafety: 4636e4a36c7c2df332bda6d59b19b41c443d4287
|
||||
React: e0cc5197a804031a6c53fb38483c3485fcb9d6f3
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { ApiVersion } from '@standardnotes/api'
|
||||
import { Environment, Platform, ApplicationIdentifier } from '@standardnotes/models'
|
||||
import { AlertService, DeviceInterface } from '@standardnotes/services'
|
||||
import { PureCryptoInterface } from '@standardnotes/sncrypto-common'
|
||||
@@ -39,4 +40,6 @@ export interface RequiredApplicationOptions {
|
||||
* Version of client application.
|
||||
*/
|
||||
appVersion: string
|
||||
|
||||
apiVersion: ApiVersion
|
||||
}
|
||||
|
||||
@@ -1090,7 +1090,7 @@ export class Dependencies {
|
||||
})
|
||||
|
||||
this.factory.set(TYPES.AuthApiService, () => {
|
||||
return new AuthApiService(this.get<AuthServer>(TYPES.AuthServer))
|
||||
return new AuthApiService(this.get<AuthServer>(TYPES.AuthServer), this.options.apiVersion)
|
||||
})
|
||||
|
||||
this.factory.set(TYPES.AuthManager, () => {
|
||||
@@ -1432,13 +1432,14 @@ export class Dependencies {
|
||||
})
|
||||
|
||||
this.factory.set(TYPES.SubscriptionApiService, () => {
|
||||
return new SubscriptionApiService(this.get<SubscriptionServer>(TYPES.SubscriptionServer))
|
||||
return new SubscriptionApiService(this.get<SubscriptionServer>(TYPES.SubscriptionServer), this.options.apiVersion)
|
||||
})
|
||||
|
||||
this.factory.set(TYPES.UserApiService, () => {
|
||||
return new UserApiService(
|
||||
this.get<UserServer>(TYPES.UserServer),
|
||||
this.get<UserRequestServer>(TYPES.UserRequestServer),
|
||||
this.options.apiVersion,
|
||||
)
|
||||
})
|
||||
|
||||
@@ -1542,6 +1543,7 @@ export class Dependencies {
|
||||
this.options.environment,
|
||||
this.options.appVersion,
|
||||
SnjsVersion,
|
||||
this.options.apiVersion,
|
||||
this.get<Logger>(TYPES.Logger),
|
||||
)
|
||||
})
|
||||
|
||||
@@ -22,6 +22,7 @@ export function createApplicationWithOptions({ identifier, environment, platform
|
||||
defaultHost: host || Defaults.getDefaultHost(),
|
||||
appVersion: Defaults.getAppVersion(),
|
||||
webSocketUrl: Defaults.getDefaultWebSocketUrl(),
|
||||
apiVersion: ApiVersion.V1,
|
||||
syncCallsThresholdPerMinute,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
SNNote,
|
||||
DesktopManagerInterface,
|
||||
FileItem,
|
||||
ApiVersion,
|
||||
} from '@standardnotes/snjs'
|
||||
import { action, computed, makeObservable, observable } from 'mobx'
|
||||
import { startAuthentication, startRegistration } from '@simplewebauthn/browser'
|
||||
@@ -112,6 +113,8 @@ export class WebApplication extends SNApplication implements WebApplicationInter
|
||||
defaultHost: defaultSyncServerHost,
|
||||
appVersion: deviceInterface.appVersion,
|
||||
webSocketUrl: webSocketUrl,
|
||||
/** iOS file:// based origin does not work with production cookies */
|
||||
apiVersion: platform === Platform.Ios ? ApiVersion.v0 : ApiVersion.v1,
|
||||
loadBatchSize:
|
||||
deviceInterface.environment === Environment.Mobile ? 250 : ApplicationOptionsDefaults.loadBatchSize,
|
||||
sleepBetweenBatches:
|
||||
|
||||
Reference in New Issue
Block a user