fix(web): disable subscription sharing on demo
This commit is contained in:
@@ -11,6 +11,7 @@ export interface SessionsClientInterface {
|
|||||||
createDemoShareToken(): Promise<Base64String | ClientDisplayableError>
|
createDemoShareToken(): Promise<Base64String | ClientDisplayableError>
|
||||||
populateSessionFromDemoShareToken(token: Base64String): Promise<void>
|
populateSessionFromDemoShareToken(token: Base64String): Promise<void>
|
||||||
getUser(): User | undefined
|
getUser(): User | undefined
|
||||||
|
isCurrentSessionReadOnly(): boolean | undefined
|
||||||
register(email: string, password: string, ephemeral: boolean): Promise<UserRegistrationResponseBody>
|
register(email: string, password: string, ephemeral: boolean): Promise<UserRegistrationResponseBody>
|
||||||
signIn(
|
signIn(
|
||||||
email: string,
|
email: string,
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ export class SNSessionManager
|
|||||||
{
|
{
|
||||||
private user?: Responses.User
|
private user?: Responses.User
|
||||||
private isSessionRenewChallengePresented = false
|
private isSessionRenewChallengePresented = false
|
||||||
|
private session?: Session | LegacySession
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private diskStorageService: DiskStorageService,
|
private diskStorageService: DiskStorageService,
|
||||||
@@ -149,6 +150,8 @@ export class SNSessionManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
private setSession(session: Session | LegacySession, persist = true): void {
|
private setSession(session: Session | LegacySession, persist = true): void {
|
||||||
|
this.session = session
|
||||||
|
|
||||||
if (session instanceof Session) {
|
if (session instanceof Session) {
|
||||||
this.httpService.setSession(session)
|
this.httpService.setSession(session)
|
||||||
}
|
}
|
||||||
@@ -170,6 +173,18 @@ export class SNSessionManager
|
|||||||
return this.user
|
return this.user
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isCurrentSessionReadOnly(): boolean | undefined {
|
||||||
|
if (this.session === undefined) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.session instanceof LegacySession) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.session.isReadOnly()
|
||||||
|
}
|
||||||
|
|
||||||
public getSureUser() {
|
public getSureUser() {
|
||||||
return this.user as Responses.User
|
return this.user as Responses.User
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { FeatureStatus, FeatureIdentifier } from '@standardnotes/snjs'
|
import { FeatureStatus, FeatureIdentifier, SessionsClientInterface } from '@standardnotes/snjs'
|
||||||
import { observer } from 'mobx-react-lite'
|
import { observer } from 'mobx-react-lite'
|
||||||
import { FunctionComponent, useState } from 'react'
|
import { FunctionComponent, useState } from 'react'
|
||||||
|
|
||||||
@@ -26,8 +26,11 @@ const SubscriptionSharing: FunctionComponent<Props> = ({ application, viewContro
|
|||||||
|
|
||||||
const subscriptionState = viewControllerManager.subscriptionController
|
const subscriptionState = viewControllerManager.subscriptionController
|
||||||
|
|
||||||
|
const isReadOnlySession = application.sessions.isCurrentSessionReadOnly()
|
||||||
|
|
||||||
const isSubscriptionSharingFeatureAvailable =
|
const isSubscriptionSharingFeatureAvailable =
|
||||||
application.features.getFeatureStatus(FeatureIdentifier.SubscriptionSharing) === FeatureStatus.Entitled
|
application.features.getFeatureStatus(FeatureIdentifier.SubscriptionSharing) === FeatureStatus.Entitled &&
|
||||||
|
!isReadOnlySession
|
||||||
|
|
||||||
const closeInviteDialog = () => setIsInviteDialogOpen(false)
|
const closeInviteDialog = () => setIsInviteDialogOpen(false)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user