Skip to content

Commit

Permalink
Fix screwed-up main branch (#142)
Browse files Browse the repository at this point in the history
* Remove release-branch stuff from main

* delete this other new file too
  • Loading branch information
daytime-em authored Jun 13, 2024
1 parent 704768f commit f82074b
Show file tree
Hide file tree
Showing 16 changed files with 84 additions and 365 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)
}
}
202 changes: 0 additions & 202 deletions app/src/main/java/com/mux/video/vod/demo/UploadNotificationService.kt

This file was deleted.

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
Loading

0 comments on commit f82074b

Please sign in to comment.