Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup + fix api for getting current status (would always return Ready before) #135

Merged
merged 4 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ buildscript {
}
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.1.2' apply false
id 'com.android.library' version '8.1.2' apply false
id 'com.android.application' version '8.4.0' apply false
id 'com.android.library' version '8.4.0' apply false
id 'org.jetbrains.kotlin.android' version '1.9.22' apply false
id 'com.mux.gradle.android.mux-android-distribution' version '1.1.2' apply false
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Jan 19 16:04:49 PST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
15 changes: 4 additions & 11 deletions library/src/main/java/com/mux/video/upload/api/MuxUpload.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import java.io.File
class MuxUpload private constructor(
private var uploadInfo: UploadInfo,
private val autoManage: Boolean = true,
initialStatus: UploadStatus = UploadStatus.Ready
) {

/**
Expand All @@ -56,7 +55,7 @@ class MuxUpload private constructor(
* To be notified of status updates (including upload progress), use [setStatusListener]
*/
@Suppress("MemberVisibilityCanBePrivate")
val uploadStatus: UploadStatus
val uploadStatus: UploadStatus get() = uploadInfo.statusFlow?.value ?: currentStatus

/**
* True when the upload is running, false if it's paused, failed, or canceled
Expand Down Expand Up @@ -273,10 +272,6 @@ class MuxUpload private constructor(
observerJob = newObserveProgressJob(uploadInfo)
}

init {
uploadStatus = initialStatus
}

/**
* The current progress of an upload, in terms of time elapsed and data transmitted
*/
Expand Down Expand Up @@ -311,7 +306,7 @@ class MuxUpload private constructor(
* @param videoFile a File that represents the video file you want to upload
*/
@Suppress("MemberVisibilityCanBePrivate")
class Builder constructor(val uploadUri: Uri, val videoFile: File) {
class Builder(val uploadUri: Uri, val videoFile: File) {

/**
* Create a new Builder with the specified input file and upload URL
Expand All @@ -320,8 +315,7 @@ class MuxUpload private constructor(
* @param videoFile a File that represents the video file you want to upload
*/
@Suppress("unused")
constructor(uploadUri: String, videoFile: File)
: this(Uri.parse(uploadUri), videoFile)
constructor(uploadUri: String, videoFile: File): this(Uri.parse(uploadUri), videoFile)

private var manageTask: Boolean = true
private var uploadInfo: UploadInfo = UploadInfo(
Expand Down Expand Up @@ -403,7 +397,6 @@ class MuxUpload private constructor(
* [MuxUploadManager]
*/
@JvmSynthetic
internal fun create(uploadInfo: UploadInfo, initialStatus: UploadStatus = UploadStatus.Ready)
= MuxUpload(uploadInfo = uploadInfo, initialStatus = initialStatus)
internal fun create(uploadInfo: UploadInfo) = MuxUpload(uploadInfo = uploadInfo)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package com.mux.video.upload.api
*
* Kotlin callers can use the [Result] API as normal
*/
@Suppress("unused")
class UploadResult {

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ sealed class UploadStatus {
/**
* This upload hos not been started. It is ready to start by calling [MuxUpload.start]
*/
object Ready: UploadStatus()
data object Ready: UploadStatus()

/**
* This upload has been started via [MuxUpload.start] but has not yet started processing anything
*/
object Started: UploadStatus()
data object Started: UploadStatus()

/**
* This upload is being prepared. If standardization is required, it is done during this step
*
* @see MuxUpload.Builder.standardizationRequested
*/
object Preparing: UploadStatus()
data object Preparing: UploadStatus()

/**
* The upload is currently being sent to Mux Video. The progress is available
Expand Down
Loading