Skip to content

Commit

Permalink
- Repair bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
DesarrolloAntonio committed Apr 5, 2024
1 parent 0fde30b commit 708a116
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
15 changes: 14 additions & 1 deletion .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,19 @@ abstract class NetworkNoCacheResource<RequestType, ResultType>(
) {
fun asFlow() = flow {
emit(Result.Loading(null)) // start loading state immediately

try {
val apiResponse = fetchFromRemote()
val remoteResponse = apiResponse.body()
if (apiResponse.isSuccessful && remoteResponse != null) {
emitAll(fetchResult(remoteResponse).map { Result.Success(it) })
} else {
emit(Result.Error(errorHandler.getApiError(apiResponse.code()), null))
emit(Result.Error(errorHandler.getApiError(
statusCode = apiResponse.code(),
throwable = null,
message = apiResponse.errorBody()?.string())))
}
} catch (e: Exception) {
Log.v("NetworkNoCacheResource", "Error: ${e.message}")
emit(Result.Error(errorHandler.getError(e), null))
}
}
Expand Down
1 change: 0 additions & 1 deletion presentation/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
</activity>
<activity android:name=".ui.bookmarkeditor.BookmarkEditorActivity"
android:label="Save in PageKeeper"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:exported="true"
tools:ignore="DiscouragedApi,LockedOrientationActivity">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class BookmarkViewModel(
makeArchivePublic: Boolean,
createEbook: Boolean
) = viewModelScope.launch {
Log.v("Add BookmarkViewModel", "createArchive: ${createArchive} makeArchivePublic: ${makeArchivePublic}")
Log.v("Add BookmarkViewModel", "createArchive: $createArchive makeArchivePublic: $makeArchivePublic")

viewModelScope.launch {
bookmarkAdditionUseCase.invoke(
Expand All @@ -79,7 +79,7 @@ class BookmarkViewModel(
when (result) {
is Result.Error -> {
Log.v("Add BookmarkViewModel", result.error?.message ?: "")
_bookmarkUiState.error(errorMessage = result.error?.message ?: "" )
_bookmarkUiState.error(errorMessage = result.error?.message ?: "Unknown error" )
}

is Result.Loading -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ fun DockedSearchBarWithCategories(
Box(Modifier.fillMaxHeight()) {
LazyColumn(
modifier = Modifier
.fillMaxHeight()
.padding(horizontal = 10.dp)
.pullRefresh(state = refreshState)
.animateContentSize(),
Expand Down

0 comments on commit 708a116

Please sign in to comment.