Adds invites to new home menu
This commit is contained in:
parent
9a981bb1d5
commit
d3a1783e57
@ -159,7 +159,7 @@ fun startInstallFromSourceIntent(context: Context, activityResultLauncher: Activ
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun startSharePlainTextIntent(
|
fun startSharePlainTextIntent(
|
||||||
fragment: Fragment,
|
context: Context,
|
||||||
activityResultLauncher: ActivityResultLauncher<Intent>?,
|
activityResultLauncher: ActivityResultLauncher<Intent>?,
|
||||||
chooserTitle: String?,
|
chooserTitle: String?,
|
||||||
text: String,
|
text: String,
|
||||||
@ -182,10 +182,10 @@ fun startSharePlainTextIntent(
|
|||||||
if (activityResultLauncher != null) {
|
if (activityResultLauncher != null) {
|
||||||
activityResultLauncher.launch(intent)
|
activityResultLauncher.launch(intent)
|
||||||
} else {
|
} else {
|
||||||
fragment.startActivity(intent)
|
context.startActivity(intent)
|
||||||
}
|
}
|
||||||
} catch (activityNotFoundException: ActivityNotFoundException) {
|
} catch (activityNotFoundException: ActivityNotFoundException) {
|
||||||
fragment.activity?.toast(R.string.error_no_external_application_found)
|
context.toast(R.string.error_no_external_application_found)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ class KeysBackupSetupStep3Fragment @Inject constructor() : VectorBaseFragment<Fr
|
|||||||
|
|
||||||
dialog.findViewById<View>(R.id.keys_backup_setup_share)?.debouncedClicks {
|
dialog.findViewById<View>(R.id.keys_backup_setup_share)?.debouncedClicks {
|
||||||
startSharePlainTextIntent(
|
startSharePlainTextIntent(
|
||||||
fragment = this,
|
context = requireContext(),
|
||||||
activityResultLauncher = null,
|
activityResultLauncher = null,
|
||||||
chooserTitle = context?.getString(R.string.keys_backup_setup_step3_share_intent_chooser_title),
|
chooserTitle = context?.getString(R.string.keys_backup_setup_step3_share_intent_chooser_title),
|
||||||
text = recoveryKey,
|
text = recoveryKey,
|
||||||
|
@ -104,7 +104,7 @@ class BootstrapSaveRecoveryKeyFragment @Inject constructor(
|
|||||||
?: return@withState
|
?: return@withState
|
||||||
|
|
||||||
startSharePlainTextIntent(
|
startSharePlainTextIntent(
|
||||||
this,
|
requireContext(),
|
||||||
copyStartForActivityResult,
|
copyStartForActivityResult,
|
||||||
context?.getString(R.string.keys_backup_setup_step3_share_intent_chooser_title),
|
context?.getString(R.string.keys_backup_setup_step3_share_intent_chooser_title),
|
||||||
recoveryKey,
|
recoveryKey,
|
||||||
|
@ -46,10 +46,10 @@ import im.vector.app.core.platform.VectorBaseActivity
|
|||||||
import im.vector.app.core.platform.VectorMenuProvider
|
import im.vector.app.core.platform.VectorMenuProvider
|
||||||
import im.vector.app.core.pushers.PushersManager
|
import im.vector.app.core.pushers.PushersManager
|
||||||
import im.vector.app.core.pushers.UnifiedPushHelper
|
import im.vector.app.core.pushers.UnifiedPushHelper
|
||||||
|
import im.vector.app.core.utils.startSharePlainTextIntent
|
||||||
import im.vector.app.databinding.ActivityHomeBinding
|
import im.vector.app.databinding.ActivityHomeBinding
|
||||||
import im.vector.app.features.MainActivity
|
import im.vector.app.features.MainActivity
|
||||||
import im.vector.app.features.MainActivityArgs
|
import im.vector.app.features.MainActivityArgs
|
||||||
import im.vector.app.features.VectorFeatures
|
|
||||||
import im.vector.app.features.analytics.accountdata.AnalyticsAccountDataViewModel
|
import im.vector.app.features.analytics.accountdata.AnalyticsAccountDataViewModel
|
||||||
import im.vector.app.features.analytics.plan.MobileScreen
|
import im.vector.app.features.analytics.plan.MobileScreen
|
||||||
import im.vector.app.features.analytics.plan.ViewRoom
|
import im.vector.app.features.analytics.plan.ViewRoom
|
||||||
@ -587,10 +587,29 @@ class HomeActivity :
|
|||||||
navigator.openSettings(this)
|
navigator.openSettings(this)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
R.id.menu_home_invite_friends -> {
|
||||||
|
launchInviteFriends()
|
||||||
|
true
|
||||||
|
}
|
||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun launchInviteFriends() {
|
||||||
|
activeSessionHolder.getSafeActiveSession()?.permalinkService()?.createPermalink(sharedActionViewModel.session.myUserId)?.let { permalink ->
|
||||||
|
analyticsTracker.screen(MobileScreen(screenName = MobileScreen.ScreenName.InviteFriends))
|
||||||
|
val text = getString(R.string.invite_friends_text, permalink)
|
||||||
|
|
||||||
|
startSharePlainTextIntent(
|
||||||
|
context = this,
|
||||||
|
activityResultLauncher = null,
|
||||||
|
chooserTitle = getString(R.string.invite_friends),
|
||||||
|
text = text,
|
||||||
|
extraTitle = getString(R.string.invite_friends_rich_title)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onBackPressed() {
|
override fun onBackPressed() {
|
||||||
if (views.drawerLayout.isDrawerOpen(GravityCompat.START)) {
|
if (views.drawerLayout.isDrawerOpen(GravityCompat.START)) {
|
||||||
views.drawerLayout.closeDrawer(GravityCompat.START)
|
views.drawerLayout.closeDrawer(GravityCompat.START)
|
||||||
|
@ -102,7 +102,7 @@ class HomeDrawerFragment @Inject constructor(
|
|||||||
val text = getString(R.string.invite_friends_text, permalink)
|
val text = getString(R.string.invite_friends_text, permalink)
|
||||||
|
|
||||||
startSharePlainTextIntent(
|
startSharePlainTextIntent(
|
||||||
fragment = this,
|
context = requireContext(),
|
||||||
activityResultLauncher = null,
|
activityResultLauncher = null,
|
||||||
chooserTitle = getString(R.string.invite_friends),
|
chooserTitle = getString(R.string.invite_friends),
|
||||||
text = text,
|
text = text,
|
||||||
|
@ -300,7 +300,7 @@ class NewHomeDetailFragment @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
views.avatar.setOnClickListener {
|
views.avatar.debouncedClicks {
|
||||||
navigator.openSettings(requireContext())
|
navigator.openSettings(requireContext())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -334,7 +334,7 @@ class RoomMemberProfileFragment @Inject constructor(
|
|||||||
.setNeutralButton(R.string.ok, null)
|
.setNeutralButton(R.string.ok, null)
|
||||||
.setPositiveButton(R.string.share_by_text) { _, _ ->
|
.setPositiveButton(R.string.share_by_text) { _, _ ->
|
||||||
startSharePlainTextIntent(
|
startSharePlainTextIntent(
|
||||||
fragment = this,
|
context = requireContext(),
|
||||||
activityResultLauncher = null,
|
activityResultLauncher = null,
|
||||||
chooserTitle = null,
|
chooserTitle = null,
|
||||||
text = permalink
|
text = permalink
|
||||||
|
@ -337,7 +337,7 @@ class RoomProfileFragment @Inject constructor(
|
|||||||
|
|
||||||
private fun onShareRoomProfile(permalink: String) {
|
private fun onShareRoomProfile(permalink: String) {
|
||||||
startSharePlainTextIntent(
|
startSharePlainTextIntent(
|
||||||
fragment = this,
|
context = requireContext(),
|
||||||
activityResultLauncher = null,
|
activityResultLauncher = null,
|
||||||
chooserTitle = null,
|
chooserTitle = null,
|
||||||
text = permalink
|
text = permalink
|
||||||
|
@ -89,7 +89,7 @@ class ShareSpaceBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetSpa
|
|||||||
}
|
}
|
||||||
is ShareSpaceViewEvents.ShowInviteByLink -> {
|
is ShareSpaceViewEvents.ShowInviteByLink -> {
|
||||||
startSharePlainTextIntent(
|
startSharePlainTextIntent(
|
||||||
fragment = this,
|
context = requireContext(),
|
||||||
activityResultLauncher = null,
|
activityResultLauncher = null,
|
||||||
chooserTitle = getString(R.string.share_by_text),
|
chooserTitle = getString(R.string.share_by_text),
|
||||||
text = getString(R.string.share_space_link_message, event.spaceName, event.permalink),
|
text = getString(R.string.share_space_link_message, event.spaceName, event.permalink),
|
||||||
|
@ -67,7 +67,7 @@ class ShowUserCodeFragment @Inject constructor(
|
|||||||
sharedViewModel.observeViewEvents {
|
sharedViewModel.observeViewEvents {
|
||||||
if (it is UserCodeShareViewEvents.SharePlainText) {
|
if (it is UserCodeShareViewEvents.SharePlainText) {
|
||||||
startSharePlainTextIntent(
|
startSharePlainTextIntent(
|
||||||
fragment = this,
|
context = requireContext(),
|
||||||
activityResultLauncher = null,
|
activityResultLauncher = null,
|
||||||
chooserTitle = it.title,
|
chooserTitle = it.title,
|
||||||
text = it.text,
|
text = it.text,
|
||||||
|
@ -96,7 +96,7 @@ class UserListFragment @Inject constructor(
|
|||||||
is UserListViewEvents.OpenShareMatrixToLink -> {
|
is UserListViewEvents.OpenShareMatrixToLink -> {
|
||||||
val text = getString(R.string.invite_friends_text, it.link)
|
val text = getString(R.string.invite_friends_text, it.link)
|
||||||
startSharePlainTextIntent(
|
startSharePlainTextIntent(
|
||||||
fragment = this,
|
context = requireContext(),
|
||||||
activityResultLauncher = null,
|
activityResultLauncher = null,
|
||||||
chooserTitle = getString(R.string.invite_friends),
|
chooserTitle = getString(R.string.invite_friends),
|
||||||
text = text,
|
text = text,
|
||||||
|
@ -4,30 +4,33 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_home_setting"
|
android:id="@+id/menu_home_invite_friends"
|
||||||
android:icon="@drawable/ic_settings_x"
|
android:title="@string/invite_friends"
|
||||||
android:title="@string/settings"
|
|
||||||
app:showAsAction="never" />
|
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"
|
||||||
android:title="@string/send_suggestion" />
|
android:title="@string/send_suggestion"
|
||||||
|
app:showAsAction="never" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_home_report_bug"
|
android:id="@+id/menu_home_report_bug"
|
||||||
android:icon="@drawable/ic_material_bug_report"
|
android:icon="@drawable/ic_material_bug_report"
|
||||||
android:title="@string/send_bug_report" />
|
android:title="@string/send_bug_report"
|
||||||
|
app:showAsAction="never" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_home_init_sync_legacy"
|
android:id="@+id/menu_home_init_sync_legacy"
|
||||||
android:title="Do a legacy init sync"
|
android:title="Do a legacy init sync"
|
||||||
tools:ignore="HardcodedText" />
|
tools:ignore="HardcodedText"
|
||||||
|
app:showAsAction="never" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_home_init_sync_optimized"
|
android:id="@+id/menu_home_init_sync_optimized"
|
||||||
android:title="Do an optimized init sync"
|
android:title="Do an optimized init sync"
|
||||||
tools:ignore="HardcodedText" />
|
tools:ignore="HardcodedText"
|
||||||
|
app:showAsAction="never" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_home_filter"
|
android:id="@+id/menu_home_filter"
|
||||||
|
Loading…
Reference in New Issue
Block a user