* feat: sync page theme color metadata with active theme bg * fix: lint * refactor: extract to method * feat: recieve theme scheme change on mobile * fix: handle issue where status bar color changes when keyboard appears on iOS * fix: disable bouncing on web view
51 lines
1.6 KiB
TypeScript
51 lines
1.6 KiB
TypeScript
import { ComponentArea } from '@standardnotes/features'
|
|
import { SNComponent } from '../Component/Component'
|
|
import { ConflictStrategy } from '../../Abstract/Item/Types/ConflictStrategy'
|
|
import { AppDataField } from '../../Abstract/Item/Types/AppDataField'
|
|
import { HistoryEntryInterface } from '../../Runtime/History'
|
|
import { DecryptedItemInterface, ItemInterface } from '../../Abstract/Item'
|
|
import { ContentType } from '@standardnotes/common'
|
|
import { useBoolean } from '@standardnotes/utils'
|
|
import { ThemePackageInfo } from '../Component/PackageInfo'
|
|
|
|
export const isTheme = (x: ItemInterface): x is SNTheme => x.content_type === ContentType.Theme
|
|
|
|
export class SNTheme extends SNComponent {
|
|
public override area: ComponentArea = ComponentArea.Themes
|
|
public override readonly package_info!: ThemePackageInfo
|
|
|
|
isLayerable(): boolean {
|
|
return useBoolean(this.package_info && this.package_info.layerable, false)
|
|
}
|
|
|
|
/** Do not duplicate under most circumstances. Always keep original */
|
|
override strategyWhenConflictingWithItem(
|
|
_item: DecryptedItemInterface,
|
|
_previousRevision?: HistoryEntryInterface,
|
|
): ConflictStrategy {
|
|
return ConflictStrategy.KeepBase
|
|
}
|
|
|
|
getMobileRules() {
|
|
return (
|
|
this.getAppDomainValue(AppDataField.MobileRules) || {
|
|
constants: {},
|
|
rules: {},
|
|
}
|
|
)
|
|
}
|
|
|
|
/** Same as getMobileRules but without default value. */
|
|
hasMobileRules() {
|
|
return this.getAppDomainValue(AppDataField.MobileRules)
|
|
}
|
|
|
|
getNotAvailOnMobile() {
|
|
return this.getAppDomainValue(AppDataField.NotAvailableOnMobile)
|
|
}
|
|
|
|
isMobileActive() {
|
|
return this.getAppDomainValue(AppDataField.MobileActive)
|
|
}
|
|
}
|