Skip to content

Commit

Permalink
Remove release-branch stuff from main
Browse files Browse the repository at this point in the history
  • Loading branch information
daytime-em committed Jun 12, 2024
1 parent 704768f commit 6bcae65
Show file tree
Hide file tree
Showing 15 changed files with 84 additions and 163 deletions.
9 changes: 4 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ android {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.5.14'
kotlinCompilerExtensionVersion '1.5.9'
}
packagingOptions {
resources {
Expand All @@ -52,28 +52,27 @@ dependencies {
implementation project(':library')

implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.11.0'
implementation 'com.google.android.material:material:1.10.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.activity:activity-ktx:1.8.2'
implementation "androidx.fragment:fragment-ktx:1.6.2"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0"
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'net.danlew:android.joda:2.12.7'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.7.0'
implementation 'androidx.activity:activity-compose:1.8.2'
implementation 'androidx.activity:activity-compose:1.8.0'
implementation "androidx.compose.ui:ui:$compose_ui_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_ui_version"
implementation "androidx.compose.runtime:runtime-livedata:$compose_ui_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$compose_ui_version"
implementation "androidx.compose.material:material-icons-extended:$compose_ui_version"
implementation "com.google.accompanist:accompanist-systemuicontroller:0.34.0"

implementation 'androidx.compose.material:material:1.6.2'
implementation 'androidx.compose.material:material:1.6.1'

implementation "com.squareup.okhttp3:logging-interceptor:4.12.0"
implementation "com.squareup.okhttp3:okhttp:4.12.0"
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'

Expand Down
16 changes: 1 addition & 15 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,14 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<!--
todo: New/Optional Stuff from U and V
* Selected Photos Access
* Media Processing FG Service type (w/mandatory timeout)
-->

<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="28" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<!-- todo dont need -->
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
android:maxSdkVersion="29" />

<application
android:name=".UploadExampleApp"
Expand Down Expand Up @@ -60,11 +51,6 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".UploadNotificationService"
android:exported="false"
android:foregroundServiceType="dataSync"
>
</service>
</application>

</manifest>
23 changes: 0 additions & 23 deletions app/src/main/java/com/mux/video/vod/demo/UploadExampleApp.kt
Original file line number Diff line number Diff line change
@@ -1,34 +1,11 @@
package com.mux.video.vod.demo

import android.annotation.TargetApi
import android.app.Application
import android.app.NotificationChannel
import android.app.NotificationManager
import android.os.Build
import com.mux.video.upload.MuxUploadSdk
import com.mux.video.upload.api.MuxUploadManager

class UploadExampleApp : Application() {

override fun onCreate() {
super.onCreate()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
createNotificationChannel()
}
MuxUploadSdk.initialize(this)
if (MuxUploadManager.allUploadJobs().isNotEmpty()) {
UploadNotificationService.startCompat(this)
}
}

@TargetApi(Build.VERSION_CODES.O)
private fun createNotificationChannel() {
val channel = NotificationChannel(
UploadNotificationService.CHANNEL_UPLOAD_PROGRESS,
getString(R.string.notif_channel_name),
NotificationManager.IMPORTANCE_LOW
)
channel.description = getString(R.string.notif_channel_desc)
getSystemService(NotificationManager::class.java).createNotificationChannel(channel)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ object ImaginaryBackend {
// note: You shouldn't do basic auth with hard-coded keys in a real app
private fun basicCredential(): String = Credentials.basic(ACCESS_TOKEN_ID, ACCESS_TOKEN_SECRET)

private const val ACCESS_TOKEN_ID = "d354b6f0-c753-40de-86a0-f92d0d08d699"
private const val ACCESS_TOKEN_SECRET = "HPcVJBvQL+PTRn3NXX40UqJaV94XM1kuj5AdeG/WR92RDY4w9TapQlFJnk1l3FmIpF2SrGJPuXj"
private const val ACCESS_TOKEN_ID = "YOUR TOKEN ID HERE"
private const val ACCESS_TOKEN_SECRET = "YOUR TOKEN SECRET HERE"
}

private interface ImaginaryWebapp {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.mux.video.vod.demo.upload.viewmodel
import android.app.Application
import android.database.Cursor
import android.graphics.Bitmap
import android.media.MediaMetadataRetriever
import android.net.Uri
import android.os.Build
import android.provider.MediaStore
Expand All @@ -12,7 +13,6 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.mux.video.upload.api.MuxUpload
import com.mux.video.vod.demo.UploadNotificationService
import com.mux.video.vod.demo.backend.ImaginaryBackend
import com.mux.video.vod.demo.upload.model.MediaStoreVideo
import com.mux.video.vod.demo.upload.model.extractThumbnail
Expand Down Expand Up @@ -67,15 +67,14 @@ class CreateUploadViewModel(private val app: Application) : AndroidViewModel(app
).build()
// Force restart when creating brand new uploads (because we're making new Direct uploads)
.start(forceRestart = true)

UploadNotificationService.startCompat(app)
}
}

/**
* In order to upload a file from the device's media store, the file must be copied into the app's
* temp directory. (Technically we could stream it from the source, but this prevents the other
* app from modifying the file if we pause the upload for a long time or whatever)
* TODO<em> Is this something that should go in the SDK? This is a common workflow
*/
@Throws
private suspend fun copyIntoTempFile(contentUri: Uri): File {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.mux.video.vod.demo.upload.viewmodel

import android.app.Application
import android.util.Log
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
Expand All @@ -23,8 +22,7 @@ class UploadListViewModel(app: Application) : AndroidViewModel(app) {

private val listUpdateListener: UploadEventListener<List<MuxUpload>> by lazy {
UploadEventListener { newUploads ->
//uploadMap.forEach { entry -> entry.value.clearListeners() }
observeUploads(newUploads)
newUploads.forEach { uploadMap[it.videoFile] = it }
updateUiData(uploadMap.values.toList())
}
}
Expand All @@ -50,13 +48,11 @@ class UploadListViewModel(app: Application) : AndroidViewModel(app) {
}

private fun observeUploads(recentUploads: List<MuxUpload>) {
recentUploads
.filter { !this.uploadMap.containsKey(it.videoFile) }
.forEach { upload ->
upload.setStatusListener {
updateUiData(uploadMap.values.toList())
}
recentUploads.forEach { upload ->
upload.setProgressListener {
uploadMap[upload.videoFile] = upload
updateUiData(uploadMap.values.toList())
}
} // recentUploads.forEach
}

Expand Down
20 changes: 2 additions & 18 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,9 @@
<resources>
<string name="app_name">Mux Upload Demo</string>
<string name="app_name">Mux Video VOD Upload SDK</string>
<string name="title_main_activity">Mux Upload</string>
<string name="title_plain_activity">Plain-View Mux Upload Example</string>
<string name="action_settings">Settings</string>
<string name="pause_button">Pause Button</string>
<string name="title_activity_create_upload">Create New Upload</string>
<string name="action_create_upload">Upload!</string>

<string name="notif_channel_name">Upload status notifications</string>
<string name="notif_channel_desc">Progress Notifications for uploads moving in the background</string>

<plurals name="notif_txt_uploading">
<item quantity="one">Uploading video</item>
<item quantity="other">Uploading %1$d videos</item>
</plurals>
<plurals name="notif_txt_failed">
<item quantity="one">Failed to upload video. Tap to retry</item>
<item quantity="other">%1$d uploads failed. Tap to retry</item>
</plurals>
<plurals name="notif_txt_success">
<item quantity="one">Upload succeeded</item>
<item quantity="other">Successfully uploaded %1$d videos</item>
</plurals>
</resources>
</resources>
6 changes: 3 additions & 3 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.4.1' apply false
id 'com.android.library' version '8.4.1' apply false
id 'org.jetbrains.kotlin.android' version '1.9.24' apply false
id 'com.android.application' version '8.1.2' apply false
id 'com.android.library' version '8.1.2' 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.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
2 changes: 1 addition & 1 deletion library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ muxDistribution {
dependencies {
implementation "com.squareup.okhttp3:logging-interceptor:4.12.0"
implementation "com.squareup.okhttp3:okhttp:4.12.0"
implementation "io.github.crow-misia.libyuv:libyuv-android:0.31.1"
implementation "io.github.crow-misia.libyuv:libyuv-android:0.29.0"

implementation 'androidx.core:core-ktx:1.12.0'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"
Expand Down
Loading

0 comments on commit 6bcae65

Please sign in to comment.