Skip to content

Commit

Permalink
Minor fixes (readium#449)
Browse files Browse the repository at this point in the history
  • Loading branch information
mickael-menu authored Jan 19, 2024
1 parent b0967f7 commit b13bc52
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import org.readium.r2.shared.publication.ReadingProgression as PublicationReadin
public interface VisualNavigator : Navigator {

@Deprecated(
"Moved to DirectionalNavigator",
"Renamed to OverflowableNavigator.Overflow",
level = DeprecationLevel.ERROR
)
@OptIn(ExperimentalReadiumApi::class)
Expand Down Expand Up @@ -126,7 +126,7 @@ public interface VisualNavigator : Navigator {
* Moves to the next content portion (eg. page) in the reading progression direction.
*/
@Deprecated(
"Moved to DirectionalNavigator",
"Moved to OverflowableNavigator",
level = DeprecationLevel.ERROR
)
public fun goForward(animated: Boolean = false, completion: () -> Unit = {}): Boolean
Expand All @@ -135,7 +135,7 @@ public interface VisualNavigator : Navigator {
* Moves to the previous content portion (eg. page) in the reading progression direction.
*/
@Deprecated(
"Moved to DirectionalNavigator",
"Moved to OverflowableNavigator",
level = DeprecationLevel.ERROR
)
public fun goBackward(animated: Boolean = false, completion: () -> Unit = {}): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,15 @@ public class MediaSessionNavigator(
return go(locator, animated, completion)
}

public fun goForward(animated: Boolean, completion: () -> Unit): Boolean {
public fun goForward(animated: Boolean = true, completion: () -> Unit = {}): Boolean {
if (!isActive) return false

seekRelative(skipForwardInterval)
completion()
return true
}

public fun goBackward(animated: Boolean, completion: () -> Unit): Boolean {
public fun goBackward(animated: Boolean = true, completion: () -> Unit = {}): Boolean {
if (!isActive) return false

seekRelative(-skipBackwardInterval)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,17 @@ public class ForegroundDownloadManager(
}

private suspend fun doRequest(request: DownloadManager.Request, id: DownloadManager.RequestId) {
val destination = withContext(Dispatchers.IO) {
File.createTempFile(UUID.randomUUID().toString(), null, downloadsDirectory)
val destination: File
try {
destination = withContext(Dispatchers.IO) {
File.createTempFile(UUID.randomUUID().toString(), null, downloadsDirectory)
}
} catch (exception: IOException) {
val error = DownloadManager.DownloadError.FileSystem(FileSystemError.IO(exception))
forEachListener(id) {
onDownloadFailed(id, error)
}
return
}

httpClient
Expand Down

0 comments on commit b13bc52

Please sign in to comment.