fix: Fixed issue where per-tag preferences were not accessible with offline subscription

This commit is contained in:
Aman Harwara
2023-08-09 23:55:42 +05:30
parent 9833bba588
commit f9d9520bca
5 changed files with 9 additions and 9 deletions

View File

@@ -475,7 +475,7 @@ export class WebApplication extends SNApplication implements WebApplicationInter
} }
hasValidFirstPartySubscription(): boolean { hasValidFirstPartySubscription(): boolean {
return this.subscriptionController.hasFirstPartyOnlineOrOfflineSubscription return this.subscriptionController.hasFirstPartyOnlineOrOfflineSubscription()
} }
async openPurchaseFlow() { async openPurchaseFlow() {

View File

@@ -93,7 +93,7 @@ const DisplayOptionsMenu: FunctionComponent<DisplayOptionsMenuProps> = ({
: selectedTag.preferences : selectedTag.preferences
const [currentMode, setCurrentMode] = useState<PreferenceMode>(selectedTagPreferences ? 'tag' : 'global') const [currentMode, setCurrentMode] = useState<PreferenceMode>(selectedTagPreferences ? 'tag' : 'global')
const [preferences, setPreferences] = useState<TagPreferences>({}) const [preferences, setPreferences] = useState<TagPreferences>({})
const hasSubscription = application.subscriptionController.hasFirstPartyOnlineOrOfflineSubscription const hasSubscription = application.subscriptionController.hasFirstPartyOnlineOrOfflineSubscription()
const controlsDisabled = currentMode === 'tag' && !hasSubscription const controlsDisabled = currentMode === 'tag' && !hasSubscription
const isDailyEntry = selectedTagPreferences?.entryMode === 'daily' const isDailyEntry = selectedTagPreferences?.entryMode === 'daily'
@@ -441,7 +441,7 @@ const DisplayOptionsMenu: FunctionComponent<DisplayOptionsMenuProps> = ({
<div className="flex flex-col pr-5"> <div className="flex flex-col pr-5">
<div className="flex flex-row items-center"> <div className="flex flex-row items-center">
<div className="text-base font-semibold uppercase text-text lg:text-xs">Daily Notebook</div> <div className="text-base font-semibold uppercase text-text lg:text-xs">Daily Notebook</div>
<Pill className="px-1.5 py-0" style="success"> <Pill className="px-1.5 !py-0.5" style="success">
Labs Labs
</Pill> </Pill>
</div> </div>
@@ -463,7 +463,7 @@ const DisplayOptionsMenu: FunctionComponent<DisplayOptionsMenuProps> = ({
<div className="flex flex-col pr-5"> <div className="flex flex-col pr-5">
<div className="flex flex-row items-center"> <div className="flex flex-row items-center">
<div className="text-base font-semibold uppercase text-text lg:text-xs">Table view</div> <div className="text-base font-semibold uppercase text-text lg:text-xs">Table view</div>
<Pill className="px-1.5 py-0" style="success"> <Pill className="px-1.5 !py-0.5" style="success">
Labs Labs
</Pill> </Pill>
</div> </div>

View File

@@ -13,7 +13,7 @@ type Props = {
const UpgradeNow = ({ application, featuresController, subscriptionContoller }: Props) => { const UpgradeNow = ({ application, featuresController, subscriptionContoller }: Props) => {
const shouldShowCTA = !featuresController.hasFolders const shouldShowCTA = !featuresController.hasFolders
const hasAccount = subscriptionContoller.hasAccount const hasAccount = subscriptionContoller.hasAccount
const hasAccessToFeatures = subscriptionContoller.hasFirstPartyOnlineOrOfflineSubscription const hasAccessToFeatures = subscriptionContoller.hasFirstPartyOnlineOrOfflineSubscription()
const onClick = useCallback(() => { const onClick = useCallback(() => {
if (hasAccount && application.isNativeIOS()) { if (hasAccount && application.isNativeIOS()) {

View File

@@ -87,7 +87,7 @@ export class LinkingController extends AbstractViewController implements Interna
} }
get isEntitledToNoteLinking() { get isEntitledToNoteLinking() {
return !!this.subscriptionController.hasFirstPartyOnlineOrOfflineSubscription return this.subscriptionController.hasFirstPartyOnlineOrOfflineSubscription()
} }
setIsLinkingPanelOpen = (open: boolean) => { setIsLinkingPanelOpen = (open: boolean) => {

View File

@@ -36,7 +36,6 @@ export class SubscriptionController extends AbstractViewController implements In
hasAccount: observable, hasAccount: observable,
onlineSubscription: observable, onlineSubscription: observable,
hasFirstPartyOnlineOrOfflineSubscription: computed,
usedInvitationsCount: computed, usedInvitationsCount: computed,
allowedInvitationsCount: computed, allowedInvitationsCount: computed,
allInvitationsUsed: computed, allInvitationsUsed: computed,
@@ -89,7 +88,7 @@ export class SubscriptionController extends AbstractViewController implements In
} }
} }
get hasFirstPartyOnlineOrOfflineSubscription(): boolean { hasFirstPartyOnlineOrOfflineSubscription(): boolean {
if (this.sessions.isSignedIn()) { if (this.sessions.isSignedIn()) {
if (!this.sessions.isSignedIntoFirstPartyServer()) { if (!this.sessions.isSignedIntoFirstPartyServer()) {
return false return false
@@ -97,7 +96,8 @@ export class SubscriptionController extends AbstractViewController implements In
return this.subscriptions.getOnlineSubscription() !== undefined return this.subscriptions.getOnlineSubscription() !== undefined
} else { } else {
return this.features.hasFirstPartyOfflineSubscription() const offline = this.features.hasFirstPartyOfflineSubscription()
return offline
} }
} }