From b8cf731dd0b0a4e9db44056446607ea3cbe959cc Mon Sep 17 00:00:00 2001 From: Kacper Ziubryniewicz Date: Sat, 14 Dec 2019 17:31:34 +0100 Subject: [PATCH] [Dialog/EventManual] Unshare using `eventObject` instead of `editingEvent`. --- .../pl/szczodrzynski/edziennik/api/v2/szkolny/SzkolnyApi.kt | 2 +- .../edziennik/ui/dialogs/event/EventManualDialog.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/szkolny/SzkolnyApi.kt b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/szkolny/SzkolnyApi.kt index 34f4b737..2638a6d0 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/szkolny/SzkolnyApi.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/szkolny/SzkolnyApi.kt @@ -25,7 +25,7 @@ import java.util.concurrent.TimeUnit.SECONDS class SzkolnyApi(val app: App) { - private var api: SzkolnyService + private val api: SzkolnyService init { val okHttpClient: OkHttpClient = app.http.newBuilder() diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventManualDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventManualDialog.kt index 8e45d591..ded6a844 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventManualDialog.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/event/EventManualDialog.kt @@ -628,8 +628,8 @@ class EventManualDialog( else if (!share && editingShared) { Toast.makeText(activity, "Unshare own event", Toast.LENGTH_SHORT).show() - editingEvent?.let { SzkolnyTask.unshareEvent(it).enqueue(activity) } - finishRemoving() + SzkolnyTask.unshareEvent(eventObject.withMetadata(metadataObject)).enqueue(activity) + finishAdding(eventObject, metadataObject) } else if (share) { Toast.makeText(activity, "Share/update own event", Toast.LENGTH_SHORT).show()