From f23453c0a76219b71094214c95fef674de6ce4e2 Mon Sep 17 00:00:00 2001 From: steckbrief Date: Sat, 13 Jul 2019 20:57:51 +0200 Subject: implements FS#276: Remove 'Invite to Pix-Art Messenger' --- .../messenger/services/NotificationService.java | 13 ----- .../pixart/messenger/ui/ConversationsActivity.java | 10 +--- .../java/de/pixart/messenger/ui/XmppActivity.java | 66 ---------------------- 3 files changed, 1 insertion(+), 88 deletions(-) (limited to 'src/main/java/de/pixart') diff --git a/src/main/java/de/pixart/messenger/services/NotificationService.java b/src/main/java/de/pixart/messenger/services/NotificationService.java index af205dbe6..7a2ec9a44 100644 --- a/src/main/java/de/pixart/messenger/services/NotificationService.java +++ b/src/main/java/de/pixart/messenger/services/NotificationService.java @@ -1035,19 +1035,6 @@ public class NotificationService { cancel(FOREGROUND_NOTIFICATION_ID); } - Notification AppUpdateNotification(PendingIntent intent, String version, String filesize) { - Notification.Builder mBuilder = new Notification.Builder(mXmppConnectionService); - mBuilder.setContentTitle(mXmppConnectionService.getString(R.string.app_name)); - mBuilder.setContentText(String.format(mXmppConnectionService.getString(R.string.update_available), version, filesize)); - mBuilder.setSmallIcon(R.drawable.ic_update_notification); - mBuilder.setContentIntent(intent); - mBuilder.setOngoing(true); - if (Compatibility.runsTwentySix()) { - mBuilder.setChannelId(UPDATE_CHANNEL_ID); - } - return mBuilder.build(); - } - private void notify(String tag, int id, Notification notification) { final NotificationManagerCompat notificationManager = NotificationManagerCompat.from(mXmppConnectionService); try { diff --git a/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java index 88a3b2509..9ac59cd34 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java @@ -443,7 +443,6 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio getMenuInflater().inflate(R.menu.activity_conversations, menu); final MenuItem qrCodeScanMenuItem = menu.findItem(R.id.action_scan_qr_code); final MenuItem menuEditProfiles = menu.findItem(R.id.action_accounts); - final MenuItem inviteUser = menu.findItem(R.id.action_invite_user); if (qrCodeScanMenuItem != null) { if (isCameraFeatureAvailable()) { Fragment fragment = getFragmentManager().findFragmentById(R.id.main_fragment); @@ -460,11 +459,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio } else { menuEditProfiles.setTitle(R.string.action_accounts); } - if (xmppConnectionServiceBound && xmppConnectionService.getAccounts().size() > 0) { - inviteUser.setVisible(true); - } else { - inviteUser.setVisible(false); - } + return super.onCreateOptionsMenu(menu); } @@ -565,9 +560,6 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio case R.id.action_scan_qr_code: UriHandlerActivity.scan(this); return true; - case R.id.action_invite_user: - inviteUser(); - break; } return super.onOptionsItemSelected(item); } diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java index 7b1f9d0f2..c938dcff2 100644 --- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java +++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java @@ -950,72 +950,6 @@ public abstract class XmppActivity extends ActionBarActivity { return null; } - public void inviteUser() { - if (!xmppConnectionServiceBound) { - Toast.makeText(this, R.string.not_connected_try_again, Toast.LENGTH_SHORT).show(); - return; - } - if (xmppConnectionService.getAccounts() == null){ - Toast.makeText(this, R.string.no_accounts, Toast.LENGTH_SHORT).show(); - return; - } - if (!xmppConnectionService.multipleAccounts()) { - Account mAccount = xmppConnectionService.getAccounts().get(0); - String user = Jid.of(mAccount.getJid()).getLocal(); - String domain = Jid.of(mAccount.getJid()).getDomain(); - String inviteURL = AdHocInviteUri(mAccount); - if (inviteURL == null) { - inviteURL = Config.inviteUserURL + user + "/" + domain; - } - Log.d(Config.LOGTAG, "Invite uri = " + inviteURL); - 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))); - overridePendingTransition(R.animator.fade_in, R.animator.fade_out); - } else { - final AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setTitle(R.string.chooce_account); - final View dialogView = this.getLayoutInflater().inflate(R.layout.choose_account_dialog, null); - final Spinner spinner = dialogView.findViewById(R.id.account); - builder.setView(dialogView); - List mActivatedAccounts = new ArrayList<>(); - for (Account account : xmppConnectionService.getAccounts()) { - if (account.getStatus() != Account.State.DISABLED) { - if (Config.DOMAIN_LOCK != null) { - mActivatedAccounts.add(account.getJid().getLocal()); - } else { - mActivatedAccounts.add(account.getJid().asBareJid().toString()); - } - } - } - StartConversationActivity.populateAccountSpinner(this, mActivatedAccounts, spinner); - builder.setPositiveButton(R.string.ok, - (dialog, id) -> { - String selection = spinner.getSelectedItem().toString(); - Account mAccount = xmppConnectionService.findAccountByJid(Jid.of(selection).asBareJid()); - String user = Jid.of(mAccount.getJid()).getLocal(); - String domain = Jid.of(mAccount.getJid()).getDomain(); - String inviteURL = AdHocInviteUri(mAccount); - if (inviteURL == null) { - inviteURL = Config.inviteUserURL + user + "/" + domain; - } - Log.d(Config.LOGTAG, "Invite uri = " + inviteURL); - String inviteText = getString(R.string.InviteText, user); - Intent intent = new Intent(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))); - overridePendingTransition(R.animator.fade_in, R.animator.fade_out); - }); - builder.setNegativeButton(R.string.cancel, null); - builder.create().show(); - } - } - private boolean AdHocInvite(Account account) { if (!xmppConnectionServiceBound) { return false; -- cgit v1.2.3