1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-09-19 15:11:42 +02:00

Clean up and fix changes from compose test

This commit is contained in:
Allan Wang 2021-11-19 21:35:49 -08:00
parent e6a45b29ca
commit 4135d5e773
No known key found for this signature in database
GPG Key ID: C93E3F9C679D7A56
5 changed files with 20 additions and 26 deletions

View File

@ -274,9 +274,9 @@ dependencies {
implementation "androidx.biometric:biometric:${Versions.andxBiometric}"
implementation 'com.github.piasy:BigImageViewer:1.8.1'
implementation 'com.github.piasy:GlideImageLoader:1.8.1'
implementation 'com.github.piasy:GlideImageViewFactory:1.8.1'
implementation "com.github.piasy:BigImageViewer:${Versions.bigImageViewer}"
implementation "com.github.piasy:GlideImageLoader:${Versions.bigImageViewer}"
implementation "com.github.piasy:GlideImageViewFactory:${Versions.bigImageViewer}"
implementation kau.Dependencies.hilt
kapt kau.Dependencies.hiltCompiler
@ -318,8 +318,6 @@ dependencies {
testImplementation "com.squareup.okhttp3:mockwebserver:${Versions.okhttp}"
androidTestImplementation "com.squareup.okhttp3:mockwebserver:${Versions.okhttp}"
// implementation "com.davemorrissey.labs:subsampling-scale-image-view:${Versions.scaleImageView}"
implementation "androidx.room:room-ktx:${Versions.room}"
implementation "androidx.room:room-runtime:${Versions.room}"
kapt "androidx.room:room-compiler:${Versions.room}"

View File

@ -219,6 +219,18 @@ class ImageActivity : KauBaseActivity() {
setOnClickListener { state.onClick(this@ImageActivity) }
}
imageProgress.tint(foregroundTint)
error.apply {
invisible()
setState(FabStates.ERROR)
}
download.apply {
setState(FabStates.DOWNLOAD)
}
share.apply {
setState(FabStates.SHARE)
}
imagePhoto.setImageLoaderCallback(object : ImageLoader.Callback {
override fun onCacheHit(imageType: Int, image: File?) {}
@ -237,17 +249,6 @@ class ImageActivity : KauBaseActivity() {
}
})
imageProgress.tint(foregroundTint)
error.apply {
invisible()
setState(FabStates.ERROR)
}
download.apply {
setState(FabStates.DOWNLOAD)
}
share.apply {
setState(FabStates.SHARE)
}
activityThemer.setFrostColors {
themeWindow = false
}

View File

@ -31,15 +31,12 @@ import kotlinx.coroutines.withTimeout
/**
* Attempts to get the fbcdn url of the supplied image redirect url
*/
suspend fun String.getFullSizedImageUrl(url: String, timeout: Long = 3000): String? {
L.v { "Image full size 1 from $url" }
return withContext(Dispatchers.IO) {
suspend fun String.getFullSizedImageUrl(url: String, timeout: Long = 3000): String? =
withContext(Dispatchers.IO) {
try {
withTimeout(timeout) {
L.v { "Image full size from $url" }
val redirect = requestBuilder().url(url).get().call()
.execute().body?.string() ?: return@withTimeout null
L.v { "Image full size from redirect $redirect" }
FB_REDIRECT_URL_MATCHER.find(redirect)[1]?.formattedFbUrl
}
} catch (e: Exception) {
@ -47,4 +44,3 @@ suspend fun String.getFullSizedImageUrl(url: String, timeout: Long = 3000): Stri
null
}
}
}

View File

@ -9,12 +9,11 @@ buildscript {
dependencies {
classpath kau.Plugins.android
// classpath kau.Plugins.kotlin
classpath kau.Plugins.kotlin
classpath kau.Plugins.spotless
classpath kau.Plugins.dexCount
classpath kau.Plugins.hilt
classpath kau.Plugins.gitVersion
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31'
}
wrapper.setDistributionType(Wrapper.DistributionType.ALL)

View File

@ -19,8 +19,8 @@ object Versions {
const val room = "2.3.0"
// http://robolectric.org/getting-started/
const val roboelectric = "4.6"
// https://github.com/davemorrissey/subsampling-scale-image-view#quick-start
const val scaleImageView = "3.10.0"
// https://github.com/Piasy/BigImageViewer#add-the-dependencies
const val bigImageViewer = "1.8.1"
// https://github.com/node-gradle/gradle-node-plugin/releases
const val nodeGradle = "3.1.1"
}