#825 - Invite friends

This commit is contained in:
Moez Bhatti
2018-07-28 18:39:29 -04:00
parent d62beb07d1
commit 74f8b308ae
6 changed files with 31 additions and 4 deletions
@@ -188,7 +188,7 @@ class Navigator @Inject constructor(
fun showRating() {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=${context.packageName}"))
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.moez.QKSMS"))
.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY
or Intent.FLAG_ACTIVITY_NEW_DOCUMENT
or Intent.FLAG_ACTIVITY_MULTIPLE_TASK)
@@ -196,7 +196,7 @@ class Navigator @Inject constructor(
try {
startActivity(intent)
} catch (e: ActivityNotFoundException) {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + context.packageName)))
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=com.moez.QKSMS")))
}
}
@@ -223,6 +223,15 @@ class Navigator @Inject constructor(
startActivityExternal(intent)
}
fun showInvite() {
analyticsManager.track("Clicked Invite")
Intent(Intent.ACTION_SEND)
.setType("text/plain")
.putExtra(Intent.EXTRA_TEXT, "http://qklabs.com/download")
.let { Intent.createChooser(it, null) }
.let(this::startActivityExternal)
}
fun addContact(address: String) {
val intent = Intent(Intent.ACTION_INSERT)
.setType(ContactsContract.Contacts.CONTENT_TYPE)
@@ -85,7 +85,8 @@ class MainActivity : QkThemedActivity(), MainView {
blocking.clicks().map { DrawerItem.BLOCKING },
settings.clicks().map { DrawerItem.SETTINGS },
plus.clicks().map { DrawerItem.PLUS },
help.clicks().map { DrawerItem.HELP }))
help.clicks().map { DrawerItem.HELP },
invite.clicks().map { DrawerItem.INVITE }))
}
override val optionsItemIntent: Subject<Int> = PublishSubject.create()
override val plusBannerIntent by lazy { plusBanner.clicks() }
@@ -47,4 +47,4 @@ interface MainView : QkView<MainState> {
}
enum class DrawerItem { INBOX, ARCHIVED, SCHEDULED, BLOCKING, SETTINGS, PLUS, HELP }
enum class DrawerItem { INBOX, ARCHIVED, SCHEDULED, BLOCKING, SETTINGS, PLUS, HELP, INVITE }
@@ -194,6 +194,7 @@ class MainViewModel @Inject constructor(
.doOnNext { if (it == DrawerItem.SETTINGS) navigator.showSettings() }
.doOnNext { if (it == DrawerItem.PLUS) navigator.showQksmsPlusActivity("main_menu") }
.doOnNext { if (it == DrawerItem.HELP) navigator.showSupport() }
.doOnNext { if (it == DrawerItem.INVITE) navigator.showInvite() }
.distinctUntilChanged()
.doOnNext {
when (it) {
@@ -152,6 +152,21 @@
</LinearLayout>
<LinearLayout
android:id="@+id/invite"
style="@style/DrawerRow">
<ImageView
style="@style/DrawerIcon"
android:src="@drawable/ic_people_black_24dp"
android:tint="?android:attr/textColorSecondary" />
<com.moez.QKSMS.common.widget.QkTextView
style="@style/DrawerText"
android:text="@string/drawer_invite" />
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/plusBanner"
android:layout_width="match_parent"
@@ -70,6 +70,7 @@
<string name="drawer_settings">Settings</string>
<string name="drawer_plus">QKSMS+</string>
<string name="drawer_help">Help &amp; feedback</string>
<string name="drawer_invite">Invite friends</string>
<string name="drawer_plus_banner_title">QKSMS+</string>
<string name="drawer_plus_banner_summary">Unlock amazing new features, and support development</string>