From 114c841f0c1b6533e9b2f80e994f397efcebb6b0 Mon Sep 17 00:00:00 2001 From: Kacper Ziubryniewicz Date: Thu, 26 Mar 2020 20:34:59 +0100 Subject: [PATCH] [API/Liburs] Fix Librus API push config endpoint. --- .../api/edziennik/librus/data/api/LibrusApiPushConfig.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiPushConfig.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiPushConfig.kt index 09142cc5..9073d03f 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiPushConfig.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/librus/data/api/LibrusApiPushConfig.kt @@ -21,6 +21,14 @@ class LibrusApiPushConfig(override val data: DataLibrus, } init { data.app.config.sync.tokenLibrus?.also { tokenLibrus -> + if(tokenLibrus.isEmpty()) { + data.setSyncNext(ENDPOINT_LIBRUS_API_PUSH_CONFIG, SYNC_ALWAYS) + data.app.config.sync.tokenLibrusList = + data.app.config.sync.tokenLibrusList + profileId + onSuccess(ENDPOINT_LIBRUS_API_PUSH_CONFIG) + return@also + } + apiGet(TAG, "ChangeRegister", payload = JsonObject( "provider" to "FCM", "device" to tokenLibrus,