add qr code option to home screen menu (#7177)

This commit is contained in:
Nikita Fedrunov 2022-09-19 22:34:56 +02:00 committed by GitHub
parent 7d2cbf5263
commit 6da6f6a7f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View file

@ -84,6 +84,7 @@ import im.vector.app.features.spaces.SpaceSettingsMenuBottomSheet
import im.vector.app.features.spaces.invite.SpaceInviteBottomSheet import im.vector.app.features.spaces.invite.SpaceInviteBottomSheet
import im.vector.app.features.spaces.share.ShareSpaceBottomSheet import im.vector.app.features.spaces.share.ShareSpaceBottomSheet
import im.vector.app.features.themes.ThemeUtils import im.vector.app.features.themes.ThemeUtils
import im.vector.app.features.usercode.UserCodeActivity
import im.vector.app.features.workers.signout.ServerBackupStatusViewModel import im.vector.app.features.workers.signout.ServerBackupStatusViewModel
import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onEach
@ -634,10 +635,18 @@ class HomeActivity :
launchInviteFriends() launchInviteFriends()
true true
} }
R.id.menu_home_qr -> {
launchQrCode()
true
}
else -> false else -> false
} }
} }
private fun launchQrCode() {
startActivity(UserCodeActivity.newIntent(this, sharedActionViewModel.session.myUserId))
}
private fun launchInviteFriends() { private fun launchInviteFriends() {
activeSessionHolder.getSafeActiveSession()?.permalinkService()?.createPermalink(sharedActionViewModel.session.myUserId)?.let { permalink -> activeSessionHolder.getSafeActiveSession()?.permalinkService()?.createPermalink(sharedActionViewModel.session.myUserId)?.let { permalink ->
analyticsTracker.screen(MobileScreen(screenName = MobileScreen.ScreenName.InviteFriends)) analyticsTracker.screen(MobileScreen(screenName = MobileScreen.ScreenName.InviteFriends))

View file

@ -12,6 +12,11 @@
android:title="@string/invite_friends" android:title="@string/invite_friends"
app:showAsAction="never" /> app:showAsAction="never" />
<item
android:id="@+id/menu_home_qr"
android:title="@string/add_by_qr_code"
app:showAsAction="never" />
<item <item
android:id="@+id/menu_home_suggestion" android:id="@+id/menu_home_suggestion"
android:icon="@drawable/ic_material_bug_report" android:icon="@drawable/ic_material_bug_report"
@ -42,5 +47,4 @@
android:title="@string/home_filter_placeholder_home" android:title="@string/home_filter_placeholder_home"
app:iconTint="?vctr_content_secondary" app:iconTint="?vctr_content_secondary"
app:showAsAction="ifRoom" /> app:showAsAction="ifRoom" />
</menu> </menu>