From 2caab8f5f186de8be4af64614f0e695eb9d8ea40 Mon Sep 17 00:00:00 2001 From: Yoan Pintas Date: Thu, 21 Dec 2023 16:14:43 +0100 Subject: [PATCH 1/4] Fix crash on happy holidays button (#1000) --- towncrier.toml | 2 +- vector-app/build.gradle | 2 +- .../settings/VectorSettingsActivity.kt | 36 +++++++++++++++++++ .../settings/VectorSettingsRootFragment.kt | 16 ++++++++- 4 files changed, 53 insertions(+), 3 deletions(-) diff --git a/towncrier.toml b/towncrier.toml index aeae552313..55e99ce1c9 100644 --- a/towncrier.toml +++ b/towncrier.toml @@ -1,5 +1,5 @@ [tool.towncrier] - version = "2.9.7" + version = "2.9.8" directory = "changelog.d" filename = "TCHAP_CHANGES.md" name = "Changes in Tchap" diff --git a/vector-app/build.gradle b/vector-app/build.gradle index 348d910f02..f07102f6d7 100644 --- a/vector-app/build.gradle +++ b/vector-app/build.gradle @@ -37,7 +37,7 @@ ext.versionMinor = 9 // Note: even values are reserved for regular release, odd values for hotfix release. // When creating a hotfix, you should decrease the value, since the current value // is the value for the next regular release. -ext.versionPatch = 7 +ext.versionPatch = 8 static def getGitTimestamp() { def cmd = 'git show -s --format=%ct' diff --git a/vector/src/main/java/im/vector/app/features/settings/VectorSettingsActivity.kt b/vector/src/main/java/im/vector/app/features/settings/VectorSettingsActivity.kt index 33557fabef..0435ee20bc 100755 --- a/vector/src/main/java/im/vector/app/features/settings/VectorSettingsActivity.kt +++ b/vector/src/main/java/im/vector/app/features/settings/VectorSettingsActivity.kt @@ -29,7 +29,10 @@ import im.vector.app.R import im.vector.app.core.extensions.replaceFragment import im.vector.app.core.platform.VectorBaseActivity import im.vector.app.databinding.ActivityVectorSettingsBinding +import im.vector.app.features.analytics.plan.ViewRoom import im.vector.app.features.discovery.DiscoverySettingsFragment +import im.vector.app.features.matrixto.MatrixToBottomSheet +import im.vector.app.features.navigation.Navigator import im.vector.app.features.navigation.SettingsActivityPayload import im.vector.app.features.settings.devices.VectorSettingsDevicesFragment import im.vector.app.features.settings.notifications.VectorSettingsNotificationFragment @@ -48,9 +51,33 @@ private const val KEY_ACTIVITY_PAYLOAD = "settings-activity-payload" @AndroidEntryPoint class VectorSettingsActivity : VectorBaseActivity(), PreferenceFragmentCompat.OnPreferenceStartFragmentCallback, + MatrixToBottomSheet.InteractionListener, FragmentManager.OnBackStackChangedListener, VectorSettingsFragmentInteractionListener { + // Tchap: Manage Christmas entry + private val fragmentLifecycleCallbacks = object : FragmentManager.FragmentLifecycleCallbacks() { + override fun onFragmentResumed(fm: FragmentManager, f: Fragment) { + if (f is MatrixToBottomSheet) { + f.interactionListener = this@VectorSettingsActivity + } + super.onFragmentResumed(fm, f) + } + + override fun onFragmentPaused(fm: FragmentManager, f: Fragment) { + if (f is MatrixToBottomSheet) { + f.interactionListener = null + } + super.onFragmentPaused(fm, f) + } + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + supportFragmentManager.registerFragmentLifecycleCallbacks(fragmentLifecycleCallbacks, false) + } + override fun getBinding() = ActivityVectorSettingsBinding.inflate(layoutInflater) override fun getCoordinatorLayout() = views.coordinatorLayout @@ -106,6 +133,7 @@ class VectorSettingsActivity : VectorBaseActivity } override fun onDestroy() { + supportFragmentManager.unregisterFragmentLifecycleCallbacks(fragmentLifecycleCallbacks) supportFragmentManager.removeOnBackStackChangedListener(this) super.onDestroy() } @@ -161,6 +189,14 @@ class VectorSettingsActivity : VectorBaseActivity } } + // Tchap: Manage Christmas entry + override fun mxToBottomSheetNavigateToRoom(roomId: String, trigger: ViewRoom.Trigger?) { + navigator.openRoom(this, roomId, trigger = trigger) + } + override fun mxToBottomSheetSwitchToSpace(spaceId: String) { + navigator.switchToSpace(this, spaceId, Navigator.PostSwitchSpaceAction.None) + } + fun navigateTo(fragmentClass: Class, arguments: Bundle? = null) { supportFragmentManager.beginTransaction() .setCustomAnimations(R.anim.right_in, R.anim.fade_out, R.anim.fade_in, R.anim.right_out) diff --git a/vector/src/main/java/im/vector/app/features/settings/VectorSettingsRootFragment.kt b/vector/src/main/java/im/vector/app/features/settings/VectorSettingsRootFragment.kt index be6a96cd8f..a51fd32672 100644 --- a/vector/src/main/java/im/vector/app/features/settings/VectorSettingsRootFragment.kt +++ b/vector/src/main/java/im/vector/app/features/settings/VectorSettingsRootFragment.kt @@ -26,7 +26,10 @@ import im.vector.app.core.preference.VectorPreference import im.vector.app.core.utils.FirstThrottler import im.vector.app.core.utils.openUrlInChromeCustomTab import im.vector.app.features.analytics.plan.MobileScreen +import im.vector.app.features.matrixto.OriginOfMatrixTo import im.vector.app.features.navigation.Navigator +import org.matrix.android.sdk.api.session.getRoomSummary +import org.matrix.android.sdk.api.session.room.model.Membership import java.util.Calendar @AndroidEntryPoint @@ -69,7 +72,18 @@ class VectorSettingsRootFragment : it.isVisible = true it.onPreferenceClickListener = Preference.OnPreferenceClickListener { if (firstThrottler.canHandle() is FirstThrottler.CanHandlerResult.Yes) { - navigator.openRoom(requireContext(), "!cDKdQyXHeWBEaKDWWV:agent.dinum.tchap.gouv.fr", null) + val roomAlias = "#JoyeusesFtesdelapartdelquipeTchapGl2gFYK2OD:agent.dinum.tchap.gouv.fr" + val eventId = "\$xW9f1eJGxQ1xstdPCVReUKQO_sFU4242SfaMIfNh3NU" + + session.getRoomSummary(roomAlias).let { roomSummary -> + if (roomSummary?.membership == Membership.JOIN) { + navigator.openRoom(requireContext(), roomSummary.roomId) + } else { + session.permalinkService().createPermalink(roomAlias, eventId).let { link -> + navigator.openMatrixToBottomSheet(requireActivity(), link, OriginOfMatrixTo.LINK) + } + } + } } false } From 8f991ba58912a4e8b465526526d7f98d52c2bc72 Mon Sep 17 00:00:00 2001 From: Yoan Pintas Date: Fri, 22 Dec 2023 21:05:56 +0100 Subject: [PATCH 2/4] Improve on-screen keyboard interaction when logging in (#1002) --- changelog.d/948.improvements | 1 + .../app/features/onboarding/ftueauth/FtueAuthLoginFragment.kt | 1 + 2 files changed, 2 insertions(+) create mode 100644 changelog.d/948.improvements diff --git a/changelog.d/948.improvements b/changelog.d/948.improvements new file mode 100644 index 0000000000..a9bf021568 --- /dev/null +++ b/changelog.d/948.improvements @@ -0,0 +1 @@ +Improve on-screen keyboard interaction when logging in. diff --git a/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthLoginFragment.kt b/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthLoginFragment.kt index 83b552f2f1..0dc7a777b2 100644 --- a/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthLoginFragment.kt +++ b/vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthLoginFragment.kt @@ -350,6 +350,7 @@ class FtueAuthLoginFragment : views.loginFieldTil.isHelperTextEnabled = false views.passwordFieldTil.isHelperTextEnabled = false views.tchapPasswordConfirmationFieldTil.isVisible = false + views.passwordField.imeOptions = EditorInfo.IME_ACTION_DONE } } } From 3038619d75964706dec909763627283e35307197 Mon Sep 17 00:00:00 2001 From: Yoan Pintas Date: Fri, 22 Dec 2023 21:07:23 +0100 Subject: [PATCH 3/4] Disable domain limit (#1001) --- changelog.d/999.improvements | 1 + .../createroom/CreateRoomViewModel.kt | 21 +++++++------------ .../createroom/CreateRoomViewState.kt | 2 +- 3 files changed, 9 insertions(+), 15 deletions(-) create mode 100644 changelog.d/999.improvements diff --git a/changelog.d/999.improvements b/changelog.d/999.improvements new file mode 100644 index 0000000000..4a1026f690 --- /dev/null +++ b/changelog.d/999.improvements @@ -0,0 +1 @@ +Les forums sont fédérés par défaut à la création. \ No newline at end of file diff --git a/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateRoomViewModel.kt b/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateRoomViewModel.kt index 0d0aa4196b..2cb9151760 100644 --- a/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateRoomViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateRoomViewModel.kt @@ -224,20 +224,13 @@ class CreateRoomViewModel @AssistedInject constructor( } private fun setTchapRoomType(action: CreateRoomAction.SetTchapRoomType) = setState { - if (action.roomType == TchapRoomType.FORUM) { - val userHSDomain = TchapUtils.getHomeServerDisplayNameFromMXIdentifier(session.myUserId) - val isAgentServerDomain = userHSDomain.equals(AGENT_SERVER_DOMAIN, ignoreCase = true) - copy( - roomType = action.roomType, - disableFederation = !isAgentServerDomain, - isFederationSettingAvailable = !isAgentServerDomain - ) - } else { - copy( - roomType = action.roomType, - disableFederation = false - ) - } + val isFederationSettingAvailable = action.roomType == TchapRoomType.FORUM && + !TchapUtils.getHomeServerDisplayNameFromMXIdentifier(session.myUserId).equals(AGENT_SERVER_DOMAIN, ignoreCase = true) + copy( + roomType = action.roomType, + disableFederation = false, + isFederationSettingAvailable = isFederationSettingAvailable + ) } private fun setRoomAliasLocalPart(action: CreateRoomAction.SetRoomAliasLocalPart) { diff --git a/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateRoomViewState.kt b/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateRoomViewState.kt index 23441e0c90..99f10abdf0 100644 --- a/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateRoomViewState.kt +++ b/vector/src/main/java/im/vector/app/features/roomdirectory/createroom/CreateRoomViewState.kt @@ -34,7 +34,7 @@ data class CreateRoomViewState( val defaultEncrypted: Map = emptyMap(), val showAdvanced: Boolean = false, val disableFederation: Boolean = false, - val isFederationSettingAvailable: Boolean = true, + val isFederationSettingAvailable: Boolean = false, val homeServerName: String = "", val userDomain: String = "", val hsAdminHasDisabledE2E: Boolean = false, From 78d872282f095320f48a52757fd059ab535db70a Mon Sep 17 00:00:00 2001 From: yostyle Date: Fri, 22 Dec 2023 21:54:33 +0100 Subject: [PATCH 4/4] Update changelog --- TCHAP_CHANGES.md | 9 +++++++++ changelog.d/948.improvements | 1 - changelog.d/999.improvements | 1 - 3 files changed, 9 insertions(+), 2 deletions(-) delete mode 100644 changelog.d/948.improvements delete mode 100644 changelog.d/999.improvements diff --git a/TCHAP_CHANGES.md b/TCHAP_CHANGES.md index 5f85208059..b3f987dec3 100644 --- a/TCHAP_CHANGES.md +++ b/TCHAP_CHANGES.md @@ -1,3 +1,12 @@ +Changes in Tchap 2.9.8 (2023-12-22) +=================================== + +Improvements 🙌 +-------------- + - Improve on-screen keyboard interaction when logging in. ([#948](https://github.com/tchapgouv/tchap-android/issues/948)) + - Les forums sont fédérés par défaut à la création. ([#999](https://github.com/tchapgouv/tchap-android/issues/999)) + + Changes in Tchap 2.9.7 (2023-12-18) =================================== diff --git a/changelog.d/948.improvements b/changelog.d/948.improvements deleted file mode 100644 index a9bf021568..0000000000 --- a/changelog.d/948.improvements +++ /dev/null @@ -1 +0,0 @@ -Improve on-screen keyboard interaction when logging in. diff --git a/changelog.d/999.improvements b/changelog.d/999.improvements deleted file mode 100644 index 4a1026f690..0000000000 --- a/changelog.d/999.improvements +++ /dev/null @@ -1 +0,0 @@ -Les forums sont fédérés par défaut à la création. \ No newline at end of file