Compare commits

...

4 Commits

Author SHA1 Message Date
Ivan Agosto
5e1a8b40c6 release v0.8.4 2025-02-06 22:25:35 -06:00
Ivan Agosto
3f461792e5 release version v0.8.3 2025-02-01 18:59:36 -06:00
Ivan Agosto
4738c317cc Fix play private videos 2025-02-01 18:53:20 -06:00
Ivan Agosto
3997b38120 Fix session fetch 2025-02-01 17:41:34 -06:00
6 changed files with 26 additions and 24 deletions

View File

@ -9,8 +9,8 @@ android {
compileSdk 35
minSdkVersion 26
targetSdkVersion 32
versionCode 13
versionName "0.8.2"
versionCode 15
versionName "0.8.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}

View File

@ -66,11 +66,6 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
binding.content.mini.miniPlayerAuthor.setOnClickListener { this.resumeVideo() }
// binding.content.mini.setOnClickListener { this.resumeVideo() }
binding.content.mini.miniPlayPause.setOnClickListener { this.playPausePlayer() }
Handler().postDelayed({
// Title for nav_bar
binding.navView.getHeaderView(0).findViewById<TextView>(R.id.side_emailTxt).text = getString(R.string.nav_header_subtitle) + " " + this.packageManager.getPackageInfo(this.packageName, 0).versionName
}, 2000)
}
// Generic function for set data to RecyclerView
@ -374,10 +369,10 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
}
private fun setSideData() {
val headerView = binding.navView.getHeaderView(0)
if (ManagerSingleton.user.status == 1) {
binding.navView.menu.findItem(R.id.ml).isVisible = true
val headerView = binding.navView.getHeaderView(0)
headerView.findViewById<TextView>(R.id.side_usernameTxt).text = ManagerSingleton.user.username
headerView.findViewById<TextView>(R.id.side_emailTxt).text = ManagerSingleton.user.email
if (ManagerSingleton.user.avatar != "" && headerView.findViewById<ImageView>(R.id.side_imageView) != null) {
@ -394,6 +389,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
}
} else {
binding.navView.menu.findItem(R.id.ml).isVisible = false
headerView.findViewById<TextView>(R.id.side_emailTxt).text = getString(R.string.nav_header_subtitle) + " " + this.packageManager.getPackageInfo(this.packageName, 0).versionName
}
}

View File

@ -10,6 +10,7 @@ import android.net.Uri
import android.os.AsyncTask
import android.os.Bundle
import android.os.Looper
import android.util.Log
import android.view.View
import android.view.WindowManager
import android.webkit.WebChromeClient
@ -139,7 +140,10 @@ class ReproductorActivity : AppCompatActivity() {
}
AsyncTask.execute {
videoPlayback = this.clientVideo.getVideo(this.video.uuid)
videoPlayback = if (ManagerSingleton.token.status == 1)
this.clientVideo.getVideo(this.video.uuid, ManagerSingleton.token.token)
else
this.clientVideo.getVideo(this.video.uuid)
// TODO: Make this configurable
// val bufferSize = 1024 * 1024 // 1mb
// val allocator = DefaultAllocator(true, bufferSize)

View File

@ -46,7 +46,6 @@ class SplashActivity : AppCompatActivity() {
}
private fun checkUser() {
Log.d("was", "Checked")
try {
val token = db.getToken()
val user = db.getUser()
@ -56,8 +55,11 @@ class SplashActivity : AppCompatActivity() {
val clientSecret = settings.getString("client_secret", "")!!
val task = TaskManager<TokenModel>()
task.runTask({client.refreshToken(token, clientId, clientSecret)}, {
when (token.status.toString()) {
task.runTask(
{
client.refreshToken(token, clientId, clientSecret)
}, {
when (it.status.toString()) {
"1" -> {
db.newToken(it)
ManagerSingleton.token = it
@ -65,12 +67,12 @@ class SplashActivity : AppCompatActivity() {
}
else -> ManagerSingleton.logout()
}
startApp()
})
} else {
ManagerSingleton.logout()
}
startApp()
}
} catch (err: Exception) {
err.printStackTrace()
Thread.sleep(2000)

View File

@ -9,7 +9,7 @@ import java.net.HttpURLConnection
import java.net.URL
open class Client {
protected fun newCon(uri: String, method: String, token: String = ""): HttpURLConnection {
protected fun newCon(uri: String, method: String, token: String? = null): HttpURLConnection {
val url = URL("https://${ManagerSingleton.url}/api/v1/$uri")
val con = url.openConnection() as HttpURLConnection
@ -17,7 +17,7 @@ open class Client {
con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded")
con.setRequestProperty("Accept", "*/*")
if (token != "") {
if (token !== null) {
con.setRequestProperty("Authorization", "Bearer $token")
}

View File

@ -201,8 +201,8 @@ class Videos : Client() {
return this.getVideos(start, "-likes")
}
fun getVideo(uuid: String): VideoModel {
val con = this.newCon("videos/$uuid", "GET")
fun getVideo(uuid: String, token: String? = null): VideoModel {
val con = this.newCon("videos/$uuid", "GET", token)
val video = VideoModel()
try {
if (con.responseCode == 200) {