feat: mobile workspaces (#1093)

This commit is contained in:
Vardan Hakobyan
2022-06-21 15:42:43 +04:00
committed by GitHub
parent 1f903f17d1
commit 7d60dfee73
71 changed files with 599 additions and 317 deletions

View File

@@ -3,7 +3,7 @@ const PREFIX_STANDARD_NOTES = '--sn-stylekit'
const PREFIX_STANDARD_NOTES_BURN = '--sn-'
function camelCaseToDashed(camel: string) {
return camel.replace(/[A-Z]/g, m => '-' + m.toLowerCase())
return camel.replace(/[A-Z]/g, (m) => '-' + m.toLowerCase())
}
export function objectToCss(object: any) {

View File

@@ -49,12 +49,12 @@ export const useCustomActionSheet = () => {
},
]
const tempOptions = options.concat(cancelOption)
const destructiveIndex = tempOptions.findIndex(item => item.destructive)
const destructiveIndex = tempOptions.findIndex((item) => item.destructive)
const cancelIndex = tempOptions.length - 1
showActionSheetWithOptions(
{
options: tempOptions.map(option => option.text),
options: tempOptions.map((option) => option.text),
destructiveButtonIndex: destructiveIndex,
cancelButtonIndex: cancelIndex,
title,
@@ -72,7 +72,7 @@ export const useCustomActionSheet = () => {
},
anchor: anchor ? findNodeHandle(anchor) ?? undefined : undefined,
},
buttonIndex => {
(buttonIndex) => {
const option = tempOptions[buttonIndex!]
option.callback && option.callback(option)
},

View File

@@ -78,7 +78,7 @@ export class ThemeService {
}
private registerObservers() {
this.unsubsribeAppEventObserver = this.application?.addEventObserver(async event => {
this.unsubsribeAppEventObserver = this.application?.addEventObserver(async (event) => {
/**
* If there are any migrations we need to set default theme to start UI
*/
@@ -259,7 +259,7 @@ export class ThemeService {
private async resolveInitialThemeForMode() {
try {
const savedThemeId = await this.getThemeForMode(this.getColorScheme())
const matchingThemeId = Object.keys(this.themes).find(themeId => themeId === savedThemeId)
const matchingThemeId = Object.keys(this.themes).find((themeId) => themeId === savedThemeId)
if (matchingThemeId) {
this.setActiveTheme(matchingThemeId)
void this.application?.mobileComponentManager.preloadThirdPartyThemeIndexPath()
@@ -278,7 +278,7 @@ export class ThemeService {
systemThemes() {
return Object.values(this.themes)
.filter(theme => theme.mobileContent.isSystemTheme)
.filter((theme) => theme.mobileContent.isSystemTheme)
.sort((a, b) => {
if (a.name < b.name) {
return -1
@@ -292,7 +292,7 @@ export class ThemeService {
nonSystemThemes() {
return Object.values(this.themes)
.filter(theme => !theme.mobileContent.isSystemTheme)
.filter((theme) => !theme.mobileContent.isSystemTheme)
.sort((a, b) => {
if (a.name < b.name) {
return -1
@@ -465,7 +465,7 @@ export class ThemeService {
private async loadCachedThemes() {
const rawValue = (await this.application!.getValue(CACHED_THEMES_KEY, StorageValueModes.Nonwrapped)) || []
const themes = (rawValue as DecryptedTransferPayload<ComponentContent>[]).map(rawPayload => {
const themes = (rawValue as DecryptedTransferPayload<ComponentContent>[]).map((rawPayload) => {
const payload = new DecryptedPayload<ComponentContent>(rawPayload)
return new MobileTheme(payload)
@@ -480,7 +480,7 @@ export class ThemeService {
const themes = this.nonSystemThemes()
return this.application!.setValue(
CACHED_THEMES_KEY,
themes.map(t => t.payloadRepresentation()),
themes.map((t) => t.payloadRepresentation()),
StorageValueModes.Nonwrapped,
)
}