From f916057d3d53c05365cf201c54dff0a8c377aa17 Mon Sep 17 00:00:00 2001 From: Koda Tomomi Date: Tue, 10 Oct 2023 17:05:42 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E3=83=AD=E3=82=B0=E3=82=A2=E3=82=A6?= =?UTF-8?q?=E3=83=88=E5=BE=8C=E9=80=9A=E7=9F=A5=E3=82=92=E5=8F=97=E3=81=91?= =?UTF-8?q?=E5=8F=96=E3=82=8B=E3=81=9F=E3=82=81=E3=81=AE=E9=96=A2=E6=95=B0?= =?UTF-8?q?=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/documentweb/DocumentWebFragment.kt | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) 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 ca0afce9..9b9cdf5f 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 @@ -19,13 +19,11 @@ import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.lifecycleScope +import com.google.firebase.messaging.FirebaseMessaging 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.ServerRepository -import jp.atled.agileworks.model.SessionRepository +import jp.atled.agileworks.model.* import jp.atled.agileworks.view.base.BaseViewModel import kotlinx.android.synthetic.main.fragment_webview_detail.* import kotlinx.coroutines.flow.collect @@ -606,6 +604,27 @@ class DocumentWebFragment : Fragment(), DocumentWebPresenter { } } } + + //getNotification() + } + + //通知再設定 + private fun getNotification() { + FirebaseMessaging.getInstance().token.addOnCompleteListener { task -> + if (task.isSuccessful) { + task.result?.apply { + NotificationRepository().setToken(requireActivity(), task.result!!) + } + } else { + Log.w(TAG, "getInstanceId failed", task.exception) + } + FcmRepository().getFcmToken { _, token -> + if (token != null) { + DeviceInfoRepository().loadOrCreateDeviceId(this.requireActivity(), token) { _, deviceId -> + } + } + } + } } companion object { -- GitLab From 094f5e0befe791e46815bedd3e8ead6cf869d72d Mon Sep 17 00:00:00 2001 From: Gk40002148 Date: Fri, 13 Oct 2023 21:20:32 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=E3=83=AD=E3=82=B0=E3=82=A2=E3=82=A6?= =?UTF-8?q?=E3=83=88=E6=99=82=E3=81=AEFcmToken=20=E3=81=AE=20remove=20?= =?UTF-8?q?=E5=87=A6=E7=90=86=E3=82=92=E5=85=A8=E3=82=B5=E3=83=BC=E3=83=90?= =?UTF-8?q?=E3=83=AD=E3=82=B0=E3=82=A2=E3=82=A6=E3=83=88=E6=99=82=E3=81=AB?= =?UTF-8?q?=E3=81=AE=E3=81=BF=E5=AE=9F=E6=96=BD=E3=81=99=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3=20=E2=80=BB=E4=B8=8D?= =?UTF-8?q?=E8=A6=81=E3=81=A8=E3=81=AA=E3=81=A3=E3=81=9F=20DocumentWebFrag?= =?UTF-8?q?ment=20=E3=81=AE=E5=87=A6=E7=90=86=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/NotificationRepository.kt | 10 +++++++++ .../ui/documentweb/DocumentWebFragment.kt | 22 ------------------- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/app/src/main/java/jp/atled/agileworks/model/NotificationRepository.kt b/app/src/main/java/jp/atled/agileworks/model/NotificationRepository.kt index 045df278..05d937f1 100644 --- a/app/src/main/java/jp/atled/agileworks/model/NotificationRepository.kt +++ b/app/src/main/java/jp/atled/agileworks/model/NotificationRepository.kt @@ -40,10 +40,20 @@ class NotificationRepository(_serverNumber: Int? = null) { Log.d("AgileWorks", "firebase token clean") ApiClient.reCreateLogout() LogoutRepository.getInstance().getLogout { + /* FcmRepository().removeFcmToken { Log.d("AgileWorks", "firebase token clean -> ${successOrFailured(it)}") onResult(it) } + */ + // 全サーバログアウト状態で FcmToken の削除 + val serverList = ServerRepository().loadServerList() + if (serverList.isEmpty()) { + FcmRepository().removeFcmToken { + Log.d("AgileWorks", "firebase token clean -> ${successOrFailured(it)}") + } + } + onResult(it) } } 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 9b9cdf5f..d63b8423 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 @@ -19,7 +19,6 @@ import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.lifecycleScope -import com.google.firebase.messaging.FirebaseMessaging import jp.atled.agileworks.R import jp.atled.agileworks.AwApp import jp.atled.agileworks.databinding.FragmentWebviewDetailBinding @@ -604,27 +603,6 @@ class DocumentWebFragment : Fragment(), DocumentWebPresenter { } } } - - //getNotification() - } - - //通知再設定 - private fun getNotification() { - FirebaseMessaging.getInstance().token.addOnCompleteListener { task -> - if (task.isSuccessful) { - task.result?.apply { - NotificationRepository().setToken(requireActivity(), task.result!!) - } - } else { - Log.w(TAG, "getInstanceId failed", task.exception) - } - FcmRepository().getFcmToken { _, token -> - if (token != null) { - DeviceInfoRepository().loadOrCreateDeviceId(this.requireActivity(), token) { _, deviceId -> - } - } - } - } } companion object { -- GitLab