Merge pull request #2063 from element-hq/feature/bma/hideRoomListMenu
Hide room list menu
This commit is contained in:
commit
215847d14c
30 changed files with 120 additions and 88 deletions
|
|
@ -14,9 +14,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.element.android.features.analytics.api
|
||||
package io.element.android.appconfig
|
||||
|
||||
object Config {
|
||||
object AnalyticsConfig {
|
||||
const val POLICY_LINK = "https://element.io/cookie-policy"
|
||||
}
|
||||
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.element.android.libraries.push.impl
|
||||
package io.element.android.appconfig
|
||||
|
||||
object NotificationConfig {
|
||||
// TODO EAx Implement and set to true at some point
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright (c) 2023 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.element.android.appconfig
|
||||
|
||||
object RoomListConfig {
|
||||
const val showInviteMenuItem = false
|
||||
const val showReportProblemMenuItem = false
|
||||
|
||||
const val hasDropdownMenu = showInviteMenuItem || showReportProblemMenuItem
|
||||
}
|
||||
1
changelog.d/2062.misc
Normal file
1
changelog.d/2062.misc
Normal file
|
|
@ -0,0 +1 @@
|
|||
Hide room list dropdown menu.
|
||||
|
|
@ -39,6 +39,7 @@ dependencies {
|
|||
implementation(projects.libraries.uiStrings)
|
||||
api(projects.features.analytics.api)
|
||||
api(projects.services.analytics.api)
|
||||
implementation(projects.appconfig)
|
||||
implementation(libs.androidx.datastore.preferences)
|
||||
implementation(libs.androidx.browser)
|
||||
ksp(libs.showkase.processor)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
package io.element.android.features.analytics.impl
|
||||
|
||||
import android.app.Activity
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
|
|
@ -27,7 +26,8 @@ import com.bumble.appyx.core.plugin.Plugin
|
|||
import dagger.assisted.Assisted
|
||||
import dagger.assisted.AssistedInject
|
||||
import io.element.android.anvilannotations.ContributesNode
|
||||
import io.element.android.features.analytics.api.Config
|
||||
import io.element.android.appconfig.AnalyticsConfig
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.androidutils.browser.openUrlInChromeCustomTab
|
||||
import io.element.android.libraries.di.AppScope
|
||||
|
||||
|
|
@ -39,13 +39,13 @@ class AnalyticsOptInNode @AssistedInject constructor(
|
|||
) : Node(buildContext, plugins = plugins) {
|
||||
|
||||
private fun onClickTerms(activity: Activity, darkTheme: Boolean) {
|
||||
activity.openUrlInChromeCustomTab(null, darkTheme, Config.POLICY_LINK)
|
||||
activity.openUrlInChromeCustomTab(null, darkTheme, AnalyticsConfig.POLICY_LINK)
|
||||
}
|
||||
|
||||
@Composable
|
||||
override fun View(modifier: Modifier) {
|
||||
val activity = LocalContext.current as Activity
|
||||
val isDark = MaterialTheme.colors.isLight.not()
|
||||
val isDark = ElementTheme.isLightTheme.not()
|
||||
val state = presenter.present()
|
||||
AnalyticsOptInView(
|
||||
state = state,
|
||||
|
|
|
|||
|
|
@ -40,10 +40,10 @@ import androidx.compose.ui.res.stringResource
|
|||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.appconfig.AnalyticsConfig
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.compound.tokens.generated.CompoundIcons
|
||||
import io.element.android.features.analytics.api.AnalyticsOptInEvents
|
||||
import io.element.android.features.analytics.api.Config
|
||||
import io.element.android.libraries.designsystem.atomic.molecules.ButtonColumnMolecule
|
||||
import io.element.android.libraries.designsystem.atomic.molecules.IconTitleSubtitleMolecule
|
||||
import io.element.android.libraries.designsystem.atomic.organisms.InfoListItem
|
||||
|
|
@ -119,7 +119,7 @@ private fun AnalyticsOptInHeader(
|
|||
color = Color.Unspecified,
|
||||
underline = false,
|
||||
bold = true,
|
||||
tagAndLink = LINK_TAG to Config.POLICY_LINK,
|
||||
tagAndLink = LINK_TAG to AnalyticsConfig.POLICY_LINK,
|
||||
)
|
||||
ClickableText(
|
||||
text = text,
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import com.squareup.anvil.annotations.ContributesBinding
|
||||
import io.element.android.appconfig.AnalyticsConfig
|
||||
import io.element.android.features.analytics.api.AnalyticsOptInEvents
|
||||
import io.element.android.features.analytics.api.Config
|
||||
import io.element.android.features.analytics.api.preferences.AnalyticsPreferencesPresenter
|
||||
import io.element.android.features.analytics.api.preferences.AnalyticsPreferencesState
|
||||
import io.element.android.libraries.core.meta.BuildMeta
|
||||
|
|
@ -52,7 +52,7 @@ class DefaultAnalyticsPreferencesPresenter @Inject constructor(
|
|||
return AnalyticsPreferencesState(
|
||||
applicationName = buildMeta.applicationName,
|
||||
isEnabled = isEnabled.value,
|
||||
policyUrl = Config.POLICY_LINK,
|
||||
policyUrl = AnalyticsConfig.POLICY_LINK,
|
||||
eventSink = ::handleEvents
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ anvil {
|
|||
dependencies {
|
||||
implementation(projects.anvilannotations)
|
||||
anvil(projects.anvilcodegen)
|
||||
implementation(projects.appconfig)
|
||||
implementation(projects.libraries.core)
|
||||
implementation(projects.libraries.androidutils)
|
||||
implementation(projects.libraries.architecture)
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ import androidx.compose.ui.res.stringResource
|
|||
import androidx.compose.ui.unit.DpOffset
|
||||
import androidx.compose.ui.unit.DpSize
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.appconfig.RoomListConfig
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.compound.tokens.generated.CompoundIcons
|
||||
import io.element.android.features.roomlist.impl.R
|
||||
|
|
@ -128,8 +129,6 @@ private fun DefaultRoomListTopBar(
|
|||
onMenuActionClicked: (RoomListMenuAction) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
var showMenu by remember { mutableStateOf(false) }
|
||||
|
||||
// We need this to manually clip the top app bar in preview mode
|
||||
val previewAppBarHeight = if (LocalInspectionMode.current) {
|
||||
112.dp.roundToPx()
|
||||
|
|
@ -222,46 +221,53 @@ private fun DefaultRoomListTopBar(
|
|||
contentDescription = stringResource(CommonStrings.action_search),
|
||||
)
|
||||
}
|
||||
IconButton(
|
||||
onClick = { showMenu = !showMenu }
|
||||
) {
|
||||
Icon(
|
||||
imageVector = CompoundIcons.OverflowVertical,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
DropdownMenu(
|
||||
expanded = showMenu,
|
||||
onDismissRequest = { showMenu = false }
|
||||
) {
|
||||
DropdownMenuItem(
|
||||
onClick = {
|
||||
showMenu = false
|
||||
onMenuActionClicked(RoomListMenuAction.InviteFriends)
|
||||
},
|
||||
text = { Text(stringResource(id = CommonStrings.action_invite)) },
|
||||
leadingIcon = {
|
||||
Icon(
|
||||
imageVector = CompoundIcons.ShareAndroid,
|
||||
tint = ElementTheme.materialColors.secondary,
|
||||
contentDescription = null,
|
||||
if (RoomListConfig.hasDropdownMenu) {
|
||||
var showMenu by remember { mutableStateOf(false) }
|
||||
IconButton(
|
||||
onClick = { showMenu = !showMenu }
|
||||
) {
|
||||
Icon(
|
||||
imageVector = CompoundIcons.OverflowVertical,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
DropdownMenu(
|
||||
expanded = showMenu,
|
||||
onDismissRequest = { showMenu = false }
|
||||
) {
|
||||
if (RoomListConfig.showInviteMenuItem) {
|
||||
DropdownMenuItem(
|
||||
onClick = {
|
||||
showMenu = false
|
||||
onMenuActionClicked(RoomListMenuAction.InviteFriends)
|
||||
},
|
||||
text = { Text(stringResource(id = CommonStrings.action_invite)) },
|
||||
leadingIcon = {
|
||||
Icon(
|
||||
imageVector = CompoundIcons.ShareAndroid,
|
||||
tint = ElementTheme.materialColors.secondary,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
DropdownMenuItem(
|
||||
onClick = {
|
||||
showMenu = false
|
||||
onMenuActionClicked(RoomListMenuAction.ReportBug)
|
||||
},
|
||||
text = { Text(stringResource(id = CommonStrings.common_report_a_problem)) },
|
||||
leadingIcon = {
|
||||
Icon(
|
||||
imageVector = CompoundIcons.ChatProblem,
|
||||
tint = ElementTheme.materialColors.secondary,
|
||||
contentDescription = null,
|
||||
if (RoomListConfig.showReportProblemMenuItem) {
|
||||
DropdownMenuItem(
|
||||
onClick = {
|
||||
showMenu = false
|
||||
onMenuActionClicked(RoomListMenuAction.ReportBug)
|
||||
},
|
||||
text = { Text(stringResource(id = CommonStrings.common_report_a_problem)) },
|
||||
leadingIcon = {
|
||||
Icon(
|
||||
imageVector = CompoundIcons.ChatProblem,
|
||||
tint = ElementTheme.materialColors.secondary,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
scrollBehavior = scrollBehavior,
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ import android.app.PendingIntent
|
|||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import androidx.core.app.NotificationCompat
|
||||
import io.element.android.appconfig.NotificationConfig
|
||||
import io.element.android.libraries.androidutils.uri.createIgnoredUri
|
||||
import io.element.android.libraries.di.ApplicationContext
|
||||
import io.element.android.libraries.push.impl.NotificationConfig
|
||||
import io.element.android.libraries.push.impl.R
|
||||
import io.element.android.libraries.push.impl.notifications.NotificationActionIds
|
||||
import io.element.android.libraries.push.impl.notifications.NotificationBroadcastReceiver
|
||||
|
|
|
|||
|
|
@ -22,12 +22,12 @@ import android.content.Intent
|
|||
import android.os.Build
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.app.RemoteInput
|
||||
import io.element.android.appconfig.NotificationConfig
|
||||
import io.element.android.libraries.androidutils.uri.createIgnoredUri
|
||||
import io.element.android.libraries.di.ApplicationContext
|
||||
import io.element.android.libraries.matrix.api.core.RoomId
|
||||
import io.element.android.libraries.matrix.api.core.SessionId
|
||||
import io.element.android.libraries.matrix.api.core.ThreadId
|
||||
import io.element.android.libraries.push.impl.NotificationConfig
|
||||
import io.element.android.libraries.push.impl.R
|
||||
import io.element.android.libraries.push.impl.notifications.NotificationActionIds
|
||||
import io.element.android.libraries.push.impl.notifications.NotificationBroadcastReceiver
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4c4552bc00b305d4f0a114932bc34ce1e47a7e144d59fc73200554a4c41831c1
|
||||
size 37325
|
||||
oid sha256:ce132903012c55bdca8fd9e081a4b92fbb9110b786bff2c15bed1f2bf81f6be7
|
||||
size 37003
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2b9fbbaf2baa535bc8160e06f3451cf37344a1959bc7528fd7ebb60d1deba115
|
||||
size 42668
|
||||
oid sha256:66756228647566a3985f80c6ab362713abb8b6a18fd6eb45b5def593c49ad26e
|
||||
size 42374
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8683e41eaa1104e27cbd009df3ef5425387034217de552bd9a7452fe360aeab6
|
||||
size 36879
|
||||
oid sha256:66a7de6dfd16f66a345ee092760f4e43db0099519584895bc5a73144001e6521
|
||||
size 36584
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:609af5a67bd82425771446f782d578ae0e65991a0dcd538622f2baccc2417280
|
||||
size 42300
|
||||
oid sha256:e2f4761d2196058c740f051c457bb59cbbe000e06d2a0cf2c1b1c3db6e88a5c5
|
||||
size 42007
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:38633c4ad718d5b24d9f8bf950774945e10b980e179ed7ad3e2d6ada142d2a8c
|
||||
size 65148
|
||||
oid sha256:1e0ce69a05b0d5fc6f93379e3598f64de5907f4e58393cef6ac34db520e1a33d
|
||||
size 64861
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:27d44086e379f39dcfc0de3f57eaead0ee31e0eef17f9f57ac3acd27fec3410b
|
||||
size 86637
|
||||
oid sha256:77ded11b7e2bda0d6c32789c5f5fcc0e11cec268b9ca6759d395d6dd1a15d6ca
|
||||
size 86389
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:38633c4ad718d5b24d9f8bf950774945e10b980e179ed7ad3e2d6ada142d2a8c
|
||||
size 65148
|
||||
oid sha256:1e0ce69a05b0d5fc6f93379e3598f64de5907f4e58393cef6ac34db520e1a33d
|
||||
size 64861
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:15cb552fefe91c70a15d303d033f8cb20cbe9c6724db81a6af2401558d81f47e
|
||||
size 65112
|
||||
oid sha256:eb3738bad0fb2af6756b8b55f7534d221a928e747762bcd485af537721f80d15
|
||||
size 64800
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d9e4bdb080c03ea0d64b66def5103f70d97c7ef493b4829f6be8962a87333336
|
||||
size 66204
|
||||
oid sha256:e59a16fa5c62267598c19b10e669c2a3b29518b5d9442616a80e2a286d1d4dfe
|
||||
size 65893
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2544d7bf96a1045ec0f4a0a6bffd893a1d5e5a3745a7acb2efceecc81b37922d
|
||||
size 66592
|
||||
oid sha256:775d4c475a1c3f31d27e5ccd550758b72073b4f1bd2c3ba80f6070d72633d514
|
||||
size 66277
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:341842b3aa4b16ce4881ac8c79017577a73322b82d0c6570f397d10bdcb31616
|
||||
size 89851
|
||||
oid sha256:cb05834596fd1984b25b545a363cf44d5ce81675fa2953da7f98388fae04c6b2
|
||||
size 89571
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f46ac96865c29a90c8e68d5c77ce04b922d56ff9072655b8f2d9c756e1e43d19
|
||||
size 67360
|
||||
oid sha256:b4f2e2ca7a4192a7bac73d2f1285bf371048aeeb348fecb775630c9630c8e404
|
||||
size 67083
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:60cd171a7caf644493ac059595742d2a4a570672ef76e2039174d18851cfd041
|
||||
size 88554
|
||||
oid sha256:379905d496dc1f7f38518252ecab1c7434d7bc43a0865f83c2ec3334e59787a9
|
||||
size 88311
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f46ac96865c29a90c8e68d5c77ce04b922d56ff9072655b8f2d9c756e1e43d19
|
||||
size 67360
|
||||
oid sha256:b4f2e2ca7a4192a7bac73d2f1285bf371048aeeb348fecb775630c9630c8e404
|
||||
size 67083
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1474722e755a1be8d91db3a6f7ce60f591d23a52dcf8217abbaee844c2c55b60
|
||||
size 67154
|
||||
oid sha256:3f0c14c6409b21d3f8aa4402bfc71cae6ef196b7ccf7ca45b9e7731dc3f2e29b
|
||||
size 66865
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d8cc283fc4c71d0c0afa84d5b97643738b6552fb88dd2e242d7b4e0066a68166
|
||||
size 68953
|
||||
oid sha256:597c721b783b7a5c92a87e554e49409b6e4fe22d8929bf234edddf8f2dc92bca
|
||||
size 68682
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7c5775a0a578ddba1f279e5085d0e5687d5da0ab973fffa907263eed72aa5376
|
||||
size 69316
|
||||
oid sha256:96bfd478d9ab46b53dc20f1867b5d5c56eddbbf9a9afc922520caa275961810a
|
||||
size 69039
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:aff70357e41e29d3dbbf8e805f38e35da274dba33809255c2ab0d3af0ca48706
|
||||
size 91446
|
||||
oid sha256:b7a3271308ba07c7f75de9e597c477b4d1d25627be4c2732721b3c94ee79dd00
|
||||
size 91191
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue