refactored some ManageAccount, WelcomeActivity and a few other things into 'full' flavor
This commit is contained in:
parent
96d34215fb
commit
a420cb5886
|
@ -21,7 +21,8 @@ repositories {
|
||||||
configurations {
|
configurations {
|
||||||
playstoreImplementation
|
playstoreImplementation
|
||||||
compatImplementation
|
compatImplementation
|
||||||
freeCompatImplementation
|
fullFreeCompatImplementation
|
||||||
|
quickFreeCompatImplementation
|
||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
|
@ -41,10 +42,11 @@ dependencies {
|
||||||
implementation "com.android.support:appcompat-v7:$supportLibVersion"
|
implementation "com.android.support:appcompat-v7:$supportLibVersion"
|
||||||
implementation "com.android.support:exifinterface:$supportLibVersion"
|
implementation "com.android.support:exifinterface:$supportLibVersion"
|
||||||
implementation "com.android.support:cardview-v7:$supportLibVersion"
|
implementation "com.android.support:cardview-v7:$supportLibVersion"
|
||||||
compatImplementation "com.android.support:support-emoji-appcompat:$supportLibVersion"
|
|
||||||
implementation "com.android.support:support-emoji:$supportLibVersion"
|
implementation "com.android.support:support-emoji:$supportLibVersion"
|
||||||
implementation "com.android.support:design:$supportLibVersion"
|
implementation "com.android.support:design:$supportLibVersion"
|
||||||
freeCompatImplementation "com.android.support:support-emoji-bundled:$supportLibVersion"
|
compatImplementation "com.android.support:support-emoji-appcompat:$supportLibVersion"
|
||||||
|
fullFreeCompatImplementation "com.android.support:support-emoji-bundled:$supportLibVersion"
|
||||||
|
quickFreeCompatImplementation "com.android.support:support-emoji-bundled:$supportLibVersion"
|
||||||
implementation 'org.bouncycastle:bcmail-jdk15on:1.58'
|
implementation 'org.bouncycastle:bcmail-jdk15on:1.58'
|
||||||
implementation 'com.google.zxing:core:3.3.0'
|
implementation 'com.google.zxing:core:3.3.0'
|
||||||
implementation 'de.measite.minidns:minidns-hla:0.2.4'
|
implementation 'de.measite.minidns:minidns-hla:0.2.4'
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
package="eu.siacs.conversations">
|
||||||
|
|
||||||
|
<application tools:ignore="GoogleAppIndexingWarning">
|
||||||
|
<activity
|
||||||
|
android:name=".ui.ManageAccountActivity"
|
||||||
|
android:label="@string/title_activity_manage_accounts"
|
||||||
|
android:launchMode="singleTask" />
|
||||||
|
<activity
|
||||||
|
android:name=".ui.WelcomeActivity"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:launchMode="singleTask"/>
|
||||||
|
<activity
|
||||||
|
android:name=".ui.MagicCreateActivity"
|
||||||
|
android:label="@string/create_account"
|
||||||
|
android:launchMode="singleTask"/>
|
||||||
|
|
||||||
|
</application>
|
||||||
|
</manifest>
|
|
@ -77,7 +77,7 @@ public class MagicCreateActivity extends XmppActivity implements TextWatcher {
|
||||||
intent.putExtra("init", true);
|
intent.putExtra("init", true);
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
Toast.makeText(MagicCreateActivity.this, R.string.secure_password_generated, Toast.LENGTH_SHORT).show();
|
Toast.makeText(MagicCreateActivity.this, R.string.secure_password_generated, Toast.LENGTH_SHORT).show();
|
||||||
WelcomeActivity.addInviteUri(intent, getIntent());
|
StartConversationActivity.addInviteUri(intent, getIntent());
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
|
@ -15,8 +15,6 @@ import eu.siacs.conversations.utils.XmppUri;
|
||||||
|
|
||||||
public class WelcomeActivity extends XmppActivity {
|
public class WelcomeActivity extends XmppActivity {
|
||||||
|
|
||||||
public static final String EXTRA_INVITE_URI = "eu.siacs.conversations.invite_uri";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void refreshUiReal() {
|
protected void refreshUiReal() {
|
||||||
|
|
||||||
|
@ -80,19 +78,7 @@ public class WelcomeActivity extends XmppActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addInviteUri(Intent intent) {
|
public void addInviteUri(Intent intent) {
|
||||||
addInviteUri(intent, getIntent());
|
StartConversationActivity.addInviteUri(intent, getIntent());
|
||||||
}
|
|
||||||
|
|
||||||
public static void addInviteUri(Intent intent, XmppUri uri) {
|
|
||||||
if (uri.isJidValid()) {
|
|
||||||
intent.putExtra(EXTRA_INVITE_URI, uri.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addInviteUri(Intent to, Intent from) {
|
|
||||||
if (from != null && from.hasExtra(EXTRA_INVITE_URI)) {
|
|
||||||
to.putExtra(EXTRA_INVITE_URI, from.getStringExtra(EXTRA_INVITE_URI));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void launch(AppCompatActivity activity) {
|
public static void launch(AppCompatActivity activity) {
|
|
@ -0,0 +1,47 @@
|
||||||
|
package eu.siacs.conversations.utils;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
|
||||||
|
import eu.siacs.conversations.Config;
|
||||||
|
import eu.siacs.conversations.entities.Account;
|
||||||
|
import eu.siacs.conversations.services.XmppConnectionService;
|
||||||
|
import eu.siacs.conversations.ui.ConversationsActivity;
|
||||||
|
import eu.siacs.conversations.ui.EditAccountActivity;
|
||||||
|
import eu.siacs.conversations.ui.ManageAccountActivity;
|
||||||
|
import eu.siacs.conversations.ui.StartConversationActivity;
|
||||||
|
import eu.siacs.conversations.ui.WelcomeActivity;
|
||||||
|
|
||||||
|
public class SignupUtils {
|
||||||
|
|
||||||
|
public static Intent getSignUpIntent(final Activity activity) {
|
||||||
|
Intent intent = new Intent(activity, WelcomeActivity.class);
|
||||||
|
StartConversationActivity.addInviteUri(intent, activity.getIntent());
|
||||||
|
return intent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Intent getRedirectionIntent(final ConversationsActivity activity) {
|
||||||
|
final XmppConnectionService service = activity.xmppConnectionService;
|
||||||
|
Account pendingAccount = AccountUtils.getPendingAccount(service);
|
||||||
|
Intent intent;
|
||||||
|
if (pendingAccount != null) {
|
||||||
|
intent = new Intent(activity, EditAccountActivity.class);
|
||||||
|
intent.putExtra("jid", pendingAccount.getJid().asBareJid().toString());
|
||||||
|
} else {
|
||||||
|
if (service.getAccounts().size() == 0) {
|
||||||
|
if (Config.X509_VERIFICATION) {
|
||||||
|
intent = new Intent(activity, ManageAccountActivity.class);
|
||||||
|
} else if (Config.MAGIC_CREATE_DOMAIN != null) {
|
||||||
|
intent = getSignUpIntent(activity);
|
||||||
|
} else {
|
||||||
|
intent = new Intent(activity, EditAccountActivity.class);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
intent = new Intent(activity, StartConversationActivity.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intent.putExtra("init", true);
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
|
return intent;
|
||||||
|
}
|
||||||
|
}
|
|
@ -147,14 +147,6 @@
|
||||||
<action android:name="android.intent.action.VIEW"/>
|
<action android:name="android.intent.action.VIEW"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
|
||||||
android:name=".ui.WelcomeActivity"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:launchMode="singleTask"/>
|
|
||||||
<activity
|
|
||||||
android:name=".ui.MagicCreateActivity"
|
|
||||||
android:label="@string/create_account"
|
|
||||||
android:launchMode="singleTask"/>
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.SettingsActivity"
|
android:name=".ui.SettingsActivity"
|
||||||
android:label="@string/title_activity_settings">
|
android:label="@string/title_activity_settings">
|
||||||
|
@ -172,10 +164,6 @@
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.ChangePasswordActivity"
|
android:name=".ui.ChangePasswordActivity"
|
||||||
android:label="@string/change_password_on_server"/>
|
android:label="@string/change_password_on_server"/>
|
||||||
<activity
|
|
||||||
android:name=".ui.ManageAccountActivity"
|
|
||||||
android:label="@string/title_activity_manage_accounts"
|
|
||||||
android:launchMode="singleTask"/>
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.ShareViaAccountActivity"
|
android:name=".ui.ShareViaAccountActivity"
|
||||||
android:label="@string/title_activity_share_via_account"
|
android:label="@string/title_activity_share_via_account"
|
||||||
|
|
|
@ -56,8 +56,9 @@ import eu.siacs.conversations.entities.Conversational;
|
||||||
import eu.siacs.conversations.entities.Message;
|
import eu.siacs.conversations.entities.Message;
|
||||||
import eu.siacs.conversations.persistance.FileBackend;
|
import eu.siacs.conversations.persistance.FileBackend;
|
||||||
import eu.siacs.conversations.ui.ConversationsActivity;
|
import eu.siacs.conversations.ui.ConversationsActivity;
|
||||||
import eu.siacs.conversations.ui.ManageAccountActivity;
|
import eu.siacs.conversations.ui.EditAccountActivity;
|
||||||
import eu.siacs.conversations.ui.TimePreference;
|
import eu.siacs.conversations.ui.TimePreference;
|
||||||
|
import eu.siacs.conversations.utils.AccountUtils;
|
||||||
import eu.siacs.conversations.utils.Compatibility;
|
import eu.siacs.conversations.utils.Compatibility;
|
||||||
import eu.siacs.conversations.utils.GeoHelper;
|
import eu.siacs.conversations.utils.GeoHelper;
|
||||||
import eu.siacs.conversations.utils.UIHelper;
|
import eu.siacs.conversations.utils.UIHelper;
|
||||||
|
@ -923,10 +924,14 @@ public class NotificationService {
|
||||||
mBuilder.setLocalOnly(true);
|
mBuilder.setLocalOnly(true);
|
||||||
}
|
}
|
||||||
mBuilder.setPriority(Notification.PRIORITY_LOW);
|
mBuilder.setPriority(Notification.PRIORITY_LOW);
|
||||||
mBuilder.setContentIntent(PendingIntent.getActivity(mXmppConnectionService,
|
final Intent intent;
|
||||||
145,
|
if (AccountUtils.MANAGE_ACCOUNT_ACTIVITY != null) {
|
||||||
new Intent(mXmppConnectionService, ManageAccountActivity.class),
|
intent = new Intent(mXmppConnectionService, AccountUtils.MANAGE_ACCOUNT_ACTIVITY);
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT));
|
} else {
|
||||||
|
intent = new Intent(mXmppConnectionService, EditAccountActivity.class);
|
||||||
|
intent.putExtra("jid", errors.get(0).getJid().asBareJid().toEscapedString());
|
||||||
|
}
|
||||||
|
mBuilder.setContentIntent(PendingIntent.getActivity(mXmppConnectionService,145, intent, PendingIntent.FLAG_UPDATE_CURRENT));
|
||||||
if (Compatibility.runsTwentySix()) {
|
if (Compatibility.runsTwentySix()) {
|
||||||
mBuilder.setChannelId("error");
|
mBuilder.setChannelId("error");
|
||||||
}
|
}
|
||||||
|
|
|
@ -3903,18 +3903,6 @@ public class XmppConnectionService extends Service {
|
||||||
return mPushManagementService;
|
return mPushManagementService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Account getPendingAccount() {
|
|
||||||
Account pending = null;
|
|
||||||
for (Account account : getAccounts()) {
|
|
||||||
if (!account.isOptionSet(Account.OPTION_LOGGED_IN_SUCCESSFULLY)) {
|
|
||||||
pending = account;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return pending;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void changeStatus(Account account, PresenceTemplate template, String signature) {
|
public void changeStatus(Account account, PresenceTemplate template, String signature) {
|
||||||
if (!template.getStatusMessage().isEmpty()) {
|
if (!template.getStatusMessage().isEmpty()) {
|
||||||
databaseBackend.insertPresenceTemplate(template);
|
databaseBackend.insertPresenceTemplate(template);
|
||||||
|
|
|
@ -78,6 +78,7 @@ import eu.siacs.conversations.ui.util.MenuDoubleTabUtil;
|
||||||
import eu.siacs.conversations.ui.util.PendingItem;
|
import eu.siacs.conversations.ui.util.PendingItem;
|
||||||
import eu.siacs.conversations.utils.EmojiWrapper;
|
import eu.siacs.conversations.utils.EmojiWrapper;
|
||||||
import eu.siacs.conversations.utils.ExceptionHelper;
|
import eu.siacs.conversations.utils.ExceptionHelper;
|
||||||
|
import eu.siacs.conversations.utils.SignupUtils;
|
||||||
import eu.siacs.conversations.utils.XmppUri;
|
import eu.siacs.conversations.utils.XmppUri;
|
||||||
import eu.siacs.conversations.xmpp.OnUpdateBlocklist;
|
import eu.siacs.conversations.xmpp.OnUpdateBlocklist;
|
||||||
import rocks.xmpp.addr.Jid;
|
import rocks.xmpp.addr.Jid;
|
||||||
|
@ -177,7 +178,10 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
|
||||||
}
|
}
|
||||||
boolean isConversationsListEmpty = xmppConnectionService.isConversationsListEmpty(ignore);
|
boolean isConversationsListEmpty = xmppConnectionService.isConversationsListEmpty(ignore);
|
||||||
if (isConversationsListEmpty && mRedirectInProcess.compareAndSet(false, true)) {
|
if (isConversationsListEmpty && mRedirectInProcess.compareAndSet(false, true)) {
|
||||||
final Intent intent = getRedirectionIntent(noAnimation);
|
final Intent intent = SignupUtils.getRedirectionIntent(this);
|
||||||
|
if (noAnimation) {
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
|
||||||
|
}
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
if (noAnimation) {
|
if (noAnimation) {
|
||||||
|
@ -188,34 +192,6 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
|
||||||
return mRedirectInProcess.get();
|
return mRedirectInProcess.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Intent getRedirectionIntent(boolean noAnimation) {
|
|
||||||
Account pendingAccount = xmppConnectionService.getPendingAccount();
|
|
||||||
Intent intent;
|
|
||||||
if (pendingAccount != null) {
|
|
||||||
intent = new Intent(this, EditAccountActivity.class);
|
|
||||||
intent.putExtra("jid", pendingAccount.getJid().asBareJid().toString());
|
|
||||||
} else {
|
|
||||||
if (xmppConnectionService.getAccounts().size() == 0) {
|
|
||||||
if (Config.X509_VERIFICATION) {
|
|
||||||
intent = new Intent(this, ManageAccountActivity.class);
|
|
||||||
} else if (Config.MAGIC_CREATE_DOMAIN != null) {
|
|
||||||
intent = new Intent(this, WelcomeActivity.class);
|
|
||||||
WelcomeActivity.addInviteUri(intent, getIntent());
|
|
||||||
} else {
|
|
||||||
intent = new Intent(this, EditAccountActivity.class);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
intent = new Intent(this, StartConversationActivity.class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
intent.putExtra("init", true);
|
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
|
||||||
if (noAnimation) {
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
|
|
||||||
}
|
|
||||||
return intent;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showDialogsIfMainIsOverview() {
|
private void showDialogsIfMainIsOverview() {
|
||||||
if (xmppConnectionService == null) {
|
if (xmppConnectionService == null) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -67,6 +67,7 @@ import eu.siacs.conversations.ui.util.MenuDoubleTabUtil;
|
||||||
import eu.siacs.conversations.ui.util.PendingItem;
|
import eu.siacs.conversations.ui.util.PendingItem;
|
||||||
import eu.siacs.conversations.ui.util.SoftKeyboardUtils;
|
import eu.siacs.conversations.ui.util.SoftKeyboardUtils;
|
||||||
import eu.siacs.conversations.utils.CryptoHelper;
|
import eu.siacs.conversations.utils.CryptoHelper;
|
||||||
|
import eu.siacs.conversations.utils.SignupUtils;
|
||||||
import eu.siacs.conversations.utils.UIHelper;
|
import eu.siacs.conversations.utils.UIHelper;
|
||||||
import eu.siacs.conversations.utils.XmppUri;
|
import eu.siacs.conversations.utils.XmppUri;
|
||||||
import eu.siacs.conversations.xml.Element;
|
import eu.siacs.conversations.xml.Element;
|
||||||
|
@ -279,8 +280,9 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
|
||||||
if (mAccount != null
|
if (mAccount != null
|
||||||
&& mAccount.getStatus() != Account.State.ONLINE
|
&& mAccount.getStatus() != Account.State.ONLINE
|
||||||
&& mFetchingAvatar) {
|
&& mFetchingAvatar) {
|
||||||
//TODO: maybe better redirect to StartConversationActivity
|
Intent intent = new Intent(this, StartConversationActivity.class);
|
||||||
startActivity(new Intent(this, ManageAccountActivity.class));
|
StartConversationActivity.addInviteUri(intent, getIntent());
|
||||||
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
} else if (mInitMode && mAccount != null && mAccount.getStatus() == Account.State.ONLINE) {
|
} else if (mInitMode && mAccount != null && mAccount.getStatus() == Account.State.ONLINE) {
|
||||||
if (!mFetchingAvatar) {
|
if (!mFetchingAvatar) {
|
||||||
|
@ -312,8 +314,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xmppConnectionService.getAccounts().size() == 0 && Config.MAGIC_CREATE_DOMAIN != null) {
|
if (xmppConnectionService.getAccounts().size() == 0 && Config.MAGIC_CREATE_DOMAIN != null) {
|
||||||
Intent intent = new Intent(EditAccountActivity.this, WelcomeActivity.class);
|
Intent intent = SignupUtils.getSignUpIntent(this);
|
||||||
WelcomeActivity.addInviteUri(intent, getIntent());
|
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -406,7 +407,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
|
||||||
if (wasFirstAccount) {
|
if (wasFirstAccount) {
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
}
|
}
|
||||||
WelcomeActivity.addInviteUri(intent, getIntent());
|
StartConversationActivity.addInviteUri(intent, getIntent());
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
});
|
});
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class PublishProfilePictureActivity extends XmppActivity implements XmppC
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
if (mInitialAccountSetup) {
|
if (mInitialAccountSetup) {
|
||||||
Intent intent = new Intent(getApplicationContext(), StartConversationActivity.class);
|
Intent intent = new Intent(getApplicationContext(), StartConversationActivity.class);
|
||||||
WelcomeActivity.addInviteUri(intent, getIntent());
|
StartConversationActivity.addInviteUri(intent, getIntent());
|
||||||
intent.putExtra("init", true);
|
intent.putExtra("init", true);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ public class PublishProfilePictureActivity extends XmppActivity implements XmppC
|
||||||
if (mInitialAccountSetup) {
|
if (mInitialAccountSetup) {
|
||||||
Intent intent = new Intent(getApplicationContext(), StartConversationActivity.class);
|
Intent intent = new Intent(getApplicationContext(), StartConversationActivity.class);
|
||||||
if (xmppConnectionService != null && xmppConnectionService.getAccounts().size() == 1) {
|
if (xmppConnectionService != null && xmppConnectionService.getAccounts().size() == 1) {
|
||||||
WelcomeActivity.addInviteUri(intent, getIntent());
|
StartConversationActivity.addInviteUri(intent, getIntent());
|
||||||
intent.putExtra("init", true);
|
intent.putExtra("init", true);
|
||||||
}
|
}
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
|
@ -82,6 +82,8 @@ import rocks.xmpp.addr.Jid;
|
||||||
|
|
||||||
public class StartConversationActivity extends XmppActivity implements XmppConnectionService.OnConversationUpdate, OnRosterUpdate, OnUpdateBlocklist, CreateConferenceDialog.CreateConferenceDialogListener, JoinConferenceDialog.JoinConferenceDialogListener {
|
public class StartConversationActivity extends XmppActivity implements XmppConnectionService.OnConversationUpdate, OnRosterUpdate, OnUpdateBlocklist, CreateConferenceDialog.CreateConferenceDialogListener, JoinConferenceDialog.JoinConferenceDialogListener {
|
||||||
|
|
||||||
|
public static final String EXTRA_INVITE_URI = "eu.siacs.conversations.invite_uri";
|
||||||
|
|
||||||
private final int REQUEST_SYNC_CONTACTS = 0x28cf;
|
private final int REQUEST_SYNC_CONTACTS = 0x28cf;
|
||||||
private final int REQUEST_CREATE_CONFERENCE = 0x39da;
|
private final int REQUEST_CREATE_CONFERENCE = 0x39da;
|
||||||
private final PendingItem<Intent> pendingViewIntent = new PendingItem<>();
|
private final PendingItem<Intent> pendingViewIntent = new PendingItem<>();
|
||||||
|
@ -236,7 +238,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isViewIntent(final Intent i) {
|
private static boolean isViewIntent(final Intent i) {
|
||||||
return i != null && (Intent.ACTION_VIEW.equals(i.getAction()) || Intent.ACTION_SENDTO.equals(i.getAction()) || i.hasExtra(WelcomeActivity.EXTRA_INVITE_URI));
|
return i != null && (Intent.ACTION_VIEW.equals(i.getAction()) || Intent.ACTION_SENDTO.equals(i.getAction()) || i.hasExtra(EXTRA_INVITE_URI));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void hideToast() {
|
protected void hideToast() {
|
||||||
|
@ -749,7 +751,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean processViewIntent(@NonNull Intent intent) {
|
protected boolean processViewIntent(@NonNull Intent intent) {
|
||||||
final String inviteUri = intent.getStringExtra(WelcomeActivity.EXTRA_INVITE_URI);
|
final String inviteUri = intent.getStringExtra(EXTRA_INVITE_URI);
|
||||||
if (inviteUri != null) {
|
if (inviteUri != null) {
|
||||||
Invite invite = new Invite(inviteUri);
|
Invite invite = new Invite(inviteUri);
|
||||||
if (invite.isJidValid()) {
|
if (invite.isJidValid()) {
|
||||||
|
@ -1165,6 +1167,12 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void addInviteUri(Intent to, Intent from) {
|
||||||
|
if (from != null && from.hasExtra(EXTRA_INVITE_URI)) {
|
||||||
|
to.putExtra(EXTRA_INVITE_URI, from.getStringExtra(EXTRA_INVITE_URI));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class Invite extends XmppUri {
|
private class Invite extends XmppUri {
|
||||||
|
|
||||||
public String account;
|
public String account;
|
||||||
|
|
|
@ -2,177 +2,194 @@ package eu.siacs.conversations.ui;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v13.app.ActivityCompat;
|
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.content.Intent;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import eu.siacs.conversations.Config;
|
|
||||||
import eu.siacs.conversations.R;
|
import eu.siacs.conversations.R;
|
||||||
import eu.siacs.conversations.persistance.DatabaseBackend;
|
import eu.siacs.conversations.persistance.DatabaseBackend;
|
||||||
|
import eu.siacs.conversations.utils.SignupUtils;
|
||||||
import eu.siacs.conversations.utils.XmppUri;
|
import eu.siacs.conversations.utils.XmppUri;
|
||||||
import rocks.xmpp.addr.Jid;
|
import rocks.xmpp.addr.Jid;
|
||||||
|
|
||||||
public class UriHandlerActivity extends AppCompatActivity {
|
public class UriHandlerActivity extends AppCompatActivity {
|
||||||
|
|
||||||
public static final String ACTION_SCAN_QR_CODE = "scan_qr_code";
|
public static final String ACTION_SCAN_QR_CODE = "scan_qr_code";
|
||||||
private static final int REQUEST_SCAN_QR_CODE = 0x1234;
|
private static final int REQUEST_SCAN_QR_CODE = 0x1234;
|
||||||
private static final int REQUEST_CAMERA_PERMISSIONS_TO_SCAN = 0x6789;
|
private static final int REQUEST_CAMERA_PERMISSIONS_TO_SCAN = 0x6789;
|
||||||
|
|
||||||
private boolean handled = false;
|
private boolean handled = false;
|
||||||
|
|
||||||
public static void scan(Activity activity) {
|
public static void scan(Activity activity) {
|
||||||
if (ContextCompat.checkSelfPermission(activity, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M || ContextCompat.checkSelfPermission(activity, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {
|
||||||
Intent intent = new Intent(activity, UriHandlerActivity.class);
|
Intent intent = new Intent(activity, UriHandlerActivity.class);
|
||||||
intent.setAction(UriHandlerActivity.ACTION_SCAN_QR_CODE);
|
intent.setAction(UriHandlerActivity.ACTION_SCAN_QR_CODE);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
|
||||||
activity.startActivity(intent);
|
activity.startActivity(intent);
|
||||||
} else {
|
} else {
|
||||||
ActivityCompat.requestPermissions(activity, new String[]{Manifest.permission.CAMERA}, REQUEST_CAMERA_PERMISSIONS_TO_SCAN);
|
activity.requestPermissions(new String[]{Manifest.permission.CAMERA}, REQUEST_CAMERA_PERMISSIONS_TO_SCAN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onRequestPermissionResult(Activity activity, int requestCode, int[] grantResults) {
|
public static void onRequestPermissionResult(Activity activity, int requestCode, int[] grantResults) {
|
||||||
if (requestCode != REQUEST_CAMERA_PERMISSIONS_TO_SCAN) {
|
if (requestCode != REQUEST_CAMERA_PERMISSIONS_TO_SCAN) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (grantResults.length > 0) {
|
if (grantResults.length > 0) {
|
||||||
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||||
scan(activity);
|
scan(activity);
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(activity, R.string.qr_code_scanner_needs_access_to_camera, Toast.LENGTH_SHORT).show();
|
Toast.makeText(activity, R.string.qr_code_scanner_needs_access_to_camera, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
this.handled = savedInstanceState != null && savedInstanceState.getBoolean("handled", false);
|
this.handled = savedInstanceState != null && savedInstanceState.getBoolean("handled", false);
|
||||||
getLayoutInflater().inflate(R.layout.toolbar, findViewById(android.R.id.content));
|
getLayoutInflater().inflate(R.layout.toolbar, findViewById(android.R.id.content));
|
||||||
setSupportActionBar(findViewById(R.id.toolbar));
|
setSupportActionBar(findViewById(R.id.toolbar));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
handleIntent(getIntent());
|
handleIntent(getIntent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(Bundle savedInstanceState) {
|
public void onSaveInstanceState(Bundle savedInstanceState) {
|
||||||
savedInstanceState.putBoolean("handled", this.handled);
|
savedInstanceState.putBoolean("handled", this.handled);
|
||||||
super.onSaveInstanceState(savedInstanceState);
|
super.onSaveInstanceState(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNewIntent(Intent intent) {
|
public void onNewIntent(Intent intent) {
|
||||||
handleIntent(intent);
|
handleIntent(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleUri(Uri uri) {
|
private void handleUri(Uri uri) {
|
||||||
handleUri(uri, false);
|
handleUri(uri, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleUri(Uri uri, final boolean scanned) {
|
private void handleUri(Uri uri, final boolean scanned) {
|
||||||
final Intent intent;
|
final Intent intent;
|
||||||
final XmppUri xmppUri = new XmppUri(uri);
|
final XmppUri xmppUri = new XmppUri(uri);
|
||||||
final List<Jid> accounts = DatabaseBackend.getInstance(this).getAccountJids(); //TODO only look at enabled accounts
|
final List<Jid> accounts = DatabaseBackend.getInstance(this).getAccountJids(); //TODO only look at enabled accounts
|
||||||
|
|
||||||
if (!xmppUri.isJidValid()) {
|
if (accounts.size() == 0) {
|
||||||
Toast.makeText(this, R.string.invalid_jid, Toast.LENGTH_SHORT).show();
|
if (xmppUri.isJidValid()) {
|
||||||
return;
|
intent = SignupUtils.getSignUpIntent(this);
|
||||||
}
|
startActivity(intent);
|
||||||
|
} else {
|
||||||
|
Toast.makeText(this, R.string.invalid_jid, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
if (accounts.size() == 0 && Config.MAGIC_CREATE_DOMAIN != null) {
|
return;
|
||||||
intent = new Intent(getApplicationContext(), WelcomeActivity.class);
|
}
|
||||||
WelcomeActivity.addInviteUri(intent, xmppUri);
|
|
||||||
startActivity(intent);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (xmppUri.isAction(XmppUri.ACTION_MESSAGE)) {
|
if (xmppUri.isAction(XmppUri.ACTION_MESSAGE)) {
|
||||||
final Jid jid = xmppUri.getJid();
|
|
||||||
final String body = xmppUri.getBody();
|
|
||||||
|
|
||||||
if (jid != null) {
|
final Jid jid = xmppUri.getJid();
|
||||||
intent = new Intent(getApplicationContext(), ShareViaAccountActivity.class);
|
final String body = xmppUri.getBody();
|
||||||
intent.putExtra(ShareViaAccountActivity.EXTRA_CONTACT, jid.toString());
|
|
||||||
intent.putExtra(ShareViaAccountActivity.EXTRA_BODY, body);
|
|
||||||
} else {
|
|
||||||
intent = new Intent(getApplicationContext(), ShareWithActivity.class);
|
|
||||||
intent.setAction(Intent.ACTION_SEND);
|
|
||||||
intent.setType("text/plain");
|
|
||||||
intent.putExtra(Intent.EXTRA_TEXT, body);
|
|
||||||
}
|
|
||||||
} else if (accounts.contains(xmppUri.getJid())) {
|
|
||||||
intent = new Intent(getApplicationContext(), EditAccountActivity.class);
|
|
||||||
intent.setAction(Intent.ACTION_VIEW);
|
|
||||||
intent.putExtra("jid", xmppUri.getJid().asBareJid().toString());
|
|
||||||
intent.setData(uri);
|
|
||||||
intent.putExtra("scanned", scanned);
|
|
||||||
} else {
|
|
||||||
intent = new Intent(getApplicationContext(), StartConversationActivity.class);
|
|
||||||
intent.setAction(Intent.ACTION_VIEW);
|
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
|
||||||
intent.putExtra("scanned", scanned);
|
|
||||||
intent.setData(uri);
|
|
||||||
}
|
|
||||||
|
|
||||||
startActivity(intent);
|
if (jid != null) {
|
||||||
}
|
Class clazz;
|
||||||
|
try {
|
||||||
|
clazz = Class.forName("eu.siacs.conversations.ui.ShareViaAccountActivity");
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
clazz = null;
|
||||||
|
|
||||||
private void handleIntent(Intent data) {
|
}
|
||||||
if (handled) {
|
if (clazz != null) {
|
||||||
return;
|
intent = new Intent(this, clazz);
|
||||||
}
|
intent.putExtra("contact", jid.toEscapedString());
|
||||||
if (data == null || data.getAction() == null) {
|
intent.putExtra("body", body);
|
||||||
finish();
|
} else {
|
||||||
return;
|
intent = new Intent(this, StartConversationActivity.class);
|
||||||
}
|
intent.setData(uri);
|
||||||
|
intent.putExtra("account", accounts.get(0).toEscapedString());
|
||||||
|
}
|
||||||
|
|
||||||
handled = true;
|
} else {
|
||||||
|
intent = new Intent(this, ShareWithActivity.class);
|
||||||
|
intent.setAction(Intent.ACTION_SEND);
|
||||||
|
intent.setType("text/plain");
|
||||||
|
intent.putExtra(Intent.EXTRA_TEXT, body);
|
||||||
|
}
|
||||||
|
} else if (accounts.contains(xmppUri.getJid())) {
|
||||||
|
intent = new Intent(getApplicationContext(), EditAccountActivity.class);
|
||||||
|
intent.setAction(Intent.ACTION_VIEW);
|
||||||
|
intent.putExtra("jid", xmppUri.getJid().asBareJid().toString());
|
||||||
|
intent.setData(uri);
|
||||||
|
intent.putExtra("scanned", scanned);
|
||||||
|
} else if (xmppUri.isJidValid()) {
|
||||||
|
intent = new Intent(getApplicationContext(), StartConversationActivity.class);
|
||||||
|
intent.setAction(Intent.ACTION_VIEW);
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
|
intent.putExtra("scanned", scanned);
|
||||||
|
intent.setData(uri);
|
||||||
|
} else {
|
||||||
|
Toast.makeText(this, R.string.invalid_jid, Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (data.getAction()) {
|
startActivity(intent);
|
||||||
case Intent.ACTION_VIEW:
|
}
|
||||||
case Intent.ACTION_SENDTO:
|
|
||||||
handleUri(data.getData());
|
|
||||||
break;
|
|
||||||
case ACTION_SCAN_QR_CODE:
|
|
||||||
Intent intent = new Intent(this, ScanActivity.class);
|
|
||||||
startActivityForResult(intent, REQUEST_SCAN_QR_CODE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
finish();
|
private void handleIntent(Intent data) {
|
||||||
}
|
if (handled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (data == null || data.getAction() == null) {
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
private static final Pattern VCARD_XMPP_PATTERN = Pattern.compile("\nIMPP([^:]*):(xmpp:.+)\n");
|
handled = true;
|
||||||
|
|
||||||
@Override
|
switch (data.getAction()) {
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
case Intent.ACTION_VIEW:
|
||||||
super.onActivityResult(requestCode, requestCode, intent);
|
case Intent.ACTION_SENDTO:
|
||||||
if (requestCode == REQUEST_SCAN_QR_CODE && resultCode == RESULT_OK) {
|
handleUri(data.getData());
|
||||||
String result = intent.getStringExtra(ScanActivity.INTENT_EXTRA_RESULT);
|
break;
|
||||||
if (result != null) {
|
case ACTION_SCAN_QR_CODE:
|
||||||
if (result.startsWith("BEGIN:VCARD\n")) {
|
Intent intent = new Intent(this, ScanActivity.class);
|
||||||
Matcher matcher = VCARD_XMPP_PATTERN.matcher(result);
|
startActivityForResult(intent, REQUEST_SCAN_QR_CODE);
|
||||||
if (matcher.find()) {
|
return;
|
||||||
result = matcher.group(2);
|
}
|
||||||
}
|
|
||||||
}
|
finish();
|
||||||
Uri uri = Uri.parse(result);
|
}
|
||||||
handleUri(uri, true);
|
|
||||||
}
|
private static final Pattern VCARD_XMPP_PATTERN = Pattern.compile("\nIMPP([^:]*):(xmpp:.+)\n");
|
||||||
}
|
|
||||||
finish();
|
@Override
|
||||||
}
|
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||||
|
super.onActivityResult(requestCode, requestCode, intent);
|
||||||
|
if (requestCode == REQUEST_SCAN_QR_CODE && resultCode == RESULT_OK) {
|
||||||
|
String result = intent.getStringExtra(ScanActivity.INTENT_EXTRA_RESULT);
|
||||||
|
if (result != null) {
|
||||||
|
if (result.startsWith("BEGIN:VCARD\n")) {
|
||||||
|
Matcher matcher = VCARD_XMPP_PATTERN.matcher(result);
|
||||||
|
if (matcher.find()) {
|
||||||
|
result = matcher.group(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Uri uri = Uri.parse(result);
|
||||||
|
handleUri(uri, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finish();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -73,6 +73,7 @@ import eu.siacs.conversations.services.XmppConnectionService.XmppConnectionBinde
|
||||||
import eu.siacs.conversations.ui.util.MenuDoubleTabUtil;
|
import eu.siacs.conversations.ui.util.MenuDoubleTabUtil;
|
||||||
import eu.siacs.conversations.ui.util.PresenceSelector;
|
import eu.siacs.conversations.ui.util.PresenceSelector;
|
||||||
import eu.siacs.conversations.ui.util.SoftKeyboardUtils;
|
import eu.siacs.conversations.ui.util.SoftKeyboardUtils;
|
||||||
|
import eu.siacs.conversations.utils.AccountUtils;
|
||||||
import eu.siacs.conversations.utils.ExceptionHelper;
|
import eu.siacs.conversations.utils.ExceptionHelper;
|
||||||
import eu.siacs.conversations.utils.ThemeHelper;
|
import eu.siacs.conversations.utils.ThemeHelper;
|
||||||
import eu.siacs.conversations.xmpp.OnKeyStatusUpdated;
|
import eu.siacs.conversations.xmpp.OnKeyStatusUpdated;
|
||||||
|
@ -338,7 +339,7 @@ public abstract class XmppActivity extends ActionBarActivity {
|
||||||
startActivity(new Intent(this, SettingsActivity.class));
|
startActivity(new Intent(this, SettingsActivity.class));
|
||||||
break;
|
break;
|
||||||
case R.id.action_accounts:
|
case R.id.action_accounts:
|
||||||
startActivity(new Intent(this, ManageAccountActivity.class));
|
AccountUtils.launchManageAccounts(this);
|
||||||
break;
|
break;
|
||||||
case android.R.id.home:
|
case android.R.id.home:
|
||||||
finish();
|
finish();
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
package eu.siacs.conversations.utils;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import eu.siacs.conversations.R;
|
||||||
|
import eu.siacs.conversations.entities.Account;
|
||||||
|
import eu.siacs.conversations.services.XmppConnectionService;
|
||||||
|
|
||||||
|
public class AccountUtils {
|
||||||
|
|
||||||
|
public static final Class MANAGE_ACCOUNT_ACTIVITY;
|
||||||
|
|
||||||
|
static {
|
||||||
|
MANAGE_ACCOUNT_ACTIVITY = getManageAccountActivityClass();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static Account getFirstEnabled(XmppConnectionService service) {
|
||||||
|
final List<Account> accounts = service.getAccounts();
|
||||||
|
for(Account account : accounts) {
|
||||||
|
if (!account.isOptionSet(Account.OPTION_DISABLED)) {
|
||||||
|
return account;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Account getPendingAccount(XmppConnectionService service) {
|
||||||
|
Account pending = null;
|
||||||
|
for (Account account : service.getAccounts()) {
|
||||||
|
if (!account.isOptionSet(Account.OPTION_LOGGED_IN_SUCCESSFULLY)) {
|
||||||
|
pending = account;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pending;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void launchManageAccounts(Activity activity) {
|
||||||
|
if (MANAGE_ACCOUNT_ACTIVITY != null) {
|
||||||
|
activity.startActivity(new Intent(activity, MANAGE_ACCOUNT_ACTIVITY));
|
||||||
|
} else {
|
||||||
|
Toast.makeText(activity, R.string.feature_not_implemented, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Class getManageAccountActivityClass() {
|
||||||
|
try {
|
||||||
|
return Class.forName("eu.siacs.conversations.ui.ManageAccountActivity");
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -50,18 +50,10 @@ public class ExceptionHelper {
|
||||||
if (neverSend || Config.BUG_REPORTS == null) {
|
if (neverSend || Config.BUG_REPORTS == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
List<Account> accounts = service.getAccounts();
|
final Account account = AccountUtils.getFirstEnabled(service);
|
||||||
Account account = null;
|
|
||||||
for (int i = 0; i < accounts.size(); ++i) {
|
|
||||||
if (accounts.get(i).isEnabled()) {
|
|
||||||
account = accounts.get(i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (account == null) {
|
if (account == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Account finalAccount = account;
|
|
||||||
FileInputStream file = activity.openFileInput(FILENAME);
|
FileInputStream file = activity.openFileInput(FILENAME);
|
||||||
InputStreamReader inputStreamReader = new InputStreamReader(file);
|
InputStreamReader inputStreamReader = new InputStreamReader(file);
|
||||||
BufferedReader stacktrace = new BufferedReader(inputStreamReader);
|
BufferedReader stacktrace = new BufferedReader(inputStreamReader);
|
||||||
|
@ -93,8 +85,8 @@ public class ExceptionHelper {
|
||||||
builder.setMessage(activity.getText(R.string.crash_report_message));
|
builder.setMessage(activity.getText(R.string.crash_report_message));
|
||||||
builder.setPositiveButton(activity.getText(R.string.send_now), (dialog, which) -> {
|
builder.setPositiveButton(activity.getText(R.string.send_now), (dialog, which) -> {
|
||||||
|
|
||||||
Log.d(Config.LOGTAG, "using account=" + finalAccount.getJid().asBareJid() + " to send in stack trace");
|
Log.d(Config.LOGTAG, "using account=" + account.getJid().asBareJid() + " to send in stack trace");
|
||||||
Conversation conversation = service.findOrCreateConversation(finalAccount, Config.BUG_REPORTS, false, true);
|
Conversation conversation = service.findOrCreateConversation(account, Config.BUG_REPORTS, false, true);
|
||||||
Message message = new Message(conversation, report.toString(), Message.ENCRYPTION_NONE);
|
Message message = new Message(conversation, report.toString(), Message.ENCRYPTION_NONE);
|
||||||
service.sendMessage(message);
|
service.sendMessage(message);
|
||||||
});
|
});
|
||||||
|
|
|
@ -180,7 +180,7 @@ public class XmppUri {
|
||||||
|
|
||||||
public Jid getJid() {
|
public Jid getJid() {
|
||||||
try {
|
try {
|
||||||
return this.jid == null ? null : Jid.of(this.jid.toLowerCase());
|
return this.jid == null ? null : Jid.of(this.jid);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -748,4 +748,5 @@
|
||||||
<string name="video_720p">High (720p)</string>
|
<string name="video_720p">High (720p)</string>
|
||||||
<string name="cancelled">cancelled</string>
|
<string name="cancelled">cancelled</string>
|
||||||
<string name="already_drafting_message">You are already drafting a message.</string>
|
<string name="already_drafting_message">You are already drafting a message.</string>
|
||||||
|
<string name="feature_not_implemented">Feature not implemented</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package eu.siacs.conversations.utils;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
|
||||||
|
import eu.siacs.conversations.ui.ConversationsActivity;
|
||||||
|
|
||||||
|
public class SignupUtils {
|
||||||
|
|
||||||
|
public static Intent getSignUpIntent(Activity activity) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Intent getRedirectionIntent(ConversationsActivity activity) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue