From d2f14093ec2df18aed677e43817c2a00542645ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Fri, 21 Feb 2020 20:41:57 +0100 Subject: [PATCH] [API] Fix sync error in case of an internal, handled error. --- .../data/api/edziennik/edudziennik/data/EdudziennikData.kt | 5 +++-- .../data/api/edziennik/idziennik/data/IdziennikData.kt | 5 +++-- .../edziennik/data/api/edziennik/librus/data/LibrusData.kt | 5 +++-- .../data/api/edziennik/mobidziennik/data/MobidziennikData.kt | 5 +++-- .../data/api/edziennik/template/data/TemplateData.kt | 5 +++-- .../edziennik/data/api/edziennik/vulcan/data/VulcanData.kt | 5 +++-- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/EdudziennikData.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/EdudziennikData.kt index 03d9fad2..a7baefcb 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/EdudziennikData.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/edudziennik/data/EdudziennikData.kt @@ -27,8 +27,9 @@ class EdudziennikData(val data: DataEdudziennik, val onSuccess: () -> Unit) { onSuccess() return } - useEndpoint(data.targetEndpointIds.firstKey()) { endpointId -> - data.targetEndpointIds.remove(endpointId) + val id = data.targetEndpointIds.firstKey() + data.targetEndpointIds.remove(id) + useEndpoint(id) { endpointId -> data.progress(data.progressStep) nextEndpoint(onSuccess) } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/IdziennikData.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/IdziennikData.kt index f407713f..e428d6cc 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/IdziennikData.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/idziennik/data/IdziennikData.kt @@ -30,8 +30,9 @@ class IdziennikData(val data: DataIdziennik, val onSuccess: () -> Unit) { onSuccess() return } - useEndpoint(data.targetEndpointIds.firstKey()) { endpointId -> - data.targetEndpointIds.remove(endpointId) + val id = data.targetEndpointIds.firstKey() + data.targetEndpointIds.remove(id) + useEndpoint(id) { endpointId -> data.progress(data.progressStep) nextEndpoint(onSuccess) } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/LibrusData.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/LibrusData.kt index 855f6162..3b2b68cb 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/LibrusData.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/LibrusData.kt @@ -31,8 +31,9 @@ class LibrusData(val data: DataLibrus, val onSuccess: () -> Unit) { onSuccess() return } - useEndpoint(data.targetEndpointIds.firstKey()) { endpointId -> - data.targetEndpointIds.remove(endpointId) + val id = data.targetEndpointIds.firstKey() + data.targetEndpointIds.remove(id) + useEndpoint(id) { endpointId -> data.progress(data.progressStep) nextEndpoint(onSuccess) } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/MobidziennikData.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/MobidziennikData.kt index c12f75c5..f98c5b51 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/MobidziennikData.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/mobidziennik/data/MobidziennikData.kt @@ -29,8 +29,9 @@ class MobidziennikData(val data: DataMobidziennik, val onSuccess: () -> Unit) { onSuccess() return } - useEndpoint(data.targetEndpointIds.firstKey()) { endpointId -> - data.targetEndpointIds.remove(endpointId) + val id = data.targetEndpointIds.firstKey() + data.targetEndpointIds.remove(id) + useEndpoint(id) { endpointId -> data.progress(data.progressStep) nextEndpoint(onSuccess) } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/data/TemplateData.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/data/TemplateData.kt index af81bc43..3e9d5dc7 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/data/TemplateData.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/template/data/TemplateData.kt @@ -32,8 +32,9 @@ class TemplateData(val data: DataTemplate, val onSuccess: () -> Unit) { onSuccess() return } - useEndpoint(data.targetEndpointIds.firstKey()) { endpointId -> - data.targetEndpointIds.remove(endpointId) + val id = data.targetEndpointIds.firstKey() + data.targetEndpointIds.remove(id) + useEndpoint(id) { endpointId -> data.progress(data.progressStep) nextEndpoint(onSuccess) } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/VulcanData.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/VulcanData.kt index b5deb178..b3887584 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/VulcanData.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/vulcan/data/VulcanData.kt @@ -27,8 +27,9 @@ class VulcanData(val data: DataVulcan, val onSuccess: () -> Unit) { onSuccess() return } - useEndpoint(data.targetEndpointIds.firstKey()) { endpointId -> - data.targetEndpointIds.remove(endpointId) + val id = data.targetEndpointIds.firstKey() + data.targetEndpointIds.remove(id) + useEndpoint(id) { endpointId -> data.progress(data.progressStep) nextEndpoint(onSuccess) }