First version of automatic contact discovery.
TODO: - Configuration (much of it) - Enabled by default? - Which keys to import? Current state: All non-revoked and non-expired with matching userid - Search for keys if already known? Current state: yes, may cause traffic (configuration: only when wifi?) - Update interval: Currently Android handles it, might be good (causes automatic refresh on new contact and stuff like that) or bad (too many of refreshes)
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
|
||||
package org.sufficientlysecure.keychain;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.graphics.PorterDuff;
|
||||
@@ -76,6 +78,17 @@ public class KeychainApplication extends Application {
|
||||
|
||||
brandGlowEffect(getApplicationContext(),
|
||||
getApplicationContext().getResources().getColor(R.color.emphasis));
|
||||
|
||||
setupAccountAsNeeded();
|
||||
}
|
||||
|
||||
private void setupAccountAsNeeded() {
|
||||
AccountManager manager = AccountManager.get(this);
|
||||
Account[] accounts = manager.getAccountsByType(getPackageName());
|
||||
if (accounts == null || accounts.length == 0) {
|
||||
Account dummy = new Account(getString(R.string.app_name), getPackageName());
|
||||
manager.addAccountExplicitly(dummy, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
static void brandGlowEffect(Context context, int brandColor) {
|
||||
|
||||
Reference in New Issue
Block a user