mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-28 19:49:20 +03:00
Idea for #344
This commit is contained in:
parent
a1fd8391da
commit
a57d4dc4b1
3 changed files with 24 additions and 5 deletions
|
|
@ -28,10 +28,19 @@ ContactUserStore.sync = fResultFunc => {
|
|||
&& !ContactUserStore.syncing()
|
||||
) {
|
||||
ContactUserStore.syncing(true);
|
||||
Remote.request('ContactsSync', (iError, oData) => {
|
||||
ContactUserStore.syncing(false);
|
||||
fResultFunc && fResultFunc(iError, oData);
|
||||
}, null, 200000);
|
||||
Remote.streamPerLine(line => {
|
||||
try {
|
||||
line = JSON.parse(line);
|
||||
if ('ContactsSync' === line.Action) {
|
||||
ContactUserStore.syncing(false);
|
||||
fResultFunc && fResultFunc(line.ErrorCode, line);
|
||||
}
|
||||
} catch (e) {
|
||||
ContactUserStore.syncing(false);
|
||||
console.error(e);
|
||||
fResultFunc && fResultFunc(Notification.UnknownError);
|
||||
}
|
||||
}, 'ContactsSync');
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue