mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-23 18:15:30 +00:00
Update dependencies
This commit is contained in:
parent
674d272eaa
commit
ff8460b361
@ -63,8 +63,9 @@ dependencies {
|
|||||||
implementation 'com.ncapdevi:frag-nav:3.2.0'
|
implementation 'com.ncapdevi:frag-nav:3.2.0'
|
||||||
implementation 'com.github.pwittchen:reactivenetwork-rx2:3.0.6'
|
implementation 'com.github.pwittchen:reactivenetwork-rx2:3.0.6'
|
||||||
|
|
||||||
implementation "io.reactivex.rxjava2:rxjava:2.2.12"
|
implementation 'io.reactivex.rxjava2:rxjava:2.2.13'
|
||||||
implementation "io.reactivex.rxjava2:rxkotlin:2.4.0"
|
implementation 'io.reactivex.rxjava2:rxkotlin:2.4.0'
|
||||||
|
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
|
||||||
|
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:${vKotlin}"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:${vKotlin}"
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${vKotlin}"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${vKotlin}"
|
||||||
@ -74,10 +75,11 @@ dependencies {
|
|||||||
implementation "${bindingAdapter}:${vBAdapt}"
|
implementation "${bindingAdapter}:${vBAdapt}"
|
||||||
implementation "${bindingAdapter}-recyclerview:${vBAdapt}"
|
implementation "${bindingAdapter}-recyclerview:${vBAdapt}"
|
||||||
|
|
||||||
def vMarkwon = '3.1.0'
|
def vMarkwon = '4.1.1'
|
||||||
implementation "ru.noties.markwon:core:${vMarkwon}"
|
implementation "io.noties.markwon:core:${vMarkwon}"
|
||||||
implementation "ru.noties.markwon:html:${vMarkwon}"
|
implementation "io.noties.markwon:html:${vMarkwon}"
|
||||||
implementation "ru.noties.markwon:image-svg:${vMarkwon}"
|
implementation "io.noties.markwon:image:${vMarkwon}"
|
||||||
|
implementation 'com.caverock:androidsvg:1.4'
|
||||||
|
|
||||||
def vLibsu = '2.5.1'
|
def vLibsu = '2.5.1'
|
||||||
implementation "com.github.topjohnwu.libsu:core:${vLibsu}"
|
implementation "com.github.topjohnwu.libsu:core:${vLibsu}"
|
||||||
@ -88,7 +90,7 @@ dependencies {
|
|||||||
implementation "org.koin:koin-android:${vKoin}"
|
implementation "org.koin:koin-android:${vKoin}"
|
||||||
implementation "org.koin:koin-androidx-viewmodel:${vKoin}"
|
implementation "org.koin:koin-androidx-viewmodel:${vKoin}"
|
||||||
|
|
||||||
def vRetrofit = '2.6.1'
|
def vRetrofit = '2.6.2'
|
||||||
implementation "com.squareup.retrofit2:retrofit:${vRetrofit}"
|
implementation "com.squareup.retrofit2:retrofit:${vRetrofit}"
|
||||||
implementation "com.squareup.retrofit2:converter-moshi:${vRetrofit}"
|
implementation "com.squareup.retrofit2:converter-moshi:${vRetrofit}"
|
||||||
implementation "com.squareup.retrofit2:converter-scalars:${vRetrofit}"
|
implementation "com.squareup.retrofit2:converter-scalars:${vRetrofit}"
|
||||||
@ -110,7 +112,7 @@ dependencies {
|
|||||||
replacedBy('com.github.topjohnwu:room-runtime')
|
replacedBy('com.github.topjohnwu:room-runtime')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
def vRoom = "2.1.0"
|
def vRoom = "2.2.0"
|
||||||
implementation "com.github.topjohnwu:room-runtime:${vRoom}"
|
implementation "com.github.topjohnwu:room-runtime:${vRoom}"
|
||||||
kapt "androidx.room:room-compiler:${vRoom}"
|
kapt "androidx.room:room-compiler:${vRoom}"
|
||||||
|
|
||||||
@ -119,13 +121,13 @@ dependencies {
|
|||||||
implementation "androidx.navigation:navigation-ui-ktx:$vNav"
|
implementation "androidx.navigation:navigation-ui-ktx:$vNav"
|
||||||
|
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'
|
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha03'
|
||||||
implementation 'androidx.preference:preference:1.1.0'
|
implementation 'androidx.preference:preference:1.1.0'
|
||||||
implementation 'androidx.recyclerview:recyclerview:1.1.0-beta04'
|
implementation 'androidx.recyclerview:recyclerview:1.1.0-beta05'
|
||||||
implementation 'androidx.cardview:cardview:1.0.0'
|
implementation 'androidx.cardview:cardview:1.0.0'
|
||||||
implementation 'androidx.work:work-runtime:2.2.0'
|
implementation 'androidx.work:work-runtime:2.2.0'
|
||||||
implementation 'androidx.transition:transition:1.2.0-rc01'
|
implementation 'androidx.transition:transition:1.2.0'
|
||||||
implementation 'androidx.multidex:multidex:2.0.1'
|
implementation 'androidx.multidex:multidex:2.0.1'
|
||||||
implementation 'androidx.core:core-ktx:1.1.0'
|
implementation 'androidx.core:core-ktx:1.1.0'
|
||||||
implementation 'com.google.android.material:material:1.1.0-alpha10'
|
implementation 'com.google.android.material:material:1.1.0-beta01'
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,10 @@ import com.topjohnwu.magisk.data.network.GithubApiServices
|
|||||||
import com.topjohnwu.magisk.data.network.GithubRawServices
|
import com.topjohnwu.magisk.data.network.GithubRawServices
|
||||||
import com.topjohnwu.magisk.net.Networking
|
import com.topjohnwu.magisk.net.Networking
|
||||||
import com.topjohnwu.magisk.net.NoSSLv3SocketFactory
|
import com.topjohnwu.magisk.net.NoSSLv3SocketFactory
|
||||||
|
import io.noties.markwon.Markwon
|
||||||
|
import io.noties.markwon.html.HtmlPlugin
|
||||||
|
import io.noties.markwon.image.ImagesPlugin
|
||||||
|
import io.noties.markwon.image.network.OkHttpNetworkSchemeHandler
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.logging.HttpLoggingInterceptor
|
import okhttp3.logging.HttpLoggingInterceptor
|
||||||
import org.koin.dsl.module
|
import org.koin.dsl.module
|
||||||
@ -23,6 +27,7 @@ val networkingModule = module {
|
|||||||
single { createRetrofit(get()) }
|
single { createRetrofit(get()) }
|
||||||
single { createApiService<GithubRawServices>(get(), Const.Url.GITHUB_RAW_URL) }
|
single { createApiService<GithubRawServices>(get(), Const.Url.GITHUB_RAW_URL) }
|
||||||
single { createApiService<GithubApiServices>(get(), Const.Url.GITHUB_API_URL) }
|
single { createApiService<GithubApiServices>(get(), Const.Url.GITHUB_API_URL) }
|
||||||
|
single { createMarkwon(get(), get()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
@ -67,3 +72,12 @@ inline fun <reified T> createApiService(retrofitBuilder: Retrofit.Builder, baseU
|
|||||||
.build()
|
.build()
|
||||||
.create(T::class.java)
|
.create(T::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun createMarkwon(context: Context, okHttpClient: OkHttpClient): Markwon {
|
||||||
|
return Markwon.builder(context)
|
||||||
|
.usePlugin(HtmlPlugin.create())
|
||||||
|
.usePlugin(ImagesPlugin.create {
|
||||||
|
it.addSchemeHandler(OkHttpNetworkSchemeHandler.create(okHttpClient))
|
||||||
|
})
|
||||||
|
.build()
|
||||||
|
}
|
||||||
|
@ -6,21 +6,20 @@ import android.widget.TextView
|
|||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import com.topjohnwu.magisk.R
|
import com.topjohnwu.magisk.R
|
||||||
import com.topjohnwu.magisk.data.repository.StringRepository
|
import com.topjohnwu.magisk.data.repository.StringRepository
|
||||||
import com.topjohnwu.magisk.extensions.inject
|
|
||||||
import com.topjohnwu.magisk.extensions.subscribeK
|
import com.topjohnwu.magisk.extensions.subscribeK
|
||||||
|
import io.noties.markwon.Markwon
|
||||||
import io.reactivex.Completable
|
import io.reactivex.Completable
|
||||||
import io.reactivex.Single
|
import io.reactivex.Single
|
||||||
import ru.noties.markwon.Markwon
|
import org.koin.core.KoinComponent
|
||||||
import ru.noties.markwon.html.HtmlPlugin
|
import org.koin.core.inject
|
||||||
import ru.noties.markwon.image.ImagesPlugin
|
|
||||||
import ru.noties.markwon.image.svg.SvgPlugin
|
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
object MarkDownWindow {
|
object MarkDownWindow : KoinComponent {
|
||||||
|
|
||||||
private val stringRepo: StringRepository by inject()
|
private val stringRepo: StringRepository by inject()
|
||||||
|
private val markwon: Markwon by inject()
|
||||||
|
|
||||||
fun show(activity: Context, title: String?, url: String) {
|
fun show(activity: Context, title: String?, url: String) {
|
||||||
show(activity, title, stringRepo.getString(url))
|
show(activity, title, stringRepo.getString(url))
|
||||||
@ -35,25 +34,14 @@ object MarkDownWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun show(activity: Context, title: String?, content: Single<String>) {
|
fun show(activity: Context, title: String?, content: Single<String>) {
|
||||||
val markwon = Markwon.builder(activity)
|
|
||||||
.usePlugin(HtmlPlugin.create())
|
|
||||||
.usePlugin(ImagesPlugin.create(activity))
|
|
||||||
.usePlugin(SvgPlugin.create(activity.resources))
|
|
||||||
.build()
|
|
||||||
val mv = LayoutInflater.from(activity).inflate(R.layout.markdown_window, null)
|
val mv = LayoutInflater.from(activity).inflate(R.layout.markdown_window, null)
|
||||||
val tv = mv.findViewById<TextView>(R.id.md_txt)
|
val tv = mv.findViewById<TextView>(R.id.md_txt)
|
||||||
|
|
||||||
content.map {
|
content.map {
|
||||||
runCatching {
|
|
||||||
markwon.setMarkdown(tv, it)
|
markwon.setMarkdown(tv, it)
|
||||||
}.onFailure {
|
|
||||||
Timber.e(it)
|
|
||||||
// Always wrap the actual exception as it could be ExceptionInInitializerError,
|
|
||||||
// which is a fatal error and RxJava will send it to the global handler and crash
|
|
||||||
throw MarkwonException(it)
|
|
||||||
}
|
|
||||||
}.ignoreElement().onErrorResumeNext {
|
}.ignoreElement().onErrorResumeNext {
|
||||||
// Nothing we can actually do other than show error message
|
// Nothing we can actually do other than show error message
|
||||||
|
Timber.e(it)
|
||||||
tv.setText(R.string.download_file_error)
|
tv.setText(R.string.download_file_error)
|
||||||
Completable.complete()
|
Completable.complete()
|
||||||
}.subscribeK {
|
}.subscribeK {
|
||||||
@ -64,6 +52,4 @@ object MarkDownWindow {
|
|||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MarkwonException(e: Throwable): Exception(e)
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user