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

Merge branch 'develop'

parents 44031d09 d6f5de32
......@@ -15,8 +15,8 @@ android {
minSdkVersion 19
targetSdkVersion 28
versionName "1.2.0"
versionCode 7
versionName "1.2.1"
versionCode 8
buildConfigField "String", "VERSION_UID", '"' + getBuildUid() + '"'
buildConfigField "String", "APP_DESCRIPTION", '"Gitfox is an Android client for Gitlab."'
......
......@@ -24,6 +24,7 @@ class App : Application() {
override fun onCreate() {
super.onCreate()
appHashCode = hashCode()
initLogger()
initFabric()
......@@ -82,4 +83,9 @@ class App : Application() {
private fun initThreetenABP() {
AndroidThreeTen.init(this)
}
companion object {
var appHashCode = -1
private set
}
}
\ No newline at end of file
......@@ -27,7 +27,7 @@ class AuthFlowFragment : FlowFragment(), MvpView {
.getInstance(AuthFlowPresenter::class.java)
override fun onCreate(savedInstanceState: Bundle?) {
prepareScope(savedInstanceState == null)
prepareScope(isFirstLaunch(savedInstanceState))
super.onCreate(savedInstanceState)
if (childFragmentManager.fragments.isEmpty()) {
navigator.setLaunchScreen(Screens.Auth)
......
......@@ -64,7 +64,7 @@ class AuthFragment : BaseFragment(), AuthView, CustomServerAuthFragment.OnClickL
userAgentString = BuildConfig.WEB_AUTH_USER_AGENT
}
webView.setWebViewClient(object : WebViewClient() {
webView.webViewClient = object : WebViewClient() {
override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
showProgressDialog(true)
......@@ -94,7 +94,7 @@ class AuthFragment : BaseFragment(), AuthView, CustomServerAuthFragment.OnClickL
super.onReceivedError(view, request, error)
showEmptyView(true)
}
})
}
zeroViewHolder = ZeroViewHolder(zeroLayout, { presenter.refresh() })
}
......@@ -104,6 +104,21 @@ class AuthFragment : BaseFragment(), AuthView, CustomServerAuthFragment.OnClickL
webView.visible(!show)
}
override fun onResume() {
super.onResume()
webView.onResume()
}
override fun onPause() {
super.onPause()
webView.onPause()
}
override fun onDestroyView() {
webView.destroy()
super.onDestroyView()
}
override fun loadUrl(url: String) {
webView.loadUrl(url)
}
......
......@@ -82,7 +82,7 @@ class DrawerFlowFragment : BaseFragment(), MvpView {
}
override fun onCreate(savedInstanceState: Bundle?) {
prepareScope(savedInstanceState == null)
prepareScope(isFirstLaunch(savedInstanceState))
super.onCreate(savedInstanceState)
if (childFragmentManager.fragments.isEmpty()) {
......
......@@ -5,8 +5,10 @@ import android.os.Handler
import android.view.LayoutInflater
import android.view.ViewGroup
import com.arellomobile.mvp.MvpAppCompatFragment
import ru.terrakok.gitlabclient.App
private const val PROGRESS_TAG = "bf_progress"
private const val STATE_LAUNCH_FLAG = "state_launch_flag"
/**
* @author Konstantin Tskhovrebov (aka terrakok) on 26.03.17.
......@@ -39,6 +41,7 @@ abstract class BaseFragment : MvpAppCompatFragment() {
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
outState.putInt(STATE_LAUNCH_FLAG, App.appHashCode)
instanceStateSaved = true
}
......@@ -55,5 +58,10 @@ abstract class BaseFragment : MvpAppCompatFragment() {
}
}
protected fun isFirstLaunch(savedInstanceState: Bundle?): Boolean {
val savedAppHashCode = savedInstanceState?.getInt(STATE_LAUNCH_FLAG) ?: -1
return savedAppHashCode != App.appHashCode
}
open fun onBackPressed() {}
}
\ No newline at end of file
......@@ -36,7 +36,7 @@ class IssueFlowFragment : FlowFragment(), MvpView {
.getInstance(IssueFlowPresenter::class.java)
override fun onCreate(savedInstanceState: Bundle?) {
prepareScope(savedInstanceState == null)
prepareScope(isFirstLaunch(savedInstanceState))
super.onCreate(savedInstanceState)
if (childFragmentManager.fragments.isEmpty()) {
navigator.setLaunchScreen(Screens.Issue)
......
......@@ -35,7 +35,7 @@ class MergeRequestFlowFragment : FlowFragment(), MvpView {
.getInstance(MergeRequestFlowPresenter::class.java)
override fun onCreate(savedInstanceState: Bundle?) {
prepareScope(savedInstanceState == null)
prepareScope(isFirstLaunch(savedInstanceState))
super.onCreate(savedInstanceState)
if (childFragmentManager.fragments.isEmpty()) {
navigator.setLaunchScreen(Screens.MergeRequest)
......
......@@ -31,6 +31,21 @@ class PrivacyPolicyFragment : BaseFragment() {
webView.loadUrl("https://gitlab.com/terrakok/gitlab-client/raw/develop/PrivacyPolicy.txt")
}
override fun onResume() {
super.onResume()
webView.onResume()
}
override fun onPause() {
super.onPause()
webView.onPause()
}
override fun onDestroyView() {
webView.destroy()
super.onDestroyView()
}
override fun onBackPressed() {
super.onBackPressed()
router.exit()
......
......@@ -29,7 +29,7 @@ class ProjectFlowFragment : FlowFragment(), MvpView {
var scopeName = arguments?.getString(ARG_SCOPE_NAME)
if (scopeName == null) {
scopeName = this@ProjectFlowFragment.objectScopeName()
arguments?.putString(ARG_SCOPE_NAME, scopeName)
arguments = (arguments ?: Bundle()).apply { putString(ARG_SCOPE_NAME, scopeName) }
}
return scopeName
}
......@@ -43,7 +43,7 @@ class ProjectFlowFragment : FlowFragment(), MvpView {
.getInstance(ProjectFlowPresenter::class.java)
override fun onCreate(savedInstanceState: Bundle?) {
prepareScope(savedInstanceState == null)
prepareScope(isFirstLaunch(savedInstanceState))
super.onCreate(savedInstanceState)
if (childFragmentManager.fragments.isEmpty()) {
navigator.setLaunchScreen(Screens.ProjectMainFlow(scopeName))
......
......@@ -33,7 +33,7 @@ class UserFlowFragment : FlowFragment(), MvpView {
.getInstance(UserFlowPresenter::class.java)
override fun onCreate(savedInstanceState: Bundle?) {
prepareScope(savedInstanceState == null)
prepareScope(isFirstLaunch(savedInstanceState))
super.onCreate(savedInstanceState)
if (childFragmentManager.fragments.isEmpty()) {
navigator.setLaunchScreen(Screens.UserInfo)
......
......@@ -7,7 +7,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0-alpha01'
classpath 'com.android.tools.build:gradle:3.4.0-alpha02'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath 'com.google.gms:google-services:4.0.1'
classpath 'io.fabric.tools:gradle:1.25.4'
......
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