diff --git a/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebClient.kt b/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebClient.kt index 3e3ad9d23140922d07beeff5bbaa25f442721674..14e8418868eea9fee3453db04dc09b708d1f06fe 100644 --- a/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebClient.kt +++ b/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebClient.kt @@ -26,12 +26,6 @@ class DocumentWebViewClient(private val webShare: DocumentWebShare): WebViewClie override fun onPageFinished(view: WebView?, url: String?) { super.onPageFinished(view, url) webShare.presenter.hideLoadingProgressBar() - if ((view != null) && (url != null) && FORM_URL_PATTERN.containsMatchIn(url)) { - webShare.history.putHistoryIndex(view.copyBackForwardList().currentIndex) - webShare.inDocumentView = true - } else { - webShare.inDocumentView = false - } webShare.presenter.updateAutoReloadState(false) } @@ -82,9 +76,6 @@ class DocumentWebViewClient(private val webShare: DocumentWebShare): WebViewClie // ネットワーク切断時Viewを表示する必要があるか設定する(URL変更時) url?.let { webShare.presenter.updateDisconnectViewDisplayState(it) } } - companion object { - private val FORM_URL_PATTERN = Regex("/xpoint/form\\.do\\b") - } } /** diff --git a/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebDownload.kt b/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebDownload.kt index 630466cbab8d33b628398833b7c8768380926f8c..63f4605d45114b0ef3761b893df502e5fa13d75b 100644 --- a/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebDownload.kt +++ b/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebDownload.kt @@ -195,12 +195,17 @@ class DocumentWebDownloader(private val handlingFragment: Fragment, private val */ private fun openDownloadConnection(urlString: String, sessionId: String): URLConnection { val url = URL(urlString) + val urlPath = listOf("/Broker/Download","/Broker/WebForm") return url.openConnection().also { if (it is HttpURLConnection) { val serverHost = LoginRepository().loadServerUrl() // セッション情報を外に漏らさないよう、 url のホストとパスを確認。 - if ((url.host == serverHost) && url.path.contains("/Broker/Download")) { - it.setRequestProperty("Cookie", "JSESSIONID=$sessionId") + if (url.host == serverHost) { + urlPath.forEach { p -> + if (url.path.contains(p)){ + it.setRequestProperty("Cookie", "JSESSIONID=$sessionId") + } + } } } if (it is HttpsURLConnection) { @@ -246,7 +251,13 @@ object DownloadHelper { .toMap() val fileNameStar = params["filename"]?.let { tryParseFileNameStar(it) } return if (fileNameStar.isNullOrEmpty()) { - params["filename"]?.let { decodeBase64(it) } + params["filename"]?.let { + if (it.startsWith("\"=?UTF-8?B?")){ + decodeBase64(it) + } else { + it + } + } } else { fileNameStar } diff --git a/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebShare.kt b/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebShare.kt index c92bc7c5da95fd73f7bc72826c8541fef511ae56..3f306ac366e9d824e4413c93ec14059962fa63ae 100644 --- a/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebShare.kt +++ b/app/src/main/java/jp/atled/agileworks/view/ui/documentweb/DocumentWebShare.kt @@ -6,36 +6,5 @@ package jp.atled.agileworks.view.ui.documentweb * @param presenter 各種表示を担当するインスタンス * @param downloader ファイルのダウンロードを担当するインスタンス */ -class DocumentWebShare(val presenter: DocumentWebPresenter, val downloader: DocumentWebDownloader) { - /** 今見ているページは書類ビューか */ - var inDocumentView = false - /** 履歴インデックス管理 */ - val history = DocumentWebHistory() -} +class DocumentWebShare(val presenter: DocumentWebPresenter, val downloader: DocumentWebDownloader) -/** - * 関連書類などから前のページに戻れるように履歴のインデックスを管理するクラス。 - */ -class DocumentWebHistory { - // 次に詰まれたインデックスを新しい履歴用インデックスとして管理するか。 - // false の場合、indexStack に必ずひとつ以上の要素がなければならない。 - private var waitingNewPage = true - // 履歴インデックス (WebBackForwardList から得られるインデックス) のスタック。各要素が戻るべきインデックス。 - private val indexStack = mutableListOf() - - /** - * 指定されたインデックスを戻るべきインデックスとして設定する。 - * - * 新規ページを待っている場合は新しい要素としてそのインデックスを積み、そうでなければ最新の要素を上書きする。 - * - * @param index 新たに設定するインデックス - */ - fun putHistoryIndex(index: Int) { - if (waitingNewPage) { - indexStack.add(index) - waitingNewPage = false - } else { - indexStack[indexStack.lastIndex] = index - } - } -}