From 64f5857aeaa3760564c64ef465293cbb6aa17275 Mon Sep 17 00:00:00 2001 From: S-6203-ATLED Date: Fri, 8 Jul 2022 10:12:26 +0900 Subject: [PATCH 1/2] =?UTF-8?q?#59=20=E3=82=A6=E3=82=A3=E3=82=B8=E3=82=A7?= =?UTF-8?q?=E3=83=83=E3=83=88=E3=82=BF=E3=83=83=E3=83=97=E6=99=82=E3=81=AE?= =?UTF-8?q?=E5=88=9D=E6=9C=9F=E3=82=BF=E3=83=96=E9=81=B8=E6=8A=9E=E3=82=92?= =?UTF-8?q?=E4=BB=95=E4=BA=8B=E3=82=BF=E3=83=96=E3=81=B8=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E3=80=81=E4=B8=8D=E8=A6=81=E3=81=AAimport=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../atled/agileworks/model/AppRepository.kt | 10 +++++++++ .../atled/agileworks/view/ui/MainActivity.kt | 21 +++++-------------- .../ui/documentweb/DocumentWebFragment.kt | 16 ++++++++++---- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/jp/atled/agileworks/model/AppRepository.kt b/app/src/main/java/jp/atled/agileworks/model/AppRepository.kt index 87de81df..b89bed84 100644 --- a/app/src/main/java/jp/atled/agileworks/model/AppRepository.kt +++ b/app/src/main/java/jp/atled/agileworks/model/AppRepository.kt @@ -9,9 +9,19 @@ class AppRepository { appBackGroundStatus = status } + fun getApprovalUrl(): String? { + return approvalUrl + } + + fun setApprovalUrl(url: String?) { + approvalUrl = url + } + companion object { fun getInstance() = AppRepository() // アプリがバックグラウンドか private var appBackGroundStatus = false + // ウィジェットタップ時のURL保持 + private var approvalUrl: String? = null } } \ No newline at end of file diff --git a/app/src/main/java/jp/atled/agileworks/view/ui/MainActivity.kt b/app/src/main/java/jp/atled/agileworks/view/ui/MainActivity.kt index f365be26..6c5399cd 100644 --- a/app/src/main/java/jp/atled/agileworks/view/ui/MainActivity.kt +++ b/app/src/main/java/jp/atled/agileworks/view/ui/MainActivity.kt @@ -8,13 +8,11 @@ import android.content.res.Configuration import android.os.Build import android.os.Bundle import android.util.Log -import android.widget.TextView import androidx.activity.viewModels import androidx.annotation.RequiresApi import androidx.annotation.StringRes import androidx.appcompat.app.ActionBar import androidx.core.app.NotificationManagerCompat -import androidx.fragment.app.Fragment import androidx.lifecycle.LiveData import androidx.lifecycle.Observer import androidx.navigation.NavController @@ -24,16 +22,12 @@ import androidx.navigation.ui.setupActionBarWithNavController import com.google.android.material.bottomnavigation.BottomNavigationView import jp.atled.agileworks.BuildConfig import jp.atled.agileworks.R -import jp.atled.agileworks.common.util.toFormattedString -import jp.atled.agileworks.model.DeviceInfoRepository -import jp.atled.agileworks.model.FcmRepository +import jp.atled.agileworks.model.AppRepository import jp.atled.agileworks.view.base.BaseActivity import jp.atled.agileworks.view.base.BaseViewModel -import jp.atled.agileworks.view.ui.documentweb.DocumentWebFragment import jp.atled.agileworks.view.ui.login.LoginUtil import jp.atled.agileworks.view.utils.putNonNullStingFromExtra import kotlinx.android.synthetic.main.activity_main.* -import java.util.* class MainActivity : BaseActivity() { private val TAG = "MainActivity" @@ -68,15 +62,10 @@ class MainActivity : BaseActivity() { // ウィジェットタップ時の情報伝達 val deepApproveUrl = intent.getStringExtra(APPROVAL_DEEPLINK_URL_KEY) if (!deepApproveUrl.isNullOrEmpty()) { - intent.putExtra("url", deepApproveUrl) - - val approvalFragment = DocumentWebFragment() - approvalFragment.arguments = intent.extras - - supportFragmentManager.beginTransaction() - .addToBackStack(null) - .replace(R.id.main_nav_fragment, approvalFragment) - .commit() + // タブ切り替え + findViewById(R.id.bottom_navigation_bar).selectedItemId = R.id.workListNavigation + // URL保持 + AppRepository.getInstance().setApprovalUrl(deepApproveUrl) } } diff --git a/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebFragment.kt b/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebFragment.kt index ff55f815..d999823f 100644 --- a/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebFragment.kt +++ b/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebFragment.kt @@ -21,6 +21,7 @@ import androidx.lifecycle.lifecycleScope import jp.atled.agileworks.R import jp.atled.agileworks.AwApp import jp.atled.agileworks.databinding.FragmentWebviewDetailBinding +import jp.atled.agileworks.model.AppRepository import jp.atled.agileworks.model.LoginRepository import jp.atled.agileworks.model.SessionRepository import jp.atled.agileworks.view.base.BaseViewModel @@ -41,6 +42,7 @@ class DocumentWebFragment : Fragment(), DocumentWebPresenter { private var webview: WebView? = null private var lastUrl: String? = null private var connectUrl: String? = null + private var holdUrl: String? = null private var getUrl: String? = null // webViewからのアラート表示用変数 private var dialog: AlertDialog? = null @@ -65,14 +67,13 @@ class DocumentWebFragment : Fragment(), DocumentWebPresenter { webview?.let { getUrl = it.getUrl() } - if(getUrl != connectUrl){ - applyCookieManager(connectUrl, true) + if(getUrl != holdUrl){ + applyCookieManager(holdUrl, true) } } } return viewDataBinding.root } - @SuppressLint("ClickableViewAccessibility") override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -82,6 +83,13 @@ class DocumentWebFragment : Fragment(), DocumentWebPresenter { if (!connectUrl!!.contains(AwApp.Baseurl())) { connectUrl = AwApp.Baseurl() + connectUrl } + holdUrl = connectUrl + if (connectUrl!!.endsWith("#work")) { + AppRepository.getInstance().getApprovalUrl()?.let { + connectUrl = it + AppRepository.getInstance().setApprovalUrl(null) + } + } getSessionAndSetupWebView(view, connectUrl!!, lastUrl,true) } // セットワーク切断状態で、webview デフォルトページ表示時に透明view表示 @@ -116,6 +124,7 @@ class DocumentWebFragment : Fragment(), DocumentWebPresenter { } override fun onDestroyView() { + super.onDestroyView() webview?.let { it.parent?.apply { if (this is RelativeLayout) { @@ -123,7 +132,6 @@ class DocumentWebFragment : Fragment(), DocumentWebPresenter { } } } - super.onDestroyView() } override fun onResume() { -- GitLab From 666efe2d619dd48a9f0fabe60c943a4f7ee6d9d0 Mon Sep 17 00:00:00 2001 From: S-6203-ATLED Date: Fri, 8 Jul 2022 17:56:54 +0900 Subject: [PATCH 2/2] =?UTF-8?q?#59=20=E3=82=A6=E3=82=A3=E3=82=B8=E3=82=A7?= =?UTF-8?q?=E3=83=83=E3=83=88=E3=81=8B=E3=82=89=E3=81=AE=E8=B5=B7=E5=8B=95?= =?UTF-8?q?=E6=99=82=E3=80=81=E5=88=9D=E6=9C=9F=E3=82=BF=E3=83=96=E3=82=92?= =?UTF-8?q?=E4=BB=95=E4=BA=8B=E3=82=BF=E3=83=96=E3=81=AB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../atled/agileworks/view/ui/documentweb/DocumentWebFragment.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebFragment.kt b/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebFragment.kt index d999823f..63498022 100644 --- a/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebFragment.kt +++ b/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebFragment.kt @@ -124,7 +124,6 @@ class DocumentWebFragment : Fragment(), DocumentWebPresenter { } override fun onDestroyView() { - super.onDestroyView() webview?.let { it.parent?.apply { if (this is RelativeLayout) { @@ -132,6 +131,7 @@ class DocumentWebFragment : Fragment(), DocumentWebPresenter { } } } + super.onDestroyView() } override fun onResume() { -- GitLab