mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-17 19:58:57 +03:00
Adds invites to new home menu
This commit is contained in:
parent
9a981bb1d5
commit
d3a1783e57
12 changed files with 42 additions and 20 deletions
|
@ -159,7 +159,7 @@ fun startInstallFromSourceIntent(context: Context, activityResultLauncher: Activ
|
|||
}
|
||||
|
||||
fun startSharePlainTextIntent(
|
||||
fragment: Fragment,
|
||||
context: Context,
|
||||
activityResultLauncher: ActivityResultLauncher<Intent>?,
|
||||
chooserTitle: String?,
|
||||
text: String,
|
||||
|
@ -182,10 +182,10 @@ fun startSharePlainTextIntent(
|
|||
if (activityResultLauncher != null) {
|
||||
activityResultLauncher.launch(intent)
|
||||
} else {
|
||||
fragment.startActivity(intent)
|
||||
context.startActivity(intent)
|
||||
}
|
||||
} 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 {
|
||||
startSharePlainTextIntent(
|
||||
fragment = this,
|
||||
context = requireContext(),
|
||||
activityResultLauncher = null,
|
||||
chooserTitle = context?.getString(R.string.keys_backup_setup_step3_share_intent_chooser_title),
|
||||
text = recoveryKey,
|
||||
|
|
|
@ -104,7 +104,7 @@ class BootstrapSaveRecoveryKeyFragment @Inject constructor(
|
|||
?: return@withState
|
||||
|
||||
startSharePlainTextIntent(
|
||||
this,
|
||||
requireContext(),
|
||||
copyStartForActivityResult,
|
||||
context?.getString(R.string.keys_backup_setup_step3_share_intent_chooser_title),
|
||||
recoveryKey,
|
||||
|
|
|
@ -46,10 +46,10 @@ import im.vector.app.core.platform.VectorBaseActivity
|
|||
import im.vector.app.core.platform.VectorMenuProvider
|
||||
import im.vector.app.core.pushers.PushersManager
|
||||
import im.vector.app.core.pushers.UnifiedPushHelper
|
||||
import im.vector.app.core.utils.startSharePlainTextIntent
|
||||
import im.vector.app.databinding.ActivityHomeBinding
|
||||
import im.vector.app.features.MainActivity
|
||||
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.plan.MobileScreen
|
||||
import im.vector.app.features.analytics.plan.ViewRoom
|
||||
|
@ -587,10 +587,29 @@ class HomeActivity :
|
|||
navigator.openSettings(this)
|
||||
true
|
||||
}
|
||||
R.id.menu_home_invite_friends -> {
|
||||
launchInviteFriends()
|
||||
true
|
||||
}
|
||||
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() {
|
||||
if (views.drawerLayout.isDrawerOpen(GravityCompat.START)) {
|
||||
views.drawerLayout.closeDrawer(GravityCompat.START)
|
||||
|
|
|
@ -102,7 +102,7 @@ class HomeDrawerFragment @Inject constructor(
|
|||
val text = getString(R.string.invite_friends_text, permalink)
|
||||
|
||||
startSharePlainTextIntent(
|
||||
fragment = this,
|
||||
context = requireContext(),
|
||||
activityResultLauncher = null,
|
||||
chooserTitle = getString(R.string.invite_friends),
|
||||
text = text,
|
||||
|
|
|
@ -300,7 +300,7 @@ class NewHomeDetailFragment @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
views.avatar.setOnClickListener {
|
||||
views.avatar.debouncedClicks {
|
||||
navigator.openSettings(requireContext())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -334,7 +334,7 @@ class RoomMemberProfileFragment @Inject constructor(
|
|||
.setNeutralButton(R.string.ok, null)
|
||||
.setPositiveButton(R.string.share_by_text) { _, _ ->
|
||||
startSharePlainTextIntent(
|
||||
fragment = this,
|
||||
context = requireContext(),
|
||||
activityResultLauncher = null,
|
||||
chooserTitle = null,
|
||||
text = permalink
|
||||
|
|
|
@ -337,7 +337,7 @@ class RoomProfileFragment @Inject constructor(
|
|||
|
||||
private fun onShareRoomProfile(permalink: String) {
|
||||
startSharePlainTextIntent(
|
||||
fragment = this,
|
||||
context = requireContext(),
|
||||
activityResultLauncher = null,
|
||||
chooserTitle = null,
|
||||
text = permalink
|
||||
|
|
|
@ -89,7 +89,7 @@ class ShareSpaceBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetSpa
|
|||
}
|
||||
is ShareSpaceViewEvents.ShowInviteByLink -> {
|
||||
startSharePlainTextIntent(
|
||||
fragment = this,
|
||||
context = requireContext(),
|
||||
activityResultLauncher = null,
|
||||
chooserTitle = getString(R.string.share_by_text),
|
||||
text = getString(R.string.share_space_link_message, event.spaceName, event.permalink),
|
||||
|
|
|
@ -67,7 +67,7 @@ class ShowUserCodeFragment @Inject constructor(
|
|||
sharedViewModel.observeViewEvents {
|
||||
if (it is UserCodeShareViewEvents.SharePlainText) {
|
||||
startSharePlainTextIntent(
|
||||
fragment = this,
|
||||
context = requireContext(),
|
||||
activityResultLauncher = null,
|
||||
chooserTitle = it.title,
|
||||
text = it.text,
|
||||
|
|
|
@ -96,7 +96,7 @@ class UserListFragment @Inject constructor(
|
|||
is UserListViewEvents.OpenShareMatrixToLink -> {
|
||||
val text = getString(R.string.invite_friends_text, it.link)
|
||||
startSharePlainTextIntent(
|
||||
fragment = this,
|
||||
context = requireContext(),
|
||||
activityResultLauncher = null,
|
||||
chooserTitle = getString(R.string.invite_friends),
|
||||
text = text,
|
||||
|
|
|
@ -4,30 +4,33 @@
|
|||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_home_setting"
|
||||
android:icon="@drawable/ic_settings_x"
|
||||
android:title="@string/settings"
|
||||
android:id="@+id/menu_home_invite_friends"
|
||||
android:title="@string/invite_friends"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_home_suggestion"
|
||||
android:icon="@drawable/ic_material_bug_report"
|
||||
android:title="@string/send_suggestion" />
|
||||
android:title="@string/send_suggestion"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_home_report_bug"
|
||||
android:icon="@drawable/ic_material_bug_report"
|
||||
android:title="@string/send_bug_report" />
|
||||
android:title="@string/send_bug_report"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_home_init_sync_legacy"
|
||||
android:title="Do a legacy init sync"
|
||||
tools:ignore="HardcodedText" />
|
||||
tools:ignore="HardcodedText"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_home_init_sync_optimized"
|
||||
android:title="Do an optimized init sync"
|
||||
tools:ignore="HardcodedText" />
|
||||
tools:ignore="HardcodedText"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_home_filter"
|
||||
|
|
Loading…
Add table
Reference in a new issue