You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-29 22:48:10 +02:00
Desktop: Resolves #2688: Add "Retry All" option to synchronisation page
Based on pull request #2712 by fhfuih commit 7d3815e51dbf682ecc1ed3544a15e51b79d5d12d Author: Laurent Cozic <laurent@cozic.net> Date: Sat Apr 4 18:26:01 2020 +0100 Fix issues commit dad1d2c4d4eb37fdd23096a3344cf4f14498e335 Merge:16cf0a30580a1ba511eaAuthor: Laurent Cozic <laurent@cozic.net> Date: Sat Apr 4 18:09:46 2020 +0100 Merge branch 'master' of https://github.com/fhfuih/joplin into fhfuih-master commit0a1ba511eaMerge:6207b42044bdd760f343Author: fhfuih <fhfuih@outlook.com> Date: Sat Mar 14 20:30:27 2020 -0400 Merge branch 'master' into master commit6207b42044Author: fhfuih <sam.zyhuang@outlook.com> Date: Sat Mar 14 20:13:28 2020 -0400 Decryption Retry All RN frontend commit6f46d1985fAuthor: fhfuih <sam.zyhuang@outlook.com> Date: Sat Mar 14 20:10:55 2020 -0400 Decryption Retry All backend & desktop commit4c3d37b311Author: fhfuih <sam.zyhuang@outlook.com> Date: Fri Mar 13 13:21:21 2020 -0400 Revert "Add "retry all" option to synchronisation page" This reverts commit15daaa16fd. commitcffc919791Author: fhfuih <sam.zyhuang@outlook.com> Date: Fri Mar 13 13:19:51 2020 -0400 Revert "Refactor "retry all" renderer to avoid hacks" This reverts commit51ba6ea655. commit51ba6ea655Author: fhfuih <sam.zyhuang@outlook.com> Date: Tue Mar 10 18:27:22 2020 -0400 Refactor "retry all" renderer to avoid hacks commit57d71712e1Merge:15daaa16fdb367955e56Author: fhfuih <sam.zyhuang@outlook.com> Date: Mon Mar 9 20:42:02 2020 -0400 Merge branch 'master' of https://github.com/fhfuih/joplin commit15daaa16fdAuthor: fhfuih <sam.zyhuang@outlook.com> Date: Mon Mar 9 20:36:09 2020 -0400 Add "retry all" option to synchronisation page
This commit is contained in:
@@ -61,6 +61,9 @@ class StatusScreenComponent extends BaseScreenComponent {
|
||||
style.fontWeight = 'bold';
|
||||
if (i > 0) style.paddingTop = 20;
|
||||
lines.push({ key: `section_${i}`, isSection: true, text: section.title });
|
||||
if (section.canRetryAll) {
|
||||
lines.push({ key: `retry_all_${i}`, text: '', retryAllHandler: section.retryAllHandler });
|
||||
}
|
||||
|
||||
for (const n in section.body) {
|
||||
if (!section.body.hasOwnProperty(n)) continue;
|
||||
@@ -101,6 +104,12 @@ class StatusScreenComponent extends BaseScreenComponent {
|
||||
|
||||
style.flex = 1;
|
||||
|
||||
const retryAllButton = item.retryAllHandler ? (
|
||||
<View style={{ flex: 0 }}>
|
||||
<Button title={_('Retry All')} onPress={item.retryAllHandler} />
|
||||
</View>
|
||||
) : null;
|
||||
|
||||
const retryButton = item.retryHandler ? (
|
||||
<View style={{ flex: 0 }}>
|
||||
<Button title={_('Retry')} onPress={item.retryHandler} />
|
||||
@@ -113,6 +122,7 @@ class StatusScreenComponent extends BaseScreenComponent {
|
||||
return (
|
||||
<View style={{ flex: 1, flexDirection: 'row' }}>
|
||||
<Text style={style}>{item.text}</Text>
|
||||
{retryAllButton}
|
||||
{retryButton}
|
||||
</View>
|
||||
);
|
||||
|
||||
@@ -139,7 +139,7 @@ class ReportService {
|
||||
const decryptionDisabledItems = await DecryptionWorker.instance().decryptionDisabledItems();
|
||||
|
||||
if (decryptionDisabledItems.length) {
|
||||
section = { title: _('Items that cannot be decrypted'), body: [], name: 'failedDecryption' };
|
||||
section = { title: _('Items that cannot be decrypted'), body: [], name: 'failedDecryption', canRetryAll: false, retryAllHandler: null };
|
||||
|
||||
section.body.push(_('Joplin failed to decrypt these items multiple times, possibly because they are corrupted or too large. These items will remain on the device but Joplin will no longer attempt to decrypt them.'));
|
||||
|
||||
@@ -157,6 +157,23 @@ class ReportService {
|
||||
});
|
||||
}
|
||||
|
||||
const retryHandlers = [];
|
||||
|
||||
for (let i = 0; i < section.body.length; i++) {
|
||||
if (section.body[i].canRetry) {
|
||||
retryHandlers.push(section.body[i].retryHandler);
|
||||
}
|
||||
}
|
||||
|
||||
if (retryHandlers.length > 1) {
|
||||
section.canRetryAll = true;
|
||||
section.retryAllHandler = async () => {
|
||||
for (const retryHandler of retryHandlers) {
|
||||
await retryHandler();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
sections.push(section);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user