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
fix linting issues
ammarahm-ede663bb66f57f
diff --git a/apps/mobile/.eslintrc.js b/apps/mobile/.eslintrc.jsindex 40c6dcd05..a55c26a7f 100644--- a/apps/mobile/.eslintrc.js+++ b/apps/mobile/.eslintrc.js@@ -1,4 +1,41 @@module.exports = {- root: true,- extends: '@react-native-community',+ parser: '@babel/eslint-parser',+ env: {+ browser: true,+ es2021: true,+ 'react-native/react-native': true+ },+ extends: ['eslint:recommended', 'plugin:react/recommended', 'plugin:prettier/recommended'],+ parserOptions: {+ ecmaFeatures: {+ jsx: true+ },+ ecmaVersion: 12,+ es6: true,+ sourceType: 'module'+ },+ plugins: ['react', 'react-native', 'prettier', 'unused-imports'],+ rules: {+ 'react/display-name': 0,+ 'no-unused-vars': 'off',+ 'unused-imports/no-unused-vars': [+ 'warn',+ {+ vars: 'all',+ varsIgnorePattern: '^_',+ args: 'after-used',+ argsIgnorePattern: '^_'+ }+ ],+ 'no-empty': 'off',+ 'react/prop-types': 0,+ 'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],+ 'prettier/prettier': [+ 'error',+ {},+ {+ usePrettierrc: true+ }+ ]+ }};diff --git a/apps/mobile/.prettierrc.js b/apps/mobile/.prettierrc.jsindex b64e4461b..4a66763d4 100644--- a/apps/mobile/.prettierrc.js+++ b/apps/mobile/.prettierrc.js@@ -1,7 +1,13 @@module.exports = {- bracketSpacing: false,- jsxBracketSameLine: true,- singleQuote: true,- trailingComma: 'none',arrowParens: 'avoid',+ bracketSpacing: true,+ jsxBracketSameLine: false,+ jsxSingleQuote: false,+ quoteProps: 'as-needed',+ singleQuote: true,+ semi: true,+ printWidth: 100,+ useTabs: false,+ tabWidth: 2,+ trailingComma: 'none'};diff --git a/apps/mobile/src/assets/images/assets.js b/apps/mobile/src/assets/images/assets.jsindex 79ddabe0b..d104b8995 100644--- a/apps/mobile/src/assets/images/assets.js+++ b/apps/mobile/src/assets/images/assets.js@@ -1,4 +1,5 @@-export const LAUNCH_ROCKET = color => `<svg xmlns="http://www.w3.org/2000/svg" data-name="Layer 1" width="748.82965" height="557.20035" viewBox="0 0 748.82965 557.20035" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M276.60133,642.057c-3.59968,0-7.20676.1709-10.72934.51563l-.51267.0498c-23.36542,2.37793-40.45611,16.17286-39.75323,32.08985l.13588,2.87793c.08961,1.81933.18508,3.77539.26367,5.94531.04255,1.07031,1.31106,1.8916,2.88946,1.8916H803.62751c40.52148-.2832,80.89606-.63965,119.9956-1.05957a177.65216,177.65216,0,0,0,21.95374-1.30957c10.86591-1.48047,18.40759-4.415,23.05841-8.97168h.00147c5.78332-5.65039,5.96551-12.76562,5.6159-20.80469-.71246-16.23242-1.419-33.28515-2.12414-50.28613-.62281-14.9834-1.24274-29.92676-1.86261-44.2334-.38343-8.49023-1.23536-15.98437-7.80317-21.71191-7.11865-6.19434-20.10137-9.334-38.58831-9.334-.22333,0-.44507,0-.67133.001-57.9361.23731-115.34192,23.1709-142.8454,57.06732-3.16711,3.90332-6.11822,8.082-8.97247,12.124a158.91584,158.91584,0,0,1-13.7804,17.66406,66.94863,66.94863,0,0,1-9.10321,8.16894c-.22326.17774-.47888.36817-.7492.54883-.61847.46387-1.26477.91114-1.895,1.30957a62.04148,62.04148,0,0,1-11.60926,6.07617l-.40692.15723c-.30627.126-.6383.252-.97027.36719a68.20886,68.20886,0,0,1-7.17,2.20605c-10.484,2.66016-22.40545,3.29785-35.43151,1.89356a151.75182,151.75182,0,0,1-35.2295-8.26465c-12.06244-4.38867-23.3529-9.86035-34.27173-15.15137-4.79614-2.32519-9.75683-4.72851-14.711-7.00586-.93134-.42871-1.84723-.84765-2.7771-1.2666-6.05066-2.71484-11.5365-4.957-16.77045-6.85449a146.28118,146.28118,0,0,0-39.96478-8.52149c-14.40918-.9082-27.10688.80469-37.73191,5.07911a60.6496,60.6496,0,0,0-8.53469,4.23339c-12.58466,7.52344-20.343,18.627-27.845,29.36524-9.33233,13.35644-18.98275,27.16894-38.0382,34.3291-21.98825,8.26953-54.08371,4.834-76.791-1.14062-7.13919-1.87891-14.26956-4.04-21.16565-6.13086q-4.17768-1.26719-8.36136-2.51661c-5.48071-1.6289-9.96621-2.877-14.116-3.93066l-1.31253-.33594c-.73008-.18261-1.46088-.36523-2.20493-.53906-4.92911-1.19141-9.51892-2.12891-14.03891-2.86621l-1.06943-.17969c-2.144-.32519-4.14834-.5957-6.11526-.82324l-.78516-.08984A109.23844,109.23844,0,0,0,276.60133,642.057Z" transform="translate(-225.58517 -171.39982)" fill="#f2f2f2"/><path d="M343.64,685.3514a1.19069,1.19069,0,0,1,1.18683-1.19452h510.294a1.19069,1.19069,0,0,1,0,2.38135h-510.294A1.19066,1.19066,0,0,1,343.64,685.3514Z" transform="translate(-225.58517 -171.39982)" fill="#cacaca"/><path d="M746.00469,214.43986a42.86006,42.86006,0,0,1-11.46,29.24c-.56.61-1.15,1.2-1.75,1.77a650.40347,650.40347,0,0,0-69.84-46.89c.3-.76.62-1.51.97-2.25a43.04295,43.04295,0,0,1,82.08,18.13Z" transform="translate(-225.58517 -171.39982)" fill="#ff6584"/><path d="M780.91466,302.03984l-.04.45q-42.465-2.925-84.92-5.86c-20.45-1.41-41.61-3.01-59.68-12.69-6.86005-3.67-13.54-8.57-21.32-8.91-9.65-.43-18.07,6.32-24.69,13.36-39.13,41.68-50.46,105.41-94.36,142.02a1394.13755,1394.13755,0,0,1,98.86-197.31c7.04-11.65,15.39-24.09,28.46-27.89,12.47-3.63,25.23,1.67,36.71,8.47,2.46,1.46,4.86,2.99,7.18,4.51q26.535,17.36994,52.2,36.06995Q750.82971,277.19487,780.91466,302.03984Z" transform="translate(-225.58517 -171.39982)" fill="#f2f2f2"/><path d="M872.47466,390.43986a670.65125,670.65125,0,0,0-104.75-116.27q-16.965-14.91-34.93-28.72a650.40347,650.40347,0,0,0-69.84-46.89q-11.94-6.93-24.16-13.31c-6.33-3.29-13.07-6.3-20.37-5.83a27.10218,27.10218,0,0,0-14.07,5.41c-8.97,6.55-14.91,16.78-19.8,26.53-4.28,8.55-8.27,17.27-12.34,25.94-1.73,3.69-3.46,7.37-5.25,11.03q-9.36008,19.23-19.16,38.25-12.63,24.51-25.99,48.65-28.065,50.745-59.23,99.66-45.81006,71.895-98.02,139.43c-4.27,5.51-6.03,6.79-10.36,12.26-1,1.28-2.78-.52-1.79-1.79,36.11005-45.64,67.55005-88.76,99.25-137.58q35.85-55.215,67.76-112.88,10.245-18.49494,20.06-37.22,15.885-30.315,30.67-61.2,3.9-8.13,7.72-16.32c8.09-17.33,19.87-43.1,42.62-42.75,6.69.1,12.9,2.81,18.76,5.81,5.97,3.07,11.83,6.33,17.68,9.64q3.51,1.98,6.99,4.02,13.785,8.00994,27.16,16.69,22.32,14.47494,43.46,30.68,10.035,7.695,19.77,15.74a673.54712,673.54712,0,0,1,109.09,114.31q5.74493,7.635,11.25,15.44C875.59472,390.49986,873.40472,391.75981,872.47466,390.43986Z" transform="translate(-225.58517 -171.39982)" fill="#e4e4e4"/><path d="M769.97685,261.4421c1.32186-1.47358,2.63549-2.94715,3.966-4.42072C784.43462,245.418,795.6924,233.94944,810.1,227.2973a52.4571,52.4571,0,0,1,21.97735-5.09434c7.86453.02529,15.55227,2.08825,22.819,4.97649,3.43559,1.37253,6.79554,2.93029,10.10449,4.58908,3.781,1.903,7.4945,3.93237,11.19076,5.97852q10.40791,5.75957,20.54571,12.02432,20.17137,12.46641,39.07925,26.83584,9.80167,7.45209,19.19878,15.39253,8.74029,7.37624,17.127,15.14831c1.19563,1.10307,2.98086-.68205,1.78523-1.78512-1.47357-1.37253-2.964-2.73664-4.45443-4.08388q-6.31532-5.70906-12.8329-11.19919-11.885-10.0287-24.38547-19.2827-19.43869-14.39893-40.21568-26.84427-10.38264-6.21425-21.051-11.90647c-2.14745-1.14516-4.32-2.26509-6.51759-3.32607a103.89918,103.89918,0,0,0-15.49347-6.30688,55.11725,55.11725,0,0,0-23.40035-2.29875,60.92335,60.92335,0,0,0-21.59005,7.46889c-14.14612,7.90678-25.11773,20.13318-35.795,32.06494C767.11358,260.86109,768.89058,262.65464,769.97685,261.4421Z" transform="translate(-225.58517 -171.39982)" fill="#e4e4e4"/><path d="M480.12667,381.68342l-33.89782-12.39828-16.83038-6.15579c-5.48137-2.00484-10.94957-4.28719-16.616-5.72275a26.21362,26.21362,0,0,0-15.03952.19162,34.66256,34.66256,0,0,0-11.73046,7.27166,95.19524,95.19524,0,0,0-9.62144,10.275c-3.66428,4.40365-7.27444,8.85345-10.90079,13.28835q-22.45,27.45558-44.6064,55.14948-22.1559,27.69344-44.01554,55.62218-21.91307,27.997-43.52474,56.22818-2.64747,3.45842-5.2904,6.92031c-.97346,1.275-3.16844.018-2.18124-1.275q21.77112-28.515,43.84571-56.79666,22.1289-28.3492,44.56359-56.45793,22.43425-28.10817,45.17171-55.97256,5.66458-6.94185,11.34787-13.86842c3.196-3.89521,6.356-7.83243,9.86155-11.45793,6.43462-6.65486,14.47386-12.536,24.09692-12.69554,5.65786-.09382,11.13345,1.70155,16.3902,3.60326,5.667,2.05012,11.32041,4.1386,16.98015,6.20868l34.13486,12.485,8.53372,3.12124c1.51441.55391.8602,2.99613-.67154,2.43589Z" transform="translate(-225.58517 -171.39982)" fill="#e4e4e4"/><path d="M814.56088,241.89784c17.22612-8.85335,39.28657-7.11936,55.11616,3.94157a786.11526,786.11526,0,0,0-89.43729,20.87423C792.44014,259.5639,801.98377,248.36189,814.56088,241.89784Z" transform="translate(-225.58517 -171.39982)" fill="#f2f2f2"/><path d="M869.84659,245.80893l3.31625,2.69552c-1.12172-.94344-2.28786-1.828-3.4858-2.665C869.73362,245.82965,869.79,245.8187,869.84659,245.80893Z" transform="translate(-225.58517 -171.39982)" fill="#f2f2f2"/><path d="M387.28886,381.80727c3.33682-4.06177,6.94448-8.31469,11.93551-9.96449l4.65975.18379A528.5525,528.5525,0,0,1,263.10428,532.971Q325.19657,457.38918,387.28886,381.80727Z" transform="translate(-225.58517 -171.39982)" fill="#f2f2f2"/><path d="M736.79357,610.34291l-28.21714-12.44874V587.19183l10.0561-.05651a7.46918,7.46918,0,0,0,7.044-5.10714l7.06437-21.193a7.46924,7.46924,0,0,0-7.08594-9.83122h-17.0785v-9.959h21.44024a7.46925,7.46925,0,0,0,7.27937-5.79584l4.865-21.16286a7.46923,7.46923,0,0,0-7.27937-9.14265H708.57643v-2.48975a4.97949,4.97949,0,0,0-9.959,0v2.48975H522.26028v-2.48975a4.9795,4.9795,0,0,0-9.959,0v2.48975h-20.9108a7.46923,7.46923,0,0,0-7.27937,9.14265l4.865,21.16286a7.46925,7.46925,0,0,0,7.27937,5.79584h16.04578v9.959H500.617a7.46923,7.46923,0,0,0-7.10927,9.76L500.7181,583.141a7.46925,7.46925,0,0,0,7.15123,5.17837l4.432-.0249v9.59968l-22.82269,12.44874a7.46922,7.46922,0,0,0-7.46924,7.46922v0a7.46925,7.46925,0,0,0,7.46924,7.46925h22.82269v54.77446a4.9795,4.9795,0,0,0,9.959,0V625.2814H698.61744v54.77446a4.9795,4.9795,0,0,0,9.959,0V625.2814h28.21714a7.46925,7.46925,0,0,0,7.46925-7.46925v0A7.46922,7.46922,0,0,0,736.79357,610.34291Zm-214.53329-69.298H698.61744v9.959H522.26028Zm0,56.84925v-9.65563l176.35716-.99076v10.64639Z" transform="translate(-225.58517 -171.39982)" fill="#ccc"/><path d="M315.95555,589.21408l7.98486-26.00457a87.77022,87.77022,0,0,0-35.0839-23.50552c13.12443,21.74329.40683,50.10772,5.70643,74.94591a52.79391,52.79391,0,0,0,28.27717,35.97783l12.11706,15.0135a88.46589,88.46589,0,0,0,6.50218-73.78667,85.453,85.453,0,0,0-9.89442-19.0176C324.36444,581.302,315.95555,589.21408,315.95555,589.21408Z" transform="translate(-225.58517 -171.39982)" fill="#f2f2f2"/><path d="M272.05023,592.53665l-4.45075-26.83629a87.7702,87.7702,0,0,0-41.8846-5.39169c21.444,13.60792,22.71121,44.6671,38.53194,64.53481a52.79391,52.79391,0,0,0,41.3547,19.59061l17.541,8.03374a88.466,88.466,0,0,0-27.08773-68.942,85.45248,85.45248,0,0,0-17.3374-12.60883C276.04789,581.70478,272.05023,592.53665,272.05023,592.53665Z" transform="translate(-225.58517 -171.39982)" fill="#f2f2f2"/><path d="M902.5106,479.11845,885.044,458.26383a87.77019,87.77019,0,0,1,23.18573-35.29606c-3.63882,25.13524,19.10562,46.32412,23.87929,71.26873a52.79386,52.79386,0,0,1-12.06557,44.141l-5.327,18.54322a88.4659,88.4659,0,0,1-34.67683-65.45432,85.45238,85.45238,0,0,1,1.72257-21.36823C891.68721,475.0979,902.5106,479.11845,902.5106,479.11845Z" transform="translate(-225.58517 -171.39982)" fill="#f2f2f2"/><path d="M944.2538,465.1105,937.92125,438.655a87.77005,87.77005,0,0,1,36.49358-21.25108c-14.46674,20.87426-3.55934,49.98279-10.41151,74.43825a52.79393,52.79393,0,0,1-30.48523,34.127l-13.03785,14.2212a88.46591,88.46591,0,0,1-1.84586-74.0496,85.45328,85.45328,0,0,1,11.0716-18.35724C936.35949,456.68492,944.2538,465.1105,944.2538,465.1105Z" transform="translate(-225.58517 -171.39982)" fill="#f2f2f2"/><polygon points="373.867 536.045 362.393 541.58 335.583 499.958 352.517 491.789 373.867 536.045" fill="#ffb6b6"/><path d="M600.74559,539.92239,590.54818,555.309s-60.63447,40.15326-58.10323,55.09015c.88547,5.22518,4.73286,16.21626,9.68184,28.46477,1.52072,3.76372,8.6663,11.24446,10.34108,15.11482,8.45541,19.54026,12.66545,35.17435,16.72606,37.26588,4.50965,2.33785,4.0477.48289,6.81076,4.74524l16-6s2.492-5.59411,3.72976-8.36482-.70312-4.14914-.70312-4.14914-2.34884,1.25171-1.9409-1.37838.26732-3.45993-.70312-4.14914-4.72555-7.73579-4.72555-7.73579a69.82223,69.82223,0,0,1-8.19389-16.23385c-.89266-2.521-.8037-8.56182-2-11-2.52046-5.13691-3.41208-8.92851-7.48445-11.59957,0,0,51.26687-24.90725,56.0774-36.82s-.13917-51.19588-.13917-51.19588Z" transform="translate(-225.58517 -171.39982)" fill="#2f2e41"/><path d="M605.53555,713.49,566.738,728.60018l-.19114-.49072A16.2068,16.2068,0,0,1,575.766,707.127l.001-.00038,4.99263-8.13674,15.31681.227,3.38679-1.319Z" transform="translate(-225.58517 -171.39982)" fill="#2f2e41"/><polygon points="470.462 475.448 489.209 474.029 486.873 523.483 474.17 524.444 470.462 475.448" fill="#ffb6b6"/><path d="M593.02692,553.52922c-4.3106-18.98155,7.83714,37.61669,20.4366,48.19854,4.95423,4.16091,25.69256-.14621,42.8621,1.16619a87.67112,87.67112,0,0,1,30.31954,8.23641c-2.73885,4.99134.12692,12.43982.6598,19.13657.97215,12.21694,1.951,23.45149,1.951,23.45149s-.00949,7.98466-.54308,9.04866-.26835,1.86279,1.326,3.99393-1.06716,2.12794-1.06716,2.12794-1.06715,2.128,1.326,3.99393,8.07377,7.30057,8.07377,7.30057l15.2371-1.353c.44-5.06062,1.75485-5.72611,4.64021-9.90671,2.74584-3.95613,2.11713-27.69491.18239-49.97665-.13112-1.5101,1.975-6.26147,1.83251-7.75157-1.42952-14.95072-5.64132-25.31417-7.49858-30.90816-1.28141-3.85954-7.43466-7.18789-15.75192-9.99213-1.26923-.42794-2.58886-.84367-3.94927-1.24722-22.9351-6.80347-57.45854-10.145-57.45854-10.145l-18.87706-16.79029Z" transform="translate(-225.58517 -171.39982)" fill="#2f2e41"/><path d="M698.047,693.13029l3.44938-1.14538,11.64877-9.948,9.036,3.07948.001-.00032a16.2068,16.2068,0,0,1,20.48676,10.27369l.16594.49981-39.51465,13.1209Z" transform="translate(-225.58517 -171.39982)" fill="#2f2e41"/><path d="M610.42386,444.23228l-11.34,8.635-13.676,4.20263s-5.65377,79.52833-10.74813,84.62269-.49987,5.23128-1.52352,11.84916-3.51168,20.18377-3.51168,20.18377c34.38707,18.20258,64.03233,18.69086,87.845-2.60926a5.93117,5.93117,0,0,0-3.23608-6.69462c-4.43194-2.35163,4.08556-13.32756.4636-15.16273s1.47241-17.755,1.47241-17.755l-3.34187-33.21557,2.64024-5.30957-6.44317-32.48858-11.18013-4.083-4.466-10.76026Z" transform="translate(-225.58517 -171.39982)" fill="${color}"/><circle cx="396.44756" cy="245.59574" r="22.43078" fill="#ffb6b6"/><path d="M603.31993,585.581a9.8303,9.8303,0,0,0-11.20736-10.08022l-15.98166-31.06366L567.227,560.25692l16.54148,27.07327a9.88361,9.88361,0,0,0,19.55136-1.74918Z" transform="translate(-225.58517 -171.39982)" fill="#ffb6b6"/><path d="M576.40552,577.98205l-34.27838-53.12743.11315-.24444c.12942-.28007,7.89169-17.0446,15.413-32.39983,1.15826-2.36467,2.31081-4.69592,3.42889-6.9284q.72381-1.44525,1.42605-2.83006c3.159-6.22783,5.919-11.37528,7.56649-13.8204A29.01536,29.01536,0,0,1,585.45,456.96784l.15859-.04078.15141.06312a14.72433,14.72433,0,0,1,8.76284,16.19753,104.296,104.296,0,0,1-19.35291,43.755l-5.557,7.32473,19.31154,41.98522Z" transform="translate(-225.58517 -171.39982)" fill="${color}"/><path d="M665.672,597.791v1.42726a3.15238,3.15238,0,0,1-3.1517,3.15168H557.69779a3.15237,3.15237,0,0,1-3.1517-3.15168V597.791a3.15235,3.15235,0,0,1,3.1517-3.15167H559.559a2.65083,2.65083,0,0,1-.10157-.70776V540.43129a2.645,2.645,0,0,1,2.64324-2.64334h96.01673a2.645,2.645,0,0,1,2.64325,2.64334v53.50028a2.49845,2.49845,0,0,1-.10158.70776h1.8612A3.15235,3.15235,0,0,1,665.672,597.791Z" transform="translate(-225.58517 -171.39982)" fill="#3f3d56"/><path d="M612.17439,568.01513a5.99072,5.99072,0,1,1,5.99071-5.99072A5.99747,5.99747,0,0,1,612.17439,568.01513Zm0-10.94882a4.95811,4.95811,0,1,0,4.9581,4.9581A4.96375,4.96375,0,0,0,612.17439,557.06631Z" transform="translate(-225.58517 -171.39982)" fill="#fff"/><circle cx="384.52404" cy="388.55935" r="5.47437" fill="#fff"/><path d="M694.27889,374.33627a9.83029,9.83029,0,0,0,2.35881,14.888l-7.14559,34.1951,16.87861-6.68267,4.19795-31.44773A9.88361,9.88361,0,0,0,694.279,374.33631Z" transform="translate(-225.58517 -171.39982)" fill="#ffb6b6"/><path d="M710.402,397.18741l-6.82552,62.85653-.24182.11865c-.19928.09793-8.84664,4.33935-19.46132,9.3906-1.79066.85213-1.534,4.54333-3.40547,5.42554-1.28914.60769-4.69342-1.5973-5.996-.98816-11.6023,5.42574-23.33421,10.70159-28.00981,12.13114a29.01531,29.01531,0,0,1-19.2887-.621l-.14887-.06818-.07788-.14438a14.72433,14.72433,0,0,1,3.39225-18.10082,104.29609,104.29609,0,0,1,42.58656-21.80405l8.92931-2.19087,11.43611-44.77622Z" transform="translate(-225.58517 -171.39982)" fill="${color}"/><path d="M672.18567,373.68221l2.56841,23.30916A2.84507,2.84507,0,0,0,677.47344,399h11.83939a2.84516,2.84516,0,0,0,2.71966-2.00863l2.12733-17.86534A4.32088,4.32088,0,1,0,695.274,370.998a2.8198,2.8198,0,0,0-2.15867-.998h-18.21A2.84558,2.84558,0,0,0,672.18567,373.68221Zm22.34593,4.23569,1.303-4.23569a2.8158,2.8158,0,0,0,.04308-1.506c.05574-.003.10816-.01661.1645-.01661a3.08511,3.08511,0,0,1,0,6.17022A3.04612,3.04612,0,0,1,694.5316,377.9179Z" transform="translate(-225.58517 -171.39982)" fill="#3f3d56"/><path d="M640.30289,397.72555c-1.84465-5.36654-11.02746-9.08881-25.91418-9.60638s-18.66227,17.02576-18.66227,17.02576c-9.938,8.06174,10.61182,29.64505,11.606,28.86767l-.447-4.05508C606.1452,423.24079,603,418,607,411l3.841.0441q7.441,1.43086,14.882,2.8617l-5.87291-5.17092.1656-.25624a22.7265,22.7265,0,0,0,8.01667,2.43412c3.15652.18554,6.6074-1.0707,8.11933-3.84781a6.46562,6.46562,0,0,0,.72539-2.46008c4.25656,1.70064,6.203,6.94811,6.203,6.94811S642.14753,403.09209,640.30289,397.72555Z" transform="translate(-225.58517 -171.39982)" fill="#2f2e41"/></svg>`+export const LAUNCH_ROCKET = color =>+ `<svg xmlns="http://www.w3.org/2000/svg" data-name="Layer 1" width="748.82965" height="557.20035" viewBox="0 0 748.82965 557.20035" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M276.60133,642.057c-3.59968,0-7.20676.1709-10.72934.51563l-.51267.0498c-23.36542,2.37793-40.45611,16.17286-39.75323,32.08985l.13588,2.87793c.08961,1.81933.18508,3.77539.26367,5.94531.04255,1.07031,1.31106,1.8916,2.88946,1.8916H803.62751c40.52148-.2832,80.89606-.63965,119.9956-1.05957a177.65216,177.65216,0,0,0,21.95374-1.30957c10.86591-1.48047,18.40759-4.415,23.05841-8.97168h.00147c5.78332-5.65039,5.96551-12.76562,5.6159-20.80469-.71246-16.23242-1.419-33.28515-2.12414-50.28613-.62281-14.9834-1.24274-29.92676-1.86261-44.2334-.38343-8.49023-1.23536-15.98437-7.80317-21.71191-7.11865-6.19434-20.10137-9.334-38.58831-9.334-.22333,0-.44507,0-.67133.001-57.9361.23731-115.34192,23.1709-142.8454,57.06732-3.16711,3.90332-6.11822,8.082-8.97247,12.124a158.91584,158.91584,0,0,1-13.7804,17.66406,66.94863,66.94863,0,0,1-9.10321,8.16894c-.22326.17774-.47888.36817-.7492.54883-.61847.46387-1.26477.91114-1.895,1.30957a62.04148,62.04148,0,0,1-11.60926,6.07617l-.40692.15723c-.30627.126-.6383.252-.97027.36719a68.20886,68.20886,0,0,1-7.17,2.20605c-10.484,2.66016-22.40545,3.29785-35.43151,1.89356a151.75182,151.75182,0,0,1-35.2295-8.26465c-12.06244-4.38867-23.3529-9.86035-34.27173-15.15137-4.79614-2.32519-9.75683-4.72851-14.711-7.00586-.93134-.42871-1.84723-.84765-2.7771-1.2666-6.05066-2.71484-11.5365-4.957-16.77045-6.85449a146.28118,146.28118,0,0,0-39.96478-8.52149c-14.40918-.9082-27.10688.80469-37.73191,5.07911a60.6496,60.6496,0,0,0-8.53469,4.23339c-12.58466,7.52344-20.343,18.627-27.845,29.36524-9.33233,13.35644-18.98275,27.16894-38.0382,34.3291-21.98825,8.26953-54.08371,4.834-76.791-1.14062-7.13919-1.87891-14.26956-4.04-21.16565-6.13086q-4.17768-1.26719-8.36136-2.51661c-5.48071-1.6289-9.96621-2.877-14.116-3.93066l-1.31253-.33594c-.73008-.18261-1.46088-.36523-2.20493-.53906-4.92911-1.19141-9.51892-2.12891-14.03891-2.86621l-1.06943-.17969c-2.144-.32519-4.14834-.5957-6.11526-.82324l-.78516-.08984A109.23844,109.23844,0,0,0,276.60133,642.057Z" transform="translate(-225.58517 -171.39982)" fill="#f2f2f2"/><path d="M343.64,685.3514a1.19069,1.19069,0,0,1,1.18683-1.19452h510.294a1.19069,1.19069,0,0,1,0,2.38135h-510.294A1.19066,1.19066,0,0,1,343.64,685.3514Z" transform="translate(-225.58517 -171.39982)" fill="#cacaca"/><path d="M746.00469,214.43986a42.86006,42.86006,0,0,1-11.46,29.24c-.56.61-1.15,1.2-1.75,1.77a650.40347,650.40347,0,0,0-69.84-46.89c.3-.76.62-1.51.97-2.25a43.04295,43.04295,0,0,1,82.08,18.13Z" transform="translate(-225.58517 -171.39982)" fill="#ff6584"/><path d="M780.91466,302.03984l-.04.45q-42.465-2.925-84.92-5.86c-20.45-1.41-41.61-3.01-59.68-12.69-6.86005-3.67-13.54-8.57-21.32-8.91-9.65-.43-18.07,6.32-24.69,13.36-39.13,41.68-50.46,105.41-94.36,142.02a1394.13755,1394.13755,0,0,1,98.86-197.31c7.04-11.65,15.39-24.09,28.46-27.89,12.47-3.63,25.23,1.67,36.71,8.47,2.46,1.46,4.86,2.99,7.18,4.51q26.535,17.36994,52.2,36.06995Q750.82971,277.19487,780.91466,302.03984Z" transform="translate(-225.58517 -171.39982)" fill="#f2f2f2"/><path d="M872.47466,390.43986a670.65125,670.65125,0,0,0-104.75-116.27q-16.965-14.91-34.93-28.72a650.40347,650.40347,0,0,0-69.84-46.89q-11.94-6.93-24.16-13.31c-6.33-3.29-13.07-6.3-20.37-5.83a27.10218,27.10218,0,0,0-14.07,5.41c-8.97,6.55-14.91,16.78-19.8,26.53-4.28,8.55-8.27,17.27-12.34,25.94-1.73,3.69-3.46,7.37-5.25,11.03q-9.36008,19.23-19.16,38.25-12.63,24.51-25.99,48.65-28.065,50.745-59.23,99.66-45.81006,71.895-98.02,139.43c-4.27,5.51-6.03,6.79-10.36,12.26-1,1.28-2.78-.52-1.79-1.79,36.11005-45.64,67.55005-88.76,99.25-137.58q35.85-55.215,67.76-112.88,10.245-18.49494,20.06-37.22,15.885-30.315,30.67-61.2,3.9-8.13,7.72-16.32c8.09-17.33,19.87-43.1,42.62-42.75,6.69.1,12.9,2.81,18.76,5.81,5.97,3.07,11.83,6.33,17.68,9.64q3.51,1.98,6.99,4.02,13.785,8.00994,27.16,16.69,22.32,14.47494,43.46,30.68,10.035,7.695,19.77,15.74a673.54712,673.54712,0,0,1,109.09,114.31q5.74493,7.635,11.25,15.44C875.59472,390.49986,873.40472,391.75981,872.47466,390.43986Z" transform="translate(-225.58517 -171.39982)" fill="#e4e4e4"/><path d="M769.97685,261.4421c1.32186-1.47358,2.63549-2.94715,3.966-4.42072C784.43462,245.418,795.6924,233.94944,810.1,227.2973a52.4571,52.4571,0,0,1,21.97735-5.09434c7.86453.02529,15.55227,2.08825,22.819,4.97649,3.43559,1.37253,6.79554,2.93029,10.10449,4.58908,3.781,1.903,7.4945,3.93237,11.19076,5.97852q10.40791,5.75957,20.54571,12.02432,20.17137,12.46641,39.07925,26.83584,9.80167,7.45209,19.19878,15.39253,8.74029,7.37624,17.127,15.14831c1.19563,1.10307,2.98086-.68205,1.78523-1.78512-1.47357-1.37253-2.964-2.73664-4.45443-4.08388q-6.31532-5.70906-12.8329-11.19919-11.885-10.0287-24.38547-19.2827-19.43869-14.39893-40.21568-26.84427-10.38264-6.21425-21.051-11.90647c-2.14745-1.14516-4.32-2.26509-6.51759-3.32607a103.89918,103.89918,0,0,0-15.49347-6.30688,55.11725,55.11725,0,0,0-23.40035-2.29875,60.92335,60.92335,0,0,0-21.59005,7.46889c-14.14612,7.90678-25.11773,20.13318-35.795,32.06494C767.11358,260.86109,768.89058,262.65464,769.97685,261.4421Z" transform="translate(-225.58517 -171.39982)" fill="#e4e4e4"/><path d="M480.12667,381.68342l-33.89782-12.39828-16.83038-6.15579c-5.48137-2.00484-10.94957-4.28719-16.616-5.72275a26.21362,26.21362,0,0,0-15.03952.19162,34.66256,34.66256,0,0,0-11.73046,7.27166,95.19524,95.19524,0,0,0-9.62144,10.275c-3.66428,4.40365-7.27444,8.85345-10.90079,13.28835q-22.45,27.45558-44.6064,55.14948-22.1559,27.69344-44.01554,55.62218-21.91307,27.997-43.52474,56.22818-2.64747,3.45842-5.2904,6.92031c-.97346,1.275-3.16844.018-2.18124-1.275q21.77112-28.515,43.84571-56.79666,22.1289-28.3492,44.56359-56.45793,22.43425-28.10817,45.17171-55.97256,5.66458-6.94185,11.34787-13.86842c3.196-3.89521,6.356-7.83243,9.86155-11.45793,6.43462-6.65486,14.47386-12.536,24.09692-12.69554,5.65786-.09382,11.13345,1.70155,16.3902,3.60326,5.667,2.05012,11.32041,4.1386,16.98015,6.20868l34.13486,12.485,8.53372,3.12124c1.51441.55391.8602,2.99613-.67154,2.43589Z" transform="translate(-225.58517 -171.39982)" fill="#e4e4e4"/><path d="M814.56088,241.89784c17.22612-8.85335,39.28657-7.11936,55.11616,3.94157a786.11526,786.11526,0,0,0-89.43729,20.87423C792.44014,259.5639,801.98377,248.36189,814.56088,241.89784Z" transform="translate(-225.58517 -171.39982)" fill="#f2f2f2"/><path d="M869.84659,245.80893l3.31625,2.69552c-1.12172-.94344-2.28786-1.828-3.4858-2.665C869.73362,245.82965,869.79,245.8187,869.84659,245.80893Z" transform="translate(-225.58517 -171.39982)" fill="#f2f2f2"/><path d="M387.28886,381.80727c3.33682-4.06177,6.94448-8.31469,11.93551-9.96449l4.65975.18379A528.5525,528.5525,0,0,1,263.10428,532.971Q325.19657,457.38918,387.28886,381.80727Z" transform="translate(-225.58517 -171.39982)" fill="#f2f2f2"/><path d="M736.79357,610.34291l-28.21714-12.44874V587.19183l10.0561-.05651a7.46918,7.46918,0,0,0,7.044-5.10714l7.06437-21.193a7.46924,7.46924,0,0,0-7.08594-9.83122h-17.0785v-9.959h21.44024a7.46925,7.46925,0,0,0,7.27937-5.79584l4.865-21.16286a7.46923,7.46923,0,0,0-7.27937-9.14265H708.57643v-2.48975a4.97949,4.97949,0,0,0-9.959,0v2.48975H522.26028v-2.48975a4.9795,4.9795,0,0,0-9.959,0v2.48975h-20.9108a7.46923,7.46923,0,0,0-7.27937,9.14265l4.865,21.16286a7.46925,7.46925,0,0,0,7.27937,5.79584h16.04578v9.959H500.617a7.46923,7.46923,0,0,0-7.10927,9.76L500.7181,583.141a7.46925,7.46925,0,0,0,7.15123,5.17837l4.432-.0249v9.59968l-22.82269,12.44874a7.46922,7.46922,0,0,0-7.46924,7.46922v0a7.46925,7.46925,0,0,0,7.46924,7.46925h22.82269v54.77446a4.9795,4.9795,0,0,0,9.959,0V625.2814H698.61744v54.77446a4.9795,4.9795,0,0,0,9.959,0V625.2814h28.21714a7.46925,7.46925,0,0,0,7.46925-7.46925v0A7.46922,7.46922,0,0,0,736.79357,610.34291Zm-214.53329-69.298H698.61744v9.959H522.26028Zm0,56.84925v-9.65563l176.35716-.99076v10.64639Z" transform="translate(-225.58517 -171.39982)" fill="#ccc"/><path d="M315.95555,589.21408l7.98486-26.00457a87.77022,87.77022,0,0,0-35.0839-23.50552c13.12443,21.74329.40683,50.10772,5.70643,74.94591a52.79391,52.79391,0,0,0,28.27717,35.97783l12.11706,15.0135a88.46589,88.46589,0,0,0,6.50218-73.78667,85.453,85.453,0,0,0-9.89442-19.0176C324.36444,581.302,315.95555,589.21408,315.95555,589.21408Z" transform="translate(-225.58517 -171.39982)" fill="#f2f2f2"/><path d="M272.05023,592.53665l-4.45075-26.83629a87.7702,87.7702,0,0,0-41.8846-5.39169c21.444,13.60792,22.71121,44.6671,38.53194,64.53481a52.79391,52.79391,0,0,0,41.3547,19.59061l17.541,8.03374a88.466,88.466,0,0,0-27.08773-68.942,85.45248,85.45248,0,0,0-17.3374-12.60883C276.04789,581.70478,272.05023,592.53665,272.05023,592.53665Z" transform="translate(-225.58517 -171.39982)" fill="#f2f2f2"/><path d="M902.5106,479.11845,885.044,458.26383a87.77019,87.77019,0,0,1,23.18573-35.29606c-3.63882,25.13524,19.10562,46.32412,23.87929,71.26873a52.79386,52.79386,0,0,1-12.06557,44.141l-5.327,18.54322a88.4659,88.4659,0,0,1-34.67683-65.45432,85.45238,85.45238,0,0,1,1.72257-21.36823C891.68721,475.0979,902.5106,479.11845,902.5106,479.11845Z" transform="translate(-225.58517 -171.39982)" fill="#f2f2f2"/><path d="M944.2538,465.1105,937.92125,438.655a87.77005,87.77005,0,0,1,36.49358-21.25108c-14.46674,20.87426-3.55934,49.98279-10.41151,74.43825a52.79393,52.79393,0,0,1-30.48523,34.127l-13.03785,14.2212a88.46591,88.46591,0,0,1-1.84586-74.0496,85.45328,85.45328,0,0,1,11.0716-18.35724C936.35949,456.68492,944.2538,465.1105,944.2538,465.1105Z" transform="translate(-225.58517 -171.39982)" fill="#f2f2f2"/><polygon points="373.867 536.045 362.393 541.58 335.583 499.958 352.517 491.789 373.867 536.045" fill="#ffb6b6"/><path d="M600.74559,539.92239,590.54818,555.309s-60.63447,40.15326-58.10323,55.09015c.88547,5.22518,4.73286,16.21626,9.68184,28.46477,1.52072,3.76372,8.6663,11.24446,10.34108,15.11482,8.45541,19.54026,12.66545,35.17435,16.72606,37.26588,4.50965,2.33785,4.0477.48289,6.81076,4.74524l16-6s2.492-5.59411,3.72976-8.36482-.70312-4.14914-.70312-4.14914-2.34884,1.25171-1.9409-1.37838.26732-3.45993-.70312-4.14914-4.72555-7.73579-4.72555-7.73579a69.82223,69.82223,0,0,1-8.19389-16.23385c-.89266-2.521-.8037-8.56182-2-11-2.52046-5.13691-3.41208-8.92851-7.48445-11.59957,0,0,51.26687-24.90725,56.0774-36.82s-.13917-51.19588-.13917-51.19588Z" transform="translate(-225.58517 -171.39982)" fill="#2f2e41"/><path d="M605.53555,713.49,566.738,728.60018l-.19114-.49072A16.2068,16.2068,0,0,1,575.766,707.127l.001-.00038,4.99263-8.13674,15.31681.227,3.38679-1.319Z" transform="translate(-225.58517 -171.39982)" fill="#2f2e41"/><polygon points="470.462 475.448 489.209 474.029 486.873 523.483 474.17 524.444 470.462 475.448" fill="#ffb6b6"/><path d="M593.02692,553.52922c-4.3106-18.98155,7.83714,37.61669,20.4366,48.19854,4.95423,4.16091,25.69256-.14621,42.8621,1.16619a87.67112,87.67112,0,0,1,30.31954,8.23641c-2.73885,4.99134.12692,12.43982.6598,19.13657.97215,12.21694,1.951,23.45149,1.951,23.45149s-.00949,7.98466-.54308,9.04866-.26835,1.86279,1.326,3.99393-1.06716,2.12794-1.06716,2.12794-1.06715,2.128,1.326,3.99393,8.07377,7.30057,8.07377,7.30057l15.2371-1.353c.44-5.06062,1.75485-5.72611,4.64021-9.90671,2.74584-3.95613,2.11713-27.69491.18239-49.97665-.13112-1.5101,1.975-6.26147,1.83251-7.75157-1.42952-14.95072-5.64132-25.31417-7.49858-30.90816-1.28141-3.85954-7.43466-7.18789-15.75192-9.99213-1.26923-.42794-2.58886-.84367-3.94927-1.24722-22.9351-6.80347-57.45854-10.145-57.45854-10.145l-18.87706-16.79029Z" transform="translate(-225.58517 -171.39982)" fill="#2f2e41"/><path d="M698.047,693.13029l3.44938-1.14538,11.64877-9.948,9.036,3.07948.001-.00032a16.2068,16.2068,0,0,1,20.48676,10.27369l.16594.49981-39.51465,13.1209Z" transform="translate(-225.58517 -171.39982)" fill="#2f2e41"/><path d="M610.42386,444.23228l-11.34,8.635-13.676,4.20263s-5.65377,79.52833-10.74813,84.62269-.49987,5.23128-1.52352,11.84916-3.51168,20.18377-3.51168,20.18377c34.38707,18.20258,64.03233,18.69086,87.845-2.60926a5.93117,5.93117,0,0,0-3.23608-6.69462c-4.43194-2.35163,4.08556-13.32756.4636-15.16273s1.47241-17.755,1.47241-17.755l-3.34187-33.21557,2.64024-5.30957-6.44317-32.48858-11.18013-4.083-4.466-10.76026Z" transform="translate(-225.58517 -171.39982)" fill="${color}"/><circle cx="396.44756" cy="245.59574" r="22.43078" fill="#ffb6b6"/><path d="M603.31993,585.581a9.8303,9.8303,0,0,0-11.20736-10.08022l-15.98166-31.06366L567.227,560.25692l16.54148,27.07327a9.88361,9.88361,0,0,0,19.55136-1.74918Z" transform="translate(-225.58517 -171.39982)" fill="#ffb6b6"/><path d="M576.40552,577.98205l-34.27838-53.12743.11315-.24444c.12942-.28007,7.89169-17.0446,15.413-32.39983,1.15826-2.36467,2.31081-4.69592,3.42889-6.9284q.72381-1.44525,1.42605-2.83006c3.159-6.22783,5.919-11.37528,7.56649-13.8204A29.01536,29.01536,0,0,1,585.45,456.96784l.15859-.04078.15141.06312a14.72433,14.72433,0,0,1,8.76284,16.19753,104.296,104.296,0,0,1-19.35291,43.755l-5.557,7.32473,19.31154,41.98522Z" transform="translate(-225.58517 -171.39982)" fill="${color}"/><path d="M665.672,597.791v1.42726a3.15238,3.15238,0,0,1-3.1517,3.15168H557.69779a3.15237,3.15237,0,0,1-3.1517-3.15168V597.791a3.15235,3.15235,0,0,1,3.1517-3.15167H559.559a2.65083,2.65083,0,0,1-.10157-.70776V540.43129a2.645,2.645,0,0,1,2.64324-2.64334h96.01673a2.645,2.645,0,0,1,2.64325,2.64334v53.50028a2.49845,2.49845,0,0,1-.10158.70776h1.8612A3.15235,3.15235,0,0,1,665.672,597.791Z" transform="translate(-225.58517 -171.39982)" fill="#3f3d56"/><path d="M612.17439,568.01513a5.99072,5.99072,0,1,1,5.99071-5.99072A5.99747,5.99747,0,0,1,612.17439,568.01513Zm0-10.94882a4.95811,4.95811,0,1,0,4.9581,4.9581A4.96375,4.96375,0,0,0,612.17439,557.06631Z" transform="translate(-225.58517 -171.39982)" fill="#fff"/><circle cx="384.52404" cy="388.55935" r="5.47437" fill="#fff"/><path d="M694.27889,374.33627a9.83029,9.83029,0,0,0,2.35881,14.888l-7.14559,34.1951,16.87861-6.68267,4.19795-31.44773A9.88361,9.88361,0,0,0,694.279,374.33631Z" transform="translate(-225.58517 -171.39982)" fill="#ffb6b6"/><path d="M710.402,397.18741l-6.82552,62.85653-.24182.11865c-.19928.09793-8.84664,4.33935-19.46132,9.3906-1.79066.85213-1.534,4.54333-3.40547,5.42554-1.28914.60769-4.69342-1.5973-5.996-.98816-11.6023,5.42574-23.33421,10.70159-28.00981,12.13114a29.01531,29.01531,0,0,1-19.2887-.621l-.14887-.06818-.07788-.14438a14.72433,14.72433,0,0,1,3.39225-18.10082,104.29609,104.29609,0,0,1,42.58656-21.80405l8.92931-2.19087,11.43611-44.77622Z" transform="translate(-225.58517 -171.39982)" fill="${color}"/><path d="M672.18567,373.68221l2.56841,23.30916A2.84507,2.84507,0,0,0,677.47344,399h11.83939a2.84516,2.84516,0,0,0,2.71966-2.00863l2.12733-17.86534A4.32088,4.32088,0,1,0,695.274,370.998a2.8198,2.8198,0,0,0-2.15867-.998h-18.21A2.84558,2.84558,0,0,0,672.18567,373.68221Zm22.34593,4.23569,1.303-4.23569a2.8158,2.8158,0,0,0,.04308-1.506c.05574-.003.10816-.01661.1645-.01661a3.08511,3.08511,0,0,1,0,6.17022A3.04612,3.04612,0,0,1,694.5316,377.9179Z" transform="translate(-225.58517 -171.39982)" fill="#3f3d56"/><path d="M640.30289,397.72555c-1.84465-5.36654-11.02746-9.08881-25.91418-9.60638s-18.66227,17.02576-18.66227,17.02576c-9.938,8.06174,10.61182,29.64505,11.606,28.86767l-.447-4.05508C606.1452,423.24079,603,418,607,411l3.841.0441q7.441,1.43086,14.882,2.8617l-5.87291-5.17092.1656-.25624a22.7265,22.7265,0,0,0,8.01667,2.43412c3.15652.18554,6.6074-1.0707,8.11933-3.84781a6.46562,6.46562,0,0,0,.72539-2.46008c4.25656,1.70064,6.203,6.94811,6.203,6.94811S642.14753,403.09209,640.30289,397.72555Z" transform="translate(-225.58517 -171.39982)" fill="#2f2e41"/></svg>`;export const FAV_SVG = color =>`<svg xmlns="http://www.w3.org/2000/svg" data-name="Layer 1" viewBox="0 0 922.18516 747.35665"><defs/><path fill="#3f3d56" d="M282.00406 237.24567c-2.67984 100.75634 131.62869 203.61052 299.27661 203.61052s434.62891-198.63676 307.83022-203.61052c-244.32514-9.5838-328.052-110.77046-303.55341-182.5 43.87495-128.46168-298.27681-15.88948-303.55342 182.5z"/><path fill="${color}" d="M505.004 157.445l-2.044-1.301 1.301-2.044-.558-.354-1.3 2.044-2.044-1.301-.355.557 2.044 1.301-1.301 2.044.558.355 1.3-2.044 2.044 1.3.355-.557zM657.004 305.445l-2.044-1.301 1.301-2.044-.558-.354-1.3 2.044-2.044-1.301-.355.557 2.044 1.301-1.301 2.044.558.355 1.3-2.044 2.044 1.3.355-.557zM411.004 287.445l-2.044-1.301 1.301-2.044-.558-.354-1.3 2.044-2.044-1.301-.355.557 2.044 1.301-1.301 2.044.558.355 1.3-2.044 2.044 1.3.355-.557zM595.004 383.445l-2.044-1.301 1.301-2.044-.558-.354-1.3 2.044-2.044-1.301-.355.557 2.044 1.301-1.301 2.044.558.355 1.3-2.044 2.044 1.3.355-.557zM424.004 346.445l-2.044-1.301 1.301-2.044-.558-.354-1.3 2.044-2.044-1.301-.355.557 2.044 1.301-1.301 2.044.558.355 1.3-2.044 2.044 1.3.355-.557zM836.004 297.445l-2.044-1.301 1.301-2.044-.558-.354-1.3 2.044-2.044-1.301-.355.557 2.044 1.301-1.301 2.044.558.355 1.3-2.044 2.044 1.3.355-.557zM382.004 176.445l-2.044-1.301 1.301-2.044-.558-.354-1.3 2.044-2.044-1.301-.355.557 2.044 1.301-1.301 2.044.558.355 1.3-2.044 2.044 1.3.355-.557z"/><path fill="#fff" d="M553.004 198.924l-2.862-1.82 1.821-2.862-.78-.496-1.821 2.861-2.861-1.821-.497.781 2.862 1.82-1.821 2.862.78.497 1.821-2.862 2.861 1.821.497-.781z"/><circle cx="450.00401" cy="233.74558" r="3" fill="${color}"/><circle cx="333.00401" cy="233.74558" r="3" fill="${color}"/><circle cx="537.00401" cy="123.74558" r="3" fill="${color}"/><circle cx="509.00401" cy="306.74558" r="3" fill="${color}"/><circle cx="507.00401" cy="243.74558" r="2" fill="${color}"/><circle cx="712.00401" cy="331.74558" r="2" fill="#ff6584"/><circle cx="406.00401" cy="222.74558" r="2" fill="#ff6584"/><circle cx="531.00401" cy="60.74558" r="2" fill="#ff6584"/><circle cx="449.00401" cy="153.74558" r="2" fill="${color}"/><circle cx="474.00401" cy="86.74558" r="2" fill="#fff"/><circle cx="773.00401" cy="266.74558" r="3" fill="${color}"/><circle cx="574.00401" cy="277.74558" r="3" fill="${color}"/><circle cx="523.00401" cy="348.74558" r="10" fill="${color}"/><circle cx="644.00401" cy="239.74558" r="3" fill="#fff"/><path fill="#2f2e41" d="M91.9285 720.61433s-5.597 23.40551-.50881 24.42314 30.02012.6892 36.1259 1.70682 18.82618-.68919 18.82618-5.26849-13.22919-7.63227-13.22919-7.63227-18.82617-10.17629-19.335-10.68513-21.87908-2.54407-21.87908-2.54407z"/><path fill="#2f2e41" d="M97.92108 553.4916s1.825 20.68377 1.825 22.50877-10.95022 97.94367-8.51684 117.41076-.22527 25.68432-.22527 29.33445 19.6924 2.29952 19.6924 2.29952l21.29211-134.4444-10.95022-40.15079z"/><path fill="#2f2e41" d="M99.05193 725.7377s-5.08814 18.31737 0 19.335 30.02014-1.16571 36.12591-.14808 18.82617 1.16571 18.82617-3.41359-13.22919-7.63225-13.22919-7.63225-18.82618-10.17628-19.335-10.68513-22.38789 2.54405-22.38789 2.54405z"/><path fill="#2f2e41" d="M92.44598 529.15776s-7.30014 17.642 1.21669 26.76721 18.25038 27.37553 18.25038 28.59222-17.03362 122.27751-14.60029 130.186 1.825 12.77526 1.21668 13.99195 6.08346 7.90851 13.38361 7.90851 18.25037-5.47513 19.467-10.34188-1.825-46.84262-1.21668-54.75113 24.94221-134.44437 21.90051-137.48613-59.6179-4.86675-59.6179-4.86675z"/><circle cx="138.68027" cy="368.55447" r="20.68377" fill="#9f616a"/><path fill="#9f616a" d="M125.90501 378.89633s4.25842 22.50881 1.21668 24.94218 23.11717 6.08345 23.11717 6.08345 3.04172-29.80894 3.65009-32.8507-27.98394 1.82507-27.98394 1.82507z"/><path fill="${color}" d="M153.88891 408.09693s3.924-21.43479-25.8849-15.35135c0 0-27.21669 22.31626-26 43s-9.558 80.63684-8.3413 84.89529-7.30015 9.73351-3.65007 11.55857 69.35142 12.77527 71.17645 0-.60836-45.01761.60835-51.101 0-57.1845-3.65007-63.26791-4.25846-9.7336-4.25846-9.7336z"/><path fill="#9f616a" d="M141.11366 556.53333s-9.12519 34.67573 2.43338 34.67573 10.95022-35.89241 10.95022-35.89241z"/><path fill="#2f2e41" d="M147.10735 372.00624c-.26387 1.74438-2.95756 2.469-6.91157 2.12925l-.006-.00091a33.1451 33.1451 0 01-4.9659-.84962c-2.46763-.60707-3.858 1.58829-4.75466 4.62742-1.472 5.01326-1.58306 12.33657-2.878 13.29123-9.03973 4.99664-35.75065-28.50373-22.06325-37.17712 4.875-3.08915 21.28527-14.623 32.62282-12.29264s6.74781 16.4024 6.74781 16.4024.41583 1.8472.88756 4.21965a63.44555 63.44555 0 011.35858 9.07762 4.42082 4.42082 0 01-.03739.57272z"/><path fill="${color}" d="M148.41381 414.18041s-20.68375-1.21669-22.50879 29.20063-1.21669 59.0095-1.21669 59.61788 8.51684 58.40119 16.42533 58.40119 13.992-1.21669 15.817-4.25845-4.86677-46.84261-4.86677-46.84261-3.04172-46.2343 1.825-60.83457 5.47514-33.45904-5.47508-35.28407z"/><path d="M125.004 451.746l-6 65 20 45-13-46-1-65M154.004 458.746l1.528 76.629-5.528-41.629 4-35z" opacity=".1" style="isolation:isolate"/><path fill="#3f3d56" d="M257.738 747.357H0v-2.106h258.12l-.382 2.106z"/></svg>`;@@ -1020,7 +1021,7 @@ export const SETTINGS_SVG = color =>`<svg id="a7e92c1a-e25c-441e-bda8-8af90c7203b5" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="996.61127" height="804.00001" viewBox="0 0 996.61127 804.00001"><title>settings</title><path d="M568.9169,56.97925c-50.93658,13.2323-95.86584,48.55976-140.52362,94.90528a76.20054,76.20054,0,0,1-99.83508,115.0871c-52.45648,62.66448-109.734,128.91082-179.6413,183.663-177.9953,139.40814,188.04041,393.65546,420,393.65546S988.917,668.04456,988.917,450.63465,792.44938-1.09,568.9169,56.97925Z" transform="translate(-101.69436 -47.99999)" fill="#f2f2f2"/><ellipse cx="532.61127" cy="773.50001" rx="464" ry="30.5" fill="#3f3d56"/><ellipse cx="545.61127" cy="771.00001" rx="160" ry="17" opacity="0.1"/><path d="M1039.04565,787.50555c0,29.27147-17.399,39.49126-38.86526,39.49126-.49723,0-.99443-.00716-1.48807-.0179-.99444-.02147-1.98173-.06795-2.95469-.13591-19.3736-1.37-34.42248-12.11568-34.42248-39.33745,0-28.16613,35.99283-63.71182,38.70426-66.34815l.00358-.00358c.10375-.10373.1574-.15381.1574-.15381S1039.04565,758.23767,1039.04565,787.50555Z" transform="translate(-101.69436 -47.99999)" fill="${color}"/><path d="M998.76387,822.51827l14.21541-19.8601-14.2512,22.04212-.03576,2.27862c-.99444-.02147-1.98173-.06795-2.95469-.13591l1.531-29.28221-.01072-.22892.025-.03936.14665-2.76868L983.14265,772.428l14.32987,20.02108.03578.58665,1.1554-22.12442L986.43357,748.0787l12.38036,18.9515,1.20548-45.8728L1000.023,721v.15381l-.20031,36.17169,12.17648-14.34063-12.22657,17.4563-.32192,19.81,11.37161-19.01232-11.41812,21.92765-.17885,11.01392L1015.7265,767.717l-16.56558,30.30525Z" transform="translate(-101.69436 -47.99999)" fill="#3f3d56"/><circle cx="476.79322" cy="192.76422" r="47.76284" fill="#2f2e41"/><polygon points="586.73 614.807 612.259 717.744 637.787 713.626 612.259 595.866 586.73 614.807" fill="#a0616a"/><path d="M723.01135,759.15573s-14.53835,4.91525-12.62191,8.2221,1.91645,23.89429-4.67153,31.30576-23.05792,30.4694-4.11748,31.2929,37.88087-11.529,37.88087-11.529V797.0366l3.294,19.76393h3.294V794.56611s8.235-13.99946,3.294-22.23443-8.16167-15.41149-14.37455-14.70547S723.01135,759.15573,723.01135,759.15573Z" transform="translate(-101.69436 -47.99999)" fill="#2f2e41"/><polygon points="486.263 702.097 482.146 724.332 510.968 724.332 510.968 702.097 486.263 702.097" fill="#a0616a"/><path d="M590.4283,767.3907s-8.235-.8235-10.70547,10.70546-24.70491,27.99891-32.93989,30.4694-8.235,10.70546,2.47049,12.35246,37.88088,2.47049,44.46886-6.588a80.72283,80.72283,0,0,1,15.64644-15.64645l-4.11748,23.05793h7.41147s6.588-22.23443,13.176-29.6459-13.176-24.70492-16.46995-24.70492Z" transform="translate(-101.69436 -47.99999)" fill="#2f2e41"/><path d="M550.07693,413.28688s-5.76448,15.64645-15.64645,18.11694-83.17322,19.76394-83.17322,19.76394-64.23278,1.647-44.46885,15.64644,51.88033,0,51.88033,0,93.87868-11.529,101.29016-23.88142a166.46131,166.46131,0,0,0,12.35246-26.35191Z" transform="translate(-101.69436 -47.99999)" fill="#a0616a"/><path d="M581.36983,344.11311s-46.93935,76.58525-41.17486,78.23224,59.2918,18.94044,61.76229,12.35246,2.47049-37.05737,2.47049-37.05737Z" transform="translate(-101.69436 -47.99999)" fill="#2f2e41"/><path d="M581.36983,344.11311s-46.93935,76.58525-41.17486,78.23224,59.2918,18.94044,61.76229,12.35246,2.47049-37.05737,2.47049-37.05737Z" transform="translate(-101.69436 -47.99999)" opacity="0.1"/><path d="M703.24742,325.99618,809.47856,380.347s60.1153,15.64645,46.93935,27.99891-55.99782-10.70546-55.99782-10.70546L682.66,344.11311Z" transform="translate(-101.69436 -47.99999)" fill="#a0616a"/><path d="M567.37037,283.17432s20.58744,31.29289,18.94044,38.70437c0,0,1.647,4.941-.8235,8.235s-1.647,23.05792-1.647,23.05792l8.235,11.529,10.70547-35.41039,4.941-37.88087s-11.11721-15.2347-9.47022-22.64617S567.37037,283.17432,567.37037,283.17432Z" transform="translate(-101.69436 -47.99999)" fill="#a0616a"/><path d="M632.42666,461.04972s-46.11585,123.52459-46.11585,177.87541-17.29344,116.11311-4.11749,121.87759,79.87924,6.588,81.52623,0-8.235-274.22458-13.176-284.93S632.42666,461.04972,632.42666,461.04972Z" transform="translate(-101.69436 -47.99999)" fill="#2f2e41"/><path d="M632.42666,461.04972s-46.11585,123.52459-46.11585,177.87541-17.29344,116.11311-4.11749,121.87759,79.87924,6.588,81.52623,0-8.235-274.22458-13.176-284.93S632.42666,461.04972,632.42666,461.04972Z" transform="translate(-101.69436 -47.99999)" opacity="0.1"/><circle cx="476.38148" cy="209.64591" r="30.4694" fill="#a0616a"/><path d="M587.13431,349.8776l-2.20524-18.58441s-6.85323,9.52594-6.85323,16.93741-4.11749,33.76339,13.176,50.23333,20.58744,19.76394,21.41093,23.05793,4.941,3.294,4.941,3.294L641.48513,521.165s7.41147,256.10765,18.94043,259.40163,46.93935,0,49.40984-4.11748-4.11749-113.64262-4.11749-113.64262,18.11694,97.17267,24.70492,97.17267,10.70546-13.99945,9.05847-14.823-11.529-64.23278-15.64645-83.99672-2.47049-186.93387-2.47049-186.93387,13.17595-21.41093-32.11639-63.40929c0,0-28.82241-83.99672-30.4694-83.99672s-33.76339-45.29235-33.76339-45.29235-18.11694,0-21.41093,10.70547S587.13431,349.8776,587.13431,349.8776Z" transform="translate(-101.69436 -47.99999)" fill="#2f2e41"/><path d="M615.13321,288.1153l9.882-6.588s41.17486,24.70492,69.99727,26.35192,27.9989,18.11694,16.46994,29.6459S654.66108,388.582,653.01409,378.7,615.13321,288.1153,615.13321,288.1153Z" transform="translate(-101.69436 -47.99999)" fill="#2f2e41"/><ellipse cx="476.79322" cy="179.58826" rx="32.93989" ry="19.76393" fill="#2f2e41"/><circle cx="480.08721" cy="145.00138" r="19.76393" fill="#2f2e41"/><path d="M555.42966,182.29591a19.766,19.766,0,0,1,17.7052-19.65708,19.98219,19.98219,0,0,0-2.05875-.10686,19.76394,19.76394,0,0,0,0,39.52787,19.98219,19.98219,0,0,0,2.05875-.10686A19.766,19.766,0,0,1,555.42966,182.29591Z" transform="translate(-101.69436 -47.99999)" fill="#2f2e41"/><rect x="430.06591" y="424.58801" width="441.47946" height="257.824" transform="translate(-184.48419 67.60969) rotate(-9.54725)" fill="#3f3d56"/><path d="M785.61317,473.58139l-289.1327,48.097a5.94707,5.94707,0,1,1-1.95176-11.73292l289.13269-48.097a5.94708,5.94708,0,0,1,1.95177,11.73292Z" transform="translate(-101.69436 -47.99999)" fill="${color}" opacity="0.3"/><circle cx="604.16474" cy="432.81963" r="24.63788" fill="${color}"/><path d="M796.34787,538.11245l-289.1327,48.097a5.94707,5.94707,0,1,1-1.95176-11.73292l289.13269-48.097a5.94708,5.94708,0,0,1,1.95177,11.73292Z" transform="translate(-101.69436 -47.99999)" fill="${color}" opacity="0.3"/><circle cx="484.16118" cy="519.09892" r="24.63788" fill="${color}"/><path d="M807.08257,602.64352l-289.1327,48.097a5.94707,5.94707,0,1,1-1.95176-11.73292l289.13269-48.097a5.94708,5.94708,0,1,1,1.95177,11.73292Z" transform="translate(-101.69436 -47.99999)" fill="${color}" opacity="0.3"/><circle cx="584.56892" cy="568.71294" r="24.63788" fill="${color}"/><circle cx="275.36982" cy="160.20126" r="54.31516" fill="#ff6584"/></svg>`;export const SEARCH_SVG = color => `-<svg xmlns="http://www.w3.org/2000/svg" data-name="Layer 1" width="643" height="447.57029" viewBox="0 0 643 447.57029" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M891.62348,313.02059H308.47961a29.96193,29.96193,0,0,1-29.92806-29.92807V255.88519a29.96193,29.96193,0,0,1,29.92806-29.92807H891.62348a29.96193,29.96193,0,0,1,29.92807,29.92807v27.20733A29.96193,29.96193,0,0,1,891.62348,313.02059ZM308.47961,227.77094a28.14617,28.14617,0,0,0-28.11424,28.11425v27.20733a28.14617,28.14617,0,0,0,28.11424,28.11425H891.62348a28.14617,28.14617,0,0,0,28.11424-28.11425V255.88519a28.14617,28.14617,0,0,0-28.11424-28.11425Z" transform="translate(-278.55155 -225.95712)" fill="#3f3d56"/><rect x="57.1354" y="26.30042" width="421.71368" height="34.46262" rx="17.23129" fill="#e6e6e6"/><rect x="107.92243" y="177.43018" width="421.71368" height="34.46262" rx="17.23129" fill="${color}"/><rect x="107.92243" y="287.00423" width="421.71368" height="34.46262" rx="17.23129" fill="#e6e6e6"/><rect x="107.92243" y="396.57828" width="421.71368" height="34.46262" rx="17.23129" fill="#e6e6e6"/><path d="M864.86391,288.10449a2.71409,2.71409,0,0,1-3.7799.66654l-14.80667-10.30275a2.714,2.714,0,1,1,3.11336-4.44644l14.80667,10.30275A2.71408,2.71408,0,0,1,864.86391,288.10449Z" transform="translate(-278.55155 -225.95712)" fill="${color}"/><path d="M848.054,276.39907a19.26672,19.26672,0,1,1-4.73174-26.83326A19.28854,19.28854,0,0,1,848.054,276.39907Zm-27.61937-19.33883a14.45,14.45,0,1,0,20.12494-3.5488A14.46638,14.46638,0,0,0,820.43461,257.06024Z" transform="translate(-278.55155 -225.95712)" fill="${color}"/><path d="M874.84562,454.28942H325.25747a.90691.90691,0,1,1,0-1.81382H874.84562a.90691.90691,0,1,1,0,1.81382Z" transform="translate(-278.55155 -225.95712)" fill="#3f3d56"/><path d="M874.84562,563.90864H325.25747a.90691.90691,0,0,1,0-1.81382H874.84562a.90691.90691,0,0,1,0,1.81382Z" transform="translate(-278.55155 -225.95712)" fill="#3f3d56"/><path d="M874.84562,673.52741H325.25747a.90691.90691,0,0,1,0-1.81382H874.84562a.90691.90691,0,1,1,0,1.81382Z" transform="translate(-278.55155 -225.95712)" fill="#3f3d56"/></svg>`+<svg xmlns="http://www.w3.org/2000/svg" data-name="Layer 1" width="643" height="447.57029" viewBox="0 0 643 447.57029" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M891.62348,313.02059H308.47961a29.96193,29.96193,0,0,1-29.92806-29.92807V255.88519a29.96193,29.96193,0,0,1,29.92806-29.92807H891.62348a29.96193,29.96193,0,0,1,29.92807,29.92807v27.20733A29.96193,29.96193,0,0,1,891.62348,313.02059ZM308.47961,227.77094a28.14617,28.14617,0,0,0-28.11424,28.11425v27.20733a28.14617,28.14617,0,0,0,28.11424,28.11425H891.62348a28.14617,28.14617,0,0,0,28.11424-28.11425V255.88519a28.14617,28.14617,0,0,0-28.11424-28.11425Z" transform="translate(-278.55155 -225.95712)" fill="#3f3d56"/><rect x="57.1354" y="26.30042" width="421.71368" height="34.46262" rx="17.23129" fill="#e6e6e6"/><rect x="107.92243" y="177.43018" width="421.71368" height="34.46262" rx="17.23129" fill="${color}"/><rect x="107.92243" y="287.00423" width="421.71368" height="34.46262" rx="17.23129" fill="#e6e6e6"/><rect x="107.92243" y="396.57828" width="421.71368" height="34.46262" rx="17.23129" fill="#e6e6e6"/><path d="M864.86391,288.10449a2.71409,2.71409,0,0,1-3.7799.66654l-14.80667-10.30275a2.714,2.714,0,1,1,3.11336-4.44644l14.80667,10.30275A2.71408,2.71408,0,0,1,864.86391,288.10449Z" transform="translate(-278.55155 -225.95712)" fill="${color}"/><path d="M848.054,276.39907a19.26672,19.26672,0,1,1-4.73174-26.83326A19.28854,19.28854,0,0,1,848.054,276.39907Zm-27.61937-19.33883a14.45,14.45,0,1,0,20.12494-3.5488A14.46638,14.46638,0,0,0,820.43461,257.06024Z" transform="translate(-278.55155 -225.95712)" fill="${color}"/><path d="M874.84562,454.28942H325.25747a.90691.90691,0,1,1,0-1.81382H874.84562a.90691.90691,0,1,1,0,1.81382Z" transform="translate(-278.55155 -225.95712)" fill="#3f3d56"/><path d="M874.84562,563.90864H325.25747a.90691.90691,0,0,1,0-1.81382H874.84562a.90691.90691,0,0,1,0,1.81382Z" transform="translate(-278.55155 -225.95712)" fill="#3f3d56"/><path d="M874.84562,673.52741H325.25747a.90691.90691,0,0,1,0-1.81382H874.84562a.90691.90691,0,1,1,0,1.81382Z" transform="translate(-278.55155 -225.95712)" fill="#3f3d56"/></svg>`;export const LOGO_BASE64 = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV4AAAFeCAIAAABCSeBNAAAFVGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS41LjAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iCiAgICB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iCiAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyIKICAgIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIKICAgIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIgogICAgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIKICAgZXhpZjpDb2xvclNwYWNlPSIxIgogICBleGlmOlBpeGVsWERpbWVuc2lvbj0iMzUwIgogICBleGlmOlBpeGVsWURpbWVuc2lvbj0iMzUwIgogICBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIgogICBwaG90b3Nob3A6SUNDUHJvZmlsZT0ic1JHQiBJRUM2MTk2Ni0yLjEiCiAgIHRpZmY6SW1hZ2VMZW5ndGg9IjM1MCIKICAgdGlmZjpJbWFnZVdpZHRoPSIzNTAiCiAgIHRpZmY6UmVzb2x1dGlvblVuaXQ9IjIiCiAgIHRpZmY6WFJlc29sdXRpb249IjcyLjAiCiAgIHRpZmY6WVJlc29sdXRpb249IjcyLjAiCiAgIHhtcDpNZXRhZGF0YURhdGU9IjIwMjEtMDItMjRUMTE6NTQ6NDkrMDU6MDAiCiAgIHhtcDpNb2RpZnlEYXRlPSIyMDIxLTAyLTI0VDExOjU0OjQ5KzA1OjAwIj4KICAgPHhtcE1NOkhpc3Rvcnk+CiAgICA8cmRmOlNlcT4KICAgICA8cmRmOmxpCiAgICAgIHhtcE1NOmFjdGlvbj0icHJvZHVjZWQiCiAgICAgIHhtcE1NOnNvZnR3YXJlQWdlbnQ9IkFmZmluaXR5IERlc2lnbmVyIChNYXIgMTIgMjAyMCkiCiAgICAgIHhtcE1NOndoZW49IjIwMjEtMDItMjBUMTM6NTA6NTQrMDU6MDAiLz4KICAgICA8cmRmOmxpCiAgICAgIHN0RXZ0OmFjdGlvbj0icHJvZHVjZWQiCiAgICAgIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFmZmluaXR5IERlc2lnbmVyIChNYXIgMTIgMjAyMCkiCiAgICAgIHN0RXZ0OndoZW49IjIwMjEtMDItMjRUMTE6NTQ6NDkrMDU6MDAiLz4KICAgIDwvcmRmOlNlcT4KICAgPC94bXBNTTpIaXN0b3J5PgogIDwvcmRmOkRlc2NyaXB0aW9uPgogPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KPD94cGFja2V0IGVuZD0iciI/Psdf2tkAAAGBaUNDUHNSR0IgSUVDNjE5NjYtMi4xAAAokXWR3yuDURjHP9swMVFcUC6WxtWmIeJGmYRaWjNluNne/VLbvL3vluRWuV1R4savC/4CbpVrpYiU3CnXxA3r9by2mmTP6TnP53zPeZ7OeQ5YQ2klo9d4IZPNacFJn3M+vOC0P2OlnToG6YgoujoWCPipah93WMx44zFrVT/3rzXG4roClnrhUUXVcsJTwv7VnGrytnCbkorEhE+F3ZpcUPjW1KMlfjE5WeIvk7VQcBysLcLO5C+O/mIlpWWE5eW4Mum8Ur6P+RJHPDs3K7FLvBOdIJP4cDLNBOMM0ceIzEN46KdXVlTJ9/7kz7AiuYrMKmtoLJMkRQ63qHmpHpeYED0uI82a2f+/fdUTA/2l6g4f1D4Zxls32LegWDCMz0PDKB6B7REuspX8lQMYfhe9UNFc+9C8AWeXFS26A+eb0P6gRrTIj2QTtyYS8HoCTWFovYaGxVLPyvsc30NoXb7qCnb3oEfONy99A2ebZ+Z8GpixAAAACXBIWXMAAAsTAAALEwEAmpwYAAAgAElEQVR4nO19e4wkx11/Vc9rZ2Z3Z9/vvfPdxb7YREmIsKNYYCT7JycYgSP/AZal8AiCKISH7VgR4BABlp0QESCIOARiQChREAIcY/6IHQlBEohkY0HIOX6d73y3d7e3753Z2XlP1++Pmq7+1qN7HjuPnu3vR6e9nurq6pqerk99X/UtyhgjCAQCIcMadAcQCEQQgdSAQCAMQGpAIBAGIDUgEAgDkBoQCIQBSA3hAjqkEC0iOugOIPqHer2+tbERTyTiiUQiHrciEYtSauH0gDAAqSFkoLRSqVSr1SKlhDYQj8cTiUQsFkOaQAggNYQLjDFKqVJYrVar1aplWYQQy7Isy4rFYtFYLBKJDKKPiEAAqSF8YIxQygihwPRAKeXHtm0zxmzbrlQqlFJLIBLh/w+064j+AakhfKC0ITgwRi1LESKUj5wp6vU6rdW49mFZVuOvZVHRFOLYAakhjGCMUUKIIwKI4a0cCO1DlHOBglBq27Y4xUULpSZi2IHUED4wRiglYAwLCuA6BVcuoETgWigccYNYFhMMYtt1zjVOCQoUxwBIDeGDTAqEEEsTH4iHwdJtgfOLQyGEEG684AeEMZdmRNPIFEMFtCqFDyLqyTngo5gxBgOizCNZjpiCdbg6QRyCcK8Q93DAieNIXwHReyA1hA9CKRDyv7eZQDdDQIhh73x2R7x6SjTYcbcR/QVSQ/jAhysgCK/oaQasD7YQMeSmKKhMFCEClgizhdINRFCB1BAycBsBh2yMNFdu/O9SgJe+YC7XmqLiFJoegg2khjCiISYwpngi2rIUKuEQvEFxA5P6wQiwViICDqSGcMEoz3s5I6BHU5Qwx4jY0DVgy0AegVJD4xSKCUMFpIZwgQongjNWRXw00YwOiv+RKCTi+CzNN1KOdcsC2hqCDaSGcKHhPnQmf0WV8A+altrR9ALz+DepD2hrGAogNYQUFDggBPw/gosp9TkrQ6+ElDAUQGoIFxoBi4zpIgGTrQ/6tQxYGQlRp/3W1QNUJIYCSA3hAmuELDeZuf3DnxofGy0y968uEfioGGhrCDaQGsIHJyCa+VsTjG4LsMiKQdlBiWgSwx7aLGWPBiLgQGoIF8RKBz0OUrdBGkwPznILQlqzI+rrNVChGBIgNYQPIguDW6DHLjKdFyjgFKLpBS7pkEZcgxI6rQI9FMEGUkPIACR/5papo9SvRA6IEDKIK03wWt7aClLCUACpIWRw9AiYecU500TSV8IfDdM+CIJSmALW91qUiQgUkBrCBQaHLiHMyeMm1XG0CWMElGtxELX5WdJYOtFUKECpYSiA1BAyaDO5QgRiwZUwQwoegNXUOGjAOPwaaIkwiwdoawg2kBpCBpOMICVrAvkglZJGOfjLTzP5MljNmPcJMRRAaggdFAOhEBZaDHzWx7m4njfneaXCGmhrCDaQGsIFKrOAMVMDc/I4wAsZHNhKdganCXELeBnxUSiQHQIMpIZwQYk1UOwIHNDQoBSKywghktuys3TRaG4IMJAaQgdXoTDFNSmVoYihOi9Bg4aEsY1zVD/GNRRDAaSG0IGBmd4nX4PwU6iXa7HPjfrmmzH92JhpChE0IDWECzABrK4yKDV9dqbwTNDiVG2pN6hQBBhIDeEChVkbZT+l/pcYbQi+ed+UNdrmPrTbacQggNQQOhhHJuQCY6SDK0EYhz1YYSGtszLdEbWIoQBSQ+jQysjUI6FVq4Q4DR2ZQqBQrJvGe6A2EWwgNYQPPGzB80xLi6zMueLaMivizpfBBlJD6NAIW/A+pZd7xS6ovs/2u9LuFYi+AakhdFAGsKI7KIYGQQqqt6Lxn6NcUNpYUmUKl4aVEcMCpIYQwxTdoC/ENm5RoYdGSSPfKE1ADjpaxxF9AFJDiOGhO7S6G4WoILfZSBLjf+dWuocYKJAaQgZu/OPj32PM6wqFwTzplR7a0UAM6WFhs511HtFHIDWEDkKLEF5Go30BwmvxlMjv5CZx4OspjaSjmyoQAQZSQ+hAxZYQlBJ5haW+FlvfLFuUM5HfyTFAtm5uRKkh+EBqCBcaa6tEnJIpuZtU36tcj3pSkjh4hE40rui0/4i+AakhdBBTPSHqBlYGm4KvCOAmjAUfWwFKDcEHUkP4AHeUaLb+knqUK2cNQ92XU1BqCD6QGsIFEZUkohWUlVT+JkklWQNzCt0c8+iGOC5AaggfgOnRPw2kXmh2VTirqpRW4Ec1BLP9XiP6DKSGcEGyDvDZXmYKqbJH4IMoNaRyE8dimQauoRpOIDWECw2Fgq+JAMngiOO5bMV5KTIy+C+vUtdZ6KeQNQIMpIZQQtssm8hrqNRUsdq+NeIa969ilWxlWwtccBVgIDWEDI6c7z9y4ZIq474VBKZscf5KioZv+nmUFoIPpIZwoRG56CgOCk2YPZQeSRwolCacEulezi0JcsEQAqkhXDA6Jo17XjYB1DtkgnCbclpEm8IwAqkhXLBtm3ikbIGAl4jKrgGCmIKjRYmmX6BNYRiB1BAuWJQaBQOf3WiExUHa2E42V0KOERwh2TjFWdNHRACB1BA+aBbI5ntPKAD84qaW1xI6GOIaPFQPRACB1BAuiElety8YU0LCCqJczcjgKBSS81LOB2c2QyACDKSGcIE641Y2BahDtUnotM9CCaB0uGZIZYttUzuIoAGpIVyAC6KIvEDbUNmUA4qfEId6rjjlXsZUcahQBB9IDaEDVVK2abYGAgqJvMjCacKNiSCiHWWzXGXpt9YHRMCB1BA6MC2DS9O12P7JGqRjo+7AGNWphGj6BSJIQGoIF4yrIZSwBR3GdNJQ7mg0TsBohxwhEkkqFIO2hgADqSFcYNpkTpqZIQ22Bl4H1DNYGTSiUUkEEWwgNYQLwvpIta0ivJyXQqAwp3hxLiCKQUHbzMqQ2QUVigADqSFcsJ0x3HTNtL7PpXJaqaxWgFmetNMoNQQfSA3hAjcHuHqElm+eOKeMDguqLZRwFQpQldfxsTsK58dRvw+iZ0BqCBmMfkc5d4uSoEGQgssXmvqgeCshAfkBFYoAA6khZODLn7wFBJ/NsqVmRLiU+AuSTTcCLrvdd0Q/gdQQMsgp2xplmjXAfwtMAoKm1JbFgdfOl6LZVnuMGAyQGsIFJZyhsZhC9kHoXGA2Rjp+B9XdoIc2eAFtDQEGUkNYITLHan859GWXyim3AjEvlCA+koUSH4UIHpAawgUqhxsIMcGY2Ylo2VzEWaJEQ5oWShA9ZYvOBcgOQQVSQ7jAoLQPeMIrfYueVBq25Vbzv6sW/mQ+hQgSkBrCBeNAbLqAgjrwbdosOIj7ongwXEBqCC+gOuG5CY1WKJkqHauDcF5KiZ7ka9zMLrACKhRBBVJDKAHSt9rOskuvlPOKTiFtsa2lbxHb2OmrMM0pG1ChCCqQGkIJMHXD1VNi8OuygzHqSTkgRA6U1KInDECpIahAaggX3IVV3IIgn9UNCkbnhdJmQ0DwTetk7AkiyEBqCBca2d+ckcy8JnOfFuQ8TsaVWsThC6PdQmmuzfsj+gSkhnCBj0ufcCNzWLQWN+2SC2MMaBDGJC5KW0T0ARFgIDWEC24GF+/pWs9D72V6MIRDKdVgs07rys1a7juir0BqCBdEkELjWFmg7Z2jwWuRFdGJRllnRcxh1JiyIeBAaggdJMsipXDZpWKGhImelFMMWBYo+MvPqQc+CalRaggqkBpCBynogFsKtIgmBYYVmXBPKuIxwhVnh7k3KDUEFEgN4YJQAXhEg//I9NmlxtUxYE43zY5gNGl21nNEn4HUEC4oAgJM6EYcS4R+DCFpHMTNDaMu6iaqrUHtifcpRBCA1BAm6CnhCSGEUMsCVcySgrLIgukGBakUeEk9gMJDwIHUECbIC7EFvNI6+WSFk9rkl8g1fDyabn2C+kVwgdQQMrSWTEXfhMJzTwqfrPPGu6AGMSRAaggXqLMy0r8CMTky9ar+oVP+wQ6YwSHgQGoIF5jzz4W2nspwlSYyULBLjdeNmmaURl0iyEBqCBN8U7b5JJJunuLJ4QLJ1iDHSOl9QAQZSA1hAo99dI6JURaQPzZlBOKxIkONkdKjpxHBBlJDuMCEJC8yLDQLhYSnlKTSEG6MA3HEh1ZYAIWIoAKpIWSAwYtyQKQhjxOAckqNpJSbVQrVY8QwAKkhZOBeyWa1GMgla/RTNLEymtwZrdZEBANIDaEDdy4YDIRyHRgN2YrFQYIPa2C+hiEBUkOYAMR+yUDo7ZvwgsHBoX/UGAXWwbiGgAOpIUxwWEDZ3o5oKoOygAJaH2F+p8YlsCnRDpEJRmRzgcmsu/GdED0CUkO40LARgCgDdbb3zf7mUgZopL3JHzWIIQFSQ5jAd6Nxjgkhuv9Srm7I78Shyh3ejXgBRYaAA6khTBAGSFPOhaa5noisWfD/iKAJmWV0b6faFNoagg2khpCBxyNw+4IcsdBkMZWxXOEUGCXRSl/a6Tiiz0BqCB/kfJDNF0do0oQqUwi6gTW1Vpo6NRCBAlJDuMC3lmmYD0ykoIQ/GtPAUV/fhFQDlOgaBEoNQQZSQ5igbTOhpHUjvvnm4YUEGgugxcEsV4BbY/jjkACpIUzgw55L/iJCwYmJ9hrULUkNXrUB5RCY5B4ReCA1hAkibazsoeggJpqLFnCUm5dkth1ijQgKkBrCBGU7CaEXyAYF3b6giwJSlnqQVI5qS7JQSBhSIDWEFY4Zkid3MYc8+l1NmRxhzZy/Sl4HSCpIE0MEpIYwQeR9Bg4IEfDofRHTzRCe3AGDLImTWhYxhEBqCB0oNEZqPgiYqYEA5QJ6LoxbVamkQCRFo1HQi++D6A2QGsIE03Ip3WVgtEoaAp+I7G6AbgvHCUJQiRhaIDWECUA2IGLQahZHRWpo7s5Uoh6MdYzdabHbiEEAqSF0aJgb+F9n5Os2iEZlj4hJ/p/TomH5prs0w3S930dEMIDUECbAPSmFBcF8vgFhpiQ6X4D80eKjjzGTeMgpGB8ZTCA1hAl8YZUTy0DA/O81cUNSUIMd9Ob1lpQAKLkQKSHIQGoIF4TdsWlIkp7iqVHfX/437lXT7F6IAAKpIVxgtt1UgDeqD65VAgZEOZpFw/RIvJdg+qsbiOABqWFY8dZbb7V9DViIzeBAlaOkjess9bgGfo7/dUlBc14YfCKIYQBSwzChVqu9/PLLf/EXf3HbbbedPn267evljM/tLqlqGj3NrReKQcG5nxoKRZApgo3ooDuAaI5CobCxsfG3f/u3n/vc5w4PD3lhh2sanYUPTA5n8op01LPCSSZJ2IJlQbeoIfZB2Tgbih7opAgekBoCjXPnzv3O7/zON7/5zUqlYtv2UZtrLdcbjHryWYXJCKF8VIu4BrBkC17JFCuDwgXIC4EEUkPgUC6X//Ef//HJJ588f/781tZWUzG+DWjzc2P8OuX+i6yIzBrusDcliSNArKDEd/yj1BBIIDUEBWtra1/72teef/75F198MZfL9eo2wljoJImEHxljlmURhzJ0RYMoUgMkCChH8JoEDHveflOaQAQGSA2BQK1WO3v2bLFY7PmdvKZx2e5gXluptOTdvgKhULgWSmSHwAM9FOGDdw6FpgqFfgCbUnUVIoczyHki1fqIgAGpIXwwhS1Ifk3TSgpzXIMsDihZIfV7IYYISA3hg2wLgG5I/6TSajSkHChFlOBrn4USQu6Q+4MIFJAawgvmmB7FR69M8cSkUKgjHDACNFRAacSrHx1/BUTvgNQQMsBk0B4+COItOBja83I6QFo5Yp8RgwBSQ+jguTmVtnqipYBLoEp41W66nKv5XRB9B1JDuNCwJcjuQzU1i0IZXuBxCmAzS6adbWnYo0IRSCA1hA+Or4ExZ3s7D+ujsRAuu6R6ELQpbSRcfGmoo5xFBANIDeGC61/QMrJB96T4SLW9MMVHJSxSuDFEsyoBKEu5vc4iggGkhtCBgoOGE0Eb9pAOjJGRDY3DacfVU4i7LhvFgKEGUkO44NoPjKlfG2eosoCCeKgbkC2YQh9ybgjE0AGpIVzgOoMSm0BNodNU3vnSJ+ShUQGelavCAxQlhgVIDeGCmxtSHtzKxK64J8yuChAK7WeJFLzTYfIZxGAQUmqo1WoHBwddSI4ydFCSrzlOSiaPf6NlQXyEhkwYQ616IsTl4kK4+BIRbISOGl566aX77rtvaWlpamrqrrvuqtfrg+5Rv8FsWzdACn9EKy3AmpJAAZM+mWu4TXTYe0S/EApqKBQKX/nKVz7wgQ8sLy/feuutTz/99NbWVq1W+/d///dPfvKTg+5d3wHySrtgDCoRraeW8tz/0j+KARF4HOdULhcuXPjXf/3X55577lvf+lY+nzfW+cxnPnPTTTf94i/+Yp/7NkCIjG9UTtlk+SZraCJQQH8HryxyOhkTPSECj+NGDZVK5dy5c9/5zne+8pWv/Pd//3crs98v//IvLy8v33333X3oXhDQSO5GCBFrH+QMsTwNHFQIeFY4pYXGsZwDjjcnZYITnCKndWksA0emCCpo66JjkHFwcHDlypWvfvWrX/ziF3d3d9u9fHx8/KWXXnrb297Wi761glqtNj4+3lYCOEppu2bUWq127epVYVawKCWUchZQMrVwLhDBThC8jlKh8VdkjhMNEUnlkEQPuWZbXwTRBxwHqeE3f/M3/+zP/uwoLeRyuTvvvPPixYuRSKRbvQoglCHayPUKghd1Y6TRNmlQLoBDlBLChQpX6nA4AmWEIcJxMEOeO3fu6I2sra29+93vPh4ylB+cTeggTYilk04VQ4Y4vywvRM7ppPlHxTVd6D+iXzgO1NAtnDt37p577qlWq4PuSG/BnH/Cf0m1yVxP3KDENQi5gwA60PUFXlu5OzzrFQqBGDiQGiR84xvf+NSnPnVcQ6GUBApMO2gRginMhAJ3x225xTa7gOg5kBpUfOYzn3nqqacG3YueAEoHFPwlGjv4r5iQfJkwc7RxyZYSWAlPIQIMpAYDfuVXfuW5554bdC96C5iXyahQKMZIeFYlDuKaGKXUDtxF6qtQIAILpAYzPvjBD166dGnQveg+zKmcTDoFjKE2GiaJbIAkSk4Xfi0hxMki5YKXmFQSRHCA1GBGqVS64447SqXSoDvSK5hjDUwlevS0amvgieSISxNMlkqkrJNEWmqBekVggdTgicuXL7/3ve+t1WqD7kjXAM2QYsLX5QgvD65BfHBOSFcplxtbUzawQdND8IDU4If/+7//u++++8rl8qA70h2o49BD4deTO8FASc/GZSlAMXO6Dcq3RkoILJAamuDZZ5997LHHjtPabSEvSNZHj8QtyvIKUUEKiFZqt9QJWWpAq2TwgNTQHI8//vjxcGfy4ciXTjTSt4hzYDGVkQUUvtB3xzQnfSPqsFddIXp9RDCA1NASPvrRj/7Lv/zLoHtxVPAhbkMdwZRCvo1occW+qJWrzkuvllFqCB6QGlqCbdsf+tCHvv/97w+6I0cCTNhGCMik4LCGkReghwI6KQhxFRPGq5linEQ1fsrMDSg1BA9IDa0il8v95E/+5P7+/qA70jkUx6F2usnUbcg9D5lFmCH1ca4LFygmBB5IDW1gbW3tfe9737EMdmCmaGilZH9//+q1a7u7u8JlI1Zze0HXMtC4MCw4Dvka+olXX3313nvvfeaZZ0ZGRgbdl7bhP4b1aGhFTHjzwgWx8GxkZGRmZiaTySRHRmLxuDkRA5M23RVZ5xBDAZQa2sbzzz//+7//+8O4OrORTwWkincP5MgF3StRrlTgVy6VSleuXHn55Zf/+6WX/ud//mdjY6NardoebSrB1IihAEoNneAP//APV1ZWPvaxjw26I+2BGwIoyN2mVhCbWTGmZnzyVgFKpdKFCxcuXrxoWVYymVxaWpqdnVUkEINYocgUiIABqaETMMYefvjhmZmZn/3Znx10X9oDI4Q628lQZQ21sX7TXNKgZr1ez+fzr7/++vnz5xOJRDKZnJ+fn56asiIRQxPIC8EGUkOHqFQqH/3oR0+fPn3rrbcOui9tQBgOqT6TO5KCflW7efFs2y4Wi8VicXd317Ks0dHRsbGxqampiYkJJTk1OiwCC6SGzrG3t3fvvff+7//+79zc3KD70hIoFBYczaKxPYTYPAImkncTvnY+dG3bzuVyuVzu6tWrlmVNTExMTU2Nj42Njo1ZlsWgSxURJCA1HAnr6+vvec97Xn311dHR0UH3pU2IxRHc9ECIwgtEc1IcHbZt7+7u8t0ALMuanp5emJ9Pp9OJRMI61rm8hxFIDUfF1atX77rrru985zuxWGzQfWmChh5h25YjL1BnJyt90hZB0+2FTrcM27a3tra2trYIIZZlzc3NrayspFIpuDsOYoBAaugCXnjhhYceeujP//zPB92RJqBiwBOiSgiiDvBiCl5QDARdh23b169fv379umVZ0Wh0dnZ2dXU1mUz29KYIfyA1dAdf+MIXTp069fGPf3zQHfGDsDs2dprSYhOpplMIxOPxHokPELZtVyqVq1evXr16NR6PJ5PJycnJhYUFpIn+A6mha/jt3/7t5eXl+++/f9Ad8QQV7ABCkrzStAhhgZdbljU+Pp7NZvvW20qlUqlUstnsW2+9NTIyMj4+zk2YSBP9QUip4dSpUxcvXuxum9Vq9SMf+ciZM2cC6850V1DKiVioWI6psQNM5fK2M2euXL2azWb7v4qkVCqVSqXNzU1CSCqVmp6enpiYGBsbSyQSfe5JeBBSanj88ccfe+yxV155pbvN8tWZr7zyyvT0dHdb7jq4BMFNCK4BAlYA7gmhaJxYXaUnTtTq9e3t7d3d3Uq5XK3V+rwbYKFQKBQKa2trhJBUKrW4uDg1NZVIJIJvBh4uhJQaxsbGvv3tby8uLnZ9G7utra1Tp06tr6+n0+nuttw1yBtYiYVVuokB2h1gsEM0EllcWFhcWKCU1mq1jY2N6xsbtb5zBCGkUCi8+eabb775JiEknU6vrq7Ozc2hj6MrCCk1EEKmp6cvX7585syZQqHQ3ZYPDg5+/Md//Lvf/W5g5zFp5PDtrTUfhLA1ePkpeCOxWGxldXV1dbVWr9eq1Y3Nzc3NzYHsG3p4ePjqq6++9tpr0Wg0lUotLy/Pzs722rdyjBFeaiCELCwsPP300z/1Uz9VqVS62/JLL730q7/6q3/5l38Z2OlLUR/4prhGW4MSHGmOpCYkGonEotEbTp684YYbyqVSsVTa2dnZ3t7uc7Z+xli1Ws1ms9lsli/3Gh0dnZ2dnZ6eRppoC6GmBkLI3Xff/elPf/qRRx7pujD85S9/+cyZM7/1W7/V3Wa7AhH1ZEgGDyKdYLlOCmY3J6WUkJFkciSZnJqauvFtbzssFHK5XHZ/fz+b7bM0Ydv24eHh4eHhxsYG97BkMpnJyclMJoM00RRhpwZCyMMPP3zx4sVeBCw9+uijN9xwQ6DcmVTERMOlVuBA6A7GPazMgQ+ya8OVRxgjlI6m06Pp9NLSEiEkl8vt7OzkcrnDw8M+SxO2be/v7+/v71+6dMmyrKmpqZmZmdHR0XQ6jTRhBFIDIYR8/vOff+211775zW92t1nbtj/84Q/fcsst73znO7vbcsdQxi0RNkilWjOpQTE9NNeaGKOUZsbHM5kML8ju719bXz84OKhUKn3e5sO27e3t7e3tbUKIZVmzs7OLi4upVIqHdfWzJ0EGUgMhhFiW9fTTT99www38dekiisXiHXfcsb29HY0G5VHzKGkaiTCHABTPJWcBnR0Uh4W0RhOGTum3I4bMsROTkxOTk7yET+b7+/v993HYtr2xsbGxscE/Li4unjhxIplMIkcE5X0dONLp9Pe+973V1dWuZ3bLZrNLS0vnz58fHx/vbsudgI89yyKMWc7qbEYMoZAw2EnZ3o6YpAZxrkE9HkxhxOTExOTEhM0YD3+8du3aoDJ3r6+vr6+vR6PRWCw2MzOzvLwc2uBLpAYXS0tL586du+222/L5fHdb3trauueee55//vlUKtXdltuGvEW17pUgpnAGZaU2MUkNYh2n13yrWzcUWJY1MjIyMjIyPz9fq9UODw9zudzW1lYul+uzNFGr1Wq12tra2traWiKRSKVSk5OTs7Ozg//5+gikBgk333zzX/3VX/38z/98192Z//mf//kbv/EbX/rSlyIDT0wAF1DAfC3OeaOHslKpXLt2bWxsbGxsTJ9I4ZhXUkgJkcRIQ8SDJqLRaCaTyWQyq6urXJTgRsSus3ZTlMvlcrm8t7d34cKFZDI5MTExMTGRyWSOvTSB1KDi/vvvf/3113/v936v6zPVU089dfLkyd/93d/tbrPtQgpVALHSYrrX1QdCiM3Yzu7uzu4uISQej09NTWUymVQymUgkFN1BWY6hr84wGyO8EY/HZ2dnZ2dnCSHVanVra2tnZ+fw8LBUKvVZmuBZ7dbX1wkhqVRqdnZ2cnIynU7H4/F+dqM/QGow4FOf+tTa2tqXv/zlXrR85syZBx54oOsttwpt3MNYaQ4lzElcKCpUKhWeXoEQEo/H5+bmZmdmYrFYNBbrwHrX1gWxWGxpaYm7QkU3KpVK/+MvC4XCpUuXLl26RAjhwZfT09OxWCw49uYj4ph8ja7jS1/60g9+8IP/+q//6nrLv/ALv/Ce97zn7W9/e9dbbgmKqxJuGOEkiXQqUsXiYESlUrly5cqVK1cIH7eLi4uLi9FWIsSVhZ7tc0o8Hj9x4sSJEycIIdVqdW1t7erVq30Ol+AoFApvvPHGG2+8QSlNpVInTpzgSzn635MuAqnBDMuynn322ZtvvpkvBO4iqtXq7bfffvny5UGlk2RQhtcGp2AEaGhsUW6vVquXLl++vLYWjUYTicTc7Oz8/LwkSnD2ke0OXckcG4vFTp8+ferUqWq1Wi6XNzY21tfX+08TjLHDw8NXXnnltddei8ViqVSqsSvHELpCkRo8MTU19cILL5w9e1Zs8dgt7O3tnT179qBrYigAACAASURBVPvf//7U1FR3W26O1vaVOMqrzFcxVKvVfD5/4eLFZDKZTqcnJydnpqfjiQTRYq7ELTu+I2iDxuPxeDw+NjZ25syZYrGYz+cHspTDtm1hv4zFYjfddNOwpB0XQGrww8mTJ7/1rW/deeedh4eH3W352rVr991337PPPjs2NtbdlluCGJaMESH3OoVQpxBXdEwW3HS3vb39xhtvjI6OZhwkFNNdt/PNc9k+lUrxMXlwcLC3t7e/v5/L5fpsmKhWq6+88komkxmuxDNIDU1w2223fe5zn/v1X//1rr9P//Ef//HQQw998Ytf7OvabbhjFWMErpUQ2aUbn9wD7ow8OvL5fD6fv3r1KiFkdHR0bm6Ouzni8Xiv96HgbtcTJ04wxrLZ7ObmZi6XKxaL/ZEmbNs+ODhAajhu+MhHPnLx4sXPfvazvXBnLi4uPvbYY91ttgnAoCeE2CL3PCHEFAdJBY90FZwm+PFoOr28sjI9NRWNxXod90Ep5bEJ/OPe3t6VK1dyuVytVuvpFsdDt38yUkNL+PSnP72+vv53f/d3XW/58ccfX11d/fCHP9z1lr3AoDYB4pHc7Wo0PaLX4QP5w8PXXnuNEGJZViqVEsmaenpTjsnJycnJScYYY2xvb+/y5cuDitEOGpAaWgKl9Mknnzx//nzX3ZmMsQcffPDmm2/ubrNNb0p5xDRtbGbHTI4JUbNvBnbbtvP5PLfw82Tzi4uLfUjWxL/j9PT09PR0vV4vl8vZbHZ9fb2fGbSDBqSGVpFOp//pn/7p3e9+t1il1y0Ui8V77rmn66HZRjCxqsr5zIdFw8rAGCNEH4es2zbCprBtm2eR3tvbsywrnU7zDXWnpqZ6rXFEIhFuv+SpQ/P5fDab5WkmenrfoAGpoQ0sLCx897vffcc73tH1dJL9XBogBSZDGySPm5alBikkYUDgNryDg4Nr165RSkWmprGxsV6HHsZiMa5x3HDDDdVqdXd3d29vL5fLFQqF/q8f7zOQGtrDqVOnnnvuubvvvrtYLA66L0eDIyZQ4JjQBQMRVx2Px1dWVrLZbLlc7o+AYwRjjK+z4r2anJycm5vjK756LU3EYrH5+fn5+XlCSKVS2dzc3N7eLhaL5XL5WNIEUkPb+NEf/dEnnnji4x//+NDZnAkB8YhcfeDp3iIRsRWFV0yUZVkL8/ML8/OWZVWr1c2tre2trVq93ucETRCMMbHvNiFkampqeXk5k8lEIpFe2yY4Ua6srBBCqtXqtWvX1tfX+5+uqqdAaugEDz744FtvvfX5z39+0B1pGwaLItj2tqm5kVeLxWLLS0sry8s88HFza+v69esDHxWcJiilkUgkk8msrKz0J9g0FoudPHny5MmTtm1Xq9UrV65cu3ZND5cYulhppIYO8dnPfnZjY+Pv//7vB92RtiHWLHAmYLIL098fodCHZVmJROLE6uqJ1dVKtVoul3d3d7e3twercdRqtZ2dnZ2dnUgkMjIyMjo6urCwMDk52evByZ/GmTNnTp8+XalUCoXC1tbWxsZGrVaLx+MikmJYgNTQIeLx+JNPPvnmm2+++OKLg+5LG2BOsjZucaRAjqDa3nbEI+kbDItqiO6UJuLxRCKRGR/n+1Ac5PPZbHZvb2+ANFGv10Wy+Wg0Ojo6Oj4+Pj09nclkekoTlNJEIpFIJCYnJ2+88cZSqRSPxwefwqdNIDV0jsnJya9//evvete7up5stnegjidCWXnJZQeLQnmCKMdC6ZBK9NwtlCaTyWQqNTc3Ryk9PDzc29vLZbMH+fwAaaJWq3H75eXLlyORyOTk5NTU1Pj4eK+TzfOn0bv2ewekhiNhaWnppZdeuvnmm7vuzuwVGKOWJa19dFZSUJjiUdMdjKmf3Ea8J+F0Oj2aTpOVFUpp/vBwY2Njf3+/XC4PZPM7jnq9LpLNRyKRmZmZubm5dDqdSCSGPclCF4HUcFScOHHiG9/4xp133jmQJCLtQgx+6qR+JpbVGPamLS3FAfzrtub4NSznM1/H2WhZW3M9mk6Pnj7NWykUCmtXrmxtbdm2PUBfT71eF8nmKaXz8/MrKyupVAr31EVq6AJ+7Md+7IknnvjEJz4x6I40h5v3zQmL5AfUlAwaei50LQPmmxeR13zvTArlCI+8DKlU6uxNN9100031er1YKFy9dm1jY2OwAQKMMZ5RzrKsaDQ6MzOzsrIS3B3Pewykhu7gkUceeeutt5588slBd6QJ9AxLfEGVWFvFocgIylZ3ylm3QbE0gwBGcOwRbnp70A1KSDQaHR8fHx8fP3v2bKlUKhQKPJpogN5Q27Z5Bu1r167FYjGeSHp+fn5QibkGAqSG7oBS+sd//MdXr1595plnBt0XPzTkBNMWEnyhRGPoyhKEV9SDtGRbIQXHYiEOqEIZGviyy1QqNTMzw9dZ5XK5vb29vb29AdIEz1iVy+U2NjZuv/32QXWj/0Bq6BoSicRTTz31xhtv/OAHPxh0XzzBHG+lj5PSCGraw8p8lQcF6Dvc+dMEFyVWVlZ4cPTOzs7BwUE+nx8Km84xAFJDNzE9Pf3888/fcsstAV+lx0SCBpNx0a0mSwo8p3ssFjNY8rnW4LtAk3oci/54XkgpX+PEu7S3t3f9+vWDg4NyuTzwEMxjDKSGLmN5efn1118/efJk15PNdgfCNynEB2V5lbMFpmJfYIz94JVXxFCcmJhYWlwcHR2l0IQpywvKVpowAkLngqbMwkEp5Uuz+UeRfIXnYjnqw0EAIDV0H/Pz888888w999wTzPVX0k52iolBDpSG+WOVtUM8fMiyrGgkMj4+vrC4ODY2Zjm14c3Eai7DoIeGzI7ApQnbtmu1Wi6Xu3r1qlhthTgikBp6gve///1/8Ad/8MlPfnLQHdHADYTOrO7GOGhWRt2RqTdm23bFtrd3drZ3dqLRaDKZHBsbm5mZGR8bg/lpfZZkdCVDjGVZ8Xh8ZmZmZmamXq8XCoWDg4Otra29vT0UJToGUkOv8Oijj168ePGpp54adEcMkMKfvavp4oMParWaSLgSi8XGx8cz4+MTExOpdFosANcXfXbWfx9EIhGePHppaYmLEnwr3Ww2izTRFpAaeogvfOELFy9e/Ld/+7dBdwRAZHwTBd7s0HFiyGq1ytc+EkLi8fj09DTfNjblrCYwmyG7zRTRaFQYJmzb5l06ODgoFArB1PUCBaSGHiKRSPzDP/zDu971Lr7zQiCgr49oIU/DUUKGK5XK+vo63106FostLizMzM4mR0YMu2/0MgOlZVliu23btre2ttbX1wuFQqVSQWnCCKSG3mJ6evrFF19cXl4OyvvnSA3uCiu4WMDZEVePg+7KzavV6uW1tctra4SQWCy2urq6vLwciURoM/9ld2FZlkjlZtv25ubm5cuXw5DusS0gNfQci4uLr7766jvf+c4guDO5j9D1SshCBHOyuRA5ArIXC42q1eqFCxcuXrwYjUZHRkYWFhYWFhb6vwO9ZVn81vV6netB165d62cW38ACqaEfuOmmm/76r//6537u5wYeoiMtxxYlIq7BlLilpxB75x4cHJw/f57vnTszMzM9Pd3X/f4IiUQikUhkeXl5eXmZ52ja39/f2toKLU0gNfQJDzzwwMsvv/zEE08MuiNAdGeMEMK8DY0wm1Mf5nPGWKFQ4HnTKKVjY2N8B7pMJtNnaYJvtz0xMXHDDTfw7Wr29/eHPod4m0Bq6B8ef/zxS5cuffWrXx1sNxp6hNgjG4Q8CejLq6LRaCqV6lvGGsZYLpfL5XKXL18mhExMTPCk8qlUqs80kUgk5ubm+HbboQJSQ1/xN3/zN6+++upLL7006I5Im9O4VkBfH8GNb3vb+TffLJVK/VeLlL0nlpeXx8bGYrEYJmXqHZAa+opYLPb8888vLy+XSqUjNnWkHdlh6jc5VWQjSSRPCQe8FYSQaDR689vfTggplUrr16/v7u7236QP957g6ylOnjyZyWT63I0wAKmh35iamjp37txNN93UWdTND/3QDz388MN33nnn0tJSB5e7S55E6jc9RpHXdJZg68pFMpk8c/r06VOnarVaoVDY2t4eyMoFxphIKs9NA0tLS+Pj4/3vybEEUsMAcObMmW9/+9t33XVXi7JDIpH4wAc+cP/99992222nTp06iiuROnvb8iaotgjSzeMGcjoZYyL5ygWeUp0xViwW84eHe3t72Wy2z7GG9Xq9WCwWi8X19fVYLJZOpzOZzOzsLF8Y2s+eHCcgNQwGt99++x/90R89+OCDPolJlpaW/t//+38/8RM/8f73v59nK+gCwJpLybIAgp2UK+D6S+IRPGlZVnp0dHR0dHFhoV6vHxwc7GezfElFn5WOarXKDROXLl2Kx+OTk5PcxxHaFI8dA6lhYPjYxz52/vz5P/3TP4WF0Wj0zJkzt9122y/90i/dcccd3Z/0GKOW1Qh8opTyceukWoD5GuBFTTI7ySV8l4fJyUlCqW3buzs72zs7hUKhWCz2mSYqlYrIFh2Px+fm5qanp1Op1MjISD+7MaRAahgk/uRP/uTy5cv//M//PDIyMjU19cADDzzyyCM8gLdHcDOmiGhIbawLXYM4B16b1jiNGjLE8hxzEcuanZubnZujhNiMbW5urq+vl0qlWq3Wf5q4cuXKlStXCCHxeHxpaWl+fj4ej/c//nJYgM9lwPja17729a9//ad/+qfj8Xh/XHHM2aVKJGVSzIwE+Cb0875NS7lhFYeoZVmLCwuLCwvM2f1hbW1tIMHjlUrlrbfeeuutt7i5hEdADt3Gc70GUsOAEY/Hf+ZnfqZ/9+OD1rZdtyUIfOLJXXjFpnTgRxkgXTUMvRbh2NFodGV5eWV5uVqrlcvlnZ2d6+vrxSM7dNuFbdulUunNN9+8cOFCPB4fGRmZn5+fm5vrc4x2MIHUEEo4i6ksZ1MZHhnp5Yxo3eSh+juIaolQEIvFYrHY6OjoyZMn+Sa6+/v729vbR4/7aAuMsXK5zGOi33jjjVQqNTY2NjU1NT09HVqNI6RfO7QQWSGF5YDCHaj4gWZ3bEmngNliTeW6iiF1jJCRkZGRZHJ2dvbGG28sFAq7u7v7+/u5XK7PSgdjjO+vff36dUJIJpOZnJzMZDLj4+OhookQfVUEAftcErjICto4HKnByAVKvIN6WqSWZoxRauksI6p59q/BGnyvmpWVFUJIPp/nm+gWi8X+b6KbzWaz2SwhhFLK97AaGxtLJpPH3jaB1BAuuBI+yCUtEr3pO2XDbWmU9PNum3JwhLiR6oHQhYVmflCO0dFRsaPc4eHh2trazs5OrVbrc2AV3wJjb2+Pf5yenl5ZWRkbG4tGo8cysAqpIVyQRHpt/qdOuKTwlUDTAz+wbdsSm2tDDQL4JvQs8nqsRIsbTyhIp9Nvf/vbGWO2bR8eHl6+fHlra6utFroFHqNNKeVxHKurq8dsKQdSQ+jQEBM8TAPiI9wgG4oPlmOwBNeAEQ4JwjlrjINQl4G3kwCOD8jx8fF3vOMd3MvAlY6dnZ0+h0swxmq12tbW1tbWFk9XlclkFhYWjsFSDqSGUAJM7BzMCYu0ZG0CkoKiX4gL3WgoEE/llgBRReSTM/So068iNtGdm5vjMdq5XG53d7f/SzlqtVo+n8/n81evXo3H42NjY5lMZnp6ekj310ZqCBdcCZ8xy1EWGsfa+NQdmf5+TT7s3ShsrWoXvoAvIpEITwx14sSJer2+t7e3u7uby+Xy+Xz/gy+5xnHhwgWuBA2dHIHUEDLISy05KQg7ZOv6v0+4dCPO2nQNvHuvU0hHIhG+nxVx0kZvbm4eHh6Wy+U+08Th4eH3vve9973vfcPl+xymviKODhG8wImAmw3cU6aNatXLNU1ECnxwWIafFeqDvu1lP236Im00IaRer1+/fv3KlSvlctm27f7QRK1Wy2az09PTfbhXt4DUEC40IhbgOijGqMklyeEV7KS4LRpZHpzVGfoFTYmgb/tQiLTR9Xq9Vqttbm5euXKlD8GXA08m3i6QGsIFLjXA4Q5jGYj3+FQ2ufNafMUcDwgBVUk7qkrfwLPLr66urq6ulsvlUqm0s7OzsbHR5xjtwAKpIXRgsjkAuiqJ9+ztFS4N450oSA+jGBRcCyXxDJQeIBKJRCKRyGQyp0+fLhaLPLv87u5uEHYVGhTCRQ0rKyvvfe97P/jBD955552D7suAoHgcjAuiHOhZIfVj1dagtd8EXisvBodkMplMJrlh4vDwcHt7O5vN5vP5sNHE8aeGaDS6vLz8Iz/yIw899NDtt99+LGNaW4e0kyWY0qWwRVDfaHQkHqzBlHZUZcNdZ9W9L9RbpNNpkTkun8+vr6/v7e2Vy2WftH3HBseWGiKRSCKR+LVf+7VPfOITw2UZ7g8kPcLDMaErEV4KRcMSQZq4MKH1gV9M+utHPApGR0dvvPFGfpzP53mMNuMbiB5HHENqOHv27KOPPnr33XeHebG9F6iToMENTGRMWjQBKnu5KonHukx+g0ZNk7YirbYgZqPDUGB0dPSWW27hUdI8/HF7e/uYccQxGTmRSOTee+/90Ic+9MM//MMnTpwIudaggzG2t7u7ublZLBRS6XQymXTPORHQXmZI3SuhtEydyGioRCgB0QyqLV6MQOlwkQWlNBaL8Ry5POH9wcHB1tbW3t6eHqM9dO8kPQZU98ILL5w9e/aYrXvrCiqVyt7u7v7+fnZ/H6rHPCciT53C0ytTD8BTxmN4wF9/SazQwp9EOASR6QMqLT18In1BvV7P5XI85302m2WMRSKRW2+9VWLkwOM4UAMCgu8Wk8vldra3c9msOtJk6YD/TafTyVQqkUjwXSQpIdTZ2I54UAMc/0aCgDShBkgRAzUQwQ7DTw0Qtm1ns9l0Oh2Pxwfdl/aA1HBMUK/XK5XKzvb2xvXrtXod7ivT8C/aNrUsZtvEiZJuVHByrvBhOzY2xjOd8QwlkAgsLX+kgRqcMa/QhCgUiRt0IjiW1DC8QGoYehQLhbW1tb29PaM22zRnPHWWWitvAqWUp0WMxWL+egRnBEpk4UDSK1QtQ0rZoOgUSA3BAFLDUILvCrWxsVGpVOr1Oh/2tm2LEaikWlAOCEz6Jpfo97IsKxqNjo6OTkxMxONxcaEqO1iWzgKqQgHZQeMCRb9ADBZIDcOEcqm0vbNzkMsVi0W7XleyqvGf0qLUVoIRCLHlFI8EXKjmgBQ+AvBmiAqxWCwej6fT6bGxMa48uwQhUtEauKGJ0UH0UylBDBBIDUEHYyx/cJDL5XK5XLFYVMIEOCj4SJXVTaKa2N4S1oc7XALHYWPNFahvOx+ZcxCPxVLpdCqZTKXTsViMWhZxHJlmW4MsKeguCaSGQAGpIaCo1WrFYnF/b29/b6/OBQRCCMzdSBruBiU1C9VCGJkmMqhBR+IdgOUKKKWaPUIgnkiMj4+n0umRRCIai/n7JlSfJVJDIIHUECAwxuq12mGhsLW5mc/niTNyhItBj5uRsrzyRM981xkewCvLCPBA+iuyzoOWlcqeEc2OxCG6Fo/HJ6emeBZ2KxKBoociLJh1CqSGYACpIRBgjG1vbW1ubtbr9UaCAyDPu0ZE26ZgOxkpuSsnDo9draEvkzij3WCk5A5OxjgRUCepvNsledxCK6boA/xWiURiZm4uk8nADXiph5iAUkOggNQwSBSLxZ2trcPDw1qt1rAUgrM2yIBAnY9wbneP5TrCrAClA1jN/ck1zwWBAoXTFK8gyR2iHedKaLBoLNMAoz0ajY4kEhOTk+Pj4xSEP/Cz4uvAj4jBAqmh37Bt++DgILu/XyqVqpWKsU5DO3CckURR8pUxD1wMxnFFQQtqg8KCIM/28F6SJUK2ZTJ4SrlQ7QTltS1KEyMjyZGRsfHx0dFRQROwq8gOQQBSQ59QqVQO8/l8Pn+YzzeylYIRTpQDoVCYFi8Sj5KGRYCqi5QkoUA2QBCdMuSmGteCZl2iMRomIX0oNk6lAiGU0tToaDqVSqXTyZGRxupP5IVgAKmhh2CMVcrlQqGwv79fKpXEkICSthg/YsEyHG+UBylA8V4ebAabonPKNSIo9AGOKWAiAn0fAGohIAXXGEFkVoJGEHgh0Ua+Q1UWpaNjY+Pj44mRkXg8bgy+QvQTSA3dh23b9VqNb53KPBbnKgqCoAYxoqDVQIluJEQWBAAUEUMpUYjGtWKCmkqsRKMR2UvqjnmdAqDhU9E7dH3EuRGTq1mUjo2PT0xOJhIJ4wa8iD4AqaGbKBaL21tbxWJRmdidI8fsz9c4cRdjM1uAYAcRdARFemgIgOIG9CaIYdxokLgzPAOTvHQWwrmL6KrwYkg+C9AZyEeSH0TTR0RX3b/C80qIZVnUssbGxqamp4du5eKwA6nhqGCMZff3c7lctVqt1+sU2OcJnHv1kSOX8LbgjGpohBAi5AUhR/haEBtM5MzkVKmsGSZgN9wGFcrwugremnhSjOFyrSaUaPh3jEYi0VgsnU6PZzJIE30AUkOHKJfL+YODYrFYKhbdUs3qBm2KZosjYAoh2ystQBjlfFiuaAQ66cDLVQ+F7PUUF6r+Tq2Ce4q4I981Z+rPB7KDTBPSQ1Cep3MV35M6mUym0+kY0kRvgNTQBvh+7cVCIZ/P12o14ixAcMOTPGRs3cugM4KxjloZlihuCK0y/F31oU5giVA6TJZIKhZQCEOJ3JTRlGAWNxRAYwoBcpBezbuReDyeTKWSyeRIMompQLsIpIbmqNVq1Url4ODgEG64LNsIlULXoeAUSiWmCpLUAJ0RCvXoHMGvkK0VkidCiAzawNMpRtIaYCEQDaSRrD8vXU9RhBHZbGm4kfIXPi4o5mgqTDwWGx0bS6ZSsVgsEonoXUO0DqQGMxhjtm2XisW9vb1qtdookq39cNZl0JInU4Z7FaQG1ogaIGJIgzquNU4TGYhs2CfOsXsjTTFhhFhKOKOsFKjKCJjJdX8HtHGoZwFruC5MTaKR6jvfmh9za6ul2E2hlxSwhuAIBmNAnVskEonxTCadTqOPozMgNaiwbTu7v39wcMAcO7mrqMuuPgHVvEekc2J4MCZNp1DI9/P/69O4Mx4IH/Og0MAmmngPgx0ElQgnhYEOoJgAjJqK3UR0yfU78BAm4DWBbGJmPc2QIflx4eUyfykqj7gFYcyyrFg8zmkCOaJ1IDU0UCqV8rlcuVJRNiZSJroG5EEueQr5eVhNUfWJO0QpPPbS1ZVCL2+CR8tuNSGWg8rQmeL2H/o1eaFzAD2Rki7j/ay8JBpFiBD3lU4J2Uox4jQzzRBwufi+lmVFotF4PJ5Kp1OpFNKEP0JNDbZtFwuFYrFYLpdtOSeCgPS66+Z6CKgAA1VZWuAgj0l1nPvA+Z3gECJeLUDThtIl/UAZ57qS7z2A3ULQGbH0Q5ILfEMzRbddCUv+C+FFQEw5lmUx5YFblhWLxRKJRDKZTIyMIE3oCCM1VKvVcrlcLBT4dunCgNdkoOoztumU627wECvcSzgUS5tzSowo0b5oRFGt4Qgn8CrYlNMOlNipo4AQOOXq5g/QDdZsbKtSkj+gYEJc+nBvC9rx09r0ZkGfiaN3SD8HqEAti2/JwdPtI01whIUaGGO1Wq1ULPIV0LzQTyJoNi0brANEGslw6nYHJ6isD36FAmCzqpNCqaArCwKmlVrSCFdyPcgVBIkYB60Uu+1c6PmUNJjJxXkm1KEDxnwZ1nskK8xC9Aeu3deidCSVSjk+jjDTxDGnBsZYvV4/yOUKhQIvcd9mXTsw2b3FR2KyIwjZVRqZ8jsHp2K1jixuECFrQGhvp+SkBMcEDgBikCZ85HNlYOtqPAPNwkAMo/JlDk/Q+iDZLOSHTIjKMlBHU1Qhy7JswFAGelI0KSI9VfgTK4JMenQ0PTrKt+TQv87xxrGlhmKxmD84qNdqwmnHwOCEH6n29ksWLAHwRhpefVhfZg31nVO8+nDCV6AYJpy+CfGBOAfKeNMFE+gmVKhHquNtX/SR9o100+g5tzvIC8OgqQI+cF3EEINWEVLEz2eBxV1G3tG7p/4u4lGD3kqEwpdyUJpMp0dHR8MTLnGsqIFvSVoqFmu1mpclvAFlQbFTqE/RPm+SMsNIM497vaSlS1fpAoU2H8IG3XkbjBMxZgwdA7KPaE01IohbKJ0ENyXK9K4Nb0I0YgXqgKHn+o8Cxz944F6Sjg6dpyTtwyQUKNB/AueRSPJgJBKJRCLcNnG8gy+PAzVUKpVyqVSpVBqxSeJVlic66aPHK+K+hd4vk5e07Fwnv5GiXBYNdLVZndhNGoc7bsEpOOzN+gi0fTiFRjlCkRFU2d6RmCBVGR+Eop6412rCgv4b6AKLz7P2GuetsImhEeMEAD8S6deJRCLxeDyRSMQTieMnTQwrNdi2Xa1WK+VyqVTiG5arfu/WDdpO5VYuMQ5pfgD5iMoitNkioFODiXQMJkAwoSnVKCAIr9+1jWEj988VkXzJ0bcNv9gwRRAz3hraKQ0GCCLJYk3aJLJeJjeuSm2a+MbAMyeERKNRnoQmFo1ax4ImhowabNuuVavFQqEMsyo6I03ftcms7TviLjONZypPFHAiNb6j0qTNz8gTr0HRNanxUDXwupDKjfs/K69bwxLibIfXAV8YJXbPdrxn+BZvRrx+I9EbL5ONkdBBbm4vVUI1Hqt3I8T4/hASjcWSqVQ8Hh9qH8dwUANjrFwqHebzNuyt79ummu4UQ70iUctvgPrDayo38dCfCSARV/d2ZGl4L9G+cSLiBjbYeONCbSsKVSanWsZ35ysJtV9/1w2soVkTYFPE+Y5QRzBO0dDua5uoxFNoF48Ofn1dpXK6K5ryVCGBKMHkU4bfV/5dFJ0LCmU6/yqaXSQWS6fTiURi6Dgi0NTAzYqVcrmRZ5UQotkR4NsGf2DlgBjnAe0tEbdQ3lFxlbtTg64gyNM+7C1R3sVmppBWr/IQ8t1jx9rqr7EbLLLgrEEmiQlPdAAADRFJREFUdwopCDpQ+tP4KJ6hj8Bv0rCkmVx+yKqApk31cHjDkSyJBibhjm8X2niGspjm9ctCZqRwpYn2RlFKo9EoD770+ikChSBSAzcr1mo1njSJaHo4lCoVIROOqFZU4o7VZtgCv69hNu5G47wFPy2912hHF/CT+bVvYfzVlAOvZqUXAEz7sMOqlCFzkD561RJ+ic4CHvWJSdczSmSRSETYJvSnFBAEhRps265WKtzL4CMTNi33wdEHak/hM5yItxbt0xwxcaXxXj638GFeAsaYzwjXaVpX3GC5V2uwmkE+6g360H4sFotGo7F4PGiBVQMeLfV6nTsalPWOEPrPo48iYwkxyqjeaNqI8nJ7STGwDgGji8ijRa+mX6Vc7nW7VnSTgaDp3X0Iq5XLW2nWq6TpJZ2hlXb0b82cxePxWCwajDw0A3hvGGO2bVcqlUq5XK/X3a74mpf1+cc4IBXoo8unxOdyr+/SSh98vlTr9VtsqitE0HHfvPSFVppVqNB4VVMByod2lVdIuaNoQddSjRzt9Tq1+L75vK6ikXgiMZJIWJGIBXY57Sf6Sg3crCh2c/MaUfqroM+BHYxGBW0NgA5Gi9cbwOcHn54bpxRiEiha7KfXYPNXMVpph8g/hL9C5KUXeIlgxhejRTb3+kY+LGC8F3Wcu/qN2kXHhEspjScSyWSyzxzRc2pgjHEBwWassf+Ciarb7cZg5WQBf3nYWK7MMHphi7NrK90wMot/x/QWiEbWpJ3nr3wjnxZ0UvAhFL2EOn5f49NrscM+c3uLY7t14m6XjimllmXF4/F4ItEHmujVAONGhFq1ClUGHcbHcZRh3xVhWBcFmzbuM/yIh0FOHwP+I9NLvGqFZJWb+g+/EEJ5OG2d9W/W/4XRYdRQdFiWxW0TsVisRzTRzdeCMVav12u1Wq1atcGGbgz4gQh87wkI74OzlugcaNkpovwz/Kg8POZcQ6maUoFSKampuU0B8avAU/BCfVzJZ9sApWqvxK1FN7z6eZT7KreQirX3Uqvp+e56tOlXhzGmcCvTwqL4d/RSYZwn0GhHuQreWVzIb2o8K+4F3hP3pqBN+Loy54AYX2O5DtPOwnJCpKgKIhdCcFdoNBaLRiK0ezTRBWqwbZvHL/PVTU2VxnZFO3jcdFbsLvT3T5nbW59GWqnpL6EYS5TuddAN/YsYv7UoMQo+PjMtAa8EhP+LodsFWn8ZmjbuXwjPenW+6/DpiVGcVBCJRKxIJB6Pd3Ex6JFE93qtVqlUFC9D36RTca8ORghp02LXbgs+Y0nvsJcqYby1Xgde3soXV4YZ7I+xnPiORv07wktaeR+6+874/GRNzQf6tV3XbZUn3LTPPqCUUkqj0WiPTA9H+ubVarVaqfi30Nlga4Upfe7ic9/OfgajyYB4DE7j3O5/eYvdMI43ZbY3XqIcNx0k+tdvccwoNX0mfyN6MbXobwJpJub4t8YPOn5RSZtCjc77lmUlRkZisVjT2x0F3XGD27Zdq9VqtRrPk6MMJFGNaC+3z7xqHHI+82SLY6DFX8UHTeXYFhtsS9gmnZJaZxf6jPCOybqzU0YW7qBxnaCJ6eHrryuR30+ivYc+EpN+C//3VqmjNB6NRuPxuNWv1ZxdJmnbtu16Ax3It71Gx6PLv02i8WBn7fhoEPpd9HfX5xKiUSfsvLEdna+J6X01fnF9YPiLNl4w9tPI7MaB6vVq+UzRrRQeEa20KR4gpZTbF/vGCAI9HJb1ep3ThOStMBFt00neq0Irv32vqaef1NYBesGG3b11u7pMV+CvZeiyiZH+iEbWrZC7fjkvgcdWJML9DgOMmO7Ha801jnqtxtdWd+uOvRiT/XxNjVO0T4mxD14ffaq19d7rH/UX3SjzK7fWRRj9LIePDA972Mqv3+JE0iO0eztKKbUszgiDCo6W+tP/Ga9WqzUSPTPmQ97+L5yob6Rtoxzr84Lqd/fvjFevlFfZ59X0EtGNgj3spFf3lDqtC9I+5cpNj/iqtD5UfCi4b0JQ0xu12xOf+pSvv+yxWbFdDFIYZjxECqzCPqK+51+zW5PGADWIgWgHTQXmthoxNmhkYeOF/EChUWKie51zdf4l8vTQVITRxSWiMX7r70YkEgnIIksjAqEnc/HBrtdr9Tp/3vznEgdtNdX09fWXyZteSwghvL7Sjtxb5lTgz5dq1bzuK34Pym9HKRVvp9OJxqspbqG89IQQJiVi0qUY3holIAjPNCR8HoUuhcFzogM+LXi1qY/DDt7Sbs0o3b2KEBKNRiPRKKW0/yzfFgJBDRCMsYabw7bd1ws+RFjonKJiPAA0xpIYzF6vLxwY1DuA2viiUy2iVnTV675eLbRS3v5g6wp0jm6JgokUCK+31gH1E0KIoAxT91S69CBiSKOwM2o14hIxvFCvJnWAEOVloJRyL0MQjAgtInDUAMFDsJltCx+H8a2Cr6D/i0iIISIdnvK6hVc7Xn9h+3pXCWiHyJWN5c4FEmdRvSYkI8BQrrgBa0IKk49dnlWIEr4qilzgdSDo1UuOUPjXWE79FkSondH7CR9Oi/Cn4JYJ2rIs7msIuIBgRKCpAYJLEgzkj5XQ4ntDTL9r03nee2J3Zw/jq+nzDrU1/4PKPjOtorm0Aq/WJAoDfNH01q006HNr5b7+Ng6oeSklotDnmehTBey/xPKaYuhSpzIlMMY1Be57NN12aDA01AAhaIKY3g8O5VsZ5lhZ0ybai6W0zDyqEe390yUIqpcr1jVhF1Ba1uVe+TWVDpjvekdF+QKFSomriAGTijR+FKr1upcy5xsncyLL3rq26K9VGZttOuErnT/KEAANUssKiN+xKxhKaoDgIVVMRFXpLxZ8v8ErpRje/GA0QPi/wd1650zoUEVvDUa9zIslnVI5fXvLd1FKxC28pnFCVLbVm/XspOkW+oGo4NMmFCUIIZZlRQKW8bUrGHpq4ODfgtsmlNfUKCJKb7/JrEW8Xz7VsiBP7G77YJYWnYR+Ad0MAdGKIGAUhcxWW3iJpsDr/WHGprw6oKtR+uXKsVNNImhvxa05j7eiNvpLE/oX0c867VBKuU3x+DGCwDGhBggmIAwTXjO8Uehty6fgJS0fxejlcTnjY6Sz36tLdjW1P6bjpnX0A+Mlki/WW19TdDfiVDaTXQtXEbl7sIRyMjjWjCBwDKkBghOEzVhj0mk2DTav0PFVxslcv9BrpiWyTm68xDgz60Z+vYL3dN2eedWoRvlbeZUJWfk6Xo00RcccamqKUhoeRhA45tQA0dgdjzHmrRjrqoRR5jdqBEodQjwnVZ/Z0muW02+q/2z6nGyE0kIrmovSE2Nr8IsYe+7Vgn/7bcOfbVusxgUWSnkKxqN3ahgRImqAaAgT3HhpnNZ0C7w+/frMtP4lxrNeU6XP7VqztBuYyF9MAAdewr+q3ZiOWyHEpvC/Spf/iYmPlJpE4y9YmfNBqAQEI0JKDRCcIzp+Cv5TvXLcHLJpsG146SlaBUMcVLMuScces26TbnvN1V66EtF0DeKhJfn4jHx0FlDO+aATdfKYAqnBhTBeNq8K3jyfaU1XT5SzuhxOtfa9miXaHMincaOO45bwMK2W53DdjshMxKf2xNRb3kPlffPRfYyc2wGMGpk4ZVkWCfxyhoEAqcEExpjDFPyjQY/QTXpKodam5/TopYB4WfWMdj59btc7bFSR9Db9b6FbE71smf5+nxYthToLH93ESCmqDE2B1NAEDHg3dN1VwKhBNLXw6eL3EU1xlHeztZfes7JHYRMdRASV+VOV0VPj22xLLOzjvnHKqQO/2yEcIDW0gYYc0Zsn1pmVzqcFXRfwuUQ50HUEYjLy+ZToxksvHUQ5q9Tx1J603rr1lchuZISOgNTQIVx1g/i6KvwDB4wwCu1edTo4K+oQT6dGq+he+EATZmz/RpTSLm7lFEIgNXQBEk10o7m+2sl1072P15ajLRVAL2zm5pB6YryvUUPhLhIUELoEpIauQsRc8k8mcVrA36ygqwas2SUtNgvbObr9v3Uc0Yzi06wwJfSg+fACqaFnkGmi+837Oylbvsp4ysvtarzcaOPQLRRN72t0fPp1iVLBC4iuA6mhHzAYL71CCf2hi/1toXumgUECZYS+AKmh3/B74C3GMnrVNEZD+EdktNgNb92+uWPSGGShdEO3dxCZATkdtNJ5RJeA1DBI4MM3QGNGFBAGAqSGoKDdH+IoVr0eWQS7BZQOggCkhkAC/Cg+FkEIJbrJK3LJGG5E5Gv1Y58KXl4YL98H1apJ7SAjBAZIDQHGsP00nQd0IiMED0gNQwV/34TRBKjXaSWM0idWsvVlUV4tGDuMCBiQGhBHRutrtBDDA6QGBAJhAK4/QSAQBiA1IBAIA5AaEAiEAUgNCATCAKQGBAJhAFIDAoEwAKkBgUAYgNSAQCAMQGpAIBAGIDUgEAgDkBoQCIQBSA0IBMIApAYEAmEAUgMCgTDg/wNRjwidU2RIFgAAAABJRU5ErkJggg==`;export const LOGIN_SVG = color =>diff --git a/apps/mobile/src/components/ActionIcon/index.js b/apps/mobile/src/components/ActionIcon/index.jsindex 128c89996..bf8dedb5b 100644--- a/apps/mobile/src/components/ActionIcon/index.js+++ b/apps/mobile/src/components/ActionIcon/index.js@@ -1,9 +1,9 @@import React from 'react';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {useTracked} from '../../provider';-import {PressableButton} from '../PressableButton';-import {SIZE} from '../../utils/SizeUtils';-import {hexToRGBA, RGB_Linear_Shade} from '../../utils/ColorUtils';+import { useTracked } from '../../provider';+import { PressableButton } from '../PressableButton';+import { SIZE } from '../../utils/SizeUtils';+import { hexToRGBA, RGB_Linear_Shade } from '../../utils/ColorUtils';import { showTooltip } from '../../utils';export const ActionIcon = ({@@ -21,17 +21,17 @@ export const ActionIcon = ({disabled,onLongPress,tooltipText,- type="gray"+ type = 'gray'}) => {const [state, dispatch] = useTracked();- const {colors} = state;+ const { colors } = state;return (<PressableButtontestID={testID}onPress={onPress}- hitSlop={{top: top, left: left, right: right, bottom: bottom}}- onLongPress={(event) => {+ hitSlop={{ top: top, left: left, right: right, bottom: bottom }}+ onLongPress={event => {if (onLongPress) {onLongPress();return;@@ -48,14 +48,13 @@ export const ActionIcon = ({justifyContent: 'center',alignItems: 'center',borderRadius: 100,- ...customStyle,- }}>+ ...customStyle+ }}+ ><Iconname={name}style={iconStyle}- color={- disabled ? RGB_Linear_Shade(-0.05, hexToRGBA(colors.nav)) : color- }+ color={disabled ? RGB_Linear_Shade(-0.05, hexToRGBA(colors.nav)) : color}size={size}/></PressableButton>diff --git a/apps/mobile/src/components/AddNotebookDialog/index.js b/apps/mobile/src/components/AddNotebookDialog/index.jsindex 9999f4539..0361fd55e 100644--- a/apps/mobile/src/components/AddNotebookDialog/index.js+++ b/apps/mobile/src/components/AddNotebookDialog/index.js@@ -1,24 +1,13 @@import React, { createRef } from 'react';-import {- Keyboard,- StyleSheet, TextInput, TouchableOpacity,- View-} from 'react-native';+import { Keyboard, StyleSheet, TextInput, TouchableOpacity, View } from 'react-native';import { FlatList } from 'react-native-gesture-handler';import { notesnook } from '../../../e2e/test.ids';import { useMenuStore } from '../../provider/stores';import { DDS } from '../../services/DeviceDetection';-import {- eSubscribeEvent,- eUnSubscribeEvent,- ToastEvent-} from '../../services/EventManager';+import { eSubscribeEvent, eUnSubscribeEvent, ToastEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';import { db } from '../../utils/database';-import {- eCloseAddNotebookDialog,- eOpenAddNotebookDialog-} from '../../utils/Events';+import { eCloseAddNotebookDialog, eOpenAddNotebookDialog } from '../../utils/Events';import { ph, pv, SIZE } from '../../utils/SizeUtils';import { sleep } from '../../utils/TimeUtils';import { ActionIcon } from '../ActionIcon';@@ -94,7 +83,7 @@ export class AddNotebookDialog extends React.Component {} else {this.setState({visible: true,- notebook:null+ notebook: null});}sleep(100).then(r => {@@ -115,7 +104,7 @@ export class AddNotebookDialog extends React.Component {};onDelete = index => {- let {topics} = this.state;+ let { topics } = this.state;let prevTopics = topics;refs = [];prevTopics.splice(index, 1);@@ -145,7 +134,7 @@ export class AddNotebookDialog extends React.Component {this.setState({loading: true});- let {topics, notebook} = this.state;+ let { topics, notebook } = this.state;if (!this.title || this.title?.trim().length === 0) {ToastEvent.show({@@ -176,9 +165,7 @@ export class AddNotebookDialog extends React.Component {if (notebook) {if (this.topicsToDelete?.length > 0) {- await db.notebooks- .notebook(toEdit.id)- .topics.delete(...this.topicsToDelete);+ await db.notebooks.notebook(toEdit.id).topics.delete(...this.topicsToDelete);toEdit = db.notebooks.notebook(toEdit.id).data;}@@ -189,7 +176,7 @@ export class AddNotebookDialog extends React.Component {});let nextTopics = toEdit.topics.map((topic, index) => {- let copy = {...topic};+ let copy = { ...topic };copy.title = prevTopics[index];return copy;});@@ -206,7 +193,7 @@ export class AddNotebookDialog extends React.Component {title: this.title,description: this.description,topics: prevTopics,- id:null+ id: null});}useMenuStore.getState().setMenuPins();@@ -224,9 +211,8 @@ export class AddNotebookDialog extends React.Component {onSubmit = (forward = true) => {this.hiddenInput.current?.focus();let willFocus = true;- let {topics} = this.state;- if (!this.currentInputValue || this.currentInputValue?.trim().length === 0)- return;+ let { topics } = this.state;+ if (!this.currentInputValue || this.currentInputValue?.trim().length === 0) return;let prevTopics = [...topics];if (this.prevItem === null) {@@ -235,7 +221,7 @@ export class AddNotebookDialog extends React.Component {topics: prevTopics});setTimeout(() => {- this.listRef.scrollToEnd({animated: true});+ this.listRef.scrollToEnd({ animated: true });}, 30);this.currentInputValue = null;} else {@@ -259,7 +245,7 @@ export class AddNotebookDialog extends React.Component {if (forward) {setTimeout(() => {- this.listRef.scrollToEnd({animated: true});+ this.listRef.scrollToEnd({ animated: true });}, 30);}}@@ -270,8 +256,8 @@ export class AddNotebookDialog extends React.Component {};render() {- const {colors} = this.props;- const {topics, visible, topicInputFocused, notebook} = this.state;+ const { colors } = this.props;+ const { topics, visible, topicInputFocused, notebook } = this.state;if (!visible) return null;return (<SheetWrapper@@ -293,13 +279,15 @@ export class AddNotebookDialog extends React.Component {});}}statusBarTranslucent={false}- onRequestClose={this.close}>+ onRequestClose={this.close}+ ><Viewstyle={{maxHeight: DDS.isTab ? '90%' : '100%',borderRadius: DDS.isTab ? 5 : 0,paddingHorizontal: 12- }}>+ }}+ ><TextInputref={this.hiddenInput}style={{@@ -311,11 +299,7 @@ export class AddNotebookDialog extends React.Component {blurOnSubmit={false}/><DialogHeader- title={- notebook && notebook.dateCreated- ? 'Edit Notebook'- : 'New Notebook'- }+ title={notebook && notebook.dateCreated ? 'Edit Notebook' : 'New Notebook'}paragraph={notebook && notebook.dateCreated? 'You are editing ' + this.title + ' notebook.'@@ -392,8 +376,8 @@ export class AddNotebookDialog extends React.Component {}}keyboardShouldPersistTaps="always"keyboardDismissMode="interactive"- ListFooterComponent={<View style={{height: 50}} />}- renderItem={({item, index}) => (+ ListFooterComponent={<View style={{ height: 50 }} />}+ renderItem={({ item, index }) => (<TopicItemitem={item}onPress={(item, index) => {@@ -419,11 +403,7 @@ export class AddNotebookDialog extends React.Component {width="100%"height={50}fontSize={SIZE.md}- title={- notebook && notebook.dateCreated- ? 'Save changes'- : 'Create notebook'- }+ title={notebook && notebook.dateCreated ? 'Save changes' : 'Create notebook'}type="accent"onPress={this.addNewNotebook}/>@@ -443,7 +423,7 @@ export class AddNotebookDialog extends React.Component {}}-const TopicItem = ({item, index, colors, onPress, onDelete}) => {+const TopicItem = ({ item, index, colors, onPress, onDelete }) => {const topicRef = ref => (refs[index] = ref);return (@@ -455,7 +435,8 @@ const TopicItem = ({item, index, colors, onPress, onDelete}) => {backgroundColor: colors.nav,borderRadius: 5,marginVertical: 5- }}>+ }}+ ><TouchableOpacitystyle={{width: '80%',@@ -489,7 +470,8 @@ const TopicItem = ({item, index, colors, onPress, onDelete}) => {alignItems: 'center',flexDirection: 'row',justifyContent: 'flex-end'- }}>+ }}+ ><ActionIcononPress={() => {onPress(item, index);diff --git a/apps/mobile/src/components/AddTopicDialog/index.js b/apps/mobile/src/components/AddTopicDialog/index.jsindex 7af89273d..bedfe4777 100644--- a/apps/mobile/src/components/AddTopicDialog/index.js+++ b/apps/mobile/src/components/AddTopicDialog/index.js@@ -1,27 +1,19 @@-import React, {createRef} from 'react';-import {Keyboard, LayoutAnimation, UIManager, View} from 'react-native';-import {- Transition,- Transitioning,- TransitioningView-} from 'react-native-reanimated';-import {useMenuStore} from '../../provider/stores';-import {- eSubscribeEvent,- eUnSubscribeEvent,- ToastEvent-} from '../../services/EventManager';+import React, { createRef } from 'react';+import { Keyboard, LayoutAnimation, UIManager, View } from 'react-native';+import { Transition, Transitioning, TransitioningView } from 'react-native-reanimated';+import { useMenuStore } from '../../provider/stores';+import { eSubscribeEvent, eUnSubscribeEvent, ToastEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';-import {db} from '../../utils/database';-import {eCloseAddTopicDialog, eOpenAddTopicDialog} from '../../utils/Events';-import {sleep} from '../../utils/TimeUtils';+import { db } from '../../utils/database';+import { eCloseAddTopicDialog, eOpenAddTopicDialog } from '../../utils/Events';+import { sleep } from '../../utils/TimeUtils';import BaseDialog from '../Dialog/base-dialog';import DialogButtons from '../Dialog/dialog-buttons';import DialogContainer from '../Dialog/dialog-container';import DialogHeader from '../Dialog/dialog-header';import Input from '../Input';import Seperator from '../Seperator';-import {Toast} from '../Toast';+import { Toast } from '../Toast';export class AddTopicDialog extends React.Component {constructor(props) {@@ -41,14 +33,14 @@ export class AddTopicDialog extends React.Component {addNewTopic = async () => {try {- this.setState({loading: true});+ this.setState({ loading: true });if (!this.title || this.title?.trim() === '') {ToastEvent.show({heading: 'Topic title is required',type: 'error',context: 'local'});- this.setState({loading: false});+ this.setState({ loading: false });return;}@@ -60,7 +52,7 @@ export class AddTopicDialog extends React.Component {await db.notebooks.notebook(topic.notebookId).topics.add(topic);}- this.setState({loading: false});+ this.setState({ loading: false });this.close();Navigation.setRoutesToUpdate([Navigation.routeNames.Notebooks,@@ -80,7 +72,7 @@ export class AddTopicDialog extends React.Component {eUnSubscribeEvent(eCloseAddTopicDialog, this.close);}- open = async ({notebookId, toEdit}) => {+ open = async ({ notebookId, toEdit }) => {let id = notebookId;if (id) {this.notebook = await db.notebooks.notebook(id).data;@@ -105,7 +97,7 @@ export class AddTopicDialog extends React.Component {};render() {- const {visible} = this.state;+ const { visible } = this.state;if (!visible) return null;return (<BaseDialog@@ -123,15 +115,14 @@ export class AddTopicDialog extends React.Component {bounce={false}statusBarTranslucent={false}visible={true}- onRequestClose={this.close}>+ onRequestClose={this.close}+ ><DialogContainer><DialogHeadericon="book-outline"title={this.toEdit ? 'Edit topic' : 'New topic'}paragraph={- this.toEdit- ? 'Edit title of the topic'- : 'Add a new topic in ' + this.notebook.title+ this.toEdit ? 'Edit title of the topic' : 'Add a new topic in ' + this.notebook.title}padding={12}/>@@ -139,7 +130,8 @@ export class AddTopicDialog extends React.Component {<Viewstyle={{paddingHorizontal: 12- }}>+ }}+ ><InputfwdRef={this.titleRef}onChangeText={value => {diff --git a/apps/mobile/src/components/Announcements/announcement.js b/apps/mobile/src/components/Announcements/announcement.jsindex b86fb0950..9850de779 100644--- a/apps/mobile/src/components/Announcements/announcement.js+++ b/apps/mobile/src/components/Announcements/announcement.js@@ -1,11 +1,11 @@import React from 'react';-import {FlatList, View} from 'react-native';-import {useTracked} from '../../provider';-import {useMessageStore, useSelectionStore} from '../../provider/stores';-import {Button} from '../Button';-import {allowedOnPlatform, renderItem} from './functions';+import { FlatList, View } from 'react-native';+import { useTracked } from '../../provider';+import { useMessageStore, useSelectionStore } from '../../provider/stores';+import { Button } from '../Button';+import { allowedOnPlatform, renderItem } from './functions';-export const Announcement = ({color}) => {+export const Announcement = ({ color }) => {const [state] = useTracked();const colors = state.colors;const announcements = useMessageStore(state => state.announcements);@@ -18,14 +18,16 @@ export const Announcement = ({color}) => {style={{backgroundColor: colors.bg,width: '100%'- }}>+ }}+ ><Viewstyle={{paddingVertical: 12,width: '100%',borderRadius: 10,overflow: 'hidden'- }}>+ }}+ ><Buttontype="errorShade"icon="close"@@ -48,11 +50,9 @@ export const Announcement = ({color}) => {width: '100%',marginTop: 15}}- data={announcement?.body.filter(item =>- allowedOnPlatform(item.platforms)- )}- renderItem={({item, index}) =>- renderItem({item: item, index: index, color: colors[color],inline:true})+ data={announcement?.body.filter(item => allowedOnPlatform(item.platforms))}+ renderItem={({ item, index }) =>+ renderItem({ item: item, index: index, color: colors[color], inline: true })}/></View>diff --git a/apps/mobile/src/components/Announcements/body.js b/apps/mobile/src/components/Announcements/body.jsindex 3fef67f8d..1941527b8 100644--- a/apps/mobile/src/components/Announcements/body.js+++ b/apps/mobile/src/components/Announcements/body.js@@ -3,8 +3,7 @@ import { useTracked } from '../../provider';import Paragraph from '../Typography/Paragraph';import { getStyle } from './functions';--export const Body = ({text, style = {}}) => {+export const Body = ({ text, style = {} }) => {const [state] = useTracked();const colors = state.colors;@@ -13,8 +12,9 @@ export const Body = ({text, style = {}}) => {style={{paddingHorizontal: 12,...getStyle(style)- }}>+ }}+ >{text}</Paragraph>);-};\ No newline at end of file+};diff --git a/apps/mobile/src/components/Announcements/cta.js b/apps/mobile/src/components/Announcements/cta.jsindex db857a208..3e7dfa0fa 100644--- a/apps/mobile/src/components/Announcements/cta.js+++ b/apps/mobile/src/components/Announcements/cta.js@@ -1,18 +1,18 @@import React from 'react';-import {View} from 'react-native';-import {useTracked} from '../../provider';-import {eSendEvent, presentSheet} from '../../services/EventManager';-import {eCloseAnnouncementDialog} from '../../utils/Events';-import {openLinkInBrowser} from '../../utils/functions';-import {SIZE} from '../../utils/SizeUtils';-import {sleep} from '../../utils/TimeUtils';+import { View } from 'react-native';+import { useTracked } from '../../provider';+import { eSendEvent, presentSheet } from '../../services/EventManager';+import { eCloseAnnouncementDialog } from '../../utils/Events';+import { openLinkInBrowser } from '../../utils/functions';+import { SIZE } from '../../utils/SizeUtils';+import { sleep } from '../../utils/TimeUtils';import SettingsBackupAndRestore from '../../views/Settings/backup-restore';-import {Button} from '../Button';+import { Button } from '../Button';import GeneralSheet from '../GeneralSheet';-import {PricingPlans} from '../Premium/pricing-plans';-import {allowedOnPlatform, getStyle} from './functions';+import { PricingPlans } from '../Premium/pricing-plans';+import { allowedOnPlatform, getStyle } from './functions';-export const Cta = ({actions, style = {}, color, inline}) => {+export const Cta = ({ actions, style = {}, color, inline }) => {const [state] = useTracked();const colors = state.colors;let buttons = actions.filter(item => allowedOnPlatform(item.platforms)) || [];@@ -51,7 +51,8 @@ export const Cta = ({actions, style = {}, color, inline}) => {style={{paddingHorizontal: 12,...getStyle(style)- }}>+ }}+ ><GeneralSheet context="premium_cta" />{buttons.length > 0 &&buttons.slice(0, 1).map(item => (diff --git a/apps/mobile/src/components/Announcements/description.js b/apps/mobile/src/components/Announcements/description.jsindex 867bfc221..093bb534c 100644--- a/apps/mobile/src/components/Announcements/description.js+++ b/apps/mobile/src/components/Announcements/description.js@@ -4,8 +4,7 @@ import { SIZE } from '../../utils/SizeUtils';import Paragraph from '../Typography/Paragraph';import { getStyle } from './functions';--export const Description = ({text, style = {}}) => {+export const Description = ({ text, style = {} }) => {const [state] = useTracked();const colors = state.colors;return (@@ -14,7 +13,8 @@ export const Description = ({text, style = {}}) => {style={{marginHorizontal: 12,...getStyle(style)- }}>+ }}+ >{text}</Paragraph>);diff --git a/apps/mobile/src/components/Announcements/functions.js b/apps/mobile/src/components/Announcements/functions.jsindex 45bd4fdbd..10598f857 100644--- a/apps/mobile/src/components/Announcements/functions.js+++ b/apps/mobile/src/components/Announcements/functions.js@@ -1,14 +1,14 @@import React, { Fragment } from 'react';-import {View} from 'react-native';-import {allowedPlatforms} from '../../provider/stores';-import {ProFeatures} from '../ResultDialog/pro-features';-import {Body} from './body';-import {Cta} from './cta';-import {Description} from './description';-import {List} from './list';-import {Photo} from './photo';-import {SubHeading} from './subheading';-import {Title} from './title';+import { View } from 'react-native';+import { allowedPlatforms } from '../../provider/stores';+import { ProFeatures } from '../ResultDialog/pro-features';+import { Body } from './body';+import { Cta } from './cta';+import { Description } from './description';+import { List } from './list';+import { Photo } from './photo';+import { SubHeading } from './subheading';+import { Title } from './title';export function allowedOnPlatform(platforms) {if (!platforms) return true;@@ -37,7 +37,8 @@ const Features = () => {paddingHorizontal: 12,alignItems: 'center',width: '100%'- }}>+ }}+ ><ProFeatures /></View>);@@ -47,7 +48,7 @@ const renderItems = {title: Title,description: Description,body: Body,- text:Body,+ text: Body,image: Photo,list: List,subheading: SubHeading,@@ -55,8 +56,16 @@ const renderItems = {callToActions: Cta};-export const renderItem = ({item, index, color,inline}) => {- const Item = renderItems[item.type] || Fragment+export const renderItem = ({ item, index, color, inline }) => {+ const Item = renderItems[item.type] || Fragment;- return <Item key={item.text || item.src || item.type} {...item} index={index} color={color} inline={inline} />;+ return (+ <Item+ key={item.text || item.src || item.type}+ {...item}+ index={index}+ color={color}+ inline={inline}+ />+ );};diff --git a/apps/mobile/src/components/Announcements/index.js b/apps/mobile/src/components/Announcements/index.jsindex 0c8fbf344..7c028fcec 100644--- a/apps/mobile/src/components/Announcements/index.js+++ b/apps/mobile/src/components/Announcements/index.js@@ -1,15 +1,12 @@-import React, {useEffect, useState} from 'react';-import {FlatList, View} from 'react-native';-import {useTracked} from '../../provider';-import {useMessageStore} from '../../provider/stores';-import {DDS} from '../../services/DeviceDetection';-import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';-import {- eCloseAnnouncementDialog,- eOpenAnnouncementDialog-} from '../../utils/Events';+import React, { useEffect, useState } from 'react';+import { FlatList, View } from 'react-native';+import { useTracked } from '../../provider';+import { useMessageStore } from '../../provider/stores';+import { DDS } from '../../services/DeviceDetection';+import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';+import { eCloseAnnouncementDialog, eOpenAnnouncementDialog } from '../../utils/Events';import BaseDialog from '../Dialog/base-dialog';-import {allowedOnPlatform, renderItem} from './functions';+import { allowedOnPlatform, renderItem } from './functions';export const AnnouncementDialog = () => {const [state] = useTracked();@@ -46,7 +43,8 @@ export const AnnouncementDialog = () => {centered={false}bottom={true}onRequestClose={close}- visible={visible}>+ visible={visible}+ ><Viewstyle={{width: DDS.isTab ? 600 : '100%',@@ -55,7 +53,8 @@ export const AnnouncementDialog = () => {borderRadius: DDS.isTab ? 10 : 0,overflow: 'hidden',marginBottom: DDS.isTab ? 20 : 0- }}>+ }}+ ><FlatListstyle={{width: '100%'diff --git a/apps/mobile/src/components/Announcements/list.js b/apps/mobile/src/components/Announcements/list.jsindex 796f7d7eb..249ddaa7b 100644--- a/apps/mobile/src/components/Announcements/list.js+++ b/apps/mobile/src/components/Announcements/list.js@@ -5,28 +5,32 @@ import { useTracked } from '../../provider';import Paragraph from '../Typography/Paragraph';import { getStyle } from './functions';-export const List = ({items, listType, style = {}}) => {+export const List = ({ items, listType, style = {} }) => {const [state] = useTracked();const colors = state.colors;-+return (<Viewstyle={{paddingHorizontal: 12,paddingLeft: listType === 'ordered' ? 25 : 25,...getStyle(style)- }}>+ }}+ >{items.map((item, index) => (<View+ key={item.text}style={{paddingVertical: 6,flexDirection: 'row'- }}>+ }}+ >{listType === 'ordered' ? (<Paragraphstyle={{marginRight: 5- }}>+ }}+ >{index + 1}.</Paragraph>) : (diff --git a/apps/mobile/src/components/Announcements/photo.js b/apps/mobile/src/components/Announcements/photo.jsindex 3d1642069..7a0f6c15f 100644--- a/apps/mobile/src/components/Announcements/photo.js+++ b/apps/mobile/src/components/Announcements/photo.js@@ -2,11 +2,10 @@ import React from 'react';import { Image } from 'react-native';import { getStyle } from './functions';--export const Photo = ({src, style = {}}) => {- return src ?(+export const Photo = ({ src, style = {} }) => {+ return src ? (<Image- source={{uri: src}}+ source={{ uri: src }}resizeMode="cover"style={{width: '100%',@@ -15,5 +14,5 @@ export const Photo = ({src, style = {}}) => {...getStyle(style)}}/>- ) : null-};\ No newline at end of file+ ) : null;+};diff --git a/apps/mobile/src/components/Announcements/subheading.js b/apps/mobile/src/components/Announcements/subheading.jsindex c7bbae4fb..39e0ea8a7 100644--- a/apps/mobile/src/components/Announcements/subheading.js+++ b/apps/mobile/src/components/Announcements/subheading.js@@ -4,8 +4,7 @@ import { SIZE } from '../../utils/SizeUtils';import Heading from '../Typography/Heading';import { getStyle } from './functions';--export const SubHeading = ({text, style = {}}) => {+export const SubHeading = ({ text, style = {} }) => {const [state] = useTracked();const colors = state.colors;@@ -16,7 +15,8 @@ export const SubHeading = ({text, style = {}}) => {marginHorizontal: 12,marginTop: 12,...getStyle(style)- }}>+ }}+ >{text}</Heading>);diff --git a/apps/mobile/src/components/Announcements/title.js b/apps/mobile/src/components/Announcements/title.jsindex 56285c64e..92fb70cc3 100644--- a/apps/mobile/src/components/Announcements/title.js+++ b/apps/mobile/src/components/Announcements/title.js@@ -1,21 +1,21 @@-import React from 'react';import { useTracked } from '../../provider';import Heading from '../Typography/Heading';import { getStyle } from './functions';-export const Title = ({text, style = {}}) => {- const [state] = useTracked();- const colors = state.colors;-- return (- <Heading- style={{- marginHorizontal: 12,- marginTop: 12,- ...getStyle(style)- }}>- {text}- </Heading>- );- };\ No newline at end of file+export const Title = ({ text, style = {} }) => {+ const [state] = useTracked();+ const colors = state.colors;++ return (+ <Heading+ style={{+ marginHorizontal: 12,+ marginTop: 12,+ ...getStyle(style)+ }}+ >+ {text}+ </Heading>+ );+};diff --git a/apps/mobile/src/components/AppLoader/index.js b/apps/mobile/src/components/AppLoader/index.jsindex ec8f9a8f8..9ac736126 100644--- a/apps/mobile/src/components/AppLoader/index.js+++ b/apps/mobile/src/components/AppLoader/index.js@@ -1,8 +1,8 @@-import React, {useEffect, useRef, useState} from 'react';-import {Appearance, Linking, Platform, SafeAreaView, View} from 'react-native';-import Animated, {Easing} from 'react-native-reanimated';+import React, { useEffect, useRef, useState } from 'react';+import { Appearance, Linking, Platform, SafeAreaView, View } from 'react-native';+import Animated, { Easing } from 'react-native-reanimated';import AnimatedProgress from 'react-native-reanimated-progress-bar';-import {useTracked} from '../../provider';+import { useTracked } from '../../provider';import {useFavoriteStore,useMessageStore,@@ -12,7 +12,7 @@ import {} from '../../provider/stores';import Backup from '../../services/Backup';import BiometricService from '../../services/BiometricService';-import {DDS} from '../../services/DeviceDetection';+import { DDS } from '../../services/DeviceDetection';import {eSendEvent,eSubscribeEvent,@@ -21,34 +21,30 @@ import {ToastEvent} from '../../services/EventManager';import PremiumService from '../../services/PremiumService';-import {editing, STORE_LINK} from '../../utils';-import {COLOR_SCHEME_DARK, COLOR_SCHEME_LIGHT} from '../../utils/Colors';-import {db} from '../../utils/database';-import {- eOpenAnnouncementDialog,- eOpenLoginDialog,- eOpenRateDialog-} from '../../utils/Events';-import {MMKV} from '../../utils/mmkv';-import {tabBarRef} from '../../utils/Refs';-import {SIZE} from '../../utils/SizeUtils';-import {sleep} from '../../utils/TimeUtils';+import { editing, STORE_LINK } from '../../utils';+import { COLOR_SCHEME_DARK, COLOR_SCHEME_LIGHT } from '../../utils/Colors';+import { db } from '../../utils/database';+import { eOpenAnnouncementDialog, eOpenLoginDialog, eOpenRateDialog } from '../../utils/Events';+import { MMKV } from '../../utils/mmkv';+import { tabBarRef } from '../../utils/Refs';+import { SIZE } from '../../utils/SizeUtils';+import { sleep } from '../../utils/TimeUtils';import SettingsBackupAndRestore from '../../views/Settings/backup-restore';-import {Button} from '../Button';+import { Button } from '../Button';import Input from '../Input';import Seperator from '../Seperator';import SplashScreen from '../SplashScreen';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';-import {checkVersion} from 'react-native-check-version';-import {Placeholder, SvgToPngView} from '../ListPlaceholders';-import {Update} from '../Update';-import {setRateAppMessage} from '../../services/Message';+import { checkVersion } from 'react-native-check-version';+import { Placeholder, SvgToPngView } from '../ListPlaceholders';+import { Update } from '../Update';+import { setRateAppMessage } from '../../services/Message';let passwordValue = null;let didVerifyUser = false;const opacityV = new Animated.Value(1);-const AppLoader = ({onLoad}) => {+const AppLoader = ({ onLoad }) => {const [state] = useTracked();const colors = state.colors;const [loading, setLoading] = useState(true);@@ -172,10 +168,7 @@ const AppLoader = ({onLoad}) => {const checkNeedsBackup = async () => {let settingsStore = useSettingStore.getState();let askForBackup = await MMKV.getItem('askForBackup');- if (- settingsStore.settings.reminder === 'off' ||- !settingsStore.settings.reminder- ) {+ if (settingsStore.settings.reminder === 'off' || !settingsStore.settings.reminder) {askForBackup = JSON.parse(askForBackup);if (askForBackup?.timestamp < Date.now()) {presentSheet({@@ -215,10 +208,7 @@ const AppLoader = ({onLoad}) => {});return;}- let verified = await BiometricService.validateUser(- 'Unlock to access your notes',- ''- );+ let verified = await BiometricService.validateUser('Unlock to access your notes', '');if (verified) {didVerifyUser = true;setVerifyUser(false);@@ -241,46 +231,40 @@ const AppLoader = ({onLoad}) => {return loading ? (<Animated.Viewstyle={{- backgroundColor:- Appearance.getColorScheme() === 'dark'- ? COLOR_SCHEME_DARK.bg- : colors.bg,+ backgroundColor: Appearance.getColorScheme() === 'dark' ? COLOR_SCHEME_DARK.bg : colors.bg,width: '100%',height: '100%',position: 'absolute',zIndex: 999,borderRadius: 10- }}>+ }}+ ><Animated.Viewstyle={{backgroundColor:- Appearance.getColorScheme() === 'dark'- ? COLOR_SCHEME_DARK.bg- : colors.bg,+ Appearance.getColorScheme() === 'dark' ? COLOR_SCHEME_DARK.bg : colors.bg,width: '100%',height: '100%',justifyContent: 'center',alignItems: 'center',borderRadius: 10,opacity: opacityV- }}>+ }}+ >{verifyUser ? (<SafeAreaViewstyle={{flex: 1,justifyContent: 'center',- width:- deviceMode !== 'mobile'- ? '50%'- : Platform.OS == 'ios'- ? '95%'- : '100%',+ width: deviceMode !== 'mobile' ? '50%' : Platform.OS == 'ios' ? '95%' : '100%',paddingHorizontal: 12- }}>+ }}+ ><Headingstyle={{alignSelf: 'center'- }}>+ }}+ >Verify your identity</Heading>@@ -289,9 +273,10 @@ const AppLoader = ({onLoad}) => {<Paragraphstyle={{alignSelf: 'center'- }}>- To keep your notes secure, please enter password of the- account you are logged in to.+ }}+ >+ To keep your notes secure, please enter password of the account you are logged in+ to.</Paragraph><Seperator /><Input@@ -317,9 +302,9 @@ const AppLoader = ({onLoad}) => {<Paragraphstyle={{alignSelf: 'center'- }}>- To keep your notes secure, please unlock app the with- biometrics.+ }}+ >+ To keep your notes secure, please unlock app the with biometrics.</Paragraph><Seperator /></>@@ -341,7 +326,8 @@ const AppLoader = ({onLoad}) => {height: 10,flexDirection: 'row',width: 100- }}>+ }}+ ><AnimatedProgressstyle={{backgroundColor:diff --git a/apps/mobile/src/components/AttachmentDialog/index.js b/apps/mobile/src/components/AttachmentDialog/index.jsindex a3eec0046..cd61ed93f 100644--- a/apps/mobile/src/components/AttachmentDialog/index.js+++ b/apps/mobile/src/components/AttachmentDialog/index.js@@ -5,15 +5,9 @@ import * as Progress from 'react-native-progress';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';import { useTracked } from '../../provider';import { useAttachmentStore } from '../../provider/stores';-import {- eSubscribeEvent,- eUnSubscribeEvent-} from '../../services/EventManager';+import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';import { db } from '../../utils/database';-import {- eCloseAttachmentDialog,- eOpenAttachmentsDialog-} from '../../utils/Events';+import { eCloseAttachmentDialog, eOpenAttachmentsDialog } from '../../utils/Events';import filesystem from '../../utils/filesystem';import { SIZE } from '../../utils/SizeUtils';import { ActionIcon } from '../ActionIcon';@@ -41,7 +35,7 @@ export const AttachmentDialog = () => {const open = item => {setNote(item);setVisible(true);- let _attachments = db.attachments.ofNote(item.id, "all");+ let _attachments = db.attachments.ofNote(item.id, 'all');setAttachments(_attachments);};@@ -62,13 +56,15 @@ export const AttachmentDialog = () => {fwdRef={actionSheetRef}onClose={async () => {setVisible(false);- }}>+ }}+ ><Viewstyle={{width: '100%',alignSelf: 'center',paddingHorizontal: 12- }}>+ }}+ ><DialogHeader title="Attachments" /><FlatListnestedScrollEnabled@@ -85,13 +81,14 @@ export const AttachmentDialog = () => {height: 150,justifyContent: 'center',alignItems: 'center'- }}>+ }}+ ><Icon name="attachment" size={60} color={colors.icon} /><Paragraph>No attachments on this note</Paragraph></View>}data={attachments}- renderItem={({item, index}) => (+ renderItem={({ item, index }) => (<Attachment attachment={item} note={note} setNote={setNote} />)}/>@@ -102,7 +99,8 @@ export const AttachmentDialog = () => {style={{textAlign: 'center',marginTop: 10- }}>+ }}+ ><Icon name="shield-key-outline" size={SIZE.xs} color={colors.icon} />{' '}All attachments are end-to-end encrypted.</Paragraph>@@ -128,7 +126,7 @@ function getFileExtension(filename) {return ext == null ? '' : ext[1];}-export const Attachment = ({attachment, encryption}) => {+export const Attachment = ({ attachment, encryption }) => {const [state] = useTracked();const colors = state.colors;const progress = useAttachmentStore(state => state.progress);@@ -149,7 +147,7 @@ export const Attachment = ({attachment, encryption}) => {useAttachmentStore.getState().remove(attachment.metadata.hash);return;}- filesystem.downloadAttachment(attachment.metadata.hash,false);+ filesystem.downloadAttachment(attachment.metadata.hash, false);};useEffect(() => {@@ -182,20 +180,23 @@ export const Attachment = ({attachment, encryption}) => {borderRadius: 5,backgroundColor: colors.nav}}- type="grayBg">+ type="grayBg"+ ><GeneralSheet context={attachment.metadata.hash} /><Viewstyle={{flexShrink: 1,flexDirection: 'row',alignItems: 'center'- }}>+ }}+ ><Viewstyle={{justifyContent: 'center',alignItems: 'center',marginLeft: -5- }}>+ }}+ ><Icon name="file" size={SIZE.xxxl} color={colors.icon} /><Paragraph@@ -204,7 +205,8 @@ export const Attachment = ({attachment, encryption}) => {color={colors.light}style={{position: 'absolute'- }}>+ }}+ >{getFileExtension(attachment.metadata.filename).toUpperCase()}</Paragraph></View>@@ -213,7 +215,8 @@ export const Attachment = ({attachment, encryption}) => {style={{flexShrink: 1,marginLeft: 10- }}>+ }}+ ><Paragraphsize={SIZE.sm - 1}style={{@@ -222,18 +225,15 @@ export const Attachment = ({attachment, encryption}) => {}}numberOfLines={1}lineBreakMode="middle"- color={colors.pri}>+ color={colors.pri}+ >{attachment.metadata.filename}</Paragraph>-<Paragraph color={colors.icon} size={SIZE.xs}>{formatBytes(attachment.length)}{' '}- {currentProgress?.type- ? '(' + currentProgress.type + 'ing - tap to cancel)'- : ''}+ {currentProgress?.type ? '(' + currentProgress.type + 'ing - tap to cancel)' : ''}</Paragraph>-</View></View>@@ -250,7 +250,8 @@ export const Attachment = ({attachment, encryption}) => {marginLeft: 5,marginTop: 5,marginRight: -5- }}>+ }}+ ><Progress.Circlesize={SIZE.xxl}progress={diff --git a/apps/mobile/src/components/Button/index.js b/apps/mobile/src/components/Button/index.jsindex 5739faf39..77e23216c 100644--- a/apps/mobile/src/components/Button/index.js+++ b/apps/mobile/src/components/Button/index.js@@ -1,10 +1,10 @@import React from 'react';-import {ActivityIndicator} from 'react-native';+import { ActivityIndicator } from 'react-native';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {useTracked} from '../../provider';-import {BUTTON_TYPES, showTooltip} from '../../utils';-import {ph, SIZE} from '../../utils/SizeUtils';-import {PressableButton} from '../PressableButton';+import { useTracked } from '../../provider';+import { BUTTON_TYPES, showTooltip } from '../../utils';+import { ph, SIZE } from '../../utils/SizeUtils';+import { PressableButton } from '../PressableButton';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';@@ -36,7 +36,7 @@ export const Button = ({iconColor}) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const textColor = buttonType.text? buttonType.text@@ -45,8 +45,7 @@ export const Button = ({? BUTTON_TYPES[type](accentColor, accentText).text: BUTTON_TYPES[type].text];- const Component = bold ? Heading : Paragraph-+ const Component = bold ? Heading : Paragraph;return (<PressableButton@@ -80,7 +79,8 @@ export const Button = ({alignItems: 'center',flexDirection: 'row',...style- }}>+ }}+ >{loading ? <ActivityIndicator color={textColor} size={fontSize + 4} /> : null}{icon && !loading && iconPosition === 'left' ? (<Icon@@ -88,7 +88,6 @@ export const Button = ({style={{marginRight: 0}}-color={iconColor || buttonType.text || textColor}size={iconSize}/>@@ -105,7 +104,8 @@ export const Button = ({marginRight: icon || (loading && iconPosition === 'right') ? 5 : 0},textStyle- ]}>+ ]}+ >{title}</Component>)}diff --git a/apps/mobile/src/components/Container/ContainerBottomButton.js b/apps/mobile/src/components/Container/ContainerBottomButton.jsindex db8c21174..02abcdb9a 100644--- a/apps/mobile/src/components/Container/ContainerBottomButton.js+++ b/apps/mobile/src/components/Container/ContainerBottomButton.js@@ -1,26 +1,16 @@-import React, {useEffect} from 'react';-import {Keyboard, Platform, View} from 'react-native';-import Animated, {Easing, sub} from 'react-native-reanimated';-import {useSafeAreaInsets} from 'react-native-safe-area-context';+import React, { useEffect } from 'react';+import { Keyboard, Platform, View } from 'react-native';+import Animated, { Easing, sub } from 'react-native-reanimated';+import { useSafeAreaInsets } from 'react-native-safe-area-context';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {notesnook} from '../../../e2e/test.ids';-import {useSettingStore} from '../../provider/stores';-import {- editing,- getElevation,- showTooltip,- TOOLTIP_POSITIONS,-} from '../../utils';-import {normalize, SIZE} from '../../utils/SizeUtils';-import {PressableButton} from '../PressableButton';+import { notesnook } from '../../../e2e/test.ids';+import { useSettingStore } from '../../provider/stores';+import { editing, getElevation, showTooltip, TOOLTIP_POSITIONS } from '../../utils';+import { normalize, SIZE } from '../../utils/SizeUtils';+import { PressableButton } from '../PressableButton';const translateY = new Animated.Value(0);-export const ContainerBottomButton = ({- title,- onPress,- color = 'accent',- shouldShow = false,-}) => {+export const ContainerBottomButton = ({ title, onPress, color = 'accent', shouldShow = false }) => {const insets = useSafeAreaInsets();const deviceMode = useSettingStore(state => state.deviceMode);@@ -28,7 +18,7 @@ export const ContainerBottomButton = ({Animated.timing(translateY, {toValue: translate,duration: 250,- easing: Easing.elastic(1),+ easing: Easing.elastic(1)}).start();}@@ -45,8 +35,8 @@ export const ContainerBottomButton = ({};useEffect(() => {- let sub1 = Keyboard.addListener('keyboardDidShow', onKeyboardShow);- let sub2 = Keyboard.addListener('keyboardDidHide', onKeyboardHide);+ let sub1 = Keyboard.addListener('keyboardDidShow', onKeyboardShow);+ let sub2 = Keyboard.addListener('keyboardDidHide', onKeyboardHide);return () => {sub1?.remove();sub2?.remove();@@ -67,13 +57,14 @@ export const ContainerBottomButton = ({zIndex: 10,transform: [{- translateY: translateY,+ translateY: translateY},{- translateX: translateY,- },- ],- }}>+ translateX: translateY+ }+ ]+ }}+ ><PressableButtontestID={notesnook.buttons.add}type="accent"@@ -81,20 +72,21 @@ export const ContainerBottomButton = ({accentText="light"customStyle={{...getElevation(5),- borderRadius: 100,+ borderRadius: 100}}onLongPress={event => {showTooltip(event, title, TOOLTIP_POSITIONS.LEFT);}}- onPress={onPress}>+ onPress={onPress}+ ><Viewstyle={{alignItems: 'center',justifyContent: 'center',- width: '100%',height: normalize(60),- width: normalize(60),- }}>+ width: normalize(60)+ }}+ ><Iconname={title === 'Clear all trash' ? 'delete' : 'plus'}color="white"diff --git a/apps/mobile/src/components/Container/ContainerTopSection.js b/apps/mobile/src/components/Container/ContainerTopSection.jsindex ad1eaec54..f32397afb 100644--- a/apps/mobile/src/components/Container/ContainerTopSection.js+++ b/apps/mobile/src/components/Container/ContainerTopSection.js@@ -3,9 +3,9 @@ import { View } from 'react-native';import { useTracked } from '../../provider';import { useSelectionStore } from '../../provider/stores';-export const ContainerTopSection = ({children}) => {+export const ContainerTopSection = ({ children }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const selectionMode = useSelectionStore(state => state.selectionMode);return !selectionMode ? (@@ -13,9 +13,10 @@ export const ContainerTopSection = ({children}) => {style={{backgroundColor: colors.bg,width: '100%',- overflow: 'hidden',- }}>+ overflow: 'hidden'+ }}+ >{children}</View>- ) : null+ ) : null;};diff --git a/apps/mobile/src/components/Container/index.js b/apps/mobile/src/components/Container/index.jsindex 65b6d4851..82d831dee 100644--- a/apps/mobile/src/components/Container/index.js+++ b/apps/mobile/src/components/Container/index.js@@ -2,25 +2,27 @@ import React from 'react';import { KeyboardAvoidingView, Platform, SafeAreaView } from 'react-native';import { useTracked } from '../../provider';import useIsFloatingKeyboard from '../../utils/use-is-floating-keyboard';-export const Container = ({children}) => {+export const Container = ({ children }) => {const [state] = useTracked();- const {colors, } = state;+ const { colors } = state;const floating = useIsFloatingKeyboard();return (- <KeyboardAvoidingView behavior="padding" enabled={Platform.OS === 'ios' && !floating }+ <KeyboardAvoidingView+ behavior="padding"+ enabled={Platform.OS === 'ios' && !floating}style={{- backgroundColor:colors.bg,- width:"100%",- height:"100%"+ backgroundColor: colors.bg,+ width: '100%',+ height: '100%'}}><SafeAreaViewstyle={{height: '100%',- backgroundColor:colors.bg,- overflow:"hidden",- }}>-+ backgroundColor: colors.bg,+ overflow: 'hidden'+ }}+ >{children}</SafeAreaView></KeyboardAvoidingView>diff --git a/apps/mobile/src/components/CustomTabs/index.js b/apps/mobile/src/components/CustomTabs/index.jsindex 9dbaad967..3fc308db1 100644--- a/apps/mobile/src/components/CustomTabs/index.js+++ b/apps/mobile/src/components/CustomTabs/index.js@@ -1,9 +1,9 @@-import React, {Component, createRef} from 'react';-import {Platform} from 'react-native';-import {Keyboard} from 'react-native';-import {FlatList, TextInput, View} from 'react-native';-import {DDS} from '../../services/DeviceDetection';-import {editing} from '../../utils';+import React, { Component, createRef } from 'react';+import { Platform } from 'react-native';+import { Keyboard } from 'react-native';+import { FlatList, TextInput, View } from 'react-native';+import { DDS } from '../../services/DeviceDetection';+import { editing } from '../../utils';export default class CustomTabs extends Component {constructor(props) {@@ -22,7 +22,7 @@ export default class CustomTabs extends Component {this.lastOffset = this.props.offsets.a;}- renderItem = ({item, index}) => this.props.items[index];+ renderItem = ({ item, index }) => this.props.items[index];onMoveShouldSetResponder = event => {if (this.responderAllowedScroll) return;@@ -69,8 +69,7 @@ export default class CustomTabs extends Component {this.currentDrawerState = true;this.goToIndex(0);}- this.props.onDrawerStateChange &&- this.props.onDrawerStateChange(this.currentDrawerState);+ this.props.onDrawerStateChange && this.props.onDrawerStateChange(this.currentDrawerState);}};@@ -78,8 +77,7 @@ export default class CustomTabs extends Component {if (this.page === 0) {this.goToIndex(1);this.currentDrawerState = false;- this.props.onDrawerStateChange &&- this.props.onDrawerStateChange(this.currentDrawerState);+ this.props.onDrawerStateChange && this.props.onDrawerStateChange(this.currentDrawerState);}};@@ -151,11 +149,7 @@ export default class CustomTabs extends Component {this.scrollTimeout = null;}this.scrollTimeout = setTimeout(() => {- if (- this.scrollOffset !== this.props.offsets.a &&- this.page === 1 &&- !this.scrollEnabled- ) {+ if (this.scrollOffset !== this.props.offsets.a && this.page === 1 && !this.scrollEnabled) {this.goToIndex(2, false);}}, 300);@@ -174,7 +168,7 @@ export default class CustomTabs extends Component {this.goToIndex(2);}if (this.page !== page) {- this.props.onChangeTab({i: page, from: this.page});+ this.props.onChangeTab({ i: page, from: this.page });this.page = page;}};@@ -202,17 +196,14 @@ export default class CustomTabs extends Component {let drawerState = page === 0 && this.scrollOffset < 150;if (drawerState !== this.currentDrawerState) {this.currentDrawerState = drawerState;- this.props.onDrawerStateChange &&- this.props.onDrawerStateChange(this.currentDrawerState);+ this.props.onDrawerStateChange && this.props.onDrawerStateChange(this.currentDrawerState);}this.props.toggleOverlay(- Math.floor(this.scrollOffset) < Math.floor(this.props.offsets.a - 10)- ? true- : false+ Math.floor(this.scrollOffset) < Math.floor(this.props.offsets.a - 10) ? true : false);if (this.page !== page) {this.scrollEndTimeout = setTimeout(() => {- this.props.onChangeTab({i: page, from: this.page});+ this.props.onChangeTab({ i: page, from: this.page });this.page = page;}, 50);}@@ -225,8 +216,7 @@ export default class CustomTabs extends Component {if (px > width * 0.75 || (DDS.isSmallTab && px > this.props.widths.a)) {this.goToIndex(1);this.currentDrawerState = false;- this.props.onDrawerStateChange &&- this.props.onDrawerStateChange(this.currentDrawerState);+ this.props.onDrawerStateChange && this.props.onDrawerStateChange(this.currentDrawerState);}}};@@ -239,10 +229,11 @@ export default class CustomTabs extends Component {onStartShouldSetResponderCapture={this.onMoveShouldSetResponder}style={{flex: 1- }}>+ }}+ ><TextInputref={this.inputElement}- style={{height: 1, padding: 0, width: 1, position: 'absolute'}}+ style={{ height: 1, padding: 0, width: 1, position: 'absolute' }}blurOnSubmit={false}/><FlatList@@ -270,11 +261,7 @@ export default class CustomTabs extends Component {disableIntervalMomentum={true}decelerationRate="fast"snapToAlignment="start"- snapToOffsets={[- this.props.offsets.a,- this.props.offsets.b,- this.props.offsets.c- ]}+ snapToOffsets={[this.props.offsets.a, this.props.offsets.b, this.props.offsets.c]}contentOffset={{x: editing.movedAway ? this.props.offsets.a : this.props.offsets.b}}diff --git a/apps/mobile/src/components/Dialog/BaseDialog.js b/apps/mobile/src/components/Dialog/BaseDialog.jsindex 923501b4c..c324b0b1a 100644--- a/apps/mobile/src/components/Dialog/BaseDialog.js+++ b/apps/mobile/src/components/Dialog/BaseDialog.js@@ -1,4 +1,4 @@-import React, {useEffect} from 'react';+import React, { useEffect } from 'react';import {Keyboard,KeyboardAvoidingView,@@ -8,9 +8,9 @@ import {StyleSheet,TouchableOpacity} from 'react-native';-import {useSettingStore} from '../../provider/stores';+import { useSettingStore } from '../../provider/stores';import useIsFloatingKeyboard from '../../utils/use-is-floating-keyboard';-import {BouncingView} from '../Transitions/bouncing-view';+import { BouncingView } from '../Transitions/bouncing-view';const BaseDialog = ({visible,@@ -60,18 +60,14 @@ const BaseDialog = ({if (!closeOnTouch) return null;useSettingStore.getState().setSheetKeyboardHandler(true);onRequestClose && onRequestClose();- }}>+ }}+ ><SafeAreaViewstyle={{- backgroundColor: background- ? background- : transparent- ? 'transparent'- : 'rgba(0,0,0,0.3)'- }}>- <KeyboardAvoidingView- enabled={!floating && Platform.OS === 'ios'}- behavior="padding">+ backgroundColor: background ? background : transparent ? 'transparent' : 'rgba(0,0,0,0.3)'+ }}+ >+ <KeyboardAvoidingView enabled={!floating && Platform.OS === 'ios'} behavior="padding"><BouncingViewduration={400}animated={animated}@@ -79,13 +75,10 @@ const BaseDialog = ({style={[styles.backdrop,{- justifyContent: centered- ? 'center'- : bottom- ? 'flex-end'- : 'flex-start'+ justifyContent: centered ? 'center' : bottom ? 'flex-end' : 'flex-start'}- ]}>+ ]}+ ><TouchableOpacityonPress={closeOnTouch ? onRequestClose : null}style={styles.overlayButton}diff --git a/apps/mobile/src/components/Dialog/DialogButtons.js b/apps/mobile/src/components/Dialog/DialogButtons.jsindex 2a70c3f1d..d123406fa 100644--- a/apps/mobile/src/components/Dialog/DialogButtons.js+++ b/apps/mobile/src/components/Dialog/DialogButtons.js@@ -1,11 +1,11 @@import React from 'react';-import {ActivityIndicator, StyleSheet, View} from 'react-native';-import {useTracked} from '../../provider';-import {SIZE} from '../../utils/SizeUtils';-import {Button} from '../Button';+import { ActivityIndicator, StyleSheet, View } from 'react-native';+import { useTracked } from '../../provider';+import { SIZE } from '../../utils/SizeUtils';+import { Button } from '../Button';import Paragraph from '../Typography/Paragraph';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {notesnook} from '../../../e2e/test.ids';+import { notesnook } from '../../../e2e/test.ids';const DialogButtons = ({onPressPositive,@@ -17,29 +17,31 @@ const DialogButtons = ({positiveType}) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;return (- <View style={[styles.container,{- backgroundColor:colors.nav,- height:60,- borderBottomRightRadius:10,- borderBottomLeftRadius:10,- paddingHorizontal:12- }]}>+ <View+ style={[+ styles.container,+ {+ backgroundColor: colors.nav,+ height: 60,+ borderBottomRightRadius: 10,+ borderBottomLeftRadius: 10,+ paddingHorizontal: 12+ }+ ]}+ >{loading ? (<ActivityIndicator color={colors.accent} size={SIZE.lg} />) : doneText ? (<Viewstyle={{flexDirection: 'row',- alignItems: 'center',- }}>- <Icon- color={colors.accent}- name="check-circle-outline"- size={SIZE.md}- />+ alignItems: 'center'+ }}+ >+ <Icon color={colors.accent} name="check-circle-outline" size={SIZE.md} /><Paragraph color={colors.accent}>{' ' + doneText}</Paragraph></View>) : (@@ -49,8 +51,9 @@ const DialogButtons = ({<Viewstyle={{flexDirection: 'row',- alignItems: 'center',- }}>+ alignItems: 'center'+ }}+ ><ButtononPress={onPressNegative}fontSize={SIZE.md}@@ -65,10 +68,10 @@ const DialogButtons = ({fontSize={SIZE.md}testID={notesnook.ids.default.dialog.yes}style={{- marginLeft: 10,+ marginLeft: 10}}bold- type={positiveType || "transparent"}+ type={positiveType || 'transparent'}title={positiveTitle}/>) : null}@@ -84,6 +87,6 @@ const styles = StyleSheet.create({justifyContent: 'space-between',alignItems: 'center',flexDirection: 'row',- marginTop: 10,- },+ marginTop: 10+ }});diff --git a/apps/mobile/src/components/Dialog/DialogContainer.js b/apps/mobile/src/components/Dialog/DialogContainer.jsindex 7ee648339..ca16079c6 100644--- a/apps/mobile/src/components/Dialog/DialogContainer.js+++ b/apps/mobile/src/components/Dialog/DialogContainer.js@@ -4,8 +4,8 @@ import { useTracked } from '../../provider';import { DDS } from '../../services/DeviceDetection';import { getElevation } from '../../utils';-const DialogContainer = ({width, height, ...restProps}) => {- const [state,] = useTracked();+const DialogContainer = ({ width, height, ...restProps }) => {+ const [state] = useTracked();const colors = state.colors;return (@@ -17,7 +17,7 @@ const DialogContainer = ({width, height, ...restProps}) => {maxHeight: height || 450,borderRadius: 10,backgroundColor: colors.bg,- paddingTop: 12,+ paddingTop: 12}}/>);diff --git a/apps/mobile/src/components/Dialog/DialogHeader.js b/apps/mobile/src/components/Dialog/DialogHeader.jsindex f93f00b7a..97d11e7ac 100644--- a/apps/mobile/src/components/Dialog/DialogHeader.js+++ b/apps/mobile/src/components/Dialog/DialogHeader.js@@ -1,9 +1,9 @@import React from 'react';-import {Text} from 'react-native';-import {View} from 'react-native';-import {useTracked} from '../../provider';-import {SIZE} from '../../utils/SizeUtils';-import {Button} from '../Button';+import { Text } from 'react-native';+import { View } from 'react-native';+import { useTracked } from '../../provider';+import { SIZE } from '../../utils/SizeUtils';+import { Button } from '../Button';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';@@ -29,22 +29,22 @@ const DialogHeader = ({justifyContent: 'space-between',minHeight: 50,paddingHorizontal: padding- }}>+ }}+ ><Viewstyle={{width: '100%'- }}>+ }}+ ><Viewstyle={{flexDirection: 'row',justifyContent: centered ? 'center' : 'space-between',alignItems: 'center'- }}>+ }}+ ><Heading size={SIZE.xl}>- {title}{' '}- {titlePart ? (- <Text style={{color: colors.accent}}>{titlePart}</Text>- ) : null}+ {title} {titlePart ? <Text style={{ color: colors.accent }}>{titlePart}</Text> : null}</Heading>{button ? (@@ -69,7 +69,8 @@ const DialogHeader = ({maxWidth: centered ? '90%' : '100%',alignSelf: centered ? 'center' : 'flex-start'}}- color={paragraphColor || colors.icon}>+ color={paragraphColor || colors.icon}+ >{paragraph}</Paragraph>) : null}diff --git a/apps/mobile/src/components/Dialog/functions.ts b/apps/mobile/src/components/Dialog/functions.tsindex 2ce3be094..14883237c 100644--- a/apps/mobile/src/components/Dialog/functions.ts+++ b/apps/mobile/src/components/Dialog/functions.ts@@ -1,28 +1,34 @@-import { eSendEvent } from "../../services/EventManager";-import { eCloseSimpleDialog, eOpenSimpleDialog } from "../../utils/Events";+import { eSendEvent } from '../../services/EventManager';+import { eCloseSimpleDialog, eOpenSimpleDialog } from '../../utils/Events';type DialogInfo = {- title?: string,- paragraph?: string,- positiveText?: string,- negativeText?: string,- positivePress?: (value:any) => void,- onClose?: () => void,- positiveType?: "transparent" | "gray" | "grayBg" | "accent" | "inverted" | "shade" | "error" | "errorShade",- icon?: string,- paragraphColor: string,- input:boolean,- inputPlaceholder:string,- defaultValue:string,- context:"global" | "local"-}+ title?: string;+ paragraph?: string;+ positiveText?: string;+ negativeText?: string;+ positivePress?: (value: any) => void;+ onClose?: () => void;+ positiveType?:+ | 'transparent'+ | 'gray'+ | 'grayBg'+ | 'accent'+ | 'inverted'+ | 'shade'+ | 'error'+ | 'errorShade';+ icon?: string;+ paragraphColor: string;+ input: boolean;+ inputPlaceholder: string;+ defaultValue: string;+ context: 'global' | 'local';+};export function presentDialog(data: DialogInfo): void {eSendEvent(eOpenSimpleDialog, data);}export function hideDialog(): void {-eSendEvent(eCloseSimpleDialog);--}\ No newline at end of file+}diff --git a/apps/mobile/src/components/Dialog/index.js b/apps/mobile/src/components/Dialog/index.jsindex c0fbd85ed..ee9d51f15 100644--- a/apps/mobile/src/components/Dialog/index.js+++ b/apps/mobile/src/components/Dialog/index.js@@ -13,7 +13,7 @@ import BaseDialog from './base-dialog';import DialogButtons from './dialog-buttons';import DialogHeader from './dialog-header';-export const Dialog = ({context = 'global'}) => {+export const Dialog = ({ context = 'global' }) => {const [state] = useTracked();const colors = state.colors;const [visible, setVisible] = useState(false);@@ -32,7 +32,7 @@ export const Dialog = ({context = 'global'}) => {input: false,inputPlaceholder: 'Enter some text',defaultValue: '',- disableBackdropClosing:false+ disableBackdropClosing: false});useEffect(() => {@@ -48,9 +48,7 @@ export const Dialog = ({context = 'global'}) => {const onPressPositive = async () => {if (dialogInfo.positivePress) {inputRef.current?.blur();- let result = await dialogInfo.positivePress(- inputValue || dialogInfo.defaultValue- );+ let result = await dialogInfo.positivePress(inputValue || dialogInfo.defaultValue);if (result === false) {return;}@@ -93,16 +91,16 @@ export const Dialog = ({context = 'global'}) => {closeOnTouch={!dialogInfo.disableBackdropClosing}onShow={async () => {if (dialogInfo.input) {-inputRef.current?.setNativeProps({- text:dialogInfo.defaultValue+ text: dialogInfo.defaultValue});await sleep(300);inputRef.current?.focus();}}}visible={true}- onRequestClose={hide}>+ onRequestClose={hide}+ ><View style={style}><DialogHeadertitle={dialogInfo.title}@@ -117,7 +115,8 @@ export const Dialog = ({context = 'global'}) => {<Viewstyle={{paddingHorizontal: 12- }}>+ }}+ ><InputfwdRef={inputRef}autoCapitalize="none"diff --git a/apps/mobile/src/components/DialogManager/Recievers.js b/apps/mobile/src/components/DialogManager/Recievers.jsindex 2287885af..1a8ec9fad 100644--- a/apps/mobile/src/components/DialogManager/Recievers.js+++ b/apps/mobile/src/components/DialogManager/Recievers.js@@ -1,4 +1,4 @@-import {eSendEvent} from '../../services/EventManager';+import { eSendEvent } from '../../services/EventManager';import {eCloseActionSheet,eCloseAddNotebookDialog,diff --git a/apps/mobile/src/components/DialogManager/index.js b/apps/mobile/src/components/DialogManager/index.jsindex 1aaa7ecec..f1fac2af7 100644--- a/apps/mobile/src/components/DialogManager/index.js+++ b/apps/mobile/src/components/DialogManager/index.js@@ -33,10 +33,7 @@ export class DialogManager extends Component {}shouldComponentUpdate(nextProps, nextState) {- return (- JSON.stringify(nextProps) !== JSON.stringify(this.props) ||- nextState !== this.state- );+ return JSON.stringify(nextProps) !== JSON.stringify(this.props) || nextState !== this.state;}onThemeChange = () => {@@ -54,7 +51,7 @@ export class DialogManager extends Component {}render() {- let {colors} = this.state;+ let { colors } = this.state;return (<><Dialog context="global" />diff --git a/apps/mobile/src/components/ExportDialog/index.js b/apps/mobile/src/components/ExportDialog/index.jsindex b8ef44534..85e195932 100644--- a/apps/mobile/src/components/ExportDialog/index.js+++ b/apps/mobile/src/components/ExportDialog/index.js@@ -18,18 +18,12 @@ import Seperator from '../Seperator';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';-const {- eSubscribeEvent,- eUnSubscribeEvent-} = require('../../services/EventManager');-const {- eOpenExportDialog,- eCloseExportDialog,-} = require('../../utils/Events');+const { eSubscribeEvent, eUnSubscribeEvent } = require('../../services/EventManager');+const { eOpenExportDialog, eCloseExportDialog } = require('../../utils/Events');const ExportDialog = () => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const [visible, setVisible] = useState(false);const actionSheetRef = useRef();@@ -75,9 +69,7 @@ const ExportDialog = () => {}setDoneText(`Note exported successfully! You can find the exported note in ${- Platform.OS === 'ios'- ? 'Files Manager/Notesnook'- : `Storage/Notesnook/exported/${name}`+ Platform.OS === 'ios' ? 'Files Manager/Notesnook' : `Storage/Notesnook/exported/${name}`}.`);@@ -137,13 +129,12 @@ const ExportDialog = () => {<Viewstyle={{paddingHorizontal: 12- }}>+ }}+ ><DialogHeadericon="export"title="Export Note"- paragraph={- 'All exports are saved in Notesnook/exported folder in phone storage'- }+ paragraph={'All exports are saved in Notesnook/exported folder in phone storage'}/></View>@@ -163,7 +154,8 @@ const ExportDialog = () => {justifyContent: 'flex-start',borderRadius: 0,paddingHorizontal: 12- }}>+ }}+ ><Viewstyle={{backgroundColor: colors.shade,@@ -172,24 +164,19 @@ const ExportDialog = () => {width: 60,justifyContent: 'center',alignItems: 'center'- }}>- <Icon- name={item.icon}- color={colors.accent}- size={SIZE.xxxl + 10}- />+ }}+ >+ <Icon name={item.icon} color={colors.accent} size={SIZE.xxxl + 10} /></View><Viewstyle={{flexShrink: 1- }}>- <Heading style={{marginLeft: 10}} size={SIZE.md}>+ }}+ >+ <Heading style={{ marginLeft: 10 }} size={SIZE.md}>{item.title}</Heading>- <Paragraph- style={{marginLeft: 10}}- size={SIZE.sm}- color={colors.icon}>+ <Paragraph style={{ marginLeft: 10 }} size={SIZE.sm} color={colors.icon}>{item.desc}</Paragraph></View>@@ -202,7 +189,8 @@ const ExportDialog = () => {width: '100%',paddingHorizontal: 12,marginTop: 10- }}>+ }}+ >{complete && (<><Button@@ -259,13 +247,12 @@ const ExportDialog = () => {marginTop: 5}}color={colors.icon}- size={SIZE.xs}>+ size={SIZE.xs}+ >{'Note exported as ' + result.fileName}</Paragraph>)}- {exporting && !complete && (- <Button loading={true} height={50} width="100%" />- )}+ {exporting && !complete && <Button loading={true} height={50} width="100%" />}</View></View></View>diff --git a/apps/mobile/src/components/ExportDialog/share.js b/apps/mobile/src/components/ExportDialog/share.jsindex 496977809..8cef067e2 100644--- a/apps/mobile/src/components/ExportDialog/share.js+++ b/apps/mobile/src/components/ExportDialog/share.js@@ -1,17 +1,18 @@import React from 'react';-import {View} from 'react-native';+import { View } from 'react-native';import FileViewer from 'react-native-file-viewer';import Share from 'react-native-share';-import {ToastEvent} from '../../services/EventManager';-import {SIZE} from '../../utils/SizeUtils';-import {Button} from '../Button';+import { ToastEvent } from '../../services/EventManager';+import { SIZE } from '../../utils/SizeUtils';+import { Button } from '../Button';-export const ShareComponent = ({uri, name, padding}) => {+export const ShareComponent = ({ uri, name, padding }) => {return (<Viewstyle={{paddingHorizontal: padding- }}>+ }}+ ><Buttontitle="Open"type="accent"diff --git a/apps/mobile/src/components/GeneralSheet/index.js b/apps/mobile/src/components/GeneralSheet/index.jsindex 979cc268e..66f5ff594 100644--- a/apps/mobile/src/components/GeneralSheet/index.js+++ b/apps/mobile/src/components/GeneralSheet/index.js@@ -15,9 +15,9 @@ import SheetWrapper from '../Sheet';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';-const GeneralSheet = ({context}) => {+const GeneralSheet = ({ context }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const [visible, setVisible] = useState(false);const [dialogData, setDialogData] = useState(null);const actionSheetRef = useRef();@@ -35,10 +35,7 @@ const GeneralSheet = ({context}) => {}, [visible]);const open = async data => {- if (- (data.context && !context) ||- (data.context && data.context !== context)- ) {+ if ((data.context && !context) || (data.context && data.context !== context)) {return;}if (visible || dialogData) {@@ -92,20 +89,19 @@ const GeneralSheet = ({context}) => {dialogData.onClose && dialogData.onClose();setVisible(false);setDialogData(null);- }}>+ }}+ ><Viewstyle={{justifyContent: 'center',alignItems: 'center',marginBottom:- !dialogData.progress &&- !dialogData.icon &&- !dialogData.title &&- !dialogData.paragraph+ !dialogData.progress && !dialogData.icon && !dialogData.title && !dialogData.paragraph? 0: 10,paddingHorizontal: 12- }}>+ }}+ >{dialogData?.progress ? (<ActivityIndicatorstyle={{@@ -127,9 +123,7 @@ const GeneralSheet = ({context}) => {{dialogData?.title ? <Heading> {dialogData?.title}</Heading> : null}{dialogData?.paragraph ? (- <Paragraph style={{textAlign: 'center'}}>- {dialogData?.paragraph}- </Paragraph>+ <Paragraph style={{ textAlign: 'center' }}>{dialogData?.paragraph}</Paragraph>) : null}</View>@@ -141,14 +135,15 @@ const GeneralSheet = ({context}) => {style={{paddingHorizontal: 12,marginBottom: dialogData.valueArray ? 12 : 0- }}>+ }}+ >{dialogData.valueArray &&dialogData.valueArray.map(v => (<Buttontitle={v}type="gray"key={v}- textStyle={{fontWeight: 'normal'}}+ textStyle={{ fontWeight: 'normal' }}fontSize={SIZE.sm}icon="check"width="100%"@@ -163,7 +158,8 @@ const GeneralSheet = ({context}) => {<Viewstyle={{paddingHorizontal: 12- }}>+ }}+ >{dialogData?.action ? (<ButtononPress={dialogData.action}@@ -171,7 +167,6 @@ const GeneralSheet = ({context}) => {title={dialogData.actionText}accentColor={dialogData.iconColor || 'accent'}accentText="light"- fontSize={SIZE.lg}type="accent"height={50}width="100%"@@ -205,12 +200,9 @@ const GeneralSheet = ({context}) => {}}size={SIZE.xs}onPress={dialogData.learnMorePress}- color={colors.icon}>- <Icon- color={colors.icon}- name="information-outline"- size={SIZE.xs}- />{' '}+ color={colors.icon}+ >+ <Icon color={colors.icon} name="information-outline" size={SIZE.xs} />{' '}{dialogData.learnMore}</Paragraph>) : null}diff --git a/apps/mobile/src/components/Github/issue.js b/apps/mobile/src/components/Github/issue.jsindex 573644466..68a8bf944 100644--- a/apps/mobile/src/components/Github/issue.js+++ b/apps/mobile/src/components/Github/issue.js@@ -5,7 +5,7 @@ import { useTracked } from '../../provider';import { useUserStore } from '../../provider/stores';import { eSendEvent, ToastEvent } from '../../services/EventManager';import PremiumService from '../../services/PremiumService';-import { APP_VERSION } from "../../../version";+import { APP_VERSION } from '../../../version';import { db } from '../../utils/database';import { eCloseProgressDialog } from '../../utils/Events';import { openLinkInBrowser } from '../../utils/functions';@@ -29,9 +29,8 @@ export const Issue = () => {const onPress = async () => {if (loading) return;if (!title.current || !body.current) return;- if (title.current?.trim() === '' || body.current?.trim().length === 0)- return;-+ if (title.current?.trim() === '' || body.current?.trim().length === 0) return;+try {setLoading(true);@@ -43,8 +42,8 @@ export const Issue = () => {**Device information:**App version: ${APP_VERSION}Platform: ${Platform.OS}-Model: ${Platform.constants.Brand || ""}-${Platform.constants.Model|| ""}-${- Platform.constants.Version || ""+Model: ${Platform.constants.Brand || ''}-${Platform.constants.Model || ''}-${+ Platform.constants.Version || ''}Pro: ${PremiumService.get()}Logged in: ${user ? 'yes' : 'no'}`,@@ -65,11 +64,12 @@ Logged in: ${user ? 'yes' : 'no'}`,}}onPress={() => {Linking.openURL(issue_url);- }}>+ }}+ >{issue_url}.</Text>{' '}- Please note that we will respond to your issue on the given link. We- recommend that you save it.+ Please note that we will respond to your issue on the given link. We recommend that you+ save it.</Text>),positiveText: 'Copy link',@@ -97,7 +97,8 @@ Logged in: ${user ? 'yes' : 'no'}`,<Viewstyle={{paddingHorizontal: 12- }}>+ }}+ ><DialogHeadertitle="Report issue"paragraph="Let us know if you have faced any issue/bug while using Notesnook."@@ -116,7 +117,7 @@ Logged in: ${user ? 'yes' : 'no'}`,fontFamily: 'OpenSans-Regular',marginBottom: 10,fontSize: SIZE.md,- color:colors.heading,+ color: colors.heading}}placeholderTextColor={colors.placeholder}/>@@ -140,15 +141,14 @@ For example:maxHeight: 200,fontSize: SIZE.sm,marginBottom: 2.5,- color:colors.pri+ color: colors.pri}}placeholderTextColor={colors.placeholder}/><Paragraphsize={SIZE.xs}- color={- colors.icon- }>{`App version: ${APP_VERSION} Platform: ${Platform.OS} Model: ${Platform.constants.Brand}-${Platform.constants.Model}-${Platform.constants.Version}`}</Paragraph>+ color={colors.icon}+ >{`App version: ${APP_VERSION} Platform: ${Platform.OS} Model: ${Platform.constants.Brand}-${Platform.constants.Model}-${Platform.constants.Version}`}</Paragraph><Seperator /><Button@@ -166,7 +166,8 @@ For example:style={{marginTop: 10,textAlign: 'center'- }}>+ }}+ >The information above will be publically available at{' '}<TextonPress={() => {@@ -175,11 +176,11 @@ For example:style={{textDecorationLine: 'underline',color: colors.accent- }}>+ }}+ >github.com/streetwriters/notesnook.</Text>{' '}- If you want to ask something in general or need some assistance, we- would suggest that you{' '}+ If you want to ask something in general or need some assistance, we would suggest that you{' '}<Textstyle={{textDecorationLine: 'underline',@@ -189,7 +190,8 @@ For example:try {await openLinkInBrowser('https://discord.gg/zQBK97EE22', colors);} catch (e) {}- }}>+ }}+ >join our community on Discord.</Text></Paragraph>diff --git a/apps/mobile/src/components/Header/HeaderLeftMenu.js b/apps/mobile/src/components/Header/HeaderLeftMenu.jsindex 531488612..1aca3f90e 100644--- a/apps/mobile/src/components/Header/HeaderLeftMenu.js+++ b/apps/mobile/src/components/Header/HeaderLeftMenu.js@@ -7,9 +7,9 @@ import Navigation from '../../services/Navigation';import { SIZE } from '../../utils/SizeUtils';import { ActionIcon } from '../ActionIcon';-export const HeaderLeftMenu = ({currentScreen,headerMenuState}) => {+export const HeaderLeftMenu = ({ currentScreen, headerMenuState }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const deviceMode = useSettingStore(state => state.deviceMode);const onLeftButtonPress = () => {@@ -20,12 +20,9 @@ export const HeaderLeftMenu = ({currentScreen,headerMenuState}) => {Navigation.goBack();};-return (<>- {deviceMode !== "tablet" ||- currentScreen === 'Search' ||- !headerMenuState ? (+ {deviceMode !== 'tablet' || currentScreen === 'Search' || !headerMenuState ? (<ActionIcontestID={notesnook.ids.default.header.buttons.left}customStyle={{@@ -35,11 +32,11 @@ export const HeaderLeftMenu = ({currentScreen,headerMenuState}) => {width: 40,borderRadius: 100,marginLeft: -5,- marginRight:DDS.isLargeTablet()? 10 : 25,+ marginRight: DDS.isLargeTablet() ? 10 : 25}}left={40}top={40}- right={DDS.isLargeTablet()? 10 : 25}+ right={DDS.isLargeTablet() ? 10 : 25}onPress={onLeftButtonPress}onLongPress={() => {Navigation.popToTop();@@ -47,7 +44,7 @@ export const HeaderLeftMenu = ({currentScreen,headerMenuState}) => {name={!headerMenuState ? 'arrow-left' : 'menu'}color={colors.pri}iconStyle={{- marginLeft: !headerMenuState ? -5 : 0,+ marginLeft: !headerMenuState ? -5 : 0}}/>) : undefined}diff --git a/apps/mobile/src/components/Header/HeaderRightMenu.js b/apps/mobile/src/components/Header/HeaderRightMenu.jsindex 2184a0498..0922f8b41 100644--- a/apps/mobile/src/components/Header/HeaderRightMenu.js+++ b/apps/mobile/src/components/Header/HeaderRightMenu.js@@ -11,9 +11,9 @@ import { sleep } from '../../utils/TimeUtils';import { ActionIcon } from '../ActionIcon';import { Button } from '../Button';-export const HeaderRightMenu = ({currentScreen, action, rightButtons}) => {+export const HeaderRightMenu = ({ currentScreen, action, rightButtons }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const deviceMode = useSettingStore(state => state.deviceMode);const menuRef = useRef();return (@@ -25,7 +25,6 @@ export const HeaderRightMenu = ({currentScreen, action, rightButtons}) => {menu: false});}}-name="magnify"color={colors.pri}customStyle={styles.rightBtn}@@ -40,10 +39,10 @@ export const HeaderRightMenu = ({currentScreen, action, rightButtons}) => {iconSize={SIZE.xl}type="shade"hitSlop={{- top:10,- right:10,- bottom:10,- left:0+ top: 10,+ right: 10,+ bottom: 10,+ left: 0}}style={{marginLeft: 10,@@ -51,8 +50,8 @@ export const HeaderRightMenu = ({currentScreen, action, rightButtons}) => {height: 32,borderRadius: 5,paddingHorizontal: 0,- borderWidth:1,- borderColor:colors.accent+ borderWidth: 1,+ borderColor: colors.accent}}/>) : null}@@ -75,7 +74,8 @@ export const HeaderRightMenu = ({currentScreen, action, rightButtons}) => {color={colors.pri}customStyle={styles.rightBtn}/>- }>+ }+ >{rightButtons.map((item, index) => (<MenuItemkey={item.title}@@ -87,7 +87,8 @@ export const HeaderRightMenu = ({currentScreen, action, rightButtons}) => {textStyle={{fontSize: SIZE.md,color: colors.pri- }}>+ }}+ ><Icon name={item.icon} size={SIZE.md} />{' ' + item.title}</MenuItem>diff --git a/apps/mobile/src/components/Header/index.js b/apps/mobile/src/components/Header/index.jsindex 12a11260d..c5f583629 100644--- a/apps/mobile/src/components/Header/index.js+++ b/apps/mobile/src/components/Header/index.js@@ -1,20 +1,20 @@-import React, {useEffect, useState} from 'react';-import {Platform, StyleSheet, View} from 'react-native';-import {useSafeAreaInsets} from 'react-native-safe-area-context';-import {useTracked} from '../../provider';-import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';+import React, { useEffect, useState } from 'react';+import { Platform, StyleSheet, View } from 'react-native';+import { useSafeAreaInsets } from 'react-native-safe-area-context';+import { useTracked } from '../../provider';+import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';import SearchService from '../../services/SearchService';-import {eScrollEvent} from '../../utils/Events';-import {ActionIcon} from '../ActionIcon';-import {SearchInput} from '../SearchInput';-import {HeaderLeftMenu} from './HeaderLeftMenu';-import {HeaderRightMenu} from './HeaderRightMenu';-import {Title} from './title';+import { eScrollEvent } from '../../utils/Events';+import { ActionIcon } from '../ActionIcon';+import { SearchInput } from '../SearchInput';+import { HeaderLeftMenu } from './HeaderLeftMenu';+import { HeaderRightMenu } from './HeaderRightMenu';+import { Title } from './title';export const Header = React.memo(- ({root, title, screen, isBack, color, action, rightButtons, notebook}) => {+ ({ root, title, screen, isBack, color, action, rightButtons, notebook }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const insets = useSafeAreaInsets();const [hide, setHide] = useState(true);@@ -44,9 +44,10 @@ export const Header = React.memo(overflow: 'hidden',borderBottomWidth: 1,borderBottomColor: hide ? 'transparent' : colors.nav,- justifyContent: 'space-between',+ justifyContent: 'space-between'}- ]}>+ ]}+ ><View style={styles.leftBtnContainer}><HeaderLeftMenu headerMenuState={!isBack} currentScreen={screen} />@@ -59,11 +60,7 @@ export const Header = React.memo(/></View>- <HeaderRightMenu- rightButtons={rightButtons}- action={action}- currentScreen={screen}- />+ <HeaderRightMenu rightButtons={rightButtons} action={action} currentScreen={screen} /></View>);},diff --git a/apps/mobile/src/components/Header/title.js b/apps/mobile/src/components/Header/title.jsindex 406f762ed..d0cab1391 100644--- a/apps/mobile/src/components/Header/title.js+++ b/apps/mobile/src/components/Header/title.js@@ -1,20 +1,16 @@-import React, {useEffect, useState} from 'react';-import {View} from 'react-native';-import {useTracked} from '../../provider';-import {- eSendEvent,- eSubscribeEvent,- eUnSubscribeEvent-} from '../../services/EventManager';+import React, { useEffect, useState } from 'react';+import { View } from 'react-native';+import { useTracked } from '../../provider';+import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';-import {eOnNewTopicAdded, eScrollEvent} from '../../utils/Events';-import {SIZE} from '../../utils/SizeUtils';+import { eOnNewTopicAdded, eScrollEvent } from '../../utils/Events';+import { SIZE } from '../../utils/SizeUtils';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';-export const Title = ({heading, headerColor, screen, notebook}) => {+export const Title = ({ heading, headerColor, screen, notebook }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const [hide, setHide] = useState(screen === 'Notebook' ? true : false);const onScroll = data => {@@ -59,7 +55,8 @@ export const Title = ({heading, headerColor, screen, notebook}) => {opacity: 1,flexShrink: 1,flexDirection: 'row'- }}>+ }}+ >{!hide ? (<HeadingonPress={navigateToNotebook}@@ -68,16 +65,15 @@ export const Title = ({heading, headerColor, screen, notebook}) => {style={{flexWrap: 'wrap'}}- color={headerColor}>+ color={headerColor}+ >{notebook ? (<Paragraph numberOfLines={1} size={SIZE.xs + 1}>{notebook?.title}{'\n'}</Paragraph>) : null}- <Heading color={colors.accent}>- {heading.slice(0, 1) === '#' ? '#' : null}- </Heading>+ <Heading color={colors.accent}>{heading.slice(0, 1) === '#' ? '#' : null}</Heading>{heading.slice(0, 1) === '#' ? heading.slice(1) : heading}</Heading>) : null}diff --git a/apps/mobile/src/components/ImagePreview/index.js b/apps/mobile/src/components/ImagePreview/index.jsindex 0021f41ae..5e8f1f660 100644--- a/apps/mobile/src/components/ImagePreview/index.js+++ b/apps/mobile/src/components/ImagePreview/index.js@@ -1,14 +1,11 @@-import React, {useEffect, useState} from 'react';-import {View} from 'react-native';+import React, { useEffect, useState } from 'react';+import { View } from 'react-native';import ImageViewer from 'react-native-image-zoom-viewer';import RNFetchBlob from 'rn-fetch-blob';import Storage from '../../utils/storage';-import {ActionIcon} from '../ActionIcon';+import { ActionIcon } from '../ActionIcon';import BaseDialog from '../Dialog/base-dialog';-const {- eSubscribeEvent,- eUnSubscribeEvent-} = require('../../services/EventManager');+const { eSubscribeEvent, eUnSubscribeEvent } = require('../../services/EventManager');const ImagePreview = () => {const [visible, setVisible] = useState(false);@@ -40,7 +37,8 @@ const ImagePreview = () => {width: '100%',height: '100%',backgroundColor: 'black'- }}>+ }}+ ><ImageViewerenableImageZoom={true}renderIndicator={() => <></>}@@ -62,7 +60,8 @@ const ImagePreview = () => {zIndex: 999,backgroundColor: 'rgba(0,0,0,0.3)',paddingTop: 30- }}>+ }}+ ><ActionIconname="close"color="white"@@ -78,8 +77,6 @@ const ImagePreview = () => {}]}/>--</View></BaseDialog>)diff --git a/apps/mobile/src/components/Input/index.js b/apps/mobile/src/components/Input/index.jsindex 41f8444de..00545fd74 100644--- a/apps/mobile/src/components/Input/index.js+++ b/apps/mobile/src/components/Input/index.js@@ -1,17 +1,17 @@-import React, {useState} from 'react';-import {TouchableOpacity,TextInput} from 'react-native';-import {View} from 'react-native';+import React, { useState } from 'react';+import { TouchableOpacity, TextInput } from 'react-native';+import { View } from 'react-native';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {useTracked} from '../../provider/index';+import { useTracked } from '../../provider/index';import {ERRORS_LIST,validateEmail,validatePass,validateUsername} from '../../services/Validation';-import {getElevation} from '../../utils';-import {SIZE} from '../../utils/SizeUtils';-import {ActionIcon} from '../ActionIcon';+import { getElevation } from '../../utils';+import { SIZE } from '../../utils/SizeUtils';+import { ActionIcon } from '../ActionIcon';import Paragraph from '../Typography/Paragraph';const Input = ({@@ -43,7 +43,7 @@ const Input = ({onFocusInput,buttons,marginRight,- autoCorrect=true,+ autoCorrect = true,buttonLeft}) => {const [state] = useTracked();@@ -60,11 +60,7 @@ const Input = ({// SPECIAL: true,});- const color = error- ? colors.red- : focus- ? customColor || colors.accent- : colors.nav;+ const color = error ? colors.red : focus ? customColor || colors.accent : colors.nav;const validate = value => {if (!validationType) return;@@ -142,7 +138,7 @@ const Input = ({flexGrow: 1,height: height || 50,paddingHorizontal: 12,- paddingRight:buttons || button || secureTextEntry || error ? 6 : 12+ paddingRight: buttons || button || secureTextEntry || error ? 6 : 12};const textStyle = {@@ -153,7 +149,7 @@ const Input = ({paddingBottom: 2.5,flexGrow: 1,height: height || 50,- fontFamily:"OpenSans-Regular"+ fontFamily: 'OpenSans-Regular'};return (@@ -165,16 +161,11 @@ const Input = ({marginBottom: marginBottom,flexGrow: 1,maxHeight: height,- marginRight:marginRight- }}>- <TouchableOpacity- disabled={!loading}- onPress={onPress}- activeOpacity={1}- style={style}>- {- buttonLeft && buttonLeft- }+ marginRight: marginRight+ }}+ >+ <TouchableOpacity disabled={!loading} onPress={onPress} activeOpacity={1} style={style}>+ {buttonLeft && buttonLeft}<TextInputref={fwdRef}@@ -185,9 +176,7 @@ const Input = ({onChangeText={onChange}autoCorrect={autoCorrect}onBlur={onBlur}- keyboardType={- validationType === 'email' ? 'email-address' : 'default'- }+ keyboardType={validationType === 'email' ? 'email-address' : 'default'}importantForAutofill="yes"importantForAccessibility="yes"returnKeyLabel={returnKeyLabel}@@ -209,7 +198,8 @@ const Input = ({justifyContent: 'center',height: 35 > height ? height : 35,alignItems: 'center'- }}>+ }}+ >{secureTextEntry && (<ActionIconname="eye"@@ -269,18 +259,16 @@ const Input = ({borderRadius: 2.5,...getElevation(2),top: 0- }}>+ }}+ ><Paragraphsize={SIZE.xs}style={{textAlign: 'right',textAlignVertical: 'bottom'- }}>- <Icon- name="alert-circle-outline"- size={SIZE.xs}- color={colors.errorText}- />{' '}+ }}+ >+ <Icon name="alert-circle-outline" size={SIZE.xs} color={colors.errorText} />{' '}{errorMessage}</Paragraph></View>@@ -292,22 +280,23 @@ const Input = ({<Viewstyle={{paddingTop: 5- }}>- {Object.keys(errorList).filter(k => errorList[k] === true).length !==- 0 ? (+ }}+ >+ {Object.keys(errorList).filter(k => errorList[k] === true).length !== 0 ? (Object.keys(ERRORS_LIST).map(error => (<Viewkey={ERRORS_LIST[error]}style={{flexDirection: 'row',alignItems: 'center'- }}>+ }}+ ><Iconname={errorList[error] ? 'close' : 'check'}color={errorList[error] ? 'red' : 'green'}/>- <Paragraph style={{marginLeft: 5}} size={SIZE.xs}>+ <Paragraph style={{ marginLeft: 5 }} size={SIZE.xs}>{ERRORS_LIST[error]}</Paragraph></View>diff --git a/apps/mobile/src/components/JumpToDialog/index.js b/apps/mobile/src/components/JumpToDialog/index.jsindex 1bc9ae7f7..7722bc5d6 100644--- a/apps/mobile/src/components/JumpToDialog/index.js+++ b/apps/mobile/src/components/JumpToDialog/index.js@@ -1,35 +1,29 @@-import React, {useEffect, useState} from 'react';-import {ScrollView, View} from 'react-native';+import React, { useEffect, useState } from 'react';+import { ScrollView, View } from 'react-native';import BaseDialog from '../../components/Dialog/base-dialog';-import {PressableButton} from '../../components/PressableButton';+import { PressableButton } from '../../components/PressableButton';import Seperator from '../../components/Seperator';-import {useTracked} from '../../provider';-import {useMessageStore} from '../../provider/stores';-import {DDS} from '../../services/DeviceDetection';-import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';-import {getElevation} from '../../utils';-import {- eCloseJumpToDialog,- eOpenJumpToDialog,- eScrollEvent-} from '../../utils/Events';-import {SIZE} from '../../utils/SizeUtils';+import { useTracked } from '../../provider';+import { useMessageStore } from '../../provider/stores';+import { DDS } from '../../services/DeviceDetection';+import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';+import { getElevation } from '../../utils';+import { eCloseJumpToDialog, eOpenJumpToDialog, eScrollEvent } from '../../utils/Events';+import { SIZE } from '../../utils/SizeUtils';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';const offsets = [];let timeout = null;-const JumpToDialog = ({scrollRef, data, type, screen}) => {+const JumpToDialog = ({ scrollRef, data, type, screen }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const notes = data;const [visible, setVisible] = useState(false);const [currentIndex, setCurrentIndex] = useState(null);const onPress = (item, index) => {- let ind = notes.findIndex(- i => i.title === item.title && i.type === 'header'- );+ let ind = notes.findIndex(i => i.title === item.title && i.type === 'header');console.log(ind);scrollRef.current?.scrollToIndex({index: ind,@@ -80,9 +74,7 @@ const JumpToDialog = ({scrollRef, data, type, screen}) => {.filter(i => i.type === 'header').map((item, index) => {let offset = 35 * index;- let ind = notes.findIndex(- i => i.title === item.title && i.type === 'header'- );+ let ind = notes.findIndex(i => i.title === item.title && i.type === 'header');let messageState = useMessageStore.getState().message;let msgOffset = messageState?.visible ? 60 : 10;ind = ind + 1;@@ -98,7 +90,8 @@ const JumpToDialog = ({scrollRef, data, type, screen}) => {loadOffsets();}}onRequestClose={close}- visible={true}>+ visible={true}+ ><Viewstyle={{...getElevation(5),@@ -111,11 +104,13 @@ const JumpToDialog = ({scrollRef, data, type, screen}) => {alignSelf: 'center',padding: 10,paddingTop: 30- }}>+ }}+ ><ScrollViewstyle={{maxHeight: '100%'- }}>+ }}+ ><Viewstyle={{flexDirection: 'row',@@ -123,7 +118,8 @@ const JumpToDialog = ({scrollRef, data, type, screen}) => {alignSelf: 'center',justifyContent: 'center',paddingBottom: 20- }}>+ }}+ >{notes.filter(i => i.type === 'header').map((item, index) => {@@ -140,15 +136,15 @@ const JumpToDialog = ({scrollRef, data, type, screen}) => {borderRadius: 100,height: 25,marginVertical: 10- }}>+ }}+ ><Paragraphsize={SIZE.sm}- color={- currentIndex === index ? colors.light : colors.accent- }+ color={currentIndex === index ? colors.light : colors.accent}style={{textAlign: 'center'- }}>+ }}+ >{item.title}</Paragraph></PressableButton>diff --git a/apps/mobile/src/components/ListPlaceholders/index.js b/apps/mobile/src/components/ListPlaceholders/index.jsindex 4f97156de..5bf2a262b 100644--- a/apps/mobile/src/components/ListPlaceholders/index.js+++ b/apps/mobile/src/components/ListPlaceholders/index.js@@ -14,54 +14,55 @@ import {TRASH_SVG} from '../../assets/images/assets';import { useTracked } from '../../provider';-export const Placeholder = ({type, w, h, color}) => {- const [state, dispatch] = useTracked();- const {colors} = state;- const getSVG = () => {- switch (type) {- case 'notes':- return NOTE_SVG(color || colors.accent);- case 'notebooks':- return NOTEBOOK_SVG(colors.accent);- case 'topics':- return TOPIC_SVG(colors.accent);- case 'tags':- return TAG_SVG(colors.accent);- case 'favorites':- return FAV_SVG(colors.accent);- case 'trash':- return TRASH_SVG(colors.accent);- case 'settings':- return SETTINGS_SVG(colors.accent);- case 'search':- return SEARCH_SVG(colors.accent);- case 'login':- return LOGIN_SVG(colors.accent);- case 'signup':- return LOGO_SVG;- }- };+export const Placeholder = ({ type, w, h, color }) => {+ const [state, dispatch] = useTracked();+ const { colors } = state;+ const getSVG = () => {+ switch (type) {+ case 'notes':+ return NOTE_SVG(color || colors.accent);+ case 'notebooks':+ return NOTEBOOK_SVG(colors.accent);+ case 'topics':+ return TOPIC_SVG(colors.accent);+ case 'tags':+ return TAG_SVG(colors.accent);+ case 'favorites':+ return FAV_SVG(colors.accent);+ case 'trash':+ return TRASH_SVG(colors.accent);+ case 'settings':+ return SETTINGS_SVG(colors.accent);+ case 'search':+ return SEARCH_SVG(colors.accent);+ case 'login':+ return LOGIN_SVG(colors.accent);+ case 'signup':+ return LOGO_SVG;+ }+ };- return (- <SvgToPngView- color={type === 'notes' ? color || colors.accent : colors.accent}- src={getSVG()}- img={type}- width={w}- height={h}- />- )- }+ return (+ <SvgToPngView+ color={type === 'notes' ? color || colors.accent : colors.accent}+ src={getSVG()}+ img={type}+ width={w}+ height={h}+ />+ );+};-export const SvgToPngView = ({width, height, src, color, img}) => {+export const SvgToPngView = ({ width, height, src, color, img }) => {const [error, setError] = useState(false);return (<Viewstyle={{height: width || 250,- width: height || 250,- }}>+ width: height || 250+ }}+ ><SvgXml xml={src} width="100%" height="100%" /></View>);diff --git a/apps/mobile/src/components/Loading/index.js b/apps/mobile/src/components/Loading/index.jsindex 1dec4fdb1..032033d93 100644--- a/apps/mobile/src/components/Loading/index.js+++ b/apps/mobile/src/components/Loading/index.js@@ -1,8 +1,8 @@import React from 'react';-import {ActivityIndicator, StyleSheet, View} from 'react-native';-import {useTracked} from '../../provider';-import {ph, pv, SIZE} from '../../utils/SizeUtils';-import {Button} from '../Button';+import { ActivityIndicator, StyleSheet, View } from 'react-native';+import { useTracked } from '../../provider';+import { ph, pv, SIZE } from '../../utils/SizeUtils';+import { Button } from '../Button';import Paragraph from '../Typography/Paragraph';export const Loading = ({@@ -11,24 +11,22 @@ export const Loading = ({done = false,doneText = 'Action completed successfully!',onDone = () => {},- customStyle = {},+ customStyle = {}}) => {const [state, dispatch] = useTracked();- const {colors} = state;+ const { colors } = state;return (<Viewstyle={[- {height: height, backgroundColor: colors.bg},+ { height: height, backgroundColor: colors.bg },styles.activityContainer,- customStyle,- ]}>+ customStyle+ ]}+ >{done ? (<>- <Paragraph- color={colors.icon}- size={SIZE.xs}- style={styles.activityText}>+ <Paragraph color={colors.icon} size={SIZE.xs} style={styles.activityText}>{doneText}</Paragraph>@@ -40,9 +38,10 @@ export const Loading = ({<Paragraphsize={SIZE.md}style={{- marginTop:10+ marginTop: 10}}- color={colors.pri}>+ color={colors.pri}+ >{tagline}</Paragraph></>@@ -55,11 +54,11 @@ const styles = StyleSheet.create({activityText: {fontSize: SIZE.sm,textAlign: 'center',- marginBottom: 10,+ marginBottom: 10},activityContainer: {alignItems: 'center',- justifyContent: 'center',+ justifyContent: 'center'},button: {paddingVertical: pv,@@ -71,11 +70,11 @@ const styles = StyleSheet.create({justifyContent: 'center',alignItems: 'center',borderWidth: 1,- flexDirection: 'row',+ flexDirection: 'row'},buttonText: {//fontFamily: "sans-serif",color: 'white',- fontSize: SIZE.sm,- },+ fontSize: SIZE.sm+ }});diff --git a/apps/mobile/src/components/LoginDialog/index.js b/apps/mobile/src/components/LoginDialog/index.jsindex d873e55b2..7d489c5e0 100644--- a/apps/mobile/src/components/LoginDialog/index.js+++ b/apps/mobile/src/components/LoginDialog/index.js@@ -1,12 +1,12 @@-import React, {useEffect, useRef, useState} from 'react';-import {ScrollView, Text, TouchableOpacity, View} from 'react-native';+import React, { useEffect, useRef, useState } from 'react';+import { ScrollView, Text, TouchableOpacity, View } from 'react-native';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {Button} from '../../components/Button';+import { Button } from '../../components/Button';import Seperator from '../../components/Seperator';-import {useTracked} from '../../provider/index';-import {useUserStore} from '../../provider/stores';+import { useTracked } from '../../provider/index';+import { useUserStore } from '../../provider/stores';import BiometricService from '../../services/BiometricService';-import {DDS} from '../../services/DeviceDetection';+import { DDS } from '../../services/DeviceDetection';import {eSendEvent,eSubscribeEvent,@@ -14,26 +14,26 @@ import {presentSheet,ToastEvent} from '../../services/EventManager';-import {clearMessage, setEmailVerifyMessage} from '../../services/Message';+import { clearMessage, setEmailVerifyMessage } from '../../services/Message';import PremiumService from '../../services/PremiumService';import Sync from '../../services/Sync';-import {hexToRGBA} from '../../utils/ColorUtils';-import {db} from '../../utils/database';-import {eOpenLoginDialog, eOpenResultDialog} from '../../utils/Events';-import {openLinkInBrowser} from '../../utils/functions';-import {MMKV} from '../../utils/mmkv';-import {SIZE} from '../../utils/SizeUtils';+import { hexToRGBA } from '../../utils/ColorUtils';+import { db } from '../../utils/database';+import { eOpenLoginDialog, eOpenResultDialog } from '../../utils/Events';+import { openLinkInBrowser } from '../../utils/functions';+import { MMKV } from '../../utils/mmkv';+import { SIZE } from '../../utils/SizeUtils';import Storage from '../../utils/storage';-import {sleep} from '../../utils/TimeUtils';+import { sleep } from '../../utils/TimeUtils';import SheetWrapper from '../Sheet';import BaseDialog from '../Dialog/base-dialog';import DialogButtons from '../Dialog/dialog-buttons';import DialogContainer from '../Dialog/dialog-container';import DialogHeader from '../Dialog/dialog-header';import Input from '../Input';-import {Header} from '../SimpleList/header';+import { Header } from '../SimpleList/header';import Paragraph from '../Typography/Paragraph';-import {ActionIcon} from '../ActionIcon';+import { ActionIcon } from '../ActionIcon';import umami from '../../utils/umami';const MODES = {@@ -145,8 +145,7 @@ const LoginDialog = () => {buttonFunc: () => changePassword(),headerParagraph: 'login to your account',showForgotButton: false,- loading:- 'Please wait while we change your password and encrypt your data.',+ loading: 'Please wait while we change your password and encrypt your data.',showLoader: true,buttonAlt: null},@@ -182,8 +181,7 @@ const LoginDialog = () => {console.log('REQUESTING NEW TOKEN');let res = await db.user.tokenManager.getToken();if (!res) throw new Error('no token found');- if (db.user.tokenManager._isTokenExpired(res))- throw new Error('token expired');+ if (db.user.tokenManager._isTokenExpired(res)) throw new Error('token expired');if (!(await Sync.run())) throw new Error('e');await MMKV.removeItem('loginSessionHasExpired');return;@@ -279,8 +277,7 @@ const LoginDialog = () => {if (error) {ToastEvent.show({heading: 'Invalid signup information',- message:- 'Some or all information provided is invalid. Resolve all errors and try again.',+ message: 'Some or all information provided is invalid. Resolve all errors and try again.',type: 'error',context: 'local'});@@ -346,10 +343,7 @@ const LoginDialog = () => {}try {let lastRecoveryEmailTime = await MMKV.getItem('lastRecoveryEmailTime');- if (- lastRecoveryEmailTime &&- Date.now() - JSON.parse(lastRecoveryEmailTime) < 60000 * 3- ) {+ if (lastRecoveryEmailTime && Date.now() - JSON.parse(lastRecoveryEmailTime) < 60000 * 3) {throw new Error('Please wait before requesting another email');}!nostatus && setStatus('Password Recovery Email Sent!');@@ -435,13 +429,15 @@ const LoginDialog = () => {}, 500);}}background={!DDS.isTab ? colors.bg : null}- transparent={true}>+ transparent={true}+ >{confirm && (<BaseDialogonRequestClose={() => {setConfirm(false);}}- visible>+ visible+ ><DialogContainer><DialogHeadertitle="Logout"@@ -506,7 +502,8 @@ const LoginDialog = () => {backgroundColor: colors.bg,zIndex: 10,minHeight: DDS.isTab ? '50%' : '85%'- }}>+ }}+ ><Headercolor="transparent"type="login"@@ -526,16 +523,16 @@ const LoginDialog = () => {flexDirection: 'row',alignItems: 'center',backgroundColor: hexToRGBA(colors.red, 0.2)- }}>+ }}+ ><Iconsize={20}- style={{marginRight: 10}}+ style={{ marginRight: 10 }}name="information"color={colors.errorText}/>- <Paragraph style={{maxWidth: '90%'}} color={colors.errorText}>- Please log in to your account to access your notes on this device- and sync them.+ <Paragraph style={{ maxWidth: '90%' }} color={colors.errorText}>+ Please log in to your account to access your notes on this device and sync them.</Paragraph></View>)}@@ -550,19 +547,13 @@ const LoginDialog = () => {marginTop: 10,flexDirection: 'row',alignItems: 'center'- }}>- <Icon- size={20}- style={{marginRight: 10}}- name="information"- color={colors.accent}- />- <Paragraph style={{maxWidth: '90%'}} color={colors.accent}>+ }}+ >+ <Icon size={20} style={{ marginRight: 10 }} name="information" color={colors.accent} />+ <Paragraph style={{ maxWidth: '90%' }} color={colors.accent}>When you sign up, your{' '}- <Text style={{fontWeight: 'bold'}}>- 14 day free trial of Notesnook Pro- </Text>{' '}- will be activated.+ <Text style={{ fontWeight: 'bold' }}>14 day free trial of Notesnook Pro</Text> will be+ activated.</Paragraph></View>)}@@ -572,7 +563,8 @@ const LoginDialog = () => {paddingHorizontal: 12,paddingTop: 12,width: focused ? '100%' : '99.9%'- }}>+ }}+ >{mode === MODES.changePassword ? null : (<InputfwdRef={_email}@@ -710,12 +702,14 @@ const LoginDialog = () => {flexDirection: 'row',width: '100%',alignItems: 'center'- }}>+ }}+ ><Paragraphsize={11}style={{maxWidth: '90%'- }}>+ }}+ >By signing up you agree to our{' '}<Paragraphsize={11}@@ -724,7 +718,8 @@ const LoginDialog = () => {.catch(e => {}).then(r => {});}}- color={colors.accent}>+ color={colors.accent}+ >terms of service{' '}</Paragraph>and{' '}@@ -735,7 +730,8 @@ const LoginDialog = () => {.catch(e => {}).then(r => {});}}- color={colors.accent}>+ color={colors.accent}+ >privacy policy.</Paragraph></Paragraph>@@ -780,16 +776,17 @@ const LoginDialog = () => {flexDirection: 'row',alignItems: 'center',flexShrink: 1- }}>+ }}+ ><ActionIcon name="alert" color={colors.warningText} /><Paragraphstyle={{flexShrink: 1,marginLeft: 5}}- color={colors.warningText}>- Do not close the app or move it to background while we change- your password.+ color={colors.warningText}+ >+ Do not close the app or move it to background while we change your password.</Paragraph></View>) : null}diff --git a/apps/mobile/src/components/Menu/ColorSection.js b/apps/mobile/src/components/Menu/ColorSection.jsindex e4abfe29d..66a458320 100644--- a/apps/mobile/src/components/Menu/ColorSection.js+++ b/apps/mobile/src/components/Menu/ColorSection.js@@ -1,19 +1,15 @@-import React, {useEffect, useState} from 'react';-import {View} from 'react-native';-import {useTracked} from '../../provider';-import {useMenuStore, useNoteStore} from '../../provider/stores';-import {- eSendEvent,- eSubscribeEvent,- eUnSubscribeEvent-} from '../../services/EventManager';+import React, { useEffect, useState } from 'react';+import { View } from 'react-native';+import { useTracked } from '../../provider';+import { useMenuStore, useNoteStore } from '../../provider/stores';+import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';-import {COLORS_NOTE} from '../../utils/Colors';-import {db} from '../../utils/database';-import {refreshNotesPage} from '../../utils/Events';-import {normalize, SIZE} from '../../utils/SizeUtils';-import {presentDialog} from '../Dialog/functions';-import {PressableButton} from '../PressableButton';+import { COLORS_NOTE } from '../../utils/Colors';+import { db } from '../../utils/database';+import { refreshNotesPage } from '../../utils/Events';+import { normalize, SIZE } from '../../utils/SizeUtils';+import { presentDialog } from '../Dialog/functions';+import { PressableButton } from '../PressableButton';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';@@ -28,14 +24,12 @@ export const ColorSection = () => {}}, [loading]);- return colorNotes.map((item, index) => (- <ColorItem key={item.id} item={item} index={index} />- ));+ return colorNotes.map((item, index) => <ColorItem key={item.id} item={item} index={index} />);};-const ColorItem = ({item, index}) => {+const ColorItem = ({ item, index }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const setColorNotes = useMenuStore(state => state.setColorNotes);const [headerTextState, setHeaderTextState] = useState(null);const alias = db.colors.alias(item.id);@@ -83,17 +77,15 @@ const ColorItem = ({item, index}) => {if (!value || value.trim().length === 0) return;await db.colors.rename(item.id, value);setColorNotes();- console.log('color updated')+ console.log('color updated');},- positiveText:"Rename"+ positiveText: 'Rename'});};return (<PressableButton- customColor={- headerTextState?.id === item.id ? 'rgba(0,0,0,0.04)' : 'transparent'- }+ customColor={headerTextState?.id === item.id ? 'rgba(0,0,0,0.04)' : 'transparent'}onLongPress={onLongPress}customSelectedColor={COLORS_NOTE[item.title.toLowerCase()]}customAlpha={!colors.night ? -0.02 : 0.02}@@ -109,18 +101,21 @@ const ColorItem = ({item, index}) => {alignItems: 'center',height: normalize(50),marginBottom: 5- }}>+ }}+ ><Viewstyle={{flexDirection: 'row',alignItems: 'center'- }}>+ }}+ ><Viewstyle={{width: 30,justifyContent: 'center',alignItems: 'flex-start'- }}>+ }}+ ><Viewstyle={{width: SIZE.lg - 2,diff --git a/apps/mobile/src/components/Menu/MenuListItem.js b/apps/mobile/src/components/Menu/MenuListItem.jsindex faa9674f2..d2eefd17e 100644--- a/apps/mobile/src/components/Menu/MenuListItem.js+++ b/apps/mobile/src/components/Menu/MenuListItem.js@@ -1,23 +1,22 @@-import React, {useEffect, useState} from 'react';-import {View} from 'react-native';+import React, { useEffect, useState } from 'react';+import { View } from 'react-native';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {useTracked} from '../../provider';-import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';+import { useTracked } from '../../provider';+import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';-import {getElevation} from '../../utils';-import {normalize, SIZE} from '../../utils/SizeUtils';-import {Button} from '../Button';-import {PressableButton} from '../PressableButton';+import { getElevation } from '../../utils';+import { normalize, SIZE } from '../../utils/SizeUtils';+import { Button } from '../Button';+import { PressableButton } from '../PressableButton';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';import ToggleSwitch from 'toggle-switch-react-native';-export const MenuListItem = ({item, index, noTextMode, testID, rightBtn}) => {+export const MenuListItem = ({ item, index, noTextMode, testID, rightBtn }) => {const [state, dispatch] = useTracked();- const {colors} = state;+ const { colors } = state;const [headerTextState, setHeaderTextState] = useState(null);- let isFocused =- headerTextState?.id === item.name.toLowerCase() + '_navigation';+ let isFocused = headerTextState?.id === item.name.toLowerCase() + '_navigation';const _onPress = event => {if (item.func) {@@ -70,12 +69,14 @@ export const MenuListItem = ({item, index, noTextMode, testID, rightBtn}) => {alignItems: 'center',height: normalize(50),marginBottom: 5- }}>+ }}+ ><Viewstyle={{flexDirection: 'row',alignItems: 'center'- }}>+ }}+ ><Iconstyle={{width: 30,@@ -83,13 +84,7 @@ export const MenuListItem = ({item, index, noTextMode, testID, rightBtn}) => {textAlign: 'left'}}name={item.icon}- color={- item.icon === 'crown'- ? colors.yellow- : isFocused- ? colors.accent- : colors.pri- }+ color={item.icon === 'crown' ? colors.yellow : isFocused ? colors.accent : colors.pri}size={SIZE.lg - 2}/>{isFocused ? (diff --git a/apps/mobile/src/components/Menu/TagsSection.js b/apps/mobile/src/components/Menu/TagsSection.jsindex 5cae5730e..80151f639 100644--- a/apps/mobile/src/components/Menu/TagsSection.js+++ b/apps/mobile/src/components/Menu/TagsSection.js@@ -1,21 +1,17 @@-import React, {useEffect, useRef, useState} from 'react';-import {FlatList, View} from 'react-native';+import React, { useEffect, useRef, useState } from 'react';+import { FlatList, View } from 'react-native';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {useTracked} from '../../provider';-import {useMenuStore, useNoteStore} from '../../provider/stores';-import {- eSendEvent,- eSubscribeEvent,- eUnSubscribeEvent-} from '../../services/EventManager';+import { useTracked } from '../../provider';+import { useMenuStore, useNoteStore } from '../../provider/stores';+import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';-import {db} from '../../utils/database';-import {eOnNewTopicAdded, refreshNotesPage} from '../../utils/Events';-import {normalize, SIZE} from '../../utils/SizeUtils';+import { db } from '../../utils/database';+import { eOnNewTopicAdded, refreshNotesPage } from '../../utils/Events';+import { normalize, SIZE } from '../../utils/SizeUtils';import SheetWrapper from '../Sheet';-import {Button} from '../Button';-import {ActionSheetEvent} from '../DialogManager/recievers';-import {PressableButton} from '../PressableButton';+import { Button } from '../Button';+import { ActionSheetEvent } from '../DialogManager/recievers';+import { PressableButton } from '../PressableButton';import Seperator from '../Seperator';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';@@ -60,7 +56,7 @@ export const TagsSection = () => {type: item.type});} else {- params = {...item, menu: true, get: 'topics'};+ params = { ...item, menu: true, get: 'topics' };eSendEvent(refreshNotesPage, params);Navigation.navigate('NotesPage', params, {heading: item.title,@@ -75,7 +71,8 @@ export const TagsSection = () => {<Viewstyle={{flexGrow: 1- }}>+ }}+ ><FlatListdata={menuPins}style={{@@ -85,17 +82,15 @@ export const TagsSection = () => {flexGrow: 1}}keyExtractor={(item, index) => item.id}- renderItem={({item, index}) => (- <PinItem item={item} index={index} onPress={onPress} />- )}+ renderItem={({ item, index }) => <PinItem item={item} index={index} onPress={onPress} />}/></View>);};-const PinItem = ({item, index, onPress}) => {+const PinItem = ({ item, index, onPress }) => {const [state, dispatch] = useTracked();- const {colors} = state;+ const { colors } = state;const setMenuPins = useMenuStore(state => state.setMenuPins);const alias = item.type === 'tag' ? db.tags.alias(item.title) : item.title;const [visible, setVisible] = useState(false);@@ -133,7 +128,8 @@ const PinItem = ({item, index, onPress}) => {}}gestureEnabled={false}fwdRef={fwdRef}- visible={true}>+ visible={true}+ ><Seperator /><Buttontitle="Remove Shortcut"@@ -168,19 +164,22 @@ const PinItem = ({item, index, onPress}) => {alignItems: 'center',height: normalize(50),marginBottom: 5- }}>+ }}+ ><Viewstyle={{flexDirection: 'row',alignItems: 'center',flexGrow: 1,flex: 1- }}>+ }}+ ><Viewstyle={{width: 30,justifyContent: 'center'- }}>+ }}+ ><Icon color={color} size={SIZE.lg - 2} name={icons[item.type]} /><Iconstyle={{@@ -198,14 +197,16 @@ const PinItem = ({item, index, onPress}) => {alignItems: 'flex-start',flexGrow: 1,flex: 1- }}>+ }}+ >{headerTextState?.id === item.id ? (<Headingstyle={{flexWrap: 'wrap'}}color={colors.heading}- size={SIZE.md}>+ size={SIZE.md}+ >{alias}</Heading>) : (diff --git a/apps/mobile/src/components/Menu/TimeSince.js b/apps/mobile/src/components/Menu/TimeSince.jsindex e1d8de643..0d4661ebf 100644--- a/apps/mobile/src/components/Menu/TimeSince.js+++ b/apps/mobile/src/components/Menu/TimeSince.js@@ -1,12 +1,11 @@-import React, {useEffect, useState} from 'react';-import {timeSince} from '../../utils/TimeUtils';+import React, { useEffect, useState } from 'react';+import { timeSince } from '../../utils/TimeUtils';import Paragraph from '../Typography/Paragraph';-export const TimeSince = ({time, style,updateFrequency=30000}) => {+export const TimeSince = ({ time, style, updateFrequency = 30000 }) => {const [timeAgo, setTimeAgo] = useState(null);useEffect(() => {-let t = timeSince(time || Date.now());setTimeAgo(t);let interval = setInterval(() => {@@ -17,7 +16,7 @@ export const TimeSince = ({time, style,updateFrequency=30000}) => {clearInterval(interval);interval = null;};- }, [time,updateFrequency]);+ }, [time, updateFrequency]);return <Paragraph style={style}>{timeAgo}</Paragraph>;};diff --git a/apps/mobile/src/components/Menu/UserSection.js b/apps/mobile/src/components/Menu/UserSection.jsindex 39259671e..2e44e5465 100644--- a/apps/mobile/src/components/Menu/UserSection.js+++ b/apps/mobile/src/components/Menu/UserSection.js@@ -1,8 +1,5 @@import React from 'react';-import {- ActivityIndicator,- Platform, View-} from 'react-native';+import { ActivityIndicator, Platform, View } from 'react-native';import { useSafeAreaInsets } from 'react-native-safe-area-context';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';import { useTracked } from '../../provider';@@ -18,7 +15,7 @@ import { TimeSince } from './TimeSince';export const UserSection = () => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const user = useUserStore(state => state.user);const syncing = useUserStore(state => state.syncing);const lastSynced = useUserStore(state => state.lastSynced);@@ -32,13 +29,15 @@ export const UserSection = () => {paddingBottom: Platform.OS === 'ios' ? insets.bottom / 2 : null,borderTopWidth: 1,borderTopColor: colors.nav- }}>+ }}+ ><Viewstyle={{flexDirection: 'row',justifyContent: 'space-between',alignItems: 'center'- }}>+ }}+ ><PressableButtononPress={async () => {if (user) {@@ -54,18 +53,21 @@ export const UserSection = () => {padding: 12,paddingHorizontal: 20,borderRadius: 0- }}>+ }}+ ><Viewstyle={{flexShrink: 1,flexGrow: 1- }}>+ }}+ ><Headingstyle={{flexWrap: 'wrap'}}size={SIZE.xs}- color={colors.icon}>+ color={colors.icon}+ >{!user ? ('You are not logged in') : !syncing ? (@@ -73,7 +75,7 @@ export const UserSection = () => {<>Last synced{' '}<TimeSince- style={{fontSize: SIZE.xs, color: colors.icon}}+ style={{ fontSize: SIZE.xs, color: colors.icon }}time={lastSynced}/></>@@ -94,10 +96,9 @@ export const UserSection = () => {style={{flexWrap: 'wrap'}}- color={colors.heading}>- {!user- ? 'Login to sync your notes.'- : 'Tap here to sync your notes.'}+ color={colors.heading}+ >+ {!user ? 'Login to sync your notes.' : 'Tap here to sync your notes.'}</Paragraph></View>diff --git a/apps/mobile/src/components/Menu/index.js b/apps/mobile/src/components/Menu/index.jsindex f58e41a5c..238cb5bb9 100644--- a/apps/mobile/src/components/Menu/index.js+++ b/apps/mobile/src/components/Menu/index.js@@ -1,14 +1,14 @@import React from 'react';-import {FlatList, View} from 'react-native';+import { FlatList, View } from 'react-native';import Animated from 'react-native-reanimated';-import {useSafeAreaInsets} from 'react-native-safe-area-context';-import {notesnook} from '../../../e2e/test.ids';-import {useTracked} from '../../provider';-import {Actions} from '../../provider/Actions';-import {useSettingStore, useUserStore} from '../../provider/stores';-import {DDS} from '../../services/DeviceDetection';-import {eSendEvent} from '../../services/EventManager';-import {DrawerScale} from '../../utils/Animations';+import { useSafeAreaInsets } from 'react-native-safe-area-context';+import { notesnook } from '../../../e2e/test.ids';+import { useTracked } from '../../provider';+import { Actions } from '../../provider/Actions';+import { useSettingStore, useUserStore } from '../../provider/stores';+import { DDS } from '../../services/DeviceDetection';+import { eSendEvent } from '../../services/EventManager';+import { DrawerScale } from '../../utils/Animations';import {ACCENT,COLOR_SCHEME,@@ -16,26 +16,26 @@ import {COLOR_SCHEME_LIGHT,setColorScheme} from '../../utils/Colors';-import {eOpenPremiumDialog} from '../../utils/Events';-import {MenuItemsList, SUBSCRIPTION_STATUS} from '../../utils/index';-import {MMKV} from '../../utils/mmkv';+import { eOpenPremiumDialog } from '../../utils/Events';+import { MenuItemsList, SUBSCRIPTION_STATUS } from '../../utils/index';+import { MMKV } from '../../utils/mmkv';import umami from '../../utils/umami';-import {ColorSection} from './ColorSection';-import {MenuListItem} from './MenuListItem';-import {TagsSection} from './TagsSection';-import {UserSection} from './UserSection';+import { ColorSection } from './ColorSection';+import { MenuListItem } from './MenuListItem';+import { TagsSection } from './TagsSection';+import { UserSection } from './UserSection';export const Menu = React.memo(() => {const [state, dispatch] = useTracked();- const {colors} = state;+ const { colors } = state;const deviceMode = useSettingStore(state => state.deviceMode);const insets = useSafeAreaInsets();const user = useUserStore(state => state.user);const noTextMode = false;function changeColorScheme(colors = COLOR_SCHEME, accent = ACCENT) {let newColors = setColorScheme(colors, accent);- dispatch({type: Actions.THEME, colors: newColors});+ dispatch({ type: Actions.THEME, colors: newColors });}const BottomItemsList = [@@ -44,10 +44,10 @@ export const Menu = React.memo(icon: 'theme-light-dark',func: () => {if (!colors.night) {- MMKV.setStringAsync('theme', JSON.stringify({night: true}));+ MMKV.setStringAsync('theme', JSON.stringify({ night: true }));changeColorScheme(COLOR_SCHEME_DARK);} else {- MMKV.setStringAsync('theme', JSON.stringify({night: false}));+ MMKV.setStringAsync('theme', JSON.stringify({ night: false }));changeColorScheme(COLOR_SCHEME_LIGHT);}},@@ -66,7 +66,7 @@ export const Menu = React.memo(name: 'Notesnook Pro',icon: 'crown',func: () => {- umami.pageView("/pro-screen","/sidemenu");+ umami.pageView('/pro-screen', '/sidemenu');eSendEvent(eOpenPremiumDialog);}};@@ -77,7 +77,8 @@ export const Menu = React.memo(height: '100%',width: '100%',backgroundColor: colors.nav- }}>+ }}+ ><Animated.Viewstyle={{height: '100%',@@ -91,7 +92,8 @@ export const Menu = React.memo(scale: deviceMode !== 'mobile' ? 1 : DrawerScale}]- }}>+ }}+ ><FlatListalwaysBounceVertical={false}contentContainerStyle={{@@ -108,12 +110,7 @@ export const Menu = React.memo(renderItem={() => (<>{MenuItemsList.map((item, index) => (- <MenuListItem- key={item.name}- item={item}- testID={item.name}- index={index}- />+ <MenuListItem key={item.name} item={item} testID={item.name} index={index} />))}<ColorSection noTextMode={noTextMode} /><TagsSection />@@ -123,45 +120,34 @@ export const Menu = React.memo(<Viewstyle={{paddingHorizontal: 12- }}>- {!user || user?.subscription?.type === SUBSCRIPTION_STATUS.TRIAL ||+ }}+ >+ {!user ||+ user?.subscription?.type === SUBSCRIPTION_STATUS.TRIAL ||user?.subscription?.type === SUBSCRIPTION_STATUS.BASIC ? (+ <MenuListItem testID={pro.name} key={pro.name} item={pro} index={0} ignore={true} />+ ) : null}++ {BottomItemsList.slice(DDS.isLargeTablet() ? 0 : 1, 3).map((item, index) => (<MenuListItem- testID={pro.name}- key={pro.name}- item={pro}- index={0}+ testID={item.name == 'Night mode' ? notesnook.ids.menu.nightmode : item.name}+ key={item.name}+ item={item}+ index={index}ignore={true}+ rightBtn={+ DDS.isLargeTablet() || item.name === 'Notesnook Pro' ? null : BottomItemsList[0]+ }/>- ) : null}-- {BottomItemsList.slice(DDS.isLargeTablet() ? 0 : 1, 3).map(- (item, index) => (- <MenuListItem- testID={- item.name == 'Night mode'- ? notesnook.ids.menu.nightmode- : item.name- }- key={item.name}- item={item}- index={index}- ignore={true}- rightBtn={- DDS.isLargeTablet() || item.name === 'Notesnook Pro'- ? null- : BottomItemsList[0]- }- />- )- )}+ ))}</View><Viewstyle={{width: '100%',paddingHorizontal: 0- }}>+ }}+ ><UserSection noTextMode={noTextMode} /></View></Animated.View>diff --git a/apps/mobile/src/components/MergeEditor/index.js b/apps/mobile/src/components/MergeEditor/index.jsindex dda3cfba7..d603a167f 100644--- a/apps/mobile/src/components/MergeEditor/index.js+++ b/apps/mobile/src/components/MergeEditor/index.js@@ -1,36 +1,29 @@import KeepAwake from '@sayem314/react-native-keep-awake';-import {EV, EVENTS} from 'notes-core/common';-import React, {createRef, useEffect, useState} from 'react';-import {Modal, SafeAreaView, Text, View} from 'react-native';+import { EV, EVENTS } from 'notes-core/common';+import React, { createRef, useEffect, useState } from 'react';+import { Modal, Platform, SafeAreaView, Text, View } from 'react-native';import Animated from 'react-native-reanimated';-import {useSafeAreaInsets} from 'react-native-safe-area-context';+import { useSafeAreaInsets } from 'react-native-safe-area-context';import WebView from 'react-native-webview';-import {useTracked} from '../../provider';-import {DDS} from '../../services/DeviceDetection';+import { useTracked } from '../../provider';+import { DDS } from '../../services/DeviceDetection';import {eSendEvent,eSubscribeEvent,- eUnSubscribeEvent+ eUnSubscribeEvent,+ ToastEvent} from '../../services/EventManager';import Navigation from '../../services/Navigation';import Sync from '../../services/Sync';-import {dHeight} from '../../utils';-import {db} from '../../utils/database';-import {- eApplyChanges,- eShowMergeDialog,- refreshNotesPage-} from '../../utils/Events';-import {openLinkInBrowser} from '../../utils/functions';-import {normalize, SIZE} from '../../utils/SizeUtils';-import {timeConverter} from '../../utils/TimeUtils';-import {- getNote,- sourceUri,- updateNoteInEditor-} from '../../views/Editor/Functions';-import {ActionIcon} from '../ActionIcon';-import {Button} from '../Button';+import { dHeight } from '../../utils';+import { db } from '../../utils/database';+import { eApplyChanges, eShowMergeDialog, refreshNotesPage } from '../../utils/Events';+import { openLinkInBrowser } from '../../utils/functions';+import { normalize, SIZE } from '../../utils/SizeUtils';+import { timeConverter } from '../../utils/TimeUtils';+import { getNote, sourceUri, updateNoteInEditor } from '../../views/Editor/Functions';+import { ActionIcon } from '../ActionIcon';+import { Button } from '../Button';import BaseDialog from '../Dialog/base-dialog';import DialogButtons from '../Dialog/dialog-buttons';import DialogContainer from '../Dialog/dialog-container';@@ -44,7 +37,7 @@ let note = null;let primaryData = null;let secondaryData = null;-function onMediaLoaded({hash, src}) {+function onMediaLoaded({ hash, src }) {console.log('on media download complete');let inject = `(function(){@@ -58,7 +51,7 @@ function onMediaLoaded({hash, src}) {const MergeEditor = () => {const [state, dispatch] = useTracked();- const {colors} = state;+ const { colors } = state;const [visible, setVisible] = useState(false);const [primary, setPrimary] = useState(true);const [secondary, setSecondary] = useState(true);@@ -70,12 +63,9 @@ const MergeEditor = () => {const insets = useSafeAreaInsets();const onPrimaryWebViewLoad = async () => {- let content = await db.content.insertPlaceholders(- primaryData,- 'placeholder.svg'- );+ let content = await db.content.insertPlaceholders(primaryData, 'placeholder.svg');postMessage(primaryWebView, 'htmldiff', content.data);- let theme = {...colors};+ let theme = { ...colors };theme.factor = normalize(1);primaryWebView.current?.injectJavaScript(`@@ -93,12 +83,9 @@ const MergeEditor = () => {const onSecondaryWebViewLoad = async () => {if (!secondaryData) return;- let content = await db.content.insertPlaceholders(- secondaryData,- 'placeholder.svg'- );+ let content = await db.content.insertPlaceholders(secondaryData, 'placeholder.svg');postMessage(secondaryWebView, 'htmldiff', content?.data);- let theme = {...colors};+ let theme = { ...colors };theme.factor = normalize(1);secondaryWebView.current?.injectJavaScript(`(function() {@@ -143,11 +130,7 @@ const MergeEditor = () => {const applyChanges = async () => {let content = keepContentFrom === 'primary' ? primaryData : secondaryData;let keepCopy =- copyToSave === 'primary'- ? primaryData- : copyToSave === 'secondary'- ? secondaryData- : null;+ copyToSave === 'primary' ? primaryData : copyToSave === 'secondary' ? secondaryData : null;await db.notes.add({id: note.id,@@ -255,8 +238,6 @@ const MergeEditor = () => {setDialogVisible(false);primaryData = null;secondaryData = null;- primaryText = null;- secondaryText = null;note = null;};@@ -289,12 +270,14 @@ const MergeEditor = () => {'landscape-left','landscape-right']}- visible={true}>+ visible={true}+ ><SafeAreaViewstyle={{backgroundColor: colors.bg,paddingTop: insets.top- }}>+ }}+ ><KeepAwake />{dialogVisible && (<BaseDialog visible={true}>@@ -320,7 +303,8 @@ const MergeEditor = () => {height: '100%',width: '100%',backgroundColor: DDS.isLargeTablet() ? 'rgba(0,0,0,0.3)' : null- }}>+ }}+ ><Viewstyle={{width: '100%',@@ -330,26 +314,19 @@ const MergeEditor = () => {alignItems: 'center',paddingHorizontal: 12,paddingLeft: 6- }}>+ }}+ ><Viewstyle={{flexDirection: 'row',alignItems: 'center',justifyContent: 'space-between',flexShrink: 1- }}>- <ActionIcon- onPress={close}- color={colors.pri}- name="arrow-left"- />- <Paragraph- style={{flexWrap: 'wrap'}}- color={colors.icon}- size={SIZE.xs}>- <Text style={{color: colors.accent, fontWeight: 'bold'}}>- (This Device)- </Text>+ }}+ >+ <ActionIcon onPress={close} color={colors.pri} name="arrow-left" />+ <Paragraph style={{ flexWrap: 'wrap' }} color={colors.icon} size={SIZE.xs}>+ <Text style={{ color: colors.accent, fontWeight: 'bold' }}>(This Device)</Text>{'\n'}{timeConverter(primaryData?.dateEdited)}</Paragraph>@@ -360,7 +337,8 @@ const MergeEditor = () => {flexDirection: 'row',alignItems: 'center',justifyContent: 'flex-end'- }}>+ }}+ >{keepContentFrom === 'secondary' ? (<ButtononPress={onPressSaveCopyFromPrimaryWebView}@@ -374,7 +352,7 @@ const MergeEditor = () => {fontSize={SIZE.xs}/>) : null}- <View style={{width: 10}} />+ <View style={{ width: 10 }} />{keepContentFrom === 'secondary' ? (<Buttontitle="Discard"@@ -431,7 +409,8 @@ const MergeEditor = () => {backgroundColor: colors.bg,borderBottomWidth: 1,borderBottomColor: colors.nav- }}>+ }}+ ><WebViewonLoad={onPrimaryWebViewLoad}ref={primaryWebView}@@ -467,21 +446,18 @@ const MergeEditor = () => {justifyContent: 'space-between',alignItems: 'center',paddingHorizontal: 12- }}>+ }}+ ><Viewstyle={{flexDirection: 'row',alignItems: 'center',justifyContent: 'space-between',flexShrink: 1- }}>- <Paragraph- style={{flexWrap: 'wrap'}}- color={colors.icon}- size={SIZE.xs}>- <Text style={{color: 'red', fontWeight: 'bold'}}>- (Incoming)- </Text>+ }}+ >+ <Paragraph style={{ flexWrap: 'wrap' }} color={colors.icon} size={SIZE.xs}>+ <Text style={{ color: 'red', fontWeight: 'bold' }}>(Incoming)</Text>{'\n'}{timeConverter(secondaryData?.dateEdited)}</Paragraph>@@ -492,7 +468,8 @@ const MergeEditor = () => {flexDirection: 'row',alignItems: 'center',justifyContent: 'flex-end'- }}>+ }}+ >{keepContentFrom === 'primary' ? (<Buttonheight={30}@@ -507,7 +484,7 @@ const MergeEditor = () => {title="Save a copy"/>) : null}- <View style={{width: 10}} />+ <View style={{ width: 10 }} />{keepContentFrom === 'primary' ? (<Buttontitle="Discard"@@ -563,7 +540,8 @@ const MergeEditor = () => {height: dHeight / 2 - (50 + insets.top / 2),backgroundColor: colors.bg,borderRadius: 10- }}>+ }}+ ><WebViewonLoad={onSecondaryWebViewLoad}ref={secondaryWebView}diff --git a/apps/mobile/src/components/MoveNoteDialog/index.js b/apps/mobile/src/components/MoveNoteDialog/index.jsindex a2dc16e72..915aecfb9 100644--- a/apps/mobile/src/components/MoveNoteDialog/index.js+++ b/apps/mobile/src/components/MoveNoteDialog/index.js@@ -1,15 +1,11 @@-import React, {createRef, useEffect, useState} from 'react';-import {Keyboard, TextInput, TouchableOpacity, View} from 'react-native';-import {FlatList} from 'react-native-gesture-handler';+import React, { createRef, useEffect, useState } from 'react';+import { Keyboard, TextInput, TouchableOpacity, View } from 'react-native';+import { FlatList } from 'react-native-gesture-handler';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {notesnook} from '../../../e2e/test.ids';-import {useTracked} from '../../provider';-import {Actions} from '../../provider/Actions';-import {- useNotebookStore,- useSelectionStore,- useSettingStore-} from '../../provider/stores';+import { notesnook } from '../../../e2e/test.ids';+import { useTracked } from '../../provider';+import { Actions } from '../../provider/Actions';+import { useNotebookStore, useSelectionStore, useSettingStore } from '../../provider/stores';import {eSubscribeEvent,eUnSubscribeEvent,@@ -17,20 +13,20 @@ import {ToastEvent} from '../../services/EventManager';import Navigation from '../../services/Navigation';-import {getTotalNotes, InteractionManager} from '../../utils';-import {db} from '../../utils/database';-import {eOpenMoveNoteDialog} from '../../utils/Events';-import {pv, SIZE} from '../../utils/SizeUtils';+import { getTotalNotes, InteractionManager } from '../../utils';+import { db } from '../../utils/database';+import { eOpenMoveNoteDialog } from '../../utils/Events';+import { pv, SIZE } from '../../utils/SizeUtils';import SheetWrapper from '../Sheet';-import {Button} from '../Button';+import { Button } from '../Button';import DialogHeader from '../Dialog/dialog-header';-import {PressableButton} from '../PressableButton';+import { PressableButton } from '../PressableButton';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';import Input from '../Input';-import {ActionIcon} from '../ActionIcon';-import {Dialog} from '../Dialog';-import {presentDialog} from '../Dialog/functions';+import { ActionIcon } from '../ActionIcon';+import { Dialog } from '../Dialog';+import { presentDialog } from '../Dialog/functions';import layoutmanager from '../../utils/layout-manager';let newNotebookTitle = null;@@ -85,13 +81,11 @@ const MoveNoteDialog = () => {export default MoveNoteDialog;-const MoveNoteComponent = ({close, note, setNote}) => {+const MoveNoteComponent = ({ close, note, setNote }) => {const [state, dispatch] = useTracked();- const {colors} = state;+ const { colors } = state;- const nbs = useNotebookStore(state =>- state.notebooks.filter(n => n?.type === 'notebook')- );+ const nbs = useNotebookStore(state => state.notebooks.filter(n => n?.type === 'notebook'));let notebooks = [...db.notebooks.all];const selectedItemsList = useSelectionStore(state => state.selectedItemsList);@@ -140,13 +134,10 @@ const MoveNoteComponent = ({close, note, setNote}) => {const handlePress = async (item, index) => {if (note && item.notes.indexOf(note.id) > -1) {- await db.notebooks- .notebook(item.notebookId)- .topics.topic(item.id)- .delete(note.id);+ await db.notebooks.notebook(item.notebookId).topics.topic(item.id).delete(note.id);if (note && note.id) {- setNote({...db.notes.note(note.id).data});+ setNote({ ...db.notes.note(note.id).data });requestAnimationFrame(() => {//layoutmanager.withSpringAnimation(500);Navigation.setRoutesToUpdate([@@ -173,7 +164,7 @@ const MoveNoteComponent = ({close, note, setNote}) => {...noteIds);if (note && note.id) {- setNote({...db.notes.note(note.id).data});+ setNote({ ...db.notes.note(note.id).data });requestAnimationFrame(() => {//layoutmanager.withSpringAnimation(500);Navigation.setRoutesToUpdate([@@ -240,7 +231,8 @@ const MoveNoteComponent = ({close, note, setNote}) => {paddingHorizontal: 12,flexDirection: 'row',justifyContent: 'space-between'- }}>+ }}+ ><DialogHeadertitle="Add to notebook"paragraph={`Add your notes to notebooks to find them easily.`}@@ -273,7 +265,8 @@ const MoveNoteComponent = ({close, note, setNote}) => {style={{width: '100%',marginTop: 10- }}>+ }}+ ><InputfwdRef={notebookInput}onChangeText={value => {@@ -290,7 +283,7 @@ const MoveNoteComponent = ({close, note, setNote}) => {button={{icon: 'check',color: notebookInputFocused ? colors.accent : colors.icon,- onPress:addNewNotebook+ onPress: addNewNotebook}}onSubmit={addNewNotebook}placeholder="Create a new notebook"@@ -300,7 +293,7 @@ const MoveNoteComponent = ({close, note, setNote}) => {style={{paddingHorizontal: 12}}- renderItem={({item, index}) => (+ renderItem={({ item, index }) => (<Viewstyle={{borderWidth: 1,@@ -308,7 +301,8 @@ const MoveNoteComponent = ({close, note, setNote}) => {borderRadius: 6,overflow: 'hidden',marginBottom: 10- }}>+ }}+ ><PressableButtononPress={() => {if (!item.topics || item.topics.length === 0) {@@ -326,7 +320,8 @@ const MoveNoteComponent = ({close, note, setNote}) => {width: '100%',borderRadius: 5,alignItems: 'flex-start'- }}>+ }}+ ><Viewstyle={{width: '100%',@@ -335,13 +330,13 @@ const MoveNoteComponent = ({close, note, setNote}) => {flexDirection: 'row',alignItems: 'center',paddingHorizontal: 12- }}>+ }}+ ><View><Heading- color={- noteExists.indexOf(item.id) > -1 ? colors.accent : null- }- size={SIZE.md}>+ color={noteExists.indexOf(item.id) > -1 ? colors.accent : null}+ size={SIZE.md}+ >{item.title}</Heading>{item.topics?.length > 0 ? (@@ -391,7 +386,7 @@ const MoveNoteComponent = ({close, note, setNote}) => {alignSelf: 'flex-end',maxHeight: 500}}- renderItem={({item, index}) => (+ renderItem={({ item, index }) => (<PressableButtononPress={() => handlePress(item, index)}type="gray"@@ -405,11 +400,10 @@ const MoveNoteComponent = ({close, note, setNote}) => {flexDirection: 'row',paddingHorizontal: 12,justifyContent: 'space-between'- }}>+ }}+ ><View>- <Paragraph color={colors.heading}>- {item.title}- </Paragraph>+ <Paragraph color={colors.heading}>{item.title}</Paragraph><Paragraph color={colors.icon} size={SIZE.xs}>{item.notes.length + ' notes'}</Paragraph>diff --git a/apps/mobile/src/components/NoteHistory/index.js b/apps/mobile/src/components/NoteHistory/index.jsindex 58585a632..112574a95 100644--- a/apps/mobile/src/components/NoteHistory/index.js+++ b/apps/mobile/src/components/NoteHistory/index.js@@ -1,25 +1,25 @@-import React, {useCallback, useEffect, useState} from 'react';-import {Text, View} from 'react-native';-import {FlatList} from 'react-native-gesture-handler';+import React, { useCallback, useEffect, useState } from 'react';+import { Text, View } from 'react-native';+import { FlatList } from 'react-native-gesture-handler';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {useTracked} from '../../provider';-import {presentSheet} from '../../services/EventManager';-import {db} from '../../utils/database';+import { useTracked } from '../../provider';+import { presentSheet } from '../../services/EventManager';+import { db } from '../../utils/database';import { openLinkInBrowser } from '../../utils/functions';-import {SIZE} from '../../utils/SizeUtils';-import {timeConverter, timeSince} from '../../utils/TimeUtils';+import { SIZE } from '../../utils/SizeUtils';+import { timeConverter, timeSince } from '../../utils/TimeUtils';import DialogHeader from '../Dialog/dialog-header';import GeneralSheet from '../GeneralSheet';-import {PressableButton} from '../PressableButton';+import { PressableButton } from '../PressableButton';import Seperator from '../Seperator';import Paragraph from '../Typography/Paragraph';import NotePreview from './preview';-export default function NoteHistory({note, ref}) {+export default function NoteHistory({ note, ref }) {const [history, setHistory] = useState([]);const [loading, setLoading] = useState(true);const [state] = useTracked();- const {colors} = state;+ const { colors } = state;useEffect(() => {(async () => {@@ -41,7 +41,7 @@ export default function NoteHistory({note, ref}) {content={content}/>),- context: 'note_history',+ context: 'note_history'});}@@ -58,7 +58,7 @@ export default function NoteHistory({note, ref}) {};const renderItem = useCallback(- ({item, index}) => (+ ({ item, index }) => (<PressableButtontype="grayBg"onPress={() => preview(item)}@@ -69,7 +69,8 @@ export default function NoteHistory({note, ref}) {height: 45,marginBottom: 10,flexDirection: 'row'- }}>+ }}+ ><Paragraph>{getDate(item.dateCreated, item.dateModified)}</Paragraph><Paragraph color={colors.icon} size={SIZE.xs}>{timeSince(item.dateModified)}@@ -106,11 +107,10 @@ export default function NoteHistory({note, ref}) {justifyContent: 'center',alignItems: 'center',height: 200- }}>+ }}+ ><Icon name="history" size={60} color={colors.icon} />- <Paragraph color={colors.icon}>- No note history found on this device.- </Paragraph>+ <Paragraph color={colors.icon}>No note history found on this device.</Paragraph></View>}renderItem={renderItem}@@ -120,13 +120,15 @@ export default function NoteHistory({note, ref}) {color={colors.icon}style={{alignSelf: 'center'- }}>- Note version history is local only.{' '}- <Text- onPress={() => {- openLinkInBrowser("https://docs.notesnook.com/versionhistory",colors);}}- style={{color: colors.accent, textDecorationLine: 'underline'}}>+ >+ Note version history is local only.{' '}+ <Text+ onPress={() => {+ openLinkInBrowser('https://docs.notesnook.com/versionhistory', colors);+ }}+ style={{ color: colors.accent, textDecorationLine: 'underline' }}+ >Learn how this works.</Text></Paragraph>diff --git a/apps/mobile/src/components/NoteHistory/preview.js b/apps/mobile/src/components/NoteHistory/preview.jsindex 79d1e4f08..725dbcfcb 100644--- a/apps/mobile/src/components/NoteHistory/preview.js+++ b/apps/mobile/src/components/NoteHistory/preview.js@@ -1,33 +1,30 @@-import React, {useRef} from 'react';-import {Alert, Platform, View} from 'react-native';+import React, { useRef } from 'react';+import { Alert, Platform, View } from 'react-native';import WebView from 'react-native-webview';-import {useTracked} from '../../provider';-import {useEditorStore} from '../../provider/stores';-import {eSendEvent, ToastEvent} from '../../services/EventManager';+import { useTracked } from '../../provider';+import { useEditorStore } from '../../provider/stores';+import { eSendEvent, ToastEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';-import {db} from '../../utils/database';-import {eCloseProgressDialog, eOnLoadNote} from '../../utils/Events';-import {openLinkInBrowser} from '../../utils/functions';-import {normalize} from '../../utils/SizeUtils';-import {getNote, sourceUri} from '../../views/Editor/Functions';+import { db } from '../../utils/database';+import { eCloseProgressDialog, eOnLoadNote } from '../../utils/Events';+import { openLinkInBrowser } from '../../utils/functions';+import { normalize } from '../../utils/SizeUtils';+import { getNote, sourceUri } from '../../views/Editor/Functions';import tiny from '../../views/Editor/tiny/tiny';-import {ActionIcon} from '../ActionIcon';-import {Button} from '../Button';+import { ActionIcon } from '../ActionIcon';+import { Button } from '../Button';import DialogHeader from '../Dialog/dialog-header';import Paragraph from '../Typography/Paragraph';-export default function NotePreview({session, content}) {+export default function NotePreview({ session, content }) {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const webviewRef = useRef();const onLoad = async () => {- let preview = await db.content.insertPlaceholders(- content,- 'placeholder.svg'- );+ let preview = await db.content.insertPlaceholders(content, 'placeholder.svg');- let theme = {...colors};+ let theme = { ...colors };theme.factor = normalize(1);webviewRef.current?.injectJavaScript(`@@ -77,7 +74,7 @@ export default function NotePreview({session, content}) {await db.noteHistory.restore(session.id);if (useEditorStore.getState()?.currentEditingNote === session?.noteId) {if (getNote()) {- eSendEvent(eOnLoadNote, {...getNote(), forced: true});+ eSendEvent(eOnLoadNote, { ...getNote(), forced: true });}}eSendEvent(eCloseProgressDialog, 'note_history');@@ -99,7 +96,8 @@ export default function NotePreview({session, content}) {style={{height: session.locked ? null : 600,width: '100%'- }}>+ }}+ ><DialogHeader padding={12} title={session.session} />{!session.locked ? (<WebView@@ -138,23 +136,18 @@ export default function NotePreview({session, content}) {height: 100,justifyContent: 'center',alignItems: 'center'- }}>- <Paragraph color={colors.icon}>- Preview not available, content is encrypted.- </Paragraph>+ }}+ >+ <Paragraph color={colors.icon}>Preview not available, content is encrypted.</Paragraph></View>)}<Viewstyle={{paddingHorizontal: 12- }}>- <Button- onPress={restore}- title="Restore this version"- type="accent"- width="100%"- />+ }}+ >+ <Button onPress={restore} title="Restore this version" type="accent" width="100%" /></View></View>);diff --git a/apps/mobile/src/components/NoteItem/index.js b/apps/mobile/src/components/NoteItem/index.jsindex 97055c615..e6892e4a7 100644--- a/apps/mobile/src/components/NoteItem/index.js+++ b/apps/mobile/src/components/NoteItem/index.js@@ -1,27 +1,27 @@-import {decode, EntityLevel} from 'entities';-import React, {useEffect} from 'react';-import {Platform, View} from 'react-native';+import { decode, EntityLevel } from 'entities';+import React, { useEffect } from 'react';+import { Platform, View } from 'react-native';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {notesnook} from '../../../e2e/test.ids';-import {useTracked} from '../../provider';-import {useSettingStore, useTagStore} from '../../provider/stores';-import {eSendEvent} from '../../services/EventManager';+import { notesnook } from '../../../e2e/test.ids';+import { useTracked } from '../../provider';+import { useSettingStore, useTagStore } from '../../provider/stores';+import { eSendEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';-import {COLORS_NOTE} from '../../utils/Colors';-import {db} from '../../utils/database';-import {refreshNotesPage} from '../../utils/Events';-import {SIZE} from '../../utils/SizeUtils';-import {ActionIcon} from '../ActionIcon';-import {Button} from '../Button';-import {ActionSheetEvent} from '../DialogManager/recievers';-import {TimeSince} from '../Menu/TimeSince';-import {Properties} from '../Properties';+import { COLORS_NOTE } from '../../utils/Colors';+import { db } from '../../utils/database';+import { refreshNotesPage } from '../../utils/Events';+import { SIZE } from '../../utils/SizeUtils';+import { ActionIcon } from '../ActionIcon';+import { Button } from '../Button';+import { ActionSheetEvent } from '../DialogManager/recievers';+import { TimeSince } from '../Menu/TimeSince';+import { Properties } from '../Properties';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';const navigateToTopic = topic => {let routeName = 'NotesPage';- let params = {...topic, menu: false, get: 'topics'};+ let params = { ...topic, menu: false, get: 'topics' };let headerState = {heading: topic.title,id: topic.id,@@ -52,15 +52,9 @@ const showActionSheet = item => {Properties.present(item);};-const NoteItem = ({- item,- isTrash,- tags,- dateBy = 'dateCreated',- noOpen = false-}) => {+const NoteItem = ({ item, isTrash, tags, dateBy = 'dateCreated', noOpen = false }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const settings = useSettingStore(state => state.settings);const compactMode = settings.notesListMode === 'compact';const attachmentCount = db.attachments?.ofNote(item.id, 'all')?.length || 0;@@ -68,7 +62,7 @@ const NoteItem = ({function getNotebook() {if (isTrash || !item.notebooks || item.notebooks.length < 1) return [];let item_notebook = item.notebooks?.slice(0, 1)[0];- notebook = db.notebooks.notebook(item_notebook.id);+ let notebook = db.notebooks.notebook(item_notebook.id);if (!notebook) return [];let topic = notebook.topics.topic(item_notebook.topics[0])?._topic;@@ -92,7 +86,8 @@ const NoteItem = ({style={{flexGrow: 1,flexShrink: 1- }}>+ }}+ >{!compactMode ? (<Viewstyle={{@@ -101,7 +96,8 @@ const NoteItem = ({zIndex: 10,elevation: 10,marginBottom: 2.5- }}>+ }}+ >{getNotebook().map(_item => (<Buttontitle={_item.title}@@ -133,7 +129,8 @@ const NoteItem = ({style={{flexWrap: 'wrap'}}- size={SIZE.md}>+ size={SIZE.md}+ >{item.title}</Heading>@@ -142,7 +139,8 @@ const NoteItem = ({style={{flexWrap: 'wrap'}}- numberOfLines={2}>+ numberOfLines={2}+ >{decode(item.headline, {level: EntityLevel.HTML})}@@ -157,7 +155,8 @@ const NoteItem = ({width: '100%',marginTop: 5,height: SIZE.md + 2- }}>+ }}+ >{!isTrash ? (<>{item.conflicted ? (@@ -177,9 +176,7 @@ const NoteItem = ({marginRight: 6}}time={item[dateBy]}- updateFrequency={- Date.now() - item[dateBy] < 60000 ? 2000 : 60000- }+ updateFrequency={Date.now() - item[dateBy] < 60000 ? 2000 : 60000}/>{attachmentCount > 0 ? (@@ -188,7 +185,8 @@ const NoteItem = ({flexDirection: 'row',alignItems: 'center',marginRight: 6- }}>+ }}+ ><Icon name="attachment" size={SIZE.md} color={colors.icon} /><Paragraph color={colors.icon} size={SIZE.xs}>{attachmentCount}@@ -204,9 +202,7 @@ const NoteItem = ({style={{marginRight: 6}}- color={- COLORS_NOTE[item.color?.toLowerCase()] || colors.accent- }+ color={COLORS_NOTE[item.color?.toLowerCase()] || colors.accent}/>) : null}@@ -244,7 +240,7 @@ const NoteItem = ({textStyle={{textDecorationLine: 'underline'}}- hitSlop={{top: 8, bottom: 12, left: 0, right: 0}}+ hitSlop={{ top: 8, bottom: 12, left: 0, right: 0 }}fontSize={SIZE.xs}style={{borderRadius: 5,@@ -266,7 +262,8 @@ const NoteItem = ({size={SIZE.xs}style={{marginRight: 6- }}>+ }}+ >Deleted on{' '}{item && item.dateDeleted? new Date(item.dateDeleted).toISOString().slice(0, 10)@@ -278,7 +275,8 @@ const NoteItem = ({size={SIZE.xs}style={{marginRight: 6- }}>+ }}+ >{item.itemType[0].toUpperCase() + item.itemType.slice(1)}</Paragraph></>diff --git a/apps/mobile/src/components/NoteItem/wrapper.js b/apps/mobile/src/components/NoteItem/wrapper.jsindex 9e713f769..c1c2522af 100644--- a/apps/mobile/src/components/NoteItem/wrapper.js+++ b/apps/mobile/src/components/NoteItem/wrapper.js@@ -1,19 +1,19 @@import React from 'react';import NoteItem from '.';-import {notesnook} from '../../../e2e/test.ids';-import {useSelectionStore, useTrashStore} from '../../provider/stores';-import {DDS} from '../../services/DeviceDetection';-import {eSendEvent, openVault, ToastEvent} from '../../services/EventManager';+import { notesnook } from '../../../e2e/test.ids';+import { useSelectionStore, useTrashStore } from '../../provider/stores';+import { DDS } from '../../services/DeviceDetection';+import { eSendEvent, openVault, ToastEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';-import {history} from '../../utils';-import {db} from '../../utils/database';-import {eOnLoadNote, eShowMergeDialog} from '../../utils/Events';-import {tabBarRef} from '../../utils/Refs';-import {presentDialog} from '../Dialog/functions';+import { history } from '../../utils';+import { db } from '../../utils/database';+import { eOnLoadNote, eShowMergeDialog } from '../../utils/Events';+import { tabBarRef } from '../../utils/Refs';+import { presentDialog } from '../Dialog/functions';import SelectionWrapper from '../SelectionWrapper';export const NoteWrapper = React.memo(- ({item, index, tags, compactMode, dateBy}) => {+ ({ item, index, tags, dateBy }) => {const isTrash = item.type === 'trash';const setSelectedItem = useSelectionStore(state => state.setSelectedItem);const onPress = async () => {@@ -92,13 +92,14 @@ export const NoteWrapper = React.memo(height={100}testID={notesnook.ids.note.get(index)}onPress={onPress}- item={item}>+ item={item}+ ><NoteItem item={item} dateBy={dateBy} tags={tags} isTrash={isTrash} /></SelectionWrapper>);},(prev, next) => {- if (prev.dateBy !== next.dateBy ) {+ if (prev.dateBy !== next.dateBy) {return false;}if (prev.item?.dateEdited !== next.item?.dateEdited) {diff --git a/apps/mobile/src/components/NotebookItem/index.js b/apps/mobile/src/components/NotebookItem/index.jsindex 30a0c3dfe..7e3139e1e 100644--- a/apps/mobile/src/components/NotebookItem/index.js+++ b/apps/mobile/src/components/NotebookItem/index.js@@ -1,30 +1,24 @@import React from 'react';-import {View} from 'react-native';+import { View } from 'react-native';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {notesnook} from '../../../e2e/test.ids';-import {useTracked} from '../../provider';-import {useSettingStore} from '../../provider/stores';-import {eSendEvent} from '../../services/EventManager';+import { notesnook } from '../../../e2e/test.ids';+import { useTracked } from '../../provider';+import { useSettingStore } from '../../provider/stores';+import { eSendEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';-import {getTotalNotes, history} from '../../utils';-import {refreshNotesPage} from '../../utils/Events';-import {SIZE} from '../../utils/SizeUtils';-import {ActionIcon} from '../ActionIcon';-import {Button} from '../Button';-import {ActionSheetEvent} from '../DialogManager/recievers';+import { getTotalNotes, history } from '../../utils';+import { refreshNotesPage } from '../../utils/Events';+import { SIZE } from '../../utils/SizeUtils';+import { ActionIcon } from '../ActionIcon';+import { Button } from '../Button';+import { ActionSheetEvent } from '../DialogManager/recievers';import { Properties } from '../Properties';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';-export const NotebookItem = ({- item,- isTopic = false,- notebookID,- isTrash,- dateBy-}) => {+export const NotebookItem = ({ item, isTopic = false, notebookID, isTrash, dateBy }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const settings = useSettingStore(state => state.settings);const compactMode = settings.notebooksListMode === 'compact';const topics = item.topics?.slice(0, 3) || [];@@ -36,7 +30,7 @@ export const NotebookItem = ({const navigateToTopic = topic => {if (history.selectedItemsList.length > 0) return;let routeName = 'NotesPage';- let params = {...topic, menu: false, get: 'topics'};+ let params = { ...topic, menu: false, get: 'topics' };let headerState = {heading: topic.title,id: topic.id,@@ -52,13 +46,15 @@ export const NotebookItem = ({style={{flexGrow: 1,flexShrink: 1- }}>+ }}+ ><Headingsize={SIZE.md}numberOfLines={1}style={{flexWrap: 'wrap'- }}>+ }}+ >{item.title}</Heading>{isTopic || !item.description || compactMode ? null : (@@ -67,7 +63,8 @@ export const NotebookItem = ({numberOfLines={2}style={{flexWrap: 'wrap'- }}>+ }}+ >{item.description}</Paragraph>)}@@ -78,7 +75,8 @@ export const NotebookItem = ({flexDirection: 'row',alignItems: 'center',flexWrap: 'wrap'- }}>+ }}+ >{topics.map(topic => (<Buttontitle={topic.title}@@ -86,14 +84,12 @@ export const NotebookItem = ({height={null}textStyle={{fontWeight: 'normal',- fontFamily: null+ fontFamily: null,+ marginRight: 0}}type="grayBg"fontSize={SIZE.xs}icon="bookmark-outline"- textStyle={{- marginRight: 0- }}iconSize={SIZE.sm}style={{borderRadius: 5,@@ -118,13 +114,15 @@ export const NotebookItem = ({alignItems: 'center',marginTop: 5,height: SIZE.md + 2- }}>+ }}+ ><Paragraphcolor={colors.accent}size={SIZE.xs}style={{marginRight: 6- }}>+ }}+ >{isTopic ? 'Topic' : 'Notebook'}</Paragraph>@@ -136,9 +134,9 @@ export const NotebookItem = ({style={{textAlignVertical: 'center',marginRight: 6- }}>- {'Deleted on ' +- new Date(item.dateDeleted).toISOString().slice(0, 10)}+ }}+ >+ {'Deleted on ' + new Date(item.dateDeleted).toISOString().slice(0, 10)}</Paragraph><Paragraphcolor={colors.accent}@@ -146,7 +144,8 @@ export const NotebookItem = ({style={{textAlignVertical: 'center',marginRight: 6- }}>+ }}+ >{item.itemType[0].toUpperCase() + item.itemType.slice(1)}</Paragraph></>@@ -156,7 +155,8 @@ export const NotebookItem = ({size={SIZE.xs}style={{marginRight: 6- }}>+ }}+ >{new Date(item[dateBy]).toDateString().substring(4)}</Paragraph>)}@@ -165,7 +165,8 @@ export const NotebookItem = ({size={SIZE.xs}style={{marginRight: 6- }}>+ }}+ >{item && totalNotes > 1? totalNotes + ' notes': totalNotes === 1@@ -175,7 +176,6 @@ export const NotebookItem = ({{item.pinned ? (<Icon- style={{marginRight: 6}}name="pin-outline"size={SIZE.sm}style={{diff --git a/apps/mobile/src/components/NotebookItem/wrapper.js b/apps/mobile/src/components/NotebookItem/wrapper.jsindex 565cc5355..db9bb4fd6 100644--- a/apps/mobile/src/components/NotebookItem/wrapper.js+++ b/apps/mobile/src/components/NotebookItem/wrapper.js@@ -1,14 +1,14 @@import React from 'react';-import {NotebookItem} from '.';-import {useSelectionStore} from '../../provider/stores';-import {eSendEvent} from '../../services/EventManager';+import { NotebookItem } from '.';+import { useSelectionStore } from '../../provider/stores';+import { eSendEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';-import {history} from '../../utils';-import {eOnNewTopicAdded, refreshNotesPage} from '../../utils/Events';+import { history } from '../../utils';+import { eOnNewTopicAdded, refreshNotesPage } from '../../utils/Events';import SelectionWrapper from '../SelectionWrapper';export const NotebookWrapper = React.memo(- ({item, index,dateBy}) => {+ ({ item, index, dateBy }) => {const isTrash = item.type === 'trash';const setSelectedItem = useSelectionStore(state => state.setSelectedItem);@@ -23,7 +23,7 @@ export const NotebookWrapper = React.memo(let params =item.type === 'topic'- ? {...item, menu: false}+ ? { ...item, menu: false }: {menu: false,notebook: item,@@ -47,7 +47,8 @@ export const NotebookWrapper = React.memo(index={index}onPress={onPress}height={item.type === 'topic' ? 80 : 110}- item={item}>+ item={item}+ ><NotebookItemisTopic={item.type === 'topic'}item={item}@@ -59,7 +60,7 @@ export const NotebookWrapper = React.memo();},(prev, next) => {- if (prev.dateBy !== next.dateBy ) {+ if (prev.dateBy !== next.dateBy) {return false;}diff --git a/apps/mobile/src/components/Premium/compactfeatures.js b/apps/mobile/src/components/Premium/compactfeatures.jsindex bbadb3639..2dd2d90be 100644--- a/apps/mobile/src/components/Premium/compactfeatures.js+++ b/apps/mobile/src/components/Premium/compactfeatures.js@@ -1,68 +1,68 @@import React from 'react';-import {ScrollView} from 'react-native';-import {useTracked} from '../../provider';-import {FeatureBlock} from './feature';+import { ScrollView } from 'react-native';+import { FeatureBlock } from './feature';-export const CompactFeatures = ({vertical,features = [],maxHeight=500,scrollRef}) => {- const [state, dispatch] = useTracked();- const {colors} = state;- let data = vertical ? features : [- {- highlight: 'Everything',- content: 'in basic',- icon: 'emoticon-wink'- },- {- highlight: 'Unlimited',- content: 'notebooks',- icon: 'notebook'- },- {- highlight: 'File & image',- content: 'attachments',- icon: 'attachment'- },- {- highlight: 'Instant',- content: 'syncing',- icon: 'sync'- },- {- highlight: 'Private',- content: 'vault',- icon: 'shield'- },- {- highlight: 'Rich text',- content: 'editing',- icon: 'square-edit-outline'- },- {- highlight: 'PDF & markdown',- content: 'exports',- icon: 'file'- },- {- highlight: 'Encrypted',- content: 'backups',- icon: 'backup-restore'- }- ]+export const CompactFeatures = ({ vertical, features = [], maxHeight = 500, scrollRef }) => {+ let data = vertical+ ? features+ : [+ {+ highlight: 'Everything',+ content: 'in basic',+ icon: 'emoticon-wink'+ },+ {+ highlight: 'Unlimited',+ content: 'notebooks',+ icon: 'notebook'+ },+ {+ highlight: 'File & image',+ content: 'attachments',+ icon: 'attachment'+ },+ {+ highlight: 'Instant',+ content: 'syncing',+ icon: 'sync'+ },+ {+ highlight: 'Private',+ content: 'vault',+ icon: 'shield'+ },+ {+ highlight: 'Rich text',+ content: 'editing',+ icon: 'square-edit-outline'+ },+ {+ highlight: 'PDF & markdown',+ content: 'exports',+ icon: 'file'+ },+ {+ highlight: 'Encrypted',+ content: 'backups',+ icon: 'backup-restore'+ }+ ];return (<ScrollViewhorizontal={!vertical}- nestedScrollEnabled- onMomentumScrollEnd={() => {- scrollRef?.current?.handleChildScrollEnd();- }}+ nestedScrollEnabled+ onMomentumScrollEnd={() => {+ scrollRef?.current?.handleChildScrollEnd();+ }}showsHorizontalScrollIndicator={false}style={{width: '100%',- maxHeight:maxHeight- }}>+ maxHeight: maxHeight+ }}+ >{data.map(item => (- <FeatureBlock vertical={vertical} {...item} />+ <FeatureBlock key={item.highlight} vertical={vertical} {...item} />))}</ScrollView>);diff --git a/apps/mobile/src/components/Premium/component.js b/apps/mobile/src/components/Premium/component.jsindex e0ce2aa30..999c94a0d 100644--- a/apps/mobile/src/components/Premium/component.js+++ b/apps/mobile/src/components/Premium/component.js@@ -1,27 +1,27 @@-import React, {useState} from 'react';-import {ScrollView, View} from 'react-native';-import {LAUNCH_ROCKET} from '../../assets/images/assets';-import {useTracked} from '../../provider';-import {useUserStore} from '../../provider/stores';-import {DDS} from '../../services/DeviceDetection';-import {eSendEvent, presentSheet} from '../../services/EventManager';-import {getElevation} from '../../utils';-import {eOpenLoginDialog} from '../../utils/Events';-import {SIZE} from '../../utils/SizeUtils';+import React, { useState } from 'react';+import { ScrollView, View } from 'react-native';+import { LAUNCH_ROCKET } from '../../assets/images/assets';+import { useTracked } from '../../provider';+import { useUserStore } from '../../provider/stores';+import { DDS } from '../../services/DeviceDetection';+import { eSendEvent, presentSheet } from '../../services/EventManager';+import { getElevation } from '../../utils';+import { eOpenLoginDialog } from '../../utils/Events';+import { SIZE } from '../../utils/SizeUtils';import umami from '../../utils/umami';-import {ActionIcon} from '../ActionIcon';-import {Button} from '../Button';+import { ActionIcon } from '../ActionIcon';+import { Button } from '../Button';import GeneralSheet from '../GeneralSheet';-import {SvgToPngView} from '../ListPlaceholders';+import { SvgToPngView } from '../ListPlaceholders';import Seperator from '../Seperator';-import {Toast} from '../Toast';+import { Toast } from '../Toast';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';-import {features} from './features';-import {Group} from './group';-import {PricingPlans} from './pricing-plans';+import { features } from './features';+import { Group } from './group';+import { PricingPlans } from './pricing-plans';-export const Component = ({close, promo, getRef}) => {+export const Component = ({ close, promo, getRef }) => {const [state, dispatch] = useTracked();const colors = state.colors;const user = useUserStore(state => state.user);@@ -63,7 +63,8 @@ export const Component = ({close, promo, getRef}) => {justifyContent: 'space-between',borderRadius: 10,maxHeight: '100%'- }}>+ }}+ ><GeneralSheet context="pricing_plans" /><ActionIcononPress={() => {@@ -87,7 +88,8 @@ export const Component = ({close, promo, getRef}) => {}}keyboardDismissMode="none"keyboardShouldPersistTaps="always"- onScroll={onScroll}>+ onScroll={onScroll}+ ><Viewkey="top-banner"style={{@@ -95,12 +97,9 @@ export const Component = ({close, promo, getRef}) => {alignItems: 'center',height: 400,justifyContent: 'center'- }}>- <SvgToPngView- width={350}- height={350}- src={LAUNCH_ROCKET(colors.accent)}- />+ }}+ >+ <SvgToPngView width={350} height={350} src={LAUNCH_ROCKET(colors.accent)} /></View><Heading@@ -109,7 +108,8 @@ export const Component = ({close, promo, getRef}) => {style={{alignSelf: 'center',paddingTop: 20- }}>+ }}+ >Notesnook{' '}<Heading size={SIZE.lg} color={colors.accent}>Pro@@ -124,16 +124,15 @@ export const Component = ({close, promo, getRef}) => {alignSelf: 'center',paddingBottom: 20,width: '90%'- }}>+ }}+ >Ready to take the next step on your private note taking journey?</Paragraph><Buttonkey="calltoaction"onPress={onPress}- title={- promo ? promo.text : user ? `See all plans` : 'Try free for 14 days'- }+ title={promo ? promo.text : user ? `See all plans` : 'Try free for 14 days'}type="accent"style={{paddingHorizontal: 24,@@ -151,7 +150,8 @@ export const Component = ({close, promo, getRef}) => {key="plans"style={{paddingHorizontal: 12- }}>+ }}+ ><PricingPlans promo={promo} /></View></ScrollView>@@ -159,9 +159,7 @@ export const Component = ({close, promo, getRef}) => {{floatingButton ? (<ButtononPress={onPress}- title={- promo ? promo.text : user ? `See all plans` : 'Try free for 14 days'- }+ title={promo ? promo.text : user ? `See all plans` : 'Try free for 14 days'}type="accent"style={{paddingHorizontal: 24,diff --git a/apps/mobile/src/components/Premium/expiring.js b/apps/mobile/src/components/Premium/expiring.jsindex 05453e90d..10670401f 100644--- a/apps/mobile/src/components/Premium/expiring.js+++ b/apps/mobile/src/components/Premium/expiring.js@@ -1,17 +1,9 @@import React, { useEffect, useState } from 'react';import { View } from 'react-native';import { useTracked } from '../../provider';-import {- eSendEvent,- eSubscribeEvent,- eUnSubscribeEvent-} from '../../services/EventManager';+import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';import PremiumService from '../../services/PremiumService';-import {- eOpenPremiumDialog,- eOpenResultDialog,- eOpenTrialEndingDialog-} from '../../utils/Events';+import { eOpenPremiumDialog, eOpenResultDialog, eOpenTrialEndingDialog } from '../../utils/Events';import { SIZE } from '../../utils/SizeUtils';import { sleep } from '../../utils/TimeUtils';import { Button } from '../Button';@@ -25,17 +17,19 @@ import { Offer } from './offer';export const Expiring = () => {const [state, dispatch] = useTracked();- const {colors} = state;+ const { colors } = state;const [visible, setVisible] = useState(false);const [status, setStatus] = useState({title: 'Your trial is ending soon',offer: null,extend: true});- const promo = status.offer ? {- promoCode:"com.streetwriters.notesnook.sub.yr.trialoffer",- text:"GET 30% OFF on yearly"-}: null+ const promo = status.offer+ ? {+ promoCode: 'com.streetwriters.notesnook.sub.yr.trialoffer',+ text: 'GET 30% OFF on yearly'+ }+ : null;useEffect(() => {eSubscribeEvent(eOpenTrialEndingDialog, open);@@ -54,24 +48,28 @@ export const Expiring = () => {<BaseDialogonRequestClose={() => {setVisible(false);- }}>+ }}+ ><DialogContainer><Viewstyle={{width: '100%',alignItems: 'center'- }}>+ }}+ ><Viewstyle={{paddingHorizontal: 12,width: '100%'- }}>+ }}+ ><HeadingtextBreakStrategy="balanced"style={{textAlign: 'center',paddingTop: 18- }}>+ }}+ >{status.title}</Heading><Seperator />@@ -79,7 +77,8 @@ export const Expiring = () => {style={{width: '100%',alignItems: 'center'- }}>+ }}+ >{status.offer ? (<><Offer padding={20} off={status.offer} />@@ -93,14 +92,14 @@ export const Expiring = () => {paddingTop: 0,paddingBottom: 20}}- size={SIZE.md + 2}>- Upgrade now to continue using all the pro features after- your trial ends+ size={SIZE.md + 2}+ >+ Upgrade now to continue using all the pro features after your trial ends</Paragraph></>)}- <CompactFeatures/>+ <CompactFeatures /><ParagraphonPress={async () => {@@ -113,7 +112,8 @@ export const Expiring = () => {textDecorationLine: 'underline',color: colors.icon,marginTop: 10- }}>+ }}+ >See what's included in Basic & Pro plans</Paragraph>@@ -127,14 +127,15 @@ export const Expiring = () => {width: '100%',borderBottomRightRadius: 10,borderBottomLeftRadius: 10- }}>+ }}+ ><Buttontype="transparent"title="Subscribe now"onPress={async () => {setVisible(false);await sleep(300);- PremiumService.sheet(null,promo)+ PremiumService.sheet(null, promo);}}fontSize={SIZE.md + 2}style={{diff --git a/apps/mobile/src/components/Premium/feature.js b/apps/mobile/src/components/Premium/feature.jsindex 675cdcd18..bc0612b0e 100644--- a/apps/mobile/src/components/Premium/feature.js+++ b/apps/mobile/src/components/Premium/feature.js@@ -1,23 +1,14 @@import React from 'react';-import {Text, View} from 'react-native';-import {color} from 'react-native-reanimated';+import { Text, View } from 'react-native';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {useTracked} from '../../provider';-import {SIZE} from '../../utils/SizeUtils';-import Seperator from '../Seperator';+import { useTracked } from '../../provider';+import { SIZE } from '../../utils/SizeUtils';import Paragraph from '../Typography/Paragraph';-import {ProTag} from './pro-tag';+import { ProTag } from './pro-tag';-export const FeatureBlock = ({- vertical,- highlight,- content,- icon,- pro,- proTagBg-}) => {- const [state, dispatch] = useTracked();- const {colors} = state;+export const FeatureBlock = ({ vertical, highlight, content, icon, pro, proTagBg }) => {+ const [state] = useTracked();+ const { colors } = state;return vertical ? (<View@@ -25,8 +16,9 @@ export const FeatureBlock = ({flexDirection: 'row',alignItems: 'center',paddingHorizontal: 12,- marginBottom: 10,- }}>+ marginBottom: 10+ }}+ ><Icon color={colors.accent} name="check" size={SIZE.lg} /><Paragraph@@ -35,7 +27,8 @@ export const FeatureBlock = ({marginLeft: 5,flexShrink: 1}}- size={SIZE.md}>+ size={SIZE.md}+ >{content}</Paragraph></View>@@ -48,17 +41,18 @@ export const FeatureBlock = ({marginRight: 10,borderRadius: 5,minWidth: 100- }}>+ }}+ ><Icon color={colors.icon} name={icon} size={SIZE.xl} /><Paragraph size={SIZE.md}>- <Text style={{color: colors.accent}}>{highlight}</Text>+ <Text style={{ color: colors.accent }}>{highlight}</Text>{'\n'}{content}</Paragraph>{pro ? (<>- <View style={{height: 5}} />+ <View style={{ height: 5 }} /><ProTag width={50} size={SIZE.xs} background={proTagBg} /></>) : (diff --git a/apps/mobile/src/components/Premium/features.js b/apps/mobile/src/components/Premium/features.jsindex 357be0bc7..bd9e30975 100644--- a/apps/mobile/src/components/Premium/features.js+++ b/apps/mobile/src/components/Premium/features.js@@ -39,8 +39,7 @@ export const features = [},{title: 'Attach files & images',- detail:- 'Add your documents, PDFs, images and videos, and keep them safe and organized.',+ detail: 'Add your documents, PDFs, images and videos, and keep them safe and organized.',pro: true,features: [{@@ -78,8 +77,7 @@ export const features = [},{title: 'Organize yourself in the best way',- detail:- 'We offer multiple ways to keep you organized. The only limit is your imagination.',+ detail: 'We offer multiple ways to keep you organized. The only limit is your imagination.',features: [{highlight: 'Unlimited',@@ -208,8 +206,7 @@ export const features = [},{title: 'Personalize & make Notesnook your own',- detail:- 'Change app themes to match your style. Custom themes are coming soon.',+ detail: 'Change app themes to match your style. Custom themes are coming soon.',pro: true,features: [{diff --git a/apps/mobile/src/components/Premium/group.js b/apps/mobile/src/components/Premium/group.jsindex 2f5463ff7..ca2d6012f 100644--- a/apps/mobile/src/components/Premium/group.js+++ b/apps/mobile/src/components/Premium/group.js@@ -1,13 +1,13 @@import React from 'react';-import {ScrollView, View} from 'react-native';-import {useTracked} from '../../provider';-import {SIZE} from '../../utils/SizeUtils';+import { ScrollView, View } from 'react-native';+import { useTracked } from '../../provider';+import { SIZE } from '../../utils/SizeUtils';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';-import {FeatureBlock} from './feature';-import {ProTag} from './pro-tag';+import { FeatureBlock } from './feature';+import { ProTag } from './pro-tag';-export const Group = ({item, index}) => {+export const Group = ({ item, index }) => {const [state] = useTracked();const colors = state.colors;@@ -15,15 +15,12 @@ export const Group = ({item, index}) => {<Viewstyle={{paddingHorizontal: 12,- paddingVertical: 8,backgroundColor: index % 2 !== 0 ? colors.bg : colors.nav,paddingVertical: 40- }}>+ }}+ >{item?.pro ? (- <ProTag- size={SIZE.sm}- background={index % 2 === 0 ? colors.bg : colors.nav}- />+ <ProTag size={SIZE.sm} background={index % 2 === 0 ? colors.bg : colors.nav} />) : null}<Heading>{item.title}</Heading><Paragraph size={SIZE.md}>{item.detail}</Paragraph>@@ -34,9 +31,11 @@ export const Group = ({item, index}) => {marginTop: 20}}horizontal- showsHorizontalScrollIndicator={false}>+ showsHorizontalScrollIndicator={false}+ >{item.features?.map(item => (<FeatureBlock+ key={item.detail}{...item}detail={item.detail}pro={item.pro}@@ -51,7 +50,8 @@ export const Group = ({item, index}) => {marginTop: 10}}size={SIZE.xs}- color={colors.icon}>+ color={colors.icon}+ >{item.info}</Paragraph>) : null}diff --git a/apps/mobile/src/components/Premium/index.js b/apps/mobile/src/components/Premium/index.jsindex 3f160e51b..d0c139a0c 100644--- a/apps/mobile/src/components/Premium/index.js+++ b/apps/mobile/src/components/Premium/index.js@@ -1,8 +1,8 @@-import React, {createRef} from 'react';-import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';-import {eClosePremiumDialog, eOpenPremiumDialog} from '../../utils/Events';+import React, { createRef } from 'react';+import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';+import { eClosePremiumDialog, eOpenPremiumDialog } from '../../utils/Events';import BaseDialog from '../Dialog/base-dialog';-import {Component} from './component';+import { Component } from './component';class PremiumDialog extends React.Component {constructor(props) {@@ -46,15 +46,8 @@ class PremiumDialog extends React.Component {render() {return !this.state.visible ? null : (- <BaseDialog- bounce- background={this.props.colors.bg}- onRequestClose={this.onClose}>- <Component- getRef={() => this.actionSheetRef}- promo={this.state.promo}- close={this.close}- />+ <BaseDialog bounce background={this.props.colors.bg} onRequestClose={this.onClose}>+ <Component getRef={() => this.actionSheetRef} promo={this.state.promo} close={this.close} /></BaseDialog>);}diff --git a/apps/mobile/src/components/Premium/offer.js b/apps/mobile/src/components/Premium/offer.jsindex a02bc8ab9..b8f2d274c 100644--- a/apps/mobile/src/components/Premium/offer.js+++ b/apps/mobile/src/components/Premium/offer.js@@ -1,16 +1,12 @@import React from 'react';-import {Text} from 'react-native';-import {useTracked} from '../../provider';-import {SIZE} from '../../utils/SizeUtils';+import { Text } from 'react-native';+import { useTracked } from '../../provider';+import { SIZE } from '../../utils/SizeUtils';import Paragraph from '../Typography/Paragraph';-export const Offer = ({- off = '30',- text = 'on yearly plan, offer ends soon',- padding = 0-}) => {+export const Offer = ({ off = '30', text = 'on yearly plan, offer ends soon', padding = 0 }) => {const [state, dispatch] = useTracked();- const {colors} = state;+ const { colors } = state;return (<Paragraph@@ -18,9 +14,10 @@ export const Offer = ({textAlign: 'center',paddingVertical: padding}}- size={SIZE.xxxl}>+ size={SIZE.xxxl}+ >GET {off}- <Text style={{color: colors.accent}}>%</Text> OFF!{'\n'}+ <Text style={{ color: colors.accent }}>%</Text> OFF!{'\n'}<Paragraph color={colors.icon}>{text}</Paragraph></Paragraph>);diff --git a/apps/mobile/src/components/Premium/premiumtoast.js b/apps/mobile/src/components/Premium/premiumtoast.jsindex f3eddb11c..e542857e5 100644--- a/apps/mobile/src/components/Premium/premiumtoast.js+++ b/apps/mobile/src/components/Premium/premiumtoast.js@@ -1,24 +1,16 @@-import React, {useEffect, useState} from 'react';-import {View} from 'react-native';-import Animated, {Easing} from 'react-native-reanimated';-import {useTracked} from '../../provider';-import {DDS} from '../../services/DeviceDetection';-import {- eSendEvent,- eSubscribeEvent,- eUnSubscribeEvent-} from '../../services/EventManager';-import {dWidth, editing, getElevation} from '../../utils';-import {- eCloseActionSheet,- eOpenPremiumDialog,- eShowGetPremium-} from '../../utils/Events';-import {SIZE} from '../../utils/SizeUtils';-import {sleep} from '../../utils/TimeUtils';-import {EditorWebView} from '../../views/Editor/Functions';+import React, { useEffect, useState } from 'react';+import { View } from 'react-native';+import Animated, { Easing } from 'react-native-reanimated';+import { useTracked } from '../../provider';+import { DDS } from '../../services/DeviceDetection';+import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';+import { dWidth, editing, getElevation } from '../../utils';+import { eCloseActionSheet, eOpenPremiumDialog, eShowGetPremium } from '../../utils/Events';+import { SIZE } from '../../utils/SizeUtils';+import { sleep } from '../../utils/TimeUtils';+import { EditorWebView } from '../../views/Editor/Functions';import tiny from '../../views/Editor/tiny/tiny';-import {Button} from '../Button';+import { Button } from '../Button';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';@@ -29,9 +21,9 @@ let currentMsg = {title: '',desc: ''};-export const PremiumToast = ({close, context = 'global', offset = 0}) => {+export const PremiumToast = ({ close, context = 'global', offset = 0 }) => {const [state, dispatch] = useTracked();- const {colors} = state;+ const { colors } = state;const [msg, setMsg] = useState(currentMsg);const open = event => {@@ -130,19 +122,22 @@ export const PremiumToast = ({close, context = 'global', offset = 0}) => {translateY: translatePrem}]- }}>+ }}+ ><Viewstyle={{flexShrink: 1,flexGrow: 1,paddingRight: 6- }}>+ }}+ ><Headingstyle={{flexWrap: 'wrap'}}color={colors.accent}- size={SIZE.md}>+ size={SIZE.md}+ >{msg.title}</Heading>@@ -151,7 +146,8 @@ export const PremiumToast = ({close, context = 'global', offset = 0}) => {flexWrap: 'wrap'}}size={SIZE.sm}- color={colors.pri}>+ color={colors.pri}+ >{msg.desc}</Paragraph></View>diff --git a/apps/mobile/src/components/Premium/pricingitem.js b/apps/mobile/src/components/Premium/pricingitem.jsindex 31a043961..df47fdc94 100644--- a/apps/mobile/src/components/Premium/pricingitem.js+++ b/apps/mobile/src/components/Premium/pricingitem.js@@ -1,13 +1,13 @@import React from 'react';-import {View} from 'react-native';-import {useTracked} from '../../provider';+import { View } from 'react-native';+import { useTracked } from '../../provider';import { getElevation } from '../../utils';-import {SIZE} from '../../utils/SizeUtils';-import {PressableButton} from '../PressableButton';+import { SIZE } from '../../utils/SizeUtils';+import { PressableButton } from '../PressableButton';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';-export const PricingItem = ({product, onPress, compact}) => {+export const PricingItem = ({ product, onPress, compact }) => {const [state, dispatch] = useTracked();const colors = state.colors;@@ -22,27 +22,22 @@ export const PricingItem = ({product, onPress, compact}) => {paddingHorizontal: 12,paddingVertical: compact ? 15 : 10,width: compact ? null : '100%',- minWidth: 150,- }}>+ minWidth: 150+ }}+ >{!compact && (<View><Heading size={SIZE.lg - 2}>- {product?.type === 'yearly' || product?.offerType === 'yearly'- ? 'Yearly'- : 'Monthly'}+ {product?.type === 'yearly' || product?.offerType === 'yearly' ? 'Yearly' : 'Monthly'}</Heading>- {product?.info && (- <Paragraph size={SIZE.xs}>{product.info}</Paragraph>- )}+ {product?.info && <Paragraph size={SIZE.xs}>{product.info}</Paragraph>}</View>)}<View><Paragraph size={SIZE.sm}><Heading size={SIZE.lg - 2}>{product?.data?.localizedPrice}/</Heading>- {product?.type === 'yearly' || product?.offerType === 'yearly'- ? '/year'- : '/month'}+ {product?.type === 'yearly' || product?.offerType === 'yearly' ? '/year' : '/month'}</Paragraph></View></PressableButton>diff --git a/apps/mobile/src/components/Premium/pricingplans.js b/apps/mobile/src/components/Premium/pricingplans.jsindex 5fbfbfe3c..fca1d288f 100644--- a/apps/mobile/src/components/Premium/pricingplans.js+++ b/apps/mobile/src/components/Premium/pricingplans.js@@ -1,32 +1,28 @@-import React, {useEffect, useState} from 'react';-import {ActivityIndicator, Platform, Text, View} from 'react-native';+import React, { useEffect, useState } from 'react';+import { ActivityIndicator, Platform, Text, View } from 'react-native';import * as RNIap from 'react-native-iap';-import {useTracked} from '../../provider';-import {useUserStore} from '../../provider/stores';-import {- eSendEvent,- presentSheet,- ToastEvent-} from '../../services/EventManager';+import { useTracked } from '../../provider';+import { useUserStore } from '../../provider/stores';+import { eSendEvent, presentSheet, ToastEvent } from '../../services/EventManager';import PremiumService from '../../services/PremiumService';-import {db} from '../../utils/database';+import { db } from '../../utils/database';import {eClosePremiumDialog,eCloseProgressDialog,eCloseSimpleDialog,eOpenLoginDialog} from '../../utils/Events';-import {openLinkInBrowser} from '../../utils/functions';-import {SIZE} from '../../utils/SizeUtils';-import {sleep} from '../../utils/TimeUtils';+import { openLinkInBrowser } from '../../utils/functions';+import { SIZE } from '../../utils/SizeUtils';+import { sleep } from '../../utils/TimeUtils';import umami from '../../utils/umami';-import {Button} from '../Button';-import {Dialog} from '../Dialog';+import { Button } from '../Button';+import { Dialog } from '../Dialog';import BaseDialog from '../Dialog/base-dialog';-import {presentDialog} from '../Dialog/functions';+import { presentDialog } from '../Dialog/functions';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';-import {PricingItem} from './pricing-item';+import { PricingItem } from './pricing-item';const promoCyclesMonthly = {1: 'first month',@@ -40,12 +36,7 @@ const promoCyclesYearly = {3: 'first 3 years'};-export const PricingPlans = ({- promo,- marginTop,- heading = true,- compact = false-}) => {+export const PricingPlans = ({ promo, marginTop, heading = true, compact = false }) => {const [state, dispatch] = useTracked();const colors = state.colors;const user = useUserStore(state => state.user);@@ -61,12 +52,8 @@ export const PricingPlans = ({let products = await PremiumService.getProducts();if (products.length > 0) {let offers = {- monthly: products.find(- p => p.productId === 'com.streetwriters.notesnook.sub.mo'- ),- yearly: products.find(- p => p.productId === 'com.streetwriters.notesnook.sub.yr'- )+ monthly: products.find(p => p.productId === 'com.streetwriters.notesnook.sub.mo'),+ yearly: products.find(p => p.productId === 'com.streetwriters.notesnook.sub.yr')};setOffers(offers);@@ -98,12 +85,10 @@ export const PricingPlans = ({let isMonthly = product.productId.indexOf('.mo') > -1;let cycleText = isMonthly? promoCyclesMonthly[- product.introductoryPriceCyclesAndroid ||- product.introductoryPriceNumberOfPeriodsIOS+ product.introductoryPriceCyclesAndroid || product.introductoryPriceNumberOfPeriodsIOS]: promoCyclesYearly[- product.introductoryPriceCyclesAndroid ||- product.introductoryPriceNumberOfPeriodsIOS+ product.introductoryPriceCyclesAndroid || product.introductoryPriceNumberOfPeriodsIOS];setProduct({@@ -132,18 +117,8 @@ export const PricingPlans = ({setBuying(false);return;}- umami.pageView(- '/iap-native',- `${compact ? 'pro-sheet' : 'pro-screen'}/pro-plans`- );- await RNIap.requestSubscription(- product?.productId,- false,- null,- null,- null,- user.id- );+ umami.pageView('/iap-native', `${compact ? 'pro-sheet' : 'pro-screen'}/pro-plans`);+ await RNIap.requestSubscription(product?.productId, false, null, null, null, user.id);setBuying(false);eSendEvent(eCloseProgressDialog);eSendEvent(eClosePremiumDialog);@@ -170,14 +145,16 @@ export const PricingPlans = ({justifyContent: 'center',alignItems: 'center',height: 100- }}>+ }}+ ><ActivityIndicator color={colors.accent} size={25} /></View>) : (<Viewstyle={{paddingHorizontal: 12- }}>+ }}+ >{buying ? (<BaseDialog statusBarTranslucent centered><ActivityIndicator size={50} color="white" />@@ -190,14 +167,16 @@ export const PricingPlans = ({alignSelf: 'center',textAlign: 'center'}}- size={SIZE.lg - 4}>+ size={SIZE.lg - 4}+ >{product.data.introductoryPrice}<Paragraphstyle={{textDecorationLine: 'line-through',color: colors.icon}}- size={SIZE.sm}>+ size={SIZE.sm}+ >({product.data.localizedPrice})</Paragraph>{' '}for {product.cycleText}@@ -212,7 +191,8 @@ export const PricingPlans = ({alignSelf: 'center',marginTop: marginTop || 20,marginBottom: 20- }}>+ }}+ >Choose a plan</Heading>) : null}@@ -222,7 +202,8 @@ export const PricingPlans = ({flexDirection: !compact ? 'column' : 'row',flexWrap: 'wrap',justifyContent: 'space-around'- }}>+ }}+ ><PricingItemonPress={() => buySubscription(offers?.monthly)}compact={compact}@@ -271,8 +252,7 @@ export const PricingPlans = ({eSendEvent(eCloseSimpleDialog);setBuying(true);try {- if (!(await getPromo(value)))- throw new Error('Error applying promo code');+ if (!(await getPromo(value))) throw new Error('Error applying promo code');ToastEvent.show({heading: 'Discount applied!',type: 'success',@@ -333,12 +313,14 @@ export const PricingPlans = ({alignSelf: 'center',justifyContent: 'center',textAlign: 'center'- }}>+ }}+ >Use promo code{' '}<Textstyle={{fontFamily: 'OpenSans-SemiBold'- }}>+ }}+ >{promo.promoCode}</Text>{' '}at checkout@@ -380,14 +362,13 @@ export const PricingPlans = ({alignSelf: 'center',textAlign: 'center',marginTop: 10- }}>- Upon signing up, your 14 day free trial of Notesnook Pro will be- activated automatically.{' '}- <Paragraph size={SIZE.xs} style={{fontWeight: 'bold'}}>+ }}+ >+ Upon signing up, your 14 day free trial of Notesnook Pro will be activated automatically.{' '}+ <Paragraph size={SIZE.xs} style={{ fontWeight: 'bold' }}>No credit card information is required.</Paragraph>{' '}- Once the free trial period ends, your account will be downgraded to- basic free account.{' '}+ Once the free trial period ends, your account will be downgraded to basic free account.{' '}<Paragraphsize={SIZE.xs}onPress={() => {@@ -398,9 +379,9 @@ export const PricingPlans = ({});}}color={colors.accent}- style={{fontWeight: 'bold', textDecorationLine: 'underline'}}>- Visit our website to learn what is included in the basic free- account.+ style={{ fontWeight: 'bold', textDecorationLine: 'underline' }}+ >+ Visit our website to learn what is included in the basic free account.</Paragraph></Paragraph>) : null}@@ -416,10 +397,11 @@ export const PricingPlans = ({alignSelf: 'center',marginTop: 10,textAlign: 'center'- }}>- By subscribing, you will be charged to your iTunes Account for the- selected plan. Subscriptions will automatically renew unless- cancelled within 24-hours before the end of the current period.+ }}+ >+ By subscribing, you will be charged to your iTunes Account for the selected plan.+ Subscriptions will automatically renew unless cancelled within 24-hours before the end+ of the current period.</Paragraph>) : (<Paragraph@@ -429,24 +411,26 @@ export const PricingPlans = ({alignSelf: 'center',marginTop: 10,textAlign: 'center'- }}>- By subscribing, your will be charged on your Google Account, and- your subscription will automatically renew until you cancel prior- to the end of the then current period.+ }}+ >+ By subscribing, your will be charged on your Google Account, and your subscription+ will automatically renew until you cancel prior to the end of the then current period.</Paragraph>)}<Viewstyle={{width: '100%'- }}>+ }}+ ><Paragraphsize={SIZE.xs}color={colors.icon}style={{maxWidth: '100%',textAlign: 'center'- }}>+ }}+ >By subscribing, you agree to our{' '}<Paragraphsize={SIZE.xs}@@ -460,7 +444,8 @@ export const PricingPlans = ({style={{textDecorationLine: 'underline'}}- color={colors.accent}>+ color={colors.accent}+ >Terms of Service{' '}</Paragraph>and{' '}@@ -476,7 +461,8 @@ export const PricingPlans = ({style={{textDecorationLine: 'underline'}}- color={colors.accent}>+ color={colors.accent}+ >Privacy Policy.</Paragraph></Paragraph>diff --git a/apps/mobile/src/components/Premium/protag.js b/apps/mobile/src/components/Premium/protag.jsindex a34f67bce..259c75377 100644--- a/apps/mobile/src/components/Premium/protag.js+++ b/apps/mobile/src/components/Premium/protag.js@@ -1,10 +1,10 @@import React from 'react';-import {View} from 'react-native';+import { View } from 'react-native';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {useTracked} from '../../provider';+import { useTracked } from '../../provider';import Paragraph from '../Typography/Paragraph';-export const ProTag = ({width, size, background}) => {+export const ProTag = ({ width, size, background }) => {const [state] = useTracked();const colors = state.colors;@@ -13,12 +13,13 @@ export const ProTag = ({width, size, background}) => {style={{backgroundColor: background || colors.bg,borderRadius: 100,- width:width || 60,+ width: width || 60,justifyContent: 'center',alignItems: 'center',paddingVertical: 2.5,flexDirection: 'row'- }}>+ }}+ ><Iconstyle={{marginRight: 3diff --git a/apps/mobile/src/components/PressableButton/index.js b/apps/mobile/src/components/PressableButton/index.jsindex 887e6d544..2f0ec97a3 100644--- a/apps/mobile/src/components/PressableButton/index.js+++ b/apps/mobile/src/components/PressableButton/index.js@@ -32,25 +32,31 @@ export const PressableButton = ({customOpacity}) => {const [state] = useTracked();- const {colors} = state;-- const selectedColor = customSelectedColor ||+ const { colors } = state;++ const selectedColor =+ customSelectedColor ||colors[type === 'accent'? BUTTON_TYPES[type](accentColor, accentText).selected: BUTTON_TYPES[type].selected];- const primaryColor = customColor ||+ const primaryColor =+ customColor ||colors[type === 'accent'? BUTTON_TYPES[type](accentColor, accentText).primary: BUTTON_TYPES[type].primary];- const opacity = customOpacity ? customOpacity : type === 'accent' ? 1 : BUTTON_TYPES[type].opacity;- const alpha = customAlpha? customAlpha : colors.night ? 0.04 : -0.04;+ const opacity = customOpacity+ ? customOpacity+ : type === 'accent'+ ? 1+ : BUTTON_TYPES[type].opacity;+ const alpha = customAlpha ? customAlpha : colors.night ? 0.04 : -0.04;const getStyle = useCallback(- ({pressed}) => [+ ({ pressed }) => [{backgroundColor: pressed? RGB_Linear_Shade(alpha, hexToRGBA(selectedColor, opacity || 1))@@ -60,11 +66,11 @@ export const PressableButton = ({borderRadius: noborder ? 0 : br,justifyContent: 'center',alignItems: 'center',- marginBottom: 0,+ marginBottom: 0},- customStyle,+ customStyle],- [customStyle, noborder, type,colors],+ [customStyle, noborder, type, colors]);return (@@ -74,7 +80,8 @@ export const PressableButton = ({hitSlop={hitSlop}onPress={onPress}onLongPress={onLongPress}- style={getStyle}>+ style={getStyle}+ >{children}</Pressable>);diff --git a/apps/mobile/src/components/Properties/colortags.js b/apps/mobile/src/components/Properties/colortags.jsindex 7d4749a65..3e8d2ad15 100644--- a/apps/mobile/src/components/Properties/colortags.js+++ b/apps/mobile/src/components/Properties/colortags.js@@ -1,20 +1,20 @@-import React, {useState} from 'react';-import {View} from 'react-native';+import React, { useState } from 'react';+import { View } from 'react-native';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {notesnook} from '../../../e2e/test.ids';-import {useMenuStore, useSettingStore} from '../../provider/stores';-import {DDS} from '../../services/DeviceDetection';-import {eSendEvent} from '../../services/EventManager';+import { notesnook } from '../../../e2e/test.ids';+import { useMenuStore, useSettingStore } from '../../provider/stores';+import { DDS } from '../../services/DeviceDetection';+import { eSendEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';-import {dWidth} from '../../utils';-import {COLORS_NOTE} from '../../utils/Colors';-import {db} from '../../utils/database';-import {refreshNotesPage} from '../../utils/Events';+import { dWidth } from '../../utils';+import { COLORS_NOTE } from '../../utils/Colors';+import { db } from '../../utils/database';+import { refreshNotesPage } from '../../utils/Events';import layoutmanager from '../../utils/layout-manager';-import {SIZE} from '../../utils/SizeUtils';-import {PressableButton} from '../PressableButton';+import { SIZE } from '../../utils/SizeUtils';+import { PressableButton } from '../PressableButton';-export const ColorTags = ({item, close}) => {+export const ColorTags = ({ item, close }) => {const [note, setNote] = useState(item);const setColorNotes = useMenuStore(state => state.setColorNotes);const dimensions = useSettingStore(state => state.dimensions);@@ -27,7 +27,7 @@ export const ColorTags = ({item, close}) => {await db.notes.note(note.id).color(color.name);}let _note = db.notes.note(note.id).data;- setNote({..._note});+ setNote({ ..._note });setColorNotes();Navigation.setRoutesToUpdate([Navigation.routeNames.NotesPage,@@ -56,7 +56,8 @@ export const ColorTags = ({item, close}) => {borderRadius: 100,justifyContent: 'center',alignItems: 'center'- }}>+ }}+ >{note.color?.toLowerCase() === color.name ? (<Icon name="check" color="white" size={SIZE.lg} />) : null}@@ -75,7 +76,8 @@ export const ColorTags = ({item, close}) => {marginTop: 20,alignItems: 'center',justifyContent: 'space-between'- }}>+ }}+ >{Object.keys(COLORS_NOTE).map(_renderColor)}</View>);diff --git a/apps/mobile/src/components/Properties/datemeta.js b/apps/mobile/src/components/Properties/datemeta.jsindex b0ddbf278..f3650e94d 100644--- a/apps/mobile/src/components/Properties/datemeta.js+++ b/apps/mobile/src/components/Properties/datemeta.js@@ -1,13 +1,13 @@import React from 'react';-import {View} from 'react-native';-import {useTracked} from '../../provider';-import {SIZE} from '../../utils/SizeUtils';+import { View } from 'react-native';+import { useTracked } from '../../provider';+import { SIZE } from '../../utils/SizeUtils';import { timeConverter } from '../../utils/TimeUtils';import Paragraph from '../Typography/Paragraph';-export const DateMeta = ({item}) => {+export const DateMeta = ({ item }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const getNameFromKey = key => {switch (key) {@@ -30,7 +30,8 @@ export const DateMeta = ({item}) => {flexDirection: 'row',justifyContent: 'space-between',paddingVertical: 3- }}>+ }}+ ><Paragraph size={SIZE.xs} color={colors.icon}>{getNameFromKey(key)}</Paragraph>@@ -48,7 +49,8 @@ export const DateMeta = ({item}) => {borderTopWidth: 1,borderTopColor: colors.nav,paddingHorizontal: 12- }}>+ }}+ >{Object.keys(item).map(renderItem)}</View>);diff --git a/apps/mobile/src/components/Properties/devmode.js b/apps/mobile/src/components/Properties/devmode.jsindex 5b8acbf36..121b6d57a 100644--- a/apps/mobile/src/components/Properties/devmode.js+++ b/apps/mobile/src/components/Properties/devmode.js@@ -7,7 +7,7 @@ import { db } from '../../utils/database';import { SIZE } from '../../utils/SizeUtils';import { Button } from '../Button';-export const DevMode = ({item}) => {+export const DevMode = ({ item }) => {const settings = useSettingStore(state => state.settings);return settings.devMode ? (@@ -16,7 +16,8 @@ export const DevMode = ({item}) => {width: '100%',paddingHorizontal: 12,marginTop: 10- }}>+ }}+ ><ButtononPress={async () => {let additionalData = {};@@ -28,7 +29,7 @@ export const DevMode = ({item}) => {}}additionalData.lastSynced = await db.lastSynced();- let _note = {...item};+ let _note = { ...item };_note.additionalData = additionalData;Clipboard.setString(db.debug.strip(_note));diff --git a/apps/mobile/src/components/Properties/index.js b/apps/mobile/src/components/Properties/index.jsindex 55867ab65..e5cb61290 100644--- a/apps/mobile/src/components/Properties/index.js+++ b/apps/mobile/src/components/Properties/index.js@@ -1,24 +1,24 @@import React from 'react';-import {ScrollView, View} from 'react-native';-import {useTracked} from '../../provider';-import {DDS} from '../../services/DeviceDetection';-import {presentSheet} from '../../services/EventManager';-import {db} from '../../utils/database';-import {SIZE} from '../../utils/SizeUtils';+import { Platform, ScrollView, View } from 'react-native';+import { useTracked } from '../../provider';+import { DDS } from '../../services/DeviceDetection';+import { presentSheet } from '../../services/EventManager';+import { db } from '../../utils/database';+import { SIZE } from '../../utils/SizeUtils';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';-import {ColorTags} from './color-tags';-import {DateMeta} from './date-meta';-import {DevMode} from './dev-mode';-import {Items} from './items';+import { ColorTags } from './color-tags';+import { DateMeta } from './date-meta';+import { DevMode } from './dev-mode';+import { Items } from './items';import Notebooks from './notebooks';-import {Synced} from './synced';-import {Tags} from './tags';-import {Topics} from './topics';+import { Synced } from './synced';+import { Tags } from './tags';+import { Topics } from './topics';-export const Properties = ({close = () => {}, item, buttons = [], getRef}) => {+export const Properties = ({ close = () => {}, item, buttons = [], getRef }) => {const [state, dispatch] = useTracked();- const {colors} = state;+ const { colors } = state;const alias = item? item.type === 'tag'@@ -43,9 +43,10 @@ export const Properties = ({close = () => {}, item, buttons = [], getRef}) => {paddingHorizontal: 0,borderBottomRightRadius: DDS.isLargeTablet() ? 10 : 1,borderBottomLeftRadius: DDS.isLargeTablet() ? 10 : 1- }}>+ }}+ >{!item || !item.id ? (- <Paragraph style={{marginVertical: 10, alignSelf: 'center'}}>+ <Paragraph style={{ marginVertical: 10, alignSelf: 'center' }}>Start writing to save your note.</Paragraph>) : (@@ -53,11 +54,13 @@ export const Properties = ({close = () => {}, item, buttons = [], getRef}) => {style={{marginTop: 5,zIndex: 10- }}>+ }}+ ><Viewstyle={{paddingHorizontal: 12- }}>+ }}+ ><Heading size={SIZE.lg}>{item.type === 'tag' ? '#' : null}{alias}@@ -65,12 +68,10 @@ export const Properties = ({close = () => {}, item, buttons = [], getRef}) => {{item.headline || item.description ? (<Paragraph numberOfLines={2} color={colors.icon}>- {(item.type === 'notebook' || item.itemType === 'notebook') &&- item?.description+ {(item.type === 'notebook' || item.itemType === 'notebook') && item?.description? item.description: null}- {(item.type === 'note' || item.itemType === 'note') &&- item?.headline+ {(item.type === 'note' || item.itemType === 'note') && item?.headline? item.headline: null}</Paragraph>@@ -81,9 +82,7 @@ export const Properties = ({close = () => {}, item, buttons = [], getRef}) => {<Topics item={item} close={close} /></View>- {item.type === 'note' ? (- <Notebooks note={item} close={close} />- ) : null}+ {item.type === 'note' ? <Notebooks note={item} close={close} /> : null}<DateMeta item={item} /></View>@@ -117,13 +116,13 @@ Properties.present = (item, buttons = []) => {if (!item) return;let type = item?.type;let props = [item];-+ let android = [];switch (type) {case 'trash':props.push(['PermDelete', 'Restore']);break;case 'note':- let android = Platform.OS === 'android' ? ['PinToNotif'] : [];+ android = Platform.OS === 'android' ? ['PinToNotif'] : [];props.push(['Add to notebook','Share',diff --git a/apps/mobile/src/components/Properties/items.js b/apps/mobile/src/components/Properties/items.jsindex 873520b5d..5d52c62c2 100644--- a/apps/mobile/src/components/Properties/items.js+++ b/apps/mobile/src/components/Properties/items.js@@ -1,21 +1,21 @@import React from 'react';-import {View} from 'react-native';-import {FlatList} from 'react-native-gesture-handler';+import { View } from 'react-native';+import { FlatList } from 'react-native-gesture-handler';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {useTracked} from '../../provider';-import {useSettingStore} from '../../provider/stores';-import {DDS} from '../../services/DeviceDetection';-import {SIZE} from '../../utils/SizeUtils';-import {Button} from '../Button';-import {PressableButton} from '../PressableButton';+import { useTracked } from '../../provider';+import { useSettingStore } from '../../provider/stores';+import { DDS } from '../../services/DeviceDetection';+import { SIZE } from '../../utils/SizeUtils';+import { Button } from '../Button';+import { PressableButton } from '../PressableButton';import Paragraph from '../Typography/Paragraph';-import {useActions} from './use-actions';+import { useActions } from './use-actions';-export const Items = ({item, buttons, close}) => {+export const Items = ({ item, buttons, close }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const dimensions = useSettingStore(state => state.dimensions);- const actions = useActions({item, close});+ const actions = useActions({ item, close });const data = actions.filter(i => buttons.indexOf(i.name) > -1 && !i.hidden);let width = dimensions.width > 600 ? 600 : dimensions.width;@@ -24,7 +24,7 @@ export const Items = ({item, buttons, close}) => {? (width - 24) / columnItemsCount: (width - 24) / columnItemsCount;- const _renderRowItem = ({item, index}) => (+ const _renderRowItem = ({ item, index }) => (<ViewonPress={item.func}key={item.name}@@ -33,7 +33,8 @@ export const Items = ({item, buttons, close}) => {alignItems: 'center',width: columnItemWidth,marginBottom: 10- }}>+ }}+ ><PressableButtononPress={item.func}type={item.on ? 'shade' : 'grayBg'}@@ -46,7 +47,8 @@ export const Items = ({item, buttons, close}) => {textAlign: 'center',textAlignVertical: 'center',marginBottom: DDS.isTab ? 7 : 3.5- }}>+ }}+ ><Iconname={item.icon}size={DDS.isTab ? SIZE.xxl : SIZE.lg}@@ -60,13 +62,13 @@ export const Items = ({item, buttons, close}) => {/></PressableButton>- <Paragraph size={SIZE.xs + 1} style={{textAlign: 'center'}}>+ <Paragraph size={SIZE.xs + 1} style={{ textAlign: 'center' }}>{item.title}</Paragraph></View>);- const renderColumnItem = ({item, index}) => (+ const renderColumnItem = ({ item, index }) => (<ButtonbuttonType={{text: item.on@@ -109,10 +111,6 @@ export const Items = ({item, buttons, close}) => {renderItem={_renderRowItem}/>) : (- <FlatList- data={data}- keyExtractor={item => item.title}- renderItem={renderColumnItem}- />+ <FlatList data={data} keyExtractor={item => item.title} renderItem={renderColumnItem} />);};diff --git a/apps/mobile/src/components/Properties/notebooks.js b/apps/mobile/src/components/Properties/notebooks.jsindex 905503085..54615deef 100644--- a/apps/mobile/src/components/Properties/notebooks.js+++ b/apps/mobile/src/components/Properties/notebooks.js@@ -1,19 +1,19 @@import React from 'react';-import {ScrollView, View} from 'react-native';+import { ScrollView, View } from 'react-native';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {useTracked} from '../../provider';-import {eSendEvent} from '../../services/EventManager';+import { useTracked } from '../../provider';+import { eSendEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';-import {db} from '../../utils/database';-import {eOnNewTopicAdded, refreshNotesPage} from '../../utils/Events';-import {SIZE} from '../../utils/SizeUtils';-import {Button} from '../Button';-import {PressableButton} from '../PressableButton';+import { db } from '../../utils/database';+import { eOnNewTopicAdded, refreshNotesPage } from '../../utils/Events';+import { SIZE } from '../../utils/SizeUtils';+import { Button } from '../Button';+import { PressableButton } from '../PressableButton';import Heading from '../Typography/Heading';-export default function Notebooks({note, close}) {- const [state, dispatch] = useTracked();- const {colors} = state;+export default function Notebooks({ note, close }) {+ const [state] = useTracked();+ const { colors } = state;function getNotebooks(item) {if (!item.notebooks || item.notebooks.length < 1) return [];@@ -63,7 +63,7 @@ export default function Notebooks({note, close}) {let routeName = 'NotesPage';let item = db.notebooks.notebook(notebookId).topics.topic(id)._topic;- let params = {...item, menu: false};+ let params = { ...item, menu: false };let headerState = {heading: item.title,id: item.id,@@ -79,9 +79,11 @@ export default function Notebooks({note, close}) {width: '100%',borderTopWidth: 1,borderTopColor: colors.nav- }}>+ }}+ >{getNotebooks(note).map(item => (<PressableButton+ key={item.id}onPress={() => {navigateNotebook(item.id);close();@@ -95,7 +97,8 @@ export default function Notebooks({note, close}) {flexGrow: 1,marginTop: 5,paddingVertical: 6- }}>+ }}+ ><Iconname="book-outline"color={colors.accent}@@ -109,7 +112,8 @@ export default function Notebooks({note, close}) {style={{maxWidth: '50%'}}- size={SIZE.sm}>+ size={SIZE.sm}+ >{item.title}</Heading>@@ -122,9 +126,11 @@ export default function Notebooks({note, close}) {borderLeftColor: colors.nav,borderLeftWidth: 1,paddingLeft: 8- }}>+ }}+ >{item.topics.map(topic => (<Button+ key={topic.id}onPress={() => {navigateTopic(topic.id, item.id);close();@@ -141,7 +147,7 @@ export default function Notebooks({note, close}) {}}/>))}- <View style={{width: 10}} />+ <View style={{ width: 10 }} /></ScrollView></PressableButton>))}diff --git a/apps/mobile/src/components/Properties/synced.js b/apps/mobile/src/components/Properties/synced.jsindex 1b29afb52..af51995e3 100644--- a/apps/mobile/src/components/Properties/synced.js+++ b/apps/mobile/src/components/Properties/synced.js@@ -1,18 +1,18 @@import React from 'react';-import {View} from 'react-native';+import { View } from 'react-native';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {useTracked} from '../../provider';-import {useUserStore} from '../../provider/stores';-import {openLinkInBrowser} from '../../utils/functions';-import {SIZE} from '../../utils/SizeUtils';-import {sleep} from '../../utils/TimeUtils';-import {Button} from '../Button';+import { useTracked } from '../../provider';+import { useUserStore } from '../../provider/stores';+import { openLinkInBrowser } from '../../utils/functions';+import { SIZE } from '../../utils/SizeUtils';+import { sleep } from '../../utils/TimeUtils';+import { Button } from '../Button';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';-export const Synced = ({item, close}) => {+export const Synced = ({ item, close }) => {const [state, dispatch] = useTracked();- const {colors} = state;+ const { colors } = state;const user = useUserStore(state => state.user);const lastSynced = useUserStore(state => state.lastSynced);@@ -30,7 +30,8 @@ export const Synced = ({item, close}) => {marginTop: 10,borderTopWidth: 1,borderTopColor: colors.nav- }}>+ }}+ ><Icon name="shield-key-outline" color={colors.accent} size={SIZE.xxxl} /><View@@ -38,13 +39,15 @@ export const Synced = ({item, close}) => {flex: 1,marginLeft: 5,flexShrink: 1- }}>+ }}+ ><Headingcolor={colors.heading}size={SIZE.xs}style={{flexWrap: 'wrap'- }}>+ }}+ >Encrypted and synced</Heading><Paragraph@@ -52,7 +55,8 @@ export const Synced = ({item, close}) => {flexWrap: 'wrap'}}size={SIZE.xs}- color={colors.pri}>+ color={colors.pri}+ >No one can view this {item.itemType || item.type} except you.</Paragraph></View>@@ -62,10 +66,7 @@ export const Synced = ({item, close}) => {try {close();await sleep(300);- await openLinkInBrowser(- 'https://docs.notesnook.com/how-is-my-data-encrypted/',- colors- );+ await openLinkInBrowser('https://docs.notesnook.com/how-is-my-data-encrypted/', colors);} catch (e) {}}}fontSize={SIZE.xs + 1}diff --git a/apps/mobile/src/components/Properties/tags.js b/apps/mobile/src/components/Properties/tags.jsindex 080c3897a..4f6a941a8 100644--- a/apps/mobile/src/components/Properties/tags.js+++ b/apps/mobile/src/components/Properties/tags.js@@ -1,30 +1,32 @@-import React, {useState} from 'react';-import {View} from 'react-native';-import {useTracked} from '../../provider';-import {eSendEvent} from '../../services/EventManager';+import React, { useState } from 'react';+import { View } from 'react-native';+import { useTracked } from '../../provider';+import { eSendEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';-import {db} from '../../utils/database';-import {eOpenTagsDialog, refreshNotesPage} from '../../utils/Events';-import {SIZE} from '../../utils/SizeUtils';-import {sleep} from '../../utils/TimeUtils';-import {Button} from '../Button';+import { db } from '../../utils/database';+import { eOpenTagsDialog, refreshNotesPage } from '../../utils/Events';+import { SIZE } from '../../utils/SizeUtils';+import { sleep } from '../../utils/TimeUtils';+import { Button } from '../Button';-export const Tags = ({item, close}) => {+export const Tags = ({ item, close }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;return item.id ? (<Viewstyle={{marginTop: 5,marginBottom: 5- }}>+ }}+ ><Viewstyle={{flexDirection: 'row',flexWrap: 'wrap',alignItems: 'center'- }}>+ }}+ ><ButtononPress={async () => {close();@@ -41,8 +43,7 @@ export const Tags = ({item, close}) => {height={25}fontSize={SIZE.xs + 1}style={{- marginRight:5,- paddingHorizontal: 0,+ marginRight: 5,borderRadius: 100,paddingHorizontal: 8}}@@ -55,7 +56,7 @@ export const Tags = ({item, close}) => {) : null;};-const TagItem = ({tag, close}) => {+const TagItem = ({ tag, close }) => {const onPress = async () => {let tags = db.tags.all;let _tag = tags.find(t => t.title === tag);@@ -76,7 +77,6 @@ const TagItem = ({tag, close}) => {};const style = {- paddingHorizontal: 0,paddingHorizontal: 8,marginVertical: 5,borderRadius: 100,diff --git a/apps/mobile/src/components/Properties/topics.js b/apps/mobile/src/components/Properties/topics.jsindex 5715c3a5b..ce0b5f9a8 100644--- a/apps/mobile/src/components/Properties/topics.js+++ b/apps/mobile/src/components/Properties/topics.js@@ -1,21 +1,17 @@import React from 'react';-import {View} from 'react-native';-import {useTracked} from '../../provider';-import {eSendEvent} from '../../services/EventManager';+import { View } from 'react-native';+import { eSendEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';-import {refreshNotesPage} from '../../utils/Events';-import {SIZE} from '../../utils/SizeUtils';-import {Button} from '../Button';+import { refreshNotesPage } from '../../utils/Events';+import { SIZE } from '../../utils/SizeUtils';+import { Button } from '../Button';-export const Topics = ({item, close}) => {- const [state] = useTracked();- const {colors} = state;-- const open = (topic) => {+export const Topics = ({ item, close }) => {+ const open = topic => {close();let routeName = 'NotesPage';- let params = {...topic, menu: false, get: 'topics'};+ let params = { ...topic, menu: false, get: 'topics' };let headerState = {heading: topic.title,id: topic.id,@@ -39,7 +35,6 @@ export const Topics = ({item, close}) => {fontSize={SIZE.xs + 1}style={{marginRight: 5,- paddingHorizontal: 0,paddingHorizontal: 8,borderRadius: 100,marginVertical: 5@@ -47,17 +42,15 @@ export const Topics = ({item, close}) => {/>);- return item &&- item.type === 'notebook' &&- item.topics &&- item.topics.length > 0 ? (+ return item && item.type === 'notebook' && item.topics && item.topics.length > 0 ? (<Viewstyle={{flexDirection: 'row',marginTop: 5,width: '100%',flexWrap: 'wrap'- }}>+ }}+ >{item.topics.sort((a, b) => a.dateEdited - b.dateEdited).slice(0, 6)diff --git a/apps/mobile/src/components/Properties/useActions.js b/apps/mobile/src/components/Properties/useActions.jsindex 406e2bfaf..a2b1b8eea 100644--- a/apps/mobile/src/components/Properties/useActions.js+++ b/apps/mobile/src/components/Properties/useActions.js@@ -1,16 +1,11 @@import Clipboard from '@react-native-clipboard/clipboard';-import React, {useEffect, useState} from 'react';-import {Platform} from 'react-native';+import React, { useEffect, useState } from 'react';+import { Platform } from 'react-native';import Share from 'react-native-share';-import {notesnook} from '../../../e2e/test.ids';-import {useTracked} from '../../provider';-import {Actions} from '../../provider/Actions';-import {- useMenuStore,- useSelectionStore,- useTagStore,- useUserStore-} from '../../provider/stores';+import { notesnook } from '../../../e2e/test.ids';+import { useTracked } from '../../provider';+import { Actions } from '../../provider/Actions';+import { useMenuStore, useSelectionStore, useTagStore, useUserStore } from '../../provider/stores';import {eSendEvent,eSubscribeEvent,@@ -22,7 +17,7 @@ import {import Navigation from '../../services/Navigation';import Notifications from '../../services/Notifications';import SettingsService from '../../services/SettingsService';-import {editing, toTXT} from '../../utils';+import { editing, toTXT } from '../../utils';import {ACCENT,COLOR_SCHEME,@@ -31,7 +26,7 @@ import {COLOR_SCHEME_PITCH_BLACK,setColorScheme} from '../../utils/Colors';-import {db} from '../../utils/database';+import { db } from '../../utils/database';import {eOpenAddNotebookDialog,eOpenAddTopicDialog,@@ -41,21 +36,19 @@ import {eOpenMoveNoteDialog,eOpenPublishNoteDialog} from '../../utils/Events';-import {deleteItems} from '../../utils/functions';-import {MMKV} from '../../utils/mmkv';-import {sleep} from '../../utils/TimeUtils';-import {presentDialog} from '../Dialog/functions';+import { deleteItems } from '../../utils/functions';+import { MMKV } from '../../utils/mmkv';+import { sleep } from '../../utils/TimeUtils';+import { presentDialog } from '../Dialog/functions';import NoteHistory from '../NoteHistory';-export const useActions = ({close = () => {}, item}) => {+export const useActions = ({ close = () => {}, item }) => {const [state, dispatch] = useTracked();- const {colors} = state;+ const { colors } = state;const clearSelection = useSelectionStore(state => state.clearSelection);const setSelectedItem = useSelectionStore(state => state.setSelectedItem);const setMenuPins = useMenuStore(state => state.setMenuPins);- const [isPinnedToMenu, setIsPinnedToMenu] = useState(- db.settings.isPinned(item.id)- );+ const [isPinnedToMenu, setIsPinnedToMenu] = useState(db.settings.isPinned(item.id));const user = useUserStore(state => state.user);const [notifPinned, setNotifPinned] = useState(null);@@ -66,8 +59,7 @@ export const useActions = ({close = () => {}, item}) => {? db.colors.alias(item.id): item.title;- const isPublished =- item.type === 'note' && db.monographs.isPublished(item.id);+ const isPublished = item.type === 'note' && db.monographs.isPublished(item.id);const noteInTopic =item.type === 'note' &&editing.actionAfterFirstSave.type === 'topic' &&@@ -117,19 +109,19 @@ export const useActions = ({close = () => {}, item}) => {function changeColorScheme(colors = COLOR_SCHEME, accent = ACCENT) {let newColors = setColorScheme(colors, accent);- dispatch({type: Actions.THEME, colors: newColors});+ dispatch({ type: Actions.THEME, colors: newColors });}function switchTheme() {if (!colors.night) {- MMKV.setStringAsync('theme', JSON.stringify({night: true}));+ MMKV.setStringAsync('theme', JSON.stringify({ night: true }));let nextTheme = SettingsService.get().pitchBlack? COLOR_SCHEME_PITCH_BLACK: COLOR_SCHEME_DARK;changeColorScheme(nextTheme);return;}- MMKV.setStringAsync('theme', JSON.stringify({night: false}));+ MMKV.setStringAsync('theme', JSON.stringify({ night: false }));changeColorScheme(COLOR_SCHEME_LIGHT);}@@ -165,10 +157,7 @@ export const useActions = ({close = () => {}, item}) => {return;}await db[`${type}s`][type](item.id).pin();- Navigation.setRoutesToUpdate([- Navigation.routeNames.Notebooks,- Navigation.routeNames.Notes- ]);+ Navigation.setRoutesToUpdate([Navigation.routeNames.Notebooks, Navigation.routeNames.Notes]);}async function pinToNotifications() {@@ -206,12 +195,9 @@ export const useActions = ({close = () => {}, item}) => {Navigation.routeNames.Favorites,Navigation.routeNames.Trash]);- type = item.type === 'trash' ? item.itemType : item.type;+ let type = item.type === 'trash' ? item.itemType : item.type;ToastEvent.show({- heading:- type === 'note'- ? 'Note restored from trash'- : 'Notebook restored from trash',+ heading: type === 'note' ? 'Note restored from trash' : 'Notebook restored from trash',type: 'success'});}@@ -337,7 +323,7 @@ export const useActions = ({close = () => {}, item}) => {notebookId: item.notebookId});} else {- await db.settings.pin(item.type, {id: item.id});+ await db.settings.pin(item.type, { id: item.id });}}setIsPinnedToMenu(db.settings.isPinned(item.id));@@ -526,10 +512,7 @@ export const useActions = ({close = () => {}, item}) => {},{name: 'PinToNotif',- title:- notifPinned !== null- ? 'Unpin from Notifications'- : 'Pin to Notifications',+ title: notifPinned !== null ? 'Unpin from Notifications' : 'Pin to Notifications',icon: 'bell',on: notifPinned !== null,func: pinToNotifications@@ -631,9 +614,7 @@ export const useActions = ({close = () => {}, item}) => {{name: 'Delete',title:- item.type !== 'notebook' && item.type !== 'note'- ? 'Delete ' + item.type- : 'Move to trash',+ item.type !== 'notebook' && item.type !== 'note' ? 'Delete ' + item.type : 'Move to trash',icon: 'delete-outline',type: 'error',func: deleteItemdiff --git a/apps/mobile/src/components/PublishNoteDialog/index.js b/apps/mobile/src/components/PublishNoteDialog/index.jsindex 1925cd34a..3e95207d6 100644--- a/apps/mobile/src/components/PublishNoteDialog/index.js+++ b/apps/mobile/src/components/PublishNoteDialog/index.js@@ -1,31 +1,24 @@-import React, {useEffect, useRef, useState} from 'react';-import {ActivityIndicator, TouchableOpacity, View} from 'react-native';+import React, { useEffect, useRef, useState } from 'react';+import { ActivityIndicator, TouchableOpacity, View } from 'react-native';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';import Clipboard from '@react-native-clipboard/clipboard';-import {useTracked} from '../../provider';-import {- eSubscribeEvent,- eUnSubscribeEvent,- ToastEvent-} from '../../services/EventManager';+import { useTracked } from '../../provider';+import { eSubscribeEvent, eUnSubscribeEvent, ToastEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';-import {db} from '../../utils/database';-import {- eClosePublishNoteDialog,- eOpenPublishNoteDialog-} from '../../utils/Events';-import {openLinkInBrowser} from '../../utils/functions';-import {SIZE} from '../../utils/SizeUtils';-import {ActionIcon} from '../ActionIcon';+import { db } from '../../utils/database';+import { eClosePublishNoteDialog, eOpenPublishNoteDialog } from '../../utils/Events';+import { openLinkInBrowser } from '../../utils/functions';+import { SIZE } from '../../utils/SizeUtils';+import { ActionIcon } from '../ActionIcon';import SheetWrapper from '../Sheet';-import {Button} from '../Button';+import { Button } from '../Button';import DialogHeader from '../Dialog/dialog-header';import Input from '../Input';import Seperator from '../Seperator';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';-import {useAttachmentStore} from '../../provider/stores';-import {editing} from '../../utils';+import { useAttachmentStore } from '../../provider/stores';+import { editing } from '../../utils';let passwordValue = null;const PublishNoteDialog = () => {@@ -39,8 +32,7 @@ const PublishNoteDialog = () => {const [note, setNote] = useState(null);const [publishing, setPublishing] = useState(false);const publishUrl =- note &&- `https://monograph.notesnook.com/${db?.monographs.monograph(note?.id)}`;+ note && `https://monograph.notesnook.com/${db?.monographs.monograph(note?.id)}`;const isPublished = note && db?.monographs.isPublished(note?.id);const pwdInput = useRef();@@ -137,13 +129,15 @@ const PublishNoteDialog = () => {onClose={async () => {passwordValue = null;setVisible(false);- }}>+ }}+ ><Viewstyle={{width: '100%',alignSelf: 'center',paddingHorizontal: 12- }}>+ }}+ ><DialogHeadertitle={note.title}paragraph={`Anyone with the link${@@ -158,17 +152,16 @@ const PublishNoteDialog = () => {alignContent: 'center',height: 150,width: '100%'- }}>+ }}+ ><ActivityIndicator size={25} color={colors.accent} /><Paragraphstyle={{textAlign: 'center'- }}>+ }}+ >Please wait...- {loading &&- `\nDownloading attachments (${- loading?.current / loading?.total- })`}+ {loading && `\nDownloading attachments (${loading?.current / loading?.total})`}</Paragraph></View>) : (@@ -182,12 +175,14 @@ const PublishNoteDialog = () => {backgroundColor: colors.nav,padding: 12,borderRadius: 5- }}>+ }}+ ><Viewstyle={{width: '100%',flexShrink: 1- }}>+ }}+ ><Heading size={SIZE.sm}>Published at:</Heading><Paragraph size={SIZE.xs} numberOfLines={1}>{publishUrl}@@ -202,9 +197,9 @@ const PublishNoteDialog = () => {style={{marginTop: 5,color: colors.pri- }}>- <Icon color={colors.accent} name="open-in-new" /> Open in- browser+ }}+ >+ <Icon color={colors.accent} name="open-in-new" /> Open in browser</Paragraph></View>@@ -235,7 +230,8 @@ const PublishNoteDialog = () => {flexDirection: 'row',alignItems: 'center',marginBottom: 10- }}>+ }}+ ><ActionIcononPress={() => {if (publishing) return;@@ -243,22 +239,18 @@ const PublishNoteDialog = () => {}}color={isLocked ? colors.accent : colors.icon}size={SIZE.lg}- name={- isLocked- ? 'check-circle-outline'- : 'checkbox-blank-circle-outline'- }+ name={isLocked ? 'check-circle-outline' : 'checkbox-blank-circle-outline'}/><Viewstyle={{width: '100%',flexShrink: 1- }}>+ }}+ ><Heading size={SIZE.md}>Password protection</Heading><Paragraph>- Published note can only be viewed by someone with the- password.+ Published note can only be viewed by someone with the password.</Paragraph></View></TouchableOpacity>@@ -271,29 +263,26 @@ const PublishNoteDialog = () => {style={{flexDirection: 'row',alignItems: 'center'- }}>+ }}+ ><ActionIcononPress={() => {setSelfDestruct(!selfDestruct);}}color={selfDestruct ? colors.accent : colors.icon}size={SIZE.lg}- name={- selfDestruct- ? 'check-circle-outline'- : 'checkbox-blank-circle-outline'- }+ name={selfDestruct ? 'check-circle-outline' : 'checkbox-blank-circle-outline'}/><Viewstyle={{width: '100%',flexShrink: 1- }}>+ }}+ ><Heading size={SIZE.md}>Self destruct</Heading><Paragraph>- Published note link will be automatically deleted once it is- viewed by someone.+ Published note link will be automatically deleted once it is viewed by someone.</Paragraph></View></TouchableOpacity>@@ -303,7 +292,8 @@ const PublishNoteDialog = () => {width: '100%',alignSelf: 'center',marginTop: 10- }}>+ }}+ >{isLocked ? (<><Input@@ -357,12 +347,10 @@ const PublishNoteDialog = () => {}}onPress={async () => {try {- await openLinkInBrowser(- 'https://docs.notesnook.com/monographs/',- colors.accent- );+ await openLinkInBrowser('https://docs.notesnook.com/monographs/', colors.accent);} catch (e) {}- }}>+ }}+ >Learn more about Notesnook Monograph</Paragraph></View>diff --git a/apps/mobile/src/components/RateDialog/index.js b/apps/mobile/src/components/RateDialog/index.jsindex bbe8a9b74..9b5443a10 100644--- a/apps/mobile/src/components/RateDialog/index.js+++ b/apps/mobile/src/components/RateDialog/index.js@@ -1,16 +1,16 @@-import React, {useEffect, useRef, useState} from 'react';-import {Linking, Platform, View} from 'react-native';-import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';-import {eCloseRateDialog, eOpenRateDialog} from '../../utils/Events';-import {MMKV} from '../../utils/mmkv';-import {SIZE} from '../../utils/SizeUtils';+import React, { useEffect, useRef, useState } from 'react';+import { Linking, Platform, View } from 'react-native';+import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';+import { eCloseRateDialog, eOpenRateDialog } from '../../utils/Events';+import { MMKV } from '../../utils/mmkv';+import { SIZE } from '../../utils/SizeUtils';import SheetWrapper from '../Sheet';-import {Button} from '../Button';+import { Button } from '../Button';import Seperator from '../Seperator';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';-import {STORE_LINK} from '../../utils';-import {clearMessage} from '../../services/Message';+import { STORE_LINK } from '../../utils';+import { clearMessage } from '../../services/Message';const RateDialog = () => {const [visible, setVisible] = useState(false);@@ -51,17 +51,19 @@ const RateDialog = () => {);setVisible(false);clearMessage();- }}>+ }}+ ><Viewstyle={{width: '100%',alignSelf: 'center',paddingHorizontal: 12- }}>+ }}+ ><Heading>Do you enjoy using Notesnook?</Heading><Paragraph size={SIZE.md}>- It took us a year to bring Notesnook to life. Share your experience- and suggestions to help us improve it.+ It took us a year to bring Notesnook to life. Share your experience and suggestions to+ help us improve it.</Paragraph><Seperator half />@@ -86,7 +88,8 @@ const RateDialog = () => {paddingTop: 12,width: '100%',alignSelf: 'center'- }}>+ }}+ ><ButtononPress={async () => {await MMKV.setItem('askForRating', 'never');diff --git a/apps/mobile/src/components/RecoveryKeyDialog/index.js b/apps/mobile/src/components/RecoveryKeyDialog/index.jsindex f3f2dc598..0cd400473 100644--- a/apps/mobile/src/components/RecoveryKeyDialog/index.js+++ b/apps/mobile/src/components/RecoveryKeyDialog/index.js@@ -1,8 +1,8 @@-import React, {createRef} from 'react';-import {Platform, View} from 'react-native';+import React, { createRef } from 'react';+import { Platform, View } from 'react-native';import QRCode from 'react-native-qrcode-svg';import Share from 'react-native-share';-import {LOGO_BASE64} from '../../assets/images/assets';+import { LOGO_BASE64 } from '../../assets/images/assets';import Clipboard from '@react-native-clipboard/clipboard';import {eSendEvent,@@ -10,22 +10,22 @@ import {eUnSubscribeEvent,ToastEvent} from '../../services/EventManager';-import {db} from '../../utils/database';-import {eOpenRecoveryKeyDialog, eOpenResultDialog} from '../../utils/Events';-import {sanitizeFilename} from '../../utils/filename';-import {SIZE} from '../../utils/SizeUtils';+import { db } from '../../utils/database';+import { eOpenRecoveryKeyDialog, eOpenResultDialog } from '../../utils/Events';+import { sanitizeFilename } from '../../utils/filename';+import { SIZE } from '../../utils/SizeUtils';import Storage from '../../utils/storage';-import {sleep} from '../../utils/TimeUtils';+import { sleep } from '../../utils/TimeUtils';import SheetWrapper from '../Sheet';-import {Button} from '../Button';+import { Button } from '../Button';import DialogHeader from '../Dialog/dialog-header';import Seperator from '../Seperator';import Paragraph from '../Typography/Paragraph';import FileViewer from 'react-native-file-viewer';import * as ScopedStorage from 'react-native-scoped-storage';-import {MMKV} from '../../utils/mmkv';-import {clearMessage} from '../../services/Message';+import { MMKV } from '../../utils/mmkv';+import { clearMessage } from '../../services/Message';let RNFetchBlob;@@ -98,24 +98,18 @@ class RecoveryKeyDialog extends React.Component {let path;RNFetchBlob = require('rn-fetch-blob').default;let fileName = 'nn_' + this.user.email + '_recovery_key_qrcode';- fileName = sanitizeFilename(fileName, {replacement: '_'});+ fileName = sanitizeFilename(fileName, { replacement: '_' });fileName = fileName + '.png';if (Platform.OS === 'android') {- await ScopedStorage.createDocument(- fileName,- 'image/png',- data,- 'base64'- );+ await ScopedStorage.createDocument(fileName, 'image/png', data, 'base64');} else {path = await Storage.checkAndCreateDir('/');await RNFetchBlob.fs.writeFile(path + fileName, data, 'base64');}ToastEvent.show({heading: 'Recovery key QR-Code saved',- message:- 'QR-Code image has been saved to Gallery at ' + path + fileName,+ message: 'QR-Code image has been saved to Gallery at ' + path + fileName,type: 'success',context: 'local'});@@ -127,7 +121,7 @@ class RecoveryKeyDialog extends React.Component {try {let path;let fileName = 'nn_' + this.user?.email + '_recovery_key';- fileName = sanitizeFilename(fileName, {replacement: '_'});+ fileName = sanitizeFilename(fileName, { replacement: '_' });fileName = fileName + '.txt';RNFetchBlob = require('rn-fetch-blob').default;@@ -174,7 +168,7 @@ class RecoveryKeyDialog extends React.Component {try {if (Platform.OS === 'ios') {Share.open({- url: 'file:/' + result.filePath,+ url: 'file:/' + path,failOnCancel: false}).catch(console.log);} else {@@ -188,14 +182,15 @@ class RecoveryKeyDialog extends React.Component {};render() {- const {colors} = this.props;+ const { colors } = this.props;if (!this.state.visible) return null;return (<SheetWrappercloseOnTouchBackdrop={false}gestureEnabled={false}onOpen={this.onOpen}- fwdRef={this.actionSheetRef}>+ fwdRef={this.actionSheetRef}+ ><Viewstyle={{width: '100%',@@ -204,7 +199,8 @@ class RecoveryKeyDialog extends React.Component {paddingHorizontal: 12,borderRadius: 10,paddingTop: 10- }}>+ }}+ ><DialogHeadertitle="Save account recovery key"paragraph="If you forget your password, you can recover your@@ -216,7 +212,8 @@ class RecoveryKeyDialog extends React.Component {borderRadius: 5,padding: 12,marginTop: 10- }}>+ }}+ ><Paragraphcolor={colors.pri}size={SIZE.sm}@@ -228,7 +225,8 @@ class RecoveryKeyDialog extends React.Component {paddingRight: 10,textAlign: 'center',textDecorationLine: 'underline'- }}>+ }}+ >{this.state.key}</Paragraph></View>@@ -244,13 +242,14 @@ class RecoveryKeyDialog extends React.Component {position: 'absolute',opacity: 0,zIndex: -1- }}>+ }}+ >{this.state.key ? (<QRCodegetRef={this.svg}size={500}value={this.state.key}- logo={{uri: LOGO_BASE64}}+ logo={{ uri: LOGO_BASE64 }}logoBorderRadius={10}/>) : null}@@ -314,7 +313,8 @@ class RecoveryKeyDialog extends React.Component {maxWidth: '100%',marginBottom: 5,textAlign: 'center'- }}>+ }}+ >Tap twice to confirm you have saved the recovery key.</Paragraph><Buttondiff --git a/apps/mobile/src/components/RestoreDialog/index.js b/apps/mobile/src/components/RestoreDialog/index.jsindex 5af195dcd..69a1f263f 100644--- a/apps/mobile/src/components/RestoreDialog/index.js+++ b/apps/mobile/src/components/RestoreDialog/index.js@@ -1,30 +1,26 @@-import React, {createRef, useEffect, useState} from 'react';-import {ActivityIndicator, Platform, View} from 'react-native';+import React, { createRef, useEffect, useState } from 'react';+import { ActivityIndicator, Platform, View } from 'react-native';import DocumentPicker from 'react-native-document-picker';-import {FlatList} from 'react-native-gesture-handler';-import {useTracked} from '../../provider';-import {initialize} from '../../provider/stores';-import {- eSubscribeEvent,- eUnSubscribeEvent,- ToastEvent-} from '../../services/EventManager';-import {db} from '../../utils/database';-import {eCloseRestoreDialog, eOpenRestoreDialog} from '../../utils/Events';-import {MMKV} from '../../utils/mmkv';-import {SIZE} from '../../utils/SizeUtils';+import { FlatList } from 'react-native-gesture-handler';+import { useTracked } from '../../provider';+import { initialize } from '../../provider/stores';+import { eSubscribeEvent, eUnSubscribeEvent, ToastEvent } from '../../services/EventManager';+import { db } from '../../utils/database';+import { eCloseRestoreDialog, eOpenRestoreDialog } from '../../utils/Events';+import { MMKV } from '../../utils/mmkv';+import { SIZE } from '../../utils/SizeUtils';import storage from '../../utils/storage';-import {sleep, timeConverter} from '../../utils/TimeUtils';+import { sleep, timeConverter } from '../../utils/TimeUtils';import SheetWrapper from '../Sheet';-import {Button} from '../Button';+import { Button } from '../Button';import DialogHeader from '../Dialog/dialog-header';import Seperator from '../Seperator';import Paragraph from '../Typography/Paragraph';import * as ScopedStorage from 'react-native-scoped-storage';-import {Dialog} from '../Dialog';-import {verifyUser} from '../../views/Settings/functions';-import {presentDialog} from '../Dialog/functions';-import {Toast} from '../Toast';+import { Dialog } from '../Dialog';+import { verifyUser } from '../../views/Settings/functions';+import { presentDialog } from '../Dialog/functions';+import { Toast } from '../Toast';const actionSheetRef = createRef();let RNFetchBlob;@@ -71,12 +67,9 @@ const RestoreDialog = () => {fwdRef={actionSheetRef}gestureEnabled={!restoring}closeOnTouchBackdrop={!restoring}- onClose={close}>- <RestoreDataComponent- close={close}- restoring={restoring}- setRestoring={setRestoring}- />+ onClose={close}+ >+ <RestoreDataComponent close={close} restoring={restoring} setRestoring={setRestoring} /><Toast context="local" /></SheetWrapper>);@@ -84,9 +77,9 @@ const RestoreDialog = () => {export default RestoreDialog;-const RestoreDataComponent = ({close, setRestoring, restoring}) => {+const RestoreDataComponent = ({ close, setRestoring, restoring }) => {const [state, dispatch] = useTracked();- const {colors} = state;+ const { colors } = state;const [files, setFiles] = useState([]);const [loading, setLoading] = useState(true);const [backupDirectoryAndroid, setBackupDirectoryAndroid] = useState(false);@@ -187,8 +180,8 @@ const RestoreDataComponent = ({close, setRestoring, restoring}) => {files = await RNFetchBlob.fs.lstat(path);}files = files.sort(function (a, b) {- timeA = a.lastModified;- timeB = b.lastModified;+ let timeA = a.lastModified;+ let timeB = b.lastModified;return timeB - timeA;});setFiles(files);@@ -201,7 +194,7 @@ const RestoreDataComponent = ({close, setRestoring, restoring}) => {}};- const renderItem = ({item, index}) => (+ const renderItem = ({ item, index }) => (<Viewstyle={{minHeight: 50,@@ -212,12 +205,14 @@ const RestoreDataComponent = ({close, setRestoring, restoring}) => {flexDirection: 'row',borderBottomWidth: 0.5,borderBottomColor: colors.nav- }}>+ }}+ ><Viewstyle={{maxWidth: '75%'- }}>- <Paragraph size={SIZE.sm} style={{width: '100%', maxWidth: '100%'}}>+ }}+ >+ <Paragraph size={SIZE.sm} style={{ width: '100%', maxWidth: '100%' }}>{timeConverter(item?.lastModified * 1)}</Paragraph><Paragraph size={SIZE.xs}>@@ -276,10 +271,7 @@ const RestoreDataComponent = ({close, setRestoring, restoring}) => {.then(async r => {try {let backup = await r.json();- console.log(- 'backup encrypted:',- backup.data.iv && backup.data.salt- );+ console.log('backup encrypted:', backup.data.iv && backup.data.salt);if (backup.data.iv && backup.data.salt) {withPassword(async value => {@@ -326,13 +318,12 @@ const RestoreDataComponent = ({close, setRestoring, restoring}) => {paddingRight: 8,alignItems: 'center',paddingTop: restoring ? 8 : 0- }}>+ }}+ ><DialogHeadertitle="Backups"paragraph={`All the backups are stored in ${- Platform.OS === 'ios'- ? 'File Manager/Notesnook/Backups'- : 'selected backups folder.'+ Platform.OS === 'ios' ? 'File Manager/Notesnook/Backups' : 'selected backups folder.'}`}button={button}/>@@ -351,7 +342,8 @@ const RestoreDataComponent = ({close, setRestoring, restoring}) => {justifyContent: 'center',alignItems: 'center',height: 100- }}>+ }}+ ><ActivityIndicator color={colors.accent} size={SIZE.lg} /></View>) : (@@ -360,16 +352,15 @@ const RestoreDataComponent = ({close, setRestoring, restoring}) => {justifyContent: 'center',alignItems: 'center',height: 100- }}>+ }}+ >{Platform.OS === 'android' && !backupDirectoryAndroid ? (<><Buttontitle="Select backups folder"icon="folder"onPress={async () => {- let folder = await ScopedStorage.openDocumentTree(- true- );+ let folder = await ScopedStorage.openDocumentTree(true);let subfolder;if (folder.name !== 'Notesnook backups') {subfolder = await ScopedStorage.createDirectory(@@ -380,10 +371,7 @@ const RestoreDataComponent = ({close, setRestoring, restoring}) => {subfolder = folder;}console.log(subfolder, folder);- MMKV.setItem(- 'backupStorageDir',- JSON.stringify(subfolder)- );+ MMKV.setItem('backupStorageDir', JSON.stringify(subfolder));setBackupDirectoryAndroid(subfolder);setLoading(true);checkBackups();@@ -403,9 +391,9 @@ const RestoreDataComponent = ({close, setRestoring, restoring}) => {}}size={SIZE.xs}textBreakStrategy="balanced"- color={colors.icon}>- Select the folder that includes your backup files to- list them here.+ color={colors.icon}+ >+ Select the folder that includes your backup files to list them here.</Paragraph></>) : (@@ -419,11 +407,10 @@ const RestoreDataComponent = ({close, setRestoring, restoring}) => {justifyContent: 'center',alignItems: 'center',height: 200- }}>+ }}+ ><ActivityIndicator color={colors.accent} />- <Paragraph color={colors.icon}>- Restoring backup. Please wait.- </Paragraph>+ <Paragraph color={colors.icon}>Restoring backup. Please wait.</Paragraph></View>)}diff --git a/apps/mobile/src/components/ResultDialog/ProFeatures.js b/apps/mobile/src/components/ResultDialog/ProFeatures.jsindex b18fc57df..1a7cbb31b 100644--- a/apps/mobile/src/components/ResultDialog/ProFeatures.js+++ b/apps/mobile/src/components/ResultDialog/ProFeatures.js@@ -1,30 +1,24 @@import React from 'react';-import {View} from 'react-native';+import { View } from 'react-native';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {useTracked} from '../../provider';-import {eSendEvent} from '../../services/EventManager';-import {- eCloseProgressDialog,- eCloseResultDialog,- eOpenPremiumDialog-} from '../../utils/Events';-import {SIZE} from '../../utils/SizeUtils';-import {sleep} from '../../utils/TimeUtils';+import { useTracked } from '../../provider';+import { eSendEvent } from '../../services/EventManager';+import { eCloseProgressDialog, eCloseResultDialog, eOpenPremiumDialog } from '../../utils/Events';+import { SIZE } from '../../utils/SizeUtils';+import { sleep } from '../../utils/TimeUtils';import Paragraph from '../Typography/Paragraph';-export const ProFeatures = ({count = 6}) => {+export const ProFeatures = ({ count = 6 }) => {const [state, dispatch] = useTracked();- const {colors} = state;+ const { colors } = state;return (<>{[{- content:- 'Unlock unlimited notebooks, tags, colors. Organize like a pro'+ content: 'Unlock unlimited notebooks, tags, colors. Organize like a pro'},{- content:- 'Attach files upto 500MB, upload 4K images with unlimited storage'+ content: 'Attach files upto 500MB, upload 4K images with unlimited storage'},{content: 'Instantly sync to unlimited devices'@@ -33,8 +27,7 @@ export const ProFeatures = ({count = 6}) => {content: 'A private vault to keep everything imporant always locked'},{- content:- 'Rich note editing experience with markdown, tables, checklists and more'+ content: 'Rich note editing experience with markdown, tables, checklists and more'},{content: 'Export your notes in Pdf, markdown and html formats'@@ -43,6 +36,7 @@ export const ProFeatures = ({count = 6}) => {.slice(0, count).map(item => (<View+ key={item.content}style={{flexDirection: 'row',width: '100%',@@ -52,11 +46,10 @@ export const ProFeatures = ({count = 6}) => {alignItems: 'center',borderRadius: 5,justifyContent: 'flex-start'- }}>+ }}+ ><Icon size={SIZE.lg} color={colors.accent} name="check" />- <Paragraph style={{marginLeft: 5, flexShrink: 1}}>- {item.content}- </Paragraph>+ <Paragraph style={{ marginLeft: 5, flexShrink: 1 }}>{item.content}</Paragraph></View>))}<Paragraph@@ -70,7 +63,8 @@ export const ProFeatures = ({count = 6}) => {style={{textDecorationLine: 'underline',color: colors.icon- }}>+ }}+ >See all features included in Notesnook Pro</Paragraph></>diff --git a/apps/mobile/src/components/ResultDialog/index.js b/apps/mobile/src/components/ResultDialog/index.jsindex e81a9062c..2b065f373 100644--- a/apps/mobile/src/components/ResultDialog/index.js+++ b/apps/mobile/src/components/ResultDialog/index.js@@ -15,16 +15,14 @@ import { ProFeatures } from './pro-features';const ResultDialog = () => {const [state, dispatch] = useTracked();- const {colors} = state;+ const { colors } = state;const [visible, setVisible] = useState(false);const [dialogData, setDialogData] = useState({title: 'Thank you for signing up!',- paragraph:- 'Try out all features of Notesnook free for 7 days. No limitations. No commitments.',+ paragraph: 'Try out all features of Notesnook free for 7 days. No limitations. No commitments.',button: 'Start taking notes'});useEffect(() => {-eSubscribeEvent(eOpenResultDialog, open);eSubscribeEvent(eCloseResultDialog, close);return () => {@@ -56,7 +54,8 @@ const ResultDialog = () => {paddingTop: 20,justifyContent: 'center',alignItems: 'center'- }}>+ }}+ ><Headingsize={SIZE.lg}textBreakStrategy="balanced"@@ -67,7 +66,8 @@ const ResultDialog = () => {maxWidth: '100%',marginBottom: 10,paddingHorizontal: 12- }}>+ }}+ >{dialogData.title}</Heading>@@ -79,7 +79,8 @@ const ResultDialog = () => {textAlign: 'center',maxWidth: '80%',lineHeight: SIZE.sm + 5- }}>+ }}+ >{dialogData.paragraph}</Paragraph>@@ -90,7 +91,8 @@ const ResultDialog = () => {paddingHorizontal: 12,alignItems: 'center',width: '100%'- }}>+ }}+ ><ProFeatures count={4} /></View>@@ -102,7 +104,8 @@ const ResultDialog = () => {borderBottomRightRadius: 10,borderBottomLeftRadius: 10,paddingVertical: 10- }}>+ }}+ ><Buttontitle={dialogData.button}width={null}diff --git a/apps/mobile/src/components/SelectionHeader/index.js b/apps/mobile/src/components/SelectionHeader/index.jsindex 8d2502164..ffa26c7cd 100644--- a/apps/mobile/src/components/SelectionHeader/index.js+++ b/apps/mobile/src/components/SelectionHeader/index.js@@ -1,24 +1,24 @@-import React, {useEffect} from 'react';-import {BackHandler, View} from 'react-native';-import {useSafeAreaInsets} from 'react-native-safe-area-context';-import {useTracked} from '../../provider';-import {useSelectionStore} from '../../provider/stores';-import {eSendEvent, ToastEvent} from '../../services/EventManager';+import React, { useEffect } from 'react';+import { BackHandler, Platform, View } from 'react-native';+import { useSafeAreaInsets } from 'react-native-safe-area-context';+import { useTracked } from '../../provider';+import { useSelectionStore } from '../../provider/stores';+import { eSendEvent, ToastEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';import SearchService from '../../services/SearchService';-import {db} from '../../utils/database';-import {eOpenMoveNoteDialog, refreshNotesPage} from '../../utils/Events';-import {deleteItems} from '../../utils/functions';+import { db } from '../../utils/database';+import { eOpenMoveNoteDialog, refreshNotesPage } from '../../utils/Events';+import { deleteItems } from '../../utils/functions';import layoutmanager from '../../utils/layout-manager';-import {SIZE} from '../../utils/SizeUtils';-import {sleep} from '../../utils/TimeUtils';-import {ActionIcon} from '../ActionIcon';-import {presentDialog} from '../Dialog/functions';+import { SIZE } from '../../utils/SizeUtils';+import { sleep } from '../../utils/TimeUtils';+import { ActionIcon } from '../ActionIcon';+import { presentDialog } from '../Dialog/functions';import Heading from '../Typography/Heading';-export const SelectionHeader = React.memo(({screen, type, extras}) => {+export const SelectionHeader = React.memo(({ screen, type, extras }) => {const [state, dispatch] = useTracked();- const {colors} = state;+ const { colors } = state;const selectionMode = useSelectionStore(state => state.selectionMode);const selectedItemsList = useSelectionStore(state => state.selectedItemsList);@@ -90,14 +90,16 @@ export const SelectionHeader = React.memo(({screen, type, extras}) => {flexDirection: 'row',zIndex: 999,paddingHorizontal: 12- }}>+ }}+ ><Viewstyle={{flexDirection: 'row',justifyContent: 'flex-start',alignItems: 'center',borderRadius: 100- }}>+ }}+ ><ActionIconcustomStyle={{justifyContent: 'center',@@ -125,7 +127,8 @@ export const SelectionHeader = React.memo(({screen, type, extras}) => {justifyContent: 'center',flexDirection: 'row',alignItems: 'center'- }}>+ }}+ ><Heading size={SIZE.md} color={colors.accent}>{selectedItemsList.length + ' Selected'}</Heading>@@ -136,7 +139,8 @@ export const SelectionHeader = React.memo(({screen, type, extras}) => {flexDirection: 'row',justifyContent: 'flex-start',alignItems: 'center'- }}>+ }}+ >{/* <ActionIcononPress={async () => {// await sleep(100);@@ -219,9 +223,7 @@ export const SelectionHeader = React.memo(({screen, type, extras}) => {}}onPress={async () => {presentDialog({- title: `Delete ${- selectedItemsList.length > 1 ? 'items' : 'item'- }`,+ title: `Delete ${selectedItemsList.length > 1 ? 'items' : 'item'}`,paragraph: `Are you sure you want to delete ${selectedItemsList.length > 1 ? 'these items?' : 'this item?'}`,@@ -257,4 +259,6 @@ export const SelectionHeader = React.memo(({screen, type, extras}) => {);});+SelectionHeader.displayName = 'SelectionHeader';+export default SelectionHeader;diff --git a/apps/mobile/src/components/SelectionWrapper/actionstrip.js b/apps/mobile/src/components/SelectionWrapper/actionstrip.jsindex 754d492f7..ef91ed6de 100644--- a/apps/mobile/src/components/SelectionWrapper/actionstrip.js+++ b/apps/mobile/src/components/SelectionWrapper/actionstrip.js@@ -1,12 +1,13 @@import React, { useEffect, useState } from 'react';-import {View } from 'react-native';-import Clipboard from "@react-native-clipboard/clipboard"+import { View } from 'react-native';+import Clipboard from '@react-native-clipboard/clipboard';import Animated, { useValue } from 'react-native-reanimated';import { useTracked } from '../../provider';import {useMenuStore,useNotebookStore,- useSelectionStore+ useSelectionStore,+ useTrashStore} from '../../provider/stores';import { openVault, ToastEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';@@ -17,9 +18,9 @@ import { ActionIcon } from '../ActionIcon';import { Button } from '../Button';import { presentDialog } from '../Dialog/functions';-export const ActionStrip = ({note, setActionStrip}) => {+export const ActionStrip = ({ note, setActionStrip }) => {const [state, dispatch] = useTracked();- const {colors} = state;+ const { colors } = state;const selectionMode = useSelectionStore(state => state.selectionMode);const setNotebooks = useNotebookStore(state => state.setNotebooks);const setMenuPins = useMenuStore(state => state.setMenuPins);@@ -38,7 +39,7 @@ export const ActionStrip = ({note, setActionStrip}) => {Navigation.setRoutesToUpdate([Navigation.routeNames.NotesPage,Navigation.routeNames.Favorites,- Navigation.routeNames.Notes,+ Navigation.routeNames.Notes]);};@@ -63,7 +64,7 @@ export const ActionStrip = ({note, setActionStrip}) => {if (db.notes.pinned.length === 3 && !note.pinned) {ToastEvent.show({heading: 'Cannot pin more than 3 notes',- type: 'error',+ type: 'error'});return;}@@ -72,7 +73,7 @@ export const ActionStrip = ({note, setActionStrip}) => {if (db.notebooks.pinned.length === 3 && !note.pinned) {ToastEvent.show({heading: 'Cannot pin more than 3 notebooks',- type: 'error',+ type: 'error'});return;}@@ -81,7 +82,7 @@ export const ActionStrip = ({note, setActionStrip}) => {}updateNotes();setActionStrip(false);- },+ }},{title: 'Add to favorites',@@ -97,13 +98,11 @@ export const ActionStrip = ({note, setActionStrip}) => {setActionStrip(false);},visible: note.type === 'note',- color: !note.favorite ? 'orange' : null,+ color: !note.favorite ? 'orange' : null},{- title: isPinnedToMenu- ? 'Remove Shortcut from Menu'- : 'Add Shortcut to Menu',+ title: isPinnedToMenu ? 'Remove Shortcut from Menu' : 'Add Shortcut to Menu',icon: isPinnedToMenu ? 'link-variant-remove' : 'link-variant',onPress: async () => {try {@@ -111,20 +110,20 @@ export const ActionStrip = ({note, setActionStrip}) => {await db.settings.unpin(note.id);ToastEvent.show({heading: 'Shortcut removed from menu',- type: 'success',+ type: 'success'});} else {if (note.type === 'topic') {await db.settings.pin(note.type, {id: note.id,- notebookId: note.notebookId,+ notebookId: note.notebookId});} else {- await db.settings.pin(note.type, {id: note.id});+ await db.settings.pin(note.type, { id: note.id });}ToastEvent.show({heading: 'Shortcut added to menu',- type: 'success',+ type: 'success'});}setIsPinnedToMenu(db.settings.isPinned(note.id));@@ -133,7 +132,7 @@ export const ActionStrip = ({note, setActionStrip}) => {setActionStrip(false);} catch (e) {}},- visible: note.type !== 'note',+ visible: note.type !== 'note'},{title: 'Copy Note',@@ -147,7 +146,7 @@ export const ActionStrip = ({note, setActionStrip}) => {locked: true,item: note,title: 'Copy note',- description: 'Unlock note to copy to clipboard.',+ description: 'Unlock note to copy to clipboard.'});} else {let delta = await db.notes.note(note.id).content();@@ -156,11 +155,11 @@ export const ActionStrip = ({note, setActionStrip}) => {Clipboard.setString(text);ToastEvent.show({heading: 'Note copied to clipboard',- type: 'success',+ type: 'success'});}setActionStrip(false);- },+ }},{title: 'Restore ' + note.itemType,@@ -172,20 +171,18 @@ export const ActionStrip = ({note, setActionStrip}) => {Navigation.routeNames.Notebooks,Navigation.routeNames.NotesPage,Navigation.routeNames.Favorites,- Navigation.routeNames.Trash,+ Navigation.routeNames.Trash]);ToastEvent.show({heading:- item.type === 'note'- ? 'Note restored from trash'- : 'Notebook restored from trash',- type: 'success',+ note.type === 'note' ? 'Note restored from trash' : 'Notebook restored from trash',+ type: 'success'});setActionStrip(false);},- visible: note.type === 'trash',+ visible: note.type === 'trash'},{title: 'Delete' + note.itemType,@@ -204,13 +201,13 @@ export const ActionStrip = ({note, setActionStrip}) => {ToastEvent.show({heading: 'Permanantly deleted items',type: 'success',- context: 'local',+ context: 'local'});},- positiveType: 'errorShade',+ positiveType: 'errorShade'});setActionStrip(false);- },+ }},{title: 'Delete' + note.type,@@ -221,7 +218,7 @@ export const ActionStrip = ({note, setActionStrip}) => {await deleteItems(note);} catch (e) {}setActionStrip(false);- },+ }},{title: 'Close',@@ -229,8 +226,8 @@ export const ActionStrip = ({note, setActionStrip}) => {onPress: () => setActionStrip(false),color: colors.light,bg: colors.red,- visible: true,- },+ visible: true+ }];return (@@ -246,8 +243,9 @@ export const ActionStrip = ({note, setActionStrip}) => {flexDirection: 'row',justifyContent: 'flex-end',alignItems: 'center',- opacity: opacity,- }}>+ opacity: opacity+ }}+ ><Buttontype="accent"title="Select"@@ -263,36 +261,36 @@ export const ActionStrip = ({note, setActionStrip}) => {style={{borderRadius: 100,paddingHorizontal: 12,- ...getElevation(5),+ ...getElevation(5)}}height={30}/>- {actions.map(- item =>- item.visible ? (- <View- key={item.icon}- style={{- width: width / 1.4 / actions.length,- height: width / 1.4 / actions.length,- backgroundColor: item.bg || colors.nav,- borderRadius: 100,- justifyContent: 'center',- alignItems: 'center',- ...getElevation(5),- marginLeft: 15,- }}>- <ActionIcon- color={item.color || colors.heading}- onPress={item.onPress}- tooltipText={item.title}- top={60}- bottom={60}- name={item.icon}- size={width / 2.8 / actions.length}- />- </View>- ) : null,+ {actions.map(item =>+ item.visible ? (+ <View+ key={item.icon}+ style={{+ width: width / 1.4 / actions.length,+ height: width / 1.4 / actions.length,+ backgroundColor: item.bg || colors.nav,+ borderRadius: 100,+ justifyContent: 'center',+ alignItems: 'center',+ ...getElevation(5),+ marginLeft: 15+ }}+ >+ <ActionIcon+ color={item.color || colors.heading}+ onPress={item.onPress}+ tooltipText={item.title}+ top={60}+ bottom={60}+ name={item.icon}+ size={width / 2.8 / actions.length}+ />+ </View>+ ) : null)}</Animated.View>);diff --git a/apps/mobile/src/components/SelectionWrapper/backfill.js b/apps/mobile/src/components/SelectionWrapper/backfill.jsindex 9c2bab958..1340cb2b3 100644--- a/apps/mobile/src/components/SelectionWrapper/backfill.js+++ b/apps/mobile/src/components/SelectionWrapper/backfill.js@@ -4,10 +4,10 @@ import { useTracked } from '../../provider';import { useEditorStore } from '../../provider/stores';import { hexToRGBA } from '../../utils/ColorUtils';-export const Filler = ({item, background}) => {+export const Filler = ({ item, background }) => {const [state] = useTracked();- const {colors} = state;-+ const { colors } = state;+const currentEditingNote = useEditorStore(state => state.currentEditingNote);const color = 'gray';@@ -18,12 +18,11 @@ export const Filler = ({item, background}) => {position: 'absolute',width: '110%',height: '150%',- backgroundColor:currentEditingNote === item.id ? hexToRGBA(colors[color], 0.12) : null,- borderLeftWidth:5,- borderLeftColor:currentEditingNote === item.id ? colors[item.color || 'accent'] : 'transparent'- }}>--- </View>- ) : null+ backgroundColor: currentEditingNote === item.id ? hexToRGBA(colors[color], 0.12) : null,+ borderLeftWidth: 5,+ borderLeftColor:+ currentEditingNote === item.id ? colors[item.color || 'accent'] : 'transparent'+ }}+ ></View>+ ) : null;};diff --git a/apps/mobile/src/components/SelectionWrapper/index.js b/apps/mobile/src/components/SelectionWrapper/index.jsindex eb4eec7b6..e3b7c5f51 100644--- a/apps/mobile/src/components/SelectionWrapper/index.js+++ b/apps/mobile/src/components/SelectionWrapper/index.js@@ -8,20 +8,13 @@ import { ActionStrip } from './action-strip';import { Filler } from './back-fill';import { SelectionIcon } from './selection';-const SelectionWrapper = ({- children,- item,- background,- onLongPress,- onPress,- testID,-}) => {+const SelectionWrapper = ({ children, item, background, onLongPress, onPress, testID }) => {const [state, dispatch] = useTracked();- const {colors} = state;+ const { colors } = state;const [actionStrip, setActionStrip] = useState(false);const settings = useSettingStore(state => state.settings);- const listMode = item.type === "notebook" ? settings.notebooksListMode : settings.notesListMode- const compactMode = (item.type === 'notebook' || item.type === 'note') && listMode === "compact"+ const listMode = item.type === 'notebook' ? settings.notebooksListMode : settings.notesListMode;+ const compactMode = (item.type === 'notebook' || item.type === 'note') && listMode === 'compact';const _onLongPress = () => {if (history.selectedItemsList.length > 0) return;@@ -65,11 +58,10 @@ const SelectionWrapper = ({borderRadius: 0,overflow: 'hidden',paddingHorizontal: 12,- paddingVertical:compactMode ? 8 : 12,- }}>- {actionStrip ? (- <ActionStrip note={item} setActionStrip={setActionStrip} />- ) : null}+ paddingVertical: compactMode ? 8 : 12+ }}+ >+ {actionStrip ? <ActionStrip note={item} setActionStrip={setActionStrip} /> : null}{item.type === 'note' ? <Filler background={background} item={item} /> : null}<SelectionIcondiff --git a/apps/mobile/src/components/SelectionWrapper/selection.js b/apps/mobile/src/components/SelectionWrapper/selection.jsindex 0b5226292..de51a1ffc 100644--- a/apps/mobile/src/components/SelectionWrapper/selection.js+++ b/apps/mobile/src/components/SelectionWrapper/selection.js@@ -1,14 +1,14 @@-import React, {useEffect, useState} from 'react';-import {TouchableOpacity, View} from 'react-native';+import React, { useEffect, useState } from 'react';+import { TouchableOpacity, View } from 'react-native';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {useTracked} from '../../provider';-import {Actions} from '../../provider/Actions';-import {useSelectionStore} from '../../provider/stores';-import {SIZE} from '../../utils/SizeUtils';+import { useTracked } from '../../provider';+import { Actions } from '../../provider/Actions';+import { useSelectionStore } from '../../provider/stores';+import { SIZE } from '../../utils/SizeUtils';-export const SelectionIcon = ({setActionStrip, item,compactMode}) => {+export const SelectionIcon = ({ setActionStrip, item, compactMode }) => {const [state, dispatch] = useTracked();- const {colors} = state;+ const { colors } = state;const selectionMode = useSelectionStore(state => state.selectionMode);const selectedItemsList = useSelectionStore(state => state.selectedItemsList);@@ -18,9 +18,7 @@ export const SelectionIcon = ({setActionStrip, item,compactMode}) => {useEffect(() => {if (selectionMode) {setActionStrip(false);- let exists = selectedItemsList.filter(- o => o.dateCreated === item.dateCreated- );+ let exists = selectedItemsList.filter(o => o.dateCreated === item.dateCreated);if (exists[0]) {if (!selected) {@@ -34,7 +32,7 @@ export const SelectionIcon = ({setActionStrip, item,compactMode}) => {}}, [selectedItemsList, item.id]);- onPress = () => {+ const onPress = () => {setSelectedItem(item);};@@ -44,7 +42,7 @@ export const SelectionIcon = ({setActionStrip, item,compactMode}) => {display: 'flex',opacity: 1,width: '10%',- height:compactMode ? 40 : 70,+ height: compactMode ? 40 : 70,justifyContent: 'center',alignItems: 'center',backgroundColor: colors.bg,@@ -52,7 +50,8 @@ export const SelectionIcon = ({setActionStrip, item,compactMode}) => {marginRight: 10,borderWidth: 1,borderColor: selected ? colors.accent : colors.border- }}>+ }}+ ><TouchableOpacityactiveOpacity={1}onPress={onPress}@@ -60,13 +59,10 @@ export const SelectionIcon = ({setActionStrip, item,compactMode}) => {justifyContent: 'center',alignItems: 'center',height: 70- }}>+ }}+ >{selected && (- <Icon- size={SIZE.xl}- color={selected ? colors.accent : colors.icon}- name="check"- />+ <Icon size={SIZE.xl} color={selected ? colors.accent : colors.icon} name="check" />)}</TouchableOpacity></View>diff --git a/apps/mobile/src/components/Seperator/index.js b/apps/mobile/src/components/Seperator/index.jsindex c2df766bb..7f88e0598 100644--- a/apps/mobile/src/components/Seperator/index.js+++ b/apps/mobile/src/components/Seperator/index.js@@ -1,15 +1,15 @@import React from 'react';-import { View} from 'react-native';+import { View } from 'react-native';-const Seperator = ({half = false}) => {+const Seperator = ({ half = false }) => {return (<Viewstyle={{- width: half ? 7.5 :15,- height: half ? 7.5 : 15,+ width: half ? 7.5 : 15,+ height: half ? 7.5 : 15}}/>);};-export default Seperator\ No newline at end of file+export default Seperator;diff --git a/apps/mobile/src/components/Shapes/index.js b/apps/mobile/src/components/Shapes/index.jsindex 9af473863..d72cf6615 100644--- a/apps/mobile/src/components/Shapes/index.js+++ b/apps/mobile/src/components/Shapes/index.js@@ -1,7 +1,7 @@import React from 'react';import { Dimensions, StyleSheet, View } from 'react-native';-const Circle = ({size, color, position}) => {+const Circle = ({ size, color, position }) => {let style = {wrapper: {flexDirection: 'row',@@ -21,7 +21,7 @@ const Circle = ({size, color, position}) => {);};-const Donut = ({size, color, position}) => {+const Donut = ({ size, color, position }) => {let style = {wrapper: {flexDirection: 'row',@@ -42,7 +42,7 @@ const Donut = ({size, color, position}) => {);};-const Triangle = ({size, color, position}) => {+const Triangle = ({ size, color, position }) => {let style = {wrapper: {flexDirection: 'row',@@ -59,7 +59,7 @@ const Triangle = ({size, color, position}) => {borderLeftColor: 'transparent',borderRightColor: 'transparent',borderBottomColor: color,- transform: [{rotate: '180deg'}]+ transform: [{ rotate: '180deg' }]}};return (@@ -69,7 +69,7 @@ const Triangle = ({size, color, position}) => {);};-const DiamondNarrow = ({size, color, position}) => {+const DiamondNarrow = ({ size, color, position }) => {let style = {wrapper: {flexDirection: 'row',@@ -111,7 +111,7 @@ const DiamondNarrow = ({size, color, position}) => {);};-const CutDiamond = ({size, color, position}) => {+const CutDiamond = ({ size, color, position }) => {let style = {wrapper: {flexDirection: 'row',@@ -153,25 +153,16 @@ const CutDiamond = ({size, color, position}) => {);};---const Shapes = ({- primaryColor,- secondaryColor,- height,- figures,- borderRadius,- style-}) => {+const Shapes = ({ primaryColor, secondaryColor, height, figures, borderRadius, style }) => {const config = {primaryColor: primaryColor || '#416DF8',secondaryColor: secondaryColor || '#2F53D5',height: Dimensions.get('window').height / (height || 3.5),sizefigure: 100,figures: figures || [- {name: 'circle', position: 'center', size: 60},- {name: 'donut', position: 'flex-start', axis: 'top', size: 80},- {name: 'circle', position: 'center', axis: 'right', size: 100}+ { name: 'circle', position: 'center', size: 60 },+ { name: 'donut', position: 'flex-start', axis: 'top', size: 80 },+ { name: 'circle', position: 'center', axis: 'right', size: 100 }],borderRadius: borderRadius !== undefined ? borderRadius : 30};@@ -204,32 +195,17 @@ const Shapes = ({if (e.name === 'circle') {arrFigures.push(- <Circle- key={i}- size={sizefigure}- color={config.secondaryColor}- position={position}- />+ <Circle key={i} size={sizefigure} color={config.secondaryColor} position={position} />);}if (e.name === 'donut') {arrFigures.push(- <Donut- key={i}- size={sizefigure}- color={config.secondaryColor}- position={position}- />+ <Donut key={i} size={sizefigure} color={config.secondaryColor} position={position} />);}if (e.name === 'triangle') {arrFigures.push(- <Triangle- key={i}- size={sizefigure}- color={config.secondaryColor}- position={position}- />+ <Triangle key={i} size={sizefigure} color={config.secondaryColor} position={position} />);}if (e.name === 'diamondNarrow') {@@ -244,12 +220,7 @@ const Shapes = ({}if (e.name === 'cutDiamond') {arrFigures.push(- <CutDiamond- key={i}- size={sizefigure}- color={config.secondaryColor}- position={position}- />+ <CutDiamond key={i} size={sizefigure} color={config.secondaryColor} position={position} />);}});@@ -266,7 +237,8 @@ const Shapes = ({borderBottomLeftRadius: config.borderRadius,borderBottomRightRadius: config.borderRadius,...style- }}>+ }}+ ><>{buildFigures()}</></View>);@@ -284,4 +256,3 @@ const styles = StyleSheet.create({});export { Shapes };-diff --git a/apps/mobile/src/components/Sheet/index.js b/apps/mobile/src/components/Sheet/index.jsindex d40519fd3..6f87da855 100644--- a/apps/mobile/src/components/Sheet/index.js+++ b/apps/mobile/src/components/Sheet/index.js@@ -1,13 +1,13 @@import React from 'react';-import {Platform, View} from 'react-native';+import { Platform, View } from 'react-native';import ActionSheet from 'react-native-actions-sheet';-import {useSafeAreaInsets} from 'react-native-safe-area-context';-import {useTracked} from '../../provider';-import {useSettingStore} from '../../provider/stores';+import { useSafeAreaInsets } from 'react-native-safe-area-context';+import { useTracked } from '../../provider';+import { useSettingStore } from '../../provider/stores';import layoutmanager from '../../utils/layout-manager';-import {PremiumToast} from '../Premium/premium-toast';-import {Toast} from '../Toast';-import {BouncingView} from '../Transitions/bouncing-view';+import { PremiumToast } from '../Premium/premium-toast';+import { Toast } from '../Toast';+import { BouncingView } from '../Transitions/bouncing-view';const SheetWrapper = ({children,@@ -20,7 +20,7 @@ const SheetWrapper = ({keyboardMode}) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const deviceMode = useSettingStore(state => state.deviceMode);const sheetKeyboardHandler = useSettingStore(state => state.sheetKeyboardHandler);const largeTablet = deviceMode === 'tablet';@@ -57,7 +57,7 @@ const SheetWrapper = ({}};- console.log('Sheet keyboard handler',sheetKeyboardHandler)+ console.log('Sheet keyboard handler', sheetKeyboardHandler);return (<ActionSheet@@ -74,27 +74,21 @@ const SheetWrapper = ({indicatorColor={colors.nav}onOpen={_onOpen}keyboardDismissMode="none"- overlayColor={pitchBlack? '#585858' : "#000000"}+ overlayColor={pitchBlack ? '#585858' : '#000000'}keyboardShouldPersistTaps="always"ExtraOverlayComponent={<><Toast context="local" />- <PremiumToast- context="sheet"- close={() => fwdRef?.current?.hide()}- offset={50}- />+ <PremiumToast context="sheet" close={() => fwdRef?.current?.hide()} offset={50} /></>}- onClose={_onClose}>+ onClose={_onClose}+ ><BouncingView>{children}<Viewstyle={{- height:- Platform.OS === 'ios' && insets.bottom !== 0- ? insets.bottom + 5- : 20+ height: Platform.OS === 'ios' && insets.bottom !== 0 ? insets.bottom + 5 : 20}}/></BouncingView>diff --git a/apps/mobile/src/components/SimpleList/card.js b/apps/mobile/src/components/SimpleList/card.jsindex bb62f3eac..5a4a361b7 100644--- a/apps/mobile/src/components/SimpleList/card.js+++ b/apps/mobile/src/components/SimpleList/card.js@@ -1,15 +1,15 @@import React from 'react';-import {View} from 'react-native';+import { View } from 'react-native';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {useTracked} from '../../provider';-import {useMessageStore, useSelectionStore} from '../../provider/stores';-import {hexToRGBA} from '../../utils/ColorUtils';-import {SIZE} from '../../utils/SizeUtils';-import {PressableButton} from '../PressableButton';+import { useTracked } from '../../provider';+import { useMessageStore, useSelectionStore } from '../../provider/stores';+import { hexToRGBA } from '../../utils/ColorUtils';+import { SIZE } from '../../utils/SizeUtils';+import { PressableButton } from '../PressableButton';import Paragraph from '../Typography/Paragraph';-export const Card = ({color}) => {- const [state,] = useTracked();+export const Card = ({ color }) => {+ const [state] = useTracked();const colors = state.colors;color = color ? color : colors.accent;@@ -27,8 +27,9 @@ export const Card = ({color}) => {flexDirection: 'row',alignItems: 'center',justifyContent: 'flex-start',- paddingHorizontal: 0,- }}>+ paddingHorizontal: 0+ }}+ ><Viewstyle={{width: 40,@@ -41,7 +42,8 @@ export const Card = ({color}) => {borderRadius: 100,alignItems: 'center',justifyContent: 'center'- }}>+ }}+ ><Iconsize={SIZE.lg}color={messageBoardState.type === 'error' ? colors.errorText : color}@@ -53,7 +55,8 @@ export const Card = ({color}) => {style={{marginLeft: 10,maxWidth: '70%'- }}>+ }}+ ><Paragraph color={colors.icon} size={SIZE.xs}>{messageBoardState.message}</Paragraph>@@ -61,7 +64,8 @@ export const Card = ({color}) => {style={{maxWidth: '100%'}}- color={colors.heading}>+ color={colors.heading}+ >{messageBoardState.actionText}</Paragraph></View>@@ -74,7 +78,8 @@ export const Card = ({color}) => {alignItems: 'center',position: 'absolute',right: 6- }}>+ }}+ ><Iconname="chevron-right"color={messageBoardState.type === 'error' ? colors.red : color}diff --git a/apps/mobile/src/components/SimpleList/empty.js b/apps/mobile/src/components/SimpleList/empty.jsindex ad0f08bdc..6d5045c4b 100644--- a/apps/mobile/src/components/SimpleList/empty.js+++ b/apps/mobile/src/components/SimpleList/empty.js@@ -1,28 +1,21 @@import React from 'react';-import {ActivityIndicator, useWindowDimensions, View} from 'react-native';-import {useSafeAreaInsets} from 'react-native-safe-area-context';-import {notesnook} from '../../../e2e/test.ids';-import {useTracked} from '../../provider';-import {COLORS_NOTE} from '../../utils/Colors';-import {normalize, SIZE} from '../../utils/SizeUtils';-import {Button} from '../Button';-import {Placeholder} from '../ListPlaceholders';+import { ActivityIndicator, useWindowDimensions, View } from 'react-native';+import { useSafeAreaInsets } from 'react-native-safe-area-context';+import { notesnook } from '../../../e2e/test.ids';+import { useTracked } from '../../provider';+import { COLORS_NOTE } from '../../utils/Colors';+import { normalize, SIZE } from '../../utils/SizeUtils';+import { Button } from '../Button';+import { Placeholder } from '../ListPlaceholders';import Seperator from '../Seperator';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';-export const Empty = ({- loading = true,- placeholderData,- absolute,- headerProps,- type,- screen-}) => {+export const Empty = ({ loading = true, placeholderData, absolute, headerProps, type, screen }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const insets = useSafeAreaInsets();- const {height} = useWindowDimensions();+ const { height } = useWindowDimensions();return (<View@@ -34,13 +27,15 @@ export const Empty = ({height: height - 250 - insets.top,width: '100%'}- ]}>+ ]}+ ><Viewstyle={{flexGrow: 1,justifyContent: 'center',alignItems: 'center'- }}>+ }}+ ><Placeholdercolor={COLORS_NOTE[headerProps.color?.toLowerCase()] || colors.accent}w={normalize(150)}@@ -54,7 +49,8 @@ export const Empty = ({textAlign: 'center',width: '80%'}}- color={colors.icon}>+ color={colors.icon}+ >{loading ? placeholderData.loading : placeholderData.paragraph}</Paragraph><Seperator />@@ -68,9 +64,7 @@ export const Empty = ({fontSize={SIZE.md}accentColor="bg"accentText={- COLORS_NOTE[headerProps.color?.toLowerCase()]- ? headerProps.color- : 'accent'+ COLORS_NOTE[headerProps.color?.toLowerCase()] ? headerProps.color : 'accent'}/>) : loading ? (@@ -78,9 +72,7 @@ export const Empty = ({style={{height: 35}}- color={- COLORS_NOTE[headerProps.color?.toLowerCase()] || colors.accent- }+ color={COLORS_NOTE[headerProps.color?.toLowerCase()] || colors.accent}/>) : (<Viewdiff --git a/apps/mobile/src/components/SimpleList/footer.js b/apps/mobile/src/components/SimpleList/footer.jsindex 525238b6f..2c66c98a2 100644--- a/apps/mobile/src/components/SimpleList/footer.js+++ b/apps/mobile/src/components/SimpleList/footer.js@@ -1,6 +1,6 @@import React from 'react';-import {View} from 'react-native';+import { View } from 'react-native';export const Footer = () => {- return <View style={{height: 150}} />;+ return <View style={{ height: 150 }} />;};diff --git a/apps/mobile/src/components/SimpleList/header.js b/apps/mobile/src/components/SimpleList/header.jsindex 3004e6962..859b1353e 100644--- a/apps/mobile/src/components/SimpleList/header.js+++ b/apps/mobile/src/components/SimpleList/header.js@@ -26,7 +26,7 @@ export const Header = React.memo(height}) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const announcements = useMessageStore(state => state.announcements);return announcements.length !== 0 && !noAnnouncement ? (@@ -39,16 +39,16 @@ export const Header = React.memo(width: '100%',justifyContent: 'center',alignItems: 'center'- }}>- {messageCard ? (- <Card color={COLORS_NOTE[color?.toLowerCase()] || colors.accent} />- ) : null}+ }}+ >+ {messageCard ? <Card color={COLORS_NOTE[color?.toLowerCase()] || colors.accent} /> : null}</View>) : (<Viewstyle={{width: '100%'- }}>+ }}+ ><Viewstyle={{minHeight: height || 195,@@ -59,14 +59,16 @@ export const Header = React.memo(backgroundColor: COLORS_NOTE[color?.toLowerCase()]? hexToRGBA(COLORS_NOTE[color?.toLowerCase()], 0.15): color || colors.shade- }}>+ }}+ ><Viewstyle={{right: 0,paddingRight: 12,bottom: 0,position: 'absolute'- }}>+ }}+ ><Placeholdercolor={COLORS_NOTE[color?.toLowerCase()] || colors.accent}w={normalize(150)}@@ -78,10 +80,9 @@ export const Header = React.memo(<Viewstyle={{marginTop: 15- }}>- <Heading- style={{marginBottom: paragraph ? 0 : 0}}- size={SIZE.xxxl * 1.2}>+ }}+ >+ <Heading style={{ marginBottom: paragraph ? 0 : 0 }} size={SIZE.xxxl * 1.2}><Heading size={SIZE.xxxl * 1.2} color={colors.accent}>{title.slice(0, 1) === '#' ? '#' : null}</Heading>@@ -112,3 +113,5 @@ export const Header = React.memo();});++Header.displayName = 'Header';diff --git a/apps/mobile/src/components/SimpleList/index.js b/apps/mobile/src/components/SimpleList/index.jsindex 87dce63ec..bb96bfddb 100644--- a/apps/mobile/src/components/SimpleList/index.js+++ b/apps/mobile/src/components/SimpleList/index.js@@ -1,26 +1,21 @@-import React, {useEffect, useRef, useState} from 'react';-import {- FlatList,- RefreshControl,- RefreshControlComponent,- View-} from 'react-native';-import {notesnook} from '../../../e2e/test.ids';-import {useTracked} from '../../provider';-import {useUserStore} from '../../provider/stores';-import {eSendEvent} from '../../services/EventManager';+import React, { useEffect, useRef, useState } from 'react';+import { FlatList, RefreshControl, RefreshControlComponent, View } from 'react-native';+import { notesnook } from '../../../e2e/test.ids';+import { useTracked } from '../../provider';+import { useUserStore } from '../../provider/stores';+import { eSendEvent } from '../../services/EventManager';import Sync from '../../services/Sync';-import {db} from '../../utils/database';-import {eScrollEvent} from '../../utils/Events';-import {sleep} from '../../utils/TimeUtils';+import { db } from '../../utils/database';+import { eScrollEvent } from '../../utils/Events';+import { sleep } from '../../utils/TimeUtils';import JumpToDialog from '../JumpToDialog';-import {NotebookWrapper} from '../NotebookItem/wrapper';-import {NoteWrapper} from '../NoteItem/wrapper';+import { NotebookWrapper } from '../NotebookItem/wrapper';+import { NoteWrapper } from '../NoteItem/wrapper';import TagItem from '../TagItem';-import {Empty} from './empty';-import {Footer} from './footer';-import {Header} from './header';-import {SectionHeader} from './section-header';+import { Empty } from './empty';+import { Footer } from './footer';+import { Header } from './header';+import { SectionHeader } from './section-header';let renderItems = {note: NoteWrapper,@@ -31,12 +26,11 @@ let renderItems = {header: SectionHeader};-const RenderItem = ({item, index, type, ...restArgs}) => {+const RenderItem = ({ item, index, type, ...restArgs }) => {if (!item) return <View />;const Item = renderItems[item.itemType || item.type] || View;const groupOptions = db.settings?.getGroupOptions(type);- const dateBy =- groupOptions.sortBy !== 'title' ? groupOptions.sortBy : 'dateEdited';+ const dateBy = groupOptions.sortBy !== 'title' ? groupOptions.sortBy : 'dateEdited';let tags =item.tags@@ -52,16 +46,7 @@ const RenderItem = ({item, index, type, ...restArgs}) => {};}).filter(t => t !== null) || [];- return (- <Item- item={item}- tags={tags}- dateBy={dateBy}- index={index}- type={type}- {...restArgs}- />- );+ return <Item item={item} tags={tags} dateBy={dateBy} index={index} type={type} {...restArgs} />;};const SimpleList = ({@@ -77,7 +62,7 @@ const SimpleList = ({ListHeader}) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const scrollRef = useRef();const [_loading, _setLoading] = useState(true);const syncing = useUserStore(state => state.syncing);@@ -100,7 +85,7 @@ const SimpleList = ({}, [loading]);const renderItem = React.useCallback(- ({item, index}) => (+ ({ item, index }) => (<RenderItemitem={item}index={index}diff --git a/apps/mobile/src/components/SimpleList/notebookheader.js b/apps/mobile/src/components/SimpleList/notebookheader.jsindex c5d3233fd..4e889b4aa 100644--- a/apps/mobile/src/components/SimpleList/notebookheader.js+++ b/apps/mobile/src/components/SimpleList/notebookheader.js@@ -1,22 +1,20 @@-import React, {useState} from 'react';-import {Platform, View} from 'react-native';-import {useTracked} from '../../provider';-import {useMenuStore} from '../../provider/stores';-import {ToastEvent} from '../../services/EventManager';-import {getTotalNotes} from '../../utils';-import {db} from '../../utils/database';-import {SIZE} from '../../utils/SizeUtils';-import {ActionIcon} from '../ActionIcon';-import {Button} from '../Button';+import React, { useState } from 'react';+import { Platform, View } from 'react-native';+import { useTracked } from '../../provider';+import { useMenuStore } from '../../provider/stores';+import { ToastEvent } from '../../services/EventManager';+import { getTotalNotes } from '../../utils';+import { db } from '../../utils/database';+import { SIZE } from '../../utils/SizeUtils';+import { ActionIcon } from '../ActionIcon';+import { Button } from '../Button';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';-export const NotebookHeader = ({notebook, onPress, onEditNotebook}) => {+export const NotebookHeader = ({ notebook, onPress, onEditNotebook }) => {const [state] = useTracked();- const {colors} = state;- const [isPinnedToMenu, setIsPinnedToMenu] = useState(- db.settings.isPinned(notebook.id)- );+ const { colors } = state;+ const [isPinnedToMenu, setIsPinnedToMenu] = useState(db.settings.isPinned(notebook.id));const setMenuPins = useMenuStore(state => state.setMenuPins);const totalNotes = getTotalNotes(notebook);@@ -25,7 +23,7 @@ export const NotebookHeader = ({notebook, onPress, onEditNotebook}) => {if (isPinnedToMenu) {await db.settings.unpin(notebook.id);} else {- await db.settings.pin(notebook.type, {id: notebook.id});+ await db.settings.pin(notebook.type, { id: notebook.id });ToastEvent.show({heading: 'Shortcut created',type: 'success'@@ -47,7 +45,8 @@ export const NotebookHeader = ({notebook, onPress, onEditNotebook}) => {alignSelf: 'center',borderRadius: 10,paddingTop: 25- }}>+ }}+ ><Paragraph color={colors.icon} size={SIZE.xs}>{new Date(notebook.dateEdited).toLocaleString()}</Paragraph>@@ -56,13 +55,15 @@ export const NotebookHeader = ({notebook, onPress, onEditNotebook}) => {flexDirection: 'row',justifyContent: 'space-between',alignItems: 'center'- }}>+ }}+ ><Heading size={SIZE.xxl}>{notebook.title}</Heading><Viewstyle={{flexDirection: 'row'- }}>+ }}+ ><ActionIconname={isPinnedToMenu ? 'link-variant-off' : 'link-variant'}onPress={onPinNotebook}@@ -102,10 +103,10 @@ export const NotebookHeader = ({notebook, onPress, onEditNotebook}) => {fontFamily: null}}size={SIZE.xs}- color={colors.icon}>- {notebook.topics.length === 1- ? '1 topic'- : `${notebook.topics.length} topics`}, {notebook && totalNotes > 1+ color={colors.icon}+ >+ {notebook.topics.length === 1 ? '1 topic' : `${notebook.topics.length} topics`},{' '}+ {notebook && totalNotes > 1? totalNotes + ' notes': totalNotes === 1? totalNotes + ' note'diff --git a/apps/mobile/src/components/SimpleList/sectionheader.js b/apps/mobile/src/components/SimpleList/sectionheader.jsindex aff9e0ec9..76b2c5611 100644--- a/apps/mobile/src/components/SimpleList/sectionheader.js+++ b/apps/mobile/src/components/SimpleList/sectionheader.js@@ -1,7 +1,7 @@-import React, {useEffect, useState} from 'react';-import {TouchableOpacity, useWindowDimensions, View} from 'react-native';-import {useTracked} from '../../provider';-import {useSettingStore} from '../../provider/stores';+import React, { useEffect, useState } from 'react';+import { TouchableOpacity, useWindowDimensions, View } from 'react-native';+import { useTracked } from '../../provider';+import { useSettingStore } from '../../provider/stores';import {eSendEvent,eSubscribeEvent,@@ -9,37 +9,32 @@ import {presentSheet} from '../../services/EventManager';import SettingsService from '../../services/SettingsService';-import {GROUP} from '../../utils';-import {COLORS_NOTE} from '../../utils/Colors';-import {db} from '../../utils/database';-import {eOpenJumpToDialog} from '../../utils/Events';-import {SIZE} from '../../utils/SizeUtils';-import {ActionIcon} from '../ActionIcon';-import {Button} from '../Button';+import { GROUP } from '../../utils';+import { COLORS_NOTE } from '../../utils/Colors';+import { db } from '../../utils/database';+import { eOpenJumpToDialog } from '../../utils/Events';+import { SIZE } from '../../utils/SizeUtils';+import { ActionIcon } from '../ActionIcon';+import { Button } from '../Button';import Sort from '../Sort';import Heading from '../Typography/Heading';-export const SectionHeader = ({item, index, type, color, screen}) => {+export const SectionHeader = ({ item, index, type, color, screen }) => {const [state] = useTracked();- const {colors} = state;- const {fontScale} = useWindowDimensions();- const [groupOptions, setGroupOptions] = useState(- db.settings?.getGroupOptions(type)- );- let groupBy = Object.keys(GROUP).find(- key => GROUP[key] === groupOptions.groupBy- );+ const { colors } = state;+ const { fontScale } = useWindowDimensions();+ const [groupOptions, setGroupOptions] = useState(db.settings?.getGroupOptions(type));+ let groupBy = Object.keys(GROUP).find(key => GROUP[key] === groupOptions.groupBy);const settings = useSettingStore(state => state.settings);- const listMode =- type === 'notebooks' ? settings.notebooksListMode : settings.notesListMode;+ const listMode = type === 'notebooks' ? settings.notebooksListMode : settings.notesListMode;groupBy = !groupBy? 'Default': groupBy.slice(0, 1).toUpperCase() + groupBy.slice(1, groupBy.length);const onUpdate = () => {- setGroupOptions({...db.settings?.getGroupOptions(type)});+ setGroupOptions({ ...db.settings?.getGroupOptions(type) });};useEffect(() => {@@ -62,17 +57,19 @@ export const SectionHeader = ({item, index, type, color, screen}) => {alignSelf: 'center',borderRadius: 5,marginVertical: 5- }}>+ }}+ ><TouchableOpacityonPress={() => {eSendEvent(eOpenJumpToDialog, type);}}activeOpacity={0.9}- hitSlop={{top: 10, left: 10, right: 30, bottom: 15}}+ hitSlop={{ top: 10, left: 10, right: 30, bottom: 15 }}style={{height: '100%',justifyContent: 'center'- }}>+ }}+ ><Headingcolor={COLORS_NOTE[color?.toLowerCase()] || colors.accent}size={SIZE.sm}@@ -80,7 +77,8 @@ export const SectionHeader = ({item, index, type, color, screen}) => {minWidth: 60,alignSelf: 'center',textAlignVertical: 'center'- }}>+ }}+ >{!item.title || item.title === '' ? 'Pinned' : item.title}</Heading></TouchableOpacity>@@ -89,7 +87,8 @@ export const SectionHeader = ({item, index, type, color, screen}) => {style={{flexDirection: 'row',alignItems: 'center'- }}>+ }}+ >{index === 0 ? (<><Button@@ -99,20 +98,13 @@ export const SectionHeader = ({item, index, type, color, screen}) => {});}}title={groupBy}- icon={- groupOptions.sortDirection === 'asc'- ? 'sort-ascending'- : 'sort-descending'- }+ icon={groupOptions.sortDirection === 'asc' ? 'sort-ascending' : 'sort-descending'}height={25}style={{borderRadius: 100,paddingHorizontal: 0,backgroundColor: 'transparent',- marginRight:- type === 'notes' || type === 'home' || type === 'notebooks'- ? 10- : 0+ marginRight: type === 'notes' || type === 'home' || type === 'notebooks' ? 10 : 0}}type="gray"iconPosition="right"@@ -127,9 +119,7 @@ export const SectionHeader = ({item, index, type, color, screen}) => {name={listMode == 'compact' ? 'view-list' : 'view-list-outline'}onPress={() => {SettingsService.set(- type !== 'notebooks'- ? 'notesListMode'- : 'notebooksListMode',+ type !== 'notebooks' ? 'notesListMode' : 'notebooksListMode',listMode === 'normal' ? 'compact' : 'normal');}}diff --git a/apps/mobile/src/components/Sort/index.js b/apps/mobile/src/components/Sort/index.jsindex ca7219382..f2f4b4053 100644--- a/apps/mobile/src/components/Sort/index.js+++ b/apps/mobile/src/components/Sort/index.js@@ -1,26 +1,23 @@-import React, {useState} from 'react';-import {View} from 'react-native';-import {useTracked} from '../../provider';-import {eSendEvent} from '../../services/EventManager';+import React, { useState } from 'react';+import { View } from 'react-native';+import { useTracked } from '../../provider';+import { eSendEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';-import {GROUP, SORT} from '../../utils';-import {db} from '../../utils/database';-import {refreshNotesPage} from '../../utils/Events';+import { GROUP, SORT } from '../../utils';+import { db } from '../../utils/database';+import { refreshNotesPage } from '../../utils/Events';import layoutmanager from '../../utils/layout-manager';-import {SIZE} from '../../utils/SizeUtils';-import {Button} from '../Button';+import { SIZE } from '../../utils/SizeUtils';+import { Button } from '../Button';import Seperator from '../Seperator';import Heading from '../Typography/Heading';-const Sort = ({type, screen}) => {+const Sort = ({ type, screen }) => {const [state] = useTracked();const colors = state.colors;- const [groupOptions, setGroupOptions] = useState(- db.settings.getGroupOptions(type)- );+ const [groupOptions, setGroupOptions] = useState(db.settings.getGroupOptions(type));const updateGroupOptions = async _groupOptions => {-await db.settings.setGroupOptions(type, _groupOptions);layoutmanager.withSpringAnimation(600);@@ -46,19 +43,22 @@ const Sort = ({type, screen}) => {width: '100%',backgroundColor: colors.bg,justifyContent: 'space-between'- }}>+ }}+ ><Viewstyle={{flexDirection: 'row',alignItems: 'center',justifyContent: 'space-between',paddingHorizontal: 12- }}>+ }}+ ><Headingsize={SIZE.xl}style={{alignSelf: 'center'- }}>+ }}+ >Sort by</Heading>@@ -72,11 +72,7 @@ const Sort = ({type, screen}) => {? 'Z - A': 'New - Old'}- icon={- groupOptions.sortDirection === 'asc'- ? 'sort-ascending'- : 'sort-descending'- }+ icon={groupOptions.sortDirection === 'asc' ? 'sort-ascending' : 'sort-descending'}height={25}iconPosition="right"fontSize={SIZE.sm - 1}@@ -105,7 +101,8 @@ const Sort = ({type, screen}) => {paddingHorizontal: 12,paddingBottom: 12,alignItems: 'center'- }}>+ }}+ >{groupOptions.groupBy === 'abc' ? (<Buttontype={'grayBg'}@@ -113,7 +110,7 @@ const Sort = ({type, screen}) => {height={45}iconPosition="left"icon={'check'}- buttonType={{text: colors.accent}}+ buttonType={{ text: colors.accent }}fontSize={SIZE.sm}iconSize={SIZE.md}/>@@ -151,7 +148,8 @@ const Sort = ({type, screen}) => {style={{marginLeft: 12}}- size={SIZE.lg}>+ size={SIZE.lg}+ >Group by</Heading>@@ -159,22 +157,19 @@ const Sort = ({type, screen}) => {<Viewstyle={{- paddingHorizontal: 0,borderRadius: 0,flexDirection: 'row',flexWrap: 'wrap',paddingHorizontal: 12- }}>+ }}+ >{Object.keys(GROUP).map((item, index) => (<Buttonkey={item}testID={'btn-' + item}type={groupOptions.groupBy === GROUP[item] ? 'grayBg' : 'gray'}buttonType={{- text:- groupOptions.groupBy === GROUP[item]- ? colors.accent- : colors.icon+ text: groupOptions.groupBy === GROUP[item] ? colors.accent : colors.icon}}onPress={async () => {let _groupOptions = {diff --git a/apps/mobile/src/components/SplashScreen/index.js b/apps/mobile/src/components/SplashScreen/index.jsindex b4a7c0c4c..fe1338703 100644--- a/apps/mobile/src/components/SplashScreen/index.js+++ b/apps/mobile/src/components/SplashScreen/index.js@@ -1,16 +1,16 @@-import React, {useEffect, useRef, useState} from 'react';-import {Dimensions, Image, View} from 'react-native';-import Animated, {Easing, timing, useValue} from 'react-native-reanimated';-import {SafeAreaView} from 'react-native-safe-area-context';-import {useTracked} from '../../provider';-import {useSettingStore} from '../../provider/stores';-import {dHeight, getElevation} from '../../utils';-import {MMKV} from '../../utils/mmkv';-import {SIZE} from '../../utils/SizeUtils';-import {sleep} from '../../utils/TimeUtils';+import React, { useEffect, useRef, useState } from 'react';+import { Dimensions, Image, View } from 'react-native';+import Animated, { Easing, timing, useValue } from 'react-native-reanimated';+import { SafeAreaView } from 'react-native-safe-area-context';+import { useTracked } from '../../provider';+import { useSettingStore } from '../../provider/stores';+import { dHeight, getElevation } from '../../utils';+import { MMKV } from '../../utils/mmkv';+import { SIZE } from '../../utils/SizeUtils';+import { sleep } from '../../utils/TimeUtils';import umami from '../../utils/umami';-import {Button} from '../Button';-import {SvgToPngView} from '../ListPlaceholders';+import { Button } from '../Button';+import { SvgToPngView } from '../ListPlaceholders';import MovableView from '../Transitions/movableview';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';@@ -21,7 +21,7 @@ const SVG_Z = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 245.487 113.const SplashScreen = () => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const isIntroCompleted = false; //useSettingStore(state => state.isIntroCompleted);const setIntroCompleted = useSettingStore(state => state.setIntroCompleted);const opacity = useValue(0);@@ -71,20 +71,23 @@ const SplashScreen = () => {translateY: translateY2}]- }}>+ }}+ ><SafeAreaViewstyle={{width: '100%',height: '100%',marginTop: 25- }}>+ }}+ ><Viewstyle={{width: '100%',height: '100%',justifyContent: 'center',alignItems: 'center'- }}>+ }}+ ><Imagesource={require('../../assets/images/notesnook-logo-png.png')}style={{@@ -100,7 +103,8 @@ const SplashScreen = () => {alignItems: 'center',justifyContent: 'center',marginBottom: 75- }}>+ }}+ ><SvgToPngView width={200} height={200} src={SVG_D} /><Viewstyle={{@@ -108,12 +112,12 @@ const SplashScreen = () => {marginBottom: 20,maxWidth: '80%',opacity: 0.8- }}>+ }}+ ><Heading>Safe & encrypted notes</Heading><Paragraph- size={- SIZE.md + 4- }>{`Write with freedom.\nNever compromise on\nprivacy again.`}</Paragraph>+ size={SIZE.md + 4}+ >{`Write with freedom.\nNever compromise on\nprivacy again.`}</Paragraph></View></View>@@ -123,7 +127,8 @@ const SplashScreen = () => {zIndex: 20,position: 'absolute',bottom: 80- }}>+ }}+ ><ButtonfontSize={SIZE.md}height={45}@@ -149,7 +154,8 @@ const SplashScreen = () => {position: 'absolute',bottom: -100,zIndex: -1- }}>+ }}+ ><SvgToPngViewwidth={Dimensions.get('window').width}height={Dimensions.get('window').width}diff --git a/apps/mobile/src/components/TagItem/index.js b/apps/mobile/src/components/TagItem/index.jsindex befe14e80..f8eafb12e 100644--- a/apps/mobile/src/components/TagItem/index.js+++ b/apps/mobile/src/components/TagItem/index.js@@ -1,24 +1,23 @@-import React, {useEffect} from 'react';-import {useWindowDimensions, View} from 'react-native';-import {notesnook} from '../../../e2e/test.ids';-import {PressableButton} from '../../components/PressableButton';-import {useTracked} from '../../provider';-import {eSendEvent} from '../../services/EventManager';+import React from 'react';+import { useWindowDimensions, View } from 'react-native';+import { notesnook } from '../../../e2e/test.ids';+import { PressableButton } from '../../components/PressableButton';+import { useTracked } from '../../provider';+import { eSendEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';-import {db} from '../../utils/database';-import {refreshNotesPage} from '../../utils/Events';-import {SIZE} from '../../utils/SizeUtils';-import {ActionIcon} from '../ActionIcon';-import {ActionSheetEvent} from '../DialogManager/recievers';+import { db } from '../../utils/database';+import { refreshNotesPage } from '../../utils/Events';+import { SIZE } from '../../utils/SizeUtils';+import { ActionIcon } from '../ActionIcon';import { Properties } from '../Properties';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';const TagItem = React.memo(- ({item, index}) => {+ ({ item, index }) => {const [state] = useTracked();- const {colors} = state;- const {fontScale} = useWindowDimensions();+ const { colors } = state;+ const { fontScale } = useWindowDimensions();const onPress = () => {let params = {...item,@@ -44,21 +43,24 @@ const TagItem = React.memo(customStyle={{paddingHorizontal: 12,flexDirection: 'row',- paddingVertical:12,+ paddingVertical: 12,alignItems: 'center',width: '100%',justifyContent: 'space-between'- }}>+ }}+ ><Viewstyle={{maxWidth: '92%'- }}>+ }}+ ><Heading size={SIZE.md}><Headingsize={SIZE.md}style={{color: colors.accent- }}>+ }}+ >#</Heading>{db.tags.alias(item.id)}@@ -68,7 +70,8 @@ const TagItem = React.memo(size={SIZE.xs}style={{marginTop: 5- }}>+ }}+ >{item && item.noteIds.length && item.noteIds.length > 1? item.noteIds.length + ' notes': item.noteIds.length === 1@@ -108,4 +111,6 @@ const TagItem = React.memo(});+TagItem.displayName = 'TagItem';+export default TagItem;diff --git a/apps/mobile/src/components/TagsDialog/index.js b/apps/mobile/src/components/TagsDialog/index.jsindex 8ec9b91ed..b844eef3c 100644--- a/apps/mobile/src/components/TagsDialog/index.js+++ b/apps/mobile/src/components/TagsDialog/index.js@@ -1,16 +1,16 @@-import React, {useEffect, useRef, useState} from 'react';-import {ScrollView, View} from 'react-native';+import React, { useEffect, useRef, useState } from 'react';+import { ScrollView, View } from 'react-native';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {useTracked} from '../../provider';-import {useTagStore} from '../../provider/stores';-import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';+import { useTracked } from '../../provider';+import { useTagStore } from '../../provider/stores';+import { eSubscribeEvent, eUnSubscribeEvent, ToastEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';-import {db} from '../../utils/database';-import {eCloseTagsDialog, eOpenTagsDialog} from '../../utils/Events';-import {SIZE} from '../../utils/SizeUtils';-import {sleep} from '../../utils/TimeUtils';+import { db } from '../../utils/database';+import { eCloseTagsDialog, eOpenTagsDialog } from '../../utils/Events';+import { SIZE } from '../../utils/SizeUtils';+import { sleep } from '../../utils/TimeUtils';import Input from '../Input';-import {PressableButton} from '../PressableButton';+import { PressableButton } from '../PressableButton';import SheetWrapper from '../Sheet';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';@@ -36,10 +36,10 @@ const TagsDialog = () => {useEffect(() => {if (visible) {- console.log('sorting tags')- sortTags();+ console.log('sorting tags');+ sortTags();}- }, [allTags, note, query,visible]);+ }, [allTags, note, query, visible]);const sortTags = () => {let _tags = [...allTags];@@ -54,7 +54,7 @@ const TagsDialog = () => {return;}let noteTags = [];- for (tag of note.tags) {+ for (let tag of note.tags) {let index = _tags.findIndex(t => t.title === tag);if (index !== -1) {noteTags.push(_tags[index]);@@ -96,7 +96,7 @@ const TagsDialog = () => {}let tag = _query;- setNote({...note, tags: note.tags ? [...note.tags, tag] : [tag]});+ setNote({ ...note, tags: note.tags ? [...note.tags, tag] : [tag] });setQuery(null);inputRef.current?.setNativeProps({text: ''@@ -132,14 +132,16 @@ const TagsDialog = () => {onClose={async () => {setQuery(null);setVisible(false);- }}>+ }}+ ><Viewstyle={{width: '100%',alignSelf: 'center',paddingHorizontal: 12,minHeight: '60%'- }}>+ }}+ ><Inputbutton={{icon: 'magnify',@@ -164,7 +166,8 @@ const TagsDialog = () => {keyboardShouldPersistTaps="always"onMomentumScrollEnd={() => {actionSheetRef.current?.handleChildScrollEnd();- }}>+ }}+ >{query && query !== tags[0]?.title ? (<PressableButtonkey={'query_item'}@@ -175,9 +178,10 @@ const TagsDialog = () => {padding: 12}}onPress={onSubmit}- type="accent">+ type="accent"+ ><Heading size={SIZE.sm} color={colors.light}>- Add "{'#' + query}"+ Add {`"` + '#' + query + `"`}</Heading><Icon name="plus" color={colors.light} size={SIZE.lg} /></PressableButton>@@ -189,7 +193,8 @@ const TagsDialog = () => {height: 200,justifyContent: 'center',alignItems: 'center'- }}>+ }}+ ><Heading size={50} color={colors.icon}>#</Heading>@@ -200,12 +205,7 @@ const TagsDialog = () => {) : null}{tags.map(item => (- <TagItem- key={item.title}- tag={item}- note={note}- setNote={setNote}- />+ <TagItem key={item.title} tag={item} note={note} setNote={setNote} />))}</ScrollView></View>@@ -215,17 +215,15 @@ const TagsDialog = () => {export default TagsDialog;-const TagItem = ({tag, note, setNote}) => {+const TagItem = ({ tag, note, setNote }) => {const [state] = useTracked();const colors = state.colors;const onPress = async () => {- let prevNote = {...note};+ let prevNote = { ...note };try {if (prevNote.tags.indexOf(tag.title) !== -1) {- await db.notes- .note(note.id)- .untag(prevNote.tags[prevNote.tags.indexOf(tag.title)]);+ await db.notes.note(note.id).untag(prevNote.tags[prevNote.tags.indexOf(tag.title)]);} else {await db.notes.note(note.id).tag(tag.title);}@@ -250,30 +248,20 @@ const TagItem = ({tag, note, setNote}) => {padding: 12}}onPress={onPress}- type={- note && note.tags.findIndex(t => t === tag.title) !== -1- ? 'shade'- : 'grayBg'- }>+ type={note && note.tags.findIndex(t => t === tag.title) !== -1 ? 'shade' : 'grayBg'}+ ><Headingsize={SIZE.sm}color={- note && note?.tags.findIndex(t => t === tag.title) !== -1- ? colors.accent- : colors.pri- }>+ note && note?.tags.findIndex(t => t === tag.title) !== -1 ? colors.accent : colors.pri+ }+ >{'#' + tag.title}</Heading><Icon- name={- note && note?.tags.findIndex(t => t === tag.title) !== -1- ? 'minus'- : 'plus'- }+ name={note && note?.tags.findIndex(t => t === tag.title) !== -1 ? 'minus' : 'plus'}color={- note && note?.tags.findIndex(t => t === tag.title) !== -1- ? colors.accent- : colors.accent+ note && note?.tags.findIndex(t => t === tag.title) !== -1 ? colors.accent : colors.accent}size={SIZE.lg}/>diff --git a/apps/mobile/src/components/Toast/index.js b/apps/mobile/src/components/Toast/index.jsindex d60b61aad..560551262 100644--- a/apps/mobile/src/components/Toast/index.js+++ b/apps/mobile/src/components/Toast/index.js@@ -1,23 +1,23 @@-import React, {useEffect, useRef, useState} from 'react';-import {Keyboard, View} from 'react-native';-import Animated, {Easing, useValue} from 'react-native-reanimated';-import {useSafeAreaInsets} from 'react-native-safe-area-context';+import React, { useEffect, useRef, useState } from 'react';+import { Keyboard, View } from 'react-native';+import Animated, { Easing, useValue } from 'react-native-reanimated';+import { useSafeAreaInsets } from 'react-native-safe-area-context';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {notesnook} from '../../../e2e/test.ids';-import {useTracked} from '../../provider';-import {DDS} from '../../services/DeviceDetection';-import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';-import {dHeight, getElevation} from '../../utils';-import {eHideToast, eShowToast} from '../../utils/Events';-import {SIZE} from '../../utils/SizeUtils';-import {sleep} from '../../utils/TimeUtils';-import {Button} from '../Button';+import { notesnook } from '../../../e2e/test.ids';+import { useTracked } from '../../provider';+import { DDS } from '../../services/DeviceDetection';+import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';+import { dHeight, getElevation } from '../../utils';+import { eHideToast, eShowToast } from '../../utils/Events';+import { SIZE } from '../../utils/SizeUtils';+import { sleep } from '../../utils/TimeUtils';+import { Button } from '../Button';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';-const {timing} = Animated;+const { timing } = Animated;let toastMessages = [];-export const Toast = ({context = 'global'}) => {+export const Toast = ({ context = 'global' }) => {const [state, dispatch] = useTracked();const colors = state.colors;const [keyboard, setKeyboard] = useState(false);@@ -181,7 +181,8 @@ export const Toast = ({context = 'global'}) => {translateY: toastTranslate}]- }}>+ }}+ ><Animated.ViewactiveOpacity={0.8}style={{@@ -201,14 +202,16 @@ export const Toast = ({context = 'global'}) => {flexDirection: 'row',alignItems: 'center',width: '95%'- }}>+ }}+ ><Viewstyle={{flexDirection: 'row',alignItems: 'center',flexGrow: 1,flex: 1- }}>+ }}+ ><Viewstyle={{height: 30,@@ -216,7 +219,8 @@ export const Toast = ({context = 'global'}) => {justifyContent: 'center',alignItems: 'center',marginRight: 10- }}>+ }}+ ><Iconname={data?.type === 'success' ? 'check' : 'close'}size={SIZE.lg}@@ -228,14 +232,16 @@ export const Toast = ({context = 'global'}) => {style={{flexGrow: 1,paddingRight: 25- }}>+ }}+ >{data?.heading ? (<Headingcolor={colors.pri}size={SIZE.md}onPress={() => {hideToastFunc();- }}>+ }}+ >{data.heading}</Heading>) : null}@@ -249,7 +255,8 @@ export const Toast = ({context = 'global'}) => {}}onPress={() => {hideToastFunc();- }}>+ }}+ >{data.message}</Paragraph>) : null}diff --git a/apps/mobile/src/components/Transitions/bouncingview.js b/apps/mobile/src/components/Transitions/bouncingview.jsindex 097bf494e..8477fd155 100644--- a/apps/mobile/src/components/Transitions/bouncingview.js+++ b/apps/mobile/src/components/Transitions/bouncingview.js@@ -1,5 +1,5 @@-import React, {useEffect, useState} from 'react';-import Animated, {Easing, timing} from 'react-native-reanimated';+import React, { useEffect, useState } from 'react';+import Animated, { Easing, timing } from 'react-native-reanimated';export const BouncingView = ({children,@@ -35,7 +35,8 @@ export const BouncingView = ({]},style- ]}>+ ]}+ >{children}</Animated.View>);diff --git a/apps/mobile/src/components/Transitions/movableview.js b/apps/mobile/src/components/Transitions/movableview.jsindex f15dbc272..d561507cb 100644--- a/apps/mobile/src/components/Transitions/movableview.js+++ b/apps/mobile/src/components/Transitions/movableview.js@@ -1,6 +1,6 @@-import React, {Component} from 'react';-import {PanResponder} from 'react-native';-import Animated, {Easing} from 'react-native-reanimated';+import React, { Component } from 'react';+import { PanResponder } from 'react-native';+import Animated, { Easing } from 'react-native-reanimated';export default class MovableView extends Component {constructor(props) {@@ -26,8 +26,10 @@ export default class MovableView extends Component {this.props.onDragStart();},onPanResponderMove: (event, state) => {- this.state.panX.setValue(state.dx);- this.state.panY.setValue(state.dy);+ if (this.props.movable) {+ this.state.panX.setValue(state.dx);+ this.state.panY.setValue(state.dy);+ }},onPanResponderRelease: () => {Animated.timing(this.state.panX, {@@ -55,13 +57,13 @@ export default class MovableView extends Component {});}- componentWillMount() {+ componentDidMount() {if (typeof this.props.onMove === 'function')this.state.pan.addListener(values => this.props.onMove(values));if (this.props.breath) {let value = 0;setInterval(() => {- value = value === 1 ? 1.02 : 1;+ value = value === 1 ? 1.03 : 1;Animated.timing(this.state.scale, {toValue: value,duration: this.props.breathDuration | 1000,@@ -72,7 +74,9 @@ export default class MovableView extends Component {}changeDisableStatus = () => {- this.state.disabled = !this.state.disabled;+ this.setState({+ disabled: !this.state.disabled+ });};render() {@@ -94,7 +98,8 @@ export default class MovableView extends Component {}]}- ]}>+ ]}+ >{this.props.children}</Animated.View>);diff --git a/apps/mobile/src/components/Typography/Heading.js b/apps/mobile/src/components/Typography/Heading.jsindex 2daf4f20e..43affe410 100644--- a/apps/mobile/src/components/Typography/Heading.js+++ b/apps/mobile/src/components/Typography/Heading.js@@ -15,9 +15,9 @@ import { SIZE } from '../../utils/SizeUtils';** @param {TextType | restTypes} props all props*/-const Heading = ({color, size = SIZE.xl, style, ...restProps}) => {+const Heading = ({ color, size = SIZE.xl, style, ...restProps }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;return (<Text@@ -28,11 +28,12 @@ const Heading = ({color, size = SIZE.xl, style, ...restProps}) => {{fontSize: size || SIZE.xl,color: color || colors.heading,- fontFamily:Platform.OS === "android" ? "OpenSans-SemiBold" : null,- fontWeight:Platform.OS === "ios" ? "600" : null+ fontFamily: Platform.OS === 'android' ? 'OpenSans-SemiBold' : null,+ fontWeight: Platform.OS === 'ios' ? '600' : null},- style,- ]}></Text>+ style+ ]}+ ></Text>);};diff --git a/apps/mobile/src/components/Typography/Paragraph.js b/apps/mobile/src/components/Typography/Paragraph.jsindex c73d2bef0..9e6a952d2 100644--- a/apps/mobile/src/components/Typography/Paragraph.js+++ b/apps/mobile/src/components/Typography/Paragraph.js@@ -14,9 +14,9 @@ import { SIZE } from '../../utils/SizeUtils';** @param {TextType | restTypes} props all props*/-const Paragraph = ({color, size = SIZE.sm, style, ...restProps}) => {+const Paragraph = ({ color, size = SIZE.sm, style, ...restProps }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;return (<Text@@ -28,12 +28,11 @@ const Paragraph = ({color, size = SIZE.sm, style, ...restProps}) => {fontSize: size || SIZE.sm,color: color || colors.pri,fontWeight: '400',- fontFamily:"OpenSans-Regular"+ fontFamily: 'OpenSans-Regular'},- style,- ]}>-- </Text>+ style+ ]}+ ></Text>);};diff --git a/apps/mobile/src/components/Update/index.js b/apps/mobile/src/components/Update/index.jsindex e3968c743..23f338aa6 100644--- a/apps/mobile/src/components/Update/index.js+++ b/apps/mobile/src/components/Update/index.js@@ -1,11 +1,11 @@import React from 'react';-import {Linking, View} from 'react-native';-import {ScrollView} from 'react-native-gesture-handler';-import {useTracked} from '../../provider';-import {STORE_LINK} from '../../utils';-import {SIZE} from '../../utils/SizeUtils';-import {Button} from '../Button';-import {SvgToPngView} from '../ListPlaceholders';+import { Linking, View } from 'react-native';+import { ScrollView } from 'react-native-gesture-handler';+import { useTracked } from '../../provider';+import { STORE_LINK } from '../../utils';+import { SIZE } from '../../utils/SizeUtils';+import { Button } from '../Button';+import { SvgToPngView } from '../ListPlaceholders';import Seperator from '../Seperator';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';@@ -13,7 +13,7 @@ import Paragraph from '../Typography/Paragraph';const UPDATE_SVG = color =>`<svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="774" height="669.5" viewBox="0 0 774 669.5" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M938.2145,322.3829C936.73266,207.5841,878.16775,115.25,806.13079,115.25c-43.29082,0-81.71777,33.346-105.81477,84.87331l28.33157,71.08654-39.15446-43.81576c-9.876,29.64743-15.48115,63.49569-15.48115,99.44475a324.20917,324.20917,0,0,0,9.98686,80.80891l75.92761-12.24058-67.9507,37.99628c22.13728,60.69069,62.59851,102.1414,109.23586,104.87608l-8.988,244.5184,27.81449.99338-5.94527-245.75716c66.41162-6.32443,119.60967-91.20375,123.8712-197.42794l-45.89372-25.66252Z" transform="translate(-213 -115.25)" fill="#f0f0f0"/><rect x="157.51532" y="354.40187" width="6.60151" height="49.25266" fill="${color}"/><polygon points="187.815 376.276 182.98 380.779 160.823 356.936 138.658 380.779 133.823 376.276 160.823 347.243 187.815 376.276" fill="${color}"/><path d="M371.9876,543.6602a52.8121,52.8121,0,1,1,52.8121-52.81209A52.87183,52.87183,0,0,1,371.9876,543.6602Zm0-99.02268a46.21059,46.21059,0,1,0,46.21058,46.21059A46.26275,46.26275,0,0,0,371.9876,444.63752Z" transform="translate(-213 -115.25)" fill="${color}"/><rect x="212.75248" y="253.9314" width="3.63974" height="27.15545" fill="#e4e4e4"/><polygon points="229.458 265.992 226.793 268.475 214.576 255.328 202.356 268.475 199.69 265.992 214.576 249.984 229.458 265.992" fill="#e4e4e4"/><path d="M426.56422,409.9859a29.118,29.118,0,1,1,29.118-29.118A29.15089,29.15089,0,0,1,426.56422,409.9859Zm0-54.59616A25.47821,25.47821,0,1,0,452.04243,380.868,25.507,25.507,0,0,0,426.56422,355.38974Z" transform="translate(-213 -115.25)" fill="#e4e4e4"/><rect x="99.52274" y="186.73872" width="3.63974" height="27.15545" fill="#e4e4e4"/><polygon points="116.229 198.799 113.563 201.282 101.346 188.136 89.126 201.282 86.46 198.799 101.346 182.792 116.229 198.799" fill="#e4e4e4"/><path d="M313.33448,342.79321a29.118,29.118,0,1,1,29.118-29.118A29.15088,29.15088,0,0,1,313.33448,342.79321Zm0-54.59615a25.47821,25.47821,0,1,0,25.47821,25.4782A25.507,25.507,0,0,0,313.33448,288.19706Z" transform="translate(-213 -115.25)" fill="#e4e4e4"/><path d="M518.7325,635.91942a8.22484,8.22484,0,0,1,.958-12.302,9.56322,9.56322,0,0,1,1.26081-.83521l-6.99347-30.13439,16.26512,5.84042,4.14749,27.72073a8.21849,8.21849,0,0,1-2.21462,10.58849A10.12952,10.12952,0,0,1,518.7325,635.91942Z" transform="translate(-213 -115.25)" fill="#ffb8b8"/><path d="M516.88531,612.40706l-.08727-.29605c-8.79267-29.805-17.88169-60.6154-28.97824-94.16236l-.0728-.21977.2448-.13088c6.18493-3.30762,15.48114-3.08736,21.62358.51183,5.68293,3.33,8.55569,9.77159,7.0024,15.68347l8.09328,38.67327c3.29039,12.64158,6.69574,25.72668,9.95036,38.62892l.09229.36576-.504.0295c-5.92592.34536-12.04821.70254-16.95322.89973Z" transform="translate(-213 -115.25)" fill="#ccc"/><polygon points="229.16 657.57 217.627 657.57 212.138 616.801 229.16 616.801 229.16 657.57" fill="#ffb8b8"/><path d="M445.10175,783.06559H407.9141v-.43107c0-7.31472,6.49345-13.26551,14.47493-13.26551h22.71272Z" transform="translate(-213 -115.25)" fill="#2f2e41"/><polygon points="337.837 648.851 326.848 652.06 308.113 614.743 324.331 610.006 337.837 648.851" fill="#ffb8b8"/><path d="M521.60173,783.39141l-.14262-.41086c-2.42325-6.96953,1.79234-14.4459,9.39693-16.66692l21.64062-6.31955,4.53736,13.05Z" transform="translate(-213 -115.25)" fill="#2f2e41"/><ellipse cx="279.46347" cy="354.21043" rx="23.10522" ry="21.17504" fill="#ffb8b8"/><path d="M502.83713,465.536c.13132-8.54065-3.76885-16.99907-9.79916-21.25171a16.77762,16.77762,0,0,0-19.87954.322c-5.937,4.44645-9.65428,13.02823-9.33974,21.56167C477.12124,466.20257,490.42379,466.23726,502.83713,465.536Z" transform="translate(-213 -115.25)" fill="#2f2e41"/><path d="M448.74454,759.69687l-.46255-.04125c-10.03358-.90255-20.40891-1.83457-30.21419-1.9415l-.5333-.00589.07281-.48411c2.32311-15.42,3.30793-31.45044,4.26037-46.9538.9405-15.308,1.91269-31.13682,4.17769-46.17039.95818-4.0257,1.892-8.00342,2.82264-11.96682,7.70037-32.79837,14.97378-63.77816,29.98728-94.44433l.14194-.28963.34381.03789c14.08679,1.56221,27.62283,6.27241,38.11391,13.26256l.20326.13513-.00988.23027a131.25944,131.25944,0,0,0-.10174,14.17269,44.82523,44.82523,0,0,1,7.48241,42.489c4.13084,12.65215,8.40154,25.73075,12.75907,38.63212,10.5818,26.587,21.53153,54.10056,32.75594,81.99045l.1842.45717-.51791.11114c-8.07587,1.73775-16.40668,3.52938-24.62518,4.22482l-.31028.0261-.14745-.25174a587.30717,587.30717,0,0,1-50.88262-112.12662c-2.80473,7.83882-6.84508,14.91443-10.75934,21.76819a157.11556,157.11556,0,0,0-9.86087,19.31354c-1.73239,13.0365-2.192,27.16078-2.63591,40.81947-.42007,12.91442-.81671,25.11236-2.19312,36.582Z" transform="translate(-213 -115.25)" fill="#2f2e41"/><path d="M484.57528,444.67592c10.01507-1.97751,21.093-.09617,28.95819,6.09651s11.85919,16.9058,8.62805,26.09364-14.20114,15.65236-24.12,13.27969c2.84131-7.33881-.35623-16.34918-7.302-20.57639C482.50242,464.55626,480.23475,452.58775,484.57528,444.67592Z" transform="translate(-213 -115.25)" fill="#2f2e41"/><path d="M496.73471,571.62025l-.36633-.15281c-12.77629-5.34207-25.30408-9.441-37.04181-13.18089l-.35989-.07114-.00092-.95644.23358.07451c.04915-.09935.1045-.21217.16008-.32456.16031-.325.26963-.54642.36264-.69292l-.00252-.00126c.97862-1.82742,1.75651-3.59337,2.50868-5.30123.77628-1.76259,1.5776-3.58243,2.61295-5.50793a15.68833,15.68833,0,0,1-4.02289-17.95719c2.593-5.63211,9.20424-10.01859,16.15083-10.74644,2.54543-6.42185,8.21712-19.91552,8.21712-19.91552s11.92674-.30015,16.72316-.85793l.08062-.00926.07923.016c10.4711,2.10273,19.213,11.1834,21.25846,22.08265,1.72665,9.199-.89525,19.721-7.38227,29.62807A128.7532,128.7532,0,0,1,504.93,561.61682c-2.92186,3.34837-5.68157,6.51067-7.97367,9.69571Z" transform="translate(-213 -115.25)" fill="#ccc"/><path d="M519.3919,459.10521v0Z" transform="translate(-213 -115.25)" fill="#2f2e41"/><path d="M519.861,457.22412c-7.01076-.95907-12.51527-7.52688-11.71835-13.982s7.76344-11.72977,14.83079-11.22907,13.06654,6.694,12.77147,13.18459S528.81221,458.44864,519.861,457.22412Z" transform="translate(-213 -115.25)" fill="#2f2e41"/><path d="M518.76646,453.03852c-7.01067-.95906-12.51516-7.52688-11.71821-13.98194.54524-4.41578,3.9788-8.27657,8.35539-10.11667-5.65378,1.13408-10.51956,5.64916-11.17757,10.97881-.79695,6.45506,4.70754,13.02288,11.71821,13.98195a14.465,14.465,0,0,0,7.6875-.98538A14.866,14.866,0,0,1,518.76646,453.03852Z" transform="translate(-213 -115.25)" fill="#2f2e41"/><path d="M382.77632,566.82181a9.99626,9.99626,0,0,1,12.97554-3.271,9.61149,9.61149,0,0,1,1.27935.81118l28.67233-16.08336-.58936,16.00057-27.13738,12.82a10.15042,10.15042,0,0,1-11.63139,1.61428A8.34216,8.34216,0,0,1,382.77632,566.82181Z" transform="translate(-213 -115.25)" fill="#ffb8b8"/><path d="M406.35053,557.3917l.2755-.17406c27.73394-17.52829,56.40359-35.64765,87.2197-56.41349l.20185-.13613.21621.16792c5.46363,4.24233,8.33439,12.34854,6.67808,18.85539-1.5324,6.02009-7.20243,10.64869-13.80215,11.27624L450.049,550.84631c-11.90943,7.05521-24.23685,14.35751-36.42636,21.46865l-.34555.20162-.19828-.42571c-2.32974-5.0055-4.73707-10.17674-6.57422-14.34943Z" transform="translate(-213 -115.25)" fill="#ccc"/><path d="M986,784.75H214a1,1,0,0,1,0-2H986a1,1,0,0,1,0,2Z" transform="translate(-213 -115.25)" fill="#cacaca"/></svg>`;-export const Update = ({version, fwdRef}) => {+export const Update = ({ version, fwdRef }) => {const [state] = useTracked();const colors = state.colors;let notes = version.notes@@ -28,7 +28,8 @@ export const Update = ({version, fwdRef}) => {alignItems: 'center',width: '100%',paddingHorizontal: 12- }}>+ }}+ ><Viewstyle={{flexDirection: 'row',@@ -38,17 +39,14 @@ export const Update = ({version, fwdRef}) => {backgroundColor: colors.nav,borderRadius: 10,padding: 12- }}>+ }}+ ><View><Heading>Update available</Heading><Paragraph>v{version.version} has been released</Paragraph></View>- <SvgToPngView- src={UPDATE_SVG(colors.accent)}- width={100}- height={100}- />+ <SvgToPngView src={UPDATE_SVG(colors.accent)} width={100} height={100} /></View><Seperator />@@ -60,14 +58,17 @@ export const Update = ({version, fwdRef}) => {style={{width: '100%',maxHeight: 500- }}>+ }}+ ><Heading size={SIZE.md}>Release notes:</Heading>{notes.map(item => (<Paragraph+ key={item}color={colors.icon}style={{marginBottom: 5- }}>+ }}+ >• {item}</Paragraph>))}diff --git a/apps/mobile/src/components/VaultDialog/index.js b/apps/mobile/src/components/VaultDialog/index.jsindex c1246f64a..d68b5a061 100644--- a/apps/mobile/src/components/VaultDialog/index.js+++ b/apps/mobile/src/components/VaultDialog/index.js@@ -8,7 +8,8 @@ import { DDS } from '../../services/DeviceDetection';import {eSendEvent,eSubscribeEvent,- eUnSubscribeEvent, ToastEvent+ eUnSubscribeEvent,+ ToastEvent} from '../../services/EventManager';import Navigation from '../../services/Navigation';import { getElevation, toTXT } from '../../utils';@@ -379,8 +380,7 @@ export class VaultDialog extends Component {async _lockNote() {if (!this.password || this.password.trim() === 0) {ToastEvent.show({- message: 'Incorrect password',- message: 'Please enter the correct password and try again',+ heading: 'Incorrect password',type: 'error',context: 'local'});@@ -474,8 +474,7 @@ export class VaultDialog extends Component {} catch (e) {ToastEvent.show({heading: 'Incorrect password',- message:- 'Please enter the correct vault password to enable biometrics.',+ message: 'Please enter the correct vault password to enable biometrics.',type: 'error',context: 'local'});@@ -571,10 +570,7 @@ export class VaultDialog extends Component {}_takeErrorAction(e) {- if (- e.message === db.vault.ERRORS.wrongPassword ||- e.message === 'FAILURE'- ) {+ if (e.message === db.vault.ERRORS.wrongPassword || e.message === 'FAILURE') {this.setState({wrongPassword: true,visible: true@@ -631,7 +627,7 @@ export class VaultDialog extends Component {};render() {- const {colors} = this.props;+ const { colors } = this.props;const {note,visible,@@ -661,7 +657,8 @@ export class VaultDialog extends Component {}}statusBarTranslucent={false}onRequestClose={this.close}- visible={true}>+ visible={true}+ ><Viewstyle={{...getElevation(5),@@ -669,7 +666,8 @@ export class VaultDialog extends Component {borderRadius: 10,backgroundColor: colors.bg,paddingTop: 12- }}>+ }}+ ><DialogHeadertitle={this.state.title}paragraph={this.state.description}@@ -681,11 +679,9 @@ export class VaultDialog extends Component {<Viewstyle={{paddingHorizontal: 12- }}>- {(novault ||- changePassword ||- this.state.clearVault ||- this.state.deleteVault) &&+ }}+ >+ {(novault || changePassword || this.state.clearVault || this.state.deleteVault) &&!this.state.revokeFingerprintAccess ? (<><Input@@ -705,9 +701,7 @@ export class VaultDialog extends Component {: 10}onSubmit={() => {- changePassword- ? changePassInputRef.current?.focus()- : this.onPress;+ changePassword ? changePassInputRef.current?.focus() : this.onPress;}}autoCompleteType="password"returnKeyLabel={changePassword ? 'Next' : this.state.title}@@ -721,9 +715,7 @@ export class VaultDialog extends Component {!novault ||changePassword ? null : (<Button- onPress={() =>- this._onPressFingerprintAuth('Unlock note', '')- }+ onPress={() => this._onPressFingerprintAuth('Unlock note', '')}icon="fingerprint"width="100%"title={'Biometric unlock'}@@ -741,9 +733,7 @@ export class VaultDialog extends Component {})}icon={- this.state.deleteAll- ? 'check-circle-outline'- : 'checkbox-blank-circle-outline'+ this.state.deleteAll ? 'check-circle-outline' : 'checkbox-blank-circle-outline'}style={{marginTop: 10@@ -825,12 +815,8 @@ export class VaultDialog extends Component {</View>) : null}- {this.state.biometricUnlock &&- !this.state.isBiometryEnrolled &&- novault ? (- <Paragraph>- Unlock with password once to enable biometric access.- </Paragraph>+ {this.state.biometricUnlock && !this.state.isBiometryEnrolled && novault ? (+ <Paragraph>Unlock with password once to enable biometric access.</Paragraph>) : null}{this.state.isBiometryAvailable &&@@ -860,9 +846,7 @@ export class VaultDialog extends Component {onPressNegative={this.close}onPressPositive={this.onPress}loading={loading}- positiveType={- deleteVault || clearVault ? 'errorShade' : 'transparent'- }+ positiveType={deleteVault || clearVault ? 'errorShade' : 'transparent'}positiveTitle={deleteVault? 'Delete'diff --git a/apps/mobile/src/navigation/NavigatorStack.js b/apps/mobile/src/navigation/NavigatorStack.jsindex d2f6d3891..c3de2a041 100644--- a/apps/mobile/src/navigation/NavigatorStack.js+++ b/apps/mobile/src/navigation/NavigatorStack.js@@ -1,20 +1,20 @@-import {NavigationContainer} from '@react-navigation/native';-import {createNativeStackNavigator} from '@react-navigation/native-stack';+import { NavigationContainer } from '@react-navigation/native';+import { createNativeStackNavigator } from '@react-navigation/native-stack';import * as React from 'react';import Container from '../components/Container';-import {useTracked} from '../provider';-import {useSelectionStore, useSettingStore} from '../provider/stores';-import {eSendEvent} from '../services/EventManager';+import { useTracked } from '../provider';+import { useSelectionStore, useSettingStore } from '../provider/stores';+import { eSendEvent } from '../services/EventManager';import Navigation from '../services/Navigation';-import {history} from '../utils';-import {MMKV} from '../utils/mmkv';-import {rootNavigatorRef} from '../utils/Refs';+import { history } from '../utils';+import { MMKV } from '../utils/mmkv';+import { rootNavigatorRef } from '../utils/Refs';import Favorites from '../views/Favorites';import Folders from '../views/Folders';import Home from '../views/Home';import Notebook from '../views/Notebook';import Notes from '../views/Notes';-import {Search} from '../views/Search';+import { Search } from '../views/Search';import Settings from '../views/Settings';import Tags from '../views/Tags';import Trash from '../views/Trash';@@ -24,7 +24,7 @@ let homepage = 'Notes';export const NavigatorStack = React.memo(() => {const [state, dispatch] = useTracked();- const {colors} = state;+ const { colors } = state;const [render, setRender] = React.useState(false);const clearSelection = useSelectionStore(state => state.clearSelection);@@ -61,7 +61,8 @@ export const NavigatorStack = React.memo(<NavigationContaineronStateChange={onStateChange}independent={true}- ref={rootNavigatorRef}>+ ref={rootNavigatorRef}+ >{render ? (<Stack.NavigatorinitialRouteName={homepage}@@ -72,7 +73,8 @@ export const NavigatorStack = React.memo(contentStyle: {backgroundColor: colors.bg}- }}>+ }}+ ><Stack.Screen name="Notes" component={Home} /><Stack.Screen name="Notebooks" component={Folders} /><Stack.Screen name="Favorites" component={Favorites} />diff --git a/apps/mobile/src/navigation/RootView.js b/apps/mobile/src/navigation/RootView.jsindex 1006a4153..e5a5637e5 100644--- a/apps/mobile/src/navigation/RootView.js+++ b/apps/mobile/src/navigation/RootView.js@@ -1,38 +1,31 @@-import {- activateKeepAwake,- deactivateKeepAwake-} from '@sayem314/react-native-keep-awake';-import React, {useEffect, useRef} from 'react';-import {View} from 'react-native';-import {StatusBar} from 'react-native-bars';-import Animated, {useValue} from 'react-native-reanimated';-import {notesnook} from '../../e2e/test.ids';+import { activateKeepAwake, deactivateKeepAwake } from '@sayem314/react-native-keep-awake';+import React, { useEffect, useRef } from 'react';+import { View } from 'react-native';+import { StatusBar } from 'react-native-bars';+import Animated, { useValue } from 'react-native-reanimated';+import { notesnook } from '../../e2e/test.ids';import CustomTabs from '../components/CustomTabs';-import {DialogManager} from '../components/DialogManager';-import {Menu} from '../components/Menu';-import {Toast} from '../components/Toast';-import {useTracked} from '../provider';-import {useEditorStore, useSettingStore} from '../provider/stores';-import {DDS} from '../services/DeviceDetection';-import {- eSendEvent,- eSubscribeEvent,- eUnSubscribeEvent-} from '../services/EventManager';-import {editing, setWidthHeight} from '../utils';-import {updateStatusBarColor} from '../utils/Colors';+import { DialogManager } from '../components/DialogManager';+import { Menu } from '../components/Menu';+import { Toast } from '../components/Toast';+import { useTracked } from '../provider';+import { useEditorStore, useSettingStore } from '../provider/stores';+import { DDS } from '../services/DeviceDetection';+import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../services/EventManager';+import { editing, setWidthHeight } from '../utils';+import { updateStatusBarColor } from '../utils/Colors';import {eClearEditor,eCloseFullscreenEditor,eOnLoadNote,eOpenFullscreenEditor} from '../utils/Events';-import {editorRef, tabBarRef} from '../utils/Refs';-import {sleep} from '../utils/TimeUtils';-import {EditorWrapper} from '../views/Editor/EditorWrapper';-import {checkStatus, EditorWebView, getNote} from '../views/Editor/Functions';+import { editorRef, tabBarRef } from '../utils/Refs';+import { sleep } from '../utils/TimeUtils';+import { EditorWrapper } from '../views/Editor/EditorWrapper';+import { checkStatus, EditorWebView, getNote } from '../views/Editor/Functions';import tiny from '../views/Editor/tiny/tiny';-import {NavigatorStack} from './NavigatorStack';+import { NavigatorStack } from './NavigatorStack';let layoutTimer = null;const onChangeTab = async obj => {@@ -41,15 +34,12 @@ const onChangeTab = async obj => {activateKeepAwake();eSendEvent('navigate');eSendEvent(eClearEditor, 'addHandler');- if (- !editing.isRestoringState &&- (!editing.currentlyEditing || !getNote())- ) {+ if (!editing.isRestoringState && (!editing.currentlyEditing || !getNote())) {if (editing.overlay) {editing.overlay = false;return;}- eSendEvent(eOnLoadNote, {type: 'new'});+ eSendEvent(eOnLoadNote, { type: 'new' });editing.currentlyEditing = true;}if (getNote()) {@@ -93,7 +83,7 @@ export const RootView = React.memo(const NativeStack = React.memo(() => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const deviceMode = useSettingStore(state => state.deviceMode);const setFullscreen = useSettingStore(state => state.setFullscreen);@@ -112,9 +102,7 @@ const NativeStack = React.memo(width: dimensions.width,zIndex: 999,paddingHorizontal:- deviceMode === 'smallTablet'- ? dimensions.width * 0- : dimensions.width * 0.15+ deviceMode === 'smallTablet' ? dimensions.width * 0 : dimensions.width * 0.15}});};@@ -125,8 +113,7 @@ const NativeStack = React.memo(style: {width:deviceMode === 'smallTablet'- ? dimensions.width -- valueLimiter(dimensions.width * 0.4, 300, 450)+ ? dimensions.width - valueLimiter(dimensions.width * 0.4, 300, 450): dimensions.width * 0.55,zIndex: null,paddingHorizontal: 0@@ -156,7 +143,6 @@ const NativeStack = React.memo(layoutTimer = null;}let size = event?.nativeEvent?.layout;- updatedDimensions = size;if (!size || (size.width === dimensions.width && deviceMode !== null)) {DDS.setSize(size);setDeviceMode(deviceMode, size);@@ -195,8 +181,7 @@ const NativeStack = React.memo(style: {width: size.width,zIndex: 999,- paddingHorizontal:- current === 'smallTablet' ? size.width * 0 : size.width * 0.15+ paddingHorizontal: current === 'smallTablet' ? size.width * 0 : size.width * 0.15}});} else {@@ -272,12 +257,8 @@ const NativeStack = React.memo(},smallTablet: {a: fullscreen ? 0 : valueLimiter(dimensions.width * 0.3, 300, 350),- b: fullscreen- ? 0- : dimensions.width + valueLimiter(dimensions.width * 0.3, 300, 350),- c: fullscreen- ? 0- : dimensions.width + valueLimiter(dimensions.width * 0.3, 300, 350)+ b: fullscreen ? 0 : dimensions.width + valueLimiter(dimensions.width * 0.3, 300, 350),+ c: fullscreen ? 0 : dimensions.width + valueLimiter(dimensions.width * 0.3, 300, 350)},tablet: {a: 0,@@ -306,20 +287,24 @@ const NativeStack = React.memo(const listItems = [<View+ key="1"onLayout={() => {- tabBarRef.current?.goToIndex(1,false);+ tabBarRef.current?.goToIndex(1, false);}}style={{height: '100%',width: fullscreen ? 0 : widths[deviceMode].a- }}>+ }}+ ><Menu /></View>,<View+ key="2"style={{height: '100%',width: fullscreen ? 0 : widths[deviceMode].b- }}>+ }}+ >{deviceMode === 'mobile' ? (<Animated.Viewstyle={{@@ -341,10 +326,9 @@ const NativeStack = React.memo(<NavigatorStack /></View>,- <EditorWrapper width={widths} dimensions={dimensions} />+ <EditorWrapper key="3" width={widths} dimensions={dimensions} />];-return (<ViewonLayout={_onLayout}@@ -353,11 +337,9 @@ const NativeStack = React.memo(width: '100%',height: '100%',backgroundColor: colors.bg- }}>- <StatusBar- animated="true"- barStyle={colors.night ? 'light-content' : 'dark-content'}- />+ }}+ >+ <StatusBar animated="true" barStyle={colors.night ? 'light-content' : 'dark-content'} />{deviceMode ? (<CustomTabsref={tabBarRef}@@ -366,9 +348,7 @@ const NativeStack = React.memo(style={{zIndex: 1}}- initialIndex={- deviceMode === 'smallTablet' || deviceMode === 'tablet' ? 0 : 1- }+ initialIndex={deviceMode === 'smallTablet' || deviceMode === 'tablet' ? 0 : 1}toggleOverlay={toggleView}offsets={offsets[deviceMode]}items={listItems}diff --git a/apps/mobile/src/provider/Actions.js b/apps/mobile/src/provider/Actions.jsindex 6536d8070..e4aeaf162 100644--- a/apps/mobile/src/provider/Actions.js+++ b/apps/mobile/src/provider/Actions.js@@ -24,17 +24,17 @@ export const Actions = {HEADER_STATE: 'headerState',SEARCH_STATE: 'searchState',CONTAINER_STATE: 'containerState',- CONTAINER_BOTTOM_BUTTON:'containerBottomButton',- HEADER_VERTICAL_MENU:'verticalMenu',- HEADER_TEXT_STATE:'headerTextState',- MESSAGE_BOARD_STATE:'messageBoardState',- LOADING:"loading",- FULLSCREEN:"fullscreen",- DEVICE_MODE:"deviceMode",- MENU_PINS:"menuPins",- LAST_SYNC:"lastSynced",- INTENT_MODE: "intentMode",- SEARCHING:'searching',- PREMIUM:'premium',+ CONTAINER_BOTTOM_BUTTON: 'containerBottomButton',+ HEADER_VERTICAL_MENU: 'verticalMenu',+ HEADER_TEXT_STATE: 'headerTextState',+ MESSAGE_BOARD_STATE: 'messageBoardState',+ LOADING: 'loading',+ FULLSCREEN: 'fullscreen',+ DEVICE_MODE: 'deviceMode',+ MENU_PINS: 'menuPins',+ LAST_SYNC: 'lastSynced',+ INTENT_MODE: 'intentMode',+ SEARCHING: 'searching',+ PREMIUM: 'premium',SEARCH_STATUS: 'searchStatus'};diff --git a/apps/mobile/src/provider/DefaultState.js b/apps/mobile/src/provider/DefaultState.jsindex 431467192..68bea76a7 100644--- a/apps/mobile/src/provider/DefaultState.js+++ b/apps/mobile/src/provider/DefaultState.js@@ -1,6 +1,6 @@-import { Appearance } from "react-native";-import { COLOR_SCHEME_DARK, COLOR_SCHEME_LIGHT } from "../utils/Colors";-const darkScheme = Appearance.getColorScheme() === "dark";+import { Appearance } from 'react-native';+import { COLOR_SCHEME_DARK, COLOR_SCHEME_LIGHT } from '../utils/Colors';+const darkScheme = Appearance.getColorScheme() === 'dark';export const defaultState = {colors: darkScheme ? COLOR_SCHEME_DARK : COLOR_SCHEME_LIGHT};diff --git a/apps/mobile/src/provider/Reducer.js b/apps/mobile/src/provider/Reducer.jsindex 09a92c1af..55f2fdad9 100644--- a/apps/mobile/src/provider/Reducer.js+++ b/apps/mobile/src/provider/Reducer.js@@ -5,11 +5,11 @@ export const reducer = (state, action) => {case Actions.THEME: {return {...state,- colors: action.colors,+ colors: action.colors};}default:- return state- //throw new Error('unknown action type');+ return state;+ //throw new Error('unknown action type');}};diff --git a/apps/mobile/src/provider/index.ts b/apps/mobile/src/provider/index.tsindex b0045e0c2..9ee27ff0c 100644--- a/apps/mobile/src/provider/index.ts+++ b/apps/mobile/src/provider/index.ts@@ -3,10 +3,9 @@ import { createContainer } from 'react-tracked';import { defaultState } from './DefaultState';import { reducer } from './Reducer';-type TrackedState = typeof defaultState+type TrackedState = typeof defaultState;-const useValue:() => [TrackedState, React.DispatchWithoutAction] = () => useReducer(reducer, defaultState);+const useValue: () => [TrackedState, React.DispatchWithoutAction] = () =>+ useReducer(reducer, defaultState);-export const {Provider, useTracked, useTrackedState} = createContainer(- useValue,-);\ No newline at end of file+export const { Provider, useTracked, useTrackedState } = createContainer(useValue);diff --git a/apps/mobile/src/provider/interfaces.ts b/apps/mobile/src/provider/interfaces.tsindex b2e9cedba..b8d15d7d8 100644--- a/apps/mobile/src/provider/interfaces.ts+++ b/apps/mobile/src/provider/interfaces.ts@@ -1,198 +1,191 @@import { State } from 'zustand';export type Item = {- id: string-}-+ id: string;+};export interface NoteStore extends State {- notes: Item[],- loading: boolean,- setLoading: (loading: boolean) => void,- setNotes: (items?: Item[]) => void,- clearNotes: () => void+ notes: Item[];+ loading: boolean;+ setLoading: (loading: boolean) => void;+ setNotes: (items?: Item[]) => void;+ clearNotes: () => void;}export interface NotebookStore extends State {- notebooks: Item[],- setNotebooks: (items?: Item[]) => void,- clearNotebooks: () => void+ notebooks: Item[];+ setNotebooks: (items?: Item[]) => void;+ clearNotebooks: () => void;}--export interface FavoriteStore extends State {- favorites: Item[],- setFavorites: (items?: Item[]) => void,- clearFavorites: () => void+ favorites: Item[];+ setFavorites: (items?: Item[]) => void;+ clearFavorites: () => void;}--export interface TagStore extends State {- tags: Item[],- setTags: (items?: Item[]) => void,- clearTags: () => void+ tags: Item[];+ setTags: (items?: Item[]) => void;+ clearTags: () => void;}-export interface TrashStore extends State {- trash: Item[],- setTrash: (items?: Item[]) => void,- clearTrash: () => void+ trash: Item[];+ setTrash: (items?: Item[]) => void;+ clearTrash: () => void;}--export interface UserStore extends State {- user: Object| null,- premium: boolean,- lastSynced: string,- syncing: boolean,- setUser: (user: Object | null) => void,- setPremium: (premium: boolean) => void,- setSyncing: (syncing: boolean) => void,- setLastSynced: (lastSynced: string) => void,- verifyUser: boolean,- setVerifyUser: (verified: boolean) => void+ user: Object | null;+ premium: boolean;+ lastSynced: string;+ syncing: boolean;+ setUser: (user: Object | null) => void;+ setPremium: (premium: boolean) => void;+ setSyncing: (syncing: boolean) => void;+ setLastSynced: (lastSynced: string) => void;+ verifyUser: boolean;+ setVerifyUser: (verified: boolean) => void;}--export type Settings = {- showToolbarOnTop?: boolean,- showKeyboardOnOpen?: boolean,- fontScale?: number,- forcePortraitOnTablet?: boolean,- useSystemTheme?: boolean,- reminder?: string,- encryptedBackup?: boolean,- homepage?: string,- sort?: string,- sortOrder?: string,- screenshotMode?: boolean,- privacyScreen?: boolean,- appLockMode?: string,- telemetry?: boolean,- notebooksListMode?: "normal" | "compact",- notesListMode?: "normal" | "compact",- devMode?: boolean,- notifNotes?: boolean- pitchBlack?:boolean,- reduceAnimations?:boolean--}+ showToolbarOnTop?: boolean;+ showKeyboardOnOpen?: boolean;+ fontScale?: number;+ forcePortraitOnTablet?: boolean;+ useSystemTheme?: boolean;+ reminder?: string;+ encryptedBackup?: boolean;+ homepage?: string;+ sort?: string;+ sortOrder?: string;+ screenshotMode?: boolean;+ privacyScreen?: boolean;+ appLockMode?: string;+ telemetry?: boolean;+ notebooksListMode?: 'normal' | 'compact';+ notesListMode?: 'normal' | 'compact';+ devMode?: boolean;+ notifNotes?: boolean;+ pitchBlack?: boolean;+ reduceAnimations?: boolean;+};type Dimensions = {- width: number,- height: number-}+ width: number;+ height: number;+};export interface SettingStore extends State {- settings: Settings,- fullscreen: boolean,- deviceMode: string | null,- dimensions: Dimensions- setSettings: (settings: Settings) => void,- setFullscreen: (fullscreen: boolean) => void,- setDeviceMode: (mode: string) => void,- setDimensions: (dimensions: Dimensions) => void- appLoading: boolean- setAppLoading: (appLoading: boolean) => void- isIntroCompleted: boolean- setIntroCompleted: (isIntroCompleted: boolean) => void,- setSheetKeyboardHandler:(sheetKeyboardHandler:boolean) => void,- sheetKeyboardHandler:boolean+ settings: Settings;+ fullscreen: boolean;+ deviceMode: string | null;+ dimensions: Dimensions;+ setSettings: (settings: Settings) => void;+ setFullscreen: (fullscreen: boolean) => void;+ setDeviceMode: (mode: string) => void;+ setDimensions: (dimensions: Dimensions) => void;+ appLoading: boolean;+ setAppLoading: (appLoading: boolean) => void;+ isIntroCompleted: boolean;+ setIntroCompleted: (isIntroCompleted: boolean) => void;+ setSheetKeyboardHandler: (sheetKeyboardHandler: boolean) => void;+ sheetKeyboardHandler: boolean;}export interface MenuStore extends State {- menuPins: object[],- colorNotes: object[],- setMenuPins: () => void,- setColorNotes: () => void- clearAll: () => void+ menuPins: object[];+ colorNotes: object[];+ setMenuPins: () => void;+ setColorNotes: () => void;+ clearAll: () => void;}-export interface EditorStore extends State {- currentEditingNote: string | null,- setCurrentlyEditingNote: (note: string | null) => void,- sessionId:string | null,- setSessionId:(sessionId:string | null) => void,- searchReplace:boolean,- setSearchReplace:(searchReplace:boolean) => void,- searchSelection:string | null+ currentEditingNote: string | null;+ setCurrentlyEditingNote: (note: string | null) => void;+ sessionId: string | null;+ setSessionId: (sessionId: string | null) => void;+ searchReplace: boolean;+ setSearchReplace: (searchReplace: boolean) => void;+ searchSelection: string | null;}-export interface SearchStore extends State {- searchResults: object[],- searching: boolean,- searchStatus: string | null,- setSearchResults: (results: object[]) => void,- setSearchStatus: (searching: boolean, status: string | null) => void+ searchResults: object[];+ searching: boolean;+ searchStatus: string | null;+ setSearchResults: (results: object[]) => void;+ setSearchStatus: (searching: boolean, status: string | null) => void;}-export interface SelectionStore extends State {- selectedItemsList: Array<Object>,- selectionMode: boolean,- setAll: (all: Array<Object>,) => void,- setSelectionMode: (mode: boolean) => void,- setSelectedItem: (item: Item) => void,- clearSelection: (noanimation:boolean) => void,+ selectedItemsList: Array<Object>;+ selectionMode: boolean;+ setAll: (all: Array<Object>) => void;+ setSelectionMode: (mode: boolean) => void;+ setSelectedItem: (item: Item) => void;+ clearSelection: (noanimation: boolean) => void;}export type Message = {- visible: boolean- message: string | null- actionText: string | null- onPress: () => void- data: object- icon: string-}+ visible: boolean;+ message: string | null;+ actionText: string | null;+ onPress: () => void;+ data: object;+ icon: string;+};export type Action = {- type: string- platforms: string[]- title: string- data: string-}+ type: string;+ platforms: string[];+ title: string;+ data: string;+};export type Style = {- marginTop?: number,- marginBottom?: number,- textAlign?: "center" | "left" | "right"-}+ marginTop?: number;+ marginBottom?: number;+ textAlign?: 'center' | 'left' | 'right';+};export type BodyItem = {- type: "image" | "title" | "description" | "body" | "list" | "features" | "poll" | "subheading" | "shapes"- src?: string- caption?: string- text?: string- style?: Style,- items?: Array<{- text?: string- }>-}+ type:+ | 'image'+ | 'title'+ | 'description'+ | 'body'+ | 'list'+ | 'features'+ | 'poll'+ | 'subheading'+ | 'shapes';+ src?: string;+ caption?: string;+ text?: string;+ style?: Style;+ items?: Array<{+ text?: string;+ }>;+};export type Announcement = {- type: "dialog" | "inline"- body: BodyItem[]- id: string- callToActions: Action[]- timestamp: number- platforms: string[]- isActive: boolean- userTypes: string[],- appVersion:number-}+ type: 'dialog' | 'inline';+ body: BodyItem[];+ id: string;+ callToActions: Action[];+ timestamp: number;+ platforms: string[];+ isActive: boolean;+ userTypes: string[];+ appVersion: number;+};export interface MessageStore extends State {- message: Message- setMessage: (message: Message) => void- announcements: Announcement[],- setAnnouncement: () => Promise<void>- dialogs: Announcement[]- remove: (id: string) => void+ message: Message;+ setMessage: (message: Message) => void;+ announcements: Announcement[];+ setAnnouncement: () => Promise<void>;+ dialogs: Announcement[];+ remove: (id: string) => void;}--diff --git a/apps/mobile/src/provider/stores.ts b/apps/mobile/src/provider/stores.tsindex 27ac4f998..dafe27cc0 100644--- a/apps/mobile/src/provider/stores.ts+++ b/apps/mobile/src/provider/stores.ts@@ -1,11 +1,11 @@-import {LayoutAnimation, Platform, UIManager} from 'react-native';-import {Dimensions} from 'react-native';+import { LayoutAnimation, Platform, UIManager } from 'react-native';+import { Dimensions } from 'react-native';import create from 'zustand';import PremiumService from '../services/PremiumService';-import {history, SUBSCRIPTION_STATUS} from '../utils';-import {APP_VERSION} from '../../version';-import {db} from '../utils/database';-import {MMKV} from '../utils/mmkv';+import { history, SUBSCRIPTION_STATUS } from '../utils';+import { APP_VERSION } from '../../version';+import { db } from '../utils/database';+import { MMKV } from '../utils/mmkv';import {MenuStore,MessageStore,@@ -22,17 +22,17 @@ import {Announcement} from './interfaces';//@ts-ignore-import {groupArray} from 'notes-core/utils/grouping';-import {EditorWebView, post} from '../views/Editor/Functions';+import { groupArray } from 'notes-core/utils/grouping';+import { EditorWebView, post } from '../views/Editor/Functions';import tiny from '../views/Editor/tiny/tiny';-import {eSubscribeEvent, eUnSubscribeEvent} from '../services/EventManager';-import {endSearch} from '../views/Editor/tiny/toolbar/commands';+import { eSubscribeEvent, eUnSubscribeEvent } from '../services/EventManager';+import { endSearch } from '../views/Editor/tiny/toolbar/commands';import layoutmanager from '../utils/layout-manager';export const useNoteStore = create<NoteStore>((set, get) => ({notes: [],loading: true,- setLoading: loading => set({loading: loading}),+ setLoading: loading => set({ loading: loading }),setNotes: items => {if (!items) {set({@@ -48,9 +48,9 @@ export const useNoteStore = create<NoteStore>((set, get) => ({prev[index] = item;}}- set({notes: prev});+ set({ notes: prev });},- clearNotes: () => set({notes: []})+ clearNotes: () => set({ notes: [] })}));export const useNotebookStore = create<NotebookStore>((set, get) => ({@@ -58,10 +58,7 @@ export const useNotebookStore = create<NotebookStore>((set, get) => ({setNotebooks: items => {if (!items) {set({- notebooks: groupArray(- db.notebooks.all,- db.settings?.getGroupOptions('notebooks')- )+ notebooks: groupArray(db.notebooks.all, db.settings?.getGroupOptions('notebooks'))});return;}@@ -73,9 +70,9 @@ export const useNotebookStore = create<NotebookStore>((set, get) => ({prev[index] = item;}}- set({notebooks: prev});+ set({ notebooks: prev });},- clearNotebooks: () => set({notebooks: []})+ clearNotebooks: () => set({ notebooks: [] })}));export const useFavoriteStore = create<FavoriteStore>((set, get) => ({@@ -83,10 +80,7 @@ export const useFavoriteStore = create<FavoriteStore>((set, get) => ({setFavorites: items => {if (!items) {set({- favorites: groupArray(- db.notes.favorites,- db.settings?.getGroupOptions('favorites')- )+ favorites: groupArray(db.notes.favorites, db.settings?.getGroupOptions('favorites'))});return;}@@ -98,9 +92,9 @@ export const useFavoriteStore = create<FavoriteStore>((set, get) => ({prev[index] = item;}}- set({favorites: prev});+ set({ favorites: prev });},- clearFavorites: () => set({favorites: []})+ clearFavorites: () => set({ favorites: [] })}));export const useTagStore = create<TagStore>((set, get) => ({@@ -120,9 +114,9 @@ export const useTagStore = create<TagStore>((set, get) => ({prev[index] = item;}}- set({tags: prev});+ set({ tags: prev });},- clearTags: () => set({tags: []})+ clearTags: () => set({ tags: [] })}));export const useTrashStore = create<TrashStore>((set, get) => ({@@ -142,9 +136,9 @@ export const useTrashStore = create<TrashStore>((set, get) => ({prev[index] = item;}}- set({trash: prev});+ set({ trash: prev });},- clearTrash: () => set({trash: []})+ clearTrash: () => set({ trash: [] })}));export const useUserStore = create<UserStore>((set, get) => ({@@ -153,11 +147,11 @@ export const useUserStore = create<UserStore>((set, get) => ({lastSynced: 'Never',syncing: false,verifyUser: false,- setUser: user => set({user: user}),- setPremium: premium => set({premium: premium}),- setSyncing: syncing => set({syncing: syncing}),- setLastSynced: lastSynced => set({lastSynced: lastSynced}),- setVerifyUser: verified => set({verifyUser: verified})+ setUser: user => set({ user: user }),+ setPremium: premium => set({ premium: premium }),+ setSyncing: syncing => set({ syncing: syncing }),+ setLastSynced: lastSynced => set({ lastSynced: lastSynced }),+ setVerifyUser: verified => set({ verifyUser: verified })}));interface AttachmentStore {@@ -180,8 +174,8 @@ interface AttachmentStore {recieved: number,type: 'upload' | 'download') => void;- loading: {total: number; current: number};- setLoading: (data: {total: number; current: number}) => void;+ loading: { total: number; current: number };+ setLoading: (data: { total: number; current: number }) => void;}export const useAttachmentStore = create<AttachmentStore>((set, get) => ({@@ -202,13 +196,13 @@ export const useAttachmentStore = create<AttachmentStore>((set, get) => ({tinymce.activeEditor._updateAttachmentProgress(progress);})()`);- set({progress: {..._p}});+ set({ progress: { ..._p } });},setProgress: (sent, total, hash, recieved, type) => {let _p = get().progress;if (!_p) return;- _p[hash] = {sent, total, hash, recieved, type};- let progress = {total, hash, loaded: type === 'download' ? recieved : sent};+ _p[hash] = { sent, total, hash, recieved, type };+ let progress = { total, hash, loaded: type === 'download' ? recieved : sent };tiny.call(EditorWebView,`@@ -217,16 +211,15 @@ export const useAttachmentStore = create<AttachmentStore>((set, get) => ({tinymce.activeEditor._updateAttachmentProgress(progress);})()`);- set({progress: {..._p}});+ set({ progress: { ..._p } });},encryptionProgress: 0,- setEncryptionProgress: encryptionProgress =>- set({encryptionProgress: encryptionProgress}),- loading: {total: 0, current: 0},- setLoading: data => set({loading: data})+ setEncryptionProgress: encryptionProgress => set({ encryptionProgress: encryptionProgress }),+ loading: { total: 0, current: 0 },+ setLoading: data => set({ loading: data })}));-let {width, height} = Dimensions.get('window');+let { width, height } = Dimensions.get('window');export const useSettingStore = create<SettingStore>((set, get) => ({settings: {@@ -254,16 +247,16 @@ export const useSettingStore = create<SettingStore>((set, get) => ({sheetKeyboardHandler: true,fullscreen: false,deviceMode: 'mobile',- dimensions: {width, height},+ dimensions: { width, height },appLoading: true,isIntroCompleted: false,- setSettings: settings => set({settings}),- setFullscreen: fullscreen => set({fullscreen}),- setDeviceMode: mode => set({deviceMode: mode}),- setDimensions: dimensions => set({dimensions: dimensions}),- setAppLoading: appLoading => set({appLoading}),- setIntroCompleted: isIntroCompleted => set({isIntroCompleted}),- setSheetKeyboardHandler: sheetKeyboardHandler => set({sheetKeyboardHandler})+ setSettings: settings => set({ settings }),+ setFullscreen: fullscreen => set({ fullscreen }),+ setDeviceMode: mode => set({ deviceMode: mode }),+ setDimensions: dimensions => set({ dimensions: dimensions }),+ setAppLoading: appLoading => set({ appLoading }),+ setIntroCompleted: isIntroCompleted => set({ isIntroCompleted }),+ setSheetKeyboardHandler: sheetKeyboardHandler => set({ sheetKeyboardHandler })}));export const useMenuStore = create<MenuStore>((set, get) => ({@@ -271,33 +264,33 @@ export const useMenuStore = create<MenuStore>((set, get) => ({colorNotes: [],setMenuPins: () => {try {- set({menuPins: db.settings.pins});+ set({ menuPins: db.settings.pins });} catch (e) {setTimeout(() => {try {- set({menuPins: db.settings.pins});+ set({ menuPins: db.settings.pins });} catch (e) {}}, 1000);}},- setColorNotes: () => set({colorNotes: db.colors.all}),- clearAll: () => set({menuPins: [], colorNotes: []})+ setColorNotes: () => set({ colorNotes: db.colors.all }),+ clearAll: () => set({ menuPins: [], colorNotes: [] })}));export const useEditorStore = create<EditorStore>((set, get) => ({currentEditingNote: null,- setCurrentlyEditingNote: note => set({currentEditingNote: note}),+ setCurrentlyEditingNote: note => set({ currentEditingNote: note }),sessionId: null,setSessionId: sessionId => {console.log(sessionId, 'session id');- tiny.call(EditorWebView,`sessionId="${sessionId}";`);- set({sessionId});+ tiny.call(EditorWebView, `sessionId="${sessionId}";`);+ set({ sessionId });},searchReplace: false,searchSelection: null,setSearchReplace: searchReplace => {if (!searchReplace) {- set({searchSelection: null, searchReplace: false});+ set({ searchSelection: null, searchReplace: false });return;}let func = (value: string) => {@@ -307,7 +300,7 @@ export const useEditorStore = create<EditorStore>((set, get) => ({endSearch();return;}- set({searchSelection: value, searchReplace: true});+ set({ searchSelection: value, searchReplace: true });};eSubscribeEvent('selectionvalue', func);tiny.call(@@ -325,8 +318,8 @@ export const useSearchStore = create<SearchStore>((set, get) => ({searchResults: [],searching: false,searchStatus: null,- setSearchResults: results => set({searchResults: results}),- setSearchStatus: (searching, status) => set({searching, searchStatus: status})+ setSearchResults: results => set({ searchResults: results }),+ setSearchStatus: (searching, status) => set({ searching, searchStatus: status })}));export const useSelectionStore = create<SelectionStore>((set, get) => ({@@ -335,7 +328,7 @@ export const useSelectionStore = create<SelectionStore>((set, get) => ({setAll: all => {//@ts-ignorehistory.selectedItemsList = all;- set({selectedItemsList: all});+ set({ selectedItemsList: all });},setSelectionMode: mode => {if (!mode) {@@ -360,17 +353,16 @@ export const useSelectionStore = create<SelectionStore>((set, get) => ({selectedItems = [...new Set(selectedItems)];//@ts-ignorehistory.selectedItemsList = selectedItems;- history.selectionMode =- selectedItems.length > 0 ? get().selectionMode : false;+ history.selectionMode = selectedItems.length > 0 ? get().selectionMode : false;set({selectedItemsList: selectedItems,selectionMode: history.selectionMode});},- clearSelection: (noanimation) => {+ clearSelection: noanimation => {history.selectedItemsList = [];history.selectionMode = false;- set({selectionMode: false, selectedItemsList: []});+ set({ selectionMode: false, selectedItemsList: [] });}}));@@ -390,7 +382,7 @@ export const useMessageStore = create<MessageStore>((set, get) => ({layoutmanager.withAnimation();}- set({message: {...message}});+ set({ message: { ...message } });}, 1);},announcements: [],@@ -406,7 +398,7 @@ export const useMessageStore = create<MessageStore>((set, get) => ({dialogsCopy.splice(dialogIndex, 1);inlineCopy.splice(index, 1);}- set({announcements: inlineCopy, dialogs: dialogsCopy});+ set({ announcements: inlineCopy, dialogs: dialogsCopy });},dialogs: [],setAnnouncement: async function () {@@ -418,7 +410,7 @@ export const useMessageStore = create<MessageStore>((set, get) => ({}} catch (e) {console.log('ERROR', e);- set({announcements: []});+ set({ announcements: [] });} finally {let all = await getFiltered(announcements);@@ -474,9 +466,7 @@ async function shouldShowAnnouncement(announcement: Announcement) {if (!announcement) return false;let removed = (await MMKV.getStringAsync(announcement.id)) === 'removed';if (removed) return false;- let show = announcement.platforms.some(- platform => allowedPlatforms.indexOf(platform) > -1- );+ let show = announcement.platforms.some(platform => allowedPlatforms.indexOf(platform) > -1);if (announcement.appVersion) {return announcement.appVersion === APP_VERSION;diff --git a/apps/mobile/src/services/Backup.js b/apps/mobile/src/services/Backup.jsindex 134d1c911..57ae46c16 100644--- a/apps/mobile/src/services/Backup.js+++ b/apps/mobile/src/services/Backup.js@@ -1,15 +1,15 @@-const {MMKV} = require('../utils/MMKV');-import {Platform} from 'react-native';+const { MMKV } = require('../utils/MMKV');+import { Platform } from 'react-native';import FileViewer from 'react-native-file-viewer';import * as ScopedStorage from 'react-native-scoped-storage';import Share from 'react-native-share';-import {presentDialog} from '../components/Dialog/functions';-import {db} from '../utils/database';-import {eCloseProgressDialog} from '../utils/Events';-import {sanitizeFilename} from '../utils/filename';+import { presentDialog } from '../components/Dialog/functions';+import { db } from '../utils/database';+import { eCloseProgressDialog } from '../utils/Events';+import { sanitizeFilename } from '../utils/filename';import storage from '../utils/storage';-import {sleep} from '../utils/TimeUtils';-import {eSendEvent, presentSheet, ToastEvent} from './EventManager';+import { sleep } from '../utils/TimeUtils';+import { eSendEvent, presentSheet, ToastEvent } from './EventManager';import SettingsService from './SettingsService';const MS_DAY = 86400000;@@ -21,10 +21,7 @@ async function getDirectoryAndroid() {if (!folder) return null;let subfolder;if (folder.name !== 'Notesnook backups') {- subfolder = await ScopedStorage.createDirectory(- folder.uri,- 'Notesnook backups'- );+ subfolder = await ScopedStorage.createDirectory(folder.uri, 'Notesnook backups');} else {subfolder = folder;}@@ -46,6 +43,7 @@ async function checkBackupDirExists(reset = false) {dir = exists ? dir : null;}if (!dir) {+ // eslint-disable-next-line no-async-promise-executordir = await new Promise(async resolve => {if (reset) {resolve(await getDirectoryAndroid());@@ -74,17 +72,13 @@ async function run() {RNFetchBlob = require('rn-fetch-blob').default;presentSheet({title: 'Backing up your data',- paragraph:- "All your backups are stored in 'Phone Storage/Notesnook/backups/' folder",+ paragraph: "All your backups are stored in 'Phone Storage/Notesnook/backups/' folder",progress: true});let backup;let error;try {- backup = await db.backup.export(- 'mobile',- SettingsService.get().encryptedBackup- );+ backup = await db.backup.export('mobile', SettingsService.get().encryptedBackup);} catch (e) {error = true;}@@ -92,7 +86,7 @@ async function run() {if (!error) {try {let backupName = 'notesnook_backup_' + Date.now();- backupName = sanitizeFilename(backupName, {replacement: '_'});+ backupName = sanitizeFilename(backupName, { replacement: '_' });backupName = backupName + '.nnbackup';let path;let backupFilePath;diff --git a/apps/mobile/src/services/BiometricService.js b/apps/mobile/src/services/BiometricService.jsindex 9253cec0a..5d865606f 100644--- a/apps/mobile/src/services/BiometricService.js+++ b/apps/mobile/src/services/BiometricService.js@@ -1,15 +1,15 @@import FingerprintScanner from 'react-native-fingerprint-scanner';import Storage from '../utils/storage';-import {ToastEvent} from './EventManager';+import { ToastEvent } from './EventManager';import * as Keychain from 'react-native-keychain';-import {Platform} from 'react-native';+import { Platform } from 'react-native';import { MMKV } from '../utils/mmkv';const CRYPT_CONFIG = Platform.select({ios: {- accessible: Keychain.ACCESSIBLE.WHEN_UNLOCKED_THIS_DEVICE_ONLY,+ accessible: Keychain.ACCESSIBLE.WHEN_UNLOCKED_THIS_DEVICE_ONLY},- android: {},+ android: {}});async function isBiometryAvailable() {@@ -32,12 +32,7 @@ async function isFingerprintAuthEnabled() {}async function storeCredentials(password) {- await Keychain.setInternetCredentials(- 'nn_vault',- 'notesnookvault',- password,- CRYPT_CONFIG,- );+ await Keychain.setInternetCredentials('nn_vault', 'notesnookvault', password, CRYPT_CONFIG);}async function resetCredentials() {@@ -54,14 +49,14 @@ async function getCredentials(title, description) {Platform.select({ios: {fallbackEnabled: true,- description: description,+ description: description},android: {title: title,description: description,- deviceCredentialAllowed: true,- },- }),+ deviceCredentialAllowed: true+ }+ }));FingerprintScanner.release();return await Keychain.getInternetCredentials('nn_vault', CRYPT_CONFIG);@@ -71,21 +66,21 @@ async function getCredentials(title, description) {heading: 'Authentication with biometrics failed.',message: 'Tap "Biometric Unlock" to try again.',type: 'error',- context: 'local',+ context: 'local'};if (e.name === 'DeviceLocked') {message = {heading: 'Biometrics authentication failed.',message: 'Wait 30 seconds to try again.',type: 'error',- context: 'local',+ context: 'local'};} else if (e.name === 'UserFallback') {message = {heading: 'Authentication cancelled by user.',message: 'Tap "Biometric Unlock" to try again.',type: 'error',- context: 'local',+ context: 'local'};}@@ -100,14 +95,14 @@ async function validateUser(title, description) {Platform.select({ios: {fallbackEnabled: true,- description: title,+ description: title},android: {title: title,description: description,- deviceCredentialAllowed: true,- },- }),+ deviceCredentialAllowed: true+ }+ }));FingerprintScanner.release();return true;@@ -118,14 +113,14 @@ async function validateUser(title, description) {heading: 'Biometrics authentication failed.',message: 'Wait 30 seconds to try again.',type: 'error',- context: 'local',+ context: 'local'});} else {ToastEvent.show({heading: 'Authentication failed.',message: 'Tap to try again.',type: 'error',- context: 'local',+ context: 'local'});}return false;@@ -140,5 +135,5 @@ export default {getCredentials,storeCredentials,hasInternetCredentials,- validateUser,+ validateUser};diff --git a/apps/mobile/src/services/DeviceDetection.js b/apps/mobile/src/services/DeviceDetection.jsindex 4a25bab70..3c88890f3 100644--- a/apps/mobile/src/services/DeviceDetection.js+++ b/apps/mobile/src/services/DeviceDetection.js@@ -1,4 +1,4 @@-import {Dimensions, PixelRatio, Platform} from 'react-native';+import { Dimensions, PixelRatio, Platform } from 'react-native';import DeviceInfo from 'react-native-device-info';let windowSize = Dimensions.get('window');@@ -39,7 +39,7 @@ export class DeviceDetectionService {let deviceWidthInInches = this.adjustedWidth / dpi;let deviceHeightInInches = this.adjustedHeight / dpi;let diagonalSize = Math.sqrt(- Math.pow(deviceWidthInInches, 2) + Math.pow(deviceHeightInInches, 2),+ Math.pow(deviceWidthInInches, 2) + Math.pow(deviceHeightInInches, 2));return Platform.isPad ? diagonalSize + 2 : diagonalSize;};@@ -58,11 +58,7 @@ export class DeviceDetectionService {this.isTab = true;this.isPhone = false;this.isSmallTab = true;- } else if (- DeviceInfo.isTablet() &&- orientation === 'LANDSCAPE' &&- deviceSize > 9- ) {+ } else if (DeviceInfo.isTablet() && orientation === 'LANDSCAPE' && deviceSize > 9) {//console.log('large tab tab')//console.log('setting large tablet');this.isTab = true;diff --git a/apps/mobile/src/services/EventManager.js b/apps/mobile/src/services/EventManager.jsindex 4544eb7aa..06b200ce7 100644--- a/apps/mobile/src/services/EventManager.js+++ b/apps/mobile/src/services/EventManager.js@@ -4,7 +4,7 @@ import {eOnNoteEdited,eOpenProgressDialog,eOpenVaultDialog,- eShowToast,+ eShowToast} from '../utils/Events';const eventManager = new EventManager();@@ -40,7 +40,7 @@ export const eSendEvent = (eventName, data) => {* @param {vaultType} data*/-export const openVault = (data) => {+export const openVault = data => {eSendEvent(eOpenVaultDialog, data);};@@ -57,7 +57,7 @@ export function sendNoteEditedEvent(data) {}export function presentSheet(data) {- eSendEvent(eOpenProgressDialog,data);+ eSendEvent(eOpenProgressDialog, data);}export const ToastEvent = {@@ -73,7 +73,7 @@ export const ToastEvent = {** @param {event} data*/- show: (data) =>+ show: data =>eSendEvent(eShowToast, {heading: data.heading,message: data.message,@@ -81,9 +81,9 @@ export const ToastEvent = {context: data.context || 'global',duration: data.duration || 3000,func: data.func || null,- actionText: data.actionText || null,+ actionText: data.actionText || null}),- hide: () => eSendEvent(eHideToast),+ hide: () => eSendEvent(eHideToast)};/*diff --git a/apps/mobile/src/services/Exporter.js b/apps/mobile/src/services/Exporter.jsindex 8ff76afb1..409f44ecb 100644--- a/apps/mobile/src/services/Exporter.js+++ b/apps/mobile/src/services/Exporter.js@@ -1,12 +1,12 @@import { decode, EntityLevel } from 'entities';-import {Platform} from 'react-native';+import { Platform } from 'react-native';import RNHTMLtoPDF from 'react-native-html-to-pdf-lite';import * as ScopedStorage from 'react-native-scoped-storage';import RNFetchBlob from 'rn-fetch-blob';import showdown from 'showdown';-import {toTXT} from '../utils';-import {db} from '../utils/database';-import {sanitizeFilename} from '../utils/filename';+import { toTXT } from '../utils';+import { db } from '../utils/database';+import { sanitizeFilename } from '../utils/filename';import Storage from '../utils/storage';const defaultStyle = `<style>@@ -14,7 +14,7 @@ const defaultStyle = `<style>width:100%;}.img_size_two {- width:50%;+ width:50%;}.img_size_three {width:25%;@@ -324,10 +324,10 @@ async function saveToPDF(note) {Platform.OS === 'ios' && (await Storage.checkAndCreateDir('/exported/PDF/'));let html = await db.notes.note(note).export('html');- html = decode(html,{- level:EntityLevel.HTML+ html = decode(html, {+ level: EntityLevel.HTML});- let fileName = sanitizeFilename(note.title + Date.now(), {replacement: '_'});+ let fileName = sanitizeFilename(note.title + Date.now(), { replacement: '_' });let html3 = html;if (html.indexOf('<head>') > -1) {let html1 = html.substring(0, html.indexOf('<head>') + 6);@@ -374,9 +374,7 @@ async function saveToPDF(note) {}async function saveToMarkdown(note) {- let path =- Platform.OS === 'ios' &&- (await Storage.checkAndCreateDir('/exported/Markdown/'));+ let path = Platform.OS === 'ios' && (await Storage.checkAndCreateDir('/exported/Markdown/'));if (Platform.OS === 'android') {let file = await ScopedStorage.openDocumentTree(true);if (!file) return;@@ -384,7 +382,7 @@ async function saveToMarkdown(note) {}let markdown = await db.notes.note(note.id).export('md', markdown);- let fileName = sanitizeFilename(note.title + Date.now(), {replacement: '_'});+ let fileName = sanitizeFilename(note.title + Date.now(), { replacement: '_' });let fileUri;if (Platform.OS === 'android') {@@ -411,9 +409,7 @@ async function saveToMarkdown(note) {}async function saveToText(note) {- let path =- Platform.OS === 'ios' &&- (await Storage.checkAndCreateDir('/exported/Text/'));+ let path = Platform.OS === 'ios' && (await Storage.checkAndCreateDir('/exported/Text/'));if (Platform.OS === 'android') {let file = await ScopedStorage.openDocumentTree(true);if (!file) return;@@ -421,7 +417,7 @@ async function saveToText(note) {}let text = await toTXT(note);- let fileName = sanitizeFilename(note.title + Date.now(), {replacement: '_'});+ let fileName = sanitizeFilename(note.title + Date.now(), { replacement: '_' });let fileUri;if (Platform.OS === 'android') {@@ -448,9 +444,7 @@ async function saveToText(note) {}async function saveToHTML(note) {- let path =- Platform.OS === 'ios' &&- (await Storage.checkAndCreateDir('/exported/Html/'));+ let path = Platform.OS === 'ios' && (await Storage.checkAndCreateDir('/exported/Html/'));if (Platform.OS === 'android') {let file = await ScopedStorage.openDocumentTree(true);if (!file) return;@@ -458,7 +452,7 @@ async function saveToHTML(note) {}let html = await db.notes.note(note.id).export('html');- let fileName = sanitizeFilename(note.title + Date.now(), {replacement: '_'});+ let fileName = sanitizeFilename(note.title + Date.now(), { replacement: '_' });let html3 = html;if (html.indexOf('<head>') > -1) {let html1 = html.substring(0, html.indexOf('<head>') + 6);diff --git a/apps/mobile/src/services/IntentService.js b/apps/mobile/src/services/IntentService.jsindex e79fe69b5..8f7091801 100644--- a/apps/mobile/src/services/IntentService.js+++ b/apps/mobile/src/services/IntentService.js@@ -131,4 +131,4 @@ export default {setIntent,iosSortedData,};- */\ No newline at end of file+ */diff --git a/apps/mobile/src/services/Message.js b/apps/mobile/src/services/Message.jsindex 1354c2576..978060a2e 100644--- a/apps/mobile/src/services/Message.js+++ b/apps/mobile/src/services/Message.js@@ -1,22 +1,16 @@-import {useMessageStore} from '../provider/stores';-import {- eOpenLoginDialog,- eOpenRateDialog,- eOpenRecoveryKeyDialog-} from '../utils/Events';-import {eSendEvent} from './EventManager';+import { useMessageStore } from '../provider/stores';+import { eOpenLoginDialog, eOpenRateDialog, eOpenRecoveryKeyDialog } from '../utils/Events';+import { eSendEvent } from './EventManager';import PremiumService from './PremiumService';-import {verifyUser} from '../views/Settings/functions';-import {MMKV} from '../utils/mmkv';-import {Platform} from 'react-native';+import { verifyUser } from '../views/Settings/functions';+import { MMKV } from '../utils/mmkv';+import { Platform } from 'react-native';import umami from '../utils/umami';const rateAppMessage = {visible: true,message: 'We would love to know what you think',- actionText:- 'Rate Notesnook on ' +- `${Platform.OS === 'ios' ? 'App store' : 'Play store'}`,+ actionText: 'Rate Notesnook on ' + `${Platform.OS === 'ios' ? 'App store' : 'Play store'}`,onPress: () => {eSendEvent(eOpenRateDialog);},diff --git a/apps/mobile/src/services/Navigation.js b/apps/mobile/src/services/Navigation.jsindex 0583c5469..0f652301d 100755--- a/apps/mobile/src/services/Navigation.js+++ b/apps/mobile/src/services/Navigation.js@@ -1,5 +1,11 @@import { StackActions } from '@react-navigation/native';-import { useFavoriteStore, useNotebookStore, useNoteStore, useTagStore, useTrashStore } from '../provider/stores';+import {+ useFavoriteStore,+ useNotebookStore,+ useNoteStore,+ useTagStore,+ useTrashStore+} from '../provider/stores';import { eOnNewTopicAdded, refreshNotesPage } from '../utils/Events';import { rootNavigatorRef, tabBarRef } from '../utils/Refs';import { eSendEvent } from './EventManager';@@ -20,7 +26,7 @@ let headerState = {heading: 'Notes',color: null,verticalMenu: true,- currentScreen: 'Notes',+ currentScreen: 'Notes'};const routeNames = {@@ -30,7 +36,7 @@ const routeNames = {NotesPage: 'NotesPage',Tags: 'Tags',Favorites: 'Favorites',- Trash: 'Trash',+ Trash: 'Trash'};let routesToUpdate = [];@@ -63,18 +69,11 @@ function routeNeedsUpdate(routeName, callback) {*/function setRoutesToUpdate(routes) {if (routes.indexOf(currentScreen) > -1) {- if (- currentScreen === routeNames.NotesPage ||- currentScreen === routeNames.Notebook- ) {- eSendEvent(- currentScreen === routeNames.NotesPage- ? refreshNotesPage- : eOnNewTopicAdded,- );+ if (currentScreen === routeNames.NotesPage || currentScreen === routeNames.Notebook) {+ eSendEvent(currentScreen === routeNames.NotesPage ? refreshNotesPage : eOnNewTopicAdded);} else {if (currentScreen === routeNames.Notes) {- useNoteStore.getState().setNotes()+ useNoteStore.getState().setNotes();} else if (currentScreen === routeNames.Notebooks) {useNotebookStore.getState().setNotebooks();} else if (currentScreen === routeNames.Favorites) {@@ -128,7 +127,7 @@ function setHeaderState(name, params, item) {headerState.currentScreen = name;headerState.verticalMenu = params.menu;if (headerState) {- eSendEvent('onHeaderStateChange', {id: headerState.id});+ eSendEvent('onHeaderStateChange', { id: headerState.id });}}@@ -152,12 +151,12 @@ function popToTop() {setHeaderState(SettingsService.get().homepage,{- menu: true,+ menu: true},{heading: SettingsService.get().homepage,- id: SettingsService.get().homepage.toLocaleLowerCase() + '_navigation',- },+ id: SettingsService.get().homepage.toLocaleLowerCase() + '_navigation'+ });}@@ -183,5 +182,5 @@ export default {routeNeedsUpdate,routeNames,getHomeLoaded,- setHomeLoaded,+ setHomeLoaded};diff --git a/apps/mobile/src/services/Notifications.ts b/apps/mobile/src/services/Notifications.tsindex 838ecedea..2cfa0dd4d 100644--- a/apps/mobile/src/services/Notifications.ts+++ b/apps/mobile/src/services/Notifications.ts@@ -1,22 +1,22 @@-import {useNoteStore} from './../provider/stores';+import { useNoteStore } from './../provider/stores';import PushNotificationIOS from '@react-native-community/push-notification-ios';-import {Platform} from 'react-native';+import { Platform } from 'react-native';import PushNotification, {Importance,PushNotificationDeliveredObject} from 'react-native-push-notification';-import {eSendEvent} from './EventManager';-import {db} from '../utils/database';-import {DDS} from './DeviceDetection';-import {tabBarRef} from '../utils/Refs';-import {eOnLoadNote} from '../utils/Events';-import {editing} from '../utils';-import {MMKV} from '../utils/mmkv';+import { eSendEvent } from './EventManager';+import { db } from '../utils/database';+import { DDS } from './DeviceDetection';+import { tabBarRef } from '../utils/Refs';+import { eOnLoadNote } from '../utils/Events';+import { editing } from '../utils';+import { MMKV } from '../utils/mmkv';import SettingsService from './SettingsService';const NOTIFICATION_TAG = 'notesnook';const CHANNEL_ID = 'com.streetwriters.notesnook';-let pinned:PushNotificationDeliveredObject[] = [];+let pinned: PushNotificationDeliveredObject[] = [];function loadNote(id: string, jump: boolean) {if (!id || id === 'notesnook_note_input') return;@@ -93,7 +93,7 @@ function init() {await db.notes.init();useNoteStore.getState().setNotes();//@ts-ignore/////-+break;}},@@ -116,33 +116,29 @@ function init() {}function remove(tag: string, id: string) {- PushNotification.clearLocalNotification(- tag || NOTIFICATION_TAG,- parseInt(id)- );+ PushNotification.clearLocalNotification(tag || NOTIFICATION_TAG, parseInt(id));get().then(() => {eSendEvent('onUpdate', 'unpin');});}-function pinQuickNote(launch:boolean) {+function pinQuickNote(launch: boolean) {get().then(items => {let notif = items.filter(i => i.tag === 'notesnook_note_input');if (notif && launch) {return;}- console.log('showing');- present({- title: 'Quick note',- message: 'Tap on "Take note" to add a note.',- ongoing: true,- actions: ['ReplyInput', 'Hide'],- tag: 'notesnook_note_input',- reply_button_text: 'Take note',- reply_placeholder_text: 'Write something...',- id: 256266- });-+ console.log('showing');+ present({+ title: 'Quick note',+ message: 'Tap on "Take note" to add a note.',+ ongoing: true,+ actions: ['ReplyInput', 'Hide'],+ tag: 'notesnook_note_input',+ reply_button_text: 'Take note',+ reply_placeholder_text: 'Write something...',+ id: 256266+ });});}diff --git a/apps/mobile/src/services/PremiumService.js b/apps/mobile/src/services/PremiumService.jsindex 2fb42f67d..06464a719 100644--- a/apps/mobile/src/services/PremiumService.js+++ b/apps/mobile/src/services/PremiumService.js@@ -1,5 +1,6 @@import { CHECK_IDS } from 'notes-core/common';import React from 'react';+import { Platform } from 'react-native';import * as RNIap from 'react-native-iap';import DialogHeader from '../components/Dialog/dialog-header';import { CompactFeatures } from '../components/Premium/compact-features';@@ -8,11 +9,7 @@ import Seperator from '../components/Seperator';import { useUserStore } from '../provider/stores';import { itemSkus, SUBSCRIPTION_STATUS } from '../utils';import { db } from '../utils/database';-import {- eOpenPremiumDialog,- eOpenTrialEndingDialog,- eShowGetPremium-} from '../utils/Events';+import { eOpenPremiumDialog, eOpenTrialEndingDialog, eShowGetPremium } from '../utils/Events';import { MMKV } from '../utils/mmkv';import { eSendEvent, presentSheet, ToastEvent } from './EventManager';@@ -52,9 +49,7 @@ async function setPremiumStatus() {}function getMontlySub() {- let _product = products.find(- p => p.productId === 'com.streetwriters.notesnook.sub.mo'- );+ let _product = products.find(p => p.productId === 'com.streetwriters.notesnook.sub.mo');if (!_product) {_product = {localizedPrice: '$4.49'@@ -66,14 +61,14 @@ function getMontlySub() {async function getProducts() {if (!products || products.length === 0) {- products = await RNIap.getSubscriptions(itemSkus);+ products = await RNIap.getSubscriptions(itemSkus);}return products;}function get() {if (__DEV__) return true;-+return SUBSCRIPTION_STATUS.BASIC !== premiumStatus;}@@ -137,7 +132,7 @@ const onUserStatusCheck = async type => {eSendEvent(eShowGetPremium, message);}}- return {type, result: status};+ return { type, result: status };};const showVerifyEmailDialog = () => {@@ -149,10 +144,7 @@ const showVerifyEmailDialog = () => {action: async () => {try {let lastEmailTime = await MMKV.getItem('lastEmailTime');- if (- lastEmailTime &&- Date.now() - JSON.parse(lastEmailTime) < 60000 * 2- ) {+ if (lastEmailTime && Date.now() - JSON.parse(lastEmailTime) < 60000 * 2) {ToastEvent.show({heading: 'Please wait before requesting another email',type: 'error',@@ -180,7 +172,7 @@ const showVerifyEmailDialog = () => {});}},- actionText: 'Resend Confirmation Link',+ actionText: 'Resend Confirmation Link'});};@@ -197,9 +189,7 @@ const subscriptions = {} else {_subscriptions = [];}- let index = _subscriptions.findIndex(- s => s.transactionId === subscription.transactionId- );+ let index = _subscriptions.findIndex(s => s.transactionId === subscription.transactionId);if (index === -1) {_subscriptions.unshift(subscription);} else {@@ -214,19 +204,14 @@ const subscriptions = {} else {_subscriptions = [];}- let index = _subscriptions.findIndex(- s => s.transactionId === transactionId- );+ let index = _subscriptions.findIndex(s => s.transactionId === transactionId);if (index !== -1) {_subscriptions.splice(index);await MMKV.setItem('subscriptionsIOS', JSON.stringify(_subscriptions));}},verify: async subscription => {- console.log(- 'verifying: ',- new Date(subscription.transactionDate).toLocaleString()- );+ console.log('verifying: ', new Date(subscription.transactionDate).toLocaleString());if (subscription.transactionReceipt) {if (Platform.OS === 'ios') {@@ -243,11 +228,8 @@ const subscriptions = {}};try {- let result = await fetch(- 'https://payments.streetwriters.co/apple/verify',- requestData- );-+ let result = await fetch('https://payments.streetwriters.co/apple/verify', requestData);+let text = await result.text();console.log(text);if (!result.ok) {@@ -328,8 +310,7 @@ const features_list = [content: 'A private vault to keep everything imporant always locked'},{- content:- 'Rich note editing experience with markdown, tables, checklists and more'+ content: 'Rich note editing experience with markdown, tables, checklists and more'},{content: 'Export your notes in Pdf, markdown and html formats'@@ -349,16 +330,11 @@ const sheet = (context, promo) => {padding={12}/><Seperator />- <CompactFeatures- scrollRef={ref}- maxHeight={300}- features={features_list}- vertical- />+ <CompactFeatures scrollRef={ref} maxHeight={300} features={features_list} vertical /><Seperator half /><PricingPlans compact heading={false} promo={promo} /></>- ),+ )});};diff --git a/apps/mobile/src/services/SearchService.js b/apps/mobile/src/services/SearchService.jsindex b5d33b39c..607731eea 100644--- a/apps/mobile/src/services/SearchService.js+++ b/apps/mobile/src/services/SearchService.js@@ -4,7 +4,7 @@ import { db } from '../utils/database';let searchInformation = {placeholder: 'Search in all notes',data: [],- type: 'notes',+ type: 'notes'};let keyword = null;@@ -25,22 +25,22 @@ async function search() {searchstore.setSearchResults([]);return;}- searchstore.setSearchStatus(true,`Searching for "${term}" in ${searchInformation.title}`)+ searchstore.setSearchStatus(true, `Searching for "${term}" in ${searchInformation.title}`);let results;if (!searchInformation.type) return;- results = await db.lookup[searchInformation.type](- searchInformation.data,- term,- );+ results = await db.lookup[searchInformation.type](searchInformation.data, term);if (!results || results.length === 0) {- searchstore.setSearchStatus(false,`No search results found for "${term}" in ${searchInformation.title}`)+ searchstore.setSearchStatus(+ false,+ `No search results found for "${term}" in ${searchInformation.title}`+ );searchstore.setSearchResults(results);return;}- searchstore.setSearchStatus(false,null)+ searchstore.setSearchStatus(false, null);searchstore.setSearchResults(results);}@@ -52,5 +52,5 @@ export default {update,getSearchInformation,search,- setTerm,+ setTerm};diff --git a/apps/mobile/src/services/SettingsService.js b/apps/mobile/src/services/SettingsService.jsindex 6acd9df99..38d00e310 100644--- a/apps/mobile/src/services/SettingsService.js+++ b/apps/mobile/src/services/SettingsService.js@@ -27,13 +27,13 @@ export const defaultSettings = {telemetry: true,notebooksListMode: 'normal',notesListMode: 'normal',- devMode:false,- notifNotes:false,- pitchBlack:false,- reduceAnimations:false+ devMode: false,+ notifNotes: false,+ pitchBlack: false,+ reduceAnimations: false};-let settings = {...defaultSettings};+let settings = { ...defaultSettings };let appLoaded = false;@@ -56,6 +56,7 @@ async function init() {if (!settings.appLockMode) {settings.appLockMode = 'none';}+ // eslint-disable-next-line no-prototype-builtinsif (!settings.hasOwnProperty('telemetry')) {settings.telemetry = true;}@@ -88,7 +89,7 @@ async function init() {}updateSize();- useSettingStore.getState().setSettings({...settings});+ useSettingStore.getState().setSettings({ ...settings });setTheme();return;}@@ -96,19 +97,19 @@ async function init() {const setTheme = async () => {if (settings) {let newColors = await getColorScheme(settings.useSystemTheme);- updateEvent({type: Actions.THEME, colors: newColors});+ updateEvent({ type: Actions.THEME, colors: newColors });}};async function set(name, value) {settings[name] = value;- settings = {...settings};+ settings = { ...settings };await MMKV.setItem('appSettings', JSON.stringify(settings));- useSettingStore.getState().setSettings({...settings});+ useSettingStore.getState().setSettings({ ...settings });}function get() {- return {...settings};+ return { ...settings };}export default {diff --git a/apps/mobile/src/services/Sync.js b/apps/mobile/src/services/Sync.jsindex 53c03533a..763ff756b 100644--- a/apps/mobile/src/services/Sync.js+++ b/apps/mobile/src/services/Sync.js@@ -1,10 +1,10 @@import Clipboard from '@react-native-clipboard/clipboard';import NetInfo from '@react-native-community/netinfo';-import {initialize, useUserStore} from '../provider/stores';-import {doInBackground} from '../utils';-import {db} from '../utils/database';-import {getNote, updateNoteInEditor} from '../views/Editor/Functions';-import {ToastEvent} from './EventManager';+import { initialize, useUserStore } from '../provider/stores';+import { doInBackground } from '../utils';+import { db } from '../utils/database';+import { getNote, updateNoteInEditor } from '../views/Editor/Functions';+import { ToastEvent } from './EventManager';let retryCount = 0;const run = async (context = 'global', forced) => {@@ -64,8 +64,8 @@ const run = async (context = 'global', forced) => {await updateNoteInEditor();}userstore.setSyncing(false);- return result;}+ return result;};export default {diff --git a/apps/mobile/src/services/Validation.js b/apps/mobile/src/services/Validation.jsindex 88a757a9a..21ffebee4 100644--- a/apps/mobile/src/services/Validation.js+++ b/apps/mobile/src/services/Validation.js@@ -2,18 +2,18 @@ import isEmail from 'validator/lib/isEmail';export function validateEmail(email) {if (email && email.length > 0) {- return isEmail(email)+ return isEmail(email);} else {return false;}}export const ERRORS_LIST = {- SHORT_PASS: 'Atleast 8 characters',- // NO_ABC: 'Atleast 1 lowercase letter.',- // NO_CAPS_ABC: 'Atleast 1 capital letter.',- // NO_NUM: 'Atleast 1 number',- // SPECIAL: 'Atleast 1 special character',+ SHORT_PASS: 'Atleast 8 characters'+ // NO_ABC: 'Atleast 1 lowercase letter.',+ // NO_CAPS_ABC: 'Atleast 1 capital letter.',+ // NO_NUM: 'Atleast 1 number',+ // SPECIAL: 'Atleast 1 special character',};export function validatePass(password) {@@ -22,18 +22,18 @@ export function validatePass(password) {}let errors = {- SHORT_PASS: true,- // NO_ABC: true,- // NO_CAPS_ABC: true,- // NO_NUM: true,- // SPECIAL: true,+ SHORT_PASS: true+ // NO_ABC: true,+ // NO_CAPS_ABC: true,+ // NO_NUM: true,+ // SPECIAL: true,};if (password.length >= 8) {errors.SHORT_PASS = false;}-/* if (password.match(/[a-z]+/)) {+ /* if (password.match(/[a-z]+/)) {errors.NO_ABC = false;}if (password.match(/[A-Z]+/)) {diff --git a/apps/mobile/src/utils/Animations.js b/apps/mobile/src/utils/Animations.jsindex a0d74fa28..54d594d1b 100644--- a/apps/mobile/src/utils/Animations.js+++ b/apps/mobile/src/utils/Animations.js@@ -1,8 +1,8 @@-import {Dimensions} from 'react-native';-import Animated, {Easing} from 'react-native-reanimated';-import {editing} from './index';+import { Dimensions } from 'react-native';+import Animated, { Easing } from 'react-native-reanimated';+import { editing } from './index';-const {Value, timing} = Animated;+const { Value, timing } = Animated;export const EditorPosition = new Value(0);export const EditorScale = new Value(1);@@ -12,7 +12,7 @@ export const EditorTranslateY = new Value(Dimensions.get('window').height * 2);export const anim1 = new Animated.Value(-Dimensions.get('window').height);export let animInitialValue = -Dimensions.get('window').height;export const opacityAnimSearch = new Animated.Value(1);-export const setAnimValue = (value) => (animInitialValue = value);+export const setAnimValue = value => (animInitialValue = value);export let currentPage = 'main';export function searchViewAnimation(translate, opacity, next, duration = 150) {@@ -20,12 +20,12 @@ export function searchViewAnimation(translate, opacity, next, duration = 150) {timing(anim1, {toValue: translate,duration: duration,- easing: Easing.inOut(Easing.ease),+ easing: Easing.inOut(Easing.ease)}).start();timing(opacityAnimSearch, {toValue: opacity,duration: duration,- easing: Easing.in(Easing.ease),+ easing: Easing.in(Easing.ease)}).start();}@@ -38,12 +38,12 @@ export function openEditorAnimation() {timing(EditorTranslateY, {duration: 200,toValue: 0,- easing: Easing.out(Easing.ease),+ easing: Easing.out(Easing.ease)}).start();timing(EditorOpacity, {duration: 150,toValue: 1,- easing: Easing.out(Easing.ease),+ easing: Easing.out(Easing.ease)}).start();}@@ -55,12 +55,12 @@ export function exitEditorAnimation() {timing(EditorOpacity, {duration: 150,toValue: 0,- easing: Easing.inOut(Easing.ease),+ easing: Easing.inOut(Easing.ease)}).start();timing(EditorTranslateY, {duration: 200,toValue: Dimensions.get('window').height * 2,- easing: Easing.inOut(Easing.ease),+ easing: Easing.inOut(Easing.ease)}).start();}@@ -74,7 +74,7 @@ export function changeContainerScale(op, scale, duration = 500, callback) {timing(op, {duration: duration,easing: Easing.out(Easing.ease),- toValue: scale,+ toValue: scale}).start(callback);}@@ -83,19 +83,19 @@ export function changeAppScale(scale, duration = 500, callback) {timing(AppBorders, {duration: duration,easing: Easing.out(Easing.ease),- toValue: 0,+ toValue: 0}).start();} else {timing(AppBorders, {duration: duration,easing: Easing.out(Easing.ease),- toValue: 10,+ toValue: 10}).start();}timing(AppScale, {duration: duration,easing: Easing.out(Easing.ease),- toValue: scale,+ toValue: scale}).start(callback);}diff --git a/apps/mobile/src/utils/ColorUtils.js b/apps/mobile/src/utils/ColorUtils.jsindex e7ecdc417..1b8b83b1b 100644--- a/apps/mobile/src/utils/ColorUtils.js+++ b/apps/mobile/src/utils/ColorUtils.js@@ -1,109 +1,114 @@-import { Appearance } from "react-native";-import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from "../services/EventManager";-import SettingsService from "../services/SettingsService";-import { ACCENT, COLOR_SCHEME, COLOR_SCHEME_DARK, COLOR_SCHEME_LIGHT, COLOR_SCHEME_PITCH_BLACK, setAccentColor, setColorScheme } from "./Colors";-import { eThemeUpdated } from "./Events";-import { MMKV } from "./MMKV";+import { Appearance } from 'react-native';+import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../services/EventManager';+import SettingsService from '../services/SettingsService';+import {+ ACCENT,+ COLOR_SCHEME,+ COLOR_SCHEME_DARK,+ COLOR_SCHEME_LIGHT,+ COLOR_SCHEME_PITCH_BLACK,+ setAccentColor,+ setColorScheme+} from './Colors';+import { eThemeUpdated } from './Events';+import { MMKV } from './mmkv';-const isValidHex = (hex) => /^#([A-Fa-f0-9]{3,4}){1,2}$/.test(hex);-const getChunksFromString = (st, chunkSize) =>- st.match(new RegExp(`.{${chunkSize}}`, 'g'));-const convertHexUnitTo256 = (hexStr) =>- parseInt(hexStr.repeat(2 / hexStr.length), 16);+const isValidHex = hex => /^#([A-Fa-f0-9]{3,4}){1,2}$/.test(hex);+const getChunksFromString = (st, chunkSize) => st.match(new RegExp(`.{${chunkSize}}`, 'g'));+const convertHexUnitTo256 = hexStr => parseInt(hexStr.repeat(2 / hexStr.length), 16);const getAlphaFloat = (a, alpha) => {- if (typeof a !== 'undefined') {- return a / 256;+ if (typeof a !== 'undefined') {+ return a / 256;+ }+ if (typeof alpha !== 'undefined') {+ if (1 < alpha && alpha <= 100) {+ return alpha / 100;}- if (typeof alpha !== 'undefined') {- if (1 < alpha && alpha <= 100) {- return alpha / 100;- }- if (0 <= alpha && alpha <= 1) {- return alpha;- }+ if (0 <= alpha && alpha <= 1) {+ return alpha;}- return 1;+ }+ return 1;};const rgbRes = {- color: '',- result: '',+ color: '',+ result: ''};export const hexToRGBA = (hex, alpha) => {- if (rgbRes.color === hex) return rgbRes.result;- if (!isValidHex(hex)) {- return hex;- }- const chunkSize = Math.floor((hex.length - 1) / 3);- const hexArr = getChunksFromString(hex.slice(1), chunkSize);- const [r, g, b, a] = hexArr.map(convertHexUnitTo256);- return `rgba(${r}, ${g}, ${b}, ${getAlphaFloat(a, alpha)})`;+ if (rgbRes.color === hex) return rgbRes.result;+ if (!isValidHex(hex)) {+ return hex;+ }+ const chunkSize = Math.floor((hex.length - 1) / 3);+ const hexArr = getChunksFromString(hex.slice(1), chunkSize);+ const [r, g, b, a] = hexArr.map(convertHexUnitTo256);+ return `rgba(${r}, ${g}, ${b}, ${getAlphaFloat(a, alpha)})`;};const shadeRes = {- color: '',- alpha: 0,- result: '',+ color: '',+ alpha: 0,+ result: ''};export const RGB_Linear_Shade = (p, rgba) => {- if (shadeRes.color === rgba && shadeRes.alpha === p) return shadeRes.result;- let i = parseInt,- r = Math.round,- P = p < 0,- t = P ? 0 : 255 * p,- [a, b, c, d] = rgba.split(',');- P = P ? 1 + p : 1 - p;- return (- 'rgb' +- (d ? 'a(' : '(') +- r(i(a[3] === 'a' ? a.slice(5) : a.slice(4)) * P + t) +- ',' +- r(i(b) * P + t) +- ',' +- r(i(c) * P + t) +- (d ? ',' + d : ')')- );+ if (shadeRes.color === rgba && shadeRes.alpha === p) return shadeRes.result;+ let i = parseInt,+ r = Math.round,+ P = p < 0,+ t = P ? 0 : 255 * p,+ [a, b, c, d] = rgba.split(',');+ P = P ? 1 + p : 1 - p;+ return (+ 'rgb' ++ (d ? 'a(' : '(') ++ r(i(a[3] === 'a' ? a.slice(5) : a.slice(4)) * P + t) ++ ',' ++ r(i(b) * P + t) ++ ',' ++ r(i(c) * P + t) ++ (d ? ',' + d : ')')+ );};export async function getColorScheme(useSystemTheme) {+ let accentColor = await MMKV.getItem('accentColor');+ let theme = await MMKV.getItem('theme');- let accentColor = await MMKV.getItem('accentColor');- let theme= await MMKV.getItem('theme');---- if (!accentColor ) {- await MMKV.setItem('accentColor', ACCENT.color);- setAccentColor(ACCENT.color);- } else {- setAccentColor(accentColor);- }+ if (!accentColor) {+ await MMKV.setItem('accentColor', ACCENT.color);+ setAccentColor(ACCENT.color);+ } else {+ setAccentColor(accentColor);+ }- if (useSystemTheme) {- Appearance.getColorScheme() === 'dark'- ? setColorScheme(SettingsService.get().pitchBlack ? COLOR_SCHEME_PITCH_BLACK : COLOR_SCHEME_DARK)- : setColorScheme(COLOR_SCHEME_LIGHT);+ if (useSystemTheme) {+ Appearance.getColorScheme() === 'dark'+ ? setColorScheme(+ SettingsService.get().pitchBlack ? COLOR_SCHEME_PITCH_BLACK : COLOR_SCHEME_DARK+ )+ : setColorScheme(COLOR_SCHEME_LIGHT);- return COLOR_SCHEME;- }+ return COLOR_SCHEME;+ }- if (!theme) {- await MMKV.setItem('theme', JSON.stringify({night: false}));- setColorScheme(COLOR_SCHEME_LIGHT);- } else {- theme = JSON.parse(theme);- theme.night- ? setColorScheme(SettingsService.get().pitchBlack ? COLOR_SCHEME_PITCH_BLACK : COLOR_SCHEME_DARK)- : setColorScheme(COLOR_SCHEME_LIGHT);- }- eSendEvent(eThemeUpdated);+ if (!theme) {+ await MMKV.setItem('theme', JSON.stringify({ night: false }));+ setColorScheme(COLOR_SCHEME_LIGHT);+ } else {+ theme = JSON.parse(theme);+ theme.night+ ? setColorScheme(+ SettingsService.get().pitchBlack ? COLOR_SCHEME_PITCH_BLACK : COLOR_SCHEME_DARK+ )+ : setColorScheme(COLOR_SCHEME_LIGHT);+ }+ eSendEvent(eThemeUpdated);- return COLOR_SCHEME;+ return COLOR_SCHEME;}-export const onThemeUpdate = (func = () => {-}) => {- return eSubscribeEvent(eThemeUpdated, func);+export const onThemeUpdate = (func = () => {}) => {+ return eSubscribeEvent(eThemeUpdated, func);};-export const clearThemeUpdateListener = (func = () => {-}) => {- return eUnSubscribeEvent(eThemeUpdated, func);+export const clearThemeUpdateListener = (func = () => {}) => {+ return eUnSubscribeEvent(eThemeUpdated, func);};diff --git a/apps/mobile/src/utils/Colors.js b/apps/mobile/src/utils/Colors.jsindex 9fa329997..9b3a3a4ab 100644--- a/apps/mobile/src/utils/Colors.js+++ b/apps/mobile/src/utils/Colors.js@@ -1,7 +1,7 @@-import {eSendEvent} from '../services/EventManager';-import {eThemeUpdated} from './Events';-import {NativeModules, Platform, StatusBar} from 'react-native';-import {AndroidModule} from '.';+import { eSendEvent } from '../services/EventManager';+import { eThemeUpdated } from './Events';+import { NativeModules, Platform, StatusBar } from 'react-native';+import { AndroidModule } from '.';export const ACCENT = {color: '#008837',@@ -103,12 +103,9 @@ export function getCurrentColors() {}export function setColorScheme(colors = COLOR_SCHEME, accent = ACCENT) {- COLOR_SCHEME = {...colors, accent: accent.color, shade: accent.shade};+ COLOR_SCHEME = { ...colors, accent: accent.color, shade: accent.shade };- StatusBar.setBarStyle(- COLOR_SCHEME.night ? 'light-content' : 'dark-content',- true- );+ StatusBar.setBarStyle(COLOR_SCHEME.night ? 'light-content' : 'dark-content', true);if (Platform.OS === 'android') {AndroidModule.setBackgroundColor(COLOR_SCHEME.bg);@@ -128,10 +125,7 @@ export function setAccentColor(color) {}export function updateStatusBarColor() {- StatusBar.setBarStyle(- COLOR_SCHEME.night ? 'light-content' : 'dark-content',- true- );+ StatusBar.setBarStyle(COLOR_SCHEME.night ? 'light-content' : 'dark-content', true);if (Platform.OS === 'android') {StatusBar.setBackgroundColor('transparent', true);StatusBar.setTranslucent(true, true);diff --git a/apps/mobile/src/utils/EvenSourceIos.js b/apps/mobile/src/utils/EvenSourceIos.jsindex d71a02eda..072457c65 100644--- a/apps/mobile/src/utils/EvenSourceIos.js+++ b/apps/mobile/src/utils/EvenSourceIos.js@@ -1,476 +1,498 @@/*** Copyright (c) 2020 Adam Chelminski*- * Permission is hereby granted, free of charge, to any person obtaining a copy- * of this software and associated documentation files (the "Software"), to- * deal in the Software without restriction, including without limitation the- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or- * sell copies of the Software, and to permit persons to whom the Software is+ * Permission is hereby granted, free of charge, to any person obtaining a copy+ * of this software and associated documentation files (the "Software"), to+ * deal in the Software without restriction, including without limitation the+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or+ * sell copies of the Software, and to permit persons to whom the Software is* furnished to do so, subject to the following conditions:*- * The above copyright notice and this permission notice shall be included in+ * The above copyright notice and this permission notice shall be included in* all copies or substantial portions of the Software.*- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS* IN THE SOFTWARE.** @format- *+ **/- 'use strict';-- var _eventTargetShim = _interopRequireDefault(require("event-target-shim"));-- var _reactNative = require("react-native");-- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }-- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }-- const EVENT_SOURCE_EVENTS = ['error', 'message', 'open', 'connection-error']; // char codes-- const bom = [239, 187, 191]; // byte order mark-- const lf = 10;- const cr = 13;- const reTrim = /^(\s|\u00A0)+|(\s|\u00A0)+$/g;- /**- * An RCTNetworking-based implementation of the EventSource web standard.- *- * See https://developer.mozilla.org/en-US/docs/Web/API/EventSource- * https://html.spec.whatwg.org/multipage/server-sent-events.html- * https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events- */-- class EventSource extends (0, _eventTargetShim.default)(...EVENT_SOURCE_EVENTS) {- // Properties- // Default, retry over a minute per 2.5s.- // Buffers for event stream parsing-- /**- * Custom extension for tracking origins of request.- */- setTrackingName(trackingName) {- this._trackingName = trackingName;- return this;- }- /**- * Creates a new EventSource- * @param {string} url the URL at which to open a stream- * @param {?Object} eventSourceInitDict extra configuration parameters- */--- constructor(url, eventSourceInitDict) {- super();-- _defineProperty(this, "readyState", EventSource.CONNECTING);-- _defineProperty(this, "withCredentials", false);-- _defineProperty(this, "maxRetryEvents", 24);-- _defineProperty(this, "reconnectIntervalMs", 2500);-- _defineProperty(this, "_isFirstChunk", false);-- _defineProperty(this, "_discardNextLineFeed", false);-- _defineProperty(this, "_lineBuf", '');-- _defineProperty(this, "_dataBuf", '');-- _defineProperty(this, "_eventTypeBuf", '');-- _defineProperty(this, "_lastEventIdBuf", '');-- _defineProperty(this, "_headers", {});-- _defineProperty(this, "_lastEventId", '');-- _defineProperty(this, "_trackingName", 'unknown');-- _defineProperty(this, "_retryAttempts", 0);-- if (!url) {- throw new Error('Cannot open an SSE stream on an empty url');- }-- this.url = url;- this._headers['Cache-Control'] = 'no-cache';- this._headers.Accept = 'text/event-stream';-- if (this._lastEventId) {- this._headers['Last-Event-ID'] = this._lastEventId;- } // This is an upsetting hack that appears to only show on Android even though it is HIGHLY not recommended.--- if (_reactNative.Platform.OS === 'android') {- this._headers["X-Requested-With"] = "XMLHttpRequest";- }-- if (eventSourceInitDict) {- if (eventSourceInitDict.headers) {- if (eventSourceInitDict.headers['Last-Event-ID']) {- this._lastEventId = eventSourceInitDict.headers['Last-Event-ID'];- delete eventSourceInitDict.headers['Last-Event-ID'];- }-- for (var headerKey in eventSourceInitDict.headers) {- const header = eventSourceInitDict.headers[headerKey];-- if (header) {- this._headers[headerKey] = header;- }- }- }-- if (eventSourceInitDict.disableAndroidXRequestedWith) {- if (_reactNative.Platform.OS === 'android') {- delete this._headers["X-Requested-With"];- }- }-- if (eventSourceInitDict.withCredentials) {- this.withCredentials = eventSourceInitDict.withCredentials;- }-- if (eventSourceInitDict.reconnectOptions) {- if (eventSourceInitDict.reconnectOptions.reconnectIntervalMs) {- this.reconnectIntervalMs = eventSourceInitDict.reconnectOptions.reconnectIntervalMs;- }-- if (eventSourceInitDict.reconnectOptions.maxRetryEvents) {- this.maxRetryEvents = eventSourceInitDict.reconnectOptions.maxRetryEvents;- }- }- }-- this._subscriptions = [];-- this._subscriptions.push(_reactNative.Networking.addListener('didReceiveNetworkResponse', args => this.__didReceiveResponse(...args)));-- this._subscriptions.push(_reactNative.Networking.addListener('didReceiveNetworkIncrementalData', args => this.__didReceiveIncrementalData(...args)));-- this._subscriptions.push(_reactNative.Networking.addListener('didCompleteNetworkResponse', args => this.__didCompleteResponse(...args)));-- this.__connnect();- }-- close() {- if (this._requestId !== null && this._requestId !== undefined) {- _reactNative.Networking.abortRequest(this._requestId);- } // clean up Networking subscriptions--- (this._subscriptions || []).forEach(sub => {- if (sub) {- sub.remove();- }- });- this._subscriptions = [];- this.readyState = EventSource.CLOSED;- this.dispatchEvent({- type: 'close'- });- }-- __connnect() {- if (this.readyState === EventSource.CLOSED) {- // don't attempt to reestablish connection when the source is closed- return;- }-- if (this._lastEventId) {- this._headers['Last-Event-ID'] = this._lastEventId;- }-- _reactNative.Networking.sendRequest('GET', // EventSource always GETs the resource- this._trackingName, this.url, this._headers, '', // body for EventSource request is always empty- 'text', // SSE is a text protocol- true, // we want incremental events- 0, // there is no timeout defined in the WHATWG spec for EventSource- this.__didCreateRequest.bind(this), this.withCredentials);- }-- __reconnect(reason) {- this.readyState = EventSource.CONNECTING;- let errorEventMessage = 'reestablishing connection';-- if (reason) {- errorEventMessage += ': ' + reason;- }-- this.dispatchEvent({- type: 'error',- data: errorEventMessage- });-- if (this.reconnectIntervalMs > 0) {- setTimeout(this.__connnect.bind(this), this.reconnectIntervalMs);- } else {- this.__connnect();- }- } // Internal buffer processing methods--- __processEventStreamChunk(chunk) {- if (this._isFirstChunk) {- if (bom.every((charCode, idx) => {- return this._lineBuf.charCodeAt(idx) === charCode;- })) {- // Strip byte order mark from chunk- chunk = chunk.slice(bom.length);- }-- this._isFirstChunk = false;- }-- let pos = 0;-- while (pos < chunk.length) {- if (this._discardNextLineFeed) {- if (chunk.charCodeAt(pos) === lf) {- // Ignore this LF since it was preceded by a CR- ++pos;- }-- this._discardNextLineFeed = false;- }-- const curCharCode = chunk.charCodeAt(pos);-- if (curCharCode === cr || curCharCode === lf) {- this.__processEventStreamLine(); // Treat CRLF properly--- if (curCharCode === cr) {- this._discardNextLineFeed = true;- }- } else {- this._lineBuf += chunk.charAt(pos);- }-- ++pos;- }- }-- __processEventStreamLine() {- const line = this._lineBuf; // clear the line buffer-- this._lineBuf = ''; // Dispatch the buffered event if this is an empty line-- if (line === '') {- this.__dispatchBufferedEvent();-- return;- }-- const colonPos = line.indexOf(':');- let field;- let value;-- if (colonPos === 0) {- // this is a comment line and should be ignored- return;- } else if (colonPos > 0) {- if (line[colonPos + 1] === ' ') {- field = line.slice(0, colonPos);- value = line.slice(colonPos + 2); // ignores the first space from the value- } else {- field = line.slice(0, colonPos);- value = line.slice(colonPos + 1);- }- } else {- field = line;- value = '';- }-- switch (field) {- case 'event':- // Set the type of this event- this._eventTypeBuf = value;- break;-- case 'data':- // Append the line to the data buffer along with an LF (U+000A)- this._dataBuf += value;- this._dataBuf += String.fromCodePoint(lf);- break;-- case 'id':- // Update the last seen event id- this._lastEventIdBuf = value;- break;-- case 'retry':- // Set a new reconnect interval value- // But I don't like this.- const newRetryMs = parseInt(value, 10);-- if (!isNaN(newRetryMs)) {- this.reconnectIntervalMs = newRetryMs;- }-- break;-- default: // this is an unrecognized field, so this line should be ignored-- }- }-- __dispatchBufferedEvent() {- this._lastEventId = this._lastEventIdBuf; // If the data buffer is an empty string, set the event type buffer to- // empty string and return-- if (this._dataBuf === '') {- this._eventTypeBuf = '';- return;- } // Dispatch the event--- const eventType = this._eventTypeBuf || 'message';- this.dispatchEvent({- type: eventType,- data: this._dataBuf.slice(0, -1),- // remove the trailing LF from the data- origin: this.url,- lastEventId: this._lastEventId- }); // Reset the data and event type buffers-- this._dataBuf = '';- this._eventTypeBuf = '';- } // Networking callbacks, exposed for testing--- __didCreateRequest(requestId) {- this._requestId = requestId;- }-- __didReceiveResponse(requestId, status, responseHeaders, responseURL) {- if (requestId !== this._requestId) {- return;- }-- if (responseHeaders) {- // make the header names case insensitive- for (const entry of Object.entries(responseHeaders)) {- const [key, value] = entry;- delete responseHeaders[key];- responseHeaders[key.toLowerCase()] = value;- }- } // Handle redirects--- if (status === 301 || status === 307) {- if (responseHeaders && responseHeaders.location) {- // set the new URL, set the requestId to null so that request- // completion doesn't attempt a reconnect, and immediately attempt- // reconnecting- this.url = responseHeaders.location;- this._requestId = null;-- this.__connnect();-- return;- } else {- this.dispatchEvent({- type: 'error',- data: 'got redirect with no location'- });- return this.close();- }- }-- if (status !== 200) {- this.dispatchEvent({- type: 'error',- data: 'unexpected HTTP status ' + status- });- return this.close();- }-- if (responseHeaders && responseHeaders['content-type'] !== 'text/event-stream') {- this.dispatchEvent({- type: 'error',- data: 'unsupported MIME type in response: ' + responseHeaders['content-type']- });- return this.close();- } else if (!responseHeaders) {- this.dispatchEvent({- type: 'error',- data: 'no MIME type in response'- });- return this.close();- } // reset the connection retry attempt counter--- this._retryAttempts = 0; // reset the stream processing buffers-- this._isFirstChunk = false;- this._discardNextLineFeed = false;- this._lineBuf = '';- this._dataBuf = '';- this._eventTypeBuf = '';- this._lastEventIdBuf = '';- this.readyState = EventSource.OPEN;- this.dispatchEvent({- type: 'open'- });- }-- __didReceiveIncrementalData(requestId, responseText, progress, total) {- if (requestId !== this._requestId) {- return;- }-- this.__processEventStreamChunk(responseText);- }-- __didCompleteResponse(requestId, error, timeOutError) {- if (requestId !== this._requestId) {- return;- } // The spec states: 'Network errors that prevents the connection from being- // established in the first place (e.g. DNS errors), should cause the user- // agent to reestablish the connection in parallel, unless the user agent- // knows that to be futile, in which case the user agent may fail the- // connection.'- //- // We are treating 5 unnsuccessful retry attempts as a sign that attempting- // to reconnect is 'futile'. Future improvements could also add exponential- // backoff.--- if (this._retryAttempts < this.maxRetryAttempts) {- // pass along the error message so that the user sees it as part of the- // error event fired for re-establishing the connection- this._retryAttempts += 1;-- this.__reconnect(error);- } else {- this.dispatchEvent({- type: 'error',- data: 'could not reconnect after ' + this.maxRetryAttempts + ' attempts'- });- this.close();- }- }-- }-- _defineProperty(EventSource, "CONNECTING", 0);-- _defineProperty(EventSource, "OPEN", 1);-- _defineProperty(EventSource, "CLOSED", 2);-- _defineProperty(EventSource, "XMLHTTP_LOADING", 3);-- _defineProperty(EventSource, "XMLHTTP_DONE", 4);-- module.exports = EventSource;\ No newline at end of file+'use strict';++var _eventTargetShim = _interopRequireDefault(require('event-target-shim'));++var _reactNative = require('react-native');++function _interopRequireDefault(obj) {+ return obj && obj.__esModule ? obj : { default: obj };+}++function _defineProperty(obj, key, value) {+ if (key in obj) {+ Object.defineProperty(obj, key, {+ value: value,+ enumerable: true,+ configurable: true,+ writable: true+ });+ } else {+ obj[key] = value;+ }+ return obj;+}++const EVENT_SOURCE_EVENTS = ['error', 'message', 'open', 'connection-error']; // char codes++const bom = [239, 187, 191]; // byte order mark++const lf = 10;+const cr = 13;+const reTrim = /^(\s|\u00A0)+|(\s|\u00A0)+$/g;+/**+ * An RCTNetworking-based implementation of the EventSource web standard.+ *+ * See https://developer.mozilla.org/en-US/docs/Web/API/EventSource+ * https://html.spec.whatwg.org/multipage/server-sent-events.html+ * https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events+ */++class EventSource extends (0, _eventTargetShim.default)(...EVENT_SOURCE_EVENTS) {+ // Properties+ // Default, retry over a minute per 2.5s.+ // Buffers for event stream parsing++ /**+ * Custom extension for tracking origins of request.+ */+ setTrackingName(trackingName) {+ this._trackingName = trackingName;+ return this;+ }+ /**+ * Creates a new EventSource+ * @param {string} url the URL at which to open a stream+ * @param {?Object} eventSourceInitDict extra configuration parameters+ */++ constructor(url, eventSourceInitDict) {+ super();++ _defineProperty(this, 'readyState', EventSource.CONNECTING);++ _defineProperty(this, 'withCredentials', false);++ _defineProperty(this, 'maxRetryEvents', 24);++ _defineProperty(this, 'reconnectIntervalMs', 2500);++ _defineProperty(this, '_isFirstChunk', false);++ _defineProperty(this, '_discardNextLineFeed', false);++ _defineProperty(this, '_lineBuf', '');++ _defineProperty(this, '_dataBuf', '');++ _defineProperty(this, '_eventTypeBuf', '');++ _defineProperty(this, '_lastEventIdBuf', '');++ _defineProperty(this, '_headers', {});++ _defineProperty(this, '_lastEventId', '');++ _defineProperty(this, '_trackingName', 'unknown');++ _defineProperty(this, '_retryAttempts', 0);++ if (!url) {+ throw new Error('Cannot open an SSE stream on an empty url');+ }++ this.url = url;+ this._headers['Cache-Control'] = 'no-cache';+ this._headers.Accept = 'text/event-stream';++ if (this._lastEventId) {+ this._headers['Last-Event-ID'] = this._lastEventId;+ } // This is an upsetting hack that appears to only show on Android even though it is HIGHLY not recommended.++ if (_reactNative.Platform.OS === 'android') {+ this._headers['X-Requested-With'] = 'XMLHttpRequest';+ }++ if (eventSourceInitDict) {+ if (eventSourceInitDict.headers) {+ if (eventSourceInitDict.headers['Last-Event-ID']) {+ this._lastEventId = eventSourceInitDict.headers['Last-Event-ID'];+ delete eventSourceInitDict.headers['Last-Event-ID'];+ }++ for (var headerKey in eventSourceInitDict.headers) {+ const header = eventSourceInitDict.headers[headerKey];++ if (header) {+ this._headers[headerKey] = header;+ }+ }+ }++ if (eventSourceInitDict.disableAndroidXRequestedWith) {+ if (_reactNative.Platform.OS === 'android') {+ delete this._headers['X-Requested-With'];+ }+ }++ if (eventSourceInitDict.withCredentials) {+ this.withCredentials = eventSourceInitDict.withCredentials;+ }++ if (eventSourceInitDict.reconnectOptions) {+ if (eventSourceInitDict.reconnectOptions.reconnectIntervalMs) {+ this.reconnectIntervalMs = eventSourceInitDict.reconnectOptions.reconnectIntervalMs;+ }++ if (eventSourceInitDict.reconnectOptions.maxRetryEvents) {+ this.maxRetryEvents = eventSourceInitDict.reconnectOptions.maxRetryEvents;+ }+ }+ }++ this._subscriptions = [];++ this._subscriptions.push(+ _reactNative.Networking.addListener('didReceiveNetworkResponse', args =>+ this.__didReceiveResponse(...args)+ )+ );++ this._subscriptions.push(+ _reactNative.Networking.addListener('didReceiveNetworkIncrementalData', args =>+ this.__didReceiveIncrementalData(...args)+ )+ );++ this._subscriptions.push(+ _reactNative.Networking.addListener('didCompleteNetworkResponse', args =>+ this.__didCompleteResponse(...args)+ )+ );++ this.__connnect();+ }++ close() {+ if (this._requestId !== null && this._requestId !== undefined) {+ _reactNative.Networking.abortRequest(this._requestId);+ } // clean up Networking subscriptions++ (this._subscriptions || []).forEach(sub => {+ if (sub) {+ sub.remove();+ }+ });+ this._subscriptions = [];+ this.readyState = EventSource.CLOSED;+ this.dispatchEvent({+ type: 'close'+ });+ }++ __connnect() {+ if (this.readyState === EventSource.CLOSED) {+ // don't attempt to reestablish connection when the source is closed+ return;+ }++ if (this._lastEventId) {+ this._headers['Last-Event-ID'] = this._lastEventId;+ }++ _reactNative.Networking.sendRequest(+ 'GET', // EventSource always GETs the resource+ this._trackingName,+ this.url,+ this._headers,+ '', // body for EventSource request is always empty+ 'text', // SSE is a text protocol+ true, // we want incremental events+ 0, // there is no timeout defined in the WHATWG spec for EventSource+ this.__didCreateRequest.bind(this),+ this.withCredentials+ );+ }++ __reconnect(reason) {+ this.readyState = EventSource.CONNECTING;+ let errorEventMessage = 'reestablishing connection';++ if (reason) {+ errorEventMessage += ': ' + reason;+ }++ this.dispatchEvent({+ type: 'error',+ data: errorEventMessage+ });++ if (this.reconnectIntervalMs > 0) {+ setTimeout(this.__connnect.bind(this), this.reconnectIntervalMs);+ } else {+ this.__connnect();+ }+ } // Internal buffer processing methods++ __processEventStreamChunk(chunk) {+ if (this._isFirstChunk) {+ if (+ bom.every((charCode, idx) => {+ return this._lineBuf.charCodeAt(idx) === charCode;+ })+ ) {+ // Strip byte order mark from chunk+ chunk = chunk.slice(bom.length);+ }++ this._isFirstChunk = false;+ }++ let pos = 0;++ while (pos < chunk.length) {+ if (this._discardNextLineFeed) {+ if (chunk.charCodeAt(pos) === lf) {+ // Ignore this LF since it was preceded by a CR+ ++pos;+ }++ this._discardNextLineFeed = false;+ }++ const curCharCode = chunk.charCodeAt(pos);++ if (curCharCode === cr || curCharCode === lf) {+ this.__processEventStreamLine(); // Treat CRLF properly++ if (curCharCode === cr) {+ this._discardNextLineFeed = true;+ }+ } else {+ this._lineBuf += chunk.charAt(pos);+ }++ ++pos;+ }+ }++ __processEventStreamLine() {+ const line = this._lineBuf; // clear the line buffer++ this._lineBuf = ''; // Dispatch the buffered event if this is an empty line++ if (line === '') {+ this.__dispatchBufferedEvent();++ return;+ }++ const colonPos = line.indexOf(':');+ let field;+ let value;++ if (colonPos === 0) {+ // this is a comment line and should be ignored+ return;+ } else if (colonPos > 0) {+ if (line[colonPos + 1] === ' ') {+ field = line.slice(0, colonPos);+ value = line.slice(colonPos + 2); // ignores the first space from the value+ } else {+ field = line.slice(0, colonPos);+ value = line.slice(colonPos + 1);+ }+ } else {+ field = line;+ value = '';+ }++ switch (field) {+ case 'event':+ // Set the type of this event+ this._eventTypeBuf = value;+ break;++ case 'data':+ // Append the line to the data buffer along with an LF (U+000A)+ this._dataBuf += value;+ this._dataBuf += String.fromCodePoint(lf);+ break;++ case 'id':+ // Update the last seen event id+ this._lastEventIdBuf = value;+ break;++ case 'retry':+ // Set a new reconnect interval value+ // But I don't like this.+ const newRetryMs = parseInt(value, 10);++ if (!isNaN(newRetryMs)) {+ this.reconnectIntervalMs = newRetryMs;+ }++ break;++ default: // this is an unrecognized field, so this line should be ignored+ }+ }++ __dispatchBufferedEvent() {+ this._lastEventId = this._lastEventIdBuf; // If the data buffer is an empty string, set the event type buffer to+ // empty string and return++ if (this._dataBuf === '') {+ this._eventTypeBuf = '';+ return;+ } // Dispatch the event++ const eventType = this._eventTypeBuf || 'message';+ this.dispatchEvent({+ type: eventType,+ data: this._dataBuf.slice(0, -1),+ // remove the trailing LF from the data+ origin: this.url,+ lastEventId: this._lastEventId+ }); // Reset the data and event type buffers++ this._dataBuf = '';+ this._eventTypeBuf = '';+ } // Networking callbacks, exposed for testing++ __didCreateRequest(requestId) {+ this._requestId = requestId;+ }++ __didReceiveResponse(requestId, status, responseHeaders, responseURL) {+ if (requestId !== this._requestId) {+ return;+ }++ if (responseHeaders) {+ // make the header names case insensitive+ for (const entry of Object.entries(responseHeaders)) {+ const [key, value] = entry;+ delete responseHeaders[key];+ responseHeaders[key.toLowerCase()] = value;+ }+ } // Handle redirects++ if (status === 301 || status === 307) {+ if (responseHeaders && responseHeaders.location) {+ // set the new URL, set the requestId to null so that request+ // completion doesn't attempt a reconnect, and immediately attempt+ // reconnecting+ this.url = responseHeaders.location;+ this._requestId = null;++ this.__connnect();++ return;+ } else {+ this.dispatchEvent({+ type: 'error',+ data: 'got redirect with no location'+ });+ return this.close();+ }+ }++ if (status !== 200) {+ this.dispatchEvent({+ type: 'error',+ data: 'unexpected HTTP status ' + status+ });+ return this.close();+ }++ if (responseHeaders && responseHeaders['content-type'] !== 'text/event-stream') {+ this.dispatchEvent({+ type: 'error',+ data: 'unsupported MIME type in response: ' + responseHeaders['content-type']+ });+ return this.close();+ } else if (!responseHeaders) {+ this.dispatchEvent({+ type: 'error',+ data: 'no MIME type in response'+ });+ return this.close();+ } // reset the connection retry attempt counter++ this._retryAttempts = 0; // reset the stream processing buffers++ this._isFirstChunk = false;+ this._discardNextLineFeed = false;+ this._lineBuf = '';+ this._dataBuf = '';+ this._eventTypeBuf = '';+ this._lastEventIdBuf = '';+ this.readyState = EventSource.OPEN;+ this.dispatchEvent({+ type: 'open'+ });+ }++ __didReceiveIncrementalData(requestId, responseText, progress, total) {+ if (requestId !== this._requestId) {+ return;+ }++ this.__processEventStreamChunk(responseText);+ }++ __didCompleteResponse(requestId, error, timeOutError) {+ if (requestId !== this._requestId) {+ return;+ } // The spec states: 'Network errors that prevents the connection from being+ // established in the first place (e.g. DNS errors), should cause the user+ // agent to reestablish the connection in parallel, unless the user agent+ // knows that to be futile, in which case the user agent may fail the+ // connection.'+ //+ // We are treating 5 unnsuccessful retry attempts as a sign that attempting+ // to reconnect is 'futile'. Future improvements could also add exponential+ // backoff.++ if (this._retryAttempts < this.maxRetryAttempts) {+ // pass along the error message so that the user sees it as part of the+ // error event fired for re-establishing the connection+ this._retryAttempts += 1;++ this.__reconnect(error);+ } else {+ this.dispatchEvent({+ type: 'error',+ data: 'could not reconnect after ' + this.maxRetryAttempts + ' attempts'+ });+ this.close();+ }+ }+}++_defineProperty(EventSource, 'CONNECTING', 0);++_defineProperty(EventSource, 'OPEN', 1);++_defineProperty(EventSource, 'CLOSED', 2);++_defineProperty(EventSource, 'XMLHTTP_LOADING', 3);++_defineProperty(EventSource, 'XMLHTTP_DONE', 4);++module.exports = EventSource;diff --git a/apps/mobile/src/utils/EventSource.js b/apps/mobile/src/utils/EventSource.jsindex bdf5e9c15..ee1c22962 100644--- a/apps/mobile/src/utils/EventSource.js+++ b/apps/mobile/src/utils/EventSource.js@@ -1,7 +1,7 @@-import {NativeEventEmitter, NativeModules, Platform} from 'react-native';+import { NativeEventEmitter, NativeModules, Platform } from 'react-native';-const NativeEventSource = Platform.OS === "ios"? null : NativeModules.EventSource;-const EventEmitter = Platform.OS === "ios"? null : new NativeEventEmitter(NativeEventSource);+const NativeEventSource = Platform.OS === 'ios' ? null : NativeModules.EventSource;+const EventEmitter = Platform.OS === 'ios' ? null : new NativeEventEmitter(NativeEventSource);export default class EventSource {constructor(url, options) {@@ -28,9 +28,9 @@ export default class EventSource {this.onopen();});- this.message = EventEmitter.addListener("message", (ev) => {- const {message} = ev;- const eventData = {data: message};+ this.message = EventEmitter.addListener('message', ev => {+ const { message } = ev;+ const eventData = { data: message };this.onmessage(eventData);});}diff --git a/apps/mobile/src/utils/Events.js b/apps/mobile/src/utils/Events.jsindex 5e04d5459..a6025c672 100644--- a/apps/mobile/src/utils/Events.js+++ b/apps/mobile/src/utils/Events.js@@ -76,13 +76,13 @@ export const eSwitchNightMode = '537';export const eStartSyncer = '538';-export const eSetModalNavigator = '539'+export const eSetModalNavigator = '539';-export const eOpenPremiumDialog = '540'+export const eOpenPremiumDialog = '540';-export const eClosePremiumDialog = '541'+export const eClosePremiumDialog = '541';-export const eResetApp = '542'+export const eResetApp = '542';export const eOpenExportDialog = '543';@@ -137,4 +137,4 @@ export const eCloseAttachmentDialog = '601';export const eOpenTrialEndingDialog = '602';export const eOpenAnnouncementDialog = '603';-export const eCloseAnnouncementDialog = '604'\ No newline at end of file+export const eCloseAnnouncementDialog = '604';diff --git a/apps/mobile/src/utils/MMKV.js b/apps/mobile/src/utils/MMKV.jsindex c6c3cf362..b8523eb4b 100644--- a/apps/mobile/src/utils/MMKV.js+++ b/apps/mobile/src/utils/MMKV.js@@ -1,3 +1,3 @@-import MMKVStorage from "react-native-mmkv-storage";+import MMKVStorage from 'react-native-mmkv-storage';-export const MMKV = new MMKVStorage.Loader().initialize();\ No newline at end of file+export const MMKV = new MMKVStorage.Loader().initialize();diff --git a/apps/mobile/src/utils/Refs.js b/apps/mobile/src/utils/Refs.jsindex d5bb98f5e..30e7a4e3e 100644--- a/apps/mobile/src/utils/Refs.js+++ b/apps/mobile/src/utils/Refs.js@@ -1,4 +1,4 @@-import {createRef} from 'react';+import { createRef } from 'react';export const sideMenuRef = createRef();export const inputRef = createRef();diff --git a/apps/mobile/src/utils/SizeUtils.js b/apps/mobile/src/utils/SizeUtils.jsindex 4027e9d67..ca3a23a94 100644--- a/apps/mobile/src/utils/SizeUtils.js+++ b/apps/mobile/src/utils/SizeUtils.js@@ -1,8 +1,8 @@-import {Dimensions, PixelRatio, Platform} from 'react-native';-import {DDS} from '../services/DeviceDetection';+import { Dimensions, PixelRatio, Platform } from 'react-native';+import { DDS } from '../services/DeviceDetection';export const scale = {- fontScale: 1,+ fontScale: 1};let windowSize = Dimensions.get('window');let adjustedWidth = windowSize.width * PixelRatio.get();@@ -13,13 +13,12 @@ export const getDeviceSize = () => {let deviceWidthInInches = adjustedWidth / dpi;let deviceHeightInInches = adjustedHeight / dpi;let diagonalSize = Math.sqrt(- Math.pow(deviceWidthInInches, 2) + Math.pow(deviceHeightInInches, 2),+ Math.pow(deviceWidthInInches, 2) + Math.pow(deviceHeightInInches, 2));- return Platform.isPad? diagonalSize + 2 : diagonalSize;+ return Platform.isPad ? diagonalSize + 2 : diagonalSize;};-const getDpi = (pd) => {-+const getDpi = pd => {return 160 * pd;};const correction = (size, multiplier) => {@@ -47,7 +46,7 @@ const correction = (size, multiplier) => {return size;}};-export const normalize = (size) => {+export const normalize = size => {let pd = pixelDensity;if (pd === 1 || pd < 1) {return correction(size, 0.82);@@ -64,12 +63,12 @@ export const normalize = (size) => {export const SIZE = {xxs: normalize(10.5) * scale.fontScale,xs: normalize(12) * scale.fontScale,- sm: normalize(14.5) * scale.fontScale,+ sm: normalize(14.5) * scale.fontScale,md: normalize(16) * scale.fontScale,lg: normalize(22) * scale.fontScale,xl: normalize(24) * scale.fontScale,xxl: normalize(28) * scale.fontScale,- xxxl: normalize(32) * scale.fontScale,+ xxxl: normalize(32) * scale.fontScale};export function updateSize() {@@ -89,4 +88,3 @@ export const br = 5; // border radiusexport var ph = normalize(10); // padding horizontalexport var pv = normalize(10); // padding verticalexport const opacity = 0.5; // active opacity-diff --git a/apps/mobile/src/utils/Storage.js b/apps/mobile/src/utils/Storage.jsindex f36d5e080..dd24607d5 100644--- a/apps/mobile/src/utils/Storage.js+++ b/apps/mobile/src/utils/Storage.js@@ -1,9 +1,9 @@-import {Platform} from 'react-native';+import { Platform } from 'react-native';import 'react-native-get-random-values';import * as Keychain from 'react-native-keychain';-import {generateSecureRandom} from 'react-native-securerandom';+import { generateSecureRandom } from 'react-native-securerandom';import Sodium from 'react-native-sodium';-import {MMKV} from './mmkv';+import { MMKV } from './mmkv';let RNFetchBlob;async function read(key) {@@ -19,10 +19,7 @@ async function read(key) {}async function write(key, data) {- return await MMKV.setItem(- key,- typeof data === 'string' ? data : JSON.stringify(data)- );+ return await MMKV.setItem(key, typeof data === 'string' ? data : JSON.stringify(data));}async function readMulti(keys) {@@ -54,8 +51,7 @@ async function clear() {async function encrypt(password, data) {if (!password.password && !password.key) return undefined;- if (password.password && password.password === '' && !password.key)- return undefined;+ if (password.password && password.password === '' && !password.key) return undefined;let message = {type: 'plain',@@ -75,9 +71,8 @@ function getAlgorithm(base64Variant) {async function decrypt(password, data) {if (!password.password && !password.key) return undefined;- if (password.password && password.password === '' && !password.key)- return undefined;- let _data = {...data};+ if (password.password && password.password === '' && !password.key) return undefined;+ let _data = { ...data };_data.output = 'plain';return await Sodium.decrypt(password, _data);}@@ -104,12 +99,7 @@ let CRYPT_CONFIG = Platform.select({async function deriveCryptoKey(name, data) {try {let credentials = await Sodium.deriveKey(data.password, data.salt);- await Keychain.setInternetCredentials(- 'notesnook',- name,- credentials.key,- CRYPT_CONFIG- );+ await Keychain.setInternetCredentials('notesnook', name, credentials.key, CRYPT_CONFIG);return credentials.key;} catch (e) {}}@@ -117,10 +107,7 @@ async function deriveCryptoKey(name, data) {async function getCryptoKey(name) {try {if (await Keychain.hasInternetCredentials('notesnook')) {- let credentials = await Keychain.getInternetCredentials(- 'notesnook',- CRYPT_CONFIG- );+ let credentials = await Keychain.getInternetCredentials('notesnook', CRYPT_CONFIG);return credentials.password;} else {return null;diff --git a/apps/mobile/src/utils/TimeUtils.js b/apps/mobile/src/utils/TimeUtils.jsindex 4e5acf8fd..7a0645090 100644--- a/apps/mobile/src/utils/TimeUtils.js+++ b/apps/mobile/src/utils/TimeUtils.js@@ -1,6 +1,4 @@--export const sleep = (duration) =>- new Promise((resolve) => setTimeout(() => resolve(), duration));+export const sleep = duration => new Promise(resolve => setTimeout(() => resolve(), duration));export function timeSince(date) {let seconds = Math.floor((new Date() - date) / 1000);@@ -16,7 +14,7 @@ export function timeSince(date) {interval = Math.floor(seconds / (86400 * 7));if (interval > 0.9) {- if (interval === 4) return "1mo ago";+ if (interval === 4) return '1mo ago';return interval < 2 ? interval + 'w ago' : interval + 'w ago';}@@ -32,12 +30,10 @@ export function timeSince(date) {if (interval > 0.9) {return interval < 2 ? interval + 'm ago' : interval + 'm ago';}- return Math.floor(seconds) < 0- ? '0s ago'- : Math.floor(seconds) + 's ago';+ return Math.floor(seconds) < 0 ? '0s ago' : Math.floor(seconds) + 's ago';}-export const timeConverter = (timestamp) => {+export const timeConverter = timestamp => {if (!timestamp) return;let d = new Date(timestamp), // Convert the passed timestamp to millisecondsyyyy = d.getFullYear(),@@ -50,20 +46,7 @@ export const timeConverter = (timestamp) => {ampm = 'AM',time;let days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];- let months = [- 'Jan',- 'Feb',- 'Mar',- 'Apr',- 'May',- 'Jun',- 'Jul',- 'Aug',- 'Sep',- 'Oct',- 'Nov',- 'Dec',- ];+ let months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];if (hh > 12) {h = hh - 12;diff --git a/apps/mobile/src/utils/ackee.js b/apps/mobile/src/utils/ackee.jsindex e2453269e..a2dbcab26 100644--- a/apps/mobile/src/utils/ackee.js+++ b/apps/mobile/src/utils/ackee.js@@ -1,8 +1,8 @@-import {AppState, Platform} from 'react-native';+import { AppState, Platform } from 'react-native';const platform = {osName: Platform.OS,- osVersion: Platform.Version,+ osVersion: Platform.Version};const isBrowser = typeof window !== 'undefined';@@ -82,11 +82,11 @@ export const attributes = function (detailed = false) {siteLocation: 'com.streetwriters.notesnook',siteReferrer: '',source: source(),- osName: platform.osName,+ osName: platform.osName};return {- ...defaultData,+ ...defaultData};};@@ -109,8 +109,8 @@ const createRecordBody = function (domainId, input) {`,variables: {domainId,- input,- },+ input+ }};};@@ -129,8 +129,8 @@ const updateRecordBody = function (recordId) {}`,variables: {- recordId,- },+ recordId+ }};};@@ -153,8 +153,8 @@ const createActionBody = function (eventId, input) {`,variables: {eventId,- input,- },+ input+ }};};@@ -175,8 +175,8 @@ const updateActionBody = function (actionId, input) {`,variables: {actionId,- input,- },+ input+ }};};@@ -246,10 +246,10 @@ export const create = function (server, opts) {// Fake instance when Ackee ignores youconst fakeInstance = {- record: () => ({stop: noop}),- updateRecord: () => ({stop: noop}),+ record: () => ({ stop: noop }),+ updateRecord: () => ({ stop: noop }),action: noop,- updateAction: noop,+ updateAction: noop};if (opts.ignoreLocalhost === true && isLocalhost() === true) {@@ -289,7 +289,7 @@ export const create = function (server, opts) {}});- return {stop};+ return { stop };};// Updates a record very x seconds to track the duration of the visit@@ -302,7 +302,7 @@ export const create = function (server, opts) {if (isFakeId(recordId) === true) {console.warn('Ackee ignores you because this is your own site');- return {stop};+ return { stop };}const interval = setInterval(() => {@@ -316,7 +316,7 @@ export const create = function (server, opts) {send(url, updateRecordBody(recordId), opts);}, 15000);- return {stop};+ return { stop };};// Creates a new action on the server@@ -348,6 +348,6 @@ export const create = function (server, opts) {record: _record,updateRecord: _updateRecord,action: _action,- updateAction: _updateAction,+ updateAction: _updateAction};};diff --git a/apps/mobile/src/utils/database.js b/apps/mobile/src/utils/database.jsindex 7713cffc7..27c381b09 100644--- a/apps/mobile/src/utils/database.js+++ b/apps/mobile/src/utils/database.js@@ -1,4 +1,4 @@-import {Platform} from 'react-native';+import { Platform } from 'react-native';import Storage from './storage';import EventSource from './even-source-ios';import AndroidEventSource from './event-source';diff --git a/apps/mobile/src/utils/differ.js b/apps/mobile/src/utils/differ.jsindex 5783366b9..44fe15c1a 100644--- a/apps/mobile/src/utils/differ.js+++ b/apps/mobile/src/utils/differ.js@@ -27,841 +27,785 @@* == '<p>this is some <ins class="diff-class">more </ins>text</p>'*/(function () {- function is_start_of_tag(char) {- return char === "<";- }- const IS_CLOSE_TAG_REGEX = /^\s*<\s*\/[^>]+>\s*$/;- function is_close_tag(tag) {- return IS_CLOSE_TAG_REGEX.test(tag);- }-- const IS_TAG_REGEX = /^\s*<[^>]+>\s*$/;- function is_tag(token) {- return IS_TAG_REGEX.test(token);- }-- function isnt_tag(token) {- return !is_tag(token);- }-- /*- * Checks if the current word is the beginning of an atomic tag. An atomic tag is one whose- * child nodes should not be compared - the entire tag should be treated as one token. This- * is useful for tags where it does not make sense to insert <ins> and <del> tags.- *- * @param {string} word The characters of the current token read so far.- *- * @return {string|null} The name of the atomic tag if the word will be an atomic tag,- * null otherwise- */- const IS_START_ATOMIC_TAG = /^<(iframe|object|math|svg|script)/;- function is_start_of_atomic_tag(word) {- var result = IS_START_ATOMIC_TAG.exec(word);- if (result) {- result = result[1];- }- return result;- }-- /*- * Checks if a tag is a void tag.- *- * @param {string} token The token to check.- *- * @return {boolean} True if the token is a void tag, false otherwise.- */- const IS_VOID_TAG_REGEX = /^\s*<[^>]+\/>\s*$/;- function is_void_tag(token) {- return IS_VOID_TAG_REGEX.test(token);- }-- /*- * Checks if a token can be wrapped inside a tag.- *- * @param {string} token The token to check.- *- * @return {boolean} True if the token can be wrapped inside a tag, false otherwise.- */- function is_wrappable(token) {- return (- isnt_tag(token) || is_start_of_atomic_tag(token) || is_void_tag(token)- );- }-- /*- * A Match stores the information of a matching block. A matching block is a list of- * consecutive tokens that appear in both the before and after lists of tokens.- *- * @param {number} start_in_before The index of the first token in the list of before tokens.- * @param {number} start_in_after The index of the first token in the list of after tokens.- * @param {number} length The number of consecutive matching tokens in this block.- */- function Match(start_in_before, start_in_after, length) {- this.start_in_before = start_in_before;- this.start_in_after = start_in_after;- this.length = length;- this.end_in_before = this.start_in_before + this.length - 1;- this.end_in_after = this.start_in_after + this.length - 1;- }-- function return_dual_pane(before, after) {- return {- before: before,- after: after,- };- }-- /*- * Merge tokens in component by regex rule.- *- * @param {find_regex} dictate witch tag we want to merge.- * @param {words Array.<string>} input data already parsed array(html tags) by html_tokens method.- * @return {Array.<string>} The list of tokens with merged components requested by component_search_role.- */- function merge_html_by_class(find_regex, words) {- var merged_words_array = [],- merged_words_to_string = "",- count_open_tags = 0;-- for (var i = 0; i < words.length; i++) {- var tag_part = words[i];- //merge html tags until parent tag is not closed (also ignore self closed html tags)- if (count_open_tags > 0 || find_regex.test(tag_part)) {- if (- is_start_of_tag(tag_part.slice(0, 1)) &&- !is_void_tag(tag_part) &&- !is_start_of_atomic_tag(tag_part)- ) {- count_open_tags += is_close_tag(tag_part) ? -1 : 1;- }- //combine all html string from html tokens while all condition are true- merged_words_to_string += tag_part;- //after parent tag is closed push as one html token- if (count_open_tags === 0) {- merged_words_array.push(merged_words_to_string);- merged_words_to_string = "";- }- } else {- //all tags that are not part of components we wont to merge just ignore- merged_words_array.push(tag_part);- }- }- return merged_words_array;- }-- /*- * Tokenizes a string of HTML.- *- * @param {string} html The string to tokenize.- *- * @return {Array.<string>} The list of tokens.- */-- function html_to_tokens(html, components_search_rule) {- let words = [];- const range = {- start: 0,- end: 0,- tagOpen: false,- whitespaceOpen: false,- ampersandOpen: false,- };- for (var i = 0; i < html.length; ++i) {- const s = html[i];-- if (s === " " || s === "\n" || s === "\r" || s === "\t") {- if (range.tagOpen || range.whitespaceOpen) continue;-- //range.end = i;- if (range.start !== i) words.push(html.slice(range.start, i));-- range.whitespaceOpen = true;- range.start = i;- } else if (range.whitespaceOpen) {- range.whitespaceOpen = false;- // range.end = i;- words.push(html.slice(range.start, i));- range.start = i;- }-- if (s === "<") {- range.tagOpen = true;-- if (range.start !== i) {- words.push(html.slice(range.start, i));- }-- range.start = i;- } else if (s === ">") {- range.tagOpen = false;- words.push(html.slice(range.start, i + 1));- range.start = i + 1;- } else if (!range.ampersandOpen && s === "&") {- range.ampersandOpen = true;- if (range.start !== i) words.push(html.slice(range.start, i));- range.start = i;- } else if (range.ampersandOpen && s === ";") {- range.ampersandOpen = false;- words.push(html.slice(range.start, i + 1));- range.start = i + 1;- }- }- if (range.start !== html.length) {- words.push(html.slice(range.start, html.length));- }-- return components_search_rule- ? merge_html_by_class(components_search_rule, words)- : words;- }-- /*- * Creates a key that should be used to match tokens. This is useful, for example, if we want- * to consider two open tag tokens as equal, even if they don't have the same attributes. We- * use a key instead of overwriting the token because we may want to render the original string- * without losing the attributes.- *- * @param {string} token The token to create the key for.- *- * @return {string} The identifying key that should be used to match before and after tokens.- */- function get_key_for_token(token) {- var tag_name = /<([^\s>]+)[\s>]/.exec(token);- if (tag_name) {- return "<" + tag_name[1].toLowerCase() + ">";- }- if (token) {- return token.replace(/(\s+| | )/g, " ");- }- return token;- }-- /*- * Finds the matching block with the most consecutive tokens within the given range in the- * before and after lists of tokens.- *- * @param {Array.<string>} before_tokens The before list of tokens.- * @param {Array.<string>} after_tokens The after list of tokens.- * @param {Object} index_of_before_locations_in_after_tokens The index that is used to search- * for tokens in the after list.- * @param {number} start_in_before The beginning of the range in the list of before tokens.- * @param {number} end_in_before The end of the range in the list of before tokens.- * @param {number} start_in_after The beginning of the range in the list of after tokens.- * @param {number} end_in_after The end of the range in the list of after tokens.- *- * @return {Match} A Match that describes the best matching block in the given range.- */- function find_match(- before_tokens,- after_tokens,- index_of_before_locations_in_after_tokens,- start_in_before,- end_in_before,- start_in_after,- end_in_after- ) {- var best_match_in_before = start_in_before;- var best_match_in_after = start_in_after;- var best_match_length = 0;- var match_length_at = {};- for (- var index_in_before = start_in_before;- index_in_before < end_in_before;- index_in_before++- ) {- var new_match_length_at = {};- var looking_for = get_key_for_token(before_tokens[index_in_before]);- var locations_in_after =- index_of_before_locations_in_after_tokens[looking_for];-- for (var i = 0; i < locations_in_after.length; i++) {- var index_in_after = locations_in_after[i];- if (index_in_after < start_in_after) continue;- if (index_in_after >= end_in_after) break;-- if (!match_length_at[index_in_after - 1]) {- match_length_at[index_in_after - 1] = 0;- }- var new_match_length = match_length_at[index_in_after - 1] + 1;- new_match_length_at[index_in_after] = new_match_length;-- if (new_match_length > best_match_length) {- best_match_in_before = index_in_before - new_match_length + 1;- best_match_in_after = index_in_after - new_match_length + 1;- best_match_length = new_match_length;- }- }- match_length_at = new_match_length_at;- }- if (best_match_length !== 0) {- return new Match(- best_match_in_before,- best_match_in_after,- best_match_length- );- }- return null;- }-- /*- * Finds all the matching blocks within the given range in the before and after lists of- * tokens. This function is called recursively to find the next best matches that precede- * and follow the first best match.- *- * @param {Array.<string>} before_tokens The before list of tokens.- * @param {Array.<string>} after_tokens The after list of tokens.- * @param {Object} index_of_before_locations_in_after_tokens The index that is used to search- * for tokens in the after list.- * @param {number} start_in_before The beginning of the range in the list of before tokens.- * @param {number} end_in_before The end of the range in the list of before tokens.- * @param {number} start_in_after The beginning of the range in the list of after tokens.- * @param {number} end_in_after The end of the range in the list of after tokens.- * @param {Array.<Match>} matching_blocks The list of matching blocks found so far.- *- * @return {Array.<Match>} The list of matching blocks in this range.- */- function recursively_find_matching_blocks(- before_tokens,- after_tokens,- index_of_before_locations_in_after_tokens,- start_in_before,- end_in_before,- start_in_after,- end_in_after,- matching_blocks- ) {- var match = find_match(- before_tokens,- after_tokens,- index_of_before_locations_in_after_tokens,- start_in_before,- end_in_before,- start_in_after,- end_in_after- );- if (match) {- if (- start_in_before < match.start_in_before &&- start_in_after < match.start_in_after- ) {- recursively_find_matching_blocks(- before_tokens,- after_tokens,- index_of_before_locations_in_after_tokens,- start_in_before,- match.start_in_before,- start_in_after,- match.start_in_after,- matching_blocks- );- }- matching_blocks.push(match);- if (- match.end_in_before <= end_in_before &&- match.end_in_after <= end_in_after- ) {- recursively_find_matching_blocks(- before_tokens,- after_tokens,- index_of_before_locations_in_after_tokens,- match.end_in_before + 1,- end_in_before,- match.end_in_after + 1,- end_in_after,- matching_blocks- );- }- }- return matching_blocks;- }-- /*- * Creates an index (A.K.A. hash table) that will be used to match the list of before- * tokens with the list of after tokens.- *- * @param {Object} options An object with the following:- * - {Array.<string>} find_these The list of tokens that will be used to search.- * - {Array.<string>} in_these The list of tokens that will be returned.- *- * @return {Object} An index that can be used to search for tokens.- */- function create_index(options) {- if (!options.find_these) {- throw new Error("params must have find_these key");- }- if (!options.in_these) {- throw new Error("params must have in_these key");- }- var queries = options.find_these.map(function (token) {- return get_key_for_token(token);- });- var results = options.in_these.map(function (token) {- return get_key_for_token(token);- });- var index = {};- for (var i = 0; i < queries.length; i++) {- var query = queries[i];- index[query] = [];- var idx = results.indexOf(query);- while (idx !== -1) {- index[query].push(idx);- idx = results.indexOf(query, idx + 1);- }- }- return index;- }-- /*- * Finds all the matching blocks in the before and after lists of tokens. This function- * is a wrapper for the recursive function recursively_find_matching_blocks.- *- * @param {Array.<string>} before_tokens The before list of tokens.- * @param {Array.<string>} after_tokens The after list of tokens.- *- * @return {Array.<Match>} The list of matching blocks.- */- function find_matching_blocks(before_tokens, after_tokens) {- var matching_blocks = [];- var index_of_before_locations_in_after_tokens = create_index({- find_these: before_tokens,- in_these: after_tokens,- });- return recursively_find_matching_blocks(- before_tokens,- after_tokens,- index_of_before_locations_in_after_tokens,- 0,- before_tokens.length,- 0,- after_tokens.length,- matching_blocks- );- }-- /*- * Gets a list of operations required to transform the before list of tokens into the- * after list of tokens. An operation describes whether a particular list of consecutive- * tokens are equal, replaced, inserted, or deleted.- *- * @param {Array.<string>} before_tokens The before list of tokens.- * @param {Array.<string>} after_tokens The after list of tokens.- *- * @return {Array.<Object>} The list of operations to transform the before list of- * tokens into the after list of tokens, where each operation has the following- * keys:- * - {string} action One of {'replace', 'insert', 'delete', 'equal'}.- * - {number} start_in_before The beginning of the range in the list of before tokens.- * - {number} end_in_before The end of the range in the list of before tokens.- * - {number} start_in_after The beginning of the range in the list of after tokens.- * - {number} end_in_after The end of the range in the list of after tokens.- */- function calculate_operations(before_tokens, after_tokens) {- if (!before_tokens) {- throw new Error("before_tokens?");- }- if (!after_tokens) {- throw new Error("after_tokens?");- }-- var position_in_before = 0;- var position_in_after = 0;- var operations = [];- var action_map = {- "false,false": "replace",- "true,false": "insert",- "false,true": "delete",- "true,true": "none",- };- var matches = find_matching_blocks(before_tokens, after_tokens);- matches.push(new Match(before_tokens.length, after_tokens.length, 0));-- for (var index = 0; index < matches.length; index++) {- var match = matches[index];- var match_starts_at_current_position_in_before =- position_in_before === match.start_in_before;- var match_starts_at_current_position_in_after =- position_in_after === match.start_in_after;- var action_up_to_match_positions =- action_map[- [- match_starts_at_current_position_in_before,- match_starts_at_current_position_in_after,- ].toString()- ];- if (action_up_to_match_positions !== "none") {- operations.push({- action: action_up_to_match_positions,- start_in_before: position_in_before,- end_in_before:- action_up_to_match_positions !== "insert"- ? match.start_in_before - 1- : void 0,- start_in_after: position_in_after,- end_in_after:- action_up_to_match_positions !== "delete"- ? match.start_in_after - 1- : void 0,- });- }- if (match.length !== 0) {- operations.push({- action: "equal",- start_in_before: match.start_in_before,- end_in_before: match.end_in_before,- start_in_after: match.start_in_after,- end_in_after: match.end_in_after,- });- }- position_in_before = match.end_in_before + 1;- position_in_after = match.end_in_after + 1;- }-- var post_processed = [];- var last_op = {- action: "none",- };-- function is_single_whitespace(op) {- if (op.action !== "equal") {- return false;- }- if (op.end_in_before - op.start_in_before !== 0) {- return false;- }- return /^\s$/.test(- before_tokens.slice(op.start_in_before, op.end_in_before + 1)- );- }-- for (var i = 0; i < operations.length; i++) {- var op = operations[i];-- if (- (is_single_whitespace(op) && last_op.action === "replace") ||- (op.action === "replace" && last_op.action === "replace")- ) {- last_op.end_in_before = op.end_in_before;- last_op.end_in_after = op.end_in_after;- } else {- post_processed.push(op);- last_op = op;- }- }- return post_processed;- }-- /*- * Returns a list of tokens of a particular type starting at a given index.- *- * @param {number} start The index of first token to test.- * @param {Array.<string>} content The list of tokens.- * @param {function} predicate A function that returns true if a token is of- * a particular type, false otherwise. It should accept the following- * parameters:- * - {string} The token to test.- */- function consecutive_where(start, content, predicate) {- content = content.slice(start, content.length + 1);- var last_matching_index = null;-- for (var index = 0; index < content.length; index++) {- var token = content[index];- var answer = predicate(token);-- if (answer === true) {- last_matching_index = index;- }- if (answer === false) {- break;- }- }-- if (last_matching_index !== null) {- return content.slice(0, last_matching_index + 1);- }- return [];- }-- /*- * Wraps and concatenates a list of tokens with a tag. Does not wrap tag tokens,- * unless they are wrappable (i.e. void and atomic tags).- *- * @param {sting} tag The tag name of the wrapper tags.- * @param {Array.<string>} content The list of tokens to wrap.- * @param {string} class_name (Optional) The class name to include in the wrapper tag.- */- function wrap(tag, content, class_name) {- var rendering = "";- var position = 0;- var length = content.length;-- while (true) {- if (position >= length) break;- var non_tags = consecutive_where(position, content, is_wrappable);- position += non_tags.length;- if (non_tags.length !== 0) {- var val = non_tags.join("");- if (val.trim()) {- rendering += `<span class="diff-${tag} ${- class_name || ""- }">${val}</span>`;- }- }-- if (position >= length) break;- var tags = consecutive_where(position, content, is_tag);- position += tags.length;- rendering += tags.join("");- }- return rendering;- }-- /*- * op_map.equal/insert/delete/replace are functions that render an operation into- * HTML content.- *- * @param {Object} op The operation that applies to a prticular list of tokens. Has the- * following keys:- * - {string} action One of {'replace', 'insert', 'delete', 'equal'}.- * - {number} start_in_before The beginning of the range in the list of before tokens.- * - {number} end_in_before The end of the range in the list of before tokens.- * - {number} start_in_after The beginning of the range in the list of after tokens.- * - {number} end_in_after The end of the range in the list of after tokens.- * @param {Array.<string>} before_tokens The before list of tokens.- * @param {Array.<string>} after_tokens The after list of tokens.- * @param {string} class_name (Optional) The class name to include in the wrapper tag.- *- * @return {string} The rendering of that operation.- */- var op_map = {- equal: function (op, before_tokens, after_tokens, class_name) {- return after_tokens- .slice(op.start_in_after, op.end_in_after + 1)- .join("");- },- insert: function (op, before_tokens, after_tokens, class_name) {- var val = after_tokens.slice(op.start_in_after, op.end_in_after + 1);- return wrap("ins", val, class_name);- },- delete: function (op, before_tokens, after_tokens, class_name) {- var val = before_tokens.slice(op.start_in_before, op.end_in_before + 1);- return wrap("del", val, class_name);- },- };-- op_map.replace = function (op, before_tokens, after_tokens, class_name) {- return [- op_map["delete"](op, before_tokens, after_tokens, class_name),- op_map.insert(op, before_tokens, after_tokens, class_name),- ];- };-- /*- * Renders a list of operations into HTML content. The result is the combined version- * of the before and after tokens with the differences wrapped in tags.- *- * @param {Array.<string>} before_tokens The before list of tokens.- * @param {Array.<string>} after_tokens The after list of tokens.- * @param {Array.<Object>} operations The list of operations to transform the before- * list of tokens into the after list of tokens, where each operation has the- * following keys:- * - {string} action One of {'replace', 'insert', 'delete', 'equal'}.- * - {number} start_in_before The beginning of the range in the list of before tokens.- * - {number} end_in_before The end of the range in the list of before tokens.- * - {number} start_in_after The beginning of the range in the list of after tokens.- * - {number} end_in_after The end of the range in the list of after tokens.- * @param {string} class_name (Optional) The class name to include in the wrapper tag.- *- * @return {string} The rendering of the list of operations.- */- function render_operations(- before_tokens,- after_tokens,- operations,- class_name- ) {- var rendering = "";- for (var i = 0; i < operations.length; i++) {- var op = operations[i];- const result = op_map[op.action](- op,- before_tokens,- after_tokens,- class_name- );- if (op.action === "replace") {- rendering += result[0] + result[1];- } else {- rendering += result;- }- }- return rendering;- }-- /**- * htmldiff thinks that atomic or component objects are equal if their tag names are the same, because of it <div class="slideshow"> === <div class="here"> for example- * this function compares them- */- function render_equal_components(- before,- after,- ops,- class_name,- components_search_rule- ) {- var i, j, r, attrs;- var op;- var amount;- var before_token, after_token;- var before_token_match, after_token_match;- for (i = 0; i < ops.length; i++) {- op = ops[i];- if (op.action === "equal") {- amount = op.end_in_before - op.start_in_before + 1; // +1 since the array is 0 based- for (j = 0; j < amount; j++) {- before_token = before[op.start_in_before + j];- after_token = after[op.start_in_after + j];- if (before_token !== after_token) {- before_token_match = components_search_rule.exec(before_token);- after_token_match = components_search_rule.exec(after_token);- if (before_token_match && after_token_match) {- if (- before_token_match[1].toLowerCase() ===- after_token_match[1].toLowerCase()- ) {- // compare content of these two same components- r = diff(before_token, after_token, class_name);- after[op.start_in_after + j] = r;- } else {- // components are different, wrap before by 'del' and after by 'ins'- attrs = class_name ? ' class="' + class_name + '"' : "";- r =- "<del" +- attrs +- ">" +- before_token +- "</del>" +- "<ins" +- attrs +- ">" +- after_token +- "</ins>";- after[op.start_in_after + j] = r;- }- }- }- }- }- }- }-- /*- * Compares two pieces of HTML content and returns the combined content with differences- * wrapped in <ins> and <del> tags.- *- * @param {string} before The HTML content before the changes.- * @param {string} after The HTML content after the changes.- * @param {string} class_name (Optional) The class attribute to include in <ins> and <del> tags.- *- * @return {string} The combined HTML content with differences wrapped in <ins> and <del> tags.- */- function diff(before, after, class_name, components_search_rule) {- if (before === after) return before;- before = html_to_tokens(before, components_search_rule);- after = html_to_tokens(after, components_search_rule);- var ops = calculate_operations(before, after);-- if (components_search_rule) {- render_equal_components(- before,- after,- ops,- class_name,- components_search_rule- );- }-- return render_operations(before, after, ops, class_name);- }-- function render_operations_dual_pane(- before_tokens,- after_tokens,- operations- ) {- var after_render, before_render, next_block, op, _i, _len;- before_render = "";- after_render = "";- for (_i = 0, _len = operations.length; _i < _len; _i++) {- op = operations[_i];- next_block = op_map[op.action](op, before_tokens, after_tokens);- switch (op.action) {- case "equal":- before_render += next_block;- after_render += next_block;- break;- case "insert":- after_render += next_block;- break;- case "delete":- before_render += next_block;- break;- case "replace":- before_render += next_block[0];- after_render += next_block[1];- break;- default:- continue;- }- }- return return_dual_pane(before_render, after_render);- }-- function diff_dual_pane(before, after) {- if (!before || !after) return { before, after };-- var ops;- if (before === after) {- return return_dual_pane(before, after);- }- before = html_to_tokens(before);- after = html_to_tokens(after);- ops = calculate_operations(before, after);- return render_operations_dual_pane(before, after, ops);- }-- diff.html_to_tokens = html_to_tokens;- diff.merge_html_by_class = merge_html_by_class;- diff.find_matching_blocks = find_matching_blocks;- find_matching_blocks.find_match = find_match;- find_matching_blocks.create_index = create_index;- find_matching_blocks.get_key_for_token = get_key_for_token;- diff.calculate_operations = calculate_operations;- diff.render_operations = render_operations;- diff.diff_dual_pane = diff_dual_pane;- diff.clean = function (html) {- const tokens = html_to_tokens(html);- let isDiffSpanOpen = false;- return tokens.reduce((result, token) => {- if (token.includes(`span class="diff-`)) {- isDiffSpanOpen = true;- return result;- } else if (isDiffSpanOpen && token.includes("</span>")) {- isDiffSpanOpen = false;- return result;- }- return result + token;- }, "");- };-- if (typeof define === "function") {- // eslint-disable-next-line no-undef- define([], function () {- return diff;- });- } else if (typeof module !== "undefined" && module !== null) {- module.exports = diff;- } else {- this.htmldiff = diff;- }- }.call(this));\ No newline at end of file+ function is_start_of_tag(char) {+ return char === '<';+ }+ const IS_CLOSE_TAG_REGEX = /^\s*<\s*\/[^>]+>\s*$/;+ function is_close_tag(tag) {+ return IS_CLOSE_TAG_REGEX.test(tag);+ }++ const IS_TAG_REGEX = /^\s*<[^>]+>\s*$/;+ function is_tag(token) {+ return IS_TAG_REGEX.test(token);+ }++ function isnt_tag(token) {+ return !is_tag(token);+ }++ /*+ * Checks if the current word is the beginning of an atomic tag. An atomic tag is one whose+ * child nodes should not be compared - the entire tag should be treated as one token. This+ * is useful for tags where it does not make sense to insert <ins> and <del> tags.+ *+ * @param {string} word The characters of the current token read so far.+ *+ * @return {string|null} The name of the atomic tag if the word will be an atomic tag,+ * null otherwise+ */+ const IS_START_ATOMIC_TAG = /^<(iframe|object|math|svg|script)/;+ function is_start_of_atomic_tag(word) {+ var result = IS_START_ATOMIC_TAG.exec(word);+ if (result) {+ result = result[1];+ }+ return result;+ }++ /*+ * Checks if a tag is a void tag.+ *+ * @param {string} token The token to check.+ *+ * @return {boolean} True if the token is a void tag, false otherwise.+ */+ const IS_VOID_TAG_REGEX = /^\s*<[^>]+\/>\s*$/;+ function is_void_tag(token) {+ return IS_VOID_TAG_REGEX.test(token);+ }++ /*+ * Checks if a token can be wrapped inside a tag.+ *+ * @param {string} token The token to check.+ *+ * @return {boolean} True if the token can be wrapped inside a tag, false otherwise.+ */+ function is_wrappable(token) {+ return isnt_tag(token) || is_start_of_atomic_tag(token) || is_void_tag(token);+ }++ /*+ * A Match stores the information of a matching block. A matching block is a list of+ * consecutive tokens that appear in both the before and after lists of tokens.+ *+ * @param {number} start_in_before The index of the first token in the list of before tokens.+ * @param {number} start_in_after The index of the first token in the list of after tokens.+ * @param {number} length The number of consecutive matching tokens in this block.+ */+ function Match(start_in_before, start_in_after, length) {+ this.start_in_before = start_in_before;+ this.start_in_after = start_in_after;+ this.length = length;+ this.end_in_before = this.start_in_before + this.length - 1;+ this.end_in_after = this.start_in_after + this.length - 1;+ }++ function return_dual_pane(before, after) {+ return {+ before: before,+ after: after+ };+ }++ /*+ * Merge tokens in component by regex rule.+ *+ * @param {find_regex} dictate witch tag we want to merge.+ * @param {words Array.<string>} input data already parsed array(html tags) by html_tokens method.+ * @return {Array.<string>} The list of tokens with merged components requested by component_search_role.+ */+ function merge_html_by_class(find_regex, words) {+ var merged_words_array = [],+ merged_words_to_string = '',+ count_open_tags = 0;++ for (var i = 0; i < words.length; i++) {+ var tag_part = words[i];+ //merge html tags until parent tag is not closed (also ignore self closed html tags)+ if (count_open_tags > 0 || find_regex.test(tag_part)) {+ if (+ is_start_of_tag(tag_part.slice(0, 1)) &&+ !is_void_tag(tag_part) &&+ !is_start_of_atomic_tag(tag_part)+ ) {+ count_open_tags += is_close_tag(tag_part) ? -1 : 1;+ }+ //combine all html string from html tokens while all condition are true+ merged_words_to_string += tag_part;+ //after parent tag is closed push as one html token+ if (count_open_tags === 0) {+ merged_words_array.push(merged_words_to_string);+ merged_words_to_string = '';+ }+ } else {+ //all tags that are not part of components we wont to merge just ignore+ merged_words_array.push(tag_part);+ }+ }+ return merged_words_array;+ }++ /*+ * Tokenizes a string of HTML.+ *+ * @param {string} html The string to tokenize.+ *+ * @return {Array.<string>} The list of tokens.+ */++ function html_to_tokens(html, components_search_rule) {+ let words = [];+ const range = {+ start: 0,+ end: 0,+ tagOpen: false,+ whitespaceOpen: false,+ ampersandOpen: false+ };+ for (var i = 0; i < html.length; ++i) {+ const s = html[i];++ if (s === ' ' || s === '\n' || s === '\r' || s === '\t') {+ if (range.tagOpen || range.whitespaceOpen) continue;++ //range.end = i;+ if (range.start !== i) words.push(html.slice(range.start, i));++ range.whitespaceOpen = true;+ range.start = i;+ } else if (range.whitespaceOpen) {+ range.whitespaceOpen = false;+ // range.end = i;+ words.push(html.slice(range.start, i));+ range.start = i;+ }++ if (s === '<') {+ range.tagOpen = true;++ if (range.start !== i) {+ words.push(html.slice(range.start, i));+ }++ range.start = i;+ } else if (s === '>') {+ range.tagOpen = false;+ words.push(html.slice(range.start, i + 1));+ range.start = i + 1;+ } else if (!range.ampersandOpen && s === '&') {+ range.ampersandOpen = true;+ if (range.start !== i) words.push(html.slice(range.start, i));+ range.start = i;+ } else if (range.ampersandOpen && s === ';') {+ range.ampersandOpen = false;+ words.push(html.slice(range.start, i + 1));+ range.start = i + 1;+ }+ }+ if (range.start !== html.length) {+ words.push(html.slice(range.start, html.length));+ }++ return components_search_rule ? merge_html_by_class(components_search_rule, words) : words;+ }++ /*+ * Creates a key that should be used to match tokens. This is useful, for example, if we want+ * to consider two open tag tokens as equal, even if they don't have the same attributes. We+ * use a key instead of overwriting the token because we may want to render the original string+ * without losing the attributes.+ *+ * @param {string} token The token to create the key for.+ *+ * @return {string} The identifying key that should be used to match before and after tokens.+ */+ function get_key_for_token(token) {+ var tag_name = /<([^\s>]+)[\s>]/.exec(token);+ if (tag_name) {+ return '<' + tag_name[1].toLowerCase() + '>';+ }+ if (token) {+ return token.replace(/(\s+| | )/g, ' ');+ }+ return token;+ }++ /*+ * Finds the matching block with the most consecutive tokens within the given range in the+ * before and after lists of tokens.+ *+ * @param {Array.<string>} before_tokens The before list of tokens.+ * @param {Array.<string>} after_tokens The after list of tokens.+ * @param {Object} index_of_before_locations_in_after_tokens The index that is used to search+ * for tokens in the after list.+ * @param {number} start_in_before The beginning of the range in the list of before tokens.+ * @param {number} end_in_before The end of the range in the list of before tokens.+ * @param {number} start_in_after The beginning of the range in the list of after tokens.+ * @param {number} end_in_after The end of the range in the list of after tokens.+ *+ * @return {Match} A Match that describes the best matching block in the given range.+ */+ function find_match(+ before_tokens,+ after_tokens,+ index_of_before_locations_in_after_tokens,+ start_in_before,+ end_in_before,+ start_in_after,+ end_in_after+ ) {+ var best_match_in_before = start_in_before;+ var best_match_in_after = start_in_after;+ var best_match_length = 0;+ var match_length_at = {};+ for (+ var index_in_before = start_in_before;+ index_in_before < end_in_before;+ index_in_before+++ ) {+ var new_match_length_at = {};+ var looking_for = get_key_for_token(before_tokens[index_in_before]);+ var locations_in_after = index_of_before_locations_in_after_tokens[looking_for];++ for (var i = 0; i < locations_in_after.length; i++) {+ var index_in_after = locations_in_after[i];+ if (index_in_after < start_in_after) continue;+ if (index_in_after >= end_in_after) break;++ if (!match_length_at[index_in_after - 1]) {+ match_length_at[index_in_after - 1] = 0;+ }+ var new_match_length = match_length_at[index_in_after - 1] + 1;+ new_match_length_at[index_in_after] = new_match_length;++ if (new_match_length > best_match_length) {+ best_match_in_before = index_in_before - new_match_length + 1;+ best_match_in_after = index_in_after - new_match_length + 1;+ best_match_length = new_match_length;+ }+ }+ match_length_at = new_match_length_at;+ }+ if (best_match_length !== 0) {+ return new Match(best_match_in_before, best_match_in_after, best_match_length);+ }+ return null;+ }++ /*+ * Finds all the matching blocks within the given range in the before and after lists of+ * tokens. This function is called recursively to find the next best matches that precede+ * and follow the first best match.+ *+ * @param {Array.<string>} before_tokens The before list of tokens.+ * @param {Array.<string>} after_tokens The after list of tokens.+ * @param {Object} index_of_before_locations_in_after_tokens The index that is used to search+ * for tokens in the after list.+ * @param {number} start_in_before The beginning of the range in the list of before tokens.+ * @param {number} end_in_before The end of the range in the list of before tokens.+ * @param {number} start_in_after The beginning of the range in the list of after tokens.+ * @param {number} end_in_after The end of the range in the list of after tokens.+ * @param {Array.<Match>} matching_blocks The list of matching blocks found so far.+ *+ * @return {Array.<Match>} The list of matching blocks in this range.+ */+ function recursively_find_matching_blocks(+ before_tokens,+ after_tokens,+ index_of_before_locations_in_after_tokens,+ start_in_before,+ end_in_before,+ start_in_after,+ end_in_after,+ matching_blocks+ ) {+ var match = find_match(+ before_tokens,+ after_tokens,+ index_of_before_locations_in_after_tokens,+ start_in_before,+ end_in_before,+ start_in_after,+ end_in_after+ );+ if (match) {+ if (start_in_before < match.start_in_before && start_in_after < match.start_in_after) {+ recursively_find_matching_blocks(+ before_tokens,+ after_tokens,+ index_of_before_locations_in_after_tokens,+ start_in_before,+ match.start_in_before,+ start_in_after,+ match.start_in_after,+ matching_blocks+ );+ }+ matching_blocks.push(match);+ if (match.end_in_before <= end_in_before && match.end_in_after <= end_in_after) {+ recursively_find_matching_blocks(+ before_tokens,+ after_tokens,+ index_of_before_locations_in_after_tokens,+ match.end_in_before + 1,+ end_in_before,+ match.end_in_after + 1,+ end_in_after,+ matching_blocks+ );+ }+ }+ return matching_blocks;+ }++ /*+ * Creates an index (A.K.A. hash table) that will be used to match the list of before+ * tokens with the list of after tokens.+ *+ * @param {Object} options An object with the following:+ * - {Array.<string>} find_these The list of tokens that will be used to search.+ * - {Array.<string>} in_these The list of tokens that will be returned.+ *+ * @return {Object} An index that can be used to search for tokens.+ */+ function create_index(options) {+ if (!options.find_these) {+ throw new Error('params must have find_these key');+ }+ if (!options.in_these) {+ throw new Error('params must have in_these key');+ }+ var queries = options.find_these.map(function (token) {+ return get_key_for_token(token);+ });+ var results = options.in_these.map(function (token) {+ return get_key_for_token(token);+ });+ var index = {};+ for (var i = 0; i < queries.length; i++) {+ var query = queries[i];+ index[query] = [];+ var idx = results.indexOf(query);+ while (idx !== -1) {+ index[query].push(idx);+ idx = results.indexOf(query, idx + 1);+ }+ }+ return index;+ }++ /*+ * Finds all the matching blocks in the before and after lists of tokens. This function+ * is a wrapper for the recursive function recursively_find_matching_blocks.+ *+ * @param {Array.<string>} before_tokens The before list of tokens.+ * @param {Array.<string>} after_tokens The after list of tokens.+ *+ * @return {Array.<Match>} The list of matching blocks.+ */+ function find_matching_blocks(before_tokens, after_tokens) {+ var matching_blocks = [];+ var index_of_before_locations_in_after_tokens = create_index({+ find_these: before_tokens,+ in_these: after_tokens+ });+ return recursively_find_matching_blocks(+ before_tokens,+ after_tokens,+ index_of_before_locations_in_after_tokens,+ 0,+ before_tokens.length,+ 0,+ after_tokens.length,+ matching_blocks+ );+ }++ /*+ * Gets a list of operations required to transform the before list of tokens into the+ * after list of tokens. An operation describes whether a particular list of consecutive+ * tokens are equal, replaced, inserted, or deleted.+ *+ * @param {Array.<string>} before_tokens The before list of tokens.+ * @param {Array.<string>} after_tokens The after list of tokens.+ *+ * @return {Array.<Object>} The list of operations to transform the before list of+ * tokens into the after list of tokens, where each operation has the following+ * keys:+ * - {string} action One of {'replace', 'insert', 'delete', 'equal'}.+ * - {number} start_in_before The beginning of the range in the list of before tokens.+ * - {number} end_in_before The end of the range in the list of before tokens.+ * - {number} start_in_after The beginning of the range in the list of after tokens.+ * - {number} end_in_after The end of the range in the list of after tokens.+ */+ function calculate_operations(before_tokens, after_tokens) {+ if (!before_tokens) {+ throw new Error('before_tokens?');+ }+ if (!after_tokens) {+ throw new Error('after_tokens?');+ }++ var position_in_before = 0;+ var position_in_after = 0;+ var operations = [];+ var action_map = {+ 'false,false': 'replace',+ 'true,false': 'insert',+ 'false,true': 'delete',+ 'true,true': 'none'+ };+ var matches = find_matching_blocks(before_tokens, after_tokens);+ matches.push(new Match(before_tokens.length, after_tokens.length, 0));++ for (var index = 0; index < matches.length; index++) {+ var match = matches[index];+ var match_starts_at_current_position_in_before = position_in_before === match.start_in_before;+ var match_starts_at_current_position_in_after = position_in_after === match.start_in_after;+ var action_up_to_match_positions =+ action_map[+ [+ match_starts_at_current_position_in_before,+ match_starts_at_current_position_in_after+ ].toString()+ ];+ if (action_up_to_match_positions !== 'none') {+ operations.push({+ action: action_up_to_match_positions,+ start_in_before: position_in_before,+ end_in_before:+ action_up_to_match_positions !== 'insert' ? match.start_in_before - 1 : void 0,+ start_in_after: position_in_after,+ end_in_after:+ action_up_to_match_positions !== 'delete' ? match.start_in_after - 1 : void 0+ });+ }+ if (match.length !== 0) {+ operations.push({+ action: 'equal',+ start_in_before: match.start_in_before,+ end_in_before: match.end_in_before,+ start_in_after: match.start_in_after,+ end_in_after: match.end_in_after+ });+ }+ position_in_before = match.end_in_before + 1;+ position_in_after = match.end_in_after + 1;+ }++ var post_processed = [];+ var last_op = {+ action: 'none'+ };++ function is_single_whitespace(op) {+ if (op.action !== 'equal') {+ return false;+ }+ if (op.end_in_before - op.start_in_before !== 0) {+ return false;+ }+ return /^\s$/.test(before_tokens.slice(op.start_in_before, op.end_in_before + 1));+ }++ for (var i = 0; i < operations.length; i++) {+ var op = operations[i];++ if (+ (is_single_whitespace(op) && last_op.action === 'replace') ||+ (op.action === 'replace' && last_op.action === 'replace')+ ) {+ last_op.end_in_before = op.end_in_before;+ last_op.end_in_after = op.end_in_after;+ } else {+ post_processed.push(op);+ last_op = op;+ }+ }+ return post_processed;+ }++ /*+ * Returns a list of tokens of a particular type starting at a given index.+ *+ * @param {number} start The index of first token to test.+ * @param {Array.<string>} content The list of tokens.+ * @param {function} predicate A function that returns true if a token is of+ * a particular type, false otherwise. It should accept the following+ * parameters:+ * - {string} The token to test.+ */+ function consecutive_where(start, content, predicate) {+ content = content.slice(start, content.length + 1);+ var last_matching_index = null;++ for (var index = 0; index < content.length; index++) {+ var token = content[index];+ var answer = predicate(token);++ if (answer === true) {+ last_matching_index = index;+ }+ if (answer === false) {+ break;+ }+ }++ if (last_matching_index !== null) {+ return content.slice(0, last_matching_index + 1);+ }+ return [];+ }++ /*+ * Wraps and concatenates a list of tokens with a tag. Does not wrap tag tokens,+ * unless they are wrappable (i.e. void and atomic tags).+ *+ * @param {sting} tag The tag name of the wrapper tags.+ * @param {Array.<string>} content The list of tokens to wrap.+ * @param {string} class_name (Optional) The class name to include in the wrapper tag.+ */+ function wrap(tag, content, class_name) {+ var rendering = '';+ var position = 0;+ var length = content.length;++ while (true) {+ if (position >= length) break;+ var non_tags = consecutive_where(position, content, is_wrappable);+ position += non_tags.length;+ if (non_tags.length !== 0) {+ var val = non_tags.join('');+ if (val.trim()) {+ rendering += `<span class="diff-${tag} ${class_name || ''}">${val}</span>`;+ }+ }++ if (position >= length) break;+ var tags = consecutive_where(position, content, is_tag);+ position += tags.length;+ rendering += tags.join('');+ }+ return rendering;+ }++ /*+ * op_map.equal/insert/delete/replace are functions that render an operation into+ * HTML content.+ *+ * @param {Object} op The operation that applies to a prticular list of tokens. Has the+ * following keys:+ * - {string} action One of {'replace', 'insert', 'delete', 'equal'}.+ * - {number} start_in_before The beginning of the range in the list of before tokens.+ * - {number} end_in_before The end of the range in the list of before tokens.+ * - {number} start_in_after The beginning of the range in the list of after tokens.+ * - {number} end_in_after The end of the range in the list of after tokens.+ * @param {Array.<string>} before_tokens The before list of tokens.+ * @param {Array.<string>} after_tokens The after list of tokens.+ * @param {string} class_name (Optional) The class name to include in the wrapper tag.+ *+ * @return {string} The rendering of that operation.+ */+ var op_map = {+ equal: function (op, before_tokens, after_tokens, class_name) {+ return after_tokens.slice(op.start_in_after, op.end_in_after + 1).join('');+ },+ insert: function (op, before_tokens, after_tokens, class_name) {+ var val = after_tokens.slice(op.start_in_after, op.end_in_after + 1);+ return wrap('ins', val, class_name);+ },+ delete: function (op, before_tokens, after_tokens, class_name) {+ var val = before_tokens.slice(op.start_in_before, op.end_in_before + 1);+ return wrap('del', val, class_name);+ }+ };++ op_map.replace = function (op, before_tokens, after_tokens, class_name) {+ return [+ op_map['delete'](op, before_tokens, after_tokens, class_name),+ op_map.insert(op, before_tokens, after_tokens, class_name)+ ];+ };++ /*+ * Renders a list of operations into HTML content. The result is the combined version+ * of the before and after tokens with the differences wrapped in tags.+ *+ * @param {Array.<string>} before_tokens The before list of tokens.+ * @param {Array.<string>} after_tokens The after list of tokens.+ * @param {Array.<Object>} operations The list of operations to transform the before+ * list of tokens into the after list of tokens, where each operation has the+ * following keys:+ * - {string} action One of {'replace', 'insert', 'delete', 'equal'}.+ * - {number} start_in_before The beginning of the range in the list of before tokens.+ * - {number} end_in_before The end of the range in the list of before tokens.+ * - {number} start_in_after The beginning of the range in the list of after tokens.+ * - {number} end_in_after The end of the range in the list of after tokens.+ * @param {string} class_name (Optional) The class name to include in the wrapper tag.+ *+ * @return {string} The rendering of the list of operations.+ */+ function render_operations(before_tokens, after_tokens, operations, class_name) {+ var rendering = '';+ for (var i = 0; i < operations.length; i++) {+ var op = operations[i];+ const result = op_map[op.action](op, before_tokens, after_tokens, class_name);+ if (op.action === 'replace') {+ rendering += result[0] + result[1];+ } else {+ rendering += result;+ }+ }+ return rendering;+ }++ /**+ * htmldiff thinks that atomic or component objects are equal if their tag names are the same, because of it <div class="slideshow"> === <div class="here"> for example+ * this function compares them+ */+ function render_equal_components(before, after, ops, class_name, components_search_rule) {+ var i, j, r, attrs;+ var op;+ var amount;+ var before_token, after_token;+ var before_token_match, after_token_match;+ for (i = 0; i < ops.length; i++) {+ op = ops[i];+ if (op.action === 'equal') {+ amount = op.end_in_before - op.start_in_before + 1; // +1 since the array is 0 based+ for (j = 0; j < amount; j++) {+ before_token = before[op.start_in_before + j];+ after_token = after[op.start_in_after + j];+ if (before_token !== after_token) {+ before_token_match = components_search_rule.exec(before_token);+ after_token_match = components_search_rule.exec(after_token);+ if (before_token_match && after_token_match) {+ if (before_token_match[1].toLowerCase() === after_token_match[1].toLowerCase()) {+ // compare content of these two same components+ r = diff(before_token, after_token, class_name);+ after[op.start_in_after + j] = r;+ } else {+ // components are different, wrap before by 'del' and after by 'ins'+ attrs = class_name ? ' class="' + class_name + '"' : '';+ r =+ '<del' ++ attrs ++ '>' ++ before_token ++ '</del>' ++ '<ins' ++ attrs ++ '>' ++ after_token ++ '</ins>';+ after[op.start_in_after + j] = r;+ }+ }+ }+ }+ }+ }+ }++ /*+ * Compares two pieces of HTML content and returns the combined content with differences+ * wrapped in <ins> and <del> tags.+ *+ * @param {string} before The HTML content before the changes.+ * @param {string} after The HTML content after the changes.+ * @param {string} class_name (Optional) The class attribute to include in <ins> and <del> tags.+ *+ * @return {string} The combined HTML content with differences wrapped in <ins> and <del> tags.+ */+ function diff(before, after, class_name, components_search_rule) {+ if (before === after) return before;+ before = html_to_tokens(before, components_search_rule);+ after = html_to_tokens(after, components_search_rule);+ var ops = calculate_operations(before, after);++ if (components_search_rule) {+ render_equal_components(before, after, ops, class_name, components_search_rule);+ }++ return render_operations(before, after, ops, class_name);+ }++ function render_operations_dual_pane(before_tokens, after_tokens, operations) {+ var after_render, before_render, next_block, op, _i, _len;+ before_render = '';+ after_render = '';+ for (_i = 0, _len = operations.length; _i < _len; _i++) {+ op = operations[_i];+ next_block = op_map[op.action](op, before_tokens, after_tokens);+ switch (op.action) {+ case 'equal':+ before_render += next_block;+ after_render += next_block;+ break;+ case 'insert':+ after_render += next_block;+ break;+ case 'delete':+ before_render += next_block;+ break;+ case 'replace':+ before_render += next_block[0];+ after_render += next_block[1];+ break;+ default:+ continue;+ }+ }+ return return_dual_pane(before_render, after_render);+ }++ function diff_dual_pane(before, after) {+ if (!before || !after) return { before, after };++ var ops;+ if (before === after) {+ return return_dual_pane(before, after);+ }+ before = html_to_tokens(before);+ after = html_to_tokens(after);+ ops = calculate_operations(before, after);+ return render_operations_dual_pane(before, after, ops);+ }++ diff.html_to_tokens = html_to_tokens;+ diff.merge_html_by_class = merge_html_by_class;+ diff.find_matching_blocks = find_matching_blocks;+ find_matching_blocks.find_match = find_match;+ find_matching_blocks.create_index = create_index;+ find_matching_blocks.get_key_for_token = get_key_for_token;+ diff.calculate_operations = calculate_operations;+ diff.render_operations = render_operations;+ diff.diff_dual_pane = diff_dual_pane;+ diff.clean = function (html) {+ const tokens = html_to_tokens(html);+ let isDiffSpanOpen = false;+ return tokens.reduce((result, token) => {+ if (token.includes(`span class="diff-`)) {+ isDiffSpanOpen = true;+ return result;+ } else if (isDiffSpanOpen && token.includes('</span>')) {+ isDiffSpanOpen = false;+ return result;+ }+ return result + token;+ }, '');+ };++ if (typeof define === 'function') {+ // eslint-disable-next-line no-undef+ define([], function () {+ return diff;+ });+ } else if (typeof module !== 'undefined' && module !== null) {+ module.exports = diff;+ } else {+ this.htmldiff = diff;+ }+}.call(this));diff --git a/apps/mobile/src/utils/filename.js b/apps/mobile/src/utils/filename.jsindex 48a110e77..e32f64c3c 100644--- a/apps/mobile/src/utils/filename.js+++ b/apps/mobile/src/utils/filename.js@@ -35,8 +35,8 @@ var windowsTrailingRe = /[. ]+$/;var whitespace = /\W+/g;function sanitize(input, replacement) {- if (typeof input !== "string") {- throw new Error("Input must be string");+ if (typeof input !== 'string') {+ throw new Error('Input must be string');}var sanitized = input.replace(whitespace, replacement)@@ -49,6 +49,6 @@ function sanitize(input, replacement) {}export function sanitizeFilename(input, options) {- var replacement = (options && options.replacement) || "";+ var replacement = (options && options.replacement) || '';return sanitize(input, replacement);-}\ No newline at end of file+}diff --git a/apps/mobile/src/utils/filesystem.js b/apps/mobile/src/utils/filesystem.jsindex c77bf0351..412331559 100644--- a/apps/mobile/src/utils/filesystem.js+++ b/apps/mobile/src/utils/filesystem.js@@ -1,12 +1,12 @@import React from 'react';-import {Platform} from 'react-native';+import { Platform } from 'react-native';import * as ScopedStorage from 'react-native-scoped-storage';import Sodium from 'react-native-sodium';import RNFetchBlob from 'rn-fetch-blob';-import {ShareComponent} from '../components/ExportDialog/share';-import {useAttachmentStore} from '../provider/stores';-import {presentSheet, ToastEvent} from '../services/EventManager';-import {db} from './database';+import { ShareComponent } from '../components/ExportDialog/share';+import { useAttachmentStore } from '../provider/stores';+import { presentSheet, ToastEvent } from '../services/EventManager';+import { db } from './database';import Storage from './storage';const cacheDir = RNFetchBlob.fs.dirs.CacheDir;@@ -43,8 +43,8 @@ function randId(prefix) {.replace('0.', prefix || '');}-async function writeEncrypted(filename, {data, type, key}) {- console.log('file input: ', {type, key});+async function writeEncrypted(filename, { data, type, key }) {+ console.log('file input: ', { type, key });let filepath = cacheDir + `/${randId('imagecache_')}`;console.log(filepath);await RNFetchBlob.fs.writeFile(filepath, data, 'base64');@@ -63,7 +63,7 @@ async function writeEncrypted(filename, {data, type, key}) {async function uploadFile(filename, data, cancelToken) {if (!data) return false;- let {url, headers} = data;+ let { url, headers } = data;console.log('uploading file: ', filename, headers);try {@@ -86,9 +86,7 @@ async function uploadFile(filename, data, cancelToken) {RNFetchBlob.wrap(`${cacheDir}/${filename}`)).uploadProgress((sent, total) => {- useAttachmentStore- .getState()- .setProgress(sent, total, filename, 0, 'upload');+ useAttachmentStore.getState().setProgress(sent, total, filename, 0, 'upload');console.log('uploading: ', sent, total);});cancelToken.cancel = request.cancel;@@ -116,10 +114,7 @@ async function uploadFile(filename, data, cancelToken) {function valueFromXml(code, xml) {if (!xml.includes(code)) return `Unknown ${code}`;- return xml.slice(- xml.indexOf(`<${code}>`) + code.length + 2,- xml.indexOf(`</${code}>`)- );+ return xml.slice(xml.indexOf(`<${code}>`) + code.length + 2, xml.indexOf(`</${code}>`));}async function fileCheck(response, totalSize) {@@ -138,7 +133,7 @@ async function fileCheck(response, totalSize) {async function downloadFile(filename, data, cancelToken) {if (!data) return false;- let {url, headers, metadata} = data;+ let { url, headers, metadata } = data;console.log('downloading file: ', filename, url);let path = `${cacheDir}/${filename}`;@@ -162,9 +157,7 @@ async function downloadFile(filename, data, cancelToken) {}).fetch('GET', downloadUrl, null).progress((recieved, total) => {- useAttachmentStore- .getState()- .setProgress(0, total, filename, recieved, 'download');+ useAttachmentStore.getState().setProgress(0, total, filename, recieved, 'download');totalSize = total;console.log('downloading: ', recieved, total);});@@ -197,7 +190,7 @@ async function deleteFile(filename, data) {return true;}- let {url, headers} = data;+ let { url, headers } = data;try {let response = await RNFetchBlob.fetch('DELETE', url, headers);let status = response.info().status;@@ -217,9 +210,9 @@ function cancelable(operation) {const cancelToken = {cancel: () => {}};- return (filename, {url, headers}) => {+ return (filename, { url, headers }) => {return {- execute: () => operation(filename, {url, headers}, cancelToken),+ execute: () => operation(filename, { url, headers }, cancelToken),cancel: async () => {await cancelToken.cancel();RNFetchBlob.fs.unlink(`${cacheDir}/${filename}`).catch(console.log);@@ -244,14 +237,8 @@ async function downloadAttachment(hash, global = true) {}try {- await db.fs.downloadFile(- attachment.metadata.hash,- attachment.metadata.hash- );- if (- !(await RNFetchBlob.fs.exists(`${cacheDir}/${attachment.metadata.hash}`))- )- return;+ await db.fs.downloadFile(attachment.metadata.hash, attachment.metadata.hash);+ if (!(await RNFetchBlob.fs.exists(`${cacheDir}/${attachment.metadata.hash}`))) return;let key = await db.attachments.decryptKey(attachment.key);console.log('attachment key', key);@@ -276,10 +263,7 @@ async function downloadAttachment(hash, global = true) {});if (attachment.dateUploaded) {- console.log(- 'Deleting attachment after download',- attachment.dateUploaded- );+ console.log('Deleting attachment after download', attachment.dateUploaded);RNFetchBlob.fs.unlink(RNFetchBlob.fs.dirs.CacheDir + `/${attachment.metadata.hash}`).catch(console.log);@@ -293,19 +277,11 @@ async function downloadAttachment(hash, global = true) {presentSheet({title: `File downloaded`,paragraph: `${attachment.metadata.filename} saved to ${- Platform.OS === 'android'- ? 'selected path'- : 'File Manager/Notesnook/downloads'+ Platform.OS === 'android' ? 'selected path' : 'File Manager/Notesnook/downloads'}`,icon: 'download',context: global ? null : attachment.metadata.hash,- component: (- <ShareComponent- uri={fileUri}- name={attachment.metadata.filename}- padding={12}- />- )+ component: <ShareComponent uri={fileUri} name={attachment.metadata.filename} padding={12} />});return fileUri;} catch (e) {diff --git a/apps/mobile/src/utils/functions.js b/apps/mobile/src/utils/functions.jsindex 5379ad68a..1ca27a7b1 100644--- a/apps/mobile/src/utils/functions.js+++ b/apps/mobile/src/utils/functions.js@@ -1,11 +1,11 @@-import {Linking} from 'react-native';-import {InAppBrowser} from 'react-native-inappbrowser-reborn';-import {history} from '.';-import {useMenuStore, useSelectionStore} from '../provider/stores';-import {eSendEvent, ToastEvent} from '../services/EventManager';+import { Linking } from 'react-native';+import { InAppBrowser } from 'react-native-inappbrowser-reborn';+import { history } from '.';+import { useMenuStore, useSelectionStore } from '../provider/stores';+import { eSendEvent, ToastEvent } from '../services/EventManager';import Navigation from '../services/Navigation';-import {db} from './database';-import {eClearEditor} from './Events';+import { db } from './database';+import { eClearEditor } from './Events';import layoutmanager from './layout-manager';export const deleteItems = async item => {@@ -46,10 +46,7 @@ export const deleteItems = async item => {await db.notes.delete(...ids);//layoutmanager.withAnimation(150);- Navigation.setRoutesToUpdate([- Navigation.routeNames.Notes,- Navigation.routeNames.NotesPage- ]);+ Navigation.setRoutesToUpdate([Navigation.routeNames.Notes, Navigation.routeNames.NotesPage]);eSendEvent(eClearEditor);}if (topics?.length > 0) {@@ -59,10 +56,7 @@ export const deleteItems = async item => {}// layoutmanager.withAnimation(150);- Navigation.setRoutesToUpdate([- Navigation.routeNames.Notebooks,- Navigation.routeNames.Notebook- ]);+ Navigation.setRoutesToUpdate([Navigation.routeNames.Notebooks, Navigation.routeNames.Notebook]);useMenuStore.getState().setMenuPins();ToastEvent.show({heading: 'Topics deleted',@@ -75,10 +69,7 @@ export const deleteItems = async item => {await db.notebooks.delete(...ids);//layoutmanager.withAnimation(150);- Navigation.setRoutesToUpdate([- Navigation.routeNames.Notebooks,- Navigation.routeNames.Notes- ]);+ Navigation.setRoutesToUpdate([Navigation.routeNames.Notebooks, Navigation.routeNames.Notes]);useMenuStore.getState().setMenuPins();}diff --git a/apps/mobile/src/utils/index.js b/apps/mobile/src/utils/index.jsindex ab4cb8fe1..8e32edfe0 100755--- a/apps/mobile/src/utils/index.js+++ b/apps/mobile/src/utils/index.js@@ -1,19 +1,16 @@-import {createRef} from 'react';-import {Dimensions, NativeModules, Platform} from 'react-native';+import { createRef } from 'react';+import { Dimensions, NativeModules, Platform } from 'react-native';import BackgroundService from 'react-native-background-actions';-import {- beginBackgroundTask,- endBackgroundTask-} from 'react-native-begin-background-task';+import { beginBackgroundTask, endBackgroundTask } from 'react-native-begin-background-task';import RNTooltips from 'react-native-tooltips';-import {useSettingStore} from '../provider/stores';-import {eSendEvent} from '../services/EventManager';+import { useSettingStore } from '../provider/stores';+import { eSendEvent } from '../services/EventManager';import Navigation from '../services/Navigation';import * as ackeeTracker from './ackee';import { db } from './database';-import {refreshNotesPage} from './Events';-import {MMKV} from './mmkv';-import {tabBarRef} from './Refs';+import { refreshNotesPage } from './Events';+import { MMKV } from './mmkv';+import { tabBarRef } from './Refs';export const Tracker = ackeeTracker.create('https://sa.streetwriters.co', {ignoreLocalhost: true@@ -53,7 +50,7 @@ export const InteractionManager = {};export async function setSetting(settings, name, value) {- let s = {...settings};+ let s = { ...settings };s[name] = value;await MMKV.setStringAsync('appSettings', JSON.stringify(s));useSettingStore.getState().setSettings(s);@@ -66,7 +63,7 @@ export const getElevation = elevation => {return {elevation,shadowColor: 'black',- shadowOffset: {width: 0.3 * elevation, height: 0.5 * elevation},+ shadowOffset: { width: 0.3 * elevation, height: 0.5 * elevation },shadowOpacity: 0.2,shadowRadius: 0.7 * elevation};@@ -141,6 +138,7 @@ export async function doInBackground(cb) {return e.message;}} else {+ // eslint-disable-next-line no-async-promise-executorreturn new Promise(async (res, rej) => {try {await BackgroundService.start(async () => {@@ -344,7 +342,7 @@ export async function toTXT(note) {}htmlToText = htmlToText || require('html-to-text');text = htmlToText.convert(text, {- selectors: [{selector: 'img', format: 'skip'}]+ selectors: [{ selector: 'img', format: 'skip' }]});text = `${note.title}\n \n ${text}`;return text;diff --git a/apps/mobile/src/utils/layoutmanager.js b/apps/mobile/src/utils/layoutmanager.jsindex 37ead2f48..00ed9dfd8 100644--- a/apps/mobile/src/utils/layoutmanager.js+++ b/apps/mobile/src/utils/layoutmanager.js@@ -1,20 +1,15 @@-import SettingsService from '../services/SettingsService';--const {LayoutAnimation} = require('react-native');+const { LayoutAnimation } = require('react-native');function withAnimation(duration = 300) {-return;// try {// throw new Error('error withAnimation')// } catch(e) {// console.log(e.stack);// }- console.log('reduce withAnimation: ',SettingsService.get().reduceAnimations)- if (SettingsService.get().reduceAnimations) return;- LayoutAnimation.configureNext(- LayoutAnimation.create(duration, 'linear', 'opacity')- );+ // console.log('reduce withAnimation: ', SettingsService.get().reduceAnimations);+ // if (SettingsService.get().reduceAnimations) return;+ // LayoutAnimation.configureNext(LayoutAnimation.create(duration, 'linear', 'opacity'));}function withSpringAnimation(duration = 300) {@@ -24,25 +19,25 @@ function withSpringAnimation(duration = 300) {// console.log(e.stack);// }return;- console.log('reduce withSpringAnimation: ',SettingsService.get().reduceAnimations)- if (SettingsService.get().reduceAnimations) return;- LayoutAnimation.configureNext({- duration: duration,- create: {- type: LayoutAnimation.Types.linear,- property: LayoutAnimation.Properties.opacity,- duration: duration / 2- },- update: {- type: LayoutAnimation.Types.spring,- springDamping: 0.8- },- delete: {- type: LayoutAnimation.Types.easeOut,- property: LayoutAnimation.Properties.opacity,- duration: duration / 2- }- });+ // console.log('reduce withSpringAnimation: ', SettingsService.get().reduceAnimations);+ // if (SettingsService.get().reduceAnimations) return;+ // LayoutAnimation.configureNext({+ // duration: duration,+ // create: {+ // type: LayoutAnimation.Types.linear,+ // property: LayoutAnimation.Properties.opacity,+ // duration: duration / 2+ // },+ // update: {+ // type: LayoutAnimation.Types.spring,+ // springDamping: 0.8+ // },+ // delete: {+ // type: LayoutAnimation.Types.easeOut,+ // property: LayoutAnimation.Properties.opacity,+ // duration: duration / 2+ // }+ // });}export default {diff --git a/apps/mobile/src/utils/linkpreview.ts b/apps/mobile/src/utils/linkpreview.tsindex 785aaa044..c855654fc 100644--- a/apps/mobile/src/utils/linkpreview.ts+++ b/apps/mobile/src/utils/linkpreview.ts@@ -1,5 +1,5 @@-import {Image} from 'react-native';-import {decode, EntityLevel} from 'entities';+import { Image } from 'react-native';+import { decode, EntityLevel } from 'entities';export interface PreviewData {description?: string;image?: PreviewDataImage;@@ -22,8 +22,7 @@ export const getActualImageUrl = (baseUrl: string, imageUrl?: string) => {let actualImageUrl = imageUrl?.trim();if (!actualImageUrl || actualImageUrl.startsWith('data')) return;- if (actualImageUrl.startsWith('//'))- actualImageUrl = `https:${actualImageUrl}`;+ if (actualImageUrl.startsWith('//')) actualImageUrl = `https:${actualImageUrl}`;if (!actualImageUrl.startsWith('http')) {if (baseUrl.endsWith('/') && actualImageUrl.startsWith('/')) {@@ -39,8 +38,8 @@ export const getActualImageUrl = (baseUrl: string, imageUrl?: string) => {export const getHtmlEntitiesDecodedText = (text?: string) => {const actualText = text?.trim();if (!actualText) return;- return decode(actualText,{- level:EntityLevel.HTML+ return decode(actualText, {+ level: EntityLevel.HTML});};@@ -54,10 +53,7 @@ export const getContent = (left: string, right: string, type: string) => {};const getDiffUrl = actualImageUrl => {- if (- !actualImageUrl.startsWith('https://www.') ||- !actualImageUrl.startsWith('http://www.')- ) {+ if (!actualImageUrl.startsWith('https://www.') || !actualImageUrl.startsWith('http://www.')) {if (actualImageUrl.startsWith('http://')) {actualImageUrl = actualImageUrl.replace('http://', 'http://www.');} else {@@ -72,7 +68,7 @@ export const getImageSize = (url: string) => {Image.getSize(url,(width, height) => {- resolve({height, width});+ resolve({ height, width });},// type-coverage:ignore-next-lineerror => {@@ -83,7 +79,7 @@ export const getImageSize = (url: string) => {Image.getSize(urlWithwww,(width, height) => {- resolve({height, width});+ resolve({ height, width });},// type-coverage:ignore-next-lineerror => reject(error)@@ -178,19 +174,16 @@ export const getLinkPreview = async (text: string) => {!acc.description &&(getContent(curr[2], curr[3], 'og:description') ||getContent(curr[2], curr[3], 'description'));- const ogImage =- !acc.imageUrl && getContent(curr[2], curr[3], 'og:image');+ const ogImage = !acc.imageUrl && getContent(curr[2], curr[3], 'og:image');const ogTitle = !acc.title && getContent(curr[2], curr[3], 'og:title');return {- description: description- ? getHtmlEntitiesDecodedText(description)- : acc.description,+ description: description ? getHtmlEntitiesDecodedText(description) : acc.description,imageUrl: ogImage ? getActualImageUrl(url, ogImage) : acc.imageUrl,title: ogTitle ? getHtmlEntitiesDecodedText(ogTitle) : acc.title};},- {title: previewData.title}+ { title: previewData.title });previewData.description = metaPreviewData.description;@@ -206,9 +199,7 @@ export const getLinkPreview = async (text: string) => {let images: PreviewDataImage[] = [];- for (const tag of tags- .filter(t => !t[1].startsWith('data'))- .slice(0, 5)) {+ for (const tag of tags.filter(t => !t[1].startsWith('data')).slice(0, 5)) {const image = await getPreviewDataImage(getActualImageUrl(url, tag[1]));if (!image) continue;@@ -216,9 +207,7 @@ export const getLinkPreview = async (text: string) => {images = [...images, image];}- previewData.image = images.sort(- (a, b) => b.height * b.width - a.height * a.width- )[0];+ previewData.image = images.sort((a, b) => b.height * b.width - a.height * a.width)[0];}return previewData;@@ -232,33 +221,28 @@ export const getPreviewDataImage = async (url?: string) => {if (!url) return;try {- const {height, width} = await getImageSize(url);+ const { height, width } = await getImageSize(url);const aspectRatio = width / (height || 1);if (height > 100 && width > 100 && aspectRatio > 0.1 && aspectRatio < 10) {- const image: PreviewDataImage = {height, url, width};+ const image: PreviewDataImage = { height, url, width };return image;}} catch {}};export const oneOf =- <T extends (...args: A) => any, U, A extends any[]>(- truthy: T | undefined,- falsy: U- ) =>+ <T extends (...args: A) => any, U, A extends any[]>(truthy: T | undefined, falsy: U) =>(...args: Parameters<T>): ReturnType<T> | U => {return truthy ? truthy(...args) : falsy;};-export const REGEX_EMAIL =- /([a-zA-Z0-9+._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)/g;+export const REGEX_EMAIL = /([a-zA-Z0-9+._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)/g;export const REGEX_IMAGE_CONTENT_TYPE = /image\/*/g;// Consider empty line after img tag and take only the src field, space before to not match data-src for exampleexport const REGEX_IMAGE_TAG = /<img[\n\r]*.*? src=["'](.*?)["']/g;export const REGEX_LINK =/((http|ftp|https):\/\/)?([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?/i;// Some pages write content before the name/property, some use single quotes instead of double-export const REGEX_META =- /<meta.*?(property|name)=["'](.*?)["'].*?content=["'](.*?)["'].*?>/g;+export const REGEX_META = /<meta.*?(property|name)=["'](.*?)["'].*?content=["'](.*?)["'].*?>/g;export const REGEX_TITLE = /<title.*?>(.*?)<\/title>/g;diff --git a/apps/mobile/src/utils/umami.js b/apps/mobile/src/utils/umami.jsindex 3b54014cb..ec6be9606 100644--- a/apps/mobile/src/utils/umami.js+++ b/apps/mobile/src/utils/umami.js@@ -1,6 +1,6 @@-import {Platform} from 'react-native';-import {MMKV} from './mmkv';-import {useSettingStore} from '../provider/stores';+import { Platform } from 'react-native';+import { MMKV } from './mmkv';+import { useSettingStore } from '../provider/stores';const WEBSITE_ID = `3c6890ce-8410-49d5-8831-15fb2eb28a21`;const baseUrl = `https://analytics.streetwriters.co/api/collect`;@@ -30,7 +30,7 @@ async function canUpdateAnalytics(route, conditions = []) {return false;}if (route !== '/welcome') {- for (cond of conditions) {+ for (let cond of conditions) {if (!eventsList || !eventsList[cond]) {console.log('analytics: conditions not met for event', route, cond);return false;@@ -61,12 +61,7 @@ async function saveAnalytics(route, value = true) {* @returns*/-async function pageView(- route,- prevRoute = '',- conditions = ['/welcome'],- once = true-) {+async function pageView(route, prevRoute = '', conditions = ['/welcome'], once = true) {if (!(await canUpdateAnalytics(route, conditions)) && once) return;let body = {payload: {diff --git a/apps/mobile/src/utils/useAnnouncement.js b/apps/mobile/src/utils/useAnnouncement.jsindex 7ab5bedb5..7f90f7f24 100644--- a/apps/mobile/src/utils/useAnnouncement.js+++ b/apps/mobile/src/utils/useAnnouncement.js@@ -1,9 +1,9 @@-import {useCallback, useEffect, useState} from 'react';-import {Platform} from 'react-native';-import {SUBSCRIPTION_STATUS} from '.';+import { useCallback, useEffect, useState } from 'react';+import { Platform } from 'react-native';+import { SUBSCRIPTION_STATUS } from '.';import PremiumService from '../services/PremiumService';-import {db} from './database';-import {MMKV} from './mmkv';+import { db } from './database';+import { MMKV } from './mmkv';var CACHED_ANNOUNCEMENT;export default function useAnnouncement() {@@ -15,8 +15,7 @@ export default function useAnnouncement() {CACHED_ANNOUNCEMENT = CACHED_ANNOUNCEMENT || (await db.announcement());if (!CACHED_ANNOUNCEMENT ||- (await MMKV.getStringAsync('removedAnnouncement')) ===- CACHED_ANNOUNCEMENT.id ||+ (await MMKV.getStringAsync('removedAnnouncement')) === CACHED_ANNOUNCEMENT.id ||!shouldShowAnnouncement(CACHED_ANNOUNCEMENT)) {CACHED_ANNOUNCEMENT = null;@@ -47,7 +46,7 @@ function shouldShowAnnouncement(announcement) {switch (announcement.userType) {case 'pro':- show = isUserPremium();+ show = PremiumService.get() && subStatus !== SUBSCRIPTION_STATUS.TRIAL;break;case 'trial':show = subStatus === SUBSCRIPTION_STATUS.TRIAL;diff --git a/apps/mobile/src/utils/useAppEvents.js b/apps/mobile/src/utils/useAppEvents.jsindex a97ee3d1f..4ff6bd5ed 100644--- a/apps/mobile/src/utils/useAppEvents.js+++ b/apps/mobile/src/utils/useAppEvents.js@@ -50,12 +50,7 @@ import {import tiny from '../views/Editor/tiny/tiny';import { updateStatusBarColor } from './Colors';import { db } from './database';-import {- eClearEditor,- eCloseProgressDialog,- eOpenLoginDialog,- refreshNotesPage-} from './Events';+import { eClearEditor, eCloseProgressDialog, eOpenLoginDialog, refreshNotesPage } from './Events';import { MMKV } from './mmkv';import Storage from './storage';import { sleep } from './TimeUtils';@@ -78,13 +73,13 @@ export const useAppEvents = () => {isReconnecting: false});- const onMediaDownloaded = ({hash, groupId, src}) => {+ const onMediaDownloaded = ({ hash, groupId, src }) => {if (groupId?.startsWith('monograph')) return;tiny.call(EditorWebView,`(function(){- let image = ${JSON.stringify({hash, src})};+ let image = ${JSON.stringify({ hash, src })};tinymce.activeEditor._replaceImage(image);})();`@@ -92,16 +87,12 @@ export const useAppEvents = () => {};const onLoadingAttachment = data => {- useAttachmentStore- .getState()- .setLoading(data.total === data.current ? null : data);+ useAttachmentStore.getState().setLoading(data.total === data.current ? null : data);};- const onSodiumProgress = ({total, progress}) => {+ const onSodiumProgress = ({ total, progress }) => {console.log('encryption progress: ', (progress / total).toFixed(2));- useAttachmentStore- .getState()- .setEncryptionProgress((progress / total).toFixed(2));+ useAttachmentStore.getState().setEncryptionProgress((progress / total).toFixed(2));};useEffect(() => {@@ -117,10 +108,7 @@ export const useAppEvents = () => {EV.subscribe(EVENTS.mediaAttachmentDownloaded, onMediaDownloaded);EV.subscribe(EVENTS.attachmentsLoading, onLoadingAttachment);- let ubsubsodium = SodiumEventEmitter.addListener(- 'onSodiumProgress',- onSodiumProgress- );+ let ubsubsodium = SodiumEventEmitter.addListener('onSodiumProgress', onSodiumProgress);eSubscribeEvent('userLoggedIn', setCurrentUser);@@ -147,19 +135,19 @@ export const useAppEvents = () => {eSendEvent(eOpenLoginDialog, 4);};- const onNoteRemoved = async id => {- try {- await db.notes.remove(id);- Navigation.setRoutesToUpdate([- Navigation.routeNames.Favorites,- Navigation.routeNames.Notes,- Navigation.routeNames.NotesPage,- Navigation.routeNames.Trash,- Navigation.routeNames.Notebook- ]);- eSendEvent(eClearEditor, id);- } catch (e) {}- };+ // const onNoteRemoved = async id => {+ // try {+ // await db.notes.remove(id);+ // Navigation.setRoutesToUpdate([+ // Navigation.routeNames.Favorites,+ // Navigation.routeNames.Notes,+ // Navigation.routeNames.NotesPage,+ // Navigation.routeNames.Trash,+ // Navigation.routeNames.Notebook+ // ]);+ // eSendEvent(eClearEditor, id);+ // } catch (e) {}+ // };useEffect(() => {if (!loading) {@@ -173,9 +161,8 @@ export const useAppEvents = () => {await setCurrentUser();} catch (e) {}})();- refValues.current.removeInternetStateListener = NetInfo.addEventListener(- onInternetStateChanged- );+ refValues.current.removeInternetStateListener =+ NetInfo.addEventListener(onInternetStateChanged);}return () => {refValues.current?.removeInternetStateListener &&@@ -215,8 +202,7 @@ export const useAppEvents = () => {if (!user) return;MMKV.setItem('isUserEmailConfirmed', 'yes');await PremiumService.setPremiumStatus();- let message =- 'You have been rewarded 7 more days of free trial. Enjoy using Notesnook!';+ let message = 'You have been rewarded 7 more days of free trial. Enjoy using Notesnook!';presentSheet({title: 'Email confirmed!',paragraph: message,@@ -226,7 +212,8 @@ export const useAppEvents = () => {paddingHorizontal: 12,paddingBottom: 15,alignItems: 'center'- }}>+ }}+ ><ProFeatures /></View>)@@ -320,7 +307,7 @@ export const useAppEvents = () => {}, 1000);};- unsubIAP = () => {+ const unsubIAP = () => {if (refValues.current?.subsriptionSuccessListener) {refValues.current.subsriptionSuccessListener?.remove();refValues.current.subsriptionSuccessListener = null;@@ -335,9 +322,7 @@ export const useAppEvents = () => {try {let user = await db.user.getUser();- let isUserEmailConfirmed = await MMKV.getStringAsync(- 'isUserEmailConfirmed'- );+ let isUserEmailConfirmed = await MMKV.getStringAsync('isUserEmailConfirmed');if ((await MMKV.getItem('loginSessionHasExpired')) === 'expired') {setUser(user);@@ -357,9 +342,7 @@ export const useAppEvents = () => {}if (user.isEmailConfirmed) {- let hasSavedRecoveryKey = await MMKV.getItem(- 'userHasSavedRecoveryKey'- );+ let hasSavedRecoveryKey = await MMKV.getItem('userHasSavedRecoveryKey');if (!hasSavedRecoveryKey) {setRecoveryKeyMessage();}@@ -437,16 +420,11 @@ export const useAppEvents = () => {}if (SettingsService.get().appLockMode === 'background') {- if (- refValues.current?.prevState === 'background' &&- !refValues.current?.showingDialog- ) {+ if (refValues.current?.prevState === 'background' && !refValues.current?.showingDialog) {refValues.current.showingDialog = true;refValues.current.prevState = 'active';eSendEvent('load_overlay', 'hide');- let result = await BiometricService.validateUser(- 'Unlock to access your notes'- );+ let result = await BiometricService.validateUser('Unlock to access your notes');if (result) {refValues.current.showingDialog = false;eSendEvent('load_overlay', 'show');@@ -475,10 +453,7 @@ export const useAppEvents = () => {}} else {refValues.current.prevState = 'background';- if (- getNote()?.locked &&- SettingsService.get().appLockMode === 'background'- ) {+ if (getNote()?.locked && SettingsService.get().appLockMode === 'background') {eSendEvent(eClearEditor);}await storeAppState();diff --git a/apps/mobile/src/utils/useIsFloatingKeyboard.js b/apps/mobile/src/utils/useIsFloatingKeyboard.jsindex f3d7a8c40..7c24c2861 100644--- a/apps/mobile/src/utils/useIsFloatingKeyboard.js+++ b/apps/mobile/src/utils/useIsFloatingKeyboard.js@@ -7,7 +7,7 @@ const useIsFloatingKeyboard = () => {const [floating, setFloating] = useState(false);useEffect(() => {- const onKeyboardWillChangeFrame = (event) => {+ const onKeyboardWillChangeFrame = event => {setFloating(event.endCoordinates.width !== windowWidth);};@@ -20,4 +20,4 @@ const useIsFloatingKeyboard = () => {return floating;};-export default useIsFloatingKeyboard\ No newline at end of file+export default useIsFloatingKeyboard;diff --git a/apps/mobile/src/utils/useKeyboard.ts b/apps/mobile/src/utils/useKeyboard.tsindex cd9e7e4eb..87a6f36c0 100644--- a/apps/mobile/src/utils/useKeyboard.ts+++ b/apps/mobile/src/utils/useKeyboard.ts@@ -1,61 +1,61 @@-import {useEffect, useState} from 'react'-import {Keyboard, KeyboardEventListener, ScreenRect} from 'react-native'+import { useEffect, useState } from 'react';+import { Keyboard, KeyboardEventListener, ScreenRect } from 'react-native';const emptyCoordinates = Object.freeze({screenX: 0,screenY: 0,width: 0,- height: 0,-})+ height: 0+});const initialValue = {start: emptyCoordinates,- end: emptyCoordinates,-}+ end: emptyCoordinates+};export function useKeyboard() {- const [shown, setShown] = useState(false)+ const [shown, setShown] = useState(false);const [coordinates, setCoordinates] = useState<{- start: undefined | ScreenRect- end: ScreenRect- }>(initialValue)- const [keyboardHeight, setKeyboardHeight] = useState<number>(0)+ start: undefined | ScreenRect;+ end: ScreenRect;+ }>(initialValue);+ const [keyboardHeight, setKeyboardHeight] = useState<number>(0);- const handleKeyboardWillShow: KeyboardEventListener = (e) => {- setCoordinates({start: e.startCoordinates, end: e.endCoordinates})- }- const handleKeyboardDidShow: KeyboardEventListener = (e) => {- setShown(true)- setCoordinates({start: e.startCoordinates, end: e.endCoordinates})- setKeyboardHeight(e.endCoordinates.height)- }- const handleKeyboardWillHide: KeyboardEventListener = (e) => {- setCoordinates({start: e.startCoordinates, end: e.endCoordinates})- }- const handleKeyboardDidHide: KeyboardEventListener = (e) => {- setShown(false)+ const handleKeyboardWillShow: KeyboardEventListener = e => {+ setCoordinates({ start: e.startCoordinates, end: e.endCoordinates });+ };+ const handleKeyboardDidShow: KeyboardEventListener = e => {+ setShown(true);+ setCoordinates({ start: e.startCoordinates, end: e.endCoordinates });+ setKeyboardHeight(e.endCoordinates.height);+ };+ const handleKeyboardWillHide: KeyboardEventListener = e => {+ setCoordinates({ start: e.startCoordinates, end: e.endCoordinates });+ };+ const handleKeyboardDidHide: KeyboardEventListener = e => {+ setShown(false);if (e) {- setCoordinates({start: e.startCoordinates, end: e.endCoordinates})+ setCoordinates({ start: e.startCoordinates, end: e.endCoordinates });} else {- setCoordinates(initialValue)- setKeyboardHeight(0)+ setCoordinates(initialValue);+ setKeyboardHeight(0);}- }+ };useEffect(() => {const subscriptions = [Keyboard.addListener('keyboardWillShow', handleKeyboardWillShow),Keyboard.addListener('keyboardDidShow', handleKeyboardDidShow),Keyboard.addListener('keyboardWillHide', handleKeyboardWillHide),- Keyboard.addListener('keyboardDidHide', handleKeyboardDidHide),- ]+ Keyboard.addListener('keyboardDidHide', handleKeyboardDidHide)+ ];return () => {- subscriptions.forEach((subscription) => subscription.remove())- }- }, [])+ subscriptions.forEach(subscription => subscription.remove());+ };+ }, []);return {keyboardShown: shown,coordinates,- keyboardHeight,- }-}\ No newline at end of file+ keyboardHeight+ };+}diff --git a/apps/mobile/src/views/Editor/EditorHeader.js b/apps/mobile/src/views/Editor/EditorHeader.jsindex 93e832192..57d5600ff 100644--- a/apps/mobile/src/views/Editor/EditorHeader.js+++ b/apps/mobile/src/views/Editor/EditorHeader.js@@ -1,24 +1,13 @@-import {EV, EVENTS} from 'notes-core/common';-import React, {useEffect, useRef} from 'react';-import {- BackHandler,- InteractionManager,- Keyboard,- Platform,- Vibration,- View-} from 'react-native';-import {useSafeAreaInsets} from 'react-native-safe-area-context';-import {notesnook} from '../../../e2e/test.ids';-import {ActionIcon} from '../../components/ActionIcon';-import {Properties} from '../../components/Properties';-import {useTracked} from '../../provider';-import {- useEditorStore,- useSettingStore,- useUserStore-} from '../../provider/stores';-import {DDS} from '../../services/DeviceDetection';+import { EV, EVENTS } from 'notes-core/common';+import React, { useEffect, useRef } from 'react';+import { BackHandler, InteractionManager, Keyboard, Platform, Vibration, View } from 'react-native';+import { useSafeAreaInsets } from 'react-native-safe-area-context';+import { notesnook } from '../../../e2e/test.ids';+import { ActionIcon } from '../../components/ActionIcon';+import { Properties } from '../../components/Properties';+import { useTracked } from '../../provider';+import { useEditorStore, useSettingStore, useUserStore } from '../../provider/stores';+import { DDS } from '../../services/DeviceDetection';import {eSendEvent,eSubscribeEvent,@@ -26,8 +15,8 @@ import {ToastEvent} from '../../services/EventManager';import Navigation from '../../services/Navigation';-import {editing, SUBSCRIPTION_STATUS} from '../../utils';-import {db} from '../../utils/database';+import { editing, SUBSCRIPTION_STATUS } from '../../utils';+import { db } from '../../utils/database';import {eClearEditor,eCloseFullscreenEditor,@@ -37,9 +26,9 @@ import {eOpenPremiumDialog,eOpenPublishNoteDialog} from '../../utils/Events';-import {tabBarRef} from '../../utils/Refs';+import { tabBarRef } from '../../utils/Refs';import umami from '../../utils/umami';-import {EditorTitle} from './EditorTitle';+import { EditorTitle } from './EditorTitle';import {clearEditor,clearTimer,@@ -48,20 +37,18 @@ import {setColors,startClosingSession} from './Functions';-import {ProgressCircle} from './ProgressCircle';-import tiny, {safeKeyboardDismiss} from './tiny/tiny';-import {endSearch} from './tiny/toolbar/commands';-import {toolbarRef} from './tiny/toolbar/constants';+import { ProgressCircle } from './ProgressCircle';+import tiny, { safeKeyboardDismiss } from './tiny/tiny';+import { endSearch } from './tiny/toolbar/commands';+import { toolbarRef } from './tiny/toolbar/constants';import picker from './tiny/toolbar/picker';-import {useEditorTags} from './useEditorTags';+import { useEditorTags } from './useEditorTags';const EditorHeader = () => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const deviceMode = useSettingStore(state => state.deviceMode);- const currentlyEditingNote = useEditorStore(- state => state.currentEditingNote- );+ const currentlyEditingNote = useEditorStore(state => state.currentEditingNote);const fullscreen = useSettingStore(state => state.fullscreen);const user = useUserStore(state => state.user);const insets = useSafeAreaInsets();@@ -194,27 +181,24 @@ const EditorHeader = () => {}, []);const onNoteRemoved = async id => {- try {- return;- // console.log('NOTE REMOVED', id);- // await db.notes.remove(id);- // if (id !== getNote().id) return;- // Navigation.setRoutesToUpdate([- // Navigation.routeNames.Favorites,- // Navigation.routeNames.Notes,- // Navigation.routeNames.NotesPage,- // Navigation.routeNames.Trash,- // Navigation.routeNames.Notebook- // ]);- } catch (e) {}+ // try {+ // return;+ // // console.log('NOTE REMOVED', id);+ // // await db.notes.remove(id);+ // // if (id !== getNote().id) return;+ // // Navigation.setRoutesToUpdate([+ // // Navigation.routeNames.Favorites,+ // // Navigation.routeNames.Notes,+ // // Navigation.routeNames.NotesPage,+ // // Navigation.routeNames.Trash,+ // // Navigation.routeNames.Notebook+ // // ]);+ // } catch (e) {}};useEffect(() => {if (fullscreen && DDS.isTab) {- handleBack.current = BackHandler.addEventListener(- 'hardwareBackPress',- _onBackPress- );+ handleBack.current = BackHandler.addEventListener('hardwareBackPress', _onBackPress);}return () => {@@ -229,10 +213,7 @@ const EditorHeader = () => {console.log(item.id);await loadNote(item);InteractionManager.runAfterInteractions(() => {- keyboardListener.current = Keyboard.addListener(- 'keyboardDidShow',- tiny.onKeyboardShow- );+ keyboardListener.current = Keyboard.addListener('keyboardDidShow', tiny.onKeyboardShow);if (!DDS.isTab) {handleBack.current = BackHandler.addEventListener('hardwareBackPress',@@ -256,10 +237,7 @@ const EditorHeader = () => {handleBack.current = null;}- handleBack.current = BackHandler.addEventListener(- 'hardwareBackPress',- _onHardwareBackPress- );+ handleBack.current = BackHandler.addEventListener('hardwareBackPress', _onHardwareBackPress);return;}if (editing.currentlyEditing) {@@ -284,16 +262,17 @@ const EditorHeader = () => {flexDirection: 'row',paddingHorizontal: 12,height: 50,- justifyContent:'space-between'-- }}>+ justifyContent: 'space-between'+ }}+ ><Viewstyle={{flexDirection: 'row',alignItems: 'center',flexGrow: 1,flexShrink: 1- }}>+ }}+ >{deviceMode !== 'mobile' && !fullscreen ? null : (<ActionIcononLongPress={async () => {@@ -312,14 +291,15 @@ const EditorHeader = () => {}}/>)}- {fullscreen ? <View style={{width: 20}} /> : null}+ {fullscreen ? <View style={{ width: 20 }} /> : null}{deviceMode !== 'mobile' ? <EditorTitle /> : null}</View><Viewstyle={{- flexDirection: 'row',- }}>+ flexDirection: 'row'+ }}+ ><>{!user ||user?.subscription.type === SUBSCRIPTION_STATUS.BASIC ||@@ -336,7 +316,7 @@ const EditorHeader = () => {safeKeyboardDismiss();editing.isFocused = true;}- umami.pageView("/pro-screen","/editor")+ umami.pageView('/pro-screen', '/editor');eSendEvent(eOpenPremiumDialog);}}/>diff --git a/apps/mobile/src/views/Editor/EditorOverlay.js b/apps/mobile/src/views/Editor/EditorOverlay.jsindex 69101ee1c..710e59add 100644--- a/apps/mobile/src/views/Editor/EditorOverlay.js+++ b/apps/mobile/src/views/Editor/EditorOverlay.js@@ -1,26 +1,22 @@-import React, {useEffect, useState} from 'react';-import {View} from 'react-native';-import Animated, {Easing, timing, useValue} from 'react-native-reanimated';-import {Button} from '../../components/Button';+import React, { useEffect, useState } from 'react';+import { View } from 'react-native';+import Animated, { Easing, timing, useValue } from 'react-native-reanimated';+import { Button } from '../../components/Button';import Heading from '../../components/Typography/Heading';import Paragraph from '../../components/Typography/Paragraph';-import {useTracked} from '../../provider';-import {- eSendEvent,- eSubscribeEvent,- eUnSubscribeEvent-} from '../../services/EventManager';-import {editing} from '../../utils';-import {eOnLoadNote} from '../../utils/Events';-import {SIZE} from '../../utils/SizeUtils';-import {sleep, timeConverter} from '../../utils/TimeUtils';+import { useTracked } from '../../provider';+import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';+import { editing } from '../../utils';+import { eOnLoadNote } from '../../utils/Events';+import { SIZE } from '../../utils/SizeUtils';+import { sleep, timeConverter } from '../../utils/TimeUtils';let timer = null;let timerError = null;let timerClosing = null;const EditorOverlay = () => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const [loading, setLoading] = useState(null);const [error, setError] = useState(false);const opacity = useValue(1);@@ -83,7 +79,8 @@ const EditorOverlay = () => {}],zIndex: 100- }}>+ }}+ ><Animated.Viewstyle={{width: '90%',@@ -92,7 +89,8 @@ const EditorOverlay = () => {backgroundColor: colors.bg,borderRadius: 5,paddingVertical: 20- }}>+ }}+ ><Viewstyle={{flexDirection: 'row',@@ -102,7 +100,8 @@ const EditorOverlay = () => {borderRadius: 5,overflow: 'hidden',backgroundColor: colors.nav- }}>+ }}+ ><Animated.Viewstyle={{height: 10,@@ -116,8 +115,9 @@ const EditorOverlay = () => {{loading?.title ? (<HeadingtextBreakStrategy="balanced"- style={{textAlign: 'center', marginBottom: 5}}- size={SIZE.lg}>+ style={{ textAlign: 'center', marginBottom: 5 }}+ size={SIZE.lg}+ >{loading.title}</Heading>) : null}@@ -125,9 +125,10 @@ const EditorOverlay = () => {{loading?.dateEdited ? (<ParagraphtextBreakStrategy="balanced"- style={{textAlign: 'center'}}+ style={{ textAlign: 'center' }}color={colors.icon}- size={SIZE.sm}>+ size={SIZE.sm}+ >{timeConverter(loading.dateEdited)}</Paragraph>) : null}@@ -138,7 +139,8 @@ const EditorOverlay = () => {style={{position: 'absolute',bottom: 25- }}>+ }}+ ><Buttontype="errorShade"style={{@@ -158,9 +160,9 @@ const EditorOverlay = () => {textAlign: 'center',maxWidth: '100%',marginTop: 5- }}>- If the editor fails to load even after reloading. Try restarting the- app.+ }}+ >+ If the editor fails to load even after reloading. Try restarting the app.</Paragraph></View>)}diff --git a/apps/mobile/src/views/Editor/EditorSettings.js b/apps/mobile/src/views/Editor/EditorSettings.jsindex 2588a2cff..10eefab95 100644--- a/apps/mobile/src/views/Editor/EditorSettings.js+++ b/apps/mobile/src/views/Editor/EditorSettings.js@@ -1,31 +1,31 @@-import React, {createRef, useEffect, useRef, useState} from 'react';-import {View} from 'react-native';-import Menu, {MenuItem} from 'react-native-reanimated-material-menu';+import React, { createRef, useEffect, useRef, useState } from 'react';+import { View } from 'react-native';+import Menu, { MenuItem } from 'react-native-reanimated-material-menu';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';import SheetWrapper from '../../components/Sheet';-import {Button} from '../../components/Button';+import { Button } from '../../components/Button';import BaseDialog from '../../components/Dialog/base-dialog';import DialogButtons from '../../components/Dialog/dialog-buttons';import DialogContainer from '../../components/Dialog/dialog-container';import DialogHeader from '../../components/Dialog/dialog-header';import Input from '../../components/Input';-import {PressableButton} from '../../components/PressableButton';+import { PressableButton } from '../../components/PressableButton';import Seperator from '../../components/Seperator';import Paragraph from '../../components/Typography/Paragraph';-import {useTracked} from '../../provider';-import {eSendEvent, eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';-import {SIZE} from '../../utils/SizeUtils';-import {sleep} from '../../utils/TimeUtils';-import {EditorWebView, getNote} from './Functions';+import { useTracked } from '../../provider';+import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';+import { SIZE } from '../../utils/SizeUtils';+import { sleep } from '../../utils/TimeUtils';+import { EditorWebView, getNote } from './Functions';import tiny from './tiny/tiny';import ToggleSwitch from 'toggle-switch-react-native';export const EditorSettings = () => {const [state, dispatch] = useTracked();- const {colors} = state;+ const { colors } = state;const [settings, setSettings] = useState({fontSize: 10,- directionality: 'ltr',+ directionality: 'ltr'});const [visible, setVisible] = useState(false);const [savePreset, setSavePreset] = useState(false);@@ -66,7 +66,7 @@ export const EditorSettings = () => {dropDownTitle,style,stub,- onPress,+ onPress}) => (<PressableButtononPress={onPress}@@ -77,12 +77,14 @@ export const EditorSettings = () => {alignItems: 'center',justifyContent: 'space-between',borderRadius: 0,- paddingHorizontal: 12,- }}>+ paddingHorizontal: 12+ }}+ ><Viewstyle={{- flexGrow: 1,- }}>+ flexGrow: 1+ }}+ ><Paragraph size={SIZE.md}>{title}</Paragraph>{description && (<Paragraph color={colors.icon} size={SIZE.sm}>@@ -120,16 +122,16 @@ export const EditorSettings = () => {stub: 'pt',dropDownTitle: settings.fontSize + 'pt',style: {- width: 70,+ width: 70},dropdownItemPress: item => {tiny.call(EditorWebView,`changeFontSize(${item})- `,+ `);- },+ }},{title: 'RTL Direction',@@ -141,25 +143,25 @@ export const EditorSettings = () => {EditorWebView,`changeDirection(${settings.directionality === 'rtl' ? false : true})- `,+ `);- eSendEvent('loadingNote',getNote());+ eSendEvent('loadingNote', getNote());await sleep(100);EditorWebView.current?.reload();- },- },+ }+ }];let presets = [{name: 'Poems',size: '12pt',- fontname: {name: 'Times New Roman', value: 'times new roman'},+ fontname: { name: 'Times New Roman', value: 'times new roman' },line_break: 'paragraph',direction: 'ltr',forecolor: '#ff0000',- hilitecolor: '#00ff00',- },+ hilitecolor: '#00ff00'+ }];return (@@ -168,19 +170,18 @@ export const EditorSettings = () => {fwdRef={actionSheetRef}onClose={() => {setVisible(false);- }}>+ }}+ ><View>{savePreset && (<BaseDialogonRequestClose={() => {setSavePreset(false);}}- visible={true}>+ visible={true}+ ><DialogContainer>- <DialogHeader- title="Save preset"- paragraph="Give this preset a name."- />+ <DialogHeader title="Save preset" paragraph="Give this preset a name." /><Input placeholder="Preset name" /><DialogButtonspositiveTitle="Save"@@ -193,12 +194,13 @@ export const EditorSettings = () => {<Viewstyle={{- paddingHorizontal: 12,- }}>+ paddingHorizontal: 12+ }}+ ><DialogHeadertitle="Editor settings"paragraph="Modify editor settings based on personal preference."- /* button={{+ /* button={{title: 'Save as Preset',onPress: () => {setSavePreset(true);@@ -209,7 +211,7 @@ export const EditorSettings = () => {<Seperator />{settingsItems.map(item => (- <SettingsButton {...item} />+ <SettingsButton key={item.title} {...item} />))}</View></SheetWrapper>@@ -217,9 +219,9 @@ export const EditorSettings = () => {);};-const DropDownMenu = ({items, onPress, style, title, stub}) => {+const DropDownMenu = ({ items, onPress, style, title, stub }) => {const [state, dispatch] = useTracked();- const {colors} = state;+ const { colors } = state;const menuRef = useRef();return (@@ -228,9 +230,9 @@ const DropDownMenu = ({items, onPress, style, title, stub}) => {animationDuration={200}style={[{- borderRadius: 5,+ borderRadius: 5},- style,+ style]}button={<Button@@ -239,18 +241,19 @@ const DropDownMenu = ({items, onPress, style, title, stub}) => {icon="chevron-down"iconSize={SIZE.lg}style={{- paddingRight: 0,+ paddingRight: 0}}onPress={() => {menuRef.current?.show();}}textStyle={{- fontWeight: 'normal',+ fontWeight: 'normal'}}width={null}fontSize={SIZE.sm}/>- }>+ }+ >{items.map((item, index) => (<MenuItemkey={item.toString()}@@ -260,8 +263,9 @@ const DropDownMenu = ({items, onPress, style, title, stub}) => {}}textStyle={{fontSize: SIZE.md,- color: colors.pri,- }}>+ color: colors.pri+ }}+ ><Icon name={item.icon} size={SIZE.md} />{item + stub}</MenuItem>diff --git a/apps/mobile/src/views/Editor/EditorTitle.js b/apps/mobile/src/views/Editor/EditorTitle.jsindex 12718bbfa..0768f68ed 100644--- a/apps/mobile/src/views/Editor/EditorTitle.js+++ b/apps/mobile/src/views/Editor/EditorTitle.js@@ -19,7 +19,7 @@ function animation(v) {export const EditorTitle = () => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const [title, setTitle] = useState(null);const onScroll = async data => {if (data.visible === undefined || data.visible === null) return;@@ -53,8 +53,9 @@ export const EditorTitle = () => {{translateY: translateY}- ],- }}>+ ]+ }}+ ><TextInputdefaultValue={title}style={{@@ -62,8 +63,8 @@ export const EditorTitle = () => {fontSize: SIZE.xl,color: colors.heading,padding: 0,- flexShrink:1,- flexWrap:'wrap'+ flexShrink: 1,+ flexWrap: 'wrap'}}placeholder="Note title"placeholderTextColor={colors.placeholder}diff --git a/apps/mobile/src/views/Editor/EditorWrapper.js b/apps/mobile/src/views/Editor/EditorWrapper.jsindex e7c016530..7c8b5e502 100644--- a/apps/mobile/src/views/Editor/EditorWrapper.js+++ b/apps/mobile/src/views/Editor/EditorWrapper.js@@ -1,4 +1,4 @@-import React, {useEffect} from 'react';+import React, { useEffect } from 'react';import {AppState,KeyboardAvoidingView,@@ -8,21 +8,21 @@ import {TextInput,View} from 'react-native';-import {useSafeAreaInsets} from 'react-native-safe-area-context';+import { useSafeAreaInsets } from 'react-native-safe-area-context';import Editor from '.';-import {PremiumToast} from '../../components/Premium/premium-toast';-import {useTracked} from '../../provider';-import {useNoteStore, useSettingStore} from '../../provider/stores';-import {DDS} from '../../services/DeviceDetection';-import {editing} from '../../utils';-import {editorRef} from '../../utils/Refs';+import { PremiumToast } from '../../components/Premium/premium-toast';+import { useTracked } from '../../provider';+import { useNoteStore, useSettingStore } from '../../provider/stores';+import { DDS } from '../../services/DeviceDetection';+import { editing } from '../../utils';+import { editorRef } from '../../utils/Refs';import useIsFloatingKeyboard from '../../utils/use-is-floating-keyboard';import EditorOverlay from './EditorOverlay';-import {checkStatus, textInput} from './Functions';+import { checkStatus, textInput } from './Functions';-export const EditorWrapper = ({width, dimensions}) => {+export const EditorWrapper = ({ width }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const deviceMode = useSettingStore(state => state.deviceMode);const loading = useNoteStore(state => state.loading);const insets = useSafeAreaInsets();@@ -55,24 +55,27 @@ export const EditorWrapper = ({width, dimensions}) => {borderLeftColor: DDS.isTab ? colors.nav : 'transparent'// paddingTop: Platform.OS === 'ios' ? insets.top : 0,// paddingBottom: Platform.OS === 'ios' ? insets.bottom : 0- }}>+ }}+ ><SafeAreaViewstyle={{width: '100%',height: '100%'- }}>+ }}+ ><KeyboardAvoidingViewbehavior="padding"style={{width: '100%',height: '100%'}}- enabled={!floating && Platform.OS === 'ios'}>+ enabled={!floating && Platform.OS === 'ios'}+ ><PremiumToast key="toast" context="editor" offset={50 + insets.top} /><TextInputkey="input"ref={textInput}- style={{height: 1, padding: 0, width: 1, position: 'absolute'}}+ style={{ height: 1, padding: 0, width: 1, position: 'absolute' }}blurOnSubmit={false}/>{loading ? null : <Editor key="editor" />}diff --git a/apps/mobile/src/views/Editor/Functions.js b/apps/mobile/src/views/Editor/Functions.jsindex cd88be705..c98b65fb3 100644--- a/apps/mobile/src/views/Editor/Functions.js+++ b/apps/mobile/src/views/Editor/Functions.js@@ -6,7 +6,8 @@ import { DDS } from '../../services/DeviceDetection';import {eSendEvent,eSubscribeEvent,- eUnSubscribeEvent, ToastEvent+ eUnSubscribeEvent,+ ToastEvent} from '../../services/EventManager';import Navigation from '../../services/Navigation';import PremiumService from '../../services/PremiumService';@@ -31,15 +32,11 @@ import umami from '../../utils/umami';import { TableCellProperties } from './TableCellProperties';import { TableRowProperties } from './TableRowProperties';import tiny from './tiny/tiny';-import {- IMAGE_TOOLTIP_CONFIG,- TABLE_TOOLTIP_CONFIG-} from './tiny/toolbar/config';+import { IMAGE_TOOLTIP_CONFIG, TABLE_TOOLTIP_CONFIG } from './tiny/toolbar/config';export let EditorWebView = createRef();export const editorTitleInput = createRef();-export const sourceUri =- Platform.OS === 'android' ? 'file:///android_asset/' : 'Web.bundle/site/';+export const sourceUri = Platform.OS === 'android' ? 'file:///android_asset/' : 'Web.bundle/site/';let lastEditTime = 0;let EDITOR_SETTINGS = null;@@ -60,7 +57,6 @@ let appColors = COLOR_SCHEME;let closingSession = false;let webviewTimer = null;let requestedReload = false;-let cTimeout = null;let disableSaving = false;let isSaving = false;let waitForContent = false;@@ -84,7 +80,7 @@ export function setColors(colors) {if (colors) {appColors = colors;}- let theme = {...appColors, factor: normalize(1)};+ let theme = { ...appColors, factor: normalize(1) };if (note && note.color && !DDS.isLargeTablet()) {theme.shade = hexToRGBA(COLORS_NOTE[note.color?.toLowerCase()], 0.15);@@ -97,7 +93,7 @@ export function isNotedEdited() {}async function waitForEvent(event, caller, onend) {- return new Promise((resolve, reject) => {+ return new Promise(resolve => {let resolved;let event_callback = () => {eUnSubscribeEvent(event, event_callback);@@ -114,7 +110,7 @@ async function waitForEvent(event, caller, onend) {});}-export async function clearTimer(clear) {+export async function clearTimer() {if (waitForContent && noteEdited) {await waitForEvent('content_event', () => {console.log('requested content from edtior');@@ -180,9 +176,7 @@ export function post(type, value = null) {export const _onShouldStartLoadWithRequest = async request => {if (request.url.includes('https')) {if (Platform.OS === 'ios' && !request.isTopFrame) return;- openLinkInBrowser(request.url, appColors)- .catch(e => {})- .then(r => {});+ openLinkInBrowser(request.url, appColors).catch(console.log).then(console.log);return false;} else {@@ -334,10 +328,7 @@ export const loadNote = async item => {editing.isFocused = false;await setNote(item);- if (- loading_queue &&- (loading_queue?.id !== item?.id || loading_queue?.type === 'new')- ) {+ if (loading_queue && (loading_queue?.id !== item?.id || loading_queue?.type === 'new')) {clearNote();loading_note = false;loadNote(loading_queue);@@ -456,7 +447,7 @@ function check_session_status() {export const _onMessage = async evt => {if (!evt || !evt.nativeEvent || !evt.nativeEvent.data) return;let message = evt.nativeEvent.data;-+ let user;try {message = JSON.parse(message);} catch (e) {@@ -533,7 +524,7 @@ export const _onMessage = async evt => {eSendEvent('loadingNote');break;case 'premium':- let user = await db.user.getUser();+ user = await db.user.getUser();if (user && !user.isEmailConfirmed) {await sleep(500);PremiumService.showVerifyEmailDialog();@@ -547,7 +538,7 @@ export const _onMessage = async evt => {break;case 'status':if (sessionId !== message.sessionId) {- if (!sessionId) makeSessionId({id});+ if (!sessionId) makeSessionId({ id });updateSessionStatus();return;}@@ -637,7 +628,7 @@ export const _onMessage = async evt => {case 'newtag':if (!getNote()) {ToastEvent.show({- heading:"Create a note first"+ heading: 'Create a note first'});return;}@@ -663,12 +654,12 @@ function onNoteChange(wait = 300) {clearTimeout(timer);timer = null;noteEdited = false;- _sid = sessionId;+ let _sid = sessionId;let params = [title, id, content.data, content.type, sessionId];timer = setTimeout(() => {//console.log('saving note', params[1], _sid, sessionId);if (!params[1]) {- console.log('update id to',id);+ console.log('update id to', id);params[1] = id;}saveNote(...params, _sid !== sessionId);@@ -752,10 +743,7 @@ async function addToCollection(id) {editing.actionAfterFirstSave = {type: null};- Navigation.setRoutesToUpdate([- Navigation.routeNames.Tags,- Navigation.routeNames.NotesPage- ]);+ Navigation.setRoutesToUpdate([Navigation.routeNames.Tags, Navigation.routeNames.NotesPage]);break;}case 'color': {@@ -773,15 +761,8 @@ async function addToCollection(id) {}}-export async function saveNote(- title,- _id,- data,- type,- sessionId,- preventUpdate-) {- console.log("saving note:", disableSaving, isSaving, _id,id);+export async function saveNote(title, _id, data, type, sessionId, preventUpdate) {+ console.log('saving note:', disableSaving, isSaving, _id, id);if (disableSaving || (isSaving && !id)) return;if (preventUpdate) {noteEdited = false;@@ -876,10 +857,7 @@ export async function saveNote(lastEditTime = n + 10;let n = db.notes.note(_id)?.data?.dateEdited;- tiny.call(- EditorWebView,- tiny.updateDateEdited(n ? timeConverter(n) : '')- );+ tiny.call(EditorWebView, tiny.updateDateEdited(n ? timeConverter(n) : ''));tiny.call(EditorWebView, tiny.updateSavingState(!n ? '' : 'Saved'));}} catch (e) {@@ -985,7 +963,6 @@ const loadNoteInEditor = async (keepHistory = true) => {if (note?.id) {eSendEvent('updateTags');post('title', title);- intent = false;if (!content || !content.data || content?.data?.length === 0) {tiny.call(@@ -1011,10 +988,7 @@ const loadNoteInEditor = async (keepHistory = true) => {}setColors();- tiny.call(- EditorWebView,- tiny.updateDateEdited(timeConverter(note.dateEdited))- );+ tiny.call(EditorWebView, tiny.updateDateEdited(timeConverter(note.dateEdited)));tiny.call(EditorWebView, tiny.updateSavingState('Saved'));} else {await restoreEditorState();@@ -1031,31 +1005,31 @@ const loadNoteInEditor = async (keepHistory = true) => {export async function updateNoteInEditor() {return;- let _note = db.notes.note(id).data;- if (_note.conflicted) {- presentResolveConflictDialog(_note);- return;- }- let data = await db.content.raw(_note.contentId);- if (lastEditTime > _note.dateEdited) return;- if (data.data === content.data) return;- if (content.data.indexOf(data.data) !== -1) return;- if (note.dateEdited === _note.dateEdited) return;-- title = note.title;- content.data = data.data;- note = _note;- lastEditTime = _note.dateEdited + 10;- tiny.call(EditorWebView, tiny.isLoading);- await setNote(_note);- tiny.call(EditorWebView, tiny.isLoading);- post('title', title);- post('inject', content.data);- setTimeout(() => {- tiny.call(EditorWebView, tiny.notLoading);- }, 50);- if (id) {- db.attachments.downloadImages(id);- }- tiny.call(EditorWebView, tiny.notLoading);+ // let _note = db.notes.note(id).data;+ // if (_note.conflicted) {+ // presentResolveConflictDialog(_note);+ // return;+ // }+ // let data = await db.content.raw(_note.contentId);+ // if (lastEditTime > _note.dateEdited) return;+ // if (data.data === content.data) return;+ // if (content.data.indexOf(data.data) !== -1) return;+ // if (note.dateEdited === _note.dateEdited) return;++ // title = note.title;+ // content.data = data.data;+ // note = _note;+ // lastEditTime = _note.dateEdited + 10;+ // tiny.call(EditorWebView, tiny.isLoading);+ // await setNote(_note);+ // tiny.call(EditorWebView, tiny.isLoading);+ // post('title', title);+ // post('inject', content.data);+ // setTimeout(() => {+ // tiny.call(EditorWebView, tiny.notLoading);+ // }, 50);+ // if (id) {+ // db.attachments.downloadImages(id);+ // }+ // tiny.call(EditorWebView, tiny.notLoading);}diff --git a/apps/mobile/src/views/Editor/HistoryComponent.js b/apps/mobile/src/views/Editor/HistoryComponent.jsindex a27fff369..b400b39a0 100644--- a/apps/mobile/src/views/Editor/HistoryComponent.js+++ b/apps/mobile/src/views/Editor/HistoryComponent.js@@ -11,7 +11,7 @@ import tiny, { safeKeyboardDismiss } from './tiny/tiny';const HistoryComponent = () => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const [historyState, setHistoryState] = useState({undo: false,redo: false@@ -36,7 +36,8 @@ const HistoryComponent = () => {flexDirection: 'row',height: 40,marginRight: 5- }}>+ }}+ >{Platform.OS === 'ios' && keyboard.keyboardShown ? (<ActionIconname="keyboard-close"diff --git a/apps/mobile/src/views/Editor/ProgressCircle.js b/apps/mobile/src/views/Editor/ProgressCircle.jsindex 5907781b9..d814dab68 100644--- a/apps/mobile/src/views/Editor/ProgressCircle.js+++ b/apps/mobile/src/views/Editor/ProgressCircle.js@@ -1,13 +1,13 @@-import React, {useEffect, useRef, useState} from 'react';-import {View} from 'react-native';+import React, { useEffect, useRef, useState } from 'react';+import { View } from 'react-native';import * as Progress from 'react-native-progress';-import {useTracked} from '../../provider';-import {useAttachmentStore} from '../../provider/stores';-import {SIZE} from '../../utils/SizeUtils';+import { useTracked } from '../../provider';+import { useAttachmentStore } from '../../provider/stores';+import { SIZE } from '../../utils/SizeUtils';export const ProgressCircle = () => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const loading = useAttachmentStore(state => state.loading);const [prog, setProg] = useState(0);const [visible, setVisible] = useState(false);@@ -50,7 +50,8 @@ export const ProgressCircle = () => {style={{justifyContent: 'center',marginLeft: 10- }}>+ }}+ ><Progress.Circlesize={SIZE.xxl}progress={prog}diff --git a/apps/mobile/src/views/Editor/TableCellProperties.js b/apps/mobile/src/views/Editor/TableCellProperties.jsindex 04dbb0e1f..2c7628377 100644--- a/apps/mobile/src/views/Editor/TableCellProperties.js+++ b/apps/mobile/src/views/Editor/TableCellProperties.js@@ -19,9 +19,9 @@ import tiny from './tiny/tiny';import ColorItem from './tiny/toolbar/coloritem';import { editor_colors, rgbToHex } from './tiny/toolbar/constants';-export const TableCellProperties = ({data}) => {+export const TableCellProperties = ({ data }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const [cellOptions, setCellOptions] = useState(data);console.log(data);@@ -101,7 +101,8 @@ export const TableCellProperties = ({data}) => {<Viewstyle={{paddingHorizontal: 12- }}>+ }}+ ><Heading size={SIZE.md}>Column Width</Heading><Viewstyle={{@@ -110,7 +111,8 @@ export const TableCellProperties = ({data}) => {justifyContent: 'space-between',borderRadius: 5,height: 50- }}>+ }}+ ><Paragraph size={SIZE.md + 2} color={colors.icon}>{cellOptions?.width}</Paragraph>@@ -118,7 +120,8 @@ export const TableCellProperties = ({data}) => {<Viewstyle={{flexDirection: 'row'- }}>+ }}+ ><ActionIconcustomStyle={{marginRight: 10@@ -144,7 +147,8 @@ export const TableCellProperties = ({data}) => {style={{marginBottom: 10}}- size={SIZE.md}>+ size={SIZE.md}+ >Cell type</Heading>@@ -152,7 +156,8 @@ export const TableCellProperties = ({data}) => {style={{flexDirection: 'row',marginBottom: 10- }}>+ }}+ ><Buttontype={cellOptions.cellType === 'th' ? 'shade' : 'grayBg'}icon={cellOptions.cellType === 'th' && 'check'}@@ -184,7 +189,8 @@ export const TableCellProperties = ({data}) => {style={{marginBottom: 10}}- size={SIZE.md}>+ size={SIZE.md}+ >Column type</Heading>@@ -192,7 +198,8 @@ export const TableCellProperties = ({data}) => {style={{flexDirection: 'row',marginBottom: 10- }}>+ }}+ ><Buttontype={cellOptions.colType === 'th' ? 'shade' : 'grayBg'}icon={cellOptions.colType === 'th' && 'check'}@@ -219,16 +226,15 @@ export const TableCellProperties = ({data}) => {title="Body"/></View>- <Heading size={SIZE.md}>- Cell background color(${cellOptions.backgroundColor})- </Heading>+ <Heading size={SIZE.md}>Cell background color(${cellOptions.backgroundColor})</Heading><ScrollViewhorizontalshowsHorizontalScrollIndicator={false}style={{flexDirection: 'row',marginTop: 10- }}>+ }}+ >{editor_colors.map(item => (<ColorItemvalue={item}@@ -261,6 +267,6 @@ TableCellProperties.present = async data => {onClose: () => {TableCellProperties.isPresented = false;},- editor:true+ editor: true});};diff --git a/apps/mobile/src/views/Editor/TableRowProperties.js b/apps/mobile/src/views/Editor/TableRowProperties.jsindex 38d099a9c..b48b0d86d 100644--- a/apps/mobile/src/views/Editor/TableRowProperties.js+++ b/apps/mobile/src/views/Editor/TableRowProperties.js@@ -17,9 +17,9 @@ import tiny from './tiny/tiny';import ColorItem from './tiny/toolbar/coloritem';import { editor_colors, rgbToHex } from './tiny/toolbar/constants';-export const TableRowProperties = ({data}) => {+export const TableRowProperties = ({ data }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const [rowOptions, setRowOptions] = useState(data);console.log(data);@@ -50,14 +50,16 @@ export const TableRowProperties = ({data}) => {<Viewstyle={{paddingHorizontal: 12- }}>+ }}+ ><Heading size={SIZE.md}>Row type</Heading><Viewstyle={{flexDirection: 'row',marginVertical: 10- }}>+ }}+ ><Buttontype={rowOptions.rowType === 'header' ? 'shade' : 'grayBg'}icon={rowOptions.rowType === 'header' && 'check'}@@ -105,7 +107,8 @@ export const TableRowProperties = ({data}) => {style={{flexDirection: 'row',marginTop: 10- }}>+ }}+ >{editor_colors.map(item => (<ColorItemvalue={item}@@ -133,7 +136,8 @@ export const TableRowProperties = ({data}) => {style={{marginTop: 10}}- size={SIZE.md}>+ size={SIZE.md}+ >Column background color</Heading><ScrollView@@ -142,7 +146,8 @@ export const TableRowProperties = ({data}) => {style={{flexDirection: 'row',marginTop: 10- }}>+ }}+ >{editor_colors.map(item => (<ColorItemvalue={item}diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.jsindex 3a15bb231..ee77ea19d 100755--- a/apps/mobile/src/views/Editor/index.js+++ b/apps/mobile/src/views/Editor/index.js@@ -1,18 +1,14 @@-import React, {useEffect, useState} from 'react';-import {Platform, View} from 'react-native';+import React, { useEffect, useState } from 'react';+import { Platform, View } from 'react-native';import WebView from 'react-native-webview';-import {notesnook} from '../../../e2e/test.ids';-import {useEditorStore, useUserStore} from '../../provider/stores';+import { notesnook } from '../../../e2e/test.ids';+import { useEditorStore, useUserStore } from '../../provider/stores';import { DDS } from '../../services/DeviceDetection';-import {- eSendEvent,- eSubscribeEvent,- eUnSubscribeEvent-} from '../../services/EventManager';-import {getCurrentColors} from '../../utils/Colors';-import {eOnLoadNote} from '../../utils/Events';-import {tabBarRef} from '../../utils/Refs';-import {sleep} from '../../utils/TimeUtils';+import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';+import { getCurrentColors } from '../../utils/Colors';+import { eOnLoadNote } from '../../utils/Events';+import { tabBarRef } from '../../utils/Refs';+import { sleep } from '../../utils/TimeUtils';import EditorHeader from './EditorHeader';import {disableEditing,@@ -26,7 +22,7 @@ import {import tiny from './tiny/tiny';import EditorToolbar from './tiny/toolbar';-const source = {uri: sourceUri + 'index.html'};+const source = { uri: sourceUri + 'index.html' };const style = {height: '100%',@@ -67,7 +63,7 @@ const Editor = React.memo(}if (getNote()) {- eSendEvent(eOnLoadNote, {...getNote(), forced: true});+ eSendEvent(eOnLoadNote, { ...getNote(), forced: true });}console.log('resetting editor');};@@ -87,7 +83,8 @@ const Editor = React.memo(backgroundColor: 'transparent',flexGrow: 1,flex: 1- }}>+ }}+ ><EditorHeader /><WebViewtestID={notesnook.editor.id}diff --git a/apps/mobile/src/views/Editor/tiny/tiny.js b/apps/mobile/src/views/Editor/tiny/tiny.jsindex f754dab38..fdaa21449 100644--- a/apps/mobile/src/views/Editor/tiny/tiny.js+++ b/apps/mobile/src/views/Editor/tiny/tiny.js@@ -1,8 +1,8 @@-import {Platform} from 'react-native';-import {editing} from '../../../utils';-import {EditorWebView, getWebviewInit, post, textInput} from '../Functions';+import { Platform } from 'react-native';+import { editing } from '../../../utils';+import { EditorWebView, getWebviewInit, post, textInput } from '../Functions';-const reset =(id) => `+const reset = id => `sessionId = null;document.getElementById("titleInput").value = '';document.getElementById("titleInput").placeholder = "Note title";@@ -184,16 +184,14 @@ function call(webview, func, noqueue) {}export function safeKeyboardDismiss() {- console.log('keyboard state', editing.keyboardState)+ console.log('keyboard state', editing.keyboardState);if (!editing.keyboardState) return;- if (Platform.OS === "android") {-+ if (Platform.OS === 'android') {textInput.current?.focus();textInput.current?.blur();} else {- call(EditorWebView,blur);+ call(EditorWebView, blur);}-}const undo = `diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/colorgroup.js b/apps/mobile/src/views/Editor/tiny/toolbar/colorgroup.jsindex 7dc190be4..d0454e59f 100644--- a/apps/mobile/src/views/Editor/tiny/toolbar/colorgroup.js+++ b/apps/mobile/src/views/Editor/tiny/toolbar/colorgroup.js@@ -2,33 +2,27 @@ import React from 'react';import { ScrollView } from 'react-native';import ColorItem from './coloritem';-const ColorGroup = ({group}) => {+const ColorGroup = ({ group }) => {+ return (+ <ScrollView+ keyboardDismissMode="none"+ keyboardShouldPersistTaps="always"+ style={{+ flexDirection: 'row',+ width: '100%'+ }}+ showsHorizontalScrollIndicator={false}+ bounces={false}+ horizontal={true}+ contentContainerStyle={{+ alignItems: 'center'+ }}+ >+ {group.data.map(item => (+ <ColorItem key={item.formatValue} value={item.formatValue} format={group.type} />+ ))}+ </ScrollView>+ );+};- return (- <ScrollView- keyboardDismissMode="none"- keyboardShouldPersistTaps="always"- style={{- flexDirection: 'row',- width: '100%',- }}- showsHorizontalScrollIndicator={false}- bounces={false}- horizontal={true}- contentContainerStyle={{- alignItems: 'center',- }}>- {group.data.map((item) => (- <ColorItem- key={item.formatValue}- value={item.formatValue}- format={group.type}- />- ))}- </ScrollView>- );- };--- export default ColorGroup;-\ No newline at end of file+export default ColorGroup;diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/coloritem.js b/apps/mobile/src/views/Editor/tiny/toolbar/coloritem.jsindex 1d7c1e811..b29bd1251 100644--- a/apps/mobile/src/views/Editor/tiny/toolbar/coloritem.js+++ b/apps/mobile/src/views/Editor/tiny/toolbar/coloritem.js@@ -1,20 +1,16 @@-import React, {useEffect, useState} from 'react';-import {View, TouchableOpacity} from 'react-native';+import React, { useEffect, useState } from 'react';+import { View, TouchableOpacity } from 'react-native';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {useTracked} from '../../../../provider';-import {- eSendEvent,- eSubscribeEvent,- eUnSubscribeEvent-} from '../../../../services/EventManager';-import {normalize, SIZE} from '../../../../utils/SizeUtils';-import {formatSelection, properties, rgbToHex} from './constants';-import {execCommands} from './commands';-import {MMKV} from '../../../../utils/mmkv';+import { useTracked } from '../../../../provider';+import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../../../../services/EventManager';+import { normalize, SIZE } from '../../../../utils/SizeUtils';+import { formatSelection, properties, rgbToHex } from './constants';+import { execCommands } from './commands';+import { MMKV } from '../../../../utils/mmkv';-const ColorItem = ({value, format, onCustomPress, checked}) => {+const ColorItem = ({ value, format, onCustomPress, checked }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const [selected, setSelected] = useState(false);const isChecked = value !== '' && (selected || checked);const isNil = value === '';@@ -82,17 +78,19 @@ const ColorItem = ({value, format, onCustomPress, checked}) => {height: normalize(40),width: normalize(40),marginRight: 5,- overflow:'hidden'- }}>+ overflow: 'hidden'+ }}+ ><Viewstyle={{- height: "100%",- width:"100%",+ height: '100%',+ width: '100%',borderRadius: 5,justifyContent: 'center',alignItems: 'center',backgroundColor: isChecked ? 'rgba(0,0,0,0.1)' : 'transparent'- }}>+ }}+ >{isNil ? <Icon color="red" size={SIZE.lg} name="close" /> : null}{isChecked ? <Icon name="check" size={SIZE.lg} color="white" /> : null}diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/commands.js b/apps/mobile/src/views/Editor/tiny/toolbar/commands.jsindex c7b4ca6d2..9c5d67567 100644--- a/apps/mobile/src/views/Editor/tiny/toolbar/commands.js+++ b/apps/mobile/src/views/Editor/tiny/toolbar/commands.js@@ -2,18 +2,14 @@ import { Platform } from 'react-native';import { useEditorStore } from '../../../../provider/stores';import { EditorWebView, textInput } from '../../Functions';import tiny from '../tiny';-import picker from './picker';export const endSearch = () => {- tiny.call(- EditorWebView,- `tinymce.activeEditor.plugins.searchreplace.done()`- );+ tiny.call(EditorWebView, `tinymce.activeEditor.plugins.searchreplace.done()`);textInput.current?.focus();useEditorStore.getState().setSearchReplace(false);Platform.OS === 'android' && EditorWebView.current?.requestFocus();tiny.call(EditorWebView, tiny.focusEditor);-}+};export const execCommands = {bold: `tinymce.activeEditor.execCommand('Bold');`,@@ -26,26 +22,19 @@ export const execCommands = {underline: `tinymce.activeEditor.execCommand('Underline');`,superscript: `tinymce.activeEditor.execCommand('Superscript');`,subscript: `tinymce.activeEditor.execCommand('Subscript');`,- forecolor: color =>- `tinymce.activeEditor.execCommand('ForeColor',false, '${color}');`,- hilitecolor: color =>- `tinymce.activeEditor.execCommand('HiliteColor',false, '${color}');`,- dforecolor: color =>- `tinymce.activeEditor.execCommand('ForeColor',false, '${color}');`,- dhilitecolor: color =>- `tinymce.activeEditor.execCommand('HiliteColor',false, '${color}');`,+ forecolor: color => `tinymce.activeEditor.execCommand('ForeColor',false, '${color}');`,+ hilitecolor: color => `tinymce.activeEditor.execCommand('HiliteColor',false, '${color}');`,+ dforecolor: color => `tinymce.activeEditor.execCommand('ForeColor',false, '${color}');`,+ dhilitecolor: color => `tinymce.activeEditor.execCommand('HiliteColor',false, '${color}');`,- fontname: fontname =>- `tinymce.activeEditor.execCommand('FontName',false, '${fontname}');`,+ fontname: fontname => `tinymce.activeEditor.execCommand('FontName',false, '${fontname}');`,indent: `tinymce.activeEditor.execCommand('Indent');`,outdent: `tinymce.activeEditor.execCommand('Outdent');`,blockquote: `tinymce.activeEditor.execCommand('mceBlockQuote');`,- link: link =>- `tinymce.activeEditor.execCommand('mceInsertLink',false, '${link}');`,+ link: link => `tinymce.activeEditor.execCommand('mceInsertLink',false, '${link}');`,unlink: `tinymce.activeEditor.execCommand('Unlink')`,- fontsize: size =>- `tinymce.activeEditor.execCommand('FontSize', false, '${size}');`,+ fontsize: size => `tinymce.activeEditor.execCommand('FontSize', false, '${size}');`,removeformat: `tinymce.activeEditor.execCommand('RemoveFormat');`,p: `tinymce.activeEditor.execCommand('FormatBlock', false, 'p');`,h2: `tinymce.activeEditor.execCommand('FormatBlock', false, 'h2');`,@@ -53,7 +42,6 @@ export const execCommands = {h4: `tinymce.activeEditor.execCommand('FormatBlock', false, 'h4');`,h5: `tinymce.activeEditor.execCommand('FormatBlock', false, 'h5');`,h6: `tinymce.activeEditor.execCommand('FormatBlock', false, 'h6');`,- pre: `tinymce.activeEditor.execCommand('FormatBlock', false, 'pre');`,ol: style =>`tinymce.activeEditor.execCommand('InsertOrderedList', false, {'list-style-type': "${style}"});`,ul: style =>@@ -89,14 +77,14 @@ export const execCommands = {pre: `tinymce.activeEditor.execCommand('mceInsertCodeBlock')`,- tablecellprops:`tableCellNodeOptions()`,+ tablecellprops: `tableCellNodeOptions()`,tableprops: "tinymce.activeEditor.execCommand('mceTableProps');",tabledelete: "tinymce.activeEditor.execCommand('mceTableDelete');",tablesplitcell: "tinymce.activeEditor.execCommand('mceTableSplitCells');",tablemergecell: "tinymce.activeEditor.execCommand('mceTableMergeCells');",tablerowprops: `tableRowNodeOptions()`,- tableinsertrowbefore:`tinymce.activeEditor.execCommand('mceTableInsertRowBefore');`,- tableinsertcolbefore:`tinymce.activeEditor.execCommand('mceTableInsertColBefore');`,+ tableinsertrowbefore: `tinymce.activeEditor.execCommand('mceTableInsertRowBefore');`,+ tableinsertcolbefore: `tinymce.activeEditor.execCommand('mceTableInsertColBefore');`,imageResize25: () => setImageSize(0.25),imageResize50: () => setImageSize(0.5),imageResize100: () => setImageSize(1),diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/constants.js b/apps/mobile/src/views/Editor/tiny/toolbar/constants.jsindex 804f07dcc..e8242882e 100644--- a/apps/mobile/src/views/Editor/tiny/toolbar/constants.js+++ b/apps/mobile/src/views/Editor/tiny/toolbar/constants.js@@ -1,9 +1,9 @@-import {createRef} from 'react';-import {Platform} from 'react-native';-import {eSendEvent} from '../../../../services/EventManager';-import {editing} from '../../../../utils';-import {sleep} from '../../../../utils/TimeUtils';-import {EditorWebView, textInput} from '../../Functions';+import { createRef } from 'react';+import { Platform } from 'react-native';+import { eSendEvent } from '../../../../services/EventManager';+import { editing } from '../../../../utils';+import { sleep } from '../../../../utils/TimeUtils';+import { EditorWebView, textInput } from '../../Functions';import tiny from '../tiny';export const properties = {@@ -54,7 +54,8 @@ function trim(str) {}export function rgbToHex(color) {- if (color.startsWith("#")) return color;+ if (color.startsWith('#')) return color;+ let r, g, b, a;if (!color.startsWith('rgba')) {color = '' + color;if (!color || color.indexOf('rgb') < 0) {@@ -65,10 +66,10 @@ export function rgbToHex(color) {return color;}- var nums = /(.*?)rgb\((\d+),\s*(\d+),\s*(\d+)\)/i.exec(color),- r = parseInt(nums[2], 10).toString(16),- g = parseInt(nums[3], 10).toString(16),- b = parseInt(nums[4], 10).toString(16);+ var nums = /(.*?)rgb\((\d+),\s*(\d+),\s*(\d+)\)/i.exec(color);+ r = parseInt(nums[2], 10).toString(16);+ g = parseInt(nums[3], 10).toString(16);+ b = parseInt(nums[4], 10).toString(16);return ('#' +@@ -78,13 +79,11 @@ export function rgbToHex(color) {);} else {let rgba = color;- var inParts = rgba.substring(rgba.indexOf('(')).split(','),- r = parseInt(trim(inParts[0].substring(1)), 10),- g = parseInt(trim(inParts[1]), 10),- b = parseInt(trim(inParts[2]), 10),- a = parseFloat(- trim(inParts[3].substring(0, inParts[3].length - 1))- ).toFixed(2);+ var inParts = rgba.substring(rgba.indexOf('(')).split(',');+ r = parseInt(trim(inParts[0].substring(1)), 10);+ g = parseInt(trim(inParts[1]), 10);+ b = parseInt(trim(inParts[2]), 10);+ a = parseFloat(trim(inParts[3].substring(0, inParts[3].length - 1))).toFixed(2);var outParts = [r.toString(16),g.toString(16),@@ -112,16 +111,16 @@ export const INPUT_MODE = {export const font_names = Platform.select({android: [- {name: 'Sans', value: 'open sans'},- {name: 'Serif', value: 'times new roman'},- {name: 'Mono', value: 'courier'},- {name: 'Classic', value: 'courier new'}+ { name: 'Sans', value: 'open sans' },+ { name: 'Serif', value: 'times new roman' },+ { name: 'Mono', value: 'courier' },+ { name: 'Classic', value: 'courier new' }],ios: [- {name: 'Sans Serif', value: 'open sans'},- {name: 'Serif', value: 'times new roman'},- {name: 'Mono', value: 'courier'},- {name: 'Classic', value: 'courier new'}+ { name: 'Sans Serif', value: 'open sans' },+ { name: 'Serif', value: 'times new roman' },+ { name: 'Mono', value: 'courier' },+ { name: 'Classic', value: 'courier new' }]});@@ -164,15 +163,7 @@ export const editor_colors = ['#3d1466'];-export const editor_font_size = [- '8pt',- '10pt',- '12pt',- '14pt',- '18pt',- '24pt',- '36pt'-];+export const editor_font_size = ['8pt', '10pt', '12pt', '14pt', '18pt', '24pt', '36pt'];export const unorderedListStyles = ['default', 'circle', 'square'];diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/group.js b/apps/mobile/src/views/Editor/tiny/toolbar/group.jsindex bd1594372..77a9d468a 100644--- a/apps/mobile/src/views/Editor/tiny/toolbar/group.js+++ b/apps/mobile/src/views/Editor/tiny/toolbar/group.js@@ -1,11 +1,11 @@import React from 'react';-import {View} from 'react-native';-import {useTracked} from '../../../../provider';+import { View } from 'react-native';+import { useTracked } from '../../../../provider';import ToolbarItem from './item';-const ToolbarGroup = ({group}) => {+const ToolbarGroup = ({ group }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;return (<View@@ -15,7 +15,8 @@ const ToolbarGroup = ({group}) => {alignItems: 'center',marginHorizontal: 3,overflow: 'hidden'- }}>+ }}+ >{group.map(item => (<ToolbarItemkey={item.format}diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/index.js b/apps/mobile/src/views/Editor/tiny/toolbar/index.jsindex c23670bce..65a9ca0c4 100644--- a/apps/mobile/src/views/Editor/tiny/toolbar/index.js+++ b/apps/mobile/src/views/Editor/tiny/toolbar/index.js@@ -10,11 +10,10 @@ import ToolbarGroup from './group';import SearcReplace from './searchreplace';import Tooltip from './tooltip';-const EditorToolbar = React.memo(() => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const config = TOOLBAR_CONFIG;const searchReplace = useEditorStore(state => state.searchReplace);@@ -32,7 +31,8 @@ const EditorToolbar = React.memo(width: '100%',minHeight: normalize(50),position: 'relative'- }}>+ }}+ >{searchReplace ? (<SearcReplace />) : (@@ -56,7 +56,8 @@ const EditorToolbar = React.memo(horizontal={true}showsHorizontalScrollIndicator={false}showsVerticalScrollIndicator={false}- bounces={false}>+ bounces={false}+ ><HistoryComponent />{config.map((item, index) =>typeof item !== 'string' ? (diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/item.js b/apps/mobile/src/views/Editor/tiny/toolbar/item.jsindex 018cc007c..9b5254b1f 100644--- a/apps/mobile/src/views/Editor/tiny/toolbar/item.js+++ b/apps/mobile/src/views/Editor/tiny/toolbar/item.js@@ -7,8 +7,11 @@ import Paragraph from '../../../../components/Typography/Paragraph';import { useTracked } from '../../../../provider';import { useUserStore } from '../../../../provider/stores';import {- eSendEvent, eSubscribeEvent,- eUnSubscribeEvent, presentSheet, ToastEvent+ eSendEvent,+ eSubscribeEvent,+ eUnSubscribeEvent,+ presentSheet,+ ToastEvent} from '../../../../services/EventManager';import PremiumService from '../../../../services/PremiumService';import { editing, showTooltip, TOOLTIP_POSITIONS } from '../../../../utils';@@ -19,8 +22,12 @@ import umami from '../../../../utils/umami';import tiny, { safeKeyboardDismiss } from '../tiny';import { execCommands } from './commands';import {- focusEditor, font_names, formatSelection,- properties, rgbToHex, TOOLBAR_ICONS+ focusEditor,+ font_names,+ formatSelection,+ properties,+ rgbToHex,+ TOOLBAR_ICONS} from './constants';import ToolbarItemPin from './itempin';import ToolbarListFormat from './listformat';@@ -42,7 +49,7 @@ const ToolbarItem = ({fullname}) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const [selected, setSelected] = useState(false);const [icon, setIcon] = useState(valueIcon);const [color, setColor] = useState(null);@@ -75,8 +82,7 @@ const ToolbarItem = ({const onColorChange = async () => {if (/^(dhilitecolor|dforecolor)$/.test(format)) {let _color = await MMKV.getItem(format);- let defColor =- format === 'dhilitecolor' ? colors.accent + '60' : colors.accent;+ let defColor = format === 'dhilitecolor' ? colors.accent + '60' : colors.accent;setColor(_color || defColor);}};@@ -136,10 +142,7 @@ const ToolbarItem = ({}if (- (format === 'fontsize' ||- format === 'ul' ||- format === 'ol' ||- format === 'fontname') &&+ (format === 'fontsize' || format === 'ul' || format === 'ol' || format === 'fontname') &&data[format] !== '' &&formatValue === data[format]) {@@ -174,12 +177,7 @@ const ToolbarItem = ({setSelected(false);return;}- if (- format === 'fontsize' ||- format === 'fontname' ||- format === 'ol' ||- format === 'ul'- ) {+ if (format === 'fontsize' || format === 'fontname' || format === 'ol' || format === 'ul') {setSelected(false);return;}@@ -203,8 +201,6 @@ const ToolbarItem = ({checkForChanges(data);};--const onPress = async event => {if (premium && !isPro) {let user = await db.user.getUser();@@ -215,7 +211,7 @@ const ToolbarItem = ({if (user && !isPro && !user.isEmailConfirmed) {PremiumService.showVerifyEmailDialog();} else {- umami.pageView("/pro-sheet","/editor/editor-toolbar")+ umami.pageView('/pro-sheet', '/editor/editor-toolbar');PremiumService.sheet();}return;@@ -223,8 +219,8 @@ const ToolbarItem = ({if (format === 'table') {presentSheet({- component:<Table/>- })+ component: <Table />+ });}if (type === 'settings') {@@ -257,7 +253,7 @@ const ToolbarItem = ({}if (format === 'link' || format === 'video') {- pauseSelectionChange = true;+ properties.pauseSelectionChange = true;formatSelection(`current_selection_range = editor.selection.getRng();`);}@@ -334,7 +330,8 @@ const ToolbarItem = ({style={{marginHorizontal: 5,marginRight: isdefaultColorFormat ? 0 : 5- }}>+ }}+ ><PressableButtontype={selected ? 'grayBg' : 'transparent'}onLongPress={event => {@@ -349,7 +346,8 @@ const ToolbarItem = ({minWidth: isdefaultColorFormat ? 25 : normalize(40),width: isdefaultColorFormat ? 25 : null,overflow: 'hidden'- }}>+ }}+ >{premium && !isPro && (<Iconsize={7}@@ -374,14 +372,10 @@ const ToolbarItem = ({/>) : (<>- {type === 'tooltip' && (- <ToolbarItemPin format={format} color={selected && color} />- )}+ {type === 'tooltip' && <ToolbarItemPin format={format} color={selected && color} />}{/^(h1|h2|h3|h4|h5|h6|p)$/.test(format) ? (- <Heading- size={SIZE.md}- color={selected ? colors.accent : colors.pri}>+ <Heading size={SIZE.md} color={selected ? colors.accent : colors.pri}>{format.slice(0, 1).toUpperCase() + format.slice(1)}</Heading>) : /^(ol|ul|cl)$/.test(format) ? (@@ -391,9 +385,7 @@ const ToolbarItem = ({formatValue={formatValue || icon || 'default'}/>) : format === 'fontsize' ? (- <Paragraph- size={13}- color={selected ? colors.accent : colors.pri}>+ <Paragraph size={13} color={selected ? colors.accent : colors.pri}>{formatValue || currentText || '12pt'}</Paragraph>) : text && groupFormat !== 'header' ? (@@ -408,7 +400,8 @@ const ToolbarItem = ({: formatValue: 'OpenSans-Regular'}}- size={13}>+ size={13}+ >{currentText || text}</Paragraph>) : (diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/itempin.js b/apps/mobile/src/views/Editor/tiny/toolbar/itempin.jsindex 48f43e3c6..bb8cd4e8f 100644--- a/apps/mobile/src/views/Editor/tiny/toolbar/itempin.js+++ b/apps/mobile/src/views/Editor/tiny/toolbar/itempin.js@@ -1,15 +1,12 @@import React, { useEffect, useState } from 'react';import Animated, { Easing, timing, useValue } from 'react-native-reanimated';import { useTracked } from '../../../../provider';-import {- eSubscribeEvent,- eUnSubscribeEvent-} from '../../../../services/EventManager';+import { eSubscribeEvent, eUnSubscribeEvent } from '../../../../services/EventManager';import { sleep } from '../../../../utils/TimeUtils';-const ToolbarItemPin = ({format, color}) => {+const ToolbarItemPin = ({ format, color }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const [visible, setVisible] = useState(false);let scale = useValue(0);useEffect(() => {@@ -26,7 +23,7 @@ const ToolbarItemPin = ({format, color}) => {timing(scale, {toValue: val,duration: time,- easing: Easing.in(Easing.ease),+ easing: Easing.in(Easing.ease)}).start();await sleep(time);animating = false;@@ -55,9 +52,9 @@ const ToolbarItemPin = ({format, color}) => {top: 0,transform: [{- scale: scale,- },- ],+ scale: scale+ }+ ]}}/>)diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/linkinput.js b/apps/mobile/src/views/Editor/tiny/toolbar/linkinput.jsindex 592c577aa..0af90aa34 100644--- a/apps/mobile/src/views/Editor/tiny/toolbar/linkinput.js+++ b/apps/mobile/src/views/Editor/tiny/toolbar/linkinput.js@@ -1,33 +1,26 @@import React, { useEffect, useRef, useState } from 'react';import { View } from 'react-native';import isEmail from 'validator/lib/isEmail';-import isMobilePhone from "validator/lib/isMobilePhone";+import isMobilePhone from 'validator/lib/isMobilePhone';import isURL from 'validator/lib/isURL';import { Button } from '../../../../components/Button';import Input from '../../../../components/Input';import { useTracked } from '../../../../provider';import { eSendEvent, ToastEvent } from '../../../../services/EventManager';-import { editing } from '../../../../utils';+import { editing, itemSkus } from '../../../../utils';import { SIZE } from '../../../../utils/SizeUtils';import { EditorWebView } from '../../Functions';import tiny from '../tiny';import { execCommands } from './commands';-import {- focusEditor,- formatSelection,- INPUT_MODE,- properties-} from './constants';+import { focusEditor, formatSelection, INPUT_MODE, properties } from './constants';import LinkPreview from './linkpreview';let inputValue = null;-const ToolbarLinkInput = ({format, value, setVisible}) => {+const ToolbarLinkInput = ({ format, value, setVisible }) => {const [state] = useTracked();- const {colors} = state;- const [mode, setMode] = useState(- value ? INPUT_MODE.NO_EDIT : INPUT_MODE.EDITING- );+ const { colors } = state;+ const [mode, setMode] = useState(value ? INPUT_MODE.NO_EDIT : INPUT_MODE.EDITING);const inputRef = useRef();@@ -66,7 +59,7 @@ const ToolbarLinkInput = ({format, value, setVisible}) => {return () => {tiny.call(EditorWebView, tiny.restoreRange);tiny.call(EditorWebView, tiny.clearRange);- }+ };}, [mode]);const onChangeText = value => {@@ -82,7 +75,6 @@ const ToolbarLinkInput = ({format, value, setVisible}) => {formatSelection(execCommands.unlink);setVisible(false);} else {-if (!isURL(inputValue) && !isEmail(inputValue) && !isMobilePhone(inputValue)) {ToastEvent.show({heading: 'Invalid url',@@ -100,7 +92,7 @@ const ToolbarLinkInput = ({format, value, setVisible}) => {editing.tooltip = null;setMode(INPUT_MODE.NO_EDIT);-+focusEditor(format, false);properties.userBlur = false;};@@ -118,7 +110,8 @@ const ToolbarLinkInput = ({format, value, setVisible}) => {style={{paddingHorizontal: 6,width: '100%'- }}>+ }}+ >{mode === INPUT_MODE.NO_EDIT ? (<LinkPreview value={value} setMode={setMode} onSubmit={onSubmit} />) : (@@ -141,6 +134,7 @@ const ToolbarLinkInput = ({format, value, setVisible}) => {}].map(button => (<Button+ key={button.text}title={button.text}fontSize={SIZE.xs + 1}height={28}diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/linkpreview.js b/apps/mobile/src/views/Editor/tiny/toolbar/linkpreview.jsindex 570f7f598..fd7941d2c 100644--- a/apps/mobile/src/views/Editor/tiny/toolbar/linkpreview.js+++ b/apps/mobile/src/views/Editor/tiny/toolbar/linkpreview.js@@ -1,23 +1,23 @@-import React, {useEffect, useState} from 'react';-import {Image, Linking, ScrollView, TouchableOpacity, View} from 'react-native';+import React, { useEffect, useState } from 'react';+import { Image, Linking, ScrollView, TouchableOpacity, View } from 'react-native';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {ActionIcon} from '../../../../components/ActionIcon';+import { ActionIcon } from '../../../../components/ActionIcon';import Heading from '../../../../components/Typography/Heading';import Paragraph from '../../../../components/Typography/Paragraph';-import {useTracked} from '../../../../provider';-import {openLinkInBrowser} from '../../../../utils/functions';-import {SIZE} from '../../../../utils/SizeUtils';-import {INPUT_MODE, properties, reFocusEditor} from './constants';+import { useTracked } from '../../../../provider';+import { openLinkInBrowser } from '../../../../utils/functions';+import { SIZE } from '../../../../utils/SizeUtils';+import { INPUT_MODE, properties, reFocusEditor } from './constants';import isEmail from 'validator/lib/isEmail';import isURL from 'validator/lib/isURL';import isMobilePhone from 'validator/lib/isMobilePhone';-import {ToastEvent} from '../../../../services/EventManager';-import {getLinkPreview} from '../../../../utils/linkpreview';+import { ToastEvent } from '../../../../services/EventManager';+import { getLinkPreview } from '../../../../utils/linkpreview';let prevLink = {};-const LinkPreview = ({setMode, value, onSubmit}) => {+const LinkPreview = ({ setMode, value, onSubmit }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const [link, setLink] = useState(prevLink.value === value ? prevLink : {});useEffect(() => {@@ -54,7 +54,7 @@ const LinkPreview = ({setMode, value, onSubmit}) => {marginRight: 5}}resizeMode="contain"- source={{uri: image}}+ source={{ uri: image }}/>) : (<View@@ -66,18 +66,15 @@ const LinkPreview = ({setMode, value, onSubmit}) => {alignItems: 'center',backgroundColor: colors.nav,borderRadius: 5- }}>+ }}+ ><Icon size={35} color={colors.accent} name="web" /></View>);};const openLink = () => {- if (- value.startsWith('mailto:') ||- value.startsWith('tel:') ||- value.startsWith('sms:')- ) {+ if (value.startsWith('mailto:') || value.startsWith('tel:') || value.startsWith('sms:')) {Linking.openURL(value).catch(console.log);return;}@@ -113,25 +110,28 @@ const LinkPreview = ({setMode, value, onSubmit}) => {<Viewstyle={{flex: 1- }}>+ }}+ ><TouchableOpacity onPress={openLink} activeOpacity={1}><ScrollViewstyle={{marginRight: 10}}horizontal- showsHorizontalScrollIndicator={false}>- <Heading numberOfLines={1} style={{paddingLeft: 5}} size={SIZE.sm}>+ showsHorizontalScrollIndicator={false}+ >+ <Heading numberOfLines={1} style={{ paddingLeft: 5 }} size={SIZE.sm}>{name ? name + ': ' + title : title ? title : 'Web Link'}</Heading></ScrollView><ScrollView horizontal showsHorizontalScrollIndicator={false}><Paragraph- style={{flexWrap: 'wrap', paddingLeft: 5}}+ style={{ flexWrap: 'wrap', paddingLeft: 5 }}numberOfLines={1}color={colors.icon}- size={SIZE.xs}>+ size={SIZE.xs}+ >{description ? description : link?.value ? link.value : value}</Paragraph></ScrollView>@@ -146,7 +146,8 @@ const LinkPreview = ({setMode, value, onSubmit}) => {flexDirection: 'row',width: '100%',alignItems: 'center'- }}>+ }}+ >{renderImage(link.image)}{renderText(link.name, link.title, link.description)}@@ -154,7 +155,8 @@ const LinkPreview = ({setMode, value, onSubmit}) => {style={{flexDirection: 'row',alignItems: 'center'- }}>+ }}+ ><ActionIcononPress={() => {onSubmit('clear');diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/listformat.js b/apps/mobile/src/views/Editor/tiny/toolbar/listformat.jsindex 4310717e4..1d9c35d6c 100644--- a/apps/mobile/src/views/Editor/tiny/toolbar/listformat.js+++ b/apps/mobile/src/views/Editor/tiny/toolbar/listformat.js@@ -1,13 +1,13 @@import React from 'react';-import {View} from 'react-native';+import { View } from 'react-native';import Heading from '../../../../components/Typography/Heading';-import {useTracked} from '../../../../provider';+import { useTracked } from '../../../../provider';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';import Paragraph from '../../../../components/Typography/Paragraph';-const ToolbarListFormat = ({selected, formatValue, format}) => {+const ToolbarListFormat = ({ selected, formatValue, format }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const ordered_lists = {default: ['1.', '2.', '3.'],'lower-alpha': ['a.', 'b.', 'c.'],@@ -29,7 +29,8 @@ const ToolbarListFormat = ({selected, formatValue, format}) => {alignItems: 'center',marginBottom: format === 'ol' ? 0 : 1,marginTop: format === 'ol' || format === 'cl' ? 0 : 1- }}>+ }}+ >{format === 'ol' ? (<Headingstyle={{@@ -37,7 +38,8 @@ const ToolbarListFormat = ({selected, formatValue, format}) => {height: 7}}color={selected && colors.accent}- size={6}>+ size={6}+ >{item}</Heading>) : format === 'cl' ? (@@ -55,11 +57,7 @@ const ToolbarListFormat = ({selected, formatValue, format}) => {style={{borderRadius: formatValue === 'square' ? 0 : 100,backgroundColor:- formatValue !== 'circle'- ? selected- ? colors.accent- : colors.pri- : null,+ formatValue !== 'circle' ? (selected ? colors.accent : colors.pri) : null,borderWidth: formatValue === 'circle' ? 0.5 : 0,width: 4,height: 4,diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/picker.js b/apps/mobile/src/views/Editor/tiny/toolbar/picker.jsindex 0dcaaceff..47a440185 100644--- a/apps/mobile/src/views/Editor/tiny/toolbar/picker.js+++ b/apps/mobile/src/views/Editor/tiny/toolbar/picker.js@@ -5,17 +5,11 @@ import { launchCamera, launchImageLibrary } from 'react-native-image-picker';import Sodium from 'react-native-sodium';import RNFetchBlob from 'rn-fetch-blob';import { Attachment } from '../../../../components/AttachmentDialog';-import {- eSendEvent,- presentSheet,- ToastEvent-} from '../../../../services/EventManager';+import { eSendEvent, presentSheet, ToastEvent } from '../../../../services/EventManager';import PremiumService from '../../../../services/PremiumService';import { editing } from '../../../../utils';import { db } from '../../../../utils/database';-import {- eCloseProgressDialog-} from '../../../../utils/Events';+import { eCloseProgressDialog } from '../../../../utils/Events';import { sleep } from '../../../../utils/TimeUtils';import { EditorWebView, getNote } from '../../Functions';import tiny, { safeKeyboardDismiss } from '../tiny';@@ -32,7 +26,8 @@ const showEncryptionSheet = file => {<Viewstyle={{paddingHorizontal: 12- }}>+ }}+ ><Attachmentattachment={{metadata: {@@ -315,7 +310,7 @@ async function attachFile(uri, hash, type, filename) {encryptionInfo.size = encryptionInfo.length;encryptionInfo.key = key;} else {- encryptionInfo = {hash: hash};+ encryptionInfo = { hash: hash };}await db.attachments.add(encryptionInfo, getNote()?.id);if (Platform.OS === 'ios') await RNFetchBlob.fs.unlink(uri);diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/searchreplace.js b/apps/mobile/src/views/Editor/tiny/toolbar/searchreplace.jsindex 9e2c8445a..35b57a15b 100644--- a/apps/mobile/src/views/Editor/tiny/toolbar/searchreplace.js+++ b/apps/mobile/src/views/Editor/tiny/toolbar/searchreplace.js@@ -1,25 +1,22 @@-import React, {useEffect, useRef, useState} from 'react';-import {View} from 'react-native';-import {Button} from '../../../../components/Button';+import React, { useEffect, useRef, useState } from 'react';+import { View } from 'react-native';+import { Button } from '../../../../components/Button';import Input from '../../../../components/Input';-import {useTracked} from '../../../../provider';-import {useEditorStore, useSettingStore} from '../../../../provider/stores';-import {- eSubscribeEvent,- eUnSubscribeEvent-} from '../../../../services/EventManager';-import {showTooltip, TOOLTIP_POSITIONS} from '../../../../utils';+import { useTracked } from '../../../../provider';+import { useEditorStore, useSettingStore } from '../../../../provider/stores';+import { eSubscribeEvent, eUnSubscribeEvent } from '../../../../services/EventManager';+import { showTooltip, TOOLTIP_POSITIONS } from '../../../../utils';import layoutmanager from '../../../../utils/layout-manager';-import {SIZE} from '../../../../utils/SizeUtils';-import {sleep} from '../../../../utils/TimeUtils';-import {EditorWebView} from '../../Functions';+import { SIZE } from '../../../../utils/SizeUtils';+import { sleep } from '../../../../utils/TimeUtils';+import { EditorWebView } from '../../Functions';import tiny from '../tiny';-import {endSearch} from './commands';-import {properties} from './constants';+import { endSearch } from './commands';+import { properties } from './constants';const SearcReplace = () => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const [focusType, setFocusType] = useState(0);const [enableReplace, setEnableReplace] = useState(false);const [menu, setMenu] = useState(false);@@ -70,26 +67,20 @@ const SearcReplace = () => {tiny.call(EditorWebView,`tinymce.activeEditor.undoManager.transact(function () {- tinymce.activeEditor.plugins.searchreplace.replace("${- values.current?.replace- }",true${all ? ',true' : ''});+ tinymce.activeEditor.plugins.searchreplace.replace("${values.current?.replace}",true${+ all ? ',true' : ''+ });});`);}function next() {- tiny.call(- EditorWebView,- `tinymce.activeEditor.plugins.searchreplace.next()`- );+ tiny.call(EditorWebView, `tinymce.activeEditor.plugins.searchreplace.next()`);}function prev() {- tiny.call(- EditorWebView,- `tinymce.activeEditor.plugins.searchreplace.prev()`- );+ tiny.call(EditorWebView, `tinymce.activeEditor.plugins.searchreplace.prev()`);}function done() {@@ -99,14 +90,14 @@ const SearcReplace = () => {function toggleMatchCase() {setConfig(c => {c.matchCase = !c.matchCase;- return {...c};+ return { ...c };});}function toggleMatchWholeWord() {setConfig(c => {c.matchWholeWord = !c.matchWholeWord;- return {...c};+ return { ...c };});}@@ -194,7 +185,8 @@ const SearcReplace = () => {borderTopLeftRadius: 10,flexDirection: 'row',alignItems: 'center'- }}>+ }}+ ><Buttonheight="93%"iconSize={SIZE.md + 4}@@ -222,15 +214,14 @@ const SearcReplace = () => {flexGrow: 1,flexDirection: deviceMode !== 'mobile' ? 'row' : 'column',flexShrink: 1- }}>+ }}+ ><InputfwdRef={findRef}onChangeText={value => {values.current.find = value;}}- defaultValue={- values.current?.find || properties.selection?.current?.value- }+ defaultValue={values.current?.find || properties.selection?.current?.value}onFocusInput={() => setFocusType(1)}onSubmit={find}blurOnSubmit={false}@@ -240,6 +231,7 @@ const SearcReplace = () => {<>{searchButtons.map(button => (<Button+ key={button.text}title={button.text}fontSize={SIZE.xs}height={28}@@ -282,6 +274,7 @@ const SearcReplace = () => {<>{replaceButtons.map(button => (<Button+ key={button.text}title={button.text}fontSize={SIZE.xs + 1}height={28}diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/table.js b/apps/mobile/src/views/Editor/tiny/toolbar/table.jsindex 9e7956a66..7820276ea 100644--- a/apps/mobile/src/views/Editor/tiny/toolbar/table.js+++ b/apps/mobile/src/views/Editor/tiny/toolbar/table.js@@ -1,26 +1,25 @@-import React, {useState} from 'react';-import {View} from 'react-native';-import {PressableButton} from '../../../../components/PressableButton';+import React, { useState } from 'react';+import { View } from 'react-native';+import { PressableButton } from '../../../../components/PressableButton';import Heading from '../../../../components/Typography/Heading';import Paragraph from '../../../../components/Typography/Paragraph';-import {useTracked} from '../../../../provider';-import {eSendEvent} from '../../../../services/EventManager';-import {eCloseProgressDialog} from '../../../../utils/Events';-import {SIZE} from '../../../../utils/SizeUtils';-import {execCommands} from './commands';-import {formatSelection} from './constants';+import { useTracked } from '../../../../provider';+import { eSendEvent } from '../../../../services/EventManager';+import { eCloseProgressDialog } from '../../../../utils/Events';+import { SIZE } from '../../../../utils/SizeUtils';+import { execCommands } from './commands';+import { formatSelection } from './constants';export const Table = () => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const [width, setWidth] = useState(400);const itemWidth = width / 5;const rightCells = [5, 10, 15, 20, 25];const bottomCells = [21, 22, 23, 24, 25];const cells = [- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,- 22, 23, 24, 25+ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25];function getRowColumns(index) {@@ -38,7 +37,8 @@ export const Table = () => {}}style={{paddingHorizontal: 12- }}>+ }}+ ><Heading size={SIZE.md}>Select rows x columns</Heading><View@@ -49,7 +49,8 @@ export const Table = () => {width: '100%',justifyContent: 'center',marginTop: 10- }}>+ }}+ >{cells.map((item, index) => (<PressableButtonkey={item.toString()}@@ -57,9 +58,7 @@ export const Table = () => {let columnCount = 5;let rowNumber = Math.floor(index / columnCount);let columnNumber = index - rowNumber * columnCount;- formatSelection(- execCommands.table(rowNumber + 1, columnNumber + 1)- );+ formatSelection(execCommands.table(rowNumber + 1, columnNumber + 1));eSendEvent(eCloseProgressDialog);}}type="gray"@@ -77,7 +76,8 @@ export const Table = () => {borderTopRightRadius: item === 5 ? 5 : 0,borderBottomLeftRadius: item === 21 ? 5 : 0,borderBottomRightRadius: item === 25 ? 5 : 0- }}>+ }}+ ><Paragraph size={SIZE.sm} color={colors.pri}>{getRowColumns(index)}</Paragraph>diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/tooltip.js b/apps/mobile/src/views/Editor/tiny/toolbar/tooltip.jsindex 5a212fef7..163531f34 100644--- a/apps/mobile/src/views/Editor/tiny/toolbar/tooltip.js+++ b/apps/mobile/src/views/Editor/tiny/toolbar/tooltip.js@@ -1,23 +1,20 @@-import React, {useEffect, useState} from 'react';-import {ScrollView, View} from 'react-native';-import {useTracked} from '../../../../provider';-import {- eSubscribeEvent,- eUnSubscribeEvent-} from '../../../../services/EventManager';-import {editing} from '../../../../utils';+import React, { useEffect, useState } from 'react';+import { ScrollView, View } from 'react-native';+import { useTracked } from '../../../../provider';+import { eSubscribeEvent, eUnSubscribeEvent } from '../../../../services/EventManager';+import { editing } from '../../../../utils';import layoutmanager from '../../../../utils/layout-manager';-import {normalize} from '../../../../utils/SizeUtils';-import {EditorWebView} from '../../Functions';+import { normalize } from '../../../../utils/SizeUtils';+import { EditorWebView } from '../../Functions';import tiny from '../tiny';import ColorGroup from './colorgroup';-import {properties} from './constants';+import { properties } from './constants';import ToolbarItem from './item';import ToolbarLinkInput from './linkinput';const Tooltip = () => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const [group, setGroup] = useState(null);const isColorGroup = /^(hilitecolor|forecolor|)$/.test(group?.type);const isInputTooltip = /^(link|video|)$/.test(group?.type);@@ -83,7 +80,9 @@ const Tooltip = () => {marginVertical: 2,borderRadius: 5}}- children={props.children}></View>+ >+ {props.children}+ </View>) : (<ScrollViewstyle={{@@ -103,8 +102,9 @@ const Tooltip = () => {flexDirection: 'row',minWidth: '100%'}}- children={props.children}- />+ >+ {props.children}+ </ScrollView>)}</View>);diff --git a/apps/mobile/src/views/Editor/useEditorTags.js b/apps/mobile/src/views/Editor/useEditorTags.jsindex 19d26618a..50946f3ed 100644--- a/apps/mobile/src/views/Editor/useEditorTags.js+++ b/apps/mobile/src/views/Editor/useEditorTags.js@@ -1,8 +1,8 @@-import {useEffect, useState} from 'react';-import {useEditorStore, useTagStore} from '../../provider/stores';-import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';-import {db} from '../../utils/database';-import {EditorWebView} from './Functions';+import { useEffect, useState } from 'react';+import { useEditorStore, useTagStore } from '../../provider/stores';+import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';+import { db } from '../../utils/database';+import { EditorWebView } from './Functions';import tiny from './tiny/tiny';export const useEditorTags = () => {@@ -19,7 +19,7 @@ export const useEditorTags = () => {return;}let note = db.notes.note(current)?.data;- setNote(note ? {...note} : null);+ setNote(note ? { ...note } : null);getTags(note);}@@ -28,8 +28,8 @@ export const useEditorTags = () => {}, [currentEditingNote, tags]);function load() {- if (!note) return;- tiny.call(EditorWebView, renderTags(noteTags));+ if (!note) return;+ tiny.call(EditorWebView, renderTags(noteTags));}useEffect(() => {@@ -42,13 +42,13 @@ export const useEditorTags = () => {function getTags(note) {if (!note || !note.tags) return [];let tags = note.tags- .map(t => (db.tags.tag(t) ? {...db.tags.tag(t)} : null))+ .map(t => (db.tags.tag(t) ? { ...db.tags.tag(t) } : null)).filter(t => t !== null);setNoteTags(tags);}useEffect(() => {- load()+ load();}, [noteTags]);const hideTagBar = `diff --git a/apps/mobile/src/views/Favorites/index.js b/apps/mobile/src/views/Favorites/index.jsindex 185ae77ec..b8f71844b 100644--- a/apps/mobile/src/views/Favorites/index.js+++ b/apps/mobile/src/views/Favorites/index.js@@ -1,24 +1,24 @@-import React, {useCallback, useEffect} from 'react';-import {ContainerTopSection} from '../../components/Container/ContainerTopSection';-import {Header} from '../../components/Header';-import {Placeholder} from '../../components/ListPlaceholders';+import React, { useCallback, useEffect } from 'react';+import { ContainerTopSection } from '../../components/Container/ContainerTopSection';+import { Header } from '../../components/Header';+import { Placeholder } from '../../components/ListPlaceholders';import SelectionHeader from '../../components/SelectionHeader';import SimpleList from '../../components/SimpleList';-import {useTracked} from '../../provider';-import {Actions} from '../../provider/Actions';+import { useTracked } from '../../provider';+import { Actions } from '../../provider/Actions';import { useFavoriteStore, useNoteStore } from '../../provider/stores';-import {DDS} from '../../services/DeviceDetection';-import {eSendEvent} from '../../services/EventManager';+import { DDS } from '../../services/DeviceDetection';+import { eSendEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';import SearchService from '../../services/SearchService';-import {InteractionManager} from '../../utils';-import {eScrollEvent} from '../../utils/Events';+import { InteractionManager } from '../../utils';+import { eScrollEvent } from '../../utils/Events';-export const Favorites = ({route, navigation}) => {+export const Favorites = ({ route, navigation }) => {const favorites = useFavoriteStore(state => state.favorites);- const setFavorites = useFavoriteStore(state =>state.setFavorites);+ const setFavorites = useFavoriteStore(state => state.setFavorites);const loading = useNoteStore(state => state.loading);-+let pageIsLoaded = false;let ranAfterInteractions = false;@@ -46,12 +46,12 @@ export const Favorites = ({route, navigation}) => {Navigation.setHeaderState('Favorites',{- menu: true,+ menu: true},{heading: 'Favorites',- id: 'favorites_navigation',- },+ id: 'favorites_navigation'+ });}, []);@@ -79,7 +79,7 @@ export const Favorites = ({route, navigation}) => {placeholder: 'Search in favorites',data: favorites,type: 'notes',- title: 'Favorites',+ title: 'Favorites'});};@@ -101,10 +101,10 @@ export const Favorites = ({route, navigation}) => {heading: 'Your favorites',paragraph: 'You have not added any notes to favorites yet.',button: null,- loading: 'Loading your favorites',+ loading: 'Loading your favorites'}}headerProps={{- heading: 'Favorites',+ heading: 'Favorites'}}focused={() => navigation.isFocused()}placeholder={<Placeholder type="favorites" />}diff --git a/apps/mobile/src/views/Folders/index.js b/apps/mobile/src/views/Folders/index.jsindex b0a4d973a..7dd737a4e 100644--- a/apps/mobile/src/views/Folders/index.js+++ b/apps/mobile/src/views/Folders/index.js@@ -1,21 +1,16 @@-import React, {useCallback, useEffect} from 'react';-import {ContainerBottomButton} from '../../components/Container/ContainerBottomButton';-import {ContainerTopSection} from '../../components/Container/ContainerTopSection';-import {AddNotebookEvent} from '../../components/DialogManager/recievers';-import {Header} from '../../components/Header';+import React, { useCallback, useEffect } from 'react';+import { ContainerBottomButton } from '../../components/Container/ContainerBottomButton';+import { ContainerTopSection } from '../../components/Container/ContainerTopSection';+import { AddNotebookEvent } from '../../components/DialogManager/recievers';+import { Header } from '../../components/Header';import SelectionHeader from '../../components/SelectionHeader';import SimpleList from '../../components/SimpleList';-import {useTracked} from '../../provider';-import {Actions} from '../../provider/Actions';import { useNotebookStore } from '../../provider/stores';-import {eSendEvent} from '../../services/EventManager';import Navigation from '../../services/Navigation';import SearchService from '../../services/SearchService';-import {InteractionManager} from '../../utils';-import {db} from '../../utils/database';-import {eScrollEvent} from '../../utils/Events';+import { InteractionManager } from '../../utils';-export const Folders = ({route, navigation}) => {+export const Folders = ({ navigation }) => {const notebooks = useNotebookStore(state => state.notebooks);const setNotebooks = useNotebookStore(state => state.setNotebooks);let ranAfterInteractions = false;@@ -24,12 +19,12 @@ export const Folders = ({route, navigation}) => {Navigation.setHeaderState('Notebooks',{- menu: true,+ menu: true},{heading: 'Notebooks',- id: 'notebooks_navigation',- },+ id: 'notebooks_navigation'+ });if (!ranAfterInteractions) {ranAfterInteractions = true;@@ -40,7 +35,7 @@ export const Folders = ({route, navigation}) => {const runAfterInteractions = () => {InteractionManager.runAfterInteractions(() => {Navigation.routeNeedsUpdate('Notebooks', () => {- setNotebooks()+ setNotebooks();});});updateSearch();@@ -51,7 +46,6 @@ export const Folders = ({route, navigation}) => {navigation.addListener('focus', onFocus);return () => {ranAfterInteractions = false;- pageIsLoaded = false;navigation.removeListener('focus', onFocus);};}, []);@@ -67,7 +61,7 @@ export const Folders = ({route, navigation}) => {placeholder: 'Type a keyword to search in notebooks',data: notebooks,type: 'notebooks',- title: 'Notebooks',+ title: 'Notebooks'});}, []);@@ -77,12 +71,7 @@ export const Folders = ({route, navigation}) => {<><SelectionHeader screen="Notebooks" /><ContainerTopSection>- <Header- title="Notebooks"- isBack={false}- screen="Notebooks"- action={_onPressBottomButton}- />+ <Header title="Notebooks" isBack={false} screen="Notebooks" action={_onPressBottomButton} /></ContainerTopSection><SimpleListlistData={notebooks}@@ -94,18 +83,15 @@ export const Folders = ({route, navigation}) => {paragraph: 'You have not added any notebooks yet.',button: 'Add a notebook',action: _onPressBottomButton,- loading: 'Loading your notebooks',+ loading: 'Loading your notebooks'}}headerProps={{- heading: 'Notebooks',+ heading: 'Notebooks'}}/>{!notebooks || notebooks.length === 0 ? null : (- <ContainerBottomButton- title="Create a new notebook"- onPress={_onPressBottomButton}- />+ <ContainerBottomButton title="Create a new notebook" onPress={_onPressBottomButton} />)}</>);diff --git a/apps/mobile/src/views/Home/index.js b/apps/mobile/src/views/Home/index.jsindex d53599f02..6f57c69eb 100755--- a/apps/mobile/src/views/Home/index.js+++ b/apps/mobile/src/views/Home/index.js@@ -15,7 +15,7 @@ import { eOnLoadNote } from '../../utils/Events';import { tabBarRef } from '../../utils/Refs';import { getNote } from '../Editor/Functions';-export const Home = ({navigation}) => {+export const Home = ({ navigation }) => {const notes = useNoteStore(state => state.notes);const setNotes = useNoteStore(state => state.setNotes);const loading = useNoteStore(state => state.loading);@@ -81,13 +81,13 @@ export const Home = ({navigation}) => {const _onPressBottomButton = React.useCallback(async () => {if (!DDS.isTab) {if (getNote()) {- eSendEvent(eOnLoadNote, {type: 'new'});+ eSendEvent(eOnLoadNote, { type: 'new' });editing.currentlyEditing = true;editing.movedAway = false;}tabBarRef.current?.goToPage(1);} else {- eSendEvent(eOnLoadNote, {type: 'new'});+ eSendEvent(eOnLoadNote, { type: 'new' });}}, []);@@ -95,12 +95,7 @@ export const Home = ({navigation}) => {<><SelectionHeader screen="Notes" /><ContainerTopSection>- <Header- title="Notes"- isBack={false}- screen="Notes"- action={_onPressBottomButton}- />+ <Header title="Notes" isBack={false} screen="Notes" action={_onPressBottomButton} /></ContainerTopSection><SimpleList@@ -127,10 +122,7 @@ export const Home = ({navigation}) => {/>{!notes || notes.length === 0 ? null : (- <ContainerBottomButton- title="Create a new note"- onPress={_onPressBottomButton}- />+ <ContainerBottomButton title="Create a new note" onPress={_onPressBottomButton} />)}</>);diff --git a/apps/mobile/src/views/Notebook/index.js b/apps/mobile/src/views/Notebook/index.jsindex 7d44d31ff..fe360d57a 100644--- a/apps/mobile/src/views/Notebook/index.js+++ b/apps/mobile/src/views/Notebook/index.js@@ -6,29 +6,18 @@ import { Header } from '../../components/Header';import SelectionHeader from '../../components/SelectionHeader';import SimpleList from '../../components/SimpleList';import { NotebookHeader } from '../../components/SimpleList/notebook-header';-import {- eSendEvent,- eSubscribeEvent,- eUnSubscribeEvent-} from '../../services/EventManager';+import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';import SearchService from '../../services/SearchService';import { InteractionManager } from '../../utils';import { db } from '../../utils/database';-import {- eOnNewTopicAdded,- eOpenAddNotebookDialog,- eOpenAddTopicDialog-} from '../../utils/Events';+import { eOnNewTopicAdded, eOpenAddNotebookDialog, eOpenAddTopicDialog } from '../../utils/Events';-export const Notebook = ({route, navigation}) => {+export const Notebook = ({ route, navigation }) => {const [topics, setTopics] = useState(- groupArray(- route?.params.notebook?.topics || [],- db.settings.getGroupOptions('topics')- )+ groupArray(route?.params.notebook?.topics || [], db.settings.getGroupOptions('topics')));- console.log('params',route?.params.notebook?.topics)+ console.log('params', route?.params.notebook?.topics);const params = useRef(route?.params);const onLoad = data => {@@ -37,9 +26,7 @@ export const Notebook = ({route, navigation}) => {let notebook = db.notebooks.notebook(params?.current?.notebook?.id)?.data;if (notebook) {params.current.notebook = notebook;- setTopics(- groupArray(notebook.topics, db.settings.getGroupOptions('topics'))- );+ setTopics(groupArray(notebook.topics, db.settings.getGroupOptions('topics')));params.current.title = params.current.notebook.title;}updateSearch();@@ -88,7 +75,7 @@ export const Notebook = ({route, navigation}) => {const _onPressBottomButton = () => {let n = params.current.notebook;- eSendEvent(eOpenAddTopicDialog, {notebookId: n.id});+ eSendEvent(eOpenAddTopicDialog, { notebookId: n.id });};return (@@ -137,10 +124,7 @@ export const Notebook = ({route, navigation}) => {}}/>- <ContainerBottomButton- title="Add new topic"- onPress={_onPressBottomButton}- />+ <ContainerBottomButton title="Add new topic" onPress={_onPressBottomButton} /></>);};diff --git a/apps/mobile/src/views/Notes/index.js b/apps/mobile/src/views/Notes/index.jsindex b5ebc5592..ddd30ada0 100644--- a/apps/mobile/src/views/Notes/index.js+++ b/apps/mobile/src/views/Notes/index.js@@ -1,30 +1,22 @@-import {groupArray} from 'notes-core/utils/grouping';-import React, {useCallback, useEffect, useRef, useState} from 'react';-import {ContainerBottomButton} from '../../components/Container/ContainerBottomButton';-import {ContainerTopSection} from '../../components/Container/ContainerTopSection';-import {Header} from '../../components/Header';+import { groupArray } from 'notes-core/utils/grouping';+import React, { useCallback, useEffect, useRef, useState } from 'react';+import { ContainerBottomButton } from '../../components/Container/ContainerBottomButton';+import { ContainerTopSection } from '../../components/Container/ContainerTopSection';+import { Header } from '../../components/Header';import SelectionHeader from '../../components/SelectionHeader';import SimpleList from '../../components/SimpleList';-import {useTracked} from '../../provider';-import {useNoteStore} from '../../provider/stores';-import {DDS} from '../../services/DeviceDetection';-import {- eSendEvent,- eSubscribeEvent,- eUnSubscribeEvent-} from '../../services/EventManager';+import { useTracked } from '../../provider';+import { useNoteStore } from '../../provider/stores';+import { DDS } from '../../services/DeviceDetection';+import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';import SearchService from '../../services/SearchService';-import {editing, InteractionManager} from '../../utils';-import {db} from '../../utils/database';-import {- eOnLoadNote,- eOpenAddTopicDialog,- refreshNotesPage-} from '../../utils/Events';-import {openLinkInBrowser} from '../../utils/functions';-import {tabBarRef} from '../../utils/Refs';-import {getNote} from '../Editor/Functions';+import { editing, InteractionManager } from '../../utils';+import { db } from '../../utils/database';+import { eOnLoadNote, eOpenAddTopicDialog, refreshNotesPage } from '../../utils/Events';+import { openLinkInBrowser } from '../../utils/functions';+import { tabBarRef } from '../../utils/Refs';+import { getNote } from '../Editor/Functions';const getNotes = params => {if (!params) return [];@@ -34,9 +26,7 @@ const getNotes = params => {} else if (params.get === 'monographs') {notes = db.monographs.all;} else {- notes = db.notebooks- .notebook(params.notebookId)- ?.topics.topic(params.id)?.all;+ notes = db.notebooks.notebook(params.notebookId)?.topics.topic(params.id)?.all;}if (!notes) {notes = [];@@ -55,7 +45,7 @@ function getAlias(params) {return alias || '';}-export const Notes = ({route, navigation}) => {+export const Notes = ({ route, navigation }) => {const [state] = useTracked();const colors = state.colors;const params = useRef(route?.params);@@ -145,9 +135,7 @@ export const Notes = ({route, navigation}) => {const updateSearch = () => {SearchService.update({- placeholder: `Search in ${- params.current?.type === 'tag' ? '#' + alias : alias- }`,+ placeholder: `Search in ${params.current?.type === 'tag' ? '#' + alias : alias}`,data: notes,noSearch: false,type: 'notes',@@ -162,23 +150,20 @@ export const Notes = ({route, navigation}) => {const _onPressBottomButton = async () => {if (params.current?.get === 'monographs') {try {- await openLinkInBrowser(- 'https://docs.notesnook.com/monographs/',- colors.accent- );+ await openLinkInBrowser('https://docs.notesnook.com/monographs/', colors.accent);} catch (e) {}return;}setActionAfterFirstSave();if (!DDS.isTab) {if (getNote()) {- eSendEvent(eOnLoadNote, {type: 'new'});+ eSendEvent(eOnLoadNote, { type: 'new' });editing.currentlyEditing = true;editing.movedAway = false;}tabBarRef.current?.goToPage(1);} else {- eSendEvent(eOnLoadNote, {type: 'new'});+ eSendEvent(eOnLoadNote, { type: 'new' });}};@@ -187,10 +172,7 @@ export const Notes = ({route, navigation}) => {params.current?.type === 'tag'? '#' + alias: alias.slice(0, 1).toUpperCase() + alias.slice(1),- color:- params.current?.type === 'color'- ? params.current?.title.toLowerCase()- : null,+ color: params.current?.type === 'color' ? params.current?.title.toLowerCase() : null,paragraph: params.current?.type === 'topic' ? 'Edit topic' : null,onPress: () => {if (params.current?.type !== 'topic') return;@@ -207,23 +189,16 @@ export const Notes = ({route, navigation}) => {};const placeholderData = {- heading:- params.current?.get === 'monographs' ? 'Your monographs' : 'Your notes',+ heading: params.current?.get === 'monographs' ? 'Your monographs' : 'Your notes',paragraph:params.current?.get === 'monographs'? 'You have not published any notes as monographs yet.': 'You have not added any notes yet.',- button:- params.current?.get === 'monographs'- ? 'Learn about monographs'- : 'Add your first Note',+ button: params.current?.get === 'monographs' ? 'Learn about monographs' : 'Add your first Note',action: _onPressBottomButton,- buttonIcon:- params.current?.get === 'monographs' ? 'information-outline' : null,+ buttonIcon: params.current?.get === 'monographs' ? 'information-outline' : null,loading:- params.current?.get === 'monographs'- ? 'Loading published notes'- : 'Loading your notes.'+ params.current?.get === 'monographs' ? 'Loading published notes' : 'Loading your notes.'};const isFocused = () => navigation.isFocused();@@ -259,12 +234,9 @@ export const Notes = ({route, navigation}) => {screen="NotesPage"action={_onPressBottomButton}notebook={- params.current?.notebookId &&- db.notebooks?.notebook(params.current?.notebookId).data- }- rightButtons={- params.current?.type !== 'topic' ? null : headerRightButtons+ params.current?.notebookId && db.notebooks?.notebook(params.current?.notebookId).data}+ rightButtons={params.current?.type !== 'topic' ? null : headerRightButtons}/></ContainerTopSection><SimpleListdiff --git a/apps/mobile/src/views/Search/index.js b/apps/mobile/src/views/Search/index.jsindex a1c340619..6586aac3b 100644--- a/apps/mobile/src/views/Search/index.js+++ b/apps/mobile/src/views/Search/index.js@@ -1,15 +1,15 @@-import React, {useCallback, useEffect} from 'react';-import {ContainerTopSection} from '../../components/Container/ContainerTopSection';+import React, { useCallback, useEffect } from 'react';+import { ContainerTopSection } from '../../components/Container/ContainerTopSection';import SelectionHeader from '../../components/SelectionHeader';import SimpleList from '../../components/SimpleList';-import {useTracked} from '../../provider';-import {useSearchStore} from '../../provider/stores';+import { useTracked } from '../../provider';+import { useSearchStore } from '../../provider/stores';import SearchService from '../../services/SearchService';-import {inputRef} from '../../utils/Refs';-import {sleep} from '../../utils/TimeUtils';-import {SearchBar} from './search-bar';+import { inputRef } from '../../utils/Refs';+import { sleep } from '../../utils/TimeUtils';+import { SearchBar } from './search-bar';-export const Search = ({route, navigation}) => {+export const Search = ({ route, navigation }) => {const [state, dispatch] = useTracked();const searchResults = useSearchStore(state => state.searchResults);@@ -50,9 +50,7 @@ export const Search = ({route, navigation}) => {heading: 'Search',paragraph:searchStatus ||- `Type a keyword to search in ${- SearchService.getSearchInformation().title- }`,+ `Type a keyword to search in ${SearchService.getSearchInformation().title}`,button: null,loading: 'Searching...'}}diff --git a/apps/mobile/src/views/Search/searchbar.js b/apps/mobile/src/views/Search/searchbar.jsindex dde3cbdbc..305515437 100644--- a/apps/mobile/src/views/Search/searchbar.js+++ b/apps/mobile/src/views/Search/searchbar.js@@ -1,25 +1,20 @@-import React, {useEffect, useRef, useState} from 'react';-import {View} from 'react-native';-import {TextInput} from 'react-native-gesture-handler';-import {useSafeAreaInsets} from 'react-native-safe-area-context';-import {ActionIcon} from '../../components/ActionIcon';-import {useTracked} from '../../provider';-import {useSearchStore} from '../../provider/stores';-import {- eSubscribeEvent,- eUnSubscribeEvent,- ToastEvent-} from '../../services/EventManager';+import React, { useEffect, useRef, useState } from 'react';+import { Platform, View } from 'react-native';+import { TextInput } from 'react-native-gesture-handler';+import { useSafeAreaInsets } from 'react-native-safe-area-context';+import { ActionIcon } from '../../components/ActionIcon';+import { useTracked } from '../../provider';+import { useSearchStore } from '../../provider/stores';+import { eSubscribeEvent, eUnSubscribeEvent, ToastEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';import SearchService from '../../services/SearchService';-import {eScrollEvent} from '../../utils/Events';-import {normalize, SIZE} from '../../utils/SizeUtils';-import {sleep} from '../../utils/TimeUtils';+import { eScrollEvent } from '../../utils/Events';+import { normalize, SIZE } from '../../utils/SizeUtils';+import { sleep } from '../../utils/TimeUtils';export const SearchBar = () => {const [state] = useTracked();const colors = state.colors;- const [focused, setFocused] = useState(false);const [value, setValue] = useState(null);const inputRef = useRef();const setSearchResults = useSearchStore(state => state.setSearchResults);@@ -49,8 +44,8 @@ export const SearchBar = () => {return () => {eUnSubscribeEvent(eScrollEvent, onScroll);};- },[]);-+ }, []);+const onChangeText = value => {setValue(value);search(value);@@ -93,7 +88,8 @@ export const SearchBar = () => {marginTop: Platform.OS === 'android' ? insets.top + 5 : 5,borderBottomWidth: 1,borderBottomColor: colors.nav- }}>+ }}+ ><ActionIconname="arrow-left"size={SIZE.xl}diff --git a/apps/mobile/src/views/Settings/appearance.js b/apps/mobile/src/views/Settings/appearance.jsindex f412a1ff3..526dae71d 100644--- a/apps/mobile/src/views/Settings/appearance.js+++ b/apps/mobile/src/views/Settings/appearance.js@@ -1,18 +1,18 @@-import React, {useRef, useState} from 'react';-import {Appearance, ScrollView, TouchableOpacity, View} from 'react-native';-import Menu, {MenuItem} from 'react-native-reanimated-material-menu';+import React, { useRef, useState } from 'react';+import { Appearance, ScrollView, TouchableOpacity, View } from 'react-native';+import Menu, { MenuItem } from 'react-native-reanimated-material-menu';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';import ToggleSwitch from 'toggle-switch-react-native';-import {PressableButton} from '../../components/PressableButton';+import { PressableButton } from '../../components/PressableButton';import Paragraph from '../../components/Typography/Paragraph';-import {useTracked} from '../../provider';-import {Actions} from '../../provider/Actions';-import {useSettingStore} from '../../provider/stores';-import {DDS} from '../../services/DeviceDetection';-import {ToastEvent} from '../../services/EventManager';+import { useTracked } from '../../provider';+import { Actions } from '../../provider/Actions';+import { useSettingStore } from '../../provider/stores';+import { DDS } from '../../services/DeviceDetection';+import { ToastEvent } from '../../services/EventManager';import PremiumService from '../../services/PremiumService';import SettingsService from '../../services/SettingsService';-import {MenuItemsList} from '../../utils';+import { MenuItemsList } from '../../utils';import {ACCENT,COLOR_SCHEME,@@ -21,22 +21,22 @@ import {COLOR_SCHEME_PITCH_BLACK,setColorScheme} from '../../utils/Colors';-import {hexToRGBA, RGB_Linear_Shade} from '../../utils/ColorUtils';-import {MMKV} from '../../utils/mmkv';-import {tabBarRef} from '../../utils/Refs';-import {pv, SIZE} from '../../utils/SizeUtils';-import {CustomButton} from './button';+import { hexToRGBA, RGB_Linear_Shade } from '../../utils/ColorUtils';+import { MMKV } from '../../utils/mmkv';+import { tabBarRef } from '../../utils/Refs';+import { pv, SIZE } from '../../utils/SizeUtils';+import { CustomButton } from './button';import SectionHeader from './section-header';const SettingsAppearanceSection = () => {const [state, dispatch] = useTracked();- const {colors} = state;+ const { colors } = state;const settings = useSettingStore(state => state.settings);const [collapsed, setCollapsed] = useState(true);const menuRef = useRef();function changeColorScheme(colors = COLOR_SCHEME, accent = ACCENT) {let newColors = setColorScheme(colors, accent);- dispatch({type: Actions.THEME, colors: newColors});+ dispatch({ type: Actions.THEME, colors: newColors });}function changeAccentColor(accentColor) {@@ -57,12 +57,10 @@ const SettingsAppearanceSection = () => {if (SettingsService.get().useSystemTheme) {await MMKV.setStringAsync('theme',- JSON.stringify({night: Appearance.getColorScheme() === 'dark'})+ JSON.stringify({ night: Appearance.getColorScheme() === 'dark' }));changeColorScheme(- Appearance.getColorScheme() === 'dark'- ? COLOR_SCHEME_DARK- : COLOR_SCHEME_LIGHT+ Appearance.getColorScheme() === 'dark' ? COLOR_SCHEME_DARK : COLOR_SCHEME_LIGHT);}});@@ -70,10 +68,7 @@ const SettingsAppearanceSection = () => {};const pitchBlack = async () => {- await SettingsService.set(- 'pitchBlack',- SettingsService.get().pitchBlack ? false : true- );+ await SettingsService.set('pitchBlack', SettingsService.get().pitchBlack ? false : true);let theme = await MMKV.getStringAsync('theme');if (!theme) return;theme = JSON.parse(theme);@@ -94,11 +89,7 @@ const SettingsAppearanceSection = () => {return (<>- <SectionHeader- collapsed={collapsed}- setCollapsed={setCollapsed}- title="Appearance"- />+ <SectionHeader collapsed={collapsed} setCollapsed={setCollapsed} title="Appearance" />{collapsed ? null : (<>@@ -106,12 +97,14 @@ const SettingsAppearanceSection = () => {style={{paddingHorizontal: 12,marginTop: 5- }}>+ }}+ ><Paragraphsize={SIZE.md}style={{textAlignVertical: 'center'- }}>+ }}+ >Accent color</Paragraph><Paragraph size={SIZE.sm} color={colors.icon}>@@ -140,7 +133,8 @@ const SettingsAppearanceSection = () => {alignSelf: 'center',flexDirection: 'row',flexWrap: 'wrap'- }}>+ }}+ >{['#FF5722','#FFA000',@@ -159,10 +153,7 @@ const SettingsAppearanceSection = () => {key={item}customColor={colors.accent === item- ? RGB_Linear_Shade(- !colors.night ? -0.2 : 0.2,- hexToRGBA(item, 1)- )+ ? RGB_Linear_Shade(!colors.night ? -0.2 : 0.2, hexToRGBA(item, 1)): item}customSelectedColor={item}@@ -183,7 +174,8 @@ const SettingsAppearanceSection = () => {width: DDS.isLargeTablet() ? 40 : 50,height: DDS.isLargeTablet() ? 40 : 50,borderRadius: 100- }}>+ }}+ >{colors.accent === item ? (<Iconsize={DDS.isLargeTablet() ? SIZE.lg : SIZE.xxl}@@ -193,7 +185,7 @@ const SettingsAppearanceSection = () => {) : null}</PressableButton>))}- <View style={{width: 50}} />+ <View style={{ width: 50 }} /></ScrollView><CustomButton@@ -252,20 +244,12 @@ const SettingsAppearanceSection = () => {tagline="Switch on dark mode at night to protect your eyes."onPress={async () => {if (!colors.night) {- await MMKV.setStringAsync(- 'theme',- JSON.stringify({night: true})- );+ await MMKV.setStringAsync('theme', JSON.stringify({ night: true }));changeColorScheme(- SettingsService.get().pitchBlack- ? COLOR_SCHEME_PITCH_BLACK- : COLOR_SCHEME_DARK+ SettingsService.get().pitchBlack ? COLOR_SCHEME_PITCH_BLACK : COLOR_SCHEME_DARK);} else {- await MMKV.setStringAsync(- 'theme',- JSON.stringify({night: false})- );+ await MMKV.setStringAsync('theme', JSON.stringify({ night: false }));changeColorScheme(COLOR_SCHEME_LIGHT);}@@ -280,16 +264,10 @@ const SettingsAppearanceSection = () => {animationSpeed={150}onToggle={async isOn => {if (!colors.night) {- await MMKV.setStringAsync(- 'theme',- JSON.stringify({night: true})- );+ await MMKV.setStringAsync('theme', JSON.stringify({ night: true }));changeColorScheme(COLOR_SCHEME_DARK);} else {- await MMKV.setStringAsync(- 'theme',- JSON.stringify({night: false})- );+ await MMKV.setStringAsync('theme', JSON.stringify({ night: false }));changeColorScheme(COLOR_SCHEME_LIGHT);}@@ -320,42 +298,36 @@ const SettingsAppearanceSection = () => {style={{flexDirection: 'row',alignItems: 'center'- }}>+ }}+ ><Paragraph>{settings.homepage}</Paragraph><Icon color={colors.icon} name="menu-down" size={SIZE.md} /></TouchableOpacity>- }>- {MenuItemsList.slice(0, MenuItemsList.length - 1).map(- (item, index) => (- <MenuItem- key={item.name}- onPress={async () => {- menuRef.current?.hide();- await SettingsService.set('homepage', item.name);- ToastEvent.show({- heading: 'Homepage set to ' + item.name,- message:- 'Restart the app for changes to take effect.',- type: 'success'- });- }}- style={{- backgroundColor:- settings.homepage === item.name- ? colors.nav- : 'transparent'- }}- textStyle={{- fontSize: SIZE.md,- color:- settings.homepage === item.name- ? colors.accent- : colors.pri- }}>- {item.name}- </MenuItem>- )- )}+ }+ >+ {MenuItemsList.slice(0, MenuItemsList.length - 1).map((item, index) => (+ <MenuItem+ key={item.name}+ onPress={async () => {+ menuRef.current?.hide();+ await SettingsService.set('homepage', item.name);+ ToastEvent.show({+ heading: 'Homepage set to ' + item.name,+ message: 'Restart the app for changes to take effect.',+ type: 'success'+ });+ }}+ style={{+ backgroundColor: settings.homepage === item.name ? colors.nav : 'transparent'+ }}+ textStyle={{+ fontSize: SIZE.md,+ color: settings.homepage === item.name ? colors.accent : colors.pri+ }}+ >+ {item.name}+ </MenuItem>+ ))}</Menu>}/>diff --git a/apps/mobile/src/views/Settings/backuprestore.js b/apps/mobile/src/views/Settings/backuprestore.jsindex 6c98c9176..a721e09b8 100644--- a/apps/mobile/src/views/Settings/backuprestore.js+++ b/apps/mobile/src/views/Settings/backuprestore.js@@ -1,34 +1,26 @@-import React, {useEffect, useState} from 'react';-import {Platform, TouchableOpacity, View} from 'react-native';+import React, { useEffect, useState } from 'react';+import { Platform, TouchableOpacity, View } from 'react-native';import ToggleSwitch from 'toggle-switch-react-native';import Seperator from '../../components/Seperator';import Paragraph from '../../components/Typography/Paragraph';-import {useTracked} from '../../provider';-import {useSettingStore, useUserStore} from '../../provider/stores';+import { useTracked } from '../../provider';+import { useSettingStore, useUserStore } from '../../provider/stores';import Backup from '../../services/Backup';-import {- eSendEvent,- presentSheet,- ToastEvent-} from '../../services/EventManager';+import { eSendEvent, presentSheet, ToastEvent } from '../../services/EventManager';import PremiumService from '../../services/PremiumService';import SettingsService from '../../services/SettingsService';-import {- eCloseProgressDialog,- eOpenLoginDialog,- eOpenRestoreDialog-} from '../../utils/Events';-import {openLinkInBrowser} from '../../utils/functions';-import {MMKV} from '../../utils/mmkv';-import {SIZE} from '../../utils/SizeUtils';-import {sleep} from '../../utils/TimeUtils';-import {CustomButton} from './button';-import {verifyUser} from './functions';+import { eCloseProgressDialog, eOpenLoginDialog, eOpenRestoreDialog } from '../../utils/Events';+import { openLinkInBrowser } from '../../utils/functions';+import { MMKV } from '../../utils/mmkv';+import { SIZE } from '../../utils/SizeUtils';+import { sleep } from '../../utils/TimeUtils';+import { CustomButton } from './button';+import { verifyUser } from './functions';import SectionHeader from './section-header';-const SettingsBackupAndRestore = ({isSheet}) => {+const SettingsBackupAndRestore = ({ isSheet }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const settings = useSettingStore(state => state.settings);const user = useUserStore(state => state.user);const [collapsed, setCollapsed] = useState(isSheet ? false : true);@@ -81,10 +73,7 @@ const SettingsBackupAndRestore = ({isSheet}) => {icon: 'import',action: async () => {try {- await openLinkInBrowser(- 'https://importer.notesnook.com',- colors- );+ await openLinkInBrowser('https://importer.notesnook.com', colors);} catch (e) {}},actionText: 'Go to Notesnook Importer',@@ -177,11 +166,7 @@ const SettingsBackupAndRestore = ({isSheet}) => {return (<>{!isSheet && (- <SectionHeader- collapsed={collapsed}- setCollapsed={setCollapsed}- title="Backup & restore"- />+ <SectionHeader collapsed={collapsed} setCollapsed={setCollapsed} title="Backup & restore" />)}{!collapsed && (@@ -202,13 +187,15 @@ const SettingsBackupAndRestore = ({isSheet}) => {paddingHorizontal: 12,flexShrink: 1,paddingVertical: 10- }}>+ }}+ ><Paragraphsize={SIZE.md}style={{textAlignVertical: 'center',maxWidth: '100%'- }}>+ }}+ >Automatic backups</Paragraph><Paragraph color={colors.icon} size={SIZE.sm}>@@ -222,7 +209,8 @@ const SettingsBackupAndRestore = ({isSheet}) => {overflow: 'hidden',flexShrink: 1,width: '100%'- }}>+ }}+ >{[{title: 'Never',@@ -262,22 +250,19 @@ const SettingsBackupAndRestore = ({isSheet}) => {}}key={item.value}style={{- backgroundColor:- settings.reminder === item.value- ? colors.accent- : colors.nav,+ backgroundColor: settings.reminder === item.value ? colors.accent : colors.nav,justifyContent: 'center',alignItems: 'center',width: '25%',height: 35,borderRightWidth: index !== 3 ? 1 : 0,borderRightColor: colors.border- }}>+ }}+ ><Paragraph- color={- settings.reminder === item.value ? 'white' : colors.icon- }- size={SIZE.sm - 1}>+ color={settings.reminder === item.value ? 'white' : colors.icon}+ size={SIZE.sm - 1}+ >{item.title}</Paragraph></TouchableOpacity>diff --git a/apps/mobile/src/views/Settings/button.js b/apps/mobile/src/views/Settings/button.jsindex 6b5711883..5fbb698fc 100644--- a/apps/mobile/src/views/Settings/button.js+++ b/apps/mobile/src/views/Settings/button.js@@ -1,59 +1,61 @@import React from 'react';-import {- View-} from 'react-native';+import { View } from 'react-native';import { PressableButton } from '../../components/PressableButton';import Paragraph from '../../components/Typography/Paragraph';import { useTracked } from '../../provider';import { SIZE } from '../../utils/SizeUtils';export const CustomButton = ({- title,- tagline,- customComponent,- onPress,- maxWidth = '100%',- color = null- }) => {- const [state] = useTracked();- const {colors} = state;- return (- <PressableButton- onPress={onPress}- customStyle={{- minHeight: 50,- justifyContent: 'space-between',- alignItems: 'center',- paddingHorizontal: 12,- paddingVertical: 12,- width: '100%',- borderRadius: 0,- flexDirection: 'row'- }}>- <View- style={{- flexShrink: 1- }}>- <Paragraph- size={SIZE.md}- color={color || colors.pri}- style={{- textAlignVertical: 'center',- flexWrap: 'wrap'- }}>- {title}- </Paragraph>- <Paragraph- style={{- flexWrap: 'wrap',- paddingRight:10- }}- size={SIZE.sm}- color={colors.icon}>- {tagline}- </Paragraph>- </View>- {customComponent ? customComponent : null}- </PressableButton>- );- };\ No newline at end of file+ title,+ tagline,+ customComponent,+ onPress,+ maxWidth = '100%',+ color = null+}) => {+ const [state] = useTracked();+ const { colors } = state;+ return (+ <PressableButton+ onPress={onPress}+ customStyle={{+ minHeight: 50,+ justifyContent: 'space-between',+ alignItems: 'center',+ paddingHorizontal: 12,+ paddingVertical: 12,+ width: '100%',+ borderRadius: 0,+ flexDirection: 'row'+ }}+ >+ <View+ style={{+ flexShrink: 1+ }}+ >+ <Paragraph+ size={SIZE.md}+ color={color || colors.pri}+ style={{+ textAlignVertical: 'center',+ flexWrap: 'wrap'+ }}+ >+ {title}+ </Paragraph>+ <Paragraph+ style={{+ flexWrap: 'wrap',+ paddingRight: 10+ }}+ size={SIZE.sm}+ color={colors.icon}+ >+ {tagline}+ </Paragraph>+ </View>+ {customComponent ? customComponent : null}+ </PressableButton>+ );+};diff --git a/apps/mobile/src/views/Settings/developeroptions.js b/apps/mobile/src/views/Settings/developeroptions.jsindex bba4e62da..7a2279d32 100644--- a/apps/mobile/src/views/Settings/developeroptions.js+++ b/apps/mobile/src/views/Settings/developeroptions.js@@ -1,14 +1,14 @@-import React, {useState} from 'react';+import React, { useState } from 'react';import ToggleSwitch from 'toggle-switch-react-native';-import {useTracked} from '../../provider';-import {useSettingStore} from '../../provider/stores';+import { useTracked } from '../../provider';+import { useSettingStore } from '../../provider/stores';import SettingsService from '../../services/SettingsService';import { CustomButton } from './button';import SectionHeader from './section-header';-const SettingsDeveloperOptions = ({isSheet}) => {+const SettingsDeveloperOptions = ({ isSheet }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const settings = useSettingStore(state => state.settings);const [collapsed, setCollapsed] = useState(isSheet ? false : true);diff --git a/apps/mobile/src/views/Settings/functions.js b/apps/mobile/src/views/Settings/functions.jsindex 1969644d2..6f1c22e33 100644--- a/apps/mobile/src/views/Settings/functions.js+++ b/apps/mobile/src/views/Settings/functions.js@@ -1,15 +1,9 @@-import {presentDialog} from '../../components/Dialog/functions';-import {ToastEvent} from '../../services/EventManager';-import {db} from '../../utils/database';-import {sleep} from '../../utils/TimeUtils';+import { presentDialog } from '../../components/Dialog/functions';+import { ToastEvent } from '../../services/EventManager';+import { db } from '../../utils/database';+import { sleep } from '../../utils/TimeUtils';-export async function verifyUser(- context,- onsuccess,- disableBackdropClosing,- onclose,- closeText-) {+export async function verifyUser(context, onsuccess, disableBackdropClosing, onclose, closeText) {presentDialog({context: context,title: "Verify it's you",diff --git a/apps/mobile/src/views/Settings/general.js b/apps/mobile/src/views/Settings/general.jsindex 5ab6befd5..fa63be317 100644--- a/apps/mobile/src/views/Settings/general.js+++ b/apps/mobile/src/views/Settings/general.js@@ -1,15 +1,15 @@-import React, {useState} from 'react';+import React, { useState } from 'react';import ToggleSwitch from 'toggle-switch-react-native';-import {useTracked} from '../../provider';-import {useSettingStore} from '../../provider/stores';+import { useTracked } from '../../provider';+import { useSettingStore } from '../../provider/stores';import Notifications from '../../services/Notifications';import SettingsService from '../../services/SettingsService';import { CustomButton } from './button';import SectionHeader from './section-header';-export const SettingsGeneralOptions = ({isSheet}) => {+export const SettingsGeneralOptions = ({ isSheet }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const settings = useSettingStore(state => state.settings);const [collapsed, setCollapsed] = useState(isSheet ? false : true);const toggleNotifNotes = () => {@@ -42,11 +42,7 @@ export const SettingsGeneralOptions = ({isSheet}) => {return (<>{!isSheet && (- <SectionHeader- collapsed={collapsed}- setCollapsed={setCollapsed}- title="General"- />+ <SectionHeader collapsed={collapsed} setCollapsed={setCollapsed} title="General" />)}{!collapsed && (diff --git a/apps/mobile/src/views/Settings/index.js b/apps/mobile/src/views/Settings/index.jsindex c3ae7f67c..52af81bad 100644--- a/apps/mobile/src/views/Settings/index.js+++ b/apps/mobile/src/views/Settings/index.js@@ -1,46 +1,42 @@-import React, {useCallback, useEffect, useState} from 'react';-import {Linking, Platform, ScrollView, View} from 'react-native';-import {Button as MButton} from '../../components/Button/index';-import {ContainerTopSection} from '../../components/Container/ContainerTopSection';-import {Issue} from '../../components/Github/issue';-import {Header as TopHeader} from '../../components/Header/index';+import React, { useCallback, useEffect, useState } from 'react';+import { Linking, Platform, ScrollView, View } from 'react-native';+import { Button as MButton } from '../../components/Button/index';+import { ContainerTopSection } from '../../components/Container/ContainerTopSection';+import { Issue } from '../../components/Github/issue';+import { Header as TopHeader } from '../../components/Header/index';import Seperator from '../../components/Seperator';import Paragraph from '../../components/Typography/Paragraph';-import {useTracked} from '../../provider';-import {- eSendEvent,- presentSheet,- ToastEvent-} from '../../services/EventManager';+import { useTracked } from '../../provider';+import { eSendEvent, presentSheet, ToastEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';-import {InteractionManager, STORE_LINK} from '../../utils';-import {APP_VERSION} from '../../../version';-import {db} from '../../utils/database';-import {eScrollEvent, eUpdateSearchState} from '../../utils/Events';-import {openLinkInBrowser} from '../../utils/functions';+import { InteractionManager, STORE_LINK } from '../../utils';+import { APP_VERSION } from '../../../version';+import { db } from '../../utils/database';+import { eScrollEvent, eUpdateSearchState } from '../../utils/Events';+import { openLinkInBrowser } from '../../utils/functions';import SettingsAppearanceSection from './appearance';import SettingsBackupAndRestore from './backup-restore';-import {CustomButton} from './button';+import { CustomButton } from './button';import SettingsDeveloperOptions from './developeroptions';import SettingsGeneralOptions from './general';import AccoutLogoutSection from './logout';import SettingsPrivacyAndSecurity from './privacy';import SectionHeader from './section-header';import SettingsUserSection from './user-section';-import {Update} from '../../components/Update';-import {checkVersion} from 'react-native-check-version';+import { Update } from '../../components/Update';+import { checkVersion } from 'react-native-check-version';const format = ver => {let parts = ver.toString().split('');- return `v${parts[0]}.${parts[1]}.${- parts[2]?.startsWith('0') ? parts[2]?.slice(1) : parts[2]- }${parts[3] === '0' ? '' : parts[3]} `;+ return `v${parts[0]}.${parts[1]}.${parts[2]?.startsWith('0') ? parts[2]?.slice(1) : parts[2]}${+ parts[3] === '0' ? '' : parts[3]+ } `;};-export const Settings = ({navigation}) => {+export const Settings = ({ navigation }) => {const [state, dispatch] = useTracked();- const {colors} = state;+ const { colors } = state;const [collapsed, setCollapsed] = useState(false);let pageIsLoaded = false;@@ -141,8 +137,7 @@ export const Settings = ({navigation}) => {presentSheet({title: 'Join our Discord Community',iconColor: 'discord',- paragraph:- 'We are not ghosts, chat with us and share your experience.',+ paragraph: 'We are not ghosts, chat with us and share your experience.',valueArray: ['Talk with us anytime.','Follow the development process',@@ -183,10 +178,7 @@ export const Settings = ({navigation}) => {name: 'Roadmap',func: async () => {try {- await openLinkInBrowser(- 'https://docs.notesnook.com/roadmap/',- colors- );+ await openLinkInBrowser('https://docs.notesnook.com/roadmap/', colors);} catch (e) {}},desc: 'See what the future of Notesnook is going to be like.'@@ -211,7 +203,8 @@ export const Settings = ({navigation}) => {style={{height: '100%',backgroundColor: colors.bg- }}>+ }}+ ><ScrollViewonScroll={e =>eSendEvent(eScrollEvent, {@@ -222,7 +215,8 @@ export const Settings = ({navigation}) => {scrollEventThrottle={1}style={{paddingHorizontal: 0- }}>+ }}+ ><SettingsUserSection /><SettingsAppearanceSection />@@ -235,11 +229,7 @@ export const Settings = ({navigation}) => {<SettingsDeveloperOptions />- <SectionHeader- collapsed={collapsed}- setCollapsed={setCollapsed}- title="Other"- />+ <SectionHeader collapsed={collapsed} setCollapsed={setCollapsed} title="Other" />{!collapsed && (<>@@ -253,25 +243,24 @@ export const Settings = ({navigation}) => {marginTop: 10,backgroundColor: colors.nav,alignSelf: 'center'- }}>+ }}+ ><Paragraphstyle={{flexWrap: 'wrap',flexBasis: 1,textAlign: 'center'}}- color={colors.pri}>- It took us a year to bring Notesnook to you. Help us make it- better by rating it on{' '}- {Platform.OS === 'ios' ? 'Appstore' : 'Playstore'}+ color={colors.pri}+ >+ It took us a year to bring Notesnook to you. Help us make it better by rating it+ on {Platform.OS === 'ios' ? 'Appstore' : 'Playstore'}</Paragraph><Seperator /><MButtontype="accent"width="100%"- title={`Rate us on ${- Platform.OS === 'ios' ? 'Appstore' : 'Playstore'- }`}+ title={`Rate us on ${Platform.OS === 'ios' ? 'Appstore' : 'Playstore'}`}onPress={async () => {try {await Linking.openURL(STORE_LINK);diff --git a/apps/mobile/src/views/Settings/logout.js b/apps/mobile/src/views/Settings/logout.jsindex da27bfb2b..565991897 100644--- a/apps/mobile/src/views/Settings/logout.js+++ b/apps/mobile/src/views/Settings/logout.js@@ -1,29 +1,29 @@-import React, {useRef, useState} from 'react';-import {View} from 'react-native';+import React, { useRef, useState } from 'react';+import { View } from 'react-native';import AnimatedProgress from 'react-native-reanimated-progress-bar';import BaseDialog from '../../components/Dialog/base-dialog';import DialogButtons from '../../components/Dialog/dialog-buttons';import DialogContainer from '../../components/Dialog/dialog-container';import DialogHeader from '../../components/Dialog/dialog-header';-import {presentDialog} from '../../components/Dialog/functions';+import { presentDialog } from '../../components/Dialog/functions';import Input from '../../components/Input';-import {PressableButton} from '../../components/PressableButton';+import { PressableButton } from '../../components/PressableButton';import Seperator from '../../components/Seperator';-import {Toast} from '../../components/Toast';+import { Toast } from '../../components/Toast';import Heading from '../../components/Typography/Heading';import Paragraph from '../../components/Typography/Paragraph';-import {useTracked} from '../../provider';-import {useUserStore} from '../../provider/stores';+import { useTracked } from '../../provider';+import { useUserStore } from '../../provider/stores';import BiometricService from '../../services/BiometricService';-import {ToastEvent} from '../../services/EventManager';-import {db} from '../../utils/database';-import {SIZE} from '../../utils/SizeUtils';+import { ToastEvent } from '../../services/EventManager';+import { db } from '../../utils/database';+import { SIZE } from '../../utils/SizeUtils';import Storage from '../../utils/storage';-import {sleep} from '../../utils/TimeUtils';+import { sleep } from '../../utils/TimeUtils';const AccoutLogoutSection = () => {const [state, dispatch] = useTracked();- const {colors} = state;+ const { colors } = state;const user = useUserStore(state => state.user);const [loading, setLoading] = useState(false);const passwordValue = useRef();@@ -39,7 +39,8 @@ const AccoutLogoutSection = () => {backgroundColor: colors.bg,justifyContent: 'center',alignItems: 'center'- }}>+ }}+ ><Heading color={colors.pri} size={SIZE.lg}>Logging out</Heading>@@ -52,7 +53,8 @@ const AccoutLogoutSection = () => {height: 10,width: 100,marginTop: 15- }}>+ }}+ ><AnimatedProgress fill={colors.accent} total={8} current={8} /></View></View>@@ -96,12 +98,14 @@ const AccoutLogoutSection = () => {paddingHorizontal: 12,marginTop: index === 0 ? 25 : 0,borderRadius: 0- }}>+ }}+ ><Headingcolor={item.name === 'Logout' ? colors.pri : colors.red}style={{fontSize: SIZE.md- }}>+ }}+ >{item.name}</Heading></PressableButton>@@ -159,12 +163,14 @@ const AccoutLogoutSection = () => {paddingHorizontal: 12,marginTop: 25,borderColor: colors.red- }}>+ }}+ ><Headingcolor={colors.red}style={{fontSize: SIZE.md- }}>+ }}+ >Delete account</Heading><Paragraph@@ -172,10 +178,10 @@ const AccoutLogoutSection = () => {flexWrap: 'wrap',flexBasis: 1}}- color={colors.red}>- Your account will be deleted and all your data will be removed- permanantly. Make sure you have saved backup of your notes. This- action is IRREVERSIBLE.+ color={colors.red}+ >+ Your account will be deleted and all your data will be removed permanantly. Make sure you+ have saved backup of your notes. This action is IRREVERSIBLE.</Paragraph></PressableButton></>diff --git a/apps/mobile/src/views/Settings/privacy.js b/apps/mobile/src/views/Settings/privacy.jsindex fb0e90a39..faaa82257 100644--- a/apps/mobile/src/views/Settings/privacy.js+++ b/apps/mobile/src/views/Settings/privacy.js@@ -1,34 +1,30 @@-import React, {useCallback, useEffect, useState} from 'react';-import {Platform, View} from 'react-native';-import {enabled} from 'react-native-privacy-snapshot';+import React, { useCallback, useEffect, useState } from 'react';+import { Platform, View } from 'react-native';+import { enabled } from 'react-native-privacy-snapshot';import ToggleSwitch from 'toggle-switch-react-native';import BaseDialog from '../../components/Dialog/base-dialog';import DialogButtons from '../../components/Dialog/dialog-buttons';import DialogContainer from '../../components/Dialog/dialog-container';import DialogHeader from '../../components/Dialog/dialog-header';-import {PressableButton} from '../../components/PressableButton';+import { PressableButton } from '../../components/PressableButton';import Seperator from '../../components/Seperator';import Heading from '../../components/Typography/Heading';import Paragraph from '../../components/Typography/Paragraph';-import {useTracked} from '../../provider';-import {useSettingStore, useUserStore} from '../../provider/stores';+import { useTracked } from '../../provider';+import { useSettingStore, useUserStore } from '../../provider/stores';import BiometricService from '../../services/BiometricService';-import {- eSubscribeEvent,- eUnSubscribeEvent,- openVault-} from '../../services/EventManager';+import { eSubscribeEvent, eUnSubscribeEvent, openVault } from '../../services/EventManager';import PremiumService from '../../services/PremiumService';import SettingsService from '../../services/SettingsService';-import {AndroidModule, InteractionManager} from '../../utils';-import {db} from '../../utils/database';-import {SIZE} from '../../utils/SizeUtils';+import { AndroidModule, InteractionManager } from '../../utils';+import { db } from '../../utils/database';+import { SIZE } from '../../utils/SizeUtils';import { CustomButton } from './button';import SectionHeader from './section-header';const SettingsPrivacyAndSecurity = () => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const settings = useSettingStore(state => state.settings);const [collapsed, setCollapsed] = useState(true);const [appLockVisible, setAppLockVisible] = useState(false);@@ -102,7 +98,8 @@ const SettingsPrivacyAndSecurity = () => {onRequestClose={() => {setAppLockVisible(false);}}- visible={true}>+ visible={true}+ ><DialogContainer height={450}><DialogHeadertitle="App lock mode"@@ -113,14 +110,12 @@ const SettingsPrivacyAndSecurity = () => {<Viewstyle={{paddingHorizontal: 12- }}>+ }}+ >{modes.map(item => (<PressableButton- type={- settings.appLockMode === item.value- ? 'grayBg'- : 'transparent'- }+ key={item.title}+ type={settings.appLockMode === item.value ? 'grayBg' : 'transparent'}onPress={() => {SettingsService.set('appLockMode', item.value);}}@@ -134,25 +129,20 @@ const SettingsPrivacyAndSecurity = () => {}}style={{marginBottom: 10- }}>+ }}+ ><Heading- color={- settings.appLockMode === item.value- ? colors.accent- : colors.pri- }- style={{maxWidth: '95%'}}- size={SIZE.md}>+ color={settings.appLockMode === item.value ? colors.accent : colors.pri}+ style={{ maxWidth: '95%' }}+ size={SIZE.md}+ >{item.title}</Heading><Paragraph- color={- settings.appLockMode === item.value- ? colors.accent- : colors.icon- }- style={{maxWidth: '95%'}}- size={SIZE.sm}>+ color={settings.appLockMode === item.value ? colors.accent : colors.icon}+ style={{ maxWidth: '95%' }}+ size={SIZE.sm}+ >{item.desc}</Paragraph></PressableButton>@@ -169,11 +159,7 @@ const SettingsPrivacyAndSecurity = () => {</BaseDialog>)}- <SectionHeader- collapsed={collapsed}- setCollapsed={setCollapsed}- title="Privacy & security"- />+ <SectionHeader collapsed={collapsed} setCollapsed={setCollapsed} title="Privacy & security" />{collapsed ? null : (<><CustomButton@@ -218,9 +204,7 @@ const SettingsPrivacyAndSecurity = () => {size="small"animationSpeed={150}onToggle={isOn => {- Platform.OS === 'android'- ? AndroidModule.setSecureMode(isOn)- : enabled(true);+ Platform.OS === 'android' ? AndroidModule.setSecureMode(isOn) : enabled(true);SettingsService.set('privacyScreen', isOn);}}/>@@ -300,8 +284,7 @@ const SettingsPrivacyAndSecurity = () => {deleteVault: true,novault: true,title: 'Delete vault',- description:- 'Enter your account password to delete your vault.'+ description: 'Enter your account password to delete your vault.'});}}/>@@ -317,8 +300,7 @@ const SettingsPrivacyAndSecurity = () => {item: {},novault: false,title: 'Create vault',- description:- 'Set a password to create vault and lock notes.'+ description: 'Set a password to create vault and lock notes.'});});}}@@ -330,5 +312,4 @@ const SettingsPrivacyAndSecurity = () => {);};--export default SettingsPrivacyAndSecurity;\ No newline at end of file+export default SettingsPrivacyAndSecurity;diff --git a/apps/mobile/src/views/Settings/sectionheader.js b/apps/mobile/src/views/Settings/sectionheader.jsindex 6f7fb6508..a02d25e05 100644--- a/apps/mobile/src/views/Settings/sectionheader.js+++ b/apps/mobile/src/views/Settings/sectionheader.js@@ -1,7 +1,5 @@import React from 'react';-import {- TouchableOpacity-} from 'react-native';+import { TouchableOpacity } from 'react-native';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';import Heading from '../../components/Typography/Heading';import Paragraph from '../../components/Typography/Paragraph';@@ -9,9 +7,9 @@ import { useTracked } from '../../provider';import layoutmanager from '../../utils/layout-manager';import { SIZE } from '../../utils/SizeUtils';-const SectionHeader = ({title, collapsed, setCollapsed}) => {+const SectionHeader = ({ title, collapsed, setCollapsed }) => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;return (<TouchableOpacity@@ -32,11 +30,10 @@ const SectionHeader = ({title, collapsed, setCollapsed}) => {marginTop: 5,borderBottomWidth: 1,borderBottomColor: colors.nav- }}>+ }}+ >{collapsed ? (- <Paragraph- size={SIZE.md + 1}- color={collapsed ? colors.icon : colors.accent}>+ <Paragraph size={SIZE.md + 1} color={collapsed ? colors.icon : colors.accent}>{title}</Paragraph>) : (diff --git a/apps/mobile/src/views/Settings/usersection.js b/apps/mobile/src/views/Settings/usersection.jsindex 16f8886b0..889d9e799 100644--- a/apps/mobile/src/views/Settings/usersection.js+++ b/apps/mobile/src/views/Settings/usersection.js@@ -1,20 +1,16 @@import dayjs from 'dayjs';import React from 'react';-import {Linking, Platform, View} from 'react-native';+import { Linking, Platform, View } from 'react-native';import * as RNIap from 'react-native-iap';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {Button} from '../../components/Button';+import { Button } from '../../components/Button';import Seperator from '../../components/Seperator';-import {Card} from '../../components/SimpleList/card';+import { Card } from '../../components/SimpleList/card';import Heading from '../../components/Typography/Heading';import Paragraph from '../../components/Typography/Paragraph';-import {useTracked} from '../../provider';-import {useMessageStore, useUserStore} from '../../provider/stores';-import {- eSendEvent,- presentSheet,- ToastEvent-} from '../../services/EventManager';+import { useTracked } from '../../provider';+import { useMessageStore, useUserStore } from '../../provider/stores';+import { eSendEvent, presentSheet, ToastEvent } from '../../services/EventManager';import PremiumService from '../../services/PremiumService';import Sync from '../../services/Sync';import {@@ -28,10 +24,10 @@ import {eOpenPremiumDialog,eOpenRecoveryKeyDialog} from '../../utils/Events';-import {SIZE} from '../../utils/SizeUtils';-import {sleep} from '../../utils/TimeUtils';-import {CustomButton} from './button';-import {verifyUser} from './functions';+import { SIZE } from '../../utils/SizeUtils';+import { sleep } from '../../utils/TimeUtils';+import { CustomButton } from './button';+import { verifyUser } from './functions';const getTimeLeft = t2 => {let daysRemaining = dayjs(t2).diff(dayjs(), 'days');@@ -43,12 +39,11 @@ const getTimeLeft = t2 => {const SettingsUserSection = () => {const [state] = useTracked();- const {colors} = state;+ const { colors } = state;const user = useUserStore(state => state.user);const messageBoardState = useMessageStore(state => state.message);- const subscriptionDaysLeft =- user && getTimeLeft(parseInt(user.subscription?.expiry));+ const subscriptionDaysLeft = user && getTimeLeft(parseInt(user.subscription?.expiry));const isExpired = user && subscriptionDaysLeft.time < 0;const expiryDate = dayjs(user?.subscription?.expiry).format('MMMM D, YYYY');const startDate = dayjs(user?.subscription?.start).format('MMMM D, YYYY');@@ -89,7 +84,8 @@ const SettingsUserSection = () => {paddingHorizontal: 12,marginTop: 15,marginBottom: 15- }}>+ }}+ ><Viewstyle={{alignSelf: 'center',@@ -97,7 +93,8 @@ const SettingsUserSection = () => {paddingVertical: 12,backgroundColor: colors.bg,borderRadius: 5- }}>+ }}+ ><Viewstyle={{justifyContent: 'space-between',@@ -106,13 +103,15 @@ const SettingsUserSection = () => {paddingBottom: 4,borderBottomWidth: 1,borderColor: colors.accent- }}>+ }}+ ><Viewstyle={{flexDirection: 'row',justifyContent: 'center',alignItems: 'center'- }}>+ }}+ ><Viewstyle={{borderWidth: 1,@@ -122,12 +121,9 @@ const SettingsUserSection = () => {height: 20,alignItems: 'center',justifyContent: 'center'- }}>- <Icon- size={SIZE.md}- color={colors.accent}- name="account-outline"- />+ }}+ >+ <Icon size={SIZE.md} color={colors.accent} name="account-outline" /></View><Paragraph@@ -135,7 +131,8 @@ const SettingsUserSection = () => {size={SIZE.sm}style={{marginLeft: 5- }}>+ }}+ >{user?.email}</Paragraph></View>@@ -144,7 +141,8 @@ const SettingsUserSection = () => {borderRadius: 5,padding: 5,paddingVertical: 2.5- }}>+ }}+ ><Heading color={colors.accent} size={SIZE.sm}>{SUBSCRIPTION_STATUS_STRINGS[user.subscription?.type]}</Heading>@@ -160,12 +158,12 @@ const SettingsUserSection = () => {textAlign: 'center'}}color={- (subscriptionDaysLeft.time > 5 &&- !subscriptionDaysLeft.isHour) ||+ (subscriptionDaysLeft.time > 5 && !subscriptionDaysLeft.isHour) ||user.subscription?.type !== 6? colors.accent: colors.red- }>+ }+ >{isExpired? 'Your subscription has ended.': user.subscription?.type === 1@@ -176,7 +174,8 @@ const SettingsUserSection = () => {style={{textAlign: 'center'}}- color={colors.pri}>+ color={colors.pri}+ >{user.subscription?.type === 2? 'You signed up on ' + startDate: user.subscription?.type === 1@@ -209,15 +208,12 @@ const SettingsUserSection = () => {!user.isEmailConfirmed? 'Confirm your email to get 7 days more': user.subscription?.provider === 3 &&- user.subscription?.type ===- SUBSCRIPTION_STATUS.PREMIUM_CANCELLED+ user.subscription?.type === SUBSCRIPTION_STATUS.PREMIUM_CANCELLED? 'Manage subscription from desktop app'- : user.subscription?.type ===- SUBSCRIPTION_STATUS.PREMIUM_CANCELLED &&+ : user.subscription?.type === SUBSCRIPTION_STATUS.PREMIUM_CANCELLED &&Platform.OS === 'android'? `Resubscribe from Google Playstore`- : user.subscription?.type ===- SUBSCRIPTION_STATUS.PREMIUM_EXPIRED+ : user.subscription?.type === SUBSCRIPTION_STATUS.PREMIUM_EXPIRED? `Resubscribe to Notesnook Pro (${PremiumService.getMontlySub().localizedPrice} / mo)`@@ -237,17 +233,11 @@ const SettingsUserSection = () => {user.subscription?.type !== SUBSCRIPTION_STATUS.BASIC &&SUBSCRIPTION_PROVIDER[user?.subscription?.provider] ? (<Button- title={- SUBSCRIPTION_PROVIDER[user?.subscription?.provider]?.title- }+ title={SUBSCRIPTION_PROVIDER[user?.subscription?.provider]?.title}onPress={() => {presentSheet({- title:- SUBSCRIPTION_PROVIDER[user?.subscription?.provider]- .title,- paragraph:- SUBSCRIPTION_PROVIDER[user?.subscription?.provider]- .desc,+ title: SUBSCRIPTION_PROVIDER[user?.subscription?.provider].title,+ paragraph: SUBSCRIPTION_PROVIDER[user?.subscription?.provider].desc});}}style={{@@ -291,11 +281,10 @@ const SettingsUserSection = () => {presentSheet({title: 'Syncing your data',paragraph: 'Please wait while we sync all your data.',- progress:true+ progress: true});await Sync.run('global', true);eSendEvent(eCloseProgressDialog);-},desc: 'Try force sync to resolve issues with syncing.'},@@ -308,9 +297,7 @@ const SettingsUserSection = () => {paragraph: `Please wait while we fetch your subscriptions.`});let subscriptions = await RNIap.getPurchaseHistory();- subscriptions.sort(- (a, b) => b.transactionDate - a.transactionDate- );+ subscriptions.sort((a, b) => b.transactionDate - a.transactionDate);let currentSubscription = subscriptions[0];presentSheet({title: 'Notesnook Pro',@@ -322,13 +309,11 @@ const SettingsUserSection = () => {title: 'Verifying subscription',paragraph: `Please wait while we verify your subscription.`});- await PremiumService.subscriptions.verify(- currentSubscription- );+ await PremiumService.subscriptions.verify(currentSubscription);eSendEvent(eCloseProgressDialog);},icon: 'information-outline',- actionText: 'Verify',+ actionText: 'Verify'});},desc: 'Verify your subscription to Notesnook Pro'diff --git a/apps/mobile/src/views/Tags/index.js b/apps/mobile/src/views/Tags/index.jsindex d77f90a1c..d97d4c1c8 100644--- a/apps/mobile/src/views/Tags/index.js+++ b/apps/mobile/src/views/Tags/index.js@@ -11,9 +11,9 @@ import SearchService from '../../services/SearchService';import { InteractionManager } from '../../utils';import { eScrollEvent } from '../../utils/Events';-export const Tags = ({route, navigation}) => {+export const Tags = ({ route, navigation }) => {const tags = useTagStore(state => state.tags);- const setTags = useTagStore(state =>state.setTags);+ const setTags = useTagStore(state => state.setTags);let ranAfterInteractions = false;const runAfterInteractions = () => {@@ -34,12 +34,12 @@ export const Tags = ({route, navigation}) => {Navigation.setHeaderState('Tags',{- menu: true,+ menu: true},{heading: 'Tags',- id: 'tags_navigation',- },+ id: 'tags_navigation'+ });}, []);@@ -62,7 +62,7 @@ export const Tags = ({route, navigation}) => {placeholder: 'Search in tags',data: tags,type: 'tags',- title: 'Tags',+ title: 'Tags'});};@@ -76,7 +76,7 @@ export const Tags = ({route, navigation}) => {listData={tags}type="tags"headerProps={{- heading: 'Tags',+ heading: 'Tags'}}screen="Tags"focused={() => navigation.isFocused()}@@ -84,7 +84,7 @@ export const Tags = ({route, navigation}) => {heading: 'Your tags',paragraph: 'You have not created any tags for your notes yet.',button: null,- loading: 'Loading your tags.',+ loading: 'Loading your tags.'}}placeholder={<Placeholder type="tags" />}placeholderText="Tags added to notes appear here"diff --git a/apps/mobile/src/views/Trash/index.js b/apps/mobile/src/views/Trash/index.jsindex 2a2173f87..2293c9df2 100644--- a/apps/mobile/src/views/Trash/index.js+++ b/apps/mobile/src/views/Trash/index.js@@ -7,14 +7,13 @@ import { Placeholder } from '../../components/ListPlaceholders';import SelectionHeader from '../../components/SelectionHeader';import SimpleList from '../../components/SimpleList';import { useSelectionStore, useTrashStore } from '../../provider/stores';-import { eSendEvent, ToastEvent } from '../../services/EventManager';+import { ToastEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';import SearchService from '../../services/SearchService';import { InteractionManager } from '../../utils';import { db } from '../../utils/database';-import { eScrollEvent } from '../../utils/Events';-export const Trash = ({route, navigation}) => {+export const Trash = ({ route, navigation }) => {const trash = useTrashStore(state => state.trash);const setTrash = useTrashStore(state => state.setTrash);let pageIsLoaded = false;@@ -46,12 +45,12 @@ export const Trash = ({route, navigation}) => {Navigation.setHeaderState('Trash',{- menu: true,+ menu: true},{heading: 'Trash',- id: 'trash_navigation',- },+ id: 'trash_navigation'+ });}, []);@@ -79,7 +78,7 @@ export const Trash = ({route, navigation}) => {placeholder: 'Search in trash',data: trash,type: 'trash',- title: 'Trash',+ title: 'Trash'});};@@ -95,13 +94,12 @@ export const Trash = ({route, navigation}) => {useSelectionStore.getState().clearSelection(true);ToastEvent.show({heading: 'Trash cleared',- message:- 'All notes and notebooks in the trash have been removed permanantly.',+ message: 'All notes and notebooks in the trash have been removed permanantly.',type: 'success',- context: 'local',+ context: 'local'});},- positiveType: 'errorShade',+ positiveType: 'errorShade'});};@@ -109,12 +107,7 @@ export const Trash = ({route, navigation}) => {<><SelectionHeader screen="Trash" /><ContainerTopSection>- <Header- title="Trash"- isBack={false}- screen="Trash"- action={_onPressBottomButton}- />+ <Header title="Trash" isBack={false} screen="Trash" action={_onPressBottomButton} /></ContainerTopSection><SimpleListlistData={trash}@@ -123,13 +116,12 @@ export const Trash = ({route, navigation}) => {focused={() => navigation.isFocused()}placeholderData={{heading: 'Trash',- paragraph:- 'Items in the trash will be permanently deleted after 7 days.',+ paragraph: 'Items in the trash will be permanently deleted after 7 days.',button: null,- loading: 'Loading trash items',+ loading: 'Loading trash items'}}headerProps={{- heading: 'Trash',+ heading: 'Trash'}}placeholder={<Placeholder type="trash" />}placeholderText="Deleted notes & notebooks appear here."