A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
preload images
ammarahm-ed18816b07bbd1
diff --git a/apps/mobile/src/services/SettingsService.js b/apps/mobile/src/services/SettingsService.jsindex af77cb560..1f0be56fe 100644--- a/apps/mobile/src/services/SettingsService.js+++ b/apps/mobile/src/services/SettingsService.js@@ -1,7 +1,7 @@import {updateEvent} from '../components/DialogManager/recievers';import {Actions} from '../provider/Actions';import {defaultState} from '../provider/DefaultState';-import {AndroidModule, sortSettings} from '../utils';+import {AndroidModule, preloadImages, sortSettings} from '../utils';import {getColorScheme} from '../utils/ColorUtils';import {MMKV} from '../utils/mmkv';import {scale, updateSize} from '../utils/SizeUtils';@@ -72,6 +72,7 @@ async function init() {const setTheme = async () => {if (settings) {let newColors = await getColorScheme(settings.useSystemTheme);+ preloadImages(newColors.accent)updateEvent({type: Actions.THEME, colors: newColors});}};diff --git a/apps/mobile/src/utils/Colors.js b/apps/mobile/src/utils/Colors.jsindex 047080a01..a96fbdc41 100644--- a/apps/mobile/src/utils/Colors.js+++ b/apps/mobile/src/utils/Colors.js@@ -86,7 +86,7 @@ export function setColorScheme(colors = COLOR_SCHEME, accent = ACCENT) {COLOR_SCHEME.night ? 'light-content' : 'dark-content',true,);-+if (Platform.OS === 'android') {AndroidModule.setBackgroundColor(COLOR_SCHEME.bg);StatusBar.setBackgroundColor('transparent', true);diff --git a/apps/mobile/src/utils/index.js b/apps/mobile/src/utils/index.jsindex aca4df1e2..63f678fae 100755--- a/apps/mobile/src/utils/index.js+++ b/apps/mobile/src/utils/index.js@@ -13,6 +13,78 @@ import {eSendEvent} from '../services/EventManager';import {MMKV} from './mmkv';import {tabBarRef} from './Refs';import {SIZE} from './SizeUtils';+import FastImage from "react-native-fast-image";+const imgNames = [+ "favorites",+ "notes",+ "notebooks",+ "tags",+ "trash",+ "login",+ "welcome",+ "vault",+ "accent",+ "settings",+ "backup",+ "community",+ "export",+ "organize",+ "privacy",+ "sync",+ "richtext",++];+const BaseURI = (img,color) => `https://github.com/ammarahm-ed/notesnook/raw/main/assets/${img}-${color.replace(+ '#',+ '%23',+)}.png`++++const allColors = [+ "#00c853",+ "#FF5722",+ "#FFA000",+ "#1B5E20",+ "#01c352",+ "#757575",+ "#0560ff",+ "#009688",+ "#2196F3",+ "#880E4F",+ "#9C27B0",+ "#9381ff",+ "#FF1744",+ "#B71C1C",+ "#ffadad",+];++const noteColors = [+ "#f44336",+ "#FF9800",+ "#FFD600",+ "#4CAF50",+ "#2196F3",+ "#673AB7",+ "#9E9E9E",+],++export function preloadImages(color) {+ let uri = imgNames.map(name => {+ return {+ uri:BaseURI(name,color)+ }+ });+ uri.concat(noteColors.map(color => {+ return {+ uri:BaseURI("notes",color)+ }+ }))+ console.log(uri);+ FastImage.preload(uri)+}++export const InteractionManager = {runAfterInteractions: (func, time = 400) => setTimeout(func, time),diff --git a/apps/mobile/src/views/Settings/index.js b/apps/mobile/src/views/Settings/index.jsindex 9d13c49dc..238fda4b1 100644--- a/apps/mobile/src/views/Settings/index.js+++ b/apps/mobile/src/views/Settings/index.js@@ -45,6 +45,7 @@ import {APP_VERSION,InteractionManager,MenuItemsList,+ preloadImages,SUBSCRIPTION_PROVIDER,SUBSCRIPTION_STATUS_STRINGS,} from '../../utils';@@ -944,6 +945,7 @@ const SettingsAppearanceSection = () => {onPress={async () => {await PremiumService.verify(async () => {changeAccentColor(item);+ preloadImages(item);await MMKV.setStringAsync('accentColor', item);});}}