refactor: display options menu logic
This commit is contained in:
@@ -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.hasFirstPartySubscriptionOrOfflineRepo()
|
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'
|
||||||
|
|
||||||
|
|||||||
@@ -89,20 +89,11 @@ export class SubscriptionController extends AbstractViewController implements In
|
|||||||
}
|
}
|
||||||
|
|
||||||
hasFirstPartyOnlineOrOfflineSubscription(): boolean {
|
hasFirstPartyOnlineOrOfflineSubscription(): boolean {
|
||||||
if (this.sessions.isSignedIn()) {
|
const offline = this.features.hasFirstPartyOfflineSubscription()
|
||||||
if (!this.sessions.isSignedIntoFirstPartyServer()) {
|
if (!this.sessions.isSignedIn() || !this.sessions.isSignedIntoFirstPartyServer()) {
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return !!this.subscriptions.getOnlineSubscription()
|
|
||||||
} else {
|
|
||||||
const offline = this.features.hasFirstPartyOfflineSubscription()
|
|
||||||
return offline
|
return offline
|
||||||
}
|
}
|
||||||
}
|
return !!this.subscriptions.getOnlineSubscription() || offline
|
||||||
|
|
||||||
hasFirstPartySubscriptionOrOfflineRepo(): boolean {
|
|
||||||
return this.hasFirstPartyOnlineOrOfflineSubscription() || this.features.hasOfflineRepo()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get usedInvitationsCount(): number {
|
get usedInvitationsCount(): number {
|
||||||
|
|||||||
Reference in New Issue
Block a user