[Themes] Implement (#34)
* [Themes] Initial work * [Themes] Read from __vendetta_themes and early UI (#36) * [Themes] Read from `__vendetta_themes` * [Themes] Save as JSON and native theming * [Themes] Basic UI * [Themes] Merge processed theme data * [Themes] Import ReactNative from `@lib/preinit`, oraganize imports * [Themes] Some minor cleanup * [Themes] UI overhaul * [Themes] Minor adjustments * [Themes] Implement updates, make UI reactive-ish * [Themes] Move to new format * [Themes > UI] Last-minute ThemeCard changes * [Themes] Properly support AMOLED --------- Co-authored-by: Amsyar Rasyiq <82711525+amsyarasyiq@users.noreply.github.com>
This commit is contained in:
parent
7dc0b1286a
commit
85a83e4873
15 changed files with 464 additions and 132 deletions
|
@ -1,13 +1,8 @@
|
|||
import { DCDFileManager, MMKVManager, StorageBackend } from "@types";
|
||||
import { ReactNative as RN } from "@metro/hoist";
|
||||
import { ReactNative as RN } from "@metro/common";
|
||||
|
||||
const MMKVManager = RN.NativeModules.MMKVManager as MMKVManager;
|
||||
const DCDFileManager = RN.NativeModules.DCDFileManager as DCDFileManager;
|
||||
|
||||
const filePathFixer: (file: string) => string = RN.Platform.select({
|
||||
default: (f) => f,
|
||||
ios: (f) => `Documents/${f}`,
|
||||
});
|
||||
const MMKVManager = window.nativeModuleProxy.MMKVManager as MMKVManager;
|
||||
const DCDFileManager = window.nativeModuleProxy.DCDFileManager as DCDFileManager;
|
||||
|
||||
export const createMMKVBackend = (store: string): StorageBackend => ({
|
||||
get: async () => JSON.parse((await MMKVManager.getItem(store)) ?? "{}"),
|
||||
|
@ -15,6 +10,12 @@ export const createMMKVBackend = (store: string): StorageBackend => ({
|
|||
});
|
||||
|
||||
export const createFileBackend = (file: string): StorageBackend => {
|
||||
// TODO: Creating this function in every file backend probably isn't ideal.
|
||||
const filePathFixer: (file: string) => string = RN.Platform.select({
|
||||
default: (f) => f,
|
||||
ios: (f) => `Documents/${f}`,
|
||||
});
|
||||
|
||||
let created: boolean;
|
||||
return {
|
||||
get: async () => {
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import { Emitter, MMKVManager, StorageBackend } from "@types";
|
||||
import { ReactNative as RN } from "@metro/hoist";
|
||||
import createEmitter from "../emitter";
|
||||
|
||||
const MMKVManager = RN.NativeModules.MMKVManager as MMKVManager;
|
||||
const MMKVManager = window.nativeModuleProxy.MMKVManager as MMKVManager;
|
||||
|
||||
const emitterSymbol = Symbol("emitter accessor");
|
||||
const syncAwaitSymbol = Symbol("wrapSync promise accessor");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue