diff options
author | Christian Schneppe <christian@pix-art.de> | 2016-06-02 20:36:44 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-06-02 20:36:44 +0200 |
commit | 4ce93a69e95b1c0661cc406a5d0dd530cc2fe5cb (patch) | |
tree | 1d201aec806c8e9f873fd0e71680a1ceb8696f9e /src/main/java | |
parent | 997ae90b46577652141bfcea5190957543f0ff7f (diff) |
Share link to invite user to start over with Pix-Art Messenger
Diffstat (limited to '')
3 files changed, 20 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java index afb6a358a..bbfedb22a 100644 --- a/src/main/java/eu/siacs/conversations/Config.java +++ b/src/main/java/eu/siacs/conversations/Config.java @@ -42,6 +42,8 @@ public final class Config { public static final String BUG_REPORTS = "bugs@pix-art.de"; + public static String inviteUserURL = "https://jabber.pix-art.de/i/"; + public static final String DOMAIN_LOCK = "pix-art.de"; //only allow account creation for this domain public static final String MAGIC_CREATE_DOMAIN = "pix-art.de"; public static final boolean SINGLE_ACCOUNT = true; //set to true to allow only one account diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index 398ca0a1d..4d9aa8d6c 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -551,6 +551,7 @@ public class ConversationActivity extends XmppActivity final MenuItem menuMute = menu.findItem(R.id.action_mute); final MenuItem menuUnmute = menu.findItem(R.id.action_unmute); final MenuItem menuUpdater = menu.findItem(R.id.action_check_updates); + final MenuItem menuInviteUser = menu.findItem(R.id.action_invite_user); if (isConversationsOverviewVisable() && isConversationsOverviewHideable()) { menuArchiveChat.setVisible(false); @@ -565,6 +566,7 @@ public class ConversationActivity extends XmppActivity menuAdd.setVisible(!isConversationsOverviewHideable()); //hide settings, accounts and updater in all menus except in main window menuUpdater.setVisible(false); + menuInviteUser.setVisible(false); if (this.getSelectedConversation() != null) { if (this.getSelectedConversation().getMode() == Conversation.MODE_SINGLE) { diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java index 0cefe1d2d..ad1cbf905 100644 --- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java @@ -359,6 +359,9 @@ public abstract class XmppActivity extends Activity { @Override public boolean onOptionsItemSelected(final MenuItem item) { switch (item.getItemId()) { + case R.id.action_invite_user: + inviteUser(); + break; case R.id.action_settings: startActivity(new Intent(this, SettingsActivity.class)); break; @@ -1076,6 +1079,19 @@ public abstract class XmppActivity extends Activity { return null; } + private void inviteUser() { + Account mAccount = xmppConnectionService.getAccounts().get(0); + String user = mAccount.getJid().getLocalpart().toString(); + String domain = mAccount.getJid().getDomainpart().toString(); + String inviteURL = Config.inviteUserURL + user + "/" + domain; + String inviteText = getString(R.string.InviteText, user); + Intent intent = new Intent(android.content.Intent.ACTION_SEND); + intent.setType("text/plain"); + intent.putExtra(Intent.EXTRA_SUBJECT, user + " " + getString(R.string.inviteUser_Subject) + " " + getString(R.string.app_name)); + intent.putExtra(Intent.EXTRA_TEXT, inviteText + "\n\n" + inviteURL); + startActivity(Intent.createChooser(intent, getString(R.string.invite_contact))); + } + @Override public void onResume() { super.onResume(); |