Browse Source

Added invite

main
M66B 6 years ago
parent
commit
67b2f1ca5b
2 changed files with 24 additions and 0 deletions
  1. +21
    -0
      app/src/main/java/eu/faircode/email/ActivityView.java
  2. +3
    -0
      app/src/main/res/values/strings.xml

+ 21
- 0
app/src/main/java/eu/faircode/email/ActivityView.java View File

@ -92,6 +92,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
static final int REQUEST_ERROR = 3;
static final int REQUEST_ATTACHMENT = 1;
static final int REQUEST_INVITE = 2;
static final String ACTION_VIEW_MESSAGES = BuildConfig.APPLICATION_ID + ".VIEW_MESSAGES";
static final String ACTION_VIEW_MESSAGE = BuildConfig.APPLICATION_ID + ".VIEW_MESSAGE";
@ -164,6 +165,9 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
case R.string.menu_rate:
onMenuRate();
break;
case R.string.menu_invite:
onMenuInvite();
break;
case R.string.menu_other:
onMenuOtherApps();
break;
@ -222,6 +226,9 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
drawerArray.add(new DrawerItem(R.layout.item_drawer_separator));
if (getIntentInvite().resolveActivity(getPackageManager()) != null)
drawerArray.add(new DrawerItem(ActivityView.this, R.layout.item_drawer, R.drawable.baseline_people_24, R.string.menu_invite));
if (getIntentRate().resolveActivity(getPackageManager()) != null)
drawerArray.add(new DrawerItem(ActivityView.this, R.layout.item_drawer, R.drawable.baseline_star_24, R.string.menu_rate));
@ -567,6 +574,16 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
return intent;
}
private Intent getIntentInvite() {
Intent intent = new Intent("com.google.android.gms.appinvite.ACTION_APP_INVITE");
intent.setPackage("com.google.android.gms");
intent.putExtra("com.google.android.gms.appinvite.TITLE", getString(R.string.menu_invite));
intent.putExtra("com.google.android.gms.appinvite.MESSAGE", getString(R.string.title_try));
intent.putExtra("com.google.android.gms.appinvite.BUTTON_TEXT", getString(R.string.title_try));
// com.google.android.gms.appinvite.DEEP_LINK_URL
return intent;
}
private Intent getIntentOtherApps() {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://play.google.com/store/apps/dev?id=8420080860664580239"));
@ -652,6 +669,10 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
}
}
private void onMenuInvite() {
startActivityForResult(getIntentInvite(), REQUEST_INVITE);
}
private void onMenuOtherApps() {
Helper.view(this, getIntentOtherApps());
}


+ 3
- 0
app/src/main/res/values/strings.xml View File

@ -39,6 +39,7 @@
<string name="menu_pro">Pro features</string>
<string name="menu_privacy">Privacy</string>
<string name="menu_about">About</string>
<string name="menu_invite">Invite</string>
<string name="menu_rate">Rate this app</string>
<string name="menu_other">Other apps</string>
@ -266,6 +267,8 @@
<string name="title_no">No</string>
<string name="title_undo">Undo</string>
<string name="title_try">Try FairEmail, an open source, privacy friendly email app for Android</string>
<string name="title_pro_feature">This is a pro feature</string>
<string name="title_pro_list">List of pro features</string>
<string name="title_pro_purchase">Buy</string>


Loading…
Cancel
Save