diff --git a/app/src/main/java/org/yrovas/linklater/LinkDingAPI.kt b/app/src/main/java/org/yrovas/linklater/LinkDingAPI.kt index 647e93b..b62225a 100644 --- a/app/src/main/java/org/yrovas/linklater/LinkDingAPI.kt +++ b/app/src/main/java/org/yrovas/linklater/LinkDingAPI.kt @@ -47,10 +47,14 @@ class LinkDingAPI( } override suspend fun saveBookmark(bookmark: LocalBookmark): Boolean { - return Ktor.client.post("$endpoint/bookmarks/") { - setBody(bookmark) - header("Authorization", "Token $token") - }.status.value in 200..299 + return try { + Ktor.client.post("$endpoint/bookmarks/") { + setBody(bookmark) + header("Authorization", "Token $token") + }.status.value in 200..299 + } catch (e: Exception) { + false + } } override suspend fun getCachedBookmarks(context: Context): List { @@ -83,6 +87,7 @@ class LinkDingAPI( } response.body().results }.onFailure { + Log.i(TAG, "getTags: ${it.message}") Result.failure>(it) } } diff --git a/app/src/main/java/org/yrovas/linklater/SaveActivityState.kt b/app/src/main/java/org/yrovas/linklater/SaveActivityState.kt index 477e2b4..401d927 100644 --- a/app/src/main/java/org/yrovas/linklater/SaveActivityState.kt +++ b/app/src/main/java/org/yrovas/linklater/SaveActivityState.kt @@ -2,7 +2,6 @@ package org.yrovas.linklater import android.content.Context import android.util.Log -import androidx.annotation.Keep import androidx.lifecycle.ViewModel import kotlinx.coroutines.flow.* import org.yrovas.linklater.data.LocalBookmark diff --git a/app/src/main/java/org/yrovas/linklater/ui/screens/SaveBookmarkScreen.kt b/app/src/main/java/org/yrovas/linklater/ui/screens/SaveBookmarkScreen.kt index db8eb1b..abf0ed4 100644 --- a/app/src/main/java/org/yrovas/linklater/ui/screens/SaveBookmarkScreen.kt +++ b/app/src/main/java/org/yrovas/linklater/ui/screens/SaveBookmarkScreen.kt @@ -116,7 +116,7 @@ fun SaveBookmarkFields(saveActivityState: SaveActivityState, submit: () -> Unit) icon = Icons.Default.Tag, onChange = { saveActivityState.updateTagNames(tagNames = it) }) - var rows by remember { mutableStateOf(max(abs(tags.size / 5), 1)) } + var rows by remember { mutableIntStateOf(max(abs(tags.size / 4), 1)) } if (collapseTags && rows > 3) rows = 3 if (!collapseTags) rows = max(abs(tags.size / 4), 1) Column(