Browse Source

Do not transform URLs to HTTPS now that we support cleartext connections.

housekeeping/remove-warnings
Antoine POPINEAU 4 years ago
parent
commit
de0a494b43
No known key found for this signature in database
GPG Key ID: A78AC64694F84063
  1. 5
      app/src/main/java/com/github/apognu/otter/utils/Util.kt

5
app/src/main/java/com/github/apognu/otter/utils/Util.kt

@ -5,7 +5,6 @@ import android.widget.Toast
import com.google.android.exoplayer2.util.Log import com.google.android.exoplayer2.util.Log
import com.preference.PowerPreference import com.preference.PowerPreference
import java.net.URI import java.net.URI
import java.net.URL
fun Context?.toast(message: String, length: Int = Toast.LENGTH_SHORT) { fun Context?.toast(message: String, length: Int = Toast.LENGTH_SHORT) {
if (this != null) { if (this != null) {
@ -35,9 +34,7 @@ fun mustNormalizeUrl(rawUrl: String): String {
val fallbackHost = PowerPreference.getFileByName(AppContext.PREFS_CREDENTIALS).getString("hostname") val fallbackHost = PowerPreference.getFileByName(AppContext.PREFS_CREDENTIALS).getString("hostname")
val uri = URI(rawUrl).takeIf { it.host != null } ?: URI("$fallbackHost$rawUrl") val uri = URI(rawUrl).takeIf { it.host != null } ?: URI("$fallbackHost$rawUrl")
return uri.toURL().run { return uri.toString()
URL("https", host, file)
}.toString()
} }
fun toDurationString(duration: Long, showSeconds: Boolean = false): String { fun toDurationString(duration: Long, showSeconds: Boolean = false): String {

Loading…
Cancel
Save