Commit a19b00ec authored by Konstantin Tskhovrebov's avatar Konstantin Tskhovrebov 🤖

Merge branch 'develop'

parents 3b2c5631 0295bd86
......@@ -15,8 +15,8 @@ android {
minSdkVersion 19
targetSdkVersion 28
versionName "1.3.1"
versionCode 10
versionName "1.3.2"
versionCode 11
buildConfigField "String", "VERSION_UID", '"' + getBuildUid() + '"'
buildConfigField "String", "APP_DESCRIPTION", '"Gitfox is an Android client for Gitlab."'
......
......@@ -16,6 +16,7 @@ import toothpick.Toothpick
import toothpick.configuration.Configuration
import toothpick.registries.FactoryRegistryLocator
import toothpick.registries.MemberInjectorRegistryLocator
import java.util.*
/**
* @author Konstantin Tskhovrebov (aka terrakok) on 26.03.17.
......@@ -24,7 +25,7 @@ class App : Application() {
override fun onCreate() {
super.onCreate()
appHashCode = hashCode()
appCode = UUID.randomUUID().toString()
initLogger()
initFabric()
......@@ -85,7 +86,7 @@ class App : Application() {
}
companion object {
var appHashCode = -1
lateinit var appCode: String
private set
}
}
\ No newline at end of file
......@@ -68,11 +68,8 @@ class AuthInteractor(
fun login(customServerPath: String, privateToken: String) =
Completable.fromAction {
var serverPath = customServerPath
if (!customServerPath.endsWith("/")) serverPath += "/"
authRepository.saveAuthData(privateToken, serverPath, false)
switchServerIfNeeded(serverPath)
authRepository.saveAuthData(privateToken, customServerPath, false)
switchServerIfNeeded(customServerPath)
}
fun logout() {
......
......@@ -7,9 +7,9 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.inputmethod.EditorInfo
import android.webkit.URLUtil
import android.widget.Toast
import kotlinx.android.synthetic.main.fragment_custom_server_auth.*
import okhttp3.HttpUrl
import ru.terrakok.gitlabclient.BuildConfig
import ru.terrakok.gitlabclient.R
......@@ -50,7 +50,9 @@ class CustomServerAuthFragment : BottomSheetDialogFragment() {
}
private fun login() {
val url = serverPathValue.text.toString()
val url = serverPathValue.text.toString().let {
if (it.endsWith("/")) it else it.plus("/")
}
val token = privateTokenValue.text.toString()
if (token.isEmpty()) {
......@@ -58,7 +60,7 @@ class CustomServerAuthFragment : BottomSheetDialogFragment() {
return
}
if (URLUtil.isValidUrl(url)) {
if (HttpUrl.parse(url) != null) {
listener.customLogin.invoke(url, token)
dismiss()
} else {
......
......@@ -41,7 +41,7 @@ abstract class BaseFragment : MvpAppCompatFragment() {
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
outState.putInt(STATE_LAUNCH_FLAG, App.appHashCode)
outState.putString(STATE_LAUNCH_FLAG, App.appCode)
instanceStateSaved = true
}
......@@ -59,8 +59,8 @@ abstract class BaseFragment : MvpAppCompatFragment() {
}
protected fun isFirstLaunch(savedInstanceState: Bundle?): Boolean {
val savedAppHashCode = savedInstanceState?.getInt(STATE_LAUNCH_FLAG) ?: -1
return savedAppHashCode != App.appHashCode
val savedAppCode = savedInstanceState?.getString(STATE_LAUNCH_FLAG)
return savedAppCode != App.appCode
}
open fun onBackPressed() {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment