mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-08-29 10:09:26 +02:00
Compare commits
1074 Commits
2.2.0-andr
...
fix/sync-q
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2febd09613 | ||
|
|
91138f4911 | ||
|
|
f9bcfe2f7a | ||
|
|
3621f95dbc | ||
|
|
536dead44d | ||
|
|
39d74e80a9 | ||
|
|
46e03dd248 | ||
|
|
152fee2c29 | ||
|
|
492a4d16b2 | ||
|
|
3d7c1fa1e7 | ||
|
|
8a138d960d | ||
|
|
69bb0e3656 | ||
|
|
4875cfa108 | ||
|
|
a28beb62c6 | ||
|
|
21c8960146 | ||
|
|
59442b9107 | ||
|
|
2ba638b123 | ||
|
|
8548940cb9 | ||
|
|
909bdfa0cf | ||
|
|
bfb3c56abe | ||
|
|
e06836f701 | ||
|
|
bc16cb79f2 | ||
|
|
176c46e3f2 | ||
|
|
af65055ce9 | ||
|
|
ad23ff19de | ||
|
|
cf65fc4f57 | ||
|
|
9ab83e7fbb | ||
|
|
1acf2aadba | ||
|
|
06833bcac9 | ||
|
|
3bf6b5293a | ||
|
|
c40d33df37 | ||
|
|
fe609f8275 | ||
|
|
3566f47f2d | ||
|
|
4b5526dffd | ||
|
|
4977390394 | ||
|
|
87804de452 | ||
|
|
bc55d2b476 | ||
|
|
3ff34a5c82 | ||
|
|
7e01e90e22 | ||
|
|
d568be6536 | ||
|
|
734e79604f | ||
|
|
227a962042 | ||
|
|
a1640175e5 | ||
|
|
7cf61570ef | ||
|
|
83762c668e | ||
|
|
ecd4a08b1c | ||
|
|
7b66462300 | ||
|
|
41639fd325 | ||
|
|
2fe82841ef | ||
|
|
9b7af87611 | ||
|
|
d99ccbc243 | ||
|
|
0f191eba5c | ||
|
|
26657c7ee3 | ||
|
|
a12749eb82 | ||
|
|
1a56d38116 | ||
|
|
0b9025af11 | ||
|
|
6f5a44cd11 | ||
|
|
5e1cc307b1 | ||
|
|
2197f1ec5e | ||
|
|
1da5fd3661 | ||
|
|
49e79b52b2 | ||
|
|
c9a657298c | ||
|
|
cfd7caf16c | ||
|
|
9744679550 | ||
|
|
9cdc502ce5 | ||
|
|
300a104949 | ||
|
|
efad6520a2 | ||
|
|
cc58351731 | ||
|
|
cf2f4c4bbb | ||
|
|
cc161b844c | ||
|
|
45ebf0670f | ||
|
|
9cfaa90232 | ||
|
|
edf4a248ed | ||
|
|
14d7ec6b4e | ||
|
|
cd2ca94c3d | ||
|
|
f1609aaa46 | ||
|
|
851364c0bf | ||
|
|
913a1743b5 | ||
|
|
dc5572d4b9 | ||
|
|
554560903c | ||
|
|
885e4a325c | ||
|
|
156ce7e711 | ||
|
|
71ecc05bd6 | ||
|
|
98b93d42c1 | ||
|
|
2e7935cacc | ||
|
|
50d64af7f6 | ||
|
|
e452fd3d2f | ||
|
|
64dd481402 | ||
|
|
28f647fa06 | ||
|
|
9eb1061cd1 | ||
|
|
3cab264213 | ||
|
|
fb56e7c866 | ||
|
|
234e368c4d | ||
|
|
4de4693505 | ||
|
|
5563c7d5f8 | ||
|
|
93225e5a30 | ||
|
|
0ab9846732 | ||
|
|
f6f1cf0ae7 | ||
|
|
69615d54db | ||
|
|
a990d0f404 | ||
|
|
4aeff48e74 | ||
|
|
78c1a75ec9 | ||
|
|
9e6664a80e | ||
|
|
b306a09747 | ||
|
|
fab52012ad | ||
|
|
fc39c714b6 | ||
|
|
5fff4bbb0e | ||
|
|
0a29571ad8 | ||
|
|
275fa1b3ca | ||
|
|
79889665e5 | ||
|
|
9888ad327c | ||
|
|
77ab2d7740 | ||
|
|
509dc4b541 | ||
|
|
ff84ee2d42 | ||
|
|
d838c2e8ad | ||
|
|
28d718acf6 | ||
|
|
adf546f29c | ||
|
|
b18cf277f6 | ||
|
|
8ab26eb852 | ||
|
|
aac43274a0 | ||
|
|
2fb2c4247a | ||
|
|
cb1d32d177 | ||
|
|
75e1985a6f | ||
|
|
0093b39f64 | ||
|
|
d19c2ef735 | ||
|
|
db527cfbf3 | ||
|
|
7da8ddb24f | ||
|
|
5d401ac9ac | ||
|
|
9605eafa00 | ||
|
|
783460c685 | ||
|
|
af906d8ace | ||
|
|
fca26a8793 | ||
|
|
27863def9c | ||
|
|
f1d4fd1d5d | ||
|
|
61b7e43d08 | ||
|
|
87ebe1918c | ||
|
|
4c5253c267 | ||
|
|
f5be8a0c86 | ||
|
|
5392582819 | ||
|
|
651ae4cdaa | ||
|
|
d87b5c5386 | ||
|
|
d5331b1997 | ||
|
|
0a6f8fa18e | ||
|
|
c1ba16eb80 | ||
|
|
0cd01b25bd | ||
|
|
f0c1300ec8 | ||
|
|
70eee2a224 | ||
|
|
42470d1d67 | ||
|
|
7fc58a3fa5 | ||
|
|
e186037c03 | ||
|
|
732a0ffea4 | ||
|
|
89f2e9fde1 | ||
|
|
c369541a7f | ||
|
|
0b7a157ab1 | ||
|
|
9b86c6ebb7 | ||
|
|
22cd07e414 | ||
|
|
47f919cb61 | ||
|
|
5b3c889b7c | ||
|
|
77ac53215c | ||
|
|
167c7125d2 | ||
|
|
ba56fd0279 | ||
|
|
8e795b729a | ||
|
|
a4eb597f35 | ||
|
|
0aeade69da | ||
|
|
90a3bd3307 | ||
|
|
7a61e3558e | ||
|
|
dd9c555bff | ||
|
|
50f84780bb | ||
|
|
e12372364d | ||
|
|
969611c9e6 | ||
|
|
06399fe3bd | ||
|
|
35c5a90b4e | ||
|
|
3c70cccd14 | ||
|
|
a3c24bc666 | ||
|
|
16b00d21a6 | ||
|
|
88f90c6240 | ||
|
|
a5c44dcb3b | ||
|
|
c0a2dd139a | ||
|
|
b354a26f0a | ||
|
|
b3de1205d9 | ||
|
|
f18e8ae421 | ||
|
|
a46b863802 | ||
|
|
2befa03cd2 | ||
|
|
763a108abb | ||
|
|
30a069c845 | ||
|
|
ffbf5cdc88 | ||
|
|
4318a65a99 | ||
|
|
bc433c56ae | ||
|
|
e43740c6bc | ||
|
|
6123bccf4b | ||
|
|
08106c20e8 | ||
|
|
eaaecbd5e5 | ||
|
|
29608099db | ||
|
|
7a773937c2 | ||
|
|
fa4a298bfa | ||
|
|
966bedbb49 | ||
|
|
159b6f3ca6 | ||
|
|
de1b0fc466 | ||
|
|
b6a3394dee | ||
|
|
f5ac51db13 | ||
|
|
df94f31998 | ||
|
|
1ec0b65fe8 | ||
|
|
d9a77ff658 | ||
|
|
c45118515c | ||
|
|
f9b8865351 | ||
|
|
1e92b3fc92 | ||
|
|
f34fb858ec | ||
|
|
1fdede5518 | ||
|
|
a454ec4944 | ||
|
|
5afbf103ac | ||
|
|
2ef1b76bfb | ||
|
|
f7d06d3b82 | ||
|
|
e405468471 | ||
|
|
9d2bacdc5f | ||
|
|
b44d4702be | ||
|
|
03803dbc23 | ||
|
|
9ea675ded1 | ||
|
|
c85d623e1c | ||
|
|
e6f1320b1d | ||
|
|
80f49e22e5 | ||
|
|
4884c27a9a | ||
|
|
4976a4dab4 | ||
|
|
5eb0b5faa7 | ||
|
|
5e33cb93c6 | ||
|
|
b4220d349f | ||
|
|
d4752685d0 | ||
|
|
0b06d2a4bd | ||
|
|
a37d9a193f | ||
|
|
b1d465e8bf | ||
|
|
31e17c305f | ||
|
|
72db8724ec | ||
|
|
b64cb22186 | ||
|
|
f5ca1220de | ||
|
|
fb54125ee6 | ||
|
|
be957d058f | ||
|
|
54a3e3c927 | ||
|
|
aabbf7c1c1 | ||
|
|
7773ba0804 | ||
|
|
9f812772fe | ||
|
|
75191afc3e | ||
|
|
1c25baccea | ||
|
|
b1d4ccc27e | ||
|
|
0d714847f3 | ||
|
|
760d4abbd0 | ||
|
|
7c1bb33ea9 | ||
|
|
5ba8ce549e | ||
|
|
a449c614ee | ||
|
|
12e6688f48 | ||
|
|
da47ef159b | ||
|
|
efc678d3cd | ||
|
|
d7a126ab85 | ||
|
|
bc9c976c95 | ||
|
|
26af23771d | ||
|
|
590f2d80d3 | ||
|
|
fdeb34ff0a | ||
|
|
ec76be776c | ||
|
|
4de5691428 | ||
|
|
ae5b339251 | ||
|
|
a6021943e1 | ||
|
|
765fcafc38 | ||
|
|
7a53881eb3 | ||
|
|
854f22f373 | ||
|
|
0566f98323 | ||
|
|
435a358c4c | ||
|
|
3f55422d45 | ||
|
|
9804c1fbb1 | ||
|
|
c3b8c4b630 | ||
|
|
8c4d8622d8 | ||
|
|
86770b32bb | ||
|
|
74c86c1e5f | ||
|
|
1538b74c63 | ||
|
|
5934c518e6 | ||
|
|
71dfd0cf9a | ||
|
|
984bf1f15f | ||
|
|
a14949b75a | ||
|
|
7bbe138d91 | ||
|
|
65dea70ae5 | ||
|
|
a07c8b9e11 | ||
|
|
69b82c61f8 | ||
|
|
fb8df74242 | ||
|
|
3674594832 | ||
|
|
1ee24cde07 | ||
|
|
93baed35f4 | ||
|
|
3e1420d496 | ||
|
|
ebc4324ef1 | ||
|
|
6ba04f4731 | ||
|
|
7359e23b65 | ||
|
|
01387bae94 | ||
|
|
df1d61ecdf | ||
|
|
cb644dbea6 | ||
|
|
fc5ea0ad51 | ||
|
|
8108dbae8a | ||
|
|
b14a9d6eca | ||
|
|
2f4a7f5410 | ||
|
|
dfa718f8ea | ||
|
|
f842700192 | ||
|
|
953d0295dc | ||
|
|
836f607aa0 | ||
|
|
2c6f205ea9 | ||
|
|
8154dd1830 | ||
|
|
686674c855 | ||
|
|
8e5d931be1 | ||
|
|
46509a04b0 | ||
|
|
d6e189134c | ||
|
|
0a05780e4d | ||
|
|
1671c99614 | ||
|
|
b5c8afe8f7 | ||
|
|
7e4ab8e14b | ||
|
|
35210ad02b | ||
|
|
9f853f0b36 | ||
|
|
559698c946 | ||
|
|
50c05efb48 | ||
|
|
94b9d3590d | ||
|
|
092016f942 | ||
|
|
24c899e709 | ||
|
|
e53cc648f0 | ||
|
|
4c541f3995 | ||
|
|
f56cbfc142 | ||
|
|
c21c4f1117 | ||
|
|
abf1f5c61c | ||
|
|
1d5b0793d0 | ||
|
|
5ba72fdbd4 | ||
|
|
c7d26d2444 | ||
|
|
22c146e350 | ||
|
|
1cb0ebd4f8 | ||
|
|
eff2e475ff | ||
|
|
aef475d8fc | ||
|
|
1ed2e55867 | ||
|
|
16ffec1f1e | ||
|
|
912e97dc3c | ||
|
|
ca2f924417 | ||
|
|
468fba8fcf | ||
|
|
b948dcee22 | ||
|
|
a633f4a3fe | ||
|
|
acb384c901 | ||
|
|
043228fe47 | ||
|
|
f29e7936d1 | ||
|
|
d4a7b8d9c9 | ||
|
|
fbabfe468a | ||
|
|
87c7eccee4 | ||
|
|
648eac5555 | ||
|
|
fe8ba8ca90 | ||
|
|
8fa4b5017c | ||
|
|
d2f39df3bf | ||
|
|
2ada289e74 | ||
|
|
1edf416461 | ||
|
|
6fae73b612 | ||
|
|
ec898748b1 | ||
|
|
5be67823ce | ||
|
|
fd868aec95 | ||
|
|
33bf5e26ff | ||
|
|
08363f95e0 | ||
|
|
dc62291fba | ||
|
|
43034cf3a3 | ||
|
|
88f047c312 | ||
|
|
46a635d4f4 | ||
|
|
882217be63 | ||
|
|
87a2650480 | ||
|
|
c41806bd70 | ||
|
|
ae7a6ba88c | ||
|
|
df78b31527 | ||
|
|
4040c62dda | ||
|
|
34bf9d5b45 | ||
|
|
80cd37fe4f | ||
|
|
21a7dbad53 | ||
|
|
c2b010d057 | ||
|
|
82b01851c7 | ||
|
|
0a81f0a09a | ||
|
|
e06cbb39b0 | ||
|
|
b52cc0c590 | ||
|
|
82376c8c47 | ||
|
|
e0b191b9a0 | ||
|
|
6ef6259629 | ||
|
|
52d08f9392 | ||
|
|
6812d3552a | ||
|
|
68ebb132cd | ||
|
|
203aa4824d | ||
|
|
047707dd35 | ||
|
|
7c7645c0c6 | ||
|
|
2d4ca15e10 | ||
|
|
9ca831713c | ||
|
|
56008c15c5 | ||
|
|
2a2811ec54 | ||
|
|
bb0c48f26a | ||
|
|
2f815fcec3 | ||
|
|
cc446f99ee | ||
|
|
9e83e67a0b | ||
|
|
bf589da7b8 | ||
|
|
21b278d42e | ||
|
|
2cd6a397dc | ||
|
|
b3aa56736e | ||
|
|
e52b72b0c6 | ||
|
|
6fa82bbe2e | ||
|
|
6b3c628e6b | ||
|
|
39e14d059e | ||
|
|
494d6633b5 | ||
|
|
690d405103 | ||
|
|
6a05048aed | ||
|
|
f75c010ecb | ||
|
|
f2c0c34c10 | ||
|
|
512517cc64 | ||
|
|
74f1d3cb74 | ||
|
|
f99cbd011a | ||
|
|
18d80cde42 | ||
|
|
6f2127abb8 | ||
|
|
cb1c023815 | ||
|
|
a9a6a00f87 | ||
|
|
060952697a | ||
|
|
a0579278c9 | ||
|
|
678684e24b | ||
|
|
27e3d18987 | ||
|
|
7ffe7f1a0c | ||
|
|
03c037da97 | ||
|
|
b7f035b78e | ||
|
|
66fe109eb9 | ||
|
|
f62cd63fbb | ||
|
|
e1e980cbb2 | ||
|
|
ca5543d6ea | ||
|
|
05cec14c9b | ||
|
|
1123fe0383 | ||
|
|
5855fe34ee | ||
|
|
030e57d0a9 | ||
|
|
b6f922eb92 | ||
|
|
2ab756a847 | ||
|
|
3611bba1d4 | ||
|
|
e07f32fb98 | ||
|
|
5ba065c8f1 | ||
|
|
1fb7541d14 | ||
|
|
0dc0ba21f9 | ||
|
|
e34f1f0b45 | ||
|
|
604d98f772 | ||
|
|
40eb2d083d | ||
|
|
3bca1ca795 | ||
|
|
ae4afd5154 | ||
|
|
27e732665a | ||
|
|
6415e89df9 | ||
|
|
4ef8785489 | ||
|
|
b7af3d92c9 | ||
|
|
82a80269d3 | ||
|
|
6112eedcc4 | ||
|
|
001bdc1dc9 | ||
|
|
fb2de4245d | ||
|
|
9164d8f138 | ||
|
|
fbcfbfc12c | ||
|
|
fb8e3a2364 | ||
|
|
375ef1c06d | ||
|
|
a064254bcf | ||
|
|
95cf31703a | ||
|
|
ff995c8d60 | ||
|
|
1f7b8ce1ed | ||
|
|
f2608a1a8d | ||
|
|
4e858f3230 | ||
|
|
ba7daf9766 | ||
|
|
d2fcd61541 | ||
|
|
417be8dbf0 | ||
|
|
9b145d15af | ||
|
|
6b9596d0d1 | ||
|
|
fa1ad69be7 | ||
|
|
1f29273561 | ||
|
|
4c21d781c4 | ||
|
|
746fc2963e | ||
|
|
289ef2a324 | ||
|
|
91eaf1c71e | ||
|
|
c22bedbfcf | ||
|
|
ef104e4126 | ||
|
|
0d884aa161 | ||
|
|
192fa8fc24 | ||
|
|
0ae24d12d8 | ||
|
|
6ecf2c8ac3 | ||
|
|
da7267de43 | ||
|
|
f134184a43 | ||
|
|
650a34ca73 | ||
|
|
009afcd6aa | ||
|
|
05f71f39a1 | ||
|
|
d3a3dc9200 | ||
|
|
9df44b1f3d | ||
|
|
964180a183 | ||
|
|
4ef51f4d8f | ||
|
|
ee39d940be | ||
|
|
db60299c54 | ||
|
|
7d3c31efc1 | ||
|
|
9e68ccb5a8 | ||
|
|
f05fc861d5 | ||
|
|
085408e5a3 | ||
|
|
6442a08d6f | ||
|
|
f58239e102 | ||
|
|
f4952aa770 | ||
|
|
5747253400 | ||
|
|
57c45a049f | ||
|
|
b3516310b0 | ||
|
|
9438c3ed46 | ||
|
|
35d36d3ec6 | ||
|
|
d852b5c9db | ||
|
|
bbb40a2842 | ||
|
|
e46963512e | ||
|
|
1ca5511e78 | ||
|
|
b6e368d730 | ||
|
|
94dfee53bc | ||
|
|
8996708164 | ||
|
|
b1f79e338f | ||
|
|
40387ca082 | ||
|
|
b02941d5aa | ||
|
|
fad31fbeb3 | ||
|
|
ca08fc0e9d | ||
|
|
7df64837fe | ||
|
|
fa70df366c | ||
|
|
70d4e99dc1 | ||
|
|
49272212bc | ||
|
|
736b2a17e9 | ||
|
|
ade420cf87 | ||
|
|
96ed46bd4a | ||
|
|
e334698e3b | ||
|
|
82d97f019d | ||
|
|
fb56206537 | ||
|
|
22fff296b5 | ||
|
|
954cb1da0d | ||
|
|
8c25de2aaf | ||
|
|
b362dca795 | ||
|
|
45c6daabe7 | ||
|
|
43c5c67bfa | ||
|
|
dde276f77e | ||
|
|
60ba6ba6cf | ||
|
|
f7a0938c38 | ||
|
|
4805e54ef3 | ||
|
|
a67599ce83 | ||
|
|
cd9867273f | ||
|
|
a0898d9223 | ||
|
|
11514051b6 | ||
|
|
0a1059e0a4 | ||
|
|
95ee494612 | ||
|
|
5c8c6f83b9 | ||
|
|
f1a7cd63a8 | ||
|
|
8b524319df | ||
|
|
06aff69adb | ||
|
|
cc39fac590 | ||
|
|
8385bd41ea | ||
|
|
77a3b771c0 | ||
|
|
aec1d601a3 | ||
|
|
7f69c5b268 | ||
|
|
215a692139 | ||
|
|
f1b986cef9 | ||
|
|
da0f86c006 | ||
|
|
0a4e84b376 | ||
|
|
f1f8a35ea5 | ||
|
|
1ffb6b3c57 | ||
|
|
0d3504dca0 | ||
|
|
0f8f53d811 | ||
|
|
85aae88300 | ||
|
|
fc69b5ffd0 | ||
|
|
a7369bf869 | ||
|
|
2da32e27ff | ||
|
|
3e71ad0b0b | ||
|
|
a62ca2aada | ||
|
|
ffacb8818c | ||
|
|
7be867c7ca | ||
|
|
29f3dafc4f | ||
|
|
cfa35bbccd | ||
|
|
0a6cc165dc | ||
|
|
c5489e3c4a | ||
|
|
0ea5bd297c | ||
|
|
9116a24392 | ||
|
|
86fc16a8d0 | ||
|
|
62d3ead9a8 | ||
|
|
525828d6e0 | ||
|
|
6b71509b74 | ||
|
|
9e382b1d04 | ||
|
|
744d3c2312 | ||
|
|
e426d9d160 | ||
|
|
ba9b671f33 | ||
|
|
90cdd5f253 | ||
|
|
24b0f322c6 | ||
|
|
a8a031a161 | ||
|
|
b66741910f | ||
|
|
6ffa192f08 | ||
|
|
c80def5d95 | ||
|
|
63cf160cea | ||
|
|
7a40db9a36 | ||
|
|
edd7431de1 | ||
|
|
eb7c0cc049 | ||
|
|
51d130e3c3 | ||
|
|
241c914800 | ||
|
|
f254fc5c58 | ||
|
|
a74b910478 | ||
|
|
7f30fe6ff9 | ||
|
|
c6efa3ba6c | ||
|
|
020e41b3db | ||
|
|
7e9dc0e55c | ||
|
|
d1072059c5 | ||
|
|
388570ca8e | ||
|
|
1fa0203651 | ||
|
|
4dbd49d612 | ||
|
|
59a25610e3 | ||
|
|
a84611d5ee | ||
|
|
44827a1f1a | ||
|
|
66203afc92 | ||
|
|
127c4cd537 | ||
|
|
15ed1b498a | ||
|
|
d5793e9e4e | ||
|
|
e34114a3c4 | ||
|
|
961b953f5a | ||
|
|
e9a5f752a4 | ||
|
|
370ba5420a | ||
|
|
b3c4dbb910 | ||
|
|
4ed378bc9c | ||
|
|
39c234c698 | ||
|
|
00837a6790 | ||
|
|
f3f735392b | ||
|
|
b7dc9646f6 | ||
|
|
30a5882b9c | ||
|
|
7449181d86 | ||
|
|
68196b2d99 | ||
|
|
53116a6b2f | ||
|
|
31479943bb | ||
|
|
7b2de009a7 | ||
|
|
3746ebd0be | ||
|
|
2db03ed2d7 | ||
|
|
0f5786d7d7 | ||
|
|
2097e5777b | ||
|
|
1c0b8e9115 | ||
|
|
117303c471 | ||
|
|
b536e62533 | ||
|
|
9353b7b39d | ||
|
|
1799404c01 | ||
|
|
144e992eca | ||
|
|
373fa02280 | ||
|
|
1c66266f2d | ||
|
|
ce3e1cdd36 | ||
|
|
4ee9593bac | ||
|
|
5409ac666e | ||
|
|
18da6cfc43 | ||
|
|
c75f750215 | ||
|
|
e2f2f0866d | ||
|
|
6583ea6a47 | ||
|
|
25ae32028b | ||
|
|
e08a6db184 | ||
|
|
95e1daf7f7 | ||
|
|
165862db06 | ||
|
|
b7bce0d8cd | ||
|
|
4daca499d6 | ||
|
|
21bd6ffbd9 | ||
|
|
80f5ecb276 | ||
|
|
39cc58480c | ||
|
|
3be7a53668 | ||
|
|
54d65beae3 | ||
|
|
8e6bbb9227 | ||
|
|
a1440fd64c | ||
|
|
b0417387b4 | ||
|
|
cc3618cb02 | ||
|
|
9f832ce25d | ||
|
|
343da60428 | ||
|
|
5f3c89a93a | ||
|
|
9fb24748c9 | ||
|
|
6ff2f5c423 | ||
|
|
b439571e17 | ||
|
|
1b471a2fda | ||
|
|
2ce30b71c7 | ||
|
|
91ae351129 | ||
|
|
2966962016 | ||
|
|
3c38c61437 | ||
|
|
8edd1af18c | ||
|
|
4b65c546f2 | ||
|
|
defc640293 | ||
|
|
7e3d889632 | ||
|
|
fa24565e25 | ||
|
|
966130dc52 | ||
|
|
6ba3732327 | ||
|
|
c0bc786669 | ||
|
|
646dbfef6e | ||
|
|
3ea0faa7df | ||
|
|
e9fbf17b40 | ||
|
|
5c7e776dce | ||
|
|
0db0070aeb | ||
|
|
774cc6f953 | ||
|
|
abe1598910 | ||
|
|
4fe2f91175 | ||
|
|
eb526063c3 | ||
|
|
08e5c285e0 | ||
|
|
05cd7e5002 | ||
|
|
a0ad4403cb | ||
|
|
d0ddaeba73 | ||
|
|
06ad68975f | ||
|
|
c37aec07bb | ||
|
|
1fc0fd5694 | ||
|
|
9aad63a623 | ||
|
|
22871d8baf | ||
|
|
65cae7888e | ||
|
|
6718be881b | ||
|
|
d10c1eb8b7 | ||
|
|
3ef8e1bab1 | ||
|
|
ec699e8ef4 | ||
|
|
206b72a5f8 | ||
|
|
dd2a27337f | ||
|
|
e43ee80fdb | ||
|
|
04fe4a7217 | ||
|
|
a46857974c | ||
|
|
4a826cfaea | ||
|
|
8c87d00102 | ||
|
|
3fd1898422 | ||
|
|
12d1b3fcc9 | ||
|
|
e3f35ac567 | ||
|
|
47feaeeac1 | ||
|
|
377bd6e510 | ||
|
|
c150006ba2 | ||
|
|
9b747d1d2b | ||
|
|
fbfcfe1bcb | ||
|
|
360b94353a | ||
|
|
19227cf51b | ||
|
|
c6297227bf | ||
|
|
99d3b7300c | ||
|
|
b77254a045 | ||
|
|
1ef4dcb52c | ||
|
|
e4ba2acd99 | ||
|
|
fcc39034c4 | ||
|
|
352639da24 | ||
|
|
b65a372192 | ||
|
|
631142f852 | ||
|
|
19f0ee97f2 | ||
|
|
c8601c88a7 | ||
|
|
a8f0724b0f | ||
|
|
6a7d11c331 | ||
|
|
e2263701d3 | ||
|
|
d88fe47c55 | ||
|
|
f78d0cda1d | ||
|
|
7bde09c5d7 | ||
|
|
0fe0a4dc0b | ||
|
|
6e1db2ea33 | ||
|
|
d0991ae96b | ||
|
|
40e28f3ed4 | ||
|
|
87ba9ae027 | ||
|
|
8c8be28363 | ||
|
|
d4ec67ee21 | ||
|
|
26ec8551f9 | ||
|
|
484bc02a28 | ||
|
|
07ebbf622d | ||
|
|
2467b57a2e | ||
|
|
7375ce55b9 | ||
|
|
de9566dc75 | ||
|
|
b9a833cc8d | ||
|
|
febf742ea2 | ||
|
|
b7ebbfda1d | ||
|
|
6bd67d2599 | ||
|
|
32467c36af | ||
|
|
7ac8b478ed | ||
|
|
0398e99cdf | ||
|
|
79be55ab44 | ||
|
|
23fbf5ae15 | ||
|
|
225a671cab | ||
|
|
8e53e61db6 | ||
|
|
99ac6ec58f | ||
|
|
08ad464310 | ||
|
|
28a115ab04 | ||
|
|
a2c875acca | ||
|
|
c06f3ed351 | ||
|
|
26cbf6a522 | ||
|
|
54f9e27ef3 | ||
|
|
38a34857db | ||
|
|
3702bb0186 | ||
|
|
0dec8b5af4 | ||
|
|
946fd3fc1d | ||
|
|
baa06ebd6e | ||
|
|
a8f1fbf6a1 | ||
|
|
657fe05464 | ||
|
|
e7d0c956bc | ||
|
|
30cad32e26 | ||
|
|
ab9538c81e | ||
|
|
fc634f15bb | ||
|
|
e07a2c4984 | ||
|
|
4374af79bc | ||
|
|
5a540362c0 | ||
|
|
2beccd6918 | ||
|
|
d4a3b53c1b | ||
|
|
947b2099a1 | ||
|
|
c0212c64bc | ||
|
|
d291a536a6 | ||
|
|
cf918ba459 | ||
|
|
c3aa2dd62b | ||
|
|
5c8cf1beb5 | ||
|
|
2f92bf0de8 | ||
|
|
088235a46d | ||
|
|
2845cb19d6 | ||
|
|
db4126fe16 | ||
|
|
4eed06c91f | ||
|
|
00da012b3f | ||
|
|
db2041a15d | ||
|
|
5971253728 | ||
|
|
19a5e78495 | ||
|
|
919e46aea8 | ||
|
|
7b7fd62047 | ||
|
|
e71447c19d | ||
|
|
c28ef94cf1 | ||
|
|
4ac9bb2d9b | ||
|
|
433749d3fa | ||
|
|
92b1ebe744 | ||
|
|
3be4705be3 | ||
|
|
f83d6c2d37 | ||
|
|
2c8d6d115c | ||
|
|
29b9c897c4 | ||
|
|
85ada72054 | ||
|
|
64bf627462 | ||
|
|
eaace54154 | ||
|
|
003178ba20 | ||
|
|
56837208d1 | ||
|
|
f6493692e4 | ||
|
|
6269a8415b | ||
|
|
3d065f2278 | ||
|
|
64e8f8b9a9 | ||
|
|
9af102451d | ||
|
|
31d0164ba8 | ||
|
|
1a40c8ec77 | ||
|
|
c1674b6f05 | ||
|
|
c5faf62398 | ||
|
|
58a17f620b | ||
|
|
47dcbba522 | ||
|
|
7cd6a6e9ee | ||
|
|
e17bd79004 | ||
|
|
2fdbc9cb1d | ||
|
|
f7cc2d61b6 | ||
|
|
ad91da9f2d | ||
|
|
3037cf8cfb | ||
|
|
aa0bf3b3dc | ||
|
|
96a3d8edac | ||
|
|
611c229ece | ||
|
|
4b6880303c | ||
|
|
44a081fa54 | ||
|
|
7bf01535c8 | ||
|
|
b7b6f604eb | ||
|
|
6b601afe0f | ||
|
|
b65761f9da | ||
|
|
fcfe9ff23b | ||
|
|
a19fa2212a | ||
|
|
5445ee0335 | ||
|
|
d2f65c435d | ||
|
|
bbe21eb7db | ||
|
|
d39426a57a | ||
|
|
f43715cd24 | ||
|
|
503b5922e9 | ||
|
|
58319c27f5 | ||
|
|
f1a2afd9d6 | ||
|
|
8bc58b7869 | ||
|
|
dd0b0f4243 | ||
|
|
1f61742786 | ||
|
|
95dd84695b | ||
|
|
1500d50ba9 | ||
|
|
c206377198 | ||
|
|
7b5923ebc5 | ||
|
|
064b6fb9dc | ||
|
|
b101f42ff0 | ||
|
|
1b13e055d1 | ||
|
|
3c378809d0 | ||
|
|
c5fcc7e962 | ||
|
|
77c9db0faa | ||
|
|
ea07672a2d | ||
|
|
222fc00bd7 | ||
|
|
ae8c220119 | ||
|
|
0e96769e93 | ||
|
|
77c0f63dfd | ||
|
|
3f4021ea44 | ||
|
|
c52d5ad176 | ||
|
|
fbb8652946 | ||
|
|
4f8c2fa37a | ||
|
|
ea405393fd | ||
|
|
5e6caa7273 | ||
|
|
b1f5ffc2ec | ||
|
|
8af8b69cbf | ||
|
|
0c0dff3b28 | ||
|
|
3ab6c4646c | ||
|
|
98dfe30099 | ||
|
|
b0438bf71e | ||
|
|
2130c8a806 | ||
|
|
7c626aca18 | ||
|
|
30662f147a | ||
|
|
846adea92e | ||
|
|
f5a7beef17 | ||
|
|
82b584b3d1 | ||
|
|
68c79bcdd5 | ||
|
|
fe4a16f182 | ||
|
|
a70961b662 | ||
|
|
d14be59204 | ||
|
|
c3965a3b0e | ||
|
|
808270d2ef | ||
|
|
a8a8080835 | ||
|
|
3906de0715 | ||
|
|
0691e71227 | ||
|
|
d372c2daf9 | ||
|
|
b11387b385 | ||
|
|
8f5ebe315e | ||
|
|
8ae4ad6126 | ||
|
|
1823a4f4ba | ||
|
|
fa6e88a0b0 | ||
|
|
eacbbe2ad8 | ||
|
|
b2b64a172f | ||
|
|
84a687d69d | ||
|
|
860e97c97d | ||
|
|
4c6c42c794 | ||
|
|
205373dca3 | ||
|
|
349cd27650 | ||
|
|
fedfab094c | ||
|
|
f62c045350 | ||
|
|
a973a5cdf0 | ||
|
|
545c78361b | ||
|
|
d7a80c631b | ||
|
|
a650b8c2d9 | ||
|
|
59e8de0f29 | ||
|
|
0d58a9288d | ||
|
|
a6b8db0466 | ||
|
|
b7d51a6144 | ||
|
|
62b93fa5b3 | ||
|
|
9489d73221 | ||
|
|
8f2f0b1db1 | ||
|
|
316b2948b1 | ||
|
|
65aa53abdf | ||
|
|
a575705f57 | ||
|
|
cded505ec6 | ||
|
|
12202f74a7 | ||
|
|
79e9ab2827 | ||
|
|
7605c4fcb1 | ||
|
|
c9450ea141 | ||
|
|
38fed25e30 | ||
|
|
082b9755db | ||
|
|
e37b57b64b | ||
|
|
9f25d623bb | ||
|
|
a85518d497 | ||
|
|
54bf4f2855 | ||
|
|
a275f52917 | ||
|
|
c916e2e09d | ||
|
|
f4f33fc852 | ||
|
|
7b458a56b2 | ||
|
|
c2852ab021 | ||
|
|
57658beb1c | ||
|
|
0b9e868e77 | ||
|
|
ae1e84a1ba | ||
|
|
be65594e54 | ||
|
|
a45a6466e7 | ||
|
|
a1e5b572fe | ||
|
|
729192f836 | ||
|
|
236fc77a63 | ||
|
|
0bd3310f23 | ||
|
|
7dbcea2663 | ||
|
|
9ee13df74e | ||
|
|
d92357cf82 | ||
|
|
d907d4f0ea | ||
|
|
18a463219d | ||
|
|
228adb0375 | ||
|
|
71b2034195 | ||
|
|
555442aa57 | ||
|
|
5d94db7b6c | ||
|
|
2e0c630ccd | ||
|
|
27f26065f6 | ||
|
|
e25d4a3039 | ||
|
|
0c84bfdbca | ||
|
|
82f800e530 | ||
|
|
34953ab614 | ||
|
|
b63ba7c842 | ||
|
|
1d6f7b3e3e | ||
|
|
8049b02451 | ||
|
|
4b4cb1e826 | ||
|
|
dc7e00e087 | ||
|
|
f2672d8335 | ||
|
|
e67d63373b | ||
|
|
b0a1b84a3b | ||
|
|
3d10837e31 | ||
|
|
be372e711c | ||
|
|
604d2c4ee9 | ||
|
|
d42f617d0f | ||
|
|
4899d32099 | ||
|
|
f6b095ffb8 | ||
|
|
eb0bc2bcfc | ||
|
|
1b79333e32 | ||
|
|
2974d554ad | ||
|
|
918557dfcc | ||
|
|
ef34cba2c6 | ||
|
|
7f68c5e57c | ||
|
|
ea6a706c25 | ||
|
|
c3badf4846 | ||
|
|
a22be4093d | ||
|
|
50cdf8d5d5 | ||
|
|
0c4698ef14 | ||
|
|
c49ad313c9 | ||
|
|
a9dbe13112 | ||
|
|
3ac3b1bcdb | ||
|
|
5b213edae8 | ||
|
|
0b971bda38 | ||
|
|
73b09847b8 | ||
|
|
b94af68265 | ||
|
|
2cddbabee1 | ||
|
|
112497b1b6 | ||
|
|
dc79c274df | ||
|
|
d35d355fb3 | ||
|
|
6bf14512f9 | ||
|
|
0d20013071 | ||
|
|
cf8ed91102 | ||
|
|
577d50b512 | ||
|
|
1a589b0955 | ||
|
|
fdcb8f107f | ||
|
|
bb0341ee74 | ||
|
|
7f3803a771 | ||
|
|
a0506ccc80 | ||
|
|
e8be040b48 | ||
|
|
16f8172d42 | ||
|
|
16915494d8 | ||
|
|
bf4e317561 | ||
|
|
a255766cda | ||
|
|
088c143f59 | ||
|
|
e9a63fcf79 | ||
|
|
68d4a5e56d | ||
|
|
25bffe2053 | ||
|
|
36f3701b4f | ||
|
|
5886c47d92 | ||
|
|
516bc75317 | ||
|
|
bc7b3535e6 | ||
|
|
6e64756725 | ||
|
|
fc19335a26 | ||
|
|
11a3092bac | ||
|
|
5db1a7b345 | ||
|
|
6116daf9ba | ||
|
|
a47c98509d | ||
|
|
e1fc116994 | ||
|
|
f3fa7fe744 | ||
|
|
0a94ee7c60 | ||
|
|
0e6150a0f5 | ||
|
|
c09715d053 | ||
|
|
9701a3d660 | ||
|
|
73ed73b2b3 | ||
|
|
c6201532f2 | ||
|
|
b5ab8e5d3e | ||
|
|
74bcd1b27d | ||
|
|
d2d269e4ca | ||
|
|
595994a495 | ||
|
|
ee0fb3680a | ||
|
|
9d7c2bbe15 | ||
|
|
b975c9c8ca | ||
|
|
bc8a336254 | ||
|
|
9934417d07 | ||
|
|
05f3709a5c | ||
|
|
b5843c24d4 | ||
|
|
80cf1f9bb6 | ||
|
|
92aab25da2 | ||
|
|
9af77e1161 | ||
|
|
bba3e5cf37 | ||
|
|
b384f85b01 | ||
|
|
aa27c27e8b | ||
|
|
c81046081f | ||
|
|
fea0bade69 | ||
|
|
cd9096d1a8 | ||
|
|
dc92f40ee2 | ||
|
|
2f5de8149d | ||
|
|
f7ade8a4c3 | ||
|
|
f200737e9b | ||
|
|
32283e973b | ||
|
|
ce889cf1c3 | ||
|
|
6ab9777fbd | ||
|
|
e3820b3e12 | ||
|
|
53ce66f4a6 | ||
|
|
c19fed1d9f | ||
|
|
0eeaf808fc | ||
|
|
78afb7eaf7 | ||
|
|
6469c6d689 | ||
|
|
3c00938fe8 | ||
|
|
2334987359 | ||
|
|
745c89ef86 | ||
|
|
2d277fbe2b | ||
|
|
f69afd2d9a | ||
|
|
02459d759f | ||
|
|
69d48ce5c1 | ||
|
|
db5abecb43 | ||
|
|
89123c0be5 | ||
|
|
119a931312 | ||
|
|
e3d86440c1 | ||
|
|
20819325fb | ||
|
|
8a19fd8de5 | ||
|
|
65b8faa5c9 | ||
|
|
058431836d | ||
|
|
f7d0267ad5 | ||
|
|
4fc4951e2e |
@@ -20,6 +20,7 @@ const SCOPES = [
|
||||
"logger",
|
||||
"theme",
|
||||
"core",
|
||||
"clipper",
|
||||
"config",
|
||||
"ci",
|
||||
"setup",
|
||||
|
||||
@@ -18,6 +18,10 @@ apps/web/public/an.js
|
||||
|
||||
# editor
|
||||
packages/editor/styles/
|
||||
packages/editor/languages/
|
||||
|
||||
# editor mobile
|
||||
packages/editor-mobile/build.bundle
|
||||
packages/editor-mobile/build.bundle
|
||||
|
||||
# snapshots
|
||||
tap-snapshots
|
||||
@@ -2,7 +2,7 @@ const LICENSE = [
|
||||
"",
|
||||
"This file is part of the Notesnook project (https://notesnook.com/)",
|
||||
"",
|
||||
"Copyright (C) 2022 Streetwriters (Private) Limited",
|
||||
"Copyright (C) 2023 Streetwriters (Private) Limited",
|
||||
"",
|
||||
"This program is free software: you can redistribute it and/or modify",
|
||||
"it under the terms of the GNU General Public License as published by",
|
||||
|
||||
4
.github/dco.yml
vendored
Normal file
4
.github/dco.yml
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
allowRemediationCommits:
|
||||
individual: true
|
||||
require:
|
||||
members: false
|
||||
64
.github/workflows/android.publish.internal.yml
vendored
Normal file
64
.github/workflows/android.publish.internal.yml
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
name: Publish @notesnook/android-internal
|
||||
|
||||
on: workflow_dispatch
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 40
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- uses: actions/setup-node@master
|
||||
with:
|
||||
node-version: '16'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: |
|
||||
apps/mobile/package-lock.json
|
||||
apps/web/package-lock.json
|
||||
packages/core/package-lock.json
|
||||
packages/crypto/package-lock.json
|
||||
packages/crypto-worker/package-lock.json
|
||||
packages/editor-mobile/package-lock.json
|
||||
packages/editor/package-lock.json
|
||||
packages/logger/package-lock.json
|
||||
packages/streamable-fs/package-lock.json
|
||||
packages/theme/package-lock.json
|
||||
|
||||
- name: Use specific Java version for the builds
|
||||
uses: joschi/setup-jdk@v2
|
||||
with:
|
||||
java-version: '11'
|
||||
architecture: 'x64'
|
||||
|
||||
- name: Install node modules
|
||||
run: |
|
||||
npm ci
|
||||
- name: Make Gradlew Executable
|
||||
run: cd apps/mobile/native/android && chmod +x ./gradlew
|
||||
|
||||
- name: Build unsigned app bundle
|
||||
run: yarn release:android:bundle
|
||||
|
||||
- name: Sign app bundle for Playstore release
|
||||
id: sign_app
|
||||
uses: r0adkll/sign-android-release@v1
|
||||
with:
|
||||
releaseDirectory: apps/mobile/native/android/app/build/outputs/bundle/release
|
||||
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
|
||||
alias: ${{ secrets.ALIAS }}
|
||||
keyStorePassword: ${{ secrets.KEY_PASSWORD }}
|
||||
keyPassword: ${{ secrets.KEY_PASSWORD }}
|
||||
|
||||
- name: Publish to Playstore
|
||||
id: deploy
|
||||
uses: r0adkll/upload-google-play@v1
|
||||
with:
|
||||
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
|
||||
packageName: com.streetwriters.notesnook
|
||||
releaseFile: ${{steps.sign_app.outputs.signedReleaseFile}}
|
||||
track: internal
|
||||
status: completed
|
||||
whatsNewDirectory: apps/mobile/native/android/releasenotes/
|
||||
26
.github/workflows/android.publish.yml
vendored
26
.github/workflows/android.publish.yml
vendored
@@ -50,7 +50,18 @@ jobs:
|
||||
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
|
||||
alias: ${{ secrets.ALIAS }}
|
||||
keyStorePassword: ${{ secrets.KEY_PASSWORD }}
|
||||
keyPassword: ${{ secrets.KEY_PASSWORD }}
|
||||
keyPassword: ${{ secrets.KEY_PASSWORD }}
|
||||
|
||||
- name: Publish to Playstore
|
||||
id: deploy
|
||||
uses: r0adkll/upload-google-play@v1.1.1
|
||||
with:
|
||||
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
|
||||
packageName: com.streetwriters.notesnook
|
||||
releaseFiles: ${{steps.sign_app.outputs.signedReleaseFile}}
|
||||
track: production
|
||||
status: completed
|
||||
whatsNewDirectory: apps/mobile/native/android/releasenotes/
|
||||
|
||||
- name: Build apks for Github release
|
||||
run: yarn release:android
|
||||
@@ -91,15 +102,4 @@ jobs:
|
||||
apps/mobile/native/android/app/build/outputs/apk/release/notesnook-arm64-v8a.apk
|
||||
apps/mobile/native/android/app/build/outputs/apk/release/notesnook-armeabi-v7a.apk
|
||||
apps/mobile/native/android/app/build/outputs/apk/release/notesnook-x86.apk
|
||||
apps/mobile/native/android/app/build/outputs/apk/release/notesnook-x86_64.apk
|
||||
|
||||
- name: Publish to Playstore
|
||||
id: deploy
|
||||
uses: r0adkll/upload-google-play@v1
|
||||
with:
|
||||
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
|
||||
packageName: com.streetwriters.notesnook
|
||||
releaseFile: ${{steps.sign_app.outputs.signedReleaseFile}}
|
||||
track: production
|
||||
status: completed
|
||||
whatsNewDirectory: apps/mobile/native/android/releasenotes/
|
||||
apps/mobile/native/android/app/build/outputs/apk/release/notesnook-x86_64.apk
|
||||
7
.github/workflows/core.tests.yml
vendored
7
.github/workflows/core.tests.yml
vendored
@@ -45,9 +45,10 @@ jobs:
|
||||
npm ci --prefer-offline --no-audit
|
||||
- name: Add environment variables
|
||||
run: |
|
||||
echo "EMAIL=${{ secrets.USER_EMAIL }}" >> $GITHUB_ENV
|
||||
echo "PASSWORD='${{ secrets.USER_PASSWORD }}'" >> $GITHUB_ENV
|
||||
echo "HASHED_PASSWORD=${{ secrets.USER_HASHED_PASSWORD }}" >> $GITHUB_ENV
|
||||
echo "USER_EMAIL=${{ secrets.USER_EMAIL }}" >> $GITHUB_ENV
|
||||
echo "USER_PASSWORD=${{ secrets.USER_PASSWORD }}" >> $GITHUB_ENV
|
||||
echo "USER_TOTP_SECRET=${{ secrets.USER_TOTP_SECRET }}" >> $GITHUB_ENV
|
||||
echo "USER_HASHED_PASSWORD=${{ secrets.USER_HASHED_PASSWORD }}" >> $GITHUB_ENV
|
||||
echo "NX_CLOUD_ACCESS_TOKEN=${{ secrets.NX_CLOUD_ACCESS_TOKEN }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Run all @notesnook/core tests
|
||||
|
||||
54
.github/workflows/desktop.publish.yml
vendored
54
.github/workflows/desktop.publish.yml
vendored
@@ -62,6 +62,26 @@ jobs:
|
||||
name: build
|
||||
path: apps/web/build/**/*
|
||||
|
||||
- name: Collect app metadata
|
||||
id: app_metadata
|
||||
working-directory: ./apps/web/desktop
|
||||
run: |
|
||||
echo ::set-output name=app_version::$(cat package.json | jq -r .version)
|
||||
|
||||
- name: Package desktop build
|
||||
run: |
|
||||
zip -r ./notesnook_build_v${{ steps.app_metadata.outputs.app_version }}.zip ./apps/web/build/
|
||||
echo "Build folder archived to ./notesnook_build_v${{ steps.app_metadata.outputs.app_version }}.zip"
|
||||
|
||||
- name: Upload desktop build
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: inputs.publish-github
|
||||
with:
|
||||
draft: true
|
||||
name: Notesnook Desktop v${{ steps.app_metadata.outputs.app_version }}
|
||||
tag_name: v${{ steps.app_metadata.outputs.app_version }}
|
||||
files: ./notesnook_build_v${{ steps.app_metadata.outputs.app_version }}.zip
|
||||
|
||||
build-macos:
|
||||
name: Build for macOS
|
||||
needs: build
|
||||
@@ -107,7 +127,9 @@ jobs:
|
||||
path: ./apps/web/desktop/build
|
||||
|
||||
- name: Install packages
|
||||
run: npm i
|
||||
run: |
|
||||
npm i
|
||||
npm i dmg-license
|
||||
working-directory: ./apps/web/desktop
|
||||
|
||||
- name: Install provisioning profile
|
||||
@@ -129,6 +151,9 @@ jobs:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
CSC_LINK: ${{ secrets.mac_certs }}
|
||||
CSC_KEY_PASSWORD: ${{ secrets.mac_certs_password }}
|
||||
APPLE_API_KEY: ~/private_keys/AuthKey_${{ secrets.api_key_id }}.p8
|
||||
APPLE_API_KEY_ID: ${{ secrets.api_key_id }}
|
||||
APPLE_API_KEY_ISSUER: ${{ secrets.api_key_issuer_id }}
|
||||
run: |
|
||||
npm run build
|
||||
if [ ${{ inputs.publish-github }} == true ]; then
|
||||
@@ -148,7 +173,7 @@ jobs:
|
||||
|
||||
echo "Uploading ${package} using altool..."
|
||||
|
||||
xcrun altool --upload-package $package -t osx --apiKey $API_KEY_ID --apiIssuer $API_KEY_ISSUER_ID --apple-id ${{ steps.app_metadata.outputs.apple_app_id }} --bundle-id ${{ steps.app_metadata.outputs.app_bundle_id }}--bundle-short-version-string ${{ steps.app_metadata.outputs.app_version }} --bundle-version ${{ steps.app_metadata.outputs.bundle_version }}
|
||||
xcrun altool --upload-package $package -t osx --apiKey $API_KEY_ID --apiIssuer $API_KEY_ISSUER_ID --apple-id ${{ steps.app_metadata.outputs.apple_app_id }} --bundle-id ${{ steps.app_metadata.outputs.app_bundle_id }} --bundle-short-version-string ${{ steps.app_metadata.outputs.app_version }} --bundle-version ${{ steps.app_metadata.outputs.bundle_version }}
|
||||
working-directory: ./apps/web/desktop
|
||||
|
||||
build-linux:
|
||||
@@ -160,12 +185,6 @@ jobs:
|
||||
- name: Check out Git repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Collect app metadata
|
||||
id: app_metadata
|
||||
working-directory: ./apps/web/desktop
|
||||
run: |
|
||||
echo ::set-output name=app_version::$(cat package.json | jq -r .version)
|
||||
|
||||
- name: Setup Snapcraft Auth
|
||||
if: inputs.publish-snap
|
||||
run: echo "SNAPCRAFT_STORE_CREDENTIALS=${{ secrets.snapcraft_token }}" >> $GITHUB_ENV
|
||||
@@ -173,13 +192,6 @@ jobs:
|
||||
- name: Install Snapcraft
|
||||
uses: samuelmeuli/action-snapcraft@v1
|
||||
if: inputs.publish-snap
|
||||
|
||||
- name: Get version info from Snapcraft
|
||||
if: inputs.publish-snap
|
||||
id: snapcraft
|
||||
run:
|
||||
echo ::set-output name=is_published::$(snapcraft status notesnook | grep ${{ steps.app_metadata.outputs.app_version }} | wc -l)
|
||||
echo $is_published
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
@@ -201,24 +213,24 @@ jobs:
|
||||
working-directory: ./apps/web/desktop
|
||||
|
||||
- name: Build snap
|
||||
if: inputs.publish-snap && steps.snapcraft.outputs.is_published <= 0
|
||||
if: inputs.publish-snap
|
||||
run: |
|
||||
npx electron-builder --linux snap -p never
|
||||
npx electron-builder --linux snap:x64 -p never
|
||||
working-directory: ./apps/web/desktop
|
||||
|
||||
- name: Build AppImage deb and rpm
|
||||
- name: Build AppImage
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
if [ ${{ inputs.publish-github }} == true ]; then
|
||||
npx electron-builder --linux AppImage deb rpm -p always
|
||||
npx electron-builder --linux AppImage:x64 AppImage:arm64 -p always
|
||||
else
|
||||
npx electron-builder --linux AppImage deb rpm -p never
|
||||
npx electron-builder --linux AppImage:x64 AppImage:arm64 -p never
|
||||
fi
|
||||
working-directory: ./apps/web/desktop
|
||||
|
||||
- name: Publish on Snapcraft
|
||||
if: inputs.publish-snap && steps.snapcraft.outputs.is_published <= 0
|
||||
if: inputs.publish-snap
|
||||
run: |
|
||||
snapcraft upload --release=stable ./dist/notesnook_linux_amd64.snap
|
||||
working-directory: ./apps/web/desktop
|
||||
|
||||
57
.github/workflows/editor.tests.yml
vendored
Normal file
57
.github/workflows/editor.tests.yml
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
name: Test @notesnook/editor
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- "master"
|
||||
paths:
|
||||
- "packages/editor/**"
|
||||
# re-run workflow if workflow file changes
|
||||
- ".github/workflows/editor.tests.yml"
|
||||
pull_request:
|
||||
types:
|
||||
- "ready_for_review"
|
||||
- "opened"
|
||||
- "synchronize"
|
||||
- "reopened"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16.x
|
||||
cache: "npm"
|
||||
cache-dependency-path: |
|
||||
apps/mobile/package-lock.json
|
||||
apps/web/package-lock.json
|
||||
packages/core/package-lock.json
|
||||
packages/crypto/package-lock.json
|
||||
packages/crypto-worker/package-lock.json
|
||||
packages/editor-mobile/package-lock.json
|
||||
packages/editor/package-lock.json
|
||||
packages/logger/package-lock.json
|
||||
packages/streamable-fs/package-lock.json
|
||||
packages/theme/package-lock.json
|
||||
|
||||
- name: Install packages
|
||||
run: |
|
||||
npm i --ignore-scripts --prefer-offline --no-audit
|
||||
npx lerna bootstrap --ignore=@notesnook/mobile -- --prefer-offline --no-audit
|
||||
|
||||
- name: Setup environment
|
||||
run: |
|
||||
echo "NX_CLOUD_ACCESS_TOKEN=${{ secrets.NX_CLOUD_ACCESS_TOKEN }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Build editor
|
||||
run: npx nx build @notesnook/editor
|
||||
|
||||
- name: Run all @notesnook/editor tests
|
||||
run: npx nx test @notesnook/editor
|
||||
9
.github/workflows/web.tests.yml
vendored
9
.github/workflows/web.tests.yml
vendored
@@ -63,7 +63,7 @@ jobs:
|
||||
name: 🧪 Test (${{ matrix.shard }}/${{ strategy.job-total }})
|
||||
strategy:
|
||||
matrix:
|
||||
shard: [1, 2, 3]
|
||||
shard: [1, 2, 3, 4]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -95,7 +95,7 @@ jobs:
|
||||
- name: Install packages
|
||||
run: |
|
||||
npm i --ignore-scripts --prefer-offline --no-audit
|
||||
npm install -D @playwright/test
|
||||
npm install -D @playwright/test otplib
|
||||
|
||||
- name: Validate build extraction
|
||||
run: ls -ld ./apps/web/build/index.html
|
||||
@@ -107,8 +107,9 @@ jobs:
|
||||
- name: Add environment variables
|
||||
run: |
|
||||
echo "USER_EMAIL=${{ secrets.USER_EMAIL }}" >> $GITHUB_ENV
|
||||
echo "CURRENT_USER_PASSWORD=${{ secrets.USER_PASSWORD }}" >> $GITHUB_ENV
|
||||
echo "CURRENT_USER_KEY=${{ secrets.USER_KEY }}" >> $GITHUB_ENV
|
||||
echo "USER_PASSWORD=${{ secrets.USER_PASSWORD }}" >> $GITHUB_ENV
|
||||
echo "USER_TOTP_SECRET=${{ secrets.USER_TOTP_SECRET }}" >> $GITHUB_ENV
|
||||
echo "USER_KEY=${{ secrets.USER_KEY }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Run tests
|
||||
run: npx playwright test --shard=${{ matrix.shard }}/${{ strategy.job-total }}
|
||||
|
||||
6
.gitignore
vendored
6
.gitignore
vendored
@@ -3,4 +3,8 @@ coverage
|
||||
node_modules
|
||||
dist
|
||||
.DS_STORE
|
||||
nx-cloud.env
|
||||
nx-cloud.env
|
||||
.idea
|
||||
.eslintcache
|
||||
.env.local
|
||||
.nyc_output
|
||||
@@ -4,5 +4,6 @@ module.exports = {
|
||||
semi: true,
|
||||
printWidth: 80,
|
||||
useTabs: false,
|
||||
tabWidth: 2
|
||||
tabWidth: 2,
|
||||
bracketSpacing: true
|
||||
};
|
||||
|
||||
11
.vscode/extensions.json
vendored
Normal file
11
.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=827846
|
||||
// for the documentation about the extensions.json format
|
||||
"recommendations": [
|
||||
"dbaeumer.vscode-eslint",
|
||||
"esbenp.prettier-vscode",
|
||||
"ms-playwright.playwright",
|
||||
"firefox-devtools.vscode-firefox-debug",
|
||||
"msjsdiag.vscode-react-native"
|
||||
]
|
||||
}
|
||||
72
.vscode/notesnook.code-workspace
vendored
Normal file
72
.vscode/notesnook.code-workspace
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"name": "✨ notesnook",
|
||||
"path": ".."
|
||||
},
|
||||
{
|
||||
"name": "🚀 @notesnook/mobile",
|
||||
"path": "../apps/mobile"
|
||||
},
|
||||
{
|
||||
"name": "🚀 @notesnook/web",
|
||||
"path": "../apps/web"
|
||||
},
|
||||
{
|
||||
"name": "🚀 @notesnook/desktop",
|
||||
"path": "../apps/web/desktop"
|
||||
},
|
||||
{
|
||||
"name": "🚀 @notesnook/web-clipper",
|
||||
"path": "../extensions/web-clipper"
|
||||
},
|
||||
{
|
||||
"name": "📦 @notesnook/clipper",
|
||||
"path": "../packages/clipper"
|
||||
},
|
||||
{
|
||||
"name": "📦 @notesnook/core",
|
||||
"path": "../packages/core"
|
||||
},
|
||||
{
|
||||
"name": "📦 @notesnook/crypto",
|
||||
"path": "../packages/crypto"
|
||||
},
|
||||
{
|
||||
"name": "📦 @notesnook/crypto-worker",
|
||||
"path": "../packages/crypto-worker"
|
||||
},
|
||||
{
|
||||
"name": "📦 @notesnook/editor",
|
||||
"path": "../packages/editor"
|
||||
},
|
||||
{
|
||||
"name": "📦 @notesnook/editor-mobile",
|
||||
"path": "../packages/editor-mobile"
|
||||
},
|
||||
{
|
||||
"name": "📦 @notesnook/logger",
|
||||
"path": "../packages/logger"
|
||||
},
|
||||
{
|
||||
"name": "📦 @notesnook/streamable-fs",
|
||||
"path": "../packages/streamable-fs"
|
||||
},
|
||||
{
|
||||
"name": "📦 @notesnook/theme",
|
||||
"path": "../packages/theme"
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"typescript.tsdk": "node_modules/typescript/lib",
|
||||
"javascript.format.enable": true,
|
||||
"editor.formatOnSave": true,
|
||||
"editor.formatOnSaveMode": "modificationsIfAvailable",
|
||||
"eslint.packageManager": "npm",
|
||||
"eslint.run": "onSave",
|
||||
"[javascript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
"eslint.execArgv": ["--cache"]
|
||||
}
|
||||
}
|
||||
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"typescript.tsdk": "node_modules/typescript/lib"
|
||||
}
|
||||
1
AUTHORS
1
AUTHORS
@@ -1,3 +1,4 @@
|
||||
Notesnook is written & maintained by:
|
||||
- Abdullah Atta <abdullahatta@streetwriters.co>
|
||||
- Ammar Ahmed <ammarahmed6506@gmail.com>
|
||||
- Muhammad Ali <alihamuh@gmail.com>
|
||||
|
||||
@@ -8,9 +8,9 @@ Thank you so much for considering to contribute to Notesnook! If you have no ide
|
||||
|
||||
Ugh! Bugs!
|
||||
|
||||
> A bug is when software behaves in a way that you didn't expect, and the developer didn't intend.
|
||||
> A bug is when software behaves in a way you didn't expect, which the developer didn't intend.
|
||||
|
||||
To help us understand what's going on, we first want to **make sure you're using the latest version of Notesnook**.
|
||||
To help us understand what's happening, we first want to **make sure you're using the latest version of Notesnook**.
|
||||
|
||||
Once you've **confirmed that the bug still exists in the latest version**, you'll want to check to make sure it's not something we already know about in the [opened GitHub issues](https://github.com/streetwriters/notesnook/issues).
|
||||
|
||||
@@ -28,15 +28,9 @@ If you've thought of a way that Notesnook could be better, we want to hear about
|
||||
|
||||
Before you open a new feature request, please make sure it's not a duplicate. **Duplicate feature requests & bug reports are closed immediately.**
|
||||
|
||||
### Improving documentation
|
||||
|
||||
All app related documentation can be found in the `docs/` directory. All the files in this directory are simple markdown files which you can edit either directly on GitHub, or in your favorite text editor.
|
||||
|
||||
If you find a mistake in the documentation or would like to contribute something new to the documentation, feel free to open a pull request; creating an issue for this is not required.
|
||||
|
||||
### Helping out in the issue tracker
|
||||
|
||||
There are always new issues getting opened that need to be triaged, sorted & organized, so the developers can easily find the most critical and/or relevant bugs to fix. Any help in this regard is appreciated.
|
||||
New issues are always opened that need to be triaged, sorted & organized, so the developers can easily find the most critical and/or relevant bugs to fix. Any help in this regard is appreciated.
|
||||
|
||||
In addition to this, you can help out in the following ways:
|
||||
|
||||
@@ -68,7 +62,7 @@ Once you are done, [open a new pull request](https://docs.github.com/en/pull-req
|
||||
|
||||
1. Fork [the repository](https://github.com/streetwriters/notesnook) and create your branch from `master` (you can name your branch anything).
|
||||
2. Run `npm run bootstrap` in the repository root.
|
||||
3. If you’ve fixed a bug or added code that should be tested, add tests!
|
||||
3. If you've fixed a bug or added code that should be tested, add tests!
|
||||
4. Ensure the test suite passes (`npm run test`).
|
||||
5. Format your code with prettier (`npm run prettier`).
|
||||
6. Make sure your code lints (`npm run lint`). Tip: `npm run linc` to only check changed files.
|
||||
@@ -91,7 +85,11 @@ The DCO is a declaration attached to every contribution made by every developer
|
||||
Signed-off-by: Jane Smith <jane.smith@email.com>
|
||||
```
|
||||
|
||||
You may type this line on your own when writing your commit messages. However, if your [user.name](http://user.name) and [user.email](http://user.email) are set in your git configs, you can use `-s` or `--signoff` to add the `Signed-off-by` line to the end of the commit message.
|
||||
On VSCode, it looks like this:
|
||||
|
||||

|
||||
|
||||
You may type this line on your own when writing your commit messages. However, if your [user.name](http://user.name) and [user.email](http://user.email) are set in your git configs, you can use `-s` or `--signoff` to add the `Signed-off-by` line to the end of the commit message automatically.
|
||||
|
||||
#### Include `<scope>:` in your commit message
|
||||
|
||||
@@ -133,11 +131,11 @@ We use an automatic code formatter called [Prettier](https://prettier.io/). Run
|
||||
|
||||
Then, our linter will catch most issues that may exist in your code. You can check the status of your code styling by simply running `npm run lint`.
|
||||
|
||||
However, there are still some styles that the linter cannot pick up. If you are unsure about something, looking at [Airbnb’s Style Guide](https://github.com/airbnb/javascript) will guide you in the right direction.
|
||||
However, there are still some styles that the linter cannot pick up. If you are unsure about something, looking at [Airbnb's Style Guide](https://github.com/airbnb/javascript) will guide you in the right direction.
|
||||
|
||||
## Git Branch Organization
|
||||
|
||||
Submit all changes directly to the [`master branch`](https://github.com/streetwriters/notesnook). We don’t use separate branches for development or for upcoming releases. This requires us to always keep the `master` branch in a deployable state which means:
|
||||
Submit all changes directly to the [`master branch`](https://github.com/streetwriters/notesnook). We don't use separate branches for development or for upcoming releases. This requires us to always keep the `master` branch in a deployable state which means:
|
||||
|
||||
1. All tests must be passing at all times
|
||||
2. There should be as few breaking changes as possible
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
|
||||
## Overview
|
||||
|
||||
Notesnook is a free (as in speech) & open source note taking app focused on user privacy & ease of use. To ensure zero knowledge principles, Notesnook encrypts everything on your device using `XChaCha20-Poly1305` & `Argon2`.
|
||||
Notesnook is a free (as in speech) & open-source note-taking app focused on user privacy & ease of use. To ensure zero knowledge principles, Notesnook encrypts everything on your device using `XChaCha20-Poly1305` & `Argon2`.
|
||||
|
||||
Notesnook is our **proof** that privacy does _not_ (always) have to come at the cost of convenience. Our goal is to provide users peace of mind & 100% confidence that their notes are safe and secure. The decision to go fully open source is one of the most crucial steps towards that.
|
||||
Notesnook is our **proof** that privacy does _not_ (always) have to come at the cost of convenience. We aim to provide users peace of mind & 100% confidence that their notes are safe and secure. The decision to go fully open source is one of the most crucial steps towards that.
|
||||
|
||||
This repository contains all the code required to build & use the Notesnook web, desktop & mobile clients. If you are looking for a full features list or screenshots, please check the [website](https://notesnook.com/).
|
||||
This repository contains all the code required to build & use the Notesnook web, desktop & mobile clients. If you are looking for a full feature list or screenshots, please check the [website](https://notesnook.com/).
|
||||
|
||||
## Developer guide
|
||||
|
||||
|
||||
2
apps/mobile/.vscode/launch.json
vendored
2
apps/mobile/.vscode/launch.json
vendored
@@ -25,4 +25,4 @@
|
||||
"request": "attach"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -19,9 +19,9 @@
|
||||
|
||||
## Build instructions
|
||||
|
||||
> **Before you start it is recommended that you read [the contributing guidelines](/CONTRIBUTING.md).**
|
||||
> **Before you start, it is recommended that you read [the contributing guidelines](/CONTRIBUTING.md).**
|
||||
|
||||
### Setting up development environment
|
||||
### Setting up the development environment
|
||||
|
||||
Requirements:
|
||||
|
||||
@@ -57,7 +57,7 @@ npm install
|
||||
|
||||
### Running the app on Android
|
||||
|
||||
[Setup an Android emulator from Android Studio](https://developer.android.com/studio/run/managing-avds) if you haven't already and then run the following command to start the app in the Emulator:
|
||||
[Setup an Android emulator from Android Studio](https://developer.android.com/studio/run/managing-avds) if you haven't already, and then run the following command to start the app in the Emulator:
|
||||
|
||||
```bash
|
||||
npm run start:android
|
||||
@@ -78,11 +78,11 @@ npm run start:ios
|
||||
|
||||
## Developer guide
|
||||
|
||||
> This project is in a transition state between Javascript & Typescript. We are gradually porting everything over to Typescript so if you can help with that, it'd be great!
|
||||
> This project is in a transition state between Javascript & Typescript. We are gradually porting everything over to Typescript, so if you can help with that, it'd be great!
|
||||
|
||||
### The tech stack
|
||||
|
||||
We try to keep the stack as lean as possible
|
||||
We try to keep the stack as lean as possible:
|
||||
|
||||
1. React Native
|
||||
2. Typescript/Javascript
|
||||
@@ -95,17 +95,17 @@ We try to keep the stack as lean as possible
|
||||
|
||||
The app codebase is distributed over two primary directories. `native/` and `app/`.
|
||||
|
||||
- `native/`: Includes `android/` and `ios/` folders and everything related to react native core functionality like bundling, development and packaging. Any react-native dependency that has native code i.e android & ios folders, is installed here.
|
||||
- `native/`: Includes `android/` and `ios/` folders and everything related to react native core functionality like bundling, development, and packaging. Any react-native dependency with native code, i.e., android & ios folders, is installed here.
|
||||
|
||||
- `app/`: Includes all the app code other than the native part. All JS only dependencies are installed here.
|
||||
- `components/`: Each component serves a specific purpose in the app UI, for example the `Paragraph` component is used to render paragraphs in the app and a `Header` component is used to render a `header` on all screens.
|
||||
- `common/`: Features that have integral role in app functionality, for example, notesnook core is initialized here.
|
||||
- `app/`: Includes all the app code other than the native part. All JS-only dependencies are installed here.
|
||||
- `components/`: Each component serves a specific purpose in the app UI. For example, the `Paragraph` component is used to render paragraphs in the app, and a `Header` component is used to render a `header` on all screens.
|
||||
- `common/`: Features that are integral to the app's functionality. For example, the notesnook core is initialized here.
|
||||
- `hooks/`: Hooks for different app logic
|
||||
- `navigation/`: Includes app navigation specific code. Here the app navigation, editor & side menu are rendered side by side in fluid tabs.
|
||||
- `navigation/`: Includes app navigation-specific code. Here the app navigation, editor & side menu are rendered side by side in fluid tabs.
|
||||
- `screens`: Navigator screens.
|
||||
- `services`: Parts of code that do a specific function, for example, the `sync` service is responsibe for running Sync from anywhere in the app.
|
||||
- `stores`: We use `zustand` for global state management in the app. There are multiple stores that provide the state for different parts of the app.
|
||||
- `utils`: General purpose stuff such as constant values, utility functions etc.
|
||||
- `services`: Parts of code that do a specific function. For example, the `sync` service runs Sync from anywhere in the app.
|
||||
- `stores`: We use `zustand` for global state management in the app. Multiple stores provide the state for different parts of the app.
|
||||
- `utils`: General purpose stuff such as constant values, utility functions, etc.
|
||||
|
||||
There are several other folders at the root:
|
||||
|
||||
@@ -115,11 +115,11 @@ There are several other folders at the root:
|
||||
|
||||
### Running the tests
|
||||
|
||||
When you are done making the required changes, you will need to run the tests to make sure you didn't break anything. We use Detox as the testing framework & the tests can be started as follows:
|
||||
When you are done making the required changes, you must run the tests to ensure you didn't break anything. We use Detox as the testing framework & the tests can be started as follows:
|
||||
|
||||
### Android
|
||||
|
||||
To run the tests on android, you will need to create an emulator device on your system:
|
||||
To run the tests on Android, you will need to create an emulator device on your system:
|
||||
|
||||
```
|
||||
$ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_5_API_31 -d pixel --package "system-images;android-31;default;x86_64"
|
||||
@@ -127,13 +127,13 @@ $ANDROID_HOME/tools/bin/avdmanager create avd -n Pixel_5_API_31 -d pixel --packa
|
||||
|
||||
If you face problems, follow the detailed guide in [Detox documentation](https://wix.github.io/Detox/docs/introduction/android-dev-env). Keep the emulator name set to `Pixel_5_API_31`.
|
||||
|
||||
Once you have created an emulator device, build the android apks
|
||||
Once you have created an emulator device, build the Android apks:
|
||||
|
||||
```
|
||||
npm run build:android
|
||||
```
|
||||
|
||||
Finally run the tests
|
||||
Finally, run the tests:
|
||||
|
||||
```
|
||||
npm run test:android
|
||||
@@ -141,9 +141,9 @@ npm run test:android
|
||||
|
||||
### iOS
|
||||
|
||||
To run e2e tests on iOS simulator, you must be on a Mac with XCode installed.
|
||||
To run e2e tests on the iOS simulator, you must be on a Mac with XCode installed.
|
||||
|
||||
First install [AppleSimulatorUtils](https://github.com/wix/AppleSimulatorUtils)
|
||||
First, install [AppleSimulatorUtils](https://github.com/wix/AppleSimulatorUtils):
|
||||
|
||||
```
|
||||
brew tap wix/brew
|
||||
@@ -156,7 +156,7 @@ Now build the iOS app for testing:
|
||||
npm run build:ios
|
||||
```
|
||||
|
||||
Finally run the tests:
|
||||
Finally, run the tests:
|
||||
|
||||
```
|
||||
npm run test:ios
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -16,7 +16,7 @@ GNU General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import "react-native-gesture-handler";
|
||||
import React, { useEffect } from "react";
|
||||
import { GestureHandlerRootView } from "react-native-gesture-handler";
|
||||
import { SafeAreaProvider } from "react-native-safe-area-context";
|
||||
@@ -30,16 +30,28 @@ import SettingsService from "./services/settings";
|
||||
import { TipManager } from "./services/tip-manager";
|
||||
import { useUserStore } from "./stores/use-user-store";
|
||||
import { View } from "react-native";
|
||||
import { useState } from "react";
|
||||
import NetInfo from "@react-native-community/netinfo";
|
||||
NetInfo.configure({
|
||||
reachabilityUrl: "https://notesnook.com",
|
||||
reachabilityTest: (response) => {
|
||||
if (!response) return false;
|
||||
return response?.status >= 200 && response?.status < 300;
|
||||
}
|
||||
});
|
||||
|
||||
SettingsService.init();
|
||||
SettingsService.checkOrientation();
|
||||
const App = () => {
|
||||
useAppEvents();
|
||||
const [init, setInit] = useState(false);
|
||||
useEffect(() => {
|
||||
let { appLockMode } = SettingsService.get();
|
||||
if (appLockMode && appLockMode !== "none") {
|
||||
useUserStore.getState().setVerifyUser(true);
|
||||
}
|
||||
//BackgroundSync.start();
|
||||
setInit(true);
|
||||
setTimeout(async () => {
|
||||
SettingsService.onFirstLaunch();
|
||||
await Notifications.get();
|
||||
@@ -77,7 +89,7 @@ const App = () => {
|
||||
}}
|
||||
>
|
||||
<ApplicationHolder />
|
||||
<Launcher />
|
||||
{init && <Launcher />}
|
||||
</GestureHandlerRootView>
|
||||
</View>
|
||||
);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
BIN
apps/mobile/app/assets/images/notesnook-dark.png
Normal file
BIN
apps/mobile/app/assets/images/notesnook-dark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -21,7 +21,7 @@ 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 Sodium from "react-native-sodium";
|
||||
import Sodium from "@ammarahmed/react-native-sodium";
|
||||
|
||||
const KEYSTORE_CONFIG = Platform.select({
|
||||
ios: {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -25,10 +25,12 @@ import filesystem from "../filesystem";
|
||||
import EventSource from "../../utils/sse/even-source-ios";
|
||||
import AndroidEventSource from "../../utils/sse/event-source";
|
||||
import Storage, { KV } from "./storage";
|
||||
import * as Gzip from "react-native-gzip";
|
||||
|
||||
const LoggerStorage = new MMKVLoader()
|
||||
.withInstanceID("notesnook_logs")
|
||||
.initialize();
|
||||
initalize(new KV(LoggerStorage));
|
||||
initalize(new KV(LoggerStorage), true);
|
||||
export const DatabaseLogger = dbLogger;
|
||||
|
||||
/**
|
||||
@@ -37,7 +39,11 @@ export const DatabaseLogger = dbLogger;
|
||||
export var db = new Database(
|
||||
Storage,
|
||||
Platform.OS === "ios" ? EventSource : AndroidEventSource,
|
||||
filesystem
|
||||
filesystem,
|
||||
{
|
||||
compress: Gzip.deflate,
|
||||
decompress: Gzip.inflate
|
||||
}
|
||||
);
|
||||
|
||||
db.host(
|
||||
@@ -48,11 +54,11 @@ db.host(
|
||||
SSE_HOST: "https://events.streetwriters.co",
|
||||
SUBSCRIPTIONS_HOST: "https://subscriptions.streetwriters.co",
|
||||
ISSUES_HOST: "https://issues.streetwriters.co"
|
||||
// API_HOST: 'http://192.168.10.29:5264',
|
||||
// AUTH_HOST: 'http://192.168.10.29:8264',
|
||||
// SSE_HOST: 'http://192.168.10.29:7264',
|
||||
// SUBSCRIPTIONS_HOST: 'http://192.168.10.29:9264',
|
||||
// ISSUES_HOST: 'http://192.168.10.29:2624'
|
||||
// API_HOST: "http://192.168.8.101:5264",
|
||||
// AUTH_HOST: "http://192.168.8.101:8264",
|
||||
// SSE_HOST: "http://192.168.8.101:7264",
|
||||
// SUBSCRIPTIONS_HOST: "http://192.168.8.101:9264",
|
||||
// ISSUES_HOST: "http://192.168.8.101:2624"
|
||||
}
|
||||
: {
|
||||
API_HOST: "https://api.notesnook.com",
|
||||
@@ -62,14 +68,3 @@ db.host(
|
||||
ISSUES_HOST: "https://issues.streetwriters.co"
|
||||
}
|
||||
);
|
||||
|
||||
export async function loadDatabase() {
|
||||
// if (!DB) {
|
||||
// let module = await import(/* webpackChunkName: "notes-core" */ 'notes-core/api/index');
|
||||
// DB = module.default;
|
||||
// }
|
||||
// db = new DB(Storage, Platform.OS === 'ios' ? EventSource : AndroidEventSource, filesystem);
|
||||
// if (DOMParser) {
|
||||
// await DOMParser.prepare();
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
50
apps/mobile/app/common/filesystem/compress.js
Normal file
50
apps/mobile/app/common/filesystem/compress.js
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import { Dimensions, Platform } from "react-native";
|
||||
import ImageResizer from "@bam.tech/react-native-image-resizer";
|
||||
import RNFetchBlob from "rn-fetch-blob";
|
||||
/**
|
||||
* Scale down & compress images to screen width
|
||||
* for loading in editor.
|
||||
* @returns
|
||||
*/
|
||||
export async function compressToBase64(path, type) {
|
||||
const { width, scale } = Dimensions.get("window");
|
||||
const response = await ImageResizer.createResizedImage(
|
||||
path,
|
||||
width * scale,
|
||||
9999,
|
||||
type,
|
||||
80,
|
||||
0,
|
||||
undefined,
|
||||
true,
|
||||
{
|
||||
mode: "contain",
|
||||
onlyScaleDown: true
|
||||
}
|
||||
);
|
||||
const base64 = await RNFetchBlob.fs.readFile(
|
||||
Platform.OS === "ios" ? response.uri?.replace("file://", "") : response.uri,
|
||||
"base64"
|
||||
);
|
||||
RNFetchBlob.fs.unlink(path.replace("file://", "")).catch(console.log);
|
||||
RNFetchBlob.fs.unlink(response.uri.replace("file://", "")).catch(console.log);
|
||||
return base64;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
import React from "react";
|
||||
import { Platform } from "react-native";
|
||||
import * as ScopedStorage from "react-native-scoped-storage";
|
||||
import Sodium from "react-native-sodium";
|
||||
import Sodium from "@ammarahmed/react-native-sodium";
|
||||
import RNFetchBlob from "rn-fetch-blob";
|
||||
import { ShareComponent } from "../../components/sheets/export-notes/share";
|
||||
import { presentSheet, ToastEvent } from "../../services/event-manager";
|
||||
@@ -28,8 +28,16 @@ import { useAttachmentStore } from "../../stores/use-attachment-store";
|
||||
import { db } from "../database";
|
||||
import Storage from "../database/storage";
|
||||
import { cacheDir } from "./utils";
|
||||
import { getFileNameWithExtension } from "@notesnook/core/utils/filename";
|
||||
|
||||
export default async function downloadAttachment(hash, global = true) {
|
||||
export default async function downloadAttachment(
|
||||
hash,
|
||||
global = true,
|
||||
options = {
|
||||
silent: false,
|
||||
cache: false
|
||||
}
|
||||
) {
|
||||
let attachment = db.attachments.attachment(hash);
|
||||
if (!attachment) {
|
||||
console.log("attachment not found");
|
||||
@@ -37,11 +45,13 @@ export default async function downloadAttachment(hash, global = true) {
|
||||
}
|
||||
|
||||
let folder = {};
|
||||
if (Platform.OS === "android") {
|
||||
folder = await ScopedStorage.openDocumentTree();
|
||||
if (!folder) return;
|
||||
} else {
|
||||
folder.uri = await Storage.checkAndCreateDir("/downloads/");
|
||||
if (!options.cache) {
|
||||
if (Platform.OS === "android") {
|
||||
folder = await ScopedStorage.openDocumentTree();
|
||||
if (!folder) return;
|
||||
} else {
|
||||
folder.uri = await Storage.checkAndCreateDir("/downloads/");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -54,6 +64,11 @@ export default async function downloadAttachment(hash, global = true) {
|
||||
)
|
||||
return;
|
||||
|
||||
let filename = getFileNameWithExtension(
|
||||
attachment.metadata.filename,
|
||||
attachment.metadata.type
|
||||
);
|
||||
|
||||
let key = await db.attachments.decryptKey(attachment.key);
|
||||
let info = {
|
||||
iv: attachment.iv,
|
||||
@@ -63,46 +78,50 @@ export default async function downloadAttachment(hash, global = true) {
|
||||
hash: attachment.metadata.hash,
|
||||
hashType: attachment.metadata.hashType,
|
||||
mime: attachment.metadata.type,
|
||||
fileName: attachment.metadata.filename,
|
||||
uri: folder.uri,
|
||||
fileName: options.cache ? undefined : filename,
|
||||
uri: options.cache ? undefined : folder.uri,
|
||||
chunkSize: attachment.chunkSize
|
||||
};
|
||||
|
||||
let fileUri = await Sodium.decryptFile(key, info, false);
|
||||
ToastEvent.show({
|
||||
heading: "Download successful",
|
||||
message: attachment.metadata.filename + " downloaded",
|
||||
type: "success"
|
||||
});
|
||||
let fileUri = await Sodium.decryptFile(
|
||||
key,
|
||||
info,
|
||||
options.cache ? "cache" : "file"
|
||||
);
|
||||
|
||||
if (attachment.dateUploaded) {
|
||||
if (!options.silent) {
|
||||
ToastEvent.show({
|
||||
heading: "Download successful",
|
||||
message: filename + " downloaded",
|
||||
type: "success"
|
||||
});
|
||||
}
|
||||
|
||||
if (
|
||||
attachment.dateUploaded &&
|
||||
!attachment.metadata?.type?.startsWith("image")
|
||||
) {
|
||||
RNFetchBlob.fs
|
||||
.unlink(RNFetchBlob.fs.dirs.CacheDir + `/${attachment.metadata.hash}`)
|
||||
.catch(console.log);
|
||||
}
|
||||
|
||||
if (Platform.OS === "ios") {
|
||||
fileUri = folder.uri + `/${attachment.metadata.filename}`;
|
||||
if (Platform.OS === "ios" && !options.cache) {
|
||||
fileUri = folder.uri + `/${filename}`;
|
||||
}
|
||||
if (!options.silent) {
|
||||
presentSheet({
|
||||
title: "File downloaded",
|
||||
paragraph: `${filename} saved to ${
|
||||
Platform.OS === "android"
|
||||
? "selected path"
|
||||
: "File Manager/Notesnook/downloads"
|
||||
}`,
|
||||
icon: "download",
|
||||
context: global ? null : attachment.metadata.hash,
|
||||
component: <ShareComponent uri={fileUri} name={filename} padding={12} />
|
||||
});
|
||||
}
|
||||
console.log("saved file uri: ", fileUri);
|
||||
|
||||
presentSheet({
|
||||
title: "File downloaded",
|
||||
paragraph: `${attachment.metadata.filename} saved to ${
|
||||
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}
|
||||
/>
|
||||
)
|
||||
});
|
||||
return fileUri;
|
||||
} catch (e) {
|
||||
console.log("download attachment error: ", e);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -17,23 +17,22 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {
|
||||
checkAttachment, downloadFile,
|
||||
getUploadedFileSize
|
||||
} from "./download";
|
||||
import { checkAttachment, downloadFile, getUploadedFileSize } from "./download";
|
||||
import {
|
||||
clearFileStorage,
|
||||
deleteFile,
|
||||
exists,
|
||||
readEncrypted,
|
||||
writeEncrypted
|
||||
writeEncryptedBase64,
|
||||
hashBase64
|
||||
} from "./io";
|
||||
import { uploadFile } from "./upload";
|
||||
import { cancelable } from "./utils";
|
||||
|
||||
export default {
|
||||
readEncrypted,
|
||||
writeEncrypted,
|
||||
writeEncryptedBase64,
|
||||
hashBase64,
|
||||
uploadFile: cancelable(uploadFile),
|
||||
downloadFile: cancelable(downloadFile),
|
||||
deleteFile,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -18,9 +18,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Platform } from "react-native";
|
||||
import Sodium from "react-native-sodium";
|
||||
import Sodium from "@ammarahmed/react-native-sodium";
|
||||
import RNFetchBlob from "rn-fetch-blob";
|
||||
import { cacheDir, getRandomId } from "./utils";
|
||||
import { db } from "../database";
|
||||
import { compressToBase64 } from "./compress";
|
||||
|
||||
export async function readEncrypted(filename, key, cipherData) {
|
||||
let path = `${cacheDir}/${filename}`;
|
||||
@@ -29,6 +31,9 @@ export async function readEncrypted(filename, key, cipherData) {
|
||||
if (!exists) {
|
||||
return false;
|
||||
}
|
||||
const attachment = db.attachments.attachment(filename);
|
||||
const isPng = /(png)/g.test(attachment?.metadata.type);
|
||||
const isJpeg = /(jpeg|jpg)/g.test(attachment?.metadata.type);
|
||||
|
||||
let output = await Sodium.decryptFile(
|
||||
key,
|
||||
@@ -36,28 +41,48 @@ export async function readEncrypted(filename, key, cipherData) {
|
||||
...cipherData,
|
||||
hash: filename
|
||||
},
|
||||
true
|
||||
cipherData.outputType === "base64"
|
||||
? isPng || isJpeg
|
||||
? "cache"
|
||||
: "base64"
|
||||
: "text"
|
||||
);
|
||||
if (cipherData.outputType === "base64" && (isPng || isJpeg)) {
|
||||
const dCachePath = `${cacheDir}/${output}`;
|
||||
output = await compressToBase64(
|
||||
`file://${dCachePath}`,
|
||||
isPng ? "PNG" : "JPEG"
|
||||
);
|
||||
}
|
||||
|
||||
return output;
|
||||
} catch (e) {
|
||||
RNFetchBlob.fs.unlink(path).catch(console.log);
|
||||
console.log(e);
|
||||
console.log("error");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export async function writeEncrypted(filename, { data, type, key }) {
|
||||
console.log("file input: ", { type, key });
|
||||
export async function hashBase64(data) {
|
||||
const hash = await Sodium.hashFile({
|
||||
type: "base64",
|
||||
data,
|
||||
uri: ""
|
||||
});
|
||||
return {
|
||||
hash: hash,
|
||||
type: "xxh64"
|
||||
};
|
||||
}
|
||||
|
||||
export async function writeEncryptedBase64({ data, key }) {
|
||||
let filepath = cacheDir + `/${getRandomId("imagecache_")}`;
|
||||
console.log(filepath);
|
||||
await RNFetchBlob.fs.writeFile(filepath, data, "base64");
|
||||
let output = await Sodium.encryptFile(key, {
|
||||
uri: Platform.OS === "ios" ? filepath : "file://" + filepath,
|
||||
type: "url"
|
||||
});
|
||||
RNFetchBlob.fs.unlink(filepath).catch(console.log);
|
||||
|
||||
console.log("encrypted file output: ", output);
|
||||
return {
|
||||
...output,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -23,10 +23,7 @@ import { Linking, View } from "react-native";
|
||||
import { eSendEvent, presentSheet } from "../../services/event-manager";
|
||||
import Sync from "../../services/sync";
|
||||
import { useThemeStore } from "../../stores/use-theme-store";
|
||||
import {
|
||||
eCloseAnnouncementDialog,
|
||||
eCloseProgressDialog
|
||||
} from "../../utils/events";
|
||||
import { eCloseAnnouncementDialog, eCloseSheet } from "../../utils/events";
|
||||
import { SIZE } from "../../utils/size";
|
||||
import { sleep } from "../../utils/time";
|
||||
import { PricingPlans } from "../premium/pricing-plans";
|
||||
@@ -60,11 +57,11 @@ export const Cta = ({ actions, style = {}, color, inline }) => {
|
||||
)
|
||||
});
|
||||
} else if (item.type === "force-sync") {
|
||||
eSendEvent(eCloseProgressDialog);
|
||||
eSendEvent(eCloseSheet);
|
||||
await sleep(300);
|
||||
Progress.present();
|
||||
Sync.run("global", true, true, () => {
|
||||
eSendEvent(eCloseProgressDialog);
|
||||
eSendEvent(eCloseSheet);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -35,10 +35,7 @@ import PremiumService from "../../services/premium";
|
||||
import { useAttachmentStore } from "../../stores/use-attachment-store";
|
||||
import { useThemeStore } from "../../stores/use-theme-store";
|
||||
import { formatBytes } from "../../utils";
|
||||
import {
|
||||
eCloseAttachmentDialog,
|
||||
eCloseProgressDialog
|
||||
} from "../../utils/events";
|
||||
import { eCloseAttachmentDialog, eCloseSheet } from "../../utils/events";
|
||||
import { SIZE } from "../../utils/size";
|
||||
import { sleep } from "../../utils/time";
|
||||
import { Dialog } from "../dialog";
|
||||
@@ -71,7 +68,7 @@ const Actions = ({ attachment, setAttachments, fwdRef }) => {
|
||||
useAttachmentStore.getState().remove(attachment.metadata.hash);
|
||||
}
|
||||
downloadAttachment(attachment.metadata.hash, false);
|
||||
eSendEvent(eCloseProgressDialog, contextId);
|
||||
eSendEvent(eCloseSheet, contextId);
|
||||
},
|
||||
icon: "download"
|
||||
},
|
||||
@@ -150,7 +147,7 @@ const Actions = ({ attachment, setAttachments, fwdRef }) => {
|
||||
onPress: async () => {
|
||||
await db.attachments.remove(attachment.metadata.hash, false);
|
||||
setAttachments([...db.attachments.all]);
|
||||
eSendEvent(eCloseProgressDialog, contextId);
|
||||
eSendEvent(eCloseSheet, contextId);
|
||||
},
|
||||
icon: "delete-outline"
|
||||
}
|
||||
@@ -230,16 +227,18 @@ const Actions = ({ attachment, setAttachments, fwdRef }) => {
|
||||
{formatBytes(attachment.length)}
|
||||
</Paragraph>
|
||||
|
||||
<Paragraph
|
||||
style={{
|
||||
marginRight: 10
|
||||
}}
|
||||
size={SIZE.xs + 1}
|
||||
color={colors.icon}
|
||||
>
|
||||
{attachment.noteIds.length} note
|
||||
{attachment.noteIds.length > 1 ? "s" : ""}
|
||||
</Paragraph>
|
||||
{attachment.noteIds ? (
|
||||
<Paragraph
|
||||
style={{
|
||||
marginRight: 10
|
||||
}}
|
||||
size={SIZE.xs + 1}
|
||||
color={colors.icon}
|
||||
>
|
||||
{attachment.noteIds.length} note
|
||||
{attachment.noteIds.length > 1 ? "s" : ""}
|
||||
</Paragraph>
|
||||
) : null}
|
||||
<Paragraph
|
||||
onPress={() => {
|
||||
Clipboard.setString(attachment.metadata.hash);
|
||||
@@ -291,7 +290,7 @@ const Actions = ({ attachment, setAttachments, fwdRef }) => {
|
||||
});
|
||||
return;
|
||||
}
|
||||
eSendEvent(eCloseProgressDialog, contextId);
|
||||
eSendEvent(eCloseSheet, contextId);
|
||||
await sleep(150);
|
||||
eSendEvent(eCloseAttachmentDialog);
|
||||
await sleep(300);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -36,7 +36,11 @@ function getFileExtension(filename) {
|
||||
var ext = /^.+\.([^.]+)$/.exec(filename);
|
||||
return ext == null ? "" : ext[1];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {any} param0
|
||||
* @returns
|
||||
*/
|
||||
export const AttachmentItem = ({ attachment, encryption, setAttachments }) => {
|
||||
const colors = useThemeStore((state) => state.colors);
|
||||
const [currentProgress, setCurrentProgress] = useAttachmentProgress(
|
||||
@@ -46,7 +50,6 @@ export const AttachmentItem = ({ attachment, encryption, setAttachments }) => {
|
||||
const encryptionProgress = useAttachmentStore(
|
||||
(state) => state.encryptionProgress
|
||||
);
|
||||
|
||||
const onPress = () => {
|
||||
Actions.present(attachment, setAttachments, attachment.metadata.hash);
|
||||
};
|
||||
@@ -122,7 +125,9 @@ export const AttachmentItem = ({ attachment, encryption, setAttachments }) => {
|
||||
</View>
|
||||
</View>
|
||||
|
||||
{currentProgress || encryptionProgress || encryption ? (
|
||||
{currentProgress ||
|
||||
(encryptionProgress && encryptionProgress !== "0.00") ||
|
||||
encryption ? (
|
||||
<TouchableOpacity
|
||||
activeOpacity={0.9}
|
||||
onPress={() => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -17,70 +17,33 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import React, { useRef, useState } from "react";
|
||||
import { View } from "react-native";
|
||||
import { FlatList } from "react-native-gesture-handler";
|
||||
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
|
||||
import { db } from "../../common/database";
|
||||
import filesystem from "../../common/filesystem";
|
||||
import {
|
||||
eSubscribeEvent,
|
||||
eUnSubscribeEvent
|
||||
} from "../../services/event-manager";
|
||||
import { presentSheet } from "../../services/event-manager";
|
||||
import { useThemeStore } from "../../stores/use-theme-store";
|
||||
import {
|
||||
eCloseAttachmentDialog,
|
||||
eOpenAttachmentsDialog
|
||||
} from "../../utils/events";
|
||||
import { SIZE } from "../../utils/size";
|
||||
import DialogHeader from "../dialog/dialog-header";
|
||||
import { Toast } from "../toast";
|
||||
import Input from "../ui/input";
|
||||
import Seperator from "../ui/seperator";
|
||||
import SheetWrapper from "../ui/sheet";
|
||||
import Paragraph from "../ui/typography/paragraph";
|
||||
import { AttachmentItem } from "./attachment-item";
|
||||
export const AttachmentDialog = () => {
|
||||
import { FlatList } from "react-native-actions-sheet";
|
||||
|
||||
export const AttachmentDialog = ({ data }) => {
|
||||
const colors = useThemeStore((state) => state.colors);
|
||||
const [visible, setVisible] = useState(false);
|
||||
const [note, setNote] = useState(null);
|
||||
const actionSheetRef = useRef();
|
||||
const [attachments, setAttachments] = useState([]);
|
||||
const [note, setNote] = useState(data);
|
||||
const [attachments, setAttachments] = useState(
|
||||
data
|
||||
? db.attachments.ofNote(data.id, "all")
|
||||
: [...(db.attachments.all || [])]
|
||||
);
|
||||
const attachmentSearchValue = useRef();
|
||||
const searchTimer = useRef();
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
eSubscribeEvent(eOpenAttachmentsDialog, open);
|
||||
eSubscribeEvent(eCloseAttachmentDialog, close);
|
||||
return () => {
|
||||
eUnSubscribeEvent(eOpenAttachmentsDialog, open);
|
||||
eUnSubscribeEvent(eCloseAttachmentDialog, close);
|
||||
};
|
||||
}, [visible]);
|
||||
|
||||
const open = (data) => {
|
||||
if (data?.id) {
|
||||
setNote(data);
|
||||
let _attachments = db.attachments.ofNote(data.id, "all");
|
||||
setAttachments(_attachments);
|
||||
} else {
|
||||
setAttachments([...db.attachments.all]);
|
||||
}
|
||||
setVisible(true);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (visible) {
|
||||
actionSheetRef.current?.show();
|
||||
}
|
||||
}, [visible]);
|
||||
|
||||
const close = () => {
|
||||
actionSheetRef.current?.hide();
|
||||
setVisible(false);
|
||||
};
|
||||
|
||||
const onChangeText = (text) => {
|
||||
attachmentSearchValue.current = text;
|
||||
if (
|
||||
@@ -104,107 +67,101 @@ export const AttachmentDialog = () => {
|
||||
<AttachmentItem setAttachments={setAttachments} attachment={item} />
|
||||
);
|
||||
|
||||
return !visible ? null : (
|
||||
<SheetWrapper
|
||||
centered={false}
|
||||
fwdRef={actionSheetRef}
|
||||
onClose={async () => {
|
||||
setVisible(false);
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
width: "100%",
|
||||
alignSelf: "center",
|
||||
paddingHorizontal: 12
|
||||
}}
|
||||
>
|
||||
<Toast context="local" />
|
||||
<View
|
||||
style={{
|
||||
width: "100%",
|
||||
alignSelf: "center",
|
||||
paddingHorizontal: 12
|
||||
}}
|
||||
>
|
||||
<DialogHeader
|
||||
title={note ? "Attachments" : "Manage attachments"}
|
||||
paragraph="Tap on an attachment to view properties"
|
||||
button={{
|
||||
title: "Check all",
|
||||
type: "grayAccent",
|
||||
loading: loading,
|
||||
onPress: async () => {
|
||||
setLoading(true);
|
||||
for (let attachment of attachments) {
|
||||
let result = await filesystem.checkAttachment(
|
||||
attachment.metadata.hash
|
||||
<DialogHeader
|
||||
title={note ? "Attachments" : "Manage attachments"}
|
||||
paragraph="Tap on an attachment to view properties"
|
||||
button={{
|
||||
title: "Check all",
|
||||
type: "grayAccent",
|
||||
loading: loading,
|
||||
onPress: async () => {
|
||||
setLoading(true);
|
||||
for (let attachment of attachments) {
|
||||
let result = await filesystem.checkAttachment(
|
||||
attachment.metadata.hash
|
||||
);
|
||||
if (result.failed) {
|
||||
db.attachments.markAsFailed(
|
||||
attachment.metadata.hash,
|
||||
result.failed
|
||||
);
|
||||
if (result.failed) {
|
||||
db.attachments.markAsFailed(
|
||||
attachment.metadata.hash,
|
||||
result.failed
|
||||
);
|
||||
} else {
|
||||
db.attachments.markAsFailed(attachment.id, null);
|
||||
}
|
||||
setAttachments([...db.attachments.all]);
|
||||
} else {
|
||||
db.attachments.markAsFailed(attachment.id, null);
|
||||
}
|
||||
setLoading(false);
|
||||
setAttachments([...db.attachments.all]);
|
||||
}
|
||||
setLoading(false);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Seperator />
|
||||
{!note ? (
|
||||
<Input
|
||||
placeholder="Filter attachments by filename, type or hash"
|
||||
onChangeText={onChangeText}
|
||||
onSubmit={() => {
|
||||
onChangeText(attachmentSearchValue.current);
|
||||
}}
|
||||
/>
|
||||
<Seperator />
|
||||
{!note ? (
|
||||
<Input
|
||||
placeholder="Filter attachments by filename, type or hash"
|
||||
onChangeText={onChangeText}
|
||||
onSubmit={() => {
|
||||
onChangeText(attachmentSearchValue.current);
|
||||
) : null}
|
||||
|
||||
<FlatList
|
||||
keyboardDismissMode="none"
|
||||
keyboardShouldPersistTaps="always"
|
||||
maxToRenderPerBatch={10}
|
||||
initialNumToRender={10}
|
||||
windowSize={5}
|
||||
ListEmptyComponent={
|
||||
<View
|
||||
style={{
|
||||
height: 150,
|
||||
justifyContent: "center",
|
||||
alignItems: "center"
|
||||
}}
|
||||
>
|
||||
<Icon name="attachment" size={60} color={colors.icon} />
|
||||
<Paragraph>
|
||||
{note ? "No attachments on this note" : "No attachments"}
|
||||
</Paragraph>
|
||||
</View>
|
||||
}
|
||||
ListFooterComponent={
|
||||
<View
|
||||
style={{
|
||||
height: 350
|
||||
}}
|
||||
/>
|
||||
) : null}
|
||||
}
|
||||
data={attachments}
|
||||
keyExtractor={(item) => item.id}
|
||||
renderItem={renderItem}
|
||||
/>
|
||||
|
||||
<FlatList
|
||||
nestedScrollEnabled
|
||||
overScrollMode="never"
|
||||
scrollToOverflowEnabled={false}
|
||||
keyboardDismissMode="none"
|
||||
keyboardShouldPersistTaps="always"
|
||||
onMomentumScrollEnd={() => {
|
||||
actionSheetRef.current?.handleChildScrollEnd();
|
||||
}}
|
||||
ListEmptyComponent={
|
||||
<View
|
||||
style={{
|
||||
height: 150,
|
||||
justifyContent: "center",
|
||||
alignItems: "center"
|
||||
}}
|
||||
>
|
||||
<Icon name="attachment" size={60} color={colors.icon} />
|
||||
<Paragraph>
|
||||
{note ? "No attachments on this note" : "No attachments"}
|
||||
</Paragraph>
|
||||
</View>
|
||||
}
|
||||
ListFooterComponent={
|
||||
<View
|
||||
style={{
|
||||
height: 350
|
||||
}}
|
||||
/>
|
||||
}
|
||||
data={attachments}
|
||||
keyExtractor={(item) => item.id}
|
||||
renderItem={renderItem}
|
||||
/>
|
||||
|
||||
<Paragraph
|
||||
color={colors.icon}
|
||||
size={SIZE.xs}
|
||||
style={{
|
||||
textAlign: "center",
|
||||
marginTop: 10
|
||||
}}
|
||||
>
|
||||
<Icon name="shield-key-outline" size={SIZE.xs} color={colors.icon} />
|
||||
{" "}All attachments are end-to-end encrypted.
|
||||
</Paragraph>
|
||||
</View>
|
||||
</SheetWrapper>
|
||||
<Paragraph
|
||||
color={colors.icon}
|
||||
size={SIZE.xs}
|
||||
style={{
|
||||
textAlign: "center",
|
||||
marginTop: 10
|
||||
}}
|
||||
>
|
||||
<Icon name="shield-key-outline" size={SIZE.xs} color={colors.icon} />
|
||||
{" "}All attachments are end-to-end encrypted.
|
||||
</Paragraph>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
AttachmentDialog.present = (note) => {
|
||||
presentSheet({
|
||||
component: () => <AttachmentDialog data={note} />
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
ToastEvent
|
||||
} from "../../services/event-manager";
|
||||
import { useUserStore } from "../../stores/use-user-store";
|
||||
import { eCloseProgressDialog } from "../../utils/events";
|
||||
import { eCloseSheet } from "../../utils/events";
|
||||
import DialogHeader from "../dialog/dialog-header";
|
||||
import { Button } from "../ui/button";
|
||||
import Input from "../ui/input";
|
||||
@@ -72,7 +72,7 @@ export const ChangePassword = () => {
|
||||
context: "global"
|
||||
});
|
||||
setLoading(false);
|
||||
eSendEvent(eCloseProgressDialog);
|
||||
eSendEvent(eCloseSheet);
|
||||
} catch (e) {
|
||||
setLoading(false);
|
||||
ToastEvent.show({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -97,6 +97,9 @@ export const ForgotPassword = () => {
|
||||
text: email.current
|
||||
});
|
||||
}}
|
||||
indicatorStyle={{
|
||||
width: 100
|
||||
}}
|
||||
gestureEnabled
|
||||
id="forgotpassword_sheet"
|
||||
>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -17,21 +17,15 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { View } from "react-native";
|
||||
import { SheetManager } from "react-native-actions-sheet";
|
||||
import Animated, { FadeInDown, FadeOutUp } from "react-native-reanimated";
|
||||
import { db } from "../../common/database";
|
||||
import { DDS } from "../../services/device-detection";
|
||||
import { eSendEvent, ToastEvent } from "../../services/event-manager";
|
||||
import { clearMessage } from "../../services/message";
|
||||
import PremiumService from "../../services/premium";
|
||||
import SettingsService from "../../services/settings";
|
||||
import { eSendEvent } from "../../services/event-manager";
|
||||
import { useThemeStore } from "../../stores/use-theme-store";
|
||||
import { useUserStore } from "../../stores/use-user-store";
|
||||
import { SIZE } from "../../utils/size";
|
||||
import { sleep } from "../../utils/time";
|
||||
import BaseDialog from "../dialog/base-dialog";
|
||||
import SheetProvider from "../sheet-provider";
|
||||
import { Progress } from "../sheets/progress";
|
||||
import { Button } from "../ui/button";
|
||||
@@ -42,108 +36,52 @@ import Paragraph from "../ui/typography/paragraph";
|
||||
import { SVG } from "./background";
|
||||
import { hideAuth } from "./common";
|
||||
import { ForgotPassword } from "./forgot-password";
|
||||
import TwoFactorVerification from "./two-factor";
|
||||
import { useLogin } from "./use-login";
|
||||
|
||||
const LoginSteps = {
|
||||
emailAuth: 1,
|
||||
mfaAuth: 2,
|
||||
passwordAuth: 3
|
||||
};
|
||||
|
||||
export const Login = ({ changeMode }) => {
|
||||
const colors = useThemeStore((state) => state.colors);
|
||||
const email = useRef();
|
||||
const emailInputRef = useRef();
|
||||
const passwordInputRef = useRef();
|
||||
const password = useRef();
|
||||
const [focused, setFocused] = useState(false);
|
||||
const [error, setError] = useState(false);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const setUser = useUserStore((state) => state.setUser);
|
||||
|
||||
const validateInfo = () => {
|
||||
if (!password.current || !email.current) {
|
||||
ToastEvent.show({
|
||||
heading: "All fields required",
|
||||
message: "Fill all the fields and try again",
|
||||
type: "error",
|
||||
context: "local"
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
const {
|
||||
step,
|
||||
setStep,
|
||||
password,
|
||||
email,
|
||||
emailInputRef,
|
||||
passwordInputRef,
|
||||
loading,
|
||||
setLoading,
|
||||
setError,
|
||||
login
|
||||
} = useLogin(async () => {
|
||||
hideAuth();
|
||||
eSendEvent("userLoggedIn", true);
|
||||
await sleep(500);
|
||||
Progress.present();
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
async () => {
|
||||
setStep(LoginSteps.emailAuth);
|
||||
await sleep(500);
|
||||
emailInputRef.current?.focus();
|
||||
setFocused(true);
|
||||
};
|
||||
return () => {
|
||||
setStep(LoginSteps.emailAuth);
|
||||
};
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
const login = async (mfa, callback) => {
|
||||
if (!validateInfo() || error) return;
|
||||
setLoading(true);
|
||||
let user;
|
||||
try {
|
||||
if (mfa) {
|
||||
await db.user.mfaLogin(
|
||||
email.current.toLowerCase(),
|
||||
password.current,
|
||||
mfa
|
||||
);
|
||||
} else {
|
||||
await db.user.login(email.current.toLowerCase(), password.current);
|
||||
}
|
||||
callback && callback(true);
|
||||
|
||||
user = await db.user.getUser();
|
||||
if (!user) throw new Error("Email or password incorrect!");
|
||||
PremiumService.setPremiumStatus();
|
||||
setUser(user);
|
||||
clearMessage();
|
||||
ToastEvent.show({
|
||||
heading: "Login successful",
|
||||
message: `Logged in as ${user.email}`,
|
||||
type: "success",
|
||||
context: "global"
|
||||
});
|
||||
hideAuth();
|
||||
SettingsService.set({
|
||||
sessionExpired: false,
|
||||
userEmailConfirmed: user?.isEmailConfirmed
|
||||
});
|
||||
eSendEvent("userLoggedIn", true);
|
||||
await sleep(500);
|
||||
Progress.present();
|
||||
} catch (e) {
|
||||
callback && callback(false);
|
||||
if (e.message === "Multifactor authentication required.") {
|
||||
setLoading(false);
|
||||
await sleep(300);
|
||||
TwoFactorVerification.present(async (mfa) => {
|
||||
if (mfa) {
|
||||
await login(mfa);
|
||||
} else {
|
||||
setLoading(false);
|
||||
}
|
||||
}, e.data);
|
||||
} else {
|
||||
setLoading(false);
|
||||
ToastEvent.show({
|
||||
heading: user ? "Failed to sync" : "Login failed",
|
||||
message: e.message,
|
||||
type: "error",
|
||||
context: "local"
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<ForgotPassword />
|
||||
<SheetProvider context="two_factor_verify" />
|
||||
{loading ? (
|
||||
<BaseDialog transparent={true} visible={true} animation="fade" />
|
||||
) : null}
|
||||
<Animated.View
|
||||
entering={FadeInDown}
|
||||
exiting={FadeOutUp}
|
||||
@@ -192,6 +130,7 @@ export const Login = ({ changeMode }) => {
|
||||
marginTop: 5
|
||||
}}
|
||||
onPress={() => {
|
||||
if (loading) return;
|
||||
changeMode(1);
|
||||
}}
|
||||
size={SIZE.md}
|
||||
@@ -228,48 +167,56 @@ export const Login = ({ changeMode }) => {
|
||||
autoCorrect={false}
|
||||
autoCapitalize="none"
|
||||
errorMessage="Email is invalid"
|
||||
placeholder="Email"
|
||||
placeholder="Enter your email"
|
||||
defaultValue={email.current}
|
||||
editable={step === LoginSteps.emailAuth && !loading}
|
||||
onSubmit={() => {
|
||||
passwordInputRef.current?.focus();
|
||||
}}
|
||||
/>
|
||||
|
||||
<Input
|
||||
fwdRef={passwordInputRef}
|
||||
onChangeText={(value) => {
|
||||
password.current = value;
|
||||
}}
|
||||
testID="input.password"
|
||||
returnKeyLabel="Done"
|
||||
returnKeyType="done"
|
||||
secureTextEntry
|
||||
autoComplete="password"
|
||||
autoCapitalize="none"
|
||||
autoCorrect={false}
|
||||
placeholder="Password"
|
||||
marginBottom={0}
|
||||
onSubmit={() => login()}
|
||||
/>
|
||||
<Button
|
||||
title="Forgot your password?"
|
||||
style={{
|
||||
alignSelf: "flex-end",
|
||||
height: 30,
|
||||
paddingHorizontal: 0
|
||||
}}
|
||||
onPress={() => {
|
||||
SheetManager.show("forgotpassword_sheet", email.current);
|
||||
}}
|
||||
textStyle={{
|
||||
textDecorationLine: "underline"
|
||||
}}
|
||||
fontSize={SIZE.xs}
|
||||
type="gray"
|
||||
/>
|
||||
{step === LoginSteps.passwordAuth && (
|
||||
<>
|
||||
<Input
|
||||
fwdRef={passwordInputRef}
|
||||
onChangeText={(value) => {
|
||||
password.current = value;
|
||||
}}
|
||||
testID="input.password"
|
||||
returnKeyLabel="Done"
|
||||
returnKeyType="done"
|
||||
secureTextEntry
|
||||
autoComplete="password"
|
||||
autoCapitalize="none"
|
||||
autoCorrect={false}
|
||||
placeholder="Password"
|
||||
marginBottom={0}
|
||||
editable={!loading}
|
||||
defaultValue={password.current}
|
||||
onSubmit={() => login()}
|
||||
/>
|
||||
<Button
|
||||
title="Forgot your password?"
|
||||
style={{
|
||||
alignSelf: "flex-end",
|
||||
height: 30,
|
||||
paddingHorizontal: 0
|
||||
}}
|
||||
onPress={() => {
|
||||
if (loading) return;
|
||||
SheetManager.show("forgotpassword_sheet", email.current);
|
||||
}}
|
||||
textStyle={{
|
||||
textDecorationLine: "underline"
|
||||
}}
|
||||
fontSize={SIZE.xs}
|
||||
type="gray"
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
<View
|
||||
style={{
|
||||
// position: 'absolute',
|
||||
marginTop: 25,
|
||||
alignSelf: "center"
|
||||
}}
|
||||
@@ -280,11 +227,40 @@ export const Login = ({ changeMode }) => {
|
||||
borderRadius: 100
|
||||
}}
|
||||
loading={loading}
|
||||
onPress={() => login()}
|
||||
// width="100%"
|
||||
onPress={() => {
|
||||
if (loading) return;
|
||||
login();
|
||||
}}
|
||||
type="accent"
|
||||
title={loading ? null : "Login to your account"}
|
||||
title={
|
||||
loading
|
||||
? null
|
||||
: step === LoginSteps.emailAuth
|
||||
? "Login"
|
||||
: "Continue"
|
||||
}
|
||||
/>
|
||||
|
||||
{step === LoginSteps.passwordAuth && (
|
||||
<Button
|
||||
title="Cancel logging in"
|
||||
style={{
|
||||
alignSelf: "center",
|
||||
height: 30,
|
||||
marginTop: 10
|
||||
}}
|
||||
onPress={() => {
|
||||
if (loading) return;
|
||||
setStep(LoginSteps.emailAuth);
|
||||
setLoading(false);
|
||||
}}
|
||||
textStyle={{
|
||||
textDecorationLine: "underline"
|
||||
}}
|
||||
fontSize={SIZE.xs}
|
||||
type="errorShade"
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
</Animated.View>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Modal, View } from "react-native";
|
||||
import { db } from "../../common/database";
|
||||
import BiometricService from "../../services/biometrics";
|
||||
@@ -27,29 +27,27 @@ import {
|
||||
eUnSubscribeEvent,
|
||||
ToastEvent
|
||||
} from "../../services/event-manager";
|
||||
import { clearMessage } from "../../services/message";
|
||||
import PremiumService from "../../services/premium";
|
||||
import SettingsService from "../../services/settings";
|
||||
import Sync from "../../services/sync";
|
||||
import { useThemeStore } from "../../stores/use-theme-store";
|
||||
import { useUserStore } from "../../stores/use-user-store";
|
||||
import { SIZE } from "../../utils/size";
|
||||
import { sleep } from "../../utils/time";
|
||||
import { Dialog } from "../dialog";
|
||||
import { presentDialog } from "../dialog/functions";
|
||||
import SheetProvider from "../sheet-provider";
|
||||
import { Progress } from "../sheets/progress";
|
||||
import { Toast } from "../toast";
|
||||
import { Button } from "../ui/button";
|
||||
import { IconButton } from "../ui/icon-button";
|
||||
import Input from "../ui/input";
|
||||
import Heading from "../ui/typography/heading";
|
||||
import Paragraph from "../ui/typography/paragraph";
|
||||
import TwoFactorVerification from "./two-factor";
|
||||
import { LoginSteps, useLogin } from "./use-login";
|
||||
|
||||
function getEmail(email) {
|
||||
if (!email) return null;
|
||||
return email.replace(/(.{2})(.*)(?=@)/, function (gp1, gp2, gp3) {
|
||||
function getObfuscatedEmail(email) {
|
||||
if (!email) return "";
|
||||
const [username, provider] = email.split("@");
|
||||
if (username.length === 1) return `****@${provider}`;
|
||||
return email.replace(/(.{1})(.*)(?=@)/, function (gp1, gp2, gp3) {
|
||||
for (let i = 0; i < gp3.length; i++) {
|
||||
gp2 += "*";
|
||||
}
|
||||
@@ -59,15 +57,14 @@ function getEmail(email) {
|
||||
|
||||
export const SessionExpired = () => {
|
||||
const colors = useThemeStore((state) => state.colors);
|
||||
const email = useRef();
|
||||
const passwordInputRef = useRef();
|
||||
const password = useRef();
|
||||
const [visible, setVisible] = useState(false);
|
||||
const [focused, setFocused] = useState(false);
|
||||
|
||||
const setUser = useUserStore((state) => state.setUser);
|
||||
|
||||
const [loading, setLoading] = useState(false);
|
||||
const { step, password, email, passwordInputRef, loading, login } = useLogin(
|
||||
() => {
|
||||
eSendEvent("userLoggedIn", true);
|
||||
setVisible(false);
|
||||
}
|
||||
);
|
||||
|
||||
const logout = async () => {
|
||||
try {
|
||||
@@ -92,9 +89,9 @@ export const SessionExpired = () => {
|
||||
eUnSubscribeEvent("session_expired", open);
|
||||
setFocused(false);
|
||||
};
|
||||
}, [visible]);
|
||||
}, [visible, open]);
|
||||
|
||||
const open = async () => {
|
||||
const open = React.useCallback(async () => {
|
||||
try {
|
||||
let res = await db.user.tokenManager.getToken();
|
||||
if (!res) throw new Error("no token found");
|
||||
@@ -120,64 +117,8 @@ export const SessionExpired = () => {
|
||||
email.current = user.email;
|
||||
setVisible(true);
|
||||
}
|
||||
};
|
||||
}, [email]);
|
||||
|
||||
const login = async (mfa, callback) => {
|
||||
setLoading(true);
|
||||
let user;
|
||||
try {
|
||||
if (mfa) {
|
||||
await db.user.mfaLogin(
|
||||
email.current.toLowerCase(),
|
||||
password.current,
|
||||
mfa
|
||||
);
|
||||
} else {
|
||||
await db.user.login(email.current.toLowerCase(), password.current);
|
||||
}
|
||||
callback && callback(true);
|
||||
setVisible(false);
|
||||
user = await db.user.getUser();
|
||||
if (!user) throw new Error("Email or password incorrect!");
|
||||
PremiumService.setPremiumStatus();
|
||||
setUser(user);
|
||||
clearMessage();
|
||||
ToastEvent.show({
|
||||
heading: "Login successful",
|
||||
message: `Logged in as ${user.email}`,
|
||||
type: "success",
|
||||
context: "global"
|
||||
});
|
||||
await SettingsService.set({
|
||||
sessionExpired: false,
|
||||
userEmailConfirmed: user?.isEmailConfirmed
|
||||
});
|
||||
eSendEvent("userLoggedIn", true);
|
||||
await sleep(500);
|
||||
Progress.present();
|
||||
setLoading(false);
|
||||
} catch (e) {
|
||||
callback && callback(false);
|
||||
if (e.message === "Multifactor authentication required.") {
|
||||
TwoFactorVerification.present(async (mfa) => {
|
||||
if (mfa) {
|
||||
await login(mfa);
|
||||
} else {
|
||||
setLoading(false);
|
||||
}
|
||||
}, e.data);
|
||||
} else {
|
||||
console.log(e.stack);
|
||||
setLoading(false);
|
||||
ToastEvent.show({
|
||||
heading: user ? "Failed to sync" : "Login failed",
|
||||
message: e.message,
|
||||
type: "error",
|
||||
context: "local"
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
return (
|
||||
visible && (
|
||||
<Modal
|
||||
@@ -194,7 +135,8 @@ export const SessionExpired = () => {
|
||||
width: focused ? "100%" : "99.9%",
|
||||
padding: 12,
|
||||
justifyContent: "center",
|
||||
flex: 1
|
||||
flex: 1,
|
||||
backgroundColor: colors.bg
|
||||
}}
|
||||
>
|
||||
<View
|
||||
@@ -225,29 +167,32 @@ export const SessionExpired = () => {
|
||||
}}
|
||||
>
|
||||
Your session on this device has expired. Please enter password for{" "}
|
||||
{getEmail(email.current)} to continue.
|
||||
{getObfuscatedEmail(email.current)} to continue.
|
||||
</Paragraph>
|
||||
</View>
|
||||
|
||||
<Input
|
||||
fwdRef={passwordInputRef}
|
||||
onChangeText={(value) => {
|
||||
password.current = value;
|
||||
}}
|
||||
returnKeyLabel="Next"
|
||||
returnKeyType="next"
|
||||
secureTextEntry
|
||||
autoComplete="password"
|
||||
autoCapitalize="none"
|
||||
autoCorrect={false}
|
||||
placeholder="Password"
|
||||
onSubmit={() => login()}
|
||||
/>
|
||||
{step === LoginSteps.passwordAuth ? (
|
||||
<Input
|
||||
fwdRef={passwordInputRef}
|
||||
onChangeText={(value) => {
|
||||
password.current = value;
|
||||
}}
|
||||
returnKeyLabel="Next"
|
||||
returnKeyType="next"
|
||||
secureTextEntry
|
||||
autoComplete="password"
|
||||
autoCapitalize="none"
|
||||
autoCorrect={false}
|
||||
placeholder="Password"
|
||||
onSubmit={() => login()}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
<Button
|
||||
style={{
|
||||
marginTop: 10,
|
||||
width: "100%"
|
||||
width: 250,
|
||||
borderRadius: 100
|
||||
}}
|
||||
loading={loading}
|
||||
onPress={() => login()}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -20,7 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
import React, { useRef, useState } from "react";
|
||||
import { Dimensions, View } from "react-native";
|
||||
import Animated, { FadeInDown, FadeOutUp } from "react-native-reanimated";
|
||||
import umami from "../../common/analytics";
|
||||
import { db } from "../../common/database";
|
||||
import { DDS } from "../../services/device-detection";
|
||||
import { ToastEvent } from "../../services/event-manager";
|
||||
@@ -31,7 +30,6 @@ import { useUserStore } from "../../stores/use-user-store";
|
||||
import { openLinkInBrowser } from "../../utils/functions";
|
||||
import { SIZE } from "../../utils/size";
|
||||
import { sleep } from "../../utils/time";
|
||||
import BaseDialog from "../dialog/base-dialog";
|
||||
import { Button } from "../ui/button";
|
||||
import Input from "../ui/input";
|
||||
import { SvgView } from "../ui/svg";
|
||||
@@ -79,7 +77,6 @@ export const Signup = ({ changeMode, trial }) => {
|
||||
clearMessage();
|
||||
setEmailVerifyMessage();
|
||||
hideAuth();
|
||||
umami.pageView("/account-created", "/welcome/signup");
|
||||
await sleep(300);
|
||||
if (trial) {
|
||||
PremiumService.sheet(null, null, true);
|
||||
@@ -99,9 +96,6 @@ export const Signup = ({ changeMode, trial }) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
{loading ? (
|
||||
<BaseDialog transparent={true} visible={true} animation="fade" />
|
||||
) : null}
|
||||
<Animated.View
|
||||
entering={FadeInDown}
|
||||
exiting={FadeOutUp}
|
||||
@@ -150,6 +144,7 @@ export const Signup = ({ changeMode, trial }) => {
|
||||
textAlign: "center"
|
||||
}}
|
||||
onPress={() => {
|
||||
if (loading) return;
|
||||
changeMode(0);
|
||||
}}
|
||||
size={SIZE.md}
|
||||
@@ -237,7 +232,10 @@ export const Signup = ({ changeMode, trial }) => {
|
||||
borderRadius: 100
|
||||
}}
|
||||
loading={loading}
|
||||
onPress={signup}
|
||||
onPress={() => {
|
||||
if (loading) return;
|
||||
signup();
|
||||
}}
|
||||
type="accent"
|
||||
title={loading ? null : "Agree and continue"}
|
||||
/>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -27,7 +27,7 @@ import {
|
||||
ToastEvent
|
||||
} from "../../services/event-manager";
|
||||
import { useThemeStore } from "../../stores/use-theme-store";
|
||||
import { eCloseProgressDialog } from "../../utils/events";
|
||||
import { eCloseSheet } from "../../utils/events";
|
||||
import { SIZE } from "../../utils/size";
|
||||
import { Button } from "../ui/button";
|
||||
import { IconButton } from "../ui/icon-button";
|
||||
@@ -54,7 +54,7 @@ const TwoFactorVerification = ({ onMfaLogin, mfaInfo }) => {
|
||||
app: "Enter the 6 digit code from your authenticator app to continue logging in",
|
||||
sms: "Enter the 6 digit code sent to your phone number to continue logging in",
|
||||
email: "Enter the 6 digit code sent to your email to continue logging in",
|
||||
recoveryCode: "Enter the 8 digit recovery code to continue logging in"
|
||||
recoveryCode: "Enter the recovery code to continue logging in"
|
||||
};
|
||||
|
||||
const secondaryMethodsText = {
|
||||
@@ -65,9 +65,7 @@ const TwoFactorVerification = ({ onMfaLogin, mfaInfo }) => {
|
||||
};
|
||||
|
||||
const onNext = async () => {
|
||||
const length = currentMethod.method === "recoveryCode" ? 8 : 6;
|
||||
|
||||
if (!code.current || code.current.length !== length) return;
|
||||
if (!code.current || code.current.length < 6) return;
|
||||
setLoading(true);
|
||||
inputRef.current?.blur();
|
||||
await onMfaLogin(
|
||||
@@ -77,7 +75,7 @@ const TwoFactorVerification = ({ onMfaLogin, mfaInfo }) => {
|
||||
},
|
||||
(result) => {
|
||||
if (result) {
|
||||
eSendEvent(eCloseProgressDialog, "two_factor_verify");
|
||||
eSendEvent(eCloseSheet, "two_factor_verify");
|
||||
}
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -202,21 +200,26 @@ const TwoFactorVerification = ({ onMfaLogin, mfaInfo }) => {
|
||||
<>
|
||||
<Input
|
||||
placeholder={
|
||||
currentMethod.method === "recoveryCode" ? "xxxxxxxx" : "xxxxxx"
|
||||
currentMethod.method === "recoveryCode"
|
||||
? "xxxxx-xxxxx"
|
||||
: "xxxxxx"
|
||||
}
|
||||
testID={"input.totp"}
|
||||
maxLength={
|
||||
currentMethod.method === "recoveryCode" ? undefined : 6
|
||||
}
|
||||
maxLength={currentMethod.method === "recoveryCode" ? 8 : 6}
|
||||
fwdRef={inputRef}
|
||||
textAlign="center"
|
||||
onChangeText={(value) => {
|
||||
code.current = value;
|
||||
onNext();
|
||||
//onNext();
|
||||
}}
|
||||
inputStyle={{
|
||||
fontSize: SIZE.lg,
|
||||
height: 60,
|
||||
textAlign: "center",
|
||||
letterSpacing: 10,
|
||||
width: null
|
||||
width: 250
|
||||
}}
|
||||
keyboardType={
|
||||
currentMethod.method === "recoveryCode" ? "default" : "numeric"
|
||||
@@ -299,7 +302,9 @@ const TwoFactorVerification = ({ onMfaLogin, mfaInfo }) => {
|
||||
|
||||
TwoFactorVerification.present = (onMfaLogin, data, context) => {
|
||||
presentSheet({
|
||||
component: <TwoFactorVerification onMfaLogin={onMfaLogin} mfaInfo={data} />,
|
||||
component: () => (
|
||||
<TwoFactorVerification onMfaLogin={onMfaLogin} mfaInfo={data} />
|
||||
),
|
||||
context: context || "two_factor_verify",
|
||||
onClose: () => {
|
||||
onMfaLogin();
|
||||
|
||||
158
apps/mobile/app/components/auth/use-login.js
Normal file
158
apps/mobile/app/components/auth/use-login.js
Normal file
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { useRef, useState } from "react";
|
||||
import { db } from "../../common/database";
|
||||
import { eSendEvent, ToastEvent } from "../../services/event-manager";
|
||||
import { clearMessage } from "../../services/message";
|
||||
import PremiumService from "../../services/premium";
|
||||
import SettingsService from "../../services/settings";
|
||||
import { useUserStore } from "../../stores/use-user-store";
|
||||
import { eCloseSheet } from "../../utils/events";
|
||||
import TwoFactorVerification from "./two-factor";
|
||||
|
||||
export const LoginSteps = {
|
||||
emailAuth: 1,
|
||||
mfaAuth: 2,
|
||||
passwordAuth: 3
|
||||
};
|
||||
|
||||
export const useLogin = (onFinishLogin) => {
|
||||
const [error, setError] = useState(false);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const setUser = useUserStore((state) => state.setUser);
|
||||
const [step, setStep] = useState(LoginSteps.emailAuth);
|
||||
const email = useRef();
|
||||
const password = useRef();
|
||||
const emailInputRef = useRef();
|
||||
const passwordInputRef = useRef();
|
||||
|
||||
const validateInfo = () => {
|
||||
if (
|
||||
(!password.current && step === LoginSteps.passwordAuth) ||
|
||||
(!email.current && step === LoginSteps.emailAuth)
|
||||
) {
|
||||
ToastEvent.show({
|
||||
heading: "All fields required",
|
||||
message: "Fill all the fields and try again",
|
||||
type: "error",
|
||||
context: "local"
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
const login = async () => {
|
||||
if (!validateInfo() || error) return;
|
||||
try {
|
||||
setLoading(true);
|
||||
switch (step) {
|
||||
case LoginSteps.emailAuth: {
|
||||
const mfaInfo = await db.user.authenticateEmail(email.current);
|
||||
if (mfaInfo) {
|
||||
TwoFactorVerification.present(async (mfa, callback) => {
|
||||
try {
|
||||
const success = await db.user.authenticateMultiFactorCode(
|
||||
mfa.code,
|
||||
mfa.method
|
||||
);
|
||||
|
||||
if (success) {
|
||||
setStep(LoginSteps.passwordAuth);
|
||||
setLoading(false);
|
||||
setTimeout(() => {
|
||||
passwordInputRef.current?.focus();
|
||||
}, 1);
|
||||
callback && callback(true);
|
||||
}
|
||||
callback && callback(false);
|
||||
} catch (e) {
|
||||
callback && callback(false);
|
||||
if (e.message === "invalid_grant") {
|
||||
eSendEvent(eCloseSheet, "two_factor_verify");
|
||||
setLoading(false);
|
||||
setStep(LoginSteps.emailAuth);
|
||||
}
|
||||
}
|
||||
}, mfaInfo);
|
||||
} else {
|
||||
finishWithError(new Error("Unable to send 2FA code"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LoginSteps.passwordAuth: {
|
||||
await db.user.authenticatePassword(email.current, password.current);
|
||||
finishLogin();
|
||||
break;
|
||||
}
|
||||
}
|
||||
setLoading(false);
|
||||
} catch (e) {
|
||||
finishWithError(e);
|
||||
}
|
||||
};
|
||||
|
||||
const finishWithError = async (e) => {
|
||||
if (e.message === "invalid_grant") setStep(LoginSteps.emailAuth);
|
||||
setLoading(false);
|
||||
ToastEvent.show({
|
||||
heading: "Login failed",
|
||||
message: e.message,
|
||||
type: "error",
|
||||
context: "local"
|
||||
});
|
||||
};
|
||||
|
||||
const finishLogin = async () => {
|
||||
const user = await db.user.getUser();
|
||||
if (!user) throw new Error("Email or password incorrect!");
|
||||
PremiumService.setPremiumStatus();
|
||||
setUser(user);
|
||||
clearMessage();
|
||||
ToastEvent.show({
|
||||
heading: "Login successful",
|
||||
message: `Logged in as ${user.email}`,
|
||||
type: "success",
|
||||
context: "global"
|
||||
});
|
||||
SettingsService.set({
|
||||
sessionExpired: false,
|
||||
userEmailConfirmed: user?.isEmailConfirmed
|
||||
});
|
||||
onFinishLogin?.();
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
return {
|
||||
login,
|
||||
step,
|
||||
setStep,
|
||||
email,
|
||||
password,
|
||||
passwordInputRef,
|
||||
emailInputRef,
|
||||
loading,
|
||||
setLoading,
|
||||
error,
|
||||
setError
|
||||
};
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import React from "react";
|
||||
import { KeyboardAvoidingView, Platform, SafeAreaView } from "react-native";
|
||||
import { KeyboardAvoidingView, Platform, View } from "react-native";
|
||||
import useGlobalSafeAreaInsets from "../../hooks/use-global-safe-area-insets";
|
||||
import useIsFloatingKeyboard from "../../hooks/use-is-floating-keyboard";
|
||||
import { useSettingStore } from "../../stores/use-setting-store";
|
||||
import { Header } from "../header";
|
||||
@@ -28,6 +29,7 @@ export const Container = ({ children }) => {
|
||||
const introCompleted = useSettingStore(
|
||||
(state) => state.settings.introCompleted
|
||||
);
|
||||
const insets = useGlobalSafeAreaInsets();
|
||||
return (
|
||||
<KeyboardAvoidingView
|
||||
behavior="padding"
|
||||
@@ -36,10 +38,12 @@ export const Container = ({ children }) => {
|
||||
flex: 1
|
||||
}}
|
||||
>
|
||||
<SafeAreaView
|
||||
<View
|
||||
style={{
|
||||
flex: 1,
|
||||
overflow: "hidden"
|
||||
overflow: "hidden",
|
||||
paddingTop: Platform.OS === "android" ? 0 : insets.top,
|
||||
paddingBottom: Platform.OS === "android" ? 0 : insets.bottom
|
||||
}}
|
||||
>
|
||||
{!introCompleted ? null : (
|
||||
@@ -50,7 +54,7 @@ export const Container = ({ children }) => {
|
||||
)}
|
||||
|
||||
{children}
|
||||
</SafeAreaView>
|
||||
</View>
|
||||
</KeyboardAvoidingView>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -21,11 +21,11 @@ import React from "react";
|
||||
import { useNoteStore } from "../../stores/use-notes-store";
|
||||
import { useThemeStore } from "../../stores/use-theme-store";
|
||||
import { AnnouncementDialog } from "../announcements";
|
||||
import { AttachmentDialog } from "../attachments";
|
||||
import AuthModal from "../auth/auth-modal";
|
||||
import { SessionExpired } from "../auth/session-expired";
|
||||
import { Dialog } from "../dialog";
|
||||
import { AddTopicDialog } from "../dialogs/add-topic";
|
||||
import { LoadingDialog } from "../dialogs/loading";
|
||||
import ResultDialog from "../dialogs/result";
|
||||
import { VaultDialog } from "../dialogs/vault";
|
||||
import ImagePreview from "../image-preview";
|
||||
@@ -33,10 +33,6 @@ import MergeConflicts from "../merge-conflicts";
|
||||
import PremiumDialog from "../premium";
|
||||
import { Expiring } from "../premium/expiring";
|
||||
import SheetProvider from "../sheet-provider";
|
||||
import { AddNotebookSheet } from "../sheets/add-notebook";
|
||||
import AddToNotebookSheet from "../sheets/add-to";
|
||||
import ManageTagsSheet from "../sheets/manage-tags";
|
||||
import PublishNoteSheet from "../sheets/publish-note";
|
||||
import RateAppSheet from "../sheets/rate-app";
|
||||
import RecoveryKeySheet from "../sheets/recovery-key";
|
||||
import RestoreDataSheet from "../sheets/restore-data";
|
||||
@@ -47,9 +43,9 @@ const DialogProvider = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<LoadingDialog />
|
||||
<Dialog context="global" />
|
||||
<AddTopicDialog colors={colors} />
|
||||
<AddNotebookSheet colors={colors} />
|
||||
<PremiumDialog colors={colors} />
|
||||
<AuthModal colors={colors} />
|
||||
<MergeConflicts />
|
||||
@@ -59,12 +55,8 @@ const DialogProvider = () => {
|
||||
<RestoreDataSheet />
|
||||
<ResultDialog />
|
||||
<VaultDialog colors={colors} />
|
||||
<AddToNotebookSheet colors={colors} />
|
||||
<RateAppSheet />
|
||||
<ImagePreview />
|
||||
<PublishNoteSheet />
|
||||
<ManageTagsSheet />
|
||||
<AttachmentDialog />
|
||||
{loading ? null : <Expiring />}
|
||||
<AnnouncementDialog />
|
||||
<SessionExpired />
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import React from "react";
|
||||
import { Text, View } from "react-native";
|
||||
import { Text, View, ViewStyle } from "react-native";
|
||||
import { useThemeStore } from "../../stores/use-theme-store";
|
||||
import { SIZE } from "../../utils/size";
|
||||
import { Button } from "../ui/button";
|
||||
@@ -35,11 +35,13 @@ type DialogHeaderProps = {
|
||||
loading?: boolean;
|
||||
title?: string;
|
||||
type?: PressableButtonProps["type"];
|
||||
icon?: string;
|
||||
};
|
||||
paragraphColor?: string;
|
||||
padding?: number;
|
||||
centered?: boolean;
|
||||
titlePart?: string;
|
||||
style?: ViewStyle;
|
||||
};
|
||||
|
||||
const DialogHeader = ({
|
||||
@@ -49,7 +51,8 @@ const DialogHeader = ({
|
||||
paragraphColor,
|
||||
padding,
|
||||
centered,
|
||||
titlePart
|
||||
titlePart,
|
||||
style
|
||||
}: DialogHeaderProps) => {
|
||||
const colors = useThemeStore((state) => state.colors);
|
||||
|
||||
@@ -61,7 +64,8 @@ const DialogHeader = ({
|
||||
alignItems: "center",
|
||||
justifyContent: "space-between",
|
||||
minHeight: 50,
|
||||
paddingHorizontal: padding
|
||||
paddingHorizontal: padding,
|
||||
...style
|
||||
}}
|
||||
>
|
||||
<View
|
||||
@@ -96,6 +100,7 @@ const DialogHeader = ({
|
||||
loading={button.loading}
|
||||
fontSize={13}
|
||||
title={button.title}
|
||||
icon={button.icon}
|
||||
type={button.type || "grayBg"}
|
||||
height={25}
|
||||
/>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -35,6 +35,7 @@ import BaseDialog from "./base-dialog";
|
||||
import DialogButtons from "./dialog-buttons";
|
||||
import DialogHeader from "./dialog-header";
|
||||
import { useCallback } from "react";
|
||||
import { Button } from "../ui/button";
|
||||
|
||||
export const Dialog = ({ context = "global" }) => {
|
||||
const colors = useThemeStore((state) => state.colors);
|
||||
@@ -54,7 +55,11 @@ export const Dialog = ({ context = "global" }) => {
|
||||
input: false,
|
||||
inputPlaceholder: "Enter some text",
|
||||
defaultValue: "",
|
||||
disableBackdropClosing: false
|
||||
disableBackdropClosing: false,
|
||||
check: {
|
||||
info: "Check",
|
||||
type: "transparent"
|
||||
}
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
@@ -87,6 +92,7 @@ export const Dialog = ({ context = "global" }) => {
|
||||
if (data.context !== context) return;
|
||||
setDialogInfo(data);
|
||||
setVisible(true);
|
||||
setInputValue(data.defaultValue);
|
||||
},
|
||||
[context]
|
||||
);
|
||||
@@ -137,6 +143,9 @@ export const Dialog = ({ context = "global" }) => {
|
||||
paragraph={dialogInfo.paragraph}
|
||||
paragraphColor={dialogInfo.paragraphColor}
|
||||
padding={12}
|
||||
style={{
|
||||
minHeight: 0
|
||||
}}
|
||||
/>
|
||||
<Seperator half />
|
||||
|
||||
@@ -163,6 +172,28 @@ export const Dialog = ({ context = "global" }) => {
|
||||
</View>
|
||||
) : null}
|
||||
|
||||
{dialogInfo.check ? (
|
||||
<>
|
||||
<Button
|
||||
onPress={() => {
|
||||
setInputValue(!inputValue);
|
||||
}}
|
||||
icon={
|
||||
inputValue
|
||||
? "check-circle-outline"
|
||||
: "checkbox-blank-circle-outline"
|
||||
}
|
||||
style={{
|
||||
justifyContent: "flex-start"
|
||||
}}
|
||||
height={35}
|
||||
width="100%"
|
||||
title={dialogInfo.check.info}
|
||||
type={inputValue ? dialogInfo.check.type : "gray"}
|
||||
/>
|
||||
</>
|
||||
) : null}
|
||||
|
||||
<DialogButtons
|
||||
onPressNegative={onNegativePress}
|
||||
onPressPositive={dialogInfo.positivePress && onPressPositive}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -22,6 +22,7 @@ import { View } from "react-native";
|
||||
|
||||
import { useMenuStore } from "../../../stores/use-menu-store";
|
||||
import {
|
||||
eSendEvent,
|
||||
eSubscribeEvent,
|
||||
eUnSubscribeEvent,
|
||||
ToastEvent
|
||||
@@ -30,6 +31,7 @@ import Navigation from "../../../services/navigation";
|
||||
import { db } from "../../../common/database";
|
||||
import {
|
||||
eCloseAddTopicDialog,
|
||||
eOnTopicSheetUpdate,
|
||||
eOpenAddTopicDialog
|
||||
} from "../../../utils/events";
|
||||
import { sleep } from "../../../utils/time";
|
||||
@@ -40,6 +42,7 @@ import DialogHeader from "../../dialog/dialog-header";
|
||||
import Input from "../../ui/input";
|
||||
import Seperator from "../../ui/seperator";
|
||||
import { Toast } from "../../toast";
|
||||
import { useRelationStore } from "../../../stores/use-relation-store";
|
||||
|
||||
export class AddTopicDialog extends React.Component {
|
||||
constructor(props) {
|
||||
@@ -59,14 +62,12 @@ export class AddTopicDialog extends React.Component {
|
||||
|
||||
addNewTopic = async () => {
|
||||
try {
|
||||
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 });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -78,10 +79,13 @@ export class AddTopicDialog extends React.Component {
|
||||
|
||||
await db.notebooks.notebook(topic.notebookId).topics.add(topic);
|
||||
}
|
||||
this.setState({ loading: false });
|
||||
this.close();
|
||||
Navigation.queueRoutesForUpdate("Notebooks", "Notebook", "TopicNotes");
|
||||
useMenuStore.getState().setMenuPins();
|
||||
setTimeout(() => {
|
||||
Navigation.queueRoutesForUpdate();
|
||||
useMenuStore.getState().setMenuPins();
|
||||
});
|
||||
eSendEvent(eOnTopicSheetUpdate);
|
||||
useRelationStore.getState().update();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
@@ -177,7 +181,6 @@ export class AddTopicDialog extends React.Component {
|
||||
positiveTitle={this.toEdit ? "Save" : "Add"}
|
||||
onPressNegative={() => this.close()}
|
||||
onPressPositive={() => this.addNewTopic()}
|
||||
loading={this.state.loading}
|
||||
/>
|
||||
</DialogContainer>
|
||||
<Toast context="local" />
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
88
apps/mobile/app/components/dialogs/loading/index.tsx
Normal file
88
apps/mobile/app/components/dialogs/loading/index.tsx
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import React from "react";
|
||||
import { View } from "react-native";
|
||||
import { useThemeStore } from "../../../stores/use-theme-store";
|
||||
import BaseDialog from "../../dialog/base-dialog";
|
||||
import { ProgressBarComponent } from "../../ui/svg/lazy";
|
||||
import { useEffect } from "react";
|
||||
import {
|
||||
eSubscribeEvent,
|
||||
eUnSubscribeEvent
|
||||
} from "../../../services/event-manager";
|
||||
import { useState } from "react";
|
||||
import { eCloseLoading, eOpenLoading } from "../../../utils/events";
|
||||
|
||||
export const LoadingDialog = () => {
|
||||
const colors = useThemeStore((state) => state.colors);
|
||||
const [visible, setVisible] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
eSubscribeEvent(eOpenLoading, open);
|
||||
eSubscribeEvent(eCloseLoading, close);
|
||||
return () => {
|
||||
eUnSubscribeEvent(eOpenLoading, open);
|
||||
eUnSubscribeEvent(eCloseLoading, close);
|
||||
};
|
||||
}, []);
|
||||
|
||||
const open = () => setVisible(true);
|
||||
const close = () => setVisible(false);
|
||||
return (
|
||||
<BaseDialog
|
||||
animated={false}
|
||||
bounce={false}
|
||||
visible={visible}
|
||||
onRequestClose={undefined}
|
||||
onShow={undefined}
|
||||
premium={undefined}
|
||||
transparent={undefined}
|
||||
>
|
||||
<View
|
||||
style={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
backgroundColor: colors.bg,
|
||||
justifyContent: "center",
|
||||
alignItems: "center"
|
||||
}}
|
||||
>
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
width: 100,
|
||||
marginTop: 15
|
||||
}}
|
||||
>
|
||||
<ProgressBarComponent
|
||||
height={5}
|
||||
width={100}
|
||||
animated={true}
|
||||
useNativeDriver
|
||||
indeterminate
|
||||
indeterminateAnimationDuration={2000}
|
||||
unfilledColor={colors.nav}
|
||||
color={colors.accent}
|
||||
borderWidth={0}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
</BaseDialog>
|
||||
);
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -135,7 +135,6 @@ const ResultDialog = () => {
|
||||
paddingHorizontal: 12
|
||||
}}
|
||||
onPress={close}
|
||||
height={50}
|
||||
fontSize={SIZE.md + 2}
|
||||
/>
|
||||
</View>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -23,7 +23,7 @@ import Icon from "react-native-vector-icons/MaterialCommunityIcons";
|
||||
import { eSendEvent } from "../../../services/event-manager";
|
||||
import { useThemeStore } from "../../../stores/use-theme-store";
|
||||
import {
|
||||
eCloseProgressDialog,
|
||||
eCloseSheet,
|
||||
eCloseResultDialog,
|
||||
eOpenPremiumDialog
|
||||
} from "../../../utils/events";
|
||||
@@ -82,7 +82,7 @@ export const ProFeatures = ({ count = 6 }) => {
|
||||
<Paragraph
|
||||
onPress={async () => {
|
||||
eSendEvent(eCloseResultDialog);
|
||||
eSendEvent(eCloseProgressDialog);
|
||||
eSendEvent(eCloseSheet);
|
||||
await sleep(300);
|
||||
eSendEvent(eOpenPremiumDialog);
|
||||
}}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -207,13 +207,7 @@ export class VaultDialog extends Component {
|
||||
return;
|
||||
}
|
||||
|
||||
Navigation.queueRoutesForUpdate(
|
||||
"Notes",
|
||||
"Favorites",
|
||||
"TopicNotes",
|
||||
"TaggedNotes",
|
||||
"ColoredNotes"
|
||||
);
|
||||
Navigation.queueRoutesForUpdate();
|
||||
|
||||
this.password = null;
|
||||
this.confirmPassword = null;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -51,7 +51,7 @@ export const LeftMenus = () => {
|
||||
}
|
||||
};
|
||||
|
||||
return isTablet ? null : (
|
||||
return isTablet && !canGoBack ? null : (
|
||||
<IconButton
|
||||
testID={notesnook.ids.default.header.buttons.left}
|
||||
customStyle={{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -30,8 +30,8 @@ import { useThemeStore } from "../../stores/use-theme-store";
|
||||
import { eScrollEvent } from "../../utils/events";
|
||||
import { SIZE } from "../../utils/size";
|
||||
import Heading from "../ui/typography/heading";
|
||||
import Paragraph from "../ui/typography/paragraph";
|
||||
import { useCallback } from "react";
|
||||
import Tag from "../ui/tag";
|
||||
|
||||
const titleState = {};
|
||||
|
||||
@@ -63,13 +63,15 @@ export const Title = () => {
|
||||
}
|
||||
if (data.y > 150) {
|
||||
if (!hide) return;
|
||||
titleState[currentScreen.id] = false;
|
||||
setHide(false);
|
||||
} else {
|
||||
if (hide) return;
|
||||
titleState[currentScreen.id] = true;
|
||||
setHide(true);
|
||||
}
|
||||
},
|
||||
[currentScreen.name, hide]
|
||||
[currentScreen.id, currentScreen.name, hide]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -84,10 +86,6 @@ export const Title = () => {
|
||||
}
|
||||
}, [currentScreen.id, currentScreen.name]);
|
||||
|
||||
useEffect(() => {
|
||||
titleState[currentScreen.id] = hide;
|
||||
}, [currentScreen.id, hide]);
|
||||
|
||||
useEffect(() => {
|
||||
eSubscribeEvent(eScrollEvent, onScroll);
|
||||
return () => {
|
||||
@@ -104,37 +102,30 @@ export const Title = () => {
|
||||
style={{
|
||||
opacity: 1,
|
||||
flexShrink: 1,
|
||||
flexDirection: "row"
|
||||
flexDirection: "row",
|
||||
alignItems: "center"
|
||||
}}
|
||||
>
|
||||
{!hide && !isHidden ? (
|
||||
<Heading
|
||||
onPress={navigateToNotebook}
|
||||
numberOfLines={isTopic ? 2 : 1}
|
||||
size={isTopic ? SIZE.md + 2 : SIZE.xl}
|
||||
numberOfLines={1}
|
||||
size={SIZE.xl}
|
||||
style={{
|
||||
flexWrap: "wrap",
|
||||
marginTop: Platform.OS === "ios" ? -1 : 0
|
||||
}}
|
||||
color={currentScreen.color || colors.heading}
|
||||
>
|
||||
{isTopic ? (
|
||||
<Paragraph numberOfLines={1} size={SIZE.xs + 1}>
|
||||
{notebook?.title}
|
||||
{"\n"}
|
||||
</Paragraph>
|
||||
) : null}
|
||||
{isTag ? (
|
||||
<Heading
|
||||
size={isTopic ? SIZE.md + 2 : SIZE.xl}
|
||||
color={colors.accent}
|
||||
>
|
||||
<Heading size={SIZE.xl} color={colors.accent}>
|
||||
#
|
||||
</Heading>
|
||||
) : null}
|
||||
{title}
|
||||
</Heading>
|
||||
) : null}
|
||||
<Tag visible={currentScreen.beta} text="BETA" />
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -18,18 +18,26 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { View } from "react-native";
|
||||
import { Platform, View } from "react-native";
|
||||
import ImageViewer from "react-native-image-zoom-viewer";
|
||||
import downloadAttachment from "../../common/filesystem/download-attachment";
|
||||
import { cacheDir } from "../../common/filesystem/utils";
|
||||
import {
|
||||
eSubscribeEvent,
|
||||
eUnSubscribeEvent
|
||||
} from "../../services/event-manager";
|
||||
import { useThemeStore } from "../../stores/use-theme-store";
|
||||
import BaseDialog from "../dialog/base-dialog";
|
||||
import { IconButton } from "../ui/icon-button";
|
||||
import { ProgressBarComponent } from "../ui/svg/lazy";
|
||||
import Sodium from "@ammarahmed/react-native-sodium";
|
||||
import dataurl from "@notesnook/core/utils/dataurl";
|
||||
|
||||
const ImagePreview = () => {
|
||||
const colors = useThemeStore((state) => state.colors);
|
||||
const [visible, setVisible] = useState(false);
|
||||
const [image, setImage] = useState("");
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
eSubscribeEvent("ImagePreview", open);
|
||||
@@ -39,9 +47,29 @@ const ImagePreview = () => {
|
||||
};
|
||||
}, []);
|
||||
|
||||
const open = (image) => {
|
||||
setImage(image);
|
||||
const open = async (image) => {
|
||||
setVisible(true);
|
||||
setLoading(true);
|
||||
setTimeout(async () => {
|
||||
let hash = image.hash;
|
||||
if (!hash && dataurl.toObject(image.src)) {
|
||||
const data = dataurl.toObject(image.src);
|
||||
if (!data) return;
|
||||
hash = await Sodium.hashFile({
|
||||
data: data.data,
|
||||
type: "base64",
|
||||
uri: ""
|
||||
});
|
||||
}
|
||||
if (!hash) return;
|
||||
const uri = await downloadAttachment(hash, false, {
|
||||
silent: true,
|
||||
cache: true
|
||||
});
|
||||
const path = `${cacheDir}/${uri}`;
|
||||
setImage("file://" + path);
|
||||
setLoading(false);
|
||||
}, 100);
|
||||
};
|
||||
|
||||
const close = () => {
|
||||
@@ -59,44 +87,60 @@ const ImagePreview = () => {
|
||||
backgroundColor: "black"
|
||||
}}
|
||||
>
|
||||
<ImageViewer
|
||||
enableImageZoom={true}
|
||||
renderIndicator={() => <></>}
|
||||
enableSwipeDown
|
||||
useNativeDriver
|
||||
onSwipeDown={close}
|
||||
saveToLocalByLongPress={false}
|
||||
renderHeader={() => (
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
width: "100%",
|
||||
justifyContent: "flex-end",
|
||||
alignItems: "center",
|
||||
height: 80,
|
||||
marginTop: 0,
|
||||
paddingHorizontal: 12,
|
||||
position: "absolute",
|
||||
zIndex: 999,
|
||||
backgroundColor: "rgba(0,0,0,0.3)",
|
||||
paddingTop: 30
|
||||
}}
|
||||
>
|
||||
<IconButton
|
||||
name="close"
|
||||
color="white"
|
||||
onPress={() => {
|
||||
close();
|
||||
{loading ? (
|
||||
<View
|
||||
style={{
|
||||
flex: 1,
|
||||
justifyContent: "center",
|
||||
alignItems: "center"
|
||||
}}
|
||||
>
|
||||
<ProgressBarComponent
|
||||
indeterminate
|
||||
color={colors.accent}
|
||||
borderColor="transparent"
|
||||
/>
|
||||
</View>
|
||||
) : (
|
||||
<ImageViewer
|
||||
enableImageZoom={true}
|
||||
renderIndicator={() => <></>}
|
||||
enableSwipeDown
|
||||
useNativeDriver
|
||||
onSwipeDown={close}
|
||||
saveToLocalByLongPress={false}
|
||||
renderHeader={() => (
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
width: "100%",
|
||||
justifyContent: "flex-end",
|
||||
alignItems: "center",
|
||||
height: 80,
|
||||
marginTop: 0,
|
||||
paddingHorizontal: 12,
|
||||
position: "absolute",
|
||||
zIndex: 999,
|
||||
backgroundColor: "rgba(0,0,0,0.3)",
|
||||
paddingTop: Platform.OS === "android" ? 30 : 0
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
)}
|
||||
imageUrls={[
|
||||
{
|
||||
url: image
|
||||
}
|
||||
]}
|
||||
/>
|
||||
>
|
||||
<IconButton
|
||||
name="close"
|
||||
color="white"
|
||||
onPress={() => {
|
||||
close();
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
)}
|
||||
imageUrls={[
|
||||
{
|
||||
url: image
|
||||
}
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
</BaseDialog>
|
||||
)
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -19,15 +19,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import React from "react";
|
||||
import Animated, { FadeInDown } from "react-native-reanimated";
|
||||
import umami from "../../common/analytics";
|
||||
import { DDS } from "../../services/device-detection";
|
||||
import { eSendEvent } from "../../services/event-manager";
|
||||
import Navigation from "../../services/navigation";
|
||||
import SettingsService from "../../services/settings";
|
||||
import { useThemeStore } from "../../stores/use-theme-store";
|
||||
import { getElevation } from "../../utils";
|
||||
import { eOpenLoginDialog } from "../../utils/events";
|
||||
import {
|
||||
eCloseLoading,
|
||||
eOpenLoading,
|
||||
eOpenLoginDialog
|
||||
} from "../../utils/events";
|
||||
import { SIZE } from "../../utils/size";
|
||||
import { sleep } from "../../utils/time";
|
||||
import { AuthMode } from "../auth";
|
||||
import { Button } from "../ui/button";
|
||||
import { SvgView } from "../ui/svg";
|
||||
@@ -82,7 +86,6 @@ export const WelcomeNotice = () => {
|
||||
}
|
||||
);
|
||||
}, 1000);
|
||||
umami.pageView("/encryptionnotice", "/welcome/privacymode");
|
||||
}}
|
||||
style={{
|
||||
paddingHorizontal: 24,
|
||||
@@ -94,6 +97,39 @@ export const WelcomeNotice = () => {
|
||||
type="accent"
|
||||
title="Create your account"
|
||||
/>
|
||||
|
||||
<Button
|
||||
title="Skip for now"
|
||||
onPress={async () => {
|
||||
eSendEvent(eOpenLoading);
|
||||
await sleep(1000);
|
||||
SettingsService.set({
|
||||
introCompleted: true
|
||||
});
|
||||
Navigation.replace(
|
||||
{
|
||||
name: "Notes"
|
||||
},
|
||||
{
|
||||
canGoBack: false
|
||||
}
|
||||
);
|
||||
await sleep(1000);
|
||||
eSendEvent(eCloseLoading);
|
||||
}}
|
||||
iconSize={20}
|
||||
type="gray"
|
||||
iconPosition="right"
|
||||
icon="chevron-right"
|
||||
height={25}
|
||||
iconStyle={{
|
||||
marginTop: 2
|
||||
}}
|
||||
style={{
|
||||
paddingHorizontal: 6,
|
||||
marginTop: 10
|
||||
}}
|
||||
/>
|
||||
</Animated.View>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -17,20 +17,17 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import notifee from "@notifee/react-native";
|
||||
import React, { useCallback, useEffect, useRef } from "react";
|
||||
import { Platform, View } from "react-native";
|
||||
import RNBootSplash from "react-native-bootsplash";
|
||||
import { checkVersion } from "react-native-check-version";
|
||||
import Config from "react-native-config";
|
||||
import { enabled } from "react-native-privacy-snapshot";
|
||||
import { DatabaseLogger, db, loadDatabase } from "../../common/database";
|
||||
import { DatabaseLogger, db } from "../../common/database";
|
||||
import { useAppState } from "../../hooks/use-app-state";
|
||||
import BackupService from "../../services/backup";
|
||||
import BiometricService from "../../services/biometrics";
|
||||
import {
|
||||
eSendEvent,
|
||||
presentSheet,
|
||||
ToastEvent
|
||||
} from "../../services/event-manager";
|
||||
import { eSendEvent, presentSheet } from "../../services/event-manager";
|
||||
import { setRateAppMessage } from "../../services/message";
|
||||
import PremiumService from "../../services/premium";
|
||||
import SettingsService from "../../services/settings";
|
||||
@@ -40,7 +37,9 @@ import { useNoteStore } from "../../stores/use-notes-store";
|
||||
import { useSettingStore } from "../../stores/use-setting-store";
|
||||
import { useThemeStore } from "../../stores/use-theme-store";
|
||||
import { useUserStore } from "../../stores/use-user-store";
|
||||
import { AndroidModule } from "../../utils";
|
||||
import { eOpenAnnouncementDialog } from "../../utils/events";
|
||||
import { getGithubVersion } from "../../utils/github-version";
|
||||
import { SIZE } from "../../utils/size";
|
||||
import { sleep } from "../../utils/time";
|
||||
import { SVG } from "../auth/background";
|
||||
@@ -71,7 +70,7 @@ const Launcher = React.memo(
|
||||
const introCompleted = useSettingStore(
|
||||
(state) => state.settings.introCompleted
|
||||
);
|
||||
const dbInitCompleted = useRef(false);
|
||||
|
||||
const loadNotes = useCallback(async () => {
|
||||
if (verifyUser) {
|
||||
return;
|
||||
@@ -82,27 +81,25 @@ const Launcher = React.memo(
|
||||
initialize();
|
||||
setImmediate(() => {
|
||||
setLoading(false);
|
||||
if (!dbInitCompleted.current) {
|
||||
setImmediate(() => doAppLoadActions());
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}, [doAppLoadActions, setLoading, verifyUser]);
|
||||
}, [setLoading, verifyUser]);
|
||||
|
||||
const init = useCallback(async () => {
|
||||
if (!dbInitCompleted.current) {
|
||||
if (!db.isInitialized) {
|
||||
await RNBootSplash.hide({ fade: true });
|
||||
await loadDatabase();
|
||||
DatabaseLogger.info("Initializing database");
|
||||
await db.init();
|
||||
dbInitCompleted.current = true;
|
||||
}
|
||||
|
||||
if (db.migrations.required() && !verifyUser) {
|
||||
presentSheet({
|
||||
component: <Migrate />,
|
||||
onClose: () => {
|
||||
onClose: async () => {
|
||||
if (!db.isInitialized) {
|
||||
await db.init();
|
||||
}
|
||||
loadNotes();
|
||||
},
|
||||
disableClosing: true
|
||||
@@ -117,17 +114,10 @@ const Launcher = React.memo(
|
||||
}
|
||||
}, [loadNotes, verifyUser]);
|
||||
|
||||
// useEffect(() => {
|
||||
// hideSplashScreen();
|
||||
// }, [verifyUser]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!loading) {
|
||||
doAppLoadActions();
|
||||
}
|
||||
return () => {
|
||||
dbInitCompleted.current = false;
|
||||
};
|
||||
}, [doAppLoadActions, loading]);
|
||||
|
||||
const doAppLoadActions = useCallback(async () => {
|
||||
@@ -136,20 +126,8 @@ const Launcher = React.memo(
|
||||
eSendEvent("session_expired");
|
||||
return;
|
||||
}
|
||||
const user = await db.user.getUser();
|
||||
notifee.setBadgeCount(0);
|
||||
await useMessageStore.getState().setAnnouncement();
|
||||
if (PremiumService.get() && user) {
|
||||
if (SettingsService.get().reminder === "off") {
|
||||
SettingsService.set({ reminder: "daily" });
|
||||
}
|
||||
if (
|
||||
await BackupService.checkBackupRequired(
|
||||
SettingsService.get().reminder
|
||||
)
|
||||
) {
|
||||
sleep(2000).then(() => BackupService.run());
|
||||
}
|
||||
}
|
||||
if (NewFeature.present()) return;
|
||||
if (await checkAppUpdateAvailable()) return;
|
||||
if (await checkForRateAppRequest()) return;
|
||||
@@ -167,10 +145,13 @@ const Launcher = React.memo(
|
||||
}, [introCompleted]);
|
||||
|
||||
const checkAppUpdateAvailable = async () => {
|
||||
if (__DEV__) return;
|
||||
if (__DEV__ || Config.isTesting === "true") return;
|
||||
try {
|
||||
const version = await checkVersion();
|
||||
if (!version.needsUpdate) return false;
|
||||
const version =
|
||||
Config.GITHUB_RELEASE === "true"
|
||||
? await getGithubVersion()
|
||||
: await checkVersion();
|
||||
if (!version || !version?.needsUpdate) return false;
|
||||
presentSheet({
|
||||
component: (ref) => <Update version={version} fwdRef={ref} />
|
||||
});
|
||||
@@ -211,13 +192,12 @@ const Launcher = React.memo(
|
||||
};
|
||||
|
||||
const onUnlockBiometrics = useCallback(async () => {
|
||||
if (!(await BiometricService.isBiometryAvailable())) {
|
||||
ToastEvent.show({
|
||||
heading: "Biometrics unavailable",
|
||||
message: "Try unlocking the app with your account password"
|
||||
});
|
||||
return;
|
||||
if (!(await BiometricService.isBiometryAvailable())) return;
|
||||
if (Platform.OS === "android") {
|
||||
const activityName = await AndroidModule.getActivityName();
|
||||
if (activityName !== "MainActivity") return;
|
||||
}
|
||||
|
||||
let verified = await BiometricService.validateUser(
|
||||
"Unlock to access your notes",
|
||||
""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -122,7 +122,7 @@ export const SectionHeader = React.memo(
|
||||
alignItems: "center"
|
||||
}}
|
||||
>
|
||||
{index === 0 ? (
|
||||
{index === 0 && (
|
||||
<>
|
||||
<Button
|
||||
onPress={() => {
|
||||
@@ -130,6 +130,7 @@ export const SectionHeader = React.memo(
|
||||
component: <Sort screen={screen} type={type} />
|
||||
});
|
||||
}}
|
||||
hidden={screen === "Reminders"}
|
||||
tooltipText="Change sorting of items in list"
|
||||
fwdRef={sortRef}
|
||||
title={groupBy}
|
||||
@@ -152,38 +153,35 @@ export const SectionHeader = React.memo(
|
||||
iconPosition="right"
|
||||
/>
|
||||
|
||||
{type === "notes" || type === "notebooks" || type === "home" ? (
|
||||
<IconButton
|
||||
customStyle={{
|
||||
width: 25,
|
||||
height: 25
|
||||
}}
|
||||
testID="icon-compact-mode"
|
||||
tooltipText={
|
||||
listMode == "compact"
|
||||
? "Switch to normal mode"
|
||||
: "Switch to compact mode"
|
||||
}
|
||||
fwdRef={compactModeRef}
|
||||
color={colors.icon}
|
||||
name={
|
||||
listMode == "compact" ? "view-list" : "view-list-outline"
|
||||
}
|
||||
onPress={() => {
|
||||
let settings = {};
|
||||
settings[
|
||||
type !== "notebooks"
|
||||
? "notesListMode"
|
||||
: "notebooksListMode"
|
||||
] = listMode === "normal" ? "compact" : "normal";
|
||||
<IconButton
|
||||
customStyle={{
|
||||
width: 25,
|
||||
height: 25
|
||||
}}
|
||||
hidden={
|
||||
type !== "notes" && type !== "notebooks" && type !== "home"
|
||||
}
|
||||
testID="icon-compact-mode"
|
||||
tooltipText={
|
||||
listMode == "compact"
|
||||
? "Switch to normal mode"
|
||||
: "Switch to compact mode"
|
||||
}
|
||||
fwdRef={compactModeRef}
|
||||
color={colors.icon}
|
||||
name={listMode == "compact" ? "view-list" : "view-list-outline"}
|
||||
onPress={() => {
|
||||
let settings = {};
|
||||
settings[
|
||||
type !== "notebooks" ? "notesListMode" : "notebooksListMode"
|
||||
] = listMode === "normal" ? "compact" : "normal";
|
||||
|
||||
SettingsService.set(settings);
|
||||
}}
|
||||
size={SIZE.lg - 2}
|
||||
/>
|
||||
) : null}
|
||||
SettingsService.set(settings);
|
||||
}}
|
||||
size={SIZE.lg - 2}
|
||||
/>
|
||||
</>
|
||||
) : null}
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -17,14 +17,18 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { getUpcomingReminder } from "@notesnook/core/collections/reminders";
|
||||
import { decode, EntityLevel } from "entities";
|
||||
import React from "react";
|
||||
import { View } from "react-native";
|
||||
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
|
||||
import { notesnook } from "../../../../e2e/test.ids";
|
||||
import { db } from "../../../common/database";
|
||||
import Notebook from "../../../screens/notebook";
|
||||
import { TaggedNotes } from "../../../screens/notes/tagged";
|
||||
import { TopicNotes } from "../../../screens/notes/topic-notes";
|
||||
import useNavigationStore from "../../../stores/use-navigation-store";
|
||||
import { useRelationStore } from "../../../stores/use-relation-store";
|
||||
import { useSettingStore } from "../../../stores/use-setting-store";
|
||||
import { useThemeStore } from "../../../stores/use-theme-store";
|
||||
import { COLORS_NOTE } from "../../../utils/color-scheme";
|
||||
@@ -32,14 +36,11 @@ import { SIZE } from "../../../utils/size";
|
||||
import { Properties } from "../../properties";
|
||||
import { Button } from "../../ui/button";
|
||||
import { IconButton } from "../../ui/icon-button";
|
||||
import { ReminderTime } from "../../ui/reminder-time";
|
||||
import { TimeSince } from "../../ui/time-since";
|
||||
import Heading from "../../ui/typography/heading";
|
||||
import Paragraph from "../../ui/typography/paragraph";
|
||||
|
||||
const navigateToTopic = (topic) => {
|
||||
TopicNotes.navigate(topic, true);
|
||||
};
|
||||
|
||||
function navigateToTag(item) {
|
||||
const tag = db.tags.tag(item.id);
|
||||
if (!tag) return;
|
||||
@@ -52,30 +53,48 @@ const showActionSheet = (item) => {
|
||||
|
||||
function getNotebook(item) {
|
||||
const isTrash = item.type === "trash";
|
||||
if (isTrash || !item.notebooks || item.notebooks.length < 1) return [];
|
||||
const currentId = useNavigationStore.getState().currentScreen.id;
|
||||
if (isTrash) return [];
|
||||
const items = [];
|
||||
const notebooks = db.relations.to(item, "notebook") || [];
|
||||
|
||||
return item.notebooks.reduce(function (prev, curr) {
|
||||
if (prev && prev.length > 0) return prev;
|
||||
const topicId = curr.topics[0];
|
||||
const notebook = db.notebooks?.notebook(curr.id)?.data;
|
||||
if (!notebook) return;
|
||||
const topic = notebook.topics.find((t) => t.id === topicId);
|
||||
if (!topic) return;
|
||||
for (let notebook of notebooks) {
|
||||
if (items.length > 1) break;
|
||||
if (notebook.id === currentId) continue;
|
||||
items.push(notebook);
|
||||
}
|
||||
|
||||
return [
|
||||
{
|
||||
title: `${notebook?.title} › ${topic?.title}`,
|
||||
notebook: notebook,
|
||||
topic: topic
|
||||
if (item.notebooks) {
|
||||
for (let nb of item.notebooks) {
|
||||
if (items.length > 1) break;
|
||||
const notebook = db.notebooks?.notebook(nb.id)?.data;
|
||||
if (!notebook) continue;
|
||||
for (let topicId of nb.topics) {
|
||||
if (items.length > 1) break;
|
||||
if (topicId === currentId) continue;
|
||||
const topic = notebook.topics.find((t) => t.id === topicId);
|
||||
if (!topic) continue;
|
||||
items.push(topic);
|
||||
}
|
||||
];
|
||||
}, []);
|
||||
}
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
function getTags(item) {
|
||||
const noteTags = item.tags?.slice(0, 3) || [];
|
||||
const tags = [];
|
||||
for (const tagName of noteTags) {
|
||||
const tag = db.tags.tag(tagName);
|
||||
if (!tag) continue;
|
||||
tags.push(tag);
|
||||
}
|
||||
return tags;
|
||||
}
|
||||
|
||||
const NoteItem = ({
|
||||
item,
|
||||
isTrash,
|
||||
tags,
|
||||
dateBy = "dateCreated",
|
||||
noOpen = false
|
||||
}) => {
|
||||
@@ -85,8 +104,13 @@ const NoteItem = ({
|
||||
);
|
||||
const compactMode = notesListMode === "compact";
|
||||
const attachmentCount = db.attachments?.ofNote(item.id, "all")?.length || 0;
|
||||
const notebooks = React.useMemo(() => getNotebook(item), [item]);
|
||||
|
||||
const _update = useRelationStore((state) => state.updater);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
const notebooks = React.useMemo(() => getNotebook(item), [item, _update]);
|
||||
const reminders = db.relations.from(item, "reminder");
|
||||
const reminder = getUpcomingReminder(reminders);
|
||||
const noteColor = COLORS_NOTE[item.color?.toLowerCase()];
|
||||
const tags = getTags(item);
|
||||
return (
|
||||
<>
|
||||
<View
|
||||
@@ -102,15 +126,21 @@ const NoteItem = ({
|
||||
alignItems: "center",
|
||||
zIndex: 10,
|
||||
elevation: 10,
|
||||
marginBottom: 2.5
|
||||
marginBottom: 2.5,
|
||||
flexWrap: "wrap"
|
||||
}}
|
||||
>
|
||||
{notebooks.map((_item) => (
|
||||
{notebooks?.map((item) => (
|
||||
<Button
|
||||
title={_item.title}
|
||||
key={_item}
|
||||
height={20}
|
||||
icon="book-outline"
|
||||
title={
|
||||
item.title.length > 25
|
||||
? item.title.slice(0, 25) + "..."
|
||||
: item.title
|
||||
}
|
||||
tooltipText={item.title}
|
||||
key={item.id}
|
||||
height={25}
|
||||
icon={item.type === "topic" ? "bookmark" : "book-outline"}
|
||||
type="grayBg"
|
||||
fontSize={SIZE.xs}
|
||||
iconSize={SIZE.sm}
|
||||
@@ -122,11 +152,29 @@ const NoteItem = ({
|
||||
marginRight: 5,
|
||||
borderWidth: 0.5,
|
||||
borderColor: colors.icon,
|
||||
paddingHorizontal: 6
|
||||
paddingHorizontal: 6,
|
||||
marginBottom: 5
|
||||
}}
|
||||
onPress={() => {
|
||||
if (item.type === "topic") {
|
||||
TopicNotes.navigate(item, true);
|
||||
} else {
|
||||
Notebook.navigate(item);
|
||||
}
|
||||
}}
|
||||
onPress={() => navigateToTopic(_item.topic)}
|
||||
/>
|
||||
))}
|
||||
|
||||
<ReminderTime
|
||||
reminder={reminder}
|
||||
color={noteColor}
|
||||
onPress={() => {
|
||||
Properties.present(reminder);
|
||||
}}
|
||||
style={{
|
||||
height: 25
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
) : null}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -20,21 +20,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
import React from "react";
|
||||
import NoteItem from ".";
|
||||
import { notesnook } from "../../../../e2e/test.ids";
|
||||
import { useSelectionStore } from "../../../stores/use-selection-store";
|
||||
import { useTrashStore } from "../../../stores/use-trash-store";
|
||||
import { useEditorStore } from "../../../stores/use-editor-store";
|
||||
import { db } from "../../../common/database";
|
||||
import { DDS } from "../../../services/device-detection";
|
||||
import {
|
||||
eSendEvent,
|
||||
hideSheet,
|
||||
openVault,
|
||||
ToastEvent
|
||||
presentSheet
|
||||
} from "../../../services/event-manager";
|
||||
import Navigation from "../../../services/navigation";
|
||||
import { useEditorStore } from "../../../stores/use-editor-store";
|
||||
import { useSelectionStore } from "../../../stores/use-selection-store";
|
||||
import { history } from "../../../utils";
|
||||
import { db } from "../../../common/database";
|
||||
import { eOnLoadNote, eShowMergeDialog } from "../../../utils/events";
|
||||
import { tabBarRef } from "../../../utils/global-refs";
|
||||
import { presentDialog } from "../../dialog/functions";
|
||||
import NotePreview from "../../note-history/preview";
|
||||
import SelectionWrapper from "../selection-wrapper";
|
||||
|
||||
const present = () =>
|
||||
@@ -44,9 +44,9 @@ const present = () =>
|
||||
paragraph: "Please sync again to open this note for editing"
|
||||
});
|
||||
|
||||
export const openNote = async (item, isTrash, setSelectedItem) => {
|
||||
export const openNote = async (item, isTrash, setSelectedItem, isSheet) => {
|
||||
let _note = item;
|
||||
|
||||
if (isSheet) hideSheet();
|
||||
if (!isTrash) {
|
||||
_note = db.notes.note(item.id).data;
|
||||
if (!db.notes.note(item.id)?.synced()) {
|
||||
@@ -84,39 +84,11 @@ export const openNote = async (item, isTrash, setSelectedItem) => {
|
||||
return;
|
||||
}
|
||||
if (isTrash) {
|
||||
presentDialog({
|
||||
title: `Restore ${item.itemType}`,
|
||||
paragraph: `Restore or delete ${item.itemType} forever`,
|
||||
positiveText: "Restore",
|
||||
negativeText: "Delete",
|
||||
positivePress: async () => {
|
||||
await db.trash.restore(item.id);
|
||||
Navigation.queueRoutesForUpdate(
|
||||
"Tags",
|
||||
"Notes",
|
||||
"Notebooks",
|
||||
"Favorites",
|
||||
"Trash",
|
||||
"TaggedNotes",
|
||||
"ColoredNotes",
|
||||
"TopicNotes"
|
||||
);
|
||||
useSelectionStore.getState().setSelectionMode(false);
|
||||
ToastEvent.show({
|
||||
heading: "Restore successful",
|
||||
type: "success"
|
||||
});
|
||||
},
|
||||
onClose: async () => {
|
||||
await db.trash.delete(item.id);
|
||||
useTrashStore.getState().setTrash();
|
||||
useSelectionStore.getState().setSelectionMode(false);
|
||||
ToastEvent.show({
|
||||
heading: "Permanantly deleted items",
|
||||
type: "success",
|
||||
context: "local"
|
||||
});
|
||||
}
|
||||
const content = await db.content.get(item.contentId);
|
||||
presentSheet({
|
||||
component: (
|
||||
<NotePreview note={item} content={{ type: "tiptap", data: content }} />
|
||||
)
|
||||
});
|
||||
} else {
|
||||
useEditorStore.getState().setReadonly(_note?.readonly);
|
||||
@@ -128,7 +100,7 @@ export const openNote = async (item, isTrash, setSelectedItem) => {
|
||||
};
|
||||
|
||||
export const NoteWrapper = React.memo(
|
||||
function NoteWrapper({ item, index, tags, dateBy }) {
|
||||
function NoteWrapper({ item, index, dateBy, isSheet }) {
|
||||
const isTrash = item.type === "trash";
|
||||
const setSelectedItem = useSelectionStore((state) => state.setSelectedItem);
|
||||
|
||||
@@ -137,10 +109,11 @@ export const NoteWrapper = React.memo(
|
||||
index={index}
|
||||
height={100}
|
||||
testID={notesnook.ids.note.get(index)}
|
||||
onPress={() => openNote(item, isTrash, setSelectedItem)}
|
||||
onPress={() => openNote(item, isTrash, setSelectedItem, isSheet)}
|
||||
isSheet={isSheet}
|
||||
item={item}
|
||||
>
|
||||
<NoteItem item={item} dateBy={dateBy} tags={tags} isTrash={isTrash} />
|
||||
<NoteItem item={item} dateBy={dateBy} isTrash={isTrash} />
|
||||
</SelectionWrapper>
|
||||
);
|
||||
},
|
||||
@@ -152,10 +125,6 @@ export const NoteWrapper = React.memo(
|
||||
return false;
|
||||
}
|
||||
|
||||
if (JSON.stringify(prev.tags) !== JSON.stringify(next.tags)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (prev.item !== next.item) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -24,7 +24,7 @@ import { notesnook } from "../../../../e2e/test.ids";
|
||||
import { TopicNotes } from "../../../screens/notes/topic-notes";
|
||||
import { useSettingStore } from "../../../stores/use-setting-store";
|
||||
import { useThemeStore } from "../../../stores/use-theme-store";
|
||||
import { getTotalNotes, history } from "../../../utils";
|
||||
import { history } from "../../../utils";
|
||||
import { SIZE } from "../../../utils/size";
|
||||
import { Properties } from "../../properties";
|
||||
import { Button } from "../../ui/button";
|
||||
@@ -41,14 +41,19 @@ const navigateToTopic = (topic) => {
|
||||
TopicNotes.navigate(topic, true);
|
||||
};
|
||||
|
||||
export const NotebookItem = ({ item, isTopic = false, isTrash, dateBy }) => {
|
||||
export const NotebookItem = ({
|
||||
item,
|
||||
isTopic = false,
|
||||
isTrash,
|
||||
dateBy,
|
||||
totalNotes
|
||||
}) => {
|
||||
const colors = useThemeStore((state) => state.colors);
|
||||
const notebooksListMode = useSettingStore(
|
||||
(state) => state.settings.notebooksListMode
|
||||
);
|
||||
const compactMode = notebooksListMode === "compact";
|
||||
const topics = item.topics?.slice(0, 3) || [];
|
||||
const totalNotes = getTotalNotes(item);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -126,16 +131,6 @@ export const NotebookItem = ({ item, isTopic = false, isTrash, dateBy }) => {
|
||||
height: SIZE.md + 2
|
||||
}}
|
||||
>
|
||||
<Paragraph
|
||||
color={colors.accent}
|
||||
size={SIZE.xs}
|
||||
style={{
|
||||
marginRight: 6
|
||||
}}
|
||||
>
|
||||
{isTopic ? "Topic" : "Notebook"}
|
||||
</Paragraph>
|
||||
|
||||
{isTrash ? (
|
||||
<>
|
||||
<Paragraph
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -64,16 +64,7 @@ export const openNotebookTopic = (item) => {
|
||||
negativeText: "Delete",
|
||||
positivePress: async () => {
|
||||
await db.trash.restore(item.id);
|
||||
Navigation.queueRoutesForUpdate(
|
||||
"Tags",
|
||||
"Notes",
|
||||
"Notebooks",
|
||||
"Favorites",
|
||||
"Trash",
|
||||
"TaggedNotes",
|
||||
"ColoredNotes",
|
||||
"TopicNotes"
|
||||
);
|
||||
Navigation.queueRoutesForUpdate();
|
||||
useSelectionStore.getState().setSelectionMode(false);
|
||||
ToastEvent.show({
|
||||
heading: "Restore successful",
|
||||
@@ -101,7 +92,7 @@ export const openNotebookTopic = (item) => {
|
||||
};
|
||||
|
||||
export const NotebookWrapper = React.memo(
|
||||
function NotebookWrapper({ item, index, dateBy }) {
|
||||
function NotebookWrapper({ item, index, dateBy, totalNotes }) {
|
||||
const isTrash = item.type === "trash";
|
||||
|
||||
return (
|
||||
@@ -118,11 +109,13 @@ export const NotebookWrapper = React.memo(
|
||||
dateBy={dateBy}
|
||||
index={index}
|
||||
isTrash={isTrash}
|
||||
totalNotes={totalNotes}
|
||||
/>
|
||||
</SelectionWrapper>
|
||||
);
|
||||
},
|
||||
(prev, next) => {
|
||||
if (prev.totalNotes !== next.totalNotes) return false;
|
||||
if (prev.item.title !== next.item.title) return false;
|
||||
if (prev.dateBy !== next.dateBy) {
|
||||
return false;
|
||||
|
||||
187
apps/mobile/app/components/list-items/reminder/index.tsx
Normal file
187
apps/mobile/app/components/list-items/reminder/index.tsx
Normal file
@@ -0,0 +1,187 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import React from "react";
|
||||
import { View } from "react-native";
|
||||
import { notesnook } from "../../../../e2e/test.ids";
|
||||
import type { Reminder } from "../../../services/notifications";
|
||||
import { useThemeStore } from "../../../stores/use-theme-store";
|
||||
import { SIZE } from "../../../utils/size";
|
||||
import { Properties } from "../../properties";
|
||||
import { IconButton } from "../../ui/icon-button";
|
||||
import Heading from "../../ui/typography/heading";
|
||||
import Paragraph from "../../ui/typography/paragraph";
|
||||
import SelectionWrapper from "../selection-wrapper";
|
||||
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
|
||||
import ReminderSheet from "../../sheets/reminder";
|
||||
import { ReminderTime } from "../../ui/reminder-time";
|
||||
|
||||
const ReminderItem = React.memo(
|
||||
({
|
||||
item,
|
||||
index,
|
||||
isSheet
|
||||
}: {
|
||||
item: Reminder;
|
||||
index: number;
|
||||
isSheet: boolean;
|
||||
}) => {
|
||||
const colors = useThemeStore((state) => state.colors);
|
||||
const openReminder = () => {
|
||||
ReminderSheet.present(item, undefined, isSheet);
|
||||
};
|
||||
return (
|
||||
<SelectionWrapper
|
||||
//@ts-ignore
|
||||
index={index}
|
||||
height={100}
|
||||
onPress={openReminder}
|
||||
item={item}
|
||||
isSheet={isSheet}
|
||||
>
|
||||
<View
|
||||
style={{
|
||||
flexShrink: 1,
|
||||
opacity: item.disabled ? 0.5 : 1
|
||||
}}
|
||||
>
|
||||
<Heading
|
||||
numberOfLines={1}
|
||||
style={{
|
||||
flexWrap: "wrap"
|
||||
}}
|
||||
size={SIZE.md}
|
||||
>
|
||||
{item.title}
|
||||
</Heading>
|
||||
|
||||
{item.description ? (
|
||||
<Paragraph
|
||||
style={{
|
||||
flexWrap: "wrap"
|
||||
}}
|
||||
numberOfLines={2}
|
||||
>
|
||||
{item.description}
|
||||
</Paragraph>
|
||||
) : null}
|
||||
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
flexWrap: "wrap"
|
||||
}}
|
||||
>
|
||||
{item.disabled ? (
|
||||
<View
|
||||
style={{
|
||||
backgroundColor: colors.nav,
|
||||
borderRadius: 5,
|
||||
flexDirection: "row",
|
||||
paddingHorizontal: 6,
|
||||
alignItems: "center",
|
||||
marginTop: 5,
|
||||
justifyContent: "flex-start",
|
||||
alignSelf: "flex-start",
|
||||
marginRight: 10,
|
||||
height: 30
|
||||
}}
|
||||
>
|
||||
<Icon
|
||||
name="bell-off-outline"
|
||||
size={SIZE.md}
|
||||
color={colors.errorText}
|
||||
/>
|
||||
<Paragraph
|
||||
size={SIZE.xs + 1}
|
||||
color={colors.icon}
|
||||
style={{ marginLeft: 5 }}
|
||||
>
|
||||
Disabled
|
||||
</Paragraph>
|
||||
</View>
|
||||
) : null}
|
||||
{item.mode === "repeat" && item.recurringMode ? (
|
||||
<View
|
||||
style={{
|
||||
backgroundColor: colors.nav,
|
||||
borderRadius: 5,
|
||||
flexDirection: "row",
|
||||
paddingHorizontal: 6,
|
||||
alignItems: "center",
|
||||
marginTop: 5,
|
||||
justifyContent: "flex-start",
|
||||
alignSelf: "flex-start",
|
||||
marginRight: 10,
|
||||
height: 30
|
||||
}}
|
||||
>
|
||||
<Icon name="reload" size={SIZE.md} color={colors.accent} />
|
||||
<Paragraph
|
||||
size={SIZE.xs + 1}
|
||||
color={colors.icon}
|
||||
style={{ marginLeft: 5 }}
|
||||
>
|
||||
{item.recurringMode.slice(0, 1).toUpperCase() +
|
||||
item.recurringMode.replace("y", "i").slice(1) +
|
||||
"ly"}
|
||||
</Paragraph>
|
||||
</View>
|
||||
) : null}
|
||||
|
||||
<ReminderTime
|
||||
reminder={item}
|
||||
checkIsActive={false}
|
||||
fontSize={SIZE.xs + 1}
|
||||
style={{
|
||||
justifyContent: "flex-start",
|
||||
borderWidth: 0,
|
||||
height: 30,
|
||||
alignSelf: "flex-start",
|
||||
marginTop: 5
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
<IconButton
|
||||
testID={notesnook.listitem.menu}
|
||||
color={colors.pri}
|
||||
name="dots-horizontal"
|
||||
size={SIZE.xl}
|
||||
onPress={() => Properties.present(item, [], isSheet)}
|
||||
customStyle={{
|
||||
justifyContent: "center",
|
||||
height: 35,
|
||||
width: 35,
|
||||
borderRadius: 100,
|
||||
alignItems: "center"
|
||||
}}
|
||||
/>
|
||||
</SelectionWrapper>
|
||||
);
|
||||
},
|
||||
(prev, next) => {
|
||||
if (prev.item?.dateModified !== next.item?.dateModified) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
);
|
||||
ReminderItem.displayName = "ReminderItem";
|
||||
|
||||
export default ReminderItem;
|
||||
@@ -1,323 +0,0 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2022 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import Clipboard from "@react-native-clipboard/clipboard";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { View } from "react-native";
|
||||
import Animated, { SlideInUp, SlideOutDown } from "react-native-reanimated";
|
||||
import { db } from "../../../common/database";
|
||||
import { openVault, ToastEvent } from "../../../services/event-manager";
|
||||
import Navigation from "../../../services/navigation";
|
||||
import { useMenuStore } from "../../../stores/use-menu-store";
|
||||
import { useNotebookStore } from "../../../stores/use-notebook-store";
|
||||
import { useSelectionStore } from "../../../stores/use-selection-store";
|
||||
import { useThemeStore } from "../../../stores/use-theme-store";
|
||||
import { useTrashStore } from "../../../stores/use-trash-store";
|
||||
import { dWidth, getElevation, toTXT } from "../../../utils";
|
||||
import { deleteItems } from "../../../utils/functions";
|
||||
import { presentDialog } from "../../dialog/functions";
|
||||
import { Button } from "../../ui/button";
|
||||
import { IconButton } from "../../ui/icon-button";
|
||||
|
||||
export const ActionStrip = ({ note, setActionStrip }) => {
|
||||
const colors = useThemeStore((state) => state.colors);
|
||||
const selectionMode = useSelectionStore((state) => state.selectionMode);
|
||||
const setNotebooks = useNotebookStore((state) => state.setNotebooks);
|
||||
const setMenuPins = useMenuStore((state) => state.setMenuPins);
|
||||
const setSelectedItem = useSelectionStore((state) => state.setSelectedItem);
|
||||
const setSelectionMode = useSelectionStore((state) => state.setSelectionMode);
|
||||
|
||||
const [isPinnedToMenu, setIsPinnedToMenu] = useState(false);
|
||||
const [width, setWidth] = useState(dWidth - 16);
|
||||
useEffect(() => {
|
||||
if (note.type === "note") return;
|
||||
setIsPinnedToMenu(db.shortcuts.exists(note.id));
|
||||
}, [note.id, note.type]);
|
||||
|
||||
const updateNotes = () => {
|
||||
Navigation.queueRoutesForUpdate(
|
||||
"Notes",
|
||||
"Favorites",
|
||||
"ColoredNotes",
|
||||
"TaggedNotes",
|
||||
"TopicNotes"
|
||||
);
|
||||
};
|
||||
|
||||
const actions = [
|
||||
{
|
||||
title: "Pin " + note.type,
|
||||
icon: note.pinned ? "pin-off" : "pin",
|
||||
visible: note.type === "note" || note.type === "notebook",
|
||||
onPress: async () => {
|
||||
if (!note.id) return;
|
||||
|
||||
if (note.type === "note") {
|
||||
if (db.notes.pinned.length === 3 && !note.pinned) {
|
||||
ToastEvent.show({
|
||||
heading: "Cannot pin more than 3 notes",
|
||||
type: "error"
|
||||
});
|
||||
return;
|
||||
}
|
||||
await db.notes.note(note.id).pin();
|
||||
} else {
|
||||
if (db.notebooks.pinned.length === 3 && !note.pinned) {
|
||||
ToastEvent.show({
|
||||
heading: "Cannot pin more than 3 notebooks",
|
||||
type: "error"
|
||||
});
|
||||
return;
|
||||
}
|
||||
await db.notebooks.notebook(note.id).pin();
|
||||
setNotebooks();
|
||||
}
|
||||
updateNotes();
|
||||
setActionStrip(false);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "Add to favorites",
|
||||
icon: note.favorite ? "star-off" : "star",
|
||||
onPress: async () => {
|
||||
if (!note.id) return;
|
||||
if (note.type === "note") {
|
||||
await db.notes.note(note.id).favorite();
|
||||
} else {
|
||||
await db.notebooks.notebook(note.id).favorite();
|
||||
}
|
||||
updateNotes();
|
||||
setActionStrip(false);
|
||||
},
|
||||
visible: note.type === "note",
|
||||
color: !note.favorite ? "orange" : null
|
||||
},
|
||||
|
||||
{
|
||||
title: isPinnedToMenu
|
||||
? "Remove Shortcut from Menu"
|
||||
: "Add Shortcut to Menu",
|
||||
icon: isPinnedToMenu ? "link-variant-remove" : "link-variant",
|
||||
onPress: async () => {
|
||||
try {
|
||||
if (isPinnedToMenu) {
|
||||
await db.shortcuts.remove(note.id);
|
||||
ToastEvent.show({
|
||||
heading: "Shortcut removed from menu",
|
||||
type: "success"
|
||||
});
|
||||
} else {
|
||||
if (note.type === "topic") {
|
||||
await db.shortcuts.add({
|
||||
item: {
|
||||
type: "topic",
|
||||
id: note.id,
|
||||
notebookId: note.notebookId
|
||||
}
|
||||
});
|
||||
} else {
|
||||
await db.shortcuts.add({
|
||||
item: {
|
||||
type: "notebook",
|
||||
id: note.id
|
||||
}
|
||||
});
|
||||
}
|
||||
ToastEvent.show({
|
||||
heading: "Shortcut added to menu",
|
||||
type: "success"
|
||||
});
|
||||
}
|
||||
setIsPinnedToMenu(db.shortcuts.exists(note.id));
|
||||
setMenuPins();
|
||||
|
||||
setActionStrip(false);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
},
|
||||
visible: note.type !== "note"
|
||||
},
|
||||
{
|
||||
title: "Copy Note",
|
||||
icon: "content-copy",
|
||||
visible: note.type === "note",
|
||||
onPress: async () => {
|
||||
if (note.locked) {
|
||||
openVault({
|
||||
copyNote: true,
|
||||
novault: true,
|
||||
locked: true,
|
||||
item: note,
|
||||
title: "Copy note",
|
||||
description: "Unlock note to copy to clipboard."
|
||||
});
|
||||
} else {
|
||||
let text = await toTXT(note);
|
||||
text = `${note.title}\n \n ${text}`;
|
||||
Clipboard.setString(text);
|
||||
ToastEvent.show({
|
||||
heading: "Note copied to clipboard",
|
||||
type: "success"
|
||||
});
|
||||
}
|
||||
setActionStrip(false);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "Restore " + note.itemType,
|
||||
icon: "delete-restore",
|
||||
onPress: async () => {
|
||||
await db.trash.restore(note.id);
|
||||
Navigation.queueRoutesForUpdate(
|
||||
"Notes",
|
||||
"Favorites",
|
||||
"ColoredNotes",
|
||||
"TaggedNotes",
|
||||
"TopicNotes",
|
||||
"Trash",
|
||||
"Notebooks"
|
||||
);
|
||||
|
||||
ToastEvent.show({
|
||||
heading:
|
||||
note.type === "note"
|
||||
? "Note restored from trash"
|
||||
: "Notebook restored from trash",
|
||||
type: "success"
|
||||
});
|
||||
|
||||
setActionStrip(false);
|
||||
},
|
||||
visible: note.type === "trash"
|
||||
},
|
||||
{
|
||||
title: "Delete" + note.itemType,
|
||||
icon: "delete",
|
||||
visible: note.type === "trash",
|
||||
onPress: () => {
|
||||
presentDialog({
|
||||
title: "Permanent delete",
|
||||
paragraph: `Are you sure you want to delete this ${note.itemType} permanantly from trash?`,
|
||||
positiveText: "Delete",
|
||||
negativeText: "Cancel",
|
||||
positivePress: async () => {
|
||||
await db.trash.delete(note.id);
|
||||
useTrashStore.getState().setTrash();
|
||||
useSelectionStore.getState().setSelectionMode(false);
|
||||
ToastEvent.show({
|
||||
heading: "Permanantly deleted items",
|
||||
type: "success",
|
||||
context: "local"
|
||||
});
|
||||
},
|
||||
positiveType: "errorShade"
|
||||
});
|
||||
setActionStrip(false);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "Delete" + note.type,
|
||||
icon: "delete",
|
||||
visible: note.type !== "trash",
|
||||
onPress: async () => {
|
||||
try {
|
||||
await deleteItems(note);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
setActionStrip(false);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "Close",
|
||||
icon: "close",
|
||||
onPress: () => setActionStrip(false),
|
||||
color: colors.light,
|
||||
bg: colors.red,
|
||||
visible: true
|
||||
}
|
||||
];
|
||||
|
||||
return (
|
||||
<Animated.View
|
||||
onLayout={(event) => {
|
||||
setWidth(event.nativeEvent.layout.width);
|
||||
}}
|
||||
entering={SlideInUp.springify().mass(0.4)}
|
||||
exiting={SlideOutDown}
|
||||
style={{
|
||||
position: "absolute",
|
||||
zIndex: 999,
|
||||
width: "102%",
|
||||
height: "100%",
|
||||
flexDirection: "row",
|
||||
justifyContent: "flex-end",
|
||||
alignItems: "center"
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
type="accent"
|
||||
title="Select"
|
||||
icon="check"
|
||||
tooltipText="Select Item"
|
||||
onPress={() => {
|
||||
if (!selectionMode) {
|
||||
setSelectionMode(true);
|
||||
}
|
||||
setSelectedItem(note);
|
||||
setActionStrip(false);
|
||||
}}
|
||||
style={{
|
||||
borderRadius: 100,
|
||||
paddingHorizontal: 12,
|
||||
...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
|
||||
}}
|
||||
>
|
||||
<IconButton
|
||||
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>
|
||||
);
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user