This commit is contained in:
the-djmaze 2022-05-20 08:34:11 +02:00
parent a1fd8391da
commit a57d4dc4b1
3 changed files with 24 additions and 5 deletions

View file

@ -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');
}
};