1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-11-08 20:12:39 +01:00

Fully remove anko, resolves #1184

This commit is contained in:
Allan Wang 2018-12-28 23:09:58 -05:00
parent 7f545a19dc
commit 0d6f53c82c
No known key found for this signature in database
GPG Key ID: C93E3F9C679D7A56
8 changed files with 54 additions and 35 deletions

View File

@ -184,9 +184,6 @@ dependencies {
//noinspection GradleDependency
implementation "ca.allanwang.kau:core-ui:$KAU"
// TODO temp
implementation "org.jetbrains.anko:anko-commons:0.10.8"
implementation "androidx.core:core-ktx:${KTX}"
// implementation "org.koin:koin-android:${KOIN}"

View File

@ -53,7 +53,6 @@ import com.pitchedapps.frost.intro.IntroTabTouchFragment
import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.cookies
import com.pitchedapps.frost.utils.launchNewTask
import org.jetbrains.anko.find
/**
* Created by Allan Wang on 2017-07-25.
@ -137,13 +136,13 @@ class IntroActivity : KauBaseActivity(), ViewPager.PageTransformer, ViewPager.On
val lastView: View? = fragments.last().view
arrayOf<View?>(
skip, indicator, next,
lastView?.find(R.id.intro_title),
lastView?.find(R.id.intro_desc)
lastView?.findViewById(R.id.intro_title),
lastView?.findViewById(R.id.intro_desc)
).forEach {
it?.animate()?.alpha(0f)?.setDuration(600)?.start()
}
if (Prefs.textColor != Color.WHITE) {
val f = lastView?.find<ImageView>(R.id.intro_image)?.drawable
val f = lastView?.findViewById<ImageView>(R.id.intro_image)?.drawable
if (f != null)
ValueAnimator.ofFloat(0f, 1f).apply {
addUpdateListener {

View File

@ -21,6 +21,7 @@ import ca.allanwang.kau.kpref.activity.KPrefAdapterBuilder
import ca.allanwang.kau.utils.materialDialog
import ca.allanwang.kau.utils.startActivityForResult
import ca.allanwang.kau.utils.string
import ca.allanwang.kau.utils.toast
import com.pitchedapps.frost.R
import com.pitchedapps.frost.activities.DebugActivity
import com.pitchedapps.frost.activities.SettingsActivity
@ -35,11 +36,13 @@ import com.pitchedapps.frost.facebook.parsers.SearchParser
import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.utils.frostUriFromFile
import com.pitchedapps.frost.utils.sendFrostEmail
import org.jetbrains.anko.doAsync
import org.jetbrains.anko.toast
import org.jetbrains.anko.uiThread
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.File
import java.util.concurrent.Future
/**
* Created by Allan Wang on 2017-06-30.
@ -69,26 +72,29 @@ fun SettingsActivity.getDebugPrefs(): KPrefAdapterBuilder.() -> Unit = {
itemsCallback { dialog, _, position, _ ->
dialog.dismiss()
val parser = parsers[position]
var attempt: Future<Unit>? = null
var attempt: Job? = null
val loading = materialDialog {
content(parser.nameRes)
progress(true, 100)
negativeText(R.string.kau_cancel)
onNegative { dialog, _ ->
attempt?.cancel(true)
attempt?.cancel()
dialog.dismiss()
}
canceledOnTouchOutside(false)
}
attempt = loading.doAsync({
createEmail(parser, "Error: ${it.message}")
}) {
val data = parser.parse(FbCookie.webCookie)
uiThread {
if (it.isCancelled) return@uiThread
it.dismiss()
createEmail(parser, data?.data)
attempt = launch(Dispatchers.IO) {
try {
val data = parser.parse(FbCookie.webCookie)
withContext(Dispatchers.Main) {
if (!isActive)
return@withContext
loading.dismiss()
createEmail(parser, data?.data)
}
} catch (e: Exception) {
createEmail(parser, "Error: ${e.message}")
}
}
}
@ -123,14 +129,20 @@ fun SettingsActivity.sendDebug(url: String, html: String?) {
dismissListener { downloader.cancel() }
}
md.doAsync {
downloader.loadAndZip(ZIP_NAME, { progress ->
uiThread { it.setProgress(progress) }
}) { success ->
uiThread {
it.dismiss()
val progressChannel = Channel<Int>(10)
launch(Dispatchers.Main) {
for (p in progressChannel) {
md.setProgress(p)
}
}
launch(Dispatchers.IO) {
downloader.loadAndZip(ZIP_NAME, { progressChannel.offer(it) }) { success ->
launch(Dispatchers.Main) {
if (!isActive) return@launch
md.dismiss()
if (success) {
val zipUri = it.context.frostUriFromFile(
val zipUri = frostUriFromFile(
File(downloader.baseDir, "$ZIP_NAME.zip")
)
L.i { "Sending debug zip with uri $zipUri" }

View File

@ -24,6 +24,7 @@ import android.util.AttributeSet
import android.view.View
import android.webkit.WebView
import androidx.annotation.WorkerThread
import ca.allanwang.kau.utils.withAlpha
import com.pitchedapps.frost.facebook.USER_AGENT_BASIC
import com.pitchedapps.frost.injectors.CssAssets
import com.pitchedapps.frost.injectors.CssHider
@ -32,7 +33,6 @@ import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.createFreshFile
import com.pitchedapps.frost.utils.isFacebookUrl
import org.jetbrains.anko.withAlpha
import java.io.File
/**

View File

@ -16,9 +16,9 @@
*/
package com.pitchedapps.frost.web
import ca.allanwang.kau.utils.runOnUiThread
import com.pitchedapps.frost.activities.WebOverlayActivity
import com.pitchedapps.frost.activities.WebOverlayActivityBase
import com.pitchedapps.frost.activities.WebOverlayBasicActivity
import com.pitchedapps.frost.contracts.VideoViewHolder
import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.facebook.FbItem
@ -34,7 +34,6 @@ import com.pitchedapps.frost.utils.launchImageActivity
import com.pitchedapps.frost.utils.launchWebOverlay
import com.pitchedapps.frost.utils.launchWebOverlayBasic
import com.pitchedapps.frost.views.FrostWebView
import org.jetbrains.anko.runOnUiThread
/**
* Created by Allan Wang on 2017-08-15.

View File

@ -22,6 +22,7 @@ import android.webkit.WebResourceRequest
import android.webkit.WebResourceResponse
import android.webkit.WebView
import android.webkit.WebViewClient
import ca.allanwang.kau.utils.withAlpha
import com.pitchedapps.frost.facebook.FB_URL_BASE
import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.facebook.FbItem
@ -41,7 +42,6 @@ import com.pitchedapps.frost.utils.launchImageActivity
import com.pitchedapps.frost.utils.resolveActivityForUri
import com.pitchedapps.frost.views.FrostWebView
import kotlinx.coroutines.channels.SendChannel
import org.jetbrains.anko.withAlpha
/**
* Created by Allan Wang on 2017-05-31.

View File

@ -6,11 +6,19 @@
<item text="" />
-->
<version title="v2.2.0" />
<item text="Rewrite a lot of internal logic to optimize loading" />
<item text="Change default user agent to new android version, previously a desktop user agent" />
<item text="" />
<item text="" />
<item text="" />
<item text="" />
<item text="" />
<item text="" />
<item text="" />
<version title="v2.1.2" />
<item text="Fix message notifications with just one other user" />
<item text="" />
<item text="" />
<item text="" />
<version title="v2.1.1" />
<item text="Fix link loading for some notifications. Some will redirect to the main notification page" />

View File

@ -1,5 +1,9 @@
# Changelog
## v2.2.0
* Rewrite a lot of internal logic to optimize loading
* Change default user agent to new android version, previously a desktop user agent
## v2.1.2
* Fix message notifications with just one other user