open manage account + certificate chooser when cbe mode is enabled
This commit is contained in:
parent
53125dbccc
commit
569b9f4e66
|
@ -4,33 +4,35 @@
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||||
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
<uses-permission android:name="android.permission.READ_CONTACTS"/>
|
||||||
<uses-permission android:name="android.permission.READ_PROFILE" />
|
<uses-permission android:name="android.permission.READ_PROFILE"/>
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||||
<uses-permission android:name="android.permission.NFC" />
|
<uses-permission android:name="android.permission.NFC"/>
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove" />
|
<uses-permission
|
||||||
|
android:name="android.permission.READ_PHONE_STATE"
|
||||||
|
tools:node="remove"/>
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/ConversationsTheme"
|
android:theme="@style/ConversationsTheme"
|
||||||
tools:replace="android:label" >
|
tools:replace="android:label">
|
||||||
<service android:name=".services.XmppConnectionService" />
|
<service android:name=".services.XmppConnectionService"/>
|
||||||
|
|
||||||
<receiver android:name=".services.EventReceiver" >
|
<receiver android:name=".services.EventReceiver">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
<action android:name="android.intent.action.BOOT_COMPLETED"/>
|
||||||
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
|
<action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
|
||||||
<action android:name="android.intent.action.ACTION_SHUTDOWN" />
|
<action android:name="android.intent.action.ACTION_SHUTDOWN"/>
|
||||||
<action android:name="android.media.RINGER_MODE_CHANGED" />
|
<action android:name="android.media.RINGER_MODE_CHANGED"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
|
@ -38,100 +40,102 @@
|
||||||
android:name=".ui.ConversationActivity"
|
android:name=".ui.ConversationActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:windowSoftInputMode="stateHidden" >
|
android:windowSoftInputMode="stateHidden">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.StartConversationActivity"
|
android:name=".ui.StartConversationActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:launchMode="singleTask"
|
android:label="@string/title_activity_start_conversation"
|
||||||
android:label="@string/title_activity_start_conversation" >
|
android:launchMode="singleTask">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.SENDTO" />
|
<action android:name="android.intent.action.SENDTO"/>
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
|
|
||||||
<data android:scheme="imto" />
|
<data android:scheme="imto"/>
|
||||||
<data android:host="jabber" />
|
<data android:host="jabber"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW"/>
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<category android:name="android.intent.category.BROWSABLE"/>
|
||||||
|
|
||||||
<data android:scheme="xmpp" />
|
<data android:scheme="xmpp"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
|
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
|
|
||||||
<data android:scheme="xmpp" />
|
<data android:scheme="xmpp"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.SettingsActivity"
|
android:name=".ui.SettingsActivity"
|
||||||
android:label="@string/title_activity_settings" />
|
android:label="@string/title_activity_settings"/>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.ChooseContactActivity"
|
android:name=".ui.ChooseContactActivity"
|
||||||
android:label="@string/title_activity_choose_contact" />
|
android:label="@string/title_activity_choose_contact"/>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.BlocklistActivity"
|
android:name=".ui.BlocklistActivity"
|
||||||
android:label="@string/title_activity_block_list" />
|
android:label="@string/title_activity_block_list"/>
|
||||||
<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
|
<activity
|
||||||
android:name=".ui.ManageAccountActivity"
|
android:name=".ui.ManageAccountActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/title_activity_manage_accounts" />
|
android:label="@string/title_activity_manage_accounts"
|
||||||
|
android:launchMode="singleTask"/>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.EditAccountActivity"
|
android:name=".ui.EditAccountActivity"
|
||||||
android:windowSoftInputMode="stateHidden|adjustResize" />
|
android:launchMode="singleTask"
|
||||||
|
android:windowSoftInputMode="stateHidden|adjustResize"/>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.ConferenceDetailsActivity"
|
android:name=".ui.ConferenceDetailsActivity"
|
||||||
android:label="@string/title_activity_conference_details"
|
android:label="@string/title_activity_conference_details"
|
||||||
android:windowSoftInputMode="stateHidden" />
|
android:windowSoftInputMode="stateHidden"/>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.ContactDetailsActivity"
|
android:name=".ui.ContactDetailsActivity"
|
||||||
android:label="@string/title_activity_contact_details"
|
android:label="@string/title_activity_contact_details"
|
||||||
android:windowSoftInputMode="stateHidden" />
|
android:windowSoftInputMode="stateHidden"/>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.PublishProfilePictureActivity"
|
android:name=".ui.PublishProfilePictureActivity"
|
||||||
android:label="@string/mgmt_account_publish_avatar"
|
android:label="@string/mgmt_account_publish_avatar"
|
||||||
android:windowSoftInputMode="stateHidden" />
|
android:windowSoftInputMode="stateHidden"/>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.VerifyOTRActivity"
|
android:name=".ui.VerifyOTRActivity"
|
||||||
android:label="@string/verify_otr"
|
android:label="@string/verify_otr"
|
||||||
android:windowSoftInputMode="stateHidden" />
|
android:windowSoftInputMode="stateHidden"/>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.ShareWithActivity"
|
android:name=".ui.ShareWithActivity"
|
||||||
android:label="@string/app_name" >
|
android:label="@string/app_name">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.SEND" />
|
<action android:name="android.intent.action.SEND"/>
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
|
|
||||||
<data android:mimeType="text/plain" />
|
<data android:mimeType="text/plain"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.SEND" />
|
<action android:name="android.intent.action.SEND"/>
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
|
|
||||||
<data android:mimeType="*/*" />
|
<data android:mimeType="*/*"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.SEND_MULTIPLE" />
|
<action android:name="android.intent.action.SEND_MULTIPLE"/>
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
|
|
||||||
<data android:mimeType="image/*" />
|
<data android:mimeType="image/*"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
|
@ -145,12 +149,13 @@
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.AboutActivity"
|
android:name=".ui.AboutActivity"
|
||||||
android:label="@string/title_activity_about"
|
android:label="@string/title_activity_about"
|
||||||
android:parentActivityName=".ui.SettingsActivity" >
|
android:parentActivityName=".ui.SettingsActivity">
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value="eu.siacs.conversations.ui.SettingsActivity" />
|
android:value="eu.siacs.conversations.ui.SettingsActivity"/>
|
||||||
</activity>
|
</activity>
|
||||||
<service android:name=".services.ExportLogsService" />
|
|
||||||
|
<service android:name=".services.ExportLogsService"/>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
|
@ -35,6 +35,7 @@ import net.java.otr4j.session.SessionStatus;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import de.timroes.android.listview.EnhancedListView;
|
import de.timroes.android.listview.EnhancedListView;
|
||||||
import eu.siacs.conversations.Config;
|
import eu.siacs.conversations.Config;
|
||||||
|
@ -105,7 +106,7 @@ public class ConversationActivity extends XmppActivity
|
||||||
private Toast prepareFileToast;
|
private Toast prepareFileToast;
|
||||||
|
|
||||||
private boolean mActivityPaused = false;
|
private boolean mActivityPaused = false;
|
||||||
private boolean mRedirected = true;
|
private AtomicBoolean mRedirected = new AtomicBoolean(false);
|
||||||
|
|
||||||
public Conversation getSelectedConversation() {
|
public Conversation getSelectedConversation() {
|
||||||
return this.mSelectedConversation;
|
return this.mSelectedConversation;
|
||||||
|
@ -631,6 +632,12 @@ public class ConversationActivity extends XmppActivity
|
||||||
this.mConversationFragment.reInit(getSelectedConversation());
|
this.mConversationFragment.reInit(getSelectedConversation());
|
||||||
} else {
|
} else {
|
||||||
setSelectedConversation(null);
|
setSelectedConversation(null);
|
||||||
|
if (mRedirected.compareAndSet(false,true)) {
|
||||||
|
Intent intent = new Intent(this, StartConversationActivity.class);
|
||||||
|
intent.putExtra("init",true);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -985,7 +992,7 @@ public class ConversationActivity extends XmppActivity
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
this.mRedirected = false;
|
this.mRedirected.set(false);
|
||||||
if (this.xmppConnectionServiceBound) {
|
if (this.xmppConnectionServiceBound) {
|
||||||
this.onBackendConnected();
|
this.onBackendConnected();
|
||||||
}
|
}
|
||||||
|
@ -1049,14 +1056,16 @@ public class ConversationActivity extends XmppActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xmppConnectionService.getAccounts().size() == 0) {
|
if (xmppConnectionService.getAccounts().size() == 0) {
|
||||||
if (!mRedirected) {
|
if (mRedirected.compareAndSet(false,true)) {
|
||||||
this.mRedirected = true;
|
if (Config.X509_VERIFICATION) {
|
||||||
|
startActivity(new Intent(this, ManageAccountActivity.class));
|
||||||
|
} else {
|
||||||
startActivity(new Intent(this, EditAccountActivity.class));
|
startActivity(new Intent(this, EditAccountActivity.class));
|
||||||
|
}
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
} else if (conversationList.size() <= 0) {
|
} else if (conversationList.size() <= 0) {
|
||||||
if (!mRedirected) {
|
if (mRedirected.compareAndSet(false,true)) {
|
||||||
this.mRedirected = true;
|
|
||||||
Intent intent = new Intent(this, StartConversationActivity.class);
|
Intent intent = new Intent(this, StartConversationActivity.class);
|
||||||
intent.putExtra("init",true);
|
intent.putExtra("init",true);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
@ -1406,26 +1415,12 @@ public class ConversationActivity extends XmppActivity
|
||||||
@Override
|
@Override
|
||||||
protected void refreshUiReal() {
|
protected void refreshUiReal() {
|
||||||
updateConversationList();
|
updateConversationList();
|
||||||
if (xmppConnectionService != null && xmppConnectionService.getAccounts().size() == 0) {
|
if (conversationList.size() > 0) {
|
||||||
if (!mRedirected) {
|
|
||||||
this.mRedirected = true;
|
|
||||||
startActivity(new Intent(this, EditAccountActivity.class));
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
} else if (conversationList.size() == 0) {
|
|
||||||
if (!mRedirected) {
|
|
||||||
this.mRedirected = true;
|
|
||||||
Intent intent = new Intent(this, StartConversationActivity.class);
|
|
||||||
intent.putExtra("init",true);
|
|
||||||
startActivity(intent);
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ConversationActivity.this.mConversationFragment.updateMessages();
|
ConversationActivity.this.mConversationFragment.updateMessages();
|
||||||
updateActionBarTitle();
|
updateActionBarTitle();
|
||||||
}
|
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAccountUpdate() {
|
public void onAccountUpdate() {
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package eu.siacs.conversations.ui;
|
package eu.siacs.conversations.ui;
|
||||||
|
|
||||||
|
import android.app.ActionBar;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.DialogInterface.OnClickListener;
|
import android.content.DialogInterface.OnClickListener;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -20,6 +22,7 @@ import android.widget.Toast;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import eu.siacs.conversations.Config;
|
import eu.siacs.conversations.Config;
|
||||||
import eu.siacs.conversations.R;
|
import eu.siacs.conversations.R;
|
||||||
|
@ -35,6 +38,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
|
||||||
protected final List<Account> accountList = new ArrayList<>();
|
protected final List<Account> accountList = new ArrayList<>();
|
||||||
protected ListView accountListView;
|
protected ListView accountListView;
|
||||||
protected AccountAdapter mAccountAdapter;
|
protected AccountAdapter mAccountAdapter;
|
||||||
|
protected AtomicBoolean mInvokedAddAccount = new AtomicBoolean(false);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAccountUpdate() {
|
public void onAccountUpdate() {
|
||||||
|
@ -47,6 +51,11 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
|
||||||
accountList.clear();
|
accountList.clear();
|
||||||
accountList.addAll(xmppConnectionService.getAccounts());
|
accountList.addAll(xmppConnectionService.getAccounts());
|
||||||
}
|
}
|
||||||
|
ActionBar actionBar = getActionBar();
|
||||||
|
if (actionBar != null) {
|
||||||
|
actionBar.setHomeButtonEnabled(this.accountList.size() > 0);
|
||||||
|
actionBar.setDisplayHomeAsUpEnabled(this.accountList.size() > 0);
|
||||||
|
}
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
mAccountAdapter.notifyDataSetChanged();
|
mAccountAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
@ -93,9 +102,12 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void onBackendConnected() {
|
void onBackendConnected() {
|
||||||
this.accountList.clear();
|
refreshUiReal();
|
||||||
this.accountList.addAll(xmppConnectionService.getAccounts());
|
if (Config.X509_VERIFICATION && this.accountList.size() == 0) {
|
||||||
mAccountAdapter.notifyDataSetChanged();
|
if (mInvokedAddAccount.compareAndSet(false,true)) {
|
||||||
|
addAccountFromKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -195,7 +207,11 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addAccountFromKey() {
|
private void addAccountFromKey() {
|
||||||
|
try {
|
||||||
KeyChain.choosePrivateKeyAlias(this, this, null, null, null, -1, null);
|
KeyChain.choosePrivateKeyAlias(this, this, null, null, null, -1, null);
|
||||||
|
} catch (ActivityNotFoundException e) {
|
||||||
|
Toast.makeText(this,R.string.device_does_not_support_certificates,Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void publishAvatar(Account account) {
|
private void publishAvatar(Account account) {
|
||||||
|
|
|
@ -535,4 +535,5 @@
|
||||||
<string name="action_renew_certificate">Renew certificate</string>
|
<string name="action_renew_certificate">Renew certificate</string>
|
||||||
<string name="error_fetching_omemo_key">Error fetching OMEMO key!</string>
|
<string name="error_fetching_omemo_key">Error fetching OMEMO key!</string>
|
||||||
<string name="verified_omemo_key_with_certificate">Verified OMEMO key with certificate!</string>
|
<string name="verified_omemo_key_with_certificate">Verified OMEMO key with certificate!</string>
|
||||||
|
<string name="device_does_not_support_certificates">Your device does not support the selection of client certificates!</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue