mirror of
https://git.sr.ht/~oppen/ariane
synced 2024-12-26 01:38:40 +00:00
add device tls info to about screen
This commit is contained in:
parent
7b02201ade
commit
56a63538e3
3 changed files with 66 additions and 13 deletions
|
@ -9,10 +9,10 @@ android {
|
|||
|
||||
defaultConfig {
|
||||
applicationId "oppen.gemini.ariane"
|
||||
minSdkVersion 29
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 7
|
||||
versionName "1.0.0"
|
||||
versionCode 8
|
||||
versionName "2.0.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
|
|
@ -3,11 +3,21 @@ package oppen.ariane.ui.modals_menus.about
|
|||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AppCompatDialog
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import kotlinx.android.synthetic.main.dialog_about.view.*
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import oppen.ariane.BuildConfig
|
||||
import oppen.ariane.R
|
||||
import java.lang.StringBuilder
|
||||
import java.security.SecureRandom
|
||||
import javax.net.ssl.SSLContext
|
||||
import javax.net.ssl.SSLSocket
|
||||
import javax.net.ssl.SSLSocketFactory
|
||||
|
||||
object AboutDialog {
|
||||
|
||||
|
@ -21,7 +31,7 @@ object AboutDialog {
|
|||
dialog.dismiss()
|
||||
}
|
||||
|
||||
view.version_label.text = BuildConfig.VERSION_NAME;
|
||||
view.version_label.text = BuildConfig.VERSION_NAME
|
||||
|
||||
view.gnu_license_button.setOnClickListener {
|
||||
context.startActivity(Intent(Intent.ACTION_VIEW).apply {
|
||||
|
@ -35,7 +45,39 @@ object AboutDialog {
|
|||
})
|
||||
}
|
||||
|
||||
buildTLSInfo(view.tls_info)
|
||||
|
||||
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
private fun buildTLSInfo(tlsInfo: AppCompatTextView?) {
|
||||
GlobalScope.launch {
|
||||
val sb = StringBuilder()
|
||||
|
||||
val sslContext = SSLContext.getInstance("TLS")
|
||||
sslContext.init(null, null, SecureRandom())
|
||||
val factory: SSLSocketFactory = sslContext.socketFactory
|
||||
val socket = factory.createSocket() as SSLSocket
|
||||
|
||||
sb.append("\n")
|
||||
sb.append("Supported TLS protocols on this device:\n\n")
|
||||
socket.supportedProtocols.forEach { protocol ->
|
||||
sb.append("$protocol \n")
|
||||
}
|
||||
|
||||
sb.append("\n\n")
|
||||
|
||||
sb.append("Supported cipher suites on this device:\n\n")
|
||||
val allCipherSuites = factory.supportedCipherSuites
|
||||
allCipherSuites.forEach { cipherSuite ->
|
||||
sb.append("$cipherSuite \n")
|
||||
}
|
||||
|
||||
sb.append("\n")
|
||||
Handler(Looper.getMainLooper()).post{
|
||||
tlsInfo?.text = sb.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -82,13 +82,13 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="Öppenlab.net"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/default_margin_big"
|
||||
android:paddingBottom="@dimen/default_margin_big"
|
||||
android:textColor="@color/stroke"
|
||||
android:text="@string/home_icon_attribution" />
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="@dimen/default_margin"
|
||||
android:layout_marginBottom="@dimen/default_margin"
|
||||
android:alpha="0.5"
|
||||
android:background="?attr/colorOnSurface" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -105,9 +105,20 @@
|
|||
android:text="@string/gnu_link"/>
|
||||
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginBottom="@dimen/default_margin"
|
||||
android:layout_marginTop="@dimen/default_margin"
|
||||
android:alpha="0.5"
|
||||
android:background="?attr/colorOnSurface" />
|
||||
|
||||
|
||||
<!-- OppenLab -->
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tls_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textIsSelectable="true"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue