Merge pull request #6236 from thundernest/fix_warnings
Code cleanup; fix some warnings
This commit is contained in:
commit
7a35120a7c
58 changed files with 111 additions and 126 deletions
|
@ -45,7 +45,7 @@ object Core : EarlyInit {
|
|||
@JvmStatic
|
||||
fun setServicesEnabled(context: Context) {
|
||||
val appContext = context.applicationContext
|
||||
val acctLength = Preferences.getPreferences(appContext).accounts.size
|
||||
val acctLength = Preferences.getPreferences().accounts.size
|
||||
val enable = acctLength > 0
|
||||
|
||||
setServicesEnabled(appContext, enable)
|
||||
|
|
|
@ -48,11 +48,11 @@ class LocalKeyStoreManager(
|
|||
* certificates for the incoming and outgoing servers.
|
||||
*/
|
||||
fun deleteCertificates(account: Account) {
|
||||
account.incomingServerSettings?.let { serverSettings ->
|
||||
account.incomingServerSettings.let { serverSettings ->
|
||||
localKeyStore.deleteCertificate(serverSettings.host!!, serverSettings.port)
|
||||
}
|
||||
|
||||
account.outgoingServerSettings?.let { serverSettings ->
|
||||
account.outgoingServerSettings.let { serverSettings ->
|
||||
localKeyStore.deleteCertificate(serverSettings.host!!, serverSettings.port)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.fsck.k9
|
||||
|
||||
import android.content.Context
|
||||
import androidx.annotation.GuardedBy
|
||||
import androidx.annotation.RestrictTo
|
||||
import com.fsck.k9.mail.MessagingException
|
||||
|
@ -291,8 +290,8 @@ class Preferences internal constructor(
|
|||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun getPreferences(context: Context): Preferences {
|
||||
return DI.get(Preferences::class.java)
|
||||
fun getPreferences(): Preferences {
|
||||
return DI.get()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -227,7 +227,7 @@ public class LocalStore {
|
|||
}
|
||||
|
||||
protected Preferences getPreferences() {
|
||||
return Preferences.getPreferences(context);
|
||||
return Preferences.getPreferences();
|
||||
}
|
||||
|
||||
public OutboxStateRepository getOutboxStateRepository() {
|
||||
|
|
|
@ -188,7 +188,7 @@ public class SettingsImporter {
|
|||
|
||||
Imported imported = parseSettings(inputStream, globalSettings, accountUuids, false);
|
||||
|
||||
Preferences preferences = Preferences.getPreferences(context);
|
||||
Preferences preferences = Preferences.getPreferences();
|
||||
Storage storage = preferences.getStorage();
|
||||
|
||||
if (globalSettings) {
|
||||
|
@ -331,7 +331,7 @@ public class SettingsImporter {
|
|||
|
||||
AccountDescription original = new AccountDescription(account.name, account.uuid);
|
||||
|
||||
Preferences prefs = Preferences.getPreferences(context);
|
||||
Preferences prefs = Preferences.getPreferences();
|
||||
List<Account> accounts = prefs.getAccounts();
|
||||
|
||||
String uuid = account.uuid;
|
||||
|
|
|
@ -96,7 +96,7 @@ public class AttachmentProvider extends ContentProvider {
|
|||
|
||||
final AttachmentInfo attachmentInfo;
|
||||
try {
|
||||
final Account account = Preferences.getPreferences(getContext()).getAccount(accountUuid);
|
||||
final Account account = Preferences.getPreferences().getAccount(accountUuid);
|
||||
attachmentInfo = DI.get(LocalStoreProvider.class).getInstance(account).getAttachmentInfo(id);
|
||||
} catch (MessagingException e) {
|
||||
Timber.e(e, "Unable to retrieve attachment info from local store for ID: %s", id);
|
||||
|
@ -143,7 +143,7 @@ public class AttachmentProvider extends ContentProvider {
|
|||
|
||||
private String getType(String accountUuid, String id, String mimeType) {
|
||||
String type;
|
||||
final Account account = Preferences.getPreferences(getContext()).getAccount(accountUuid);
|
||||
final Account account = Preferences.getPreferences().getAccount(accountUuid);
|
||||
|
||||
try {
|
||||
final LocalStore localStore = DI.get(LocalStoreProvider.class).getInstance(account);
|
||||
|
@ -182,7 +182,7 @@ public class AttachmentProvider extends ContentProvider {
|
|||
|
||||
@Nullable
|
||||
private OpenPgpDataSource getAttachmentDataSource(String accountUuid, String attachmentId) throws MessagingException {
|
||||
final Account account = Preferences.getPreferences(getContext()).getAccount(accountUuid);
|
||||
final Account account = Preferences.getPreferences().getAccount(accountUuid);
|
||||
LocalStore localStore = DI.get(LocalStoreProvider.class).getInstance(account);
|
||||
return localStore.getAttachmentDataSource(attachmentId);
|
||||
}
|
||||
|
|
|
@ -505,8 +505,7 @@ public class EmailProvider extends ContentProvider {
|
|||
|
||||
private Account getAccount(String accountUuid) {
|
||||
if (mPreferences == null) {
|
||||
Context appContext = getContext().getApplicationContext();
|
||||
mPreferences = Preferences.getPreferences(appContext);
|
||||
mPreferences = Preferences.getPreferences();
|
||||
}
|
||||
|
||||
Account account = mPreferences.getAccount(accountUuid);
|
||||
|
|
|
@ -174,7 +174,7 @@ public class RawMessageProvider extends ContentProvider {
|
|||
long folderId = messageReference.getFolderId();
|
||||
String uid = messageReference.getUid();
|
||||
|
||||
Account account = Preferences.getPreferences(getContext()).getAccount(accountUuid);
|
||||
Account account = Preferences.getPreferences().getAccount(accountUuid);
|
||||
if (account == null) {
|
||||
Timber.w("Account not found: %s", accountUuid);
|
||||
return null;
|
||||
|
|
|
@ -179,7 +179,7 @@ public class DatabaseUpgradeService extends Service {
|
|||
* Upgrade the accounts' databases.
|
||||
*/
|
||||
private void upgradeDatabases() {
|
||||
Preferences preferences = Preferences.getPreferences(this);
|
||||
Preferences preferences = Preferences.getPreferences();
|
||||
|
||||
List<Account> accounts = preferences.getAccounts();
|
||||
mProgressEnd = accounts.size();
|
||||
|
|
|
@ -23,7 +23,7 @@ public class AutocryptHeaderParserTest extends RobolectricTest {
|
|||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
BinaryTempFileBody.setTempDirectory(RuntimeEnvironment.application.getCacheDir());
|
||||
BinaryTempFileBody.setTempDirectory(RuntimeEnvironment.getApplication().getCacheDir());
|
||||
}
|
||||
|
||||
// Test cases taken from: https://github.com/mailencrypt/autocrypt/tree/master/src/tests/data
|
||||
|
|
|
@ -4,6 +4,7 @@ package com.fsck.k9.cache;
|
|||
import java.util.Collections;
|
||||
import java.util.UUID;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
|
||||
import com.fsck.k9.RobolectricTest;
|
||||
|
@ -26,6 +27,7 @@ import static org.mockito.Mockito.when;
|
|||
|
||||
|
||||
public class EmailProviderCacheTest extends RobolectricTest {
|
||||
private final Context context = RuntimeEnvironment.getApplication();
|
||||
|
||||
private EmailProviderCache cache;
|
||||
@Mock
|
||||
|
@ -40,7 +42,7 @@ public class EmailProviderCacheTest extends RobolectricTest {
|
|||
MockitoAnnotations.initMocks(this);
|
||||
EmailProvider.CONTENT_URI = Uri.parse("content://test.provider.email");
|
||||
|
||||
cache = EmailProviderCache.getCache(UUID.randomUUID().toString(), RuntimeEnvironment.application);
|
||||
cache = EmailProviderCache.getCache(UUID.randomUUID().toString(), context);
|
||||
when(mockLocalMessage.getDatabaseId()).thenReturn(localMessageId);
|
||||
when(mockLocalMessage.getFolder()).thenReturn(mockLocalMessageFolder);
|
||||
when(mockLocalMessageFolder.getDatabaseId()).thenReturn(localMessageFolderId);
|
||||
|
@ -48,16 +50,16 @@ public class EmailProviderCacheTest extends RobolectricTest {
|
|||
|
||||
@Test
|
||||
public void getCache_returnsDifferentCacheForEachUUID() {
|
||||
EmailProviderCache cache = EmailProviderCache.getCache("u001", RuntimeEnvironment.application);
|
||||
EmailProviderCache cache2 = EmailProviderCache.getCache("u002", RuntimeEnvironment.application);
|
||||
EmailProviderCache cache = EmailProviderCache.getCache("u001", context);
|
||||
EmailProviderCache cache2 = EmailProviderCache.getCache("u002", context);
|
||||
|
||||
assertNotEquals(cache, cache2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getCache_returnsSameCacheForAUUID() {
|
||||
EmailProviderCache cache = EmailProviderCache.getCache("u001", RuntimeEnvironment.application);
|
||||
EmailProviderCache cache2 = EmailProviderCache.getCache("u001", RuntimeEnvironment.application);
|
||||
EmailProviderCache cache = EmailProviderCache.getCache("u001", context);
|
||||
EmailProviderCache cache2 = EmailProviderCache.getCache("u001", context);
|
||||
|
||||
assertSame(cache, cache2);
|
||||
}
|
||||
|
|
|
@ -137,9 +137,9 @@ public class MessagingControllerTest extends K9RobolectricTest {
|
|||
public void setUp() throws MessagingException {
|
||||
ShadowLog.stream = System.out;
|
||||
MockitoAnnotations.initMocks(this);
|
||||
appContext = RuntimeEnvironment.application;
|
||||
appContext = RuntimeEnvironment.getApplication();
|
||||
|
||||
preferences = Preferences.getPreferences(appContext);
|
||||
preferences = Preferences.getPreferences();
|
||||
|
||||
controller = new MessagingController(appContext, notificationController, notificationStrategy,
|
||||
localStoreProvider, messageCountsProvider, backendManager, preferences, messageStoreManager,
|
||||
|
|
|
@ -22,7 +22,7 @@ public class MessageHelperTest extends RobolectricTest {
|
|||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
Context context = RuntimeEnvironment.application;
|
||||
Context context = RuntimeEnvironment.getApplication();
|
||||
contacts = new Contacts(context);
|
||||
contactsWithFakeContact = new Contacts(context) {
|
||||
@Override public String getNameForAddress(String address) {
|
||||
|
|
|
@ -73,7 +73,7 @@ public class MessageViewInfoExtractorTest extends K9RobolectricTest {
|
|||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
context = RuntimeEnvironment.application;
|
||||
context = RuntimeEnvironment.getApplication();
|
||||
|
||||
HtmlProcessor htmlProcessor = createFakeHtmlProcessor();
|
||||
attachmentInfoExtractor = spy(DI.get(AttachmentInfoExtractor.class));
|
||||
|
|
|
@ -41,7 +41,7 @@ public class AttachmentInfoExtractorTest extends RobolectricTest {
|
|||
@Before
|
||||
public void setUp() throws Exception {
|
||||
AttachmentProvider.CONTENT_URI = Uri.parse("content://test.attachmentprovider");
|
||||
context = RuntimeEnvironment.application;
|
||||
context = RuntimeEnvironment.getApplication();
|
||||
attachmentInfoExtractor = new AttachmentInfoExtractor(context);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.mockito.kotlin.mock
|
|||
import org.robolectric.RuntimeEnvironment
|
||||
|
||||
class SettingsExporterTest : K9RobolectricTest() {
|
||||
private val contentResolver = RuntimeEnvironment.application.contentResolver
|
||||
private val contentResolver = RuntimeEnvironment.getApplication().contentResolver
|
||||
private val preferences: Preferences by inject()
|
||||
private val folderSettingsProvider: FolderSettingsProvider by inject()
|
||||
private val folderRepository: FolderRepository by inject()
|
||||
|
|
|
@ -6,6 +6,8 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.fsck.k9.K9RobolectricTest;
|
||||
import com.fsck.k9.Preferences;
|
||||
import com.fsck.k9.mail.AuthType;
|
||||
|
@ -20,6 +22,7 @@ import static org.junit.Assert.assertTrue;
|
|||
|
||||
|
||||
public class SettingsImporterTest extends K9RobolectricTest {
|
||||
private final Context context = RuntimeEnvironment.getApplication();
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
|
@ -27,7 +30,7 @@ public class SettingsImporterTest extends K9RobolectricTest {
|
|||
}
|
||||
|
||||
private void deletePreExistingAccounts() {
|
||||
Preferences preferences = Preferences.getPreferences(RuntimeEnvironment.application);
|
||||
Preferences preferences = Preferences.getPreferences();
|
||||
preferences.clearAccounts();
|
||||
}
|
||||
|
||||
|
@ -36,7 +39,7 @@ public class SettingsImporterTest extends K9RobolectricTest {
|
|||
InputStream inputStream = inputStreamOf("");
|
||||
List<String> accountUuids = new ArrayList<>();
|
||||
|
||||
SettingsImporter.importSettings(RuntimeEnvironment.application, inputStream, true, accountUuids, true);
|
||||
SettingsImporter.importSettings(context, inputStream, true, accountUuids, true);
|
||||
}
|
||||
|
||||
@Test(expected = SettingsImportExportException.class)
|
||||
|
@ -44,7 +47,7 @@ public class SettingsImporterTest extends K9RobolectricTest {
|
|||
InputStream inputStream = inputStreamOf("<k9settings version=\"1\"></k9settings>");
|
||||
List<String> accountUuids = new ArrayList<>();
|
||||
|
||||
SettingsImporter.importSettings(RuntimeEnvironment.application, inputStream, true, accountUuids, true);
|
||||
SettingsImporter.importSettings(context, inputStream, true, accountUuids, true);
|
||||
}
|
||||
|
||||
@Test(expected = SettingsImportExportException.class)
|
||||
|
@ -52,7 +55,7 @@ public class SettingsImporterTest extends K9RobolectricTest {
|
|||
InputStream inputStream = inputStreamOf("<k9settings version=\"1\" format=\"A\"></k9settings>");
|
||||
List<String> accountUuids = new ArrayList<>();
|
||||
|
||||
SettingsImporter.importSettings(RuntimeEnvironment.application, inputStream, true, accountUuids, true);
|
||||
SettingsImporter.importSettings(context, inputStream, true, accountUuids, true);
|
||||
}
|
||||
|
||||
@Test(expected = SettingsImportExportException.class)
|
||||
|
@ -60,7 +63,7 @@ public class SettingsImporterTest extends K9RobolectricTest {
|
|||
InputStream inputStream = inputStreamOf("<k9settings version=\"1\" format=\"0\"></k9settings>");
|
||||
List<String> accountUuids = new ArrayList<>();
|
||||
|
||||
SettingsImporter.importSettings(RuntimeEnvironment.application, inputStream, true, accountUuids, true);
|
||||
SettingsImporter.importSettings(context, inputStream, true, accountUuids, true);
|
||||
}
|
||||
|
||||
@Test(expected = SettingsImportExportException.class)
|
||||
|
@ -68,7 +71,7 @@ public class SettingsImporterTest extends K9RobolectricTest {
|
|||
InputStream inputStream = inputStreamOf("<k9settings format=\"1\"></k9settings>");
|
||||
List<String> accountUuids = new ArrayList<>();
|
||||
|
||||
SettingsImporter.importSettings(RuntimeEnvironment.application, inputStream, true, accountUuids, true);
|
||||
SettingsImporter.importSettings(context, inputStream, true, accountUuids, true);
|
||||
}
|
||||
|
||||
@Test(expected = SettingsImportExportException.class)
|
||||
|
@ -76,7 +79,7 @@ public class SettingsImporterTest extends K9RobolectricTest {
|
|||
InputStream inputStream = inputStreamOf("<k9settings format=\"1\" version=\"A\"></k9settings>");
|
||||
List<String> accountUuids = new ArrayList<>();
|
||||
|
||||
SettingsImporter.importSettings(RuntimeEnvironment.application, inputStream, true, accountUuids, true);
|
||||
SettingsImporter.importSettings(context, inputStream, true, accountUuids, true);
|
||||
}
|
||||
|
||||
@Test(expected = SettingsImportExportException.class)
|
||||
|
@ -84,7 +87,7 @@ public class SettingsImporterTest extends K9RobolectricTest {
|
|||
InputStream inputStream = inputStreamOf("<k9settings format=\"1\" version=\"0\"></k9settings>");
|
||||
List<String> accountUuids = new ArrayList<>();
|
||||
|
||||
SettingsImporter.importSettings(RuntimeEnvironment.application, inputStream, true, accountUuids, true);
|
||||
SettingsImporter.importSettings(context, inputStream, true, accountUuids, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -162,7 +165,7 @@ public class SettingsImporterTest extends K9RobolectricTest {
|
|||
accountUuids.add(validUUID);
|
||||
|
||||
SettingsImporter.ImportResults results = SettingsImporter.importSettings(
|
||||
RuntimeEnvironment.application, inputStream, true, accountUuids, false);
|
||||
context, inputStream, true, accountUuids, false);
|
||||
|
||||
assertEquals(0, results.erroneousAccounts.size());
|
||||
assertEquals(1, results.importedAccounts.size());
|
||||
|
|
|
@ -149,7 +149,7 @@ public class MessageProvider extends ContentProvider {
|
|||
|
||||
// get account
|
||||
Account myAccount = null;
|
||||
for (Account account : Preferences.getPreferences(getContext()).getAccounts()) {
|
||||
for (Account account : Preferences.getPreferences().getAccounts()) {
|
||||
if (account.getAccountNumber() == accountId) {
|
||||
myAccount = account;
|
||||
}
|
||||
|
@ -601,7 +601,7 @@ public class MessageProvider extends ContentProvider {
|
|||
|
||||
MatrixCursor cursor = new MatrixCursor(projection);
|
||||
|
||||
for (Account account : Preferences.getPreferences(getContext()).getAccounts()) {
|
||||
for (Account account : Preferences.getPreferences().getAccounts()) {
|
||||
Object[] values = new Object[projection.length];
|
||||
|
||||
int fieldIndex = 0;
|
||||
|
@ -667,7 +667,7 @@ public class MessageProvider extends ContentProvider {
|
|||
|
||||
Context context = getContext();
|
||||
MessagingController controller = MessagingController.getInstance(context);
|
||||
Collection<Account> accounts = Preferences.getPreferences(context).getAccounts();
|
||||
Collection<Account> accounts = Preferences.getPreferences().getAccounts();
|
||||
|
||||
for (Account account : accounts) {
|
||||
if (account.getAccountNumber() == accountNumber) {
|
||||
|
|
|
@ -35,7 +35,7 @@ class UnreadWidgetDataProvider(
|
|||
|
||||
private fun loadSearchAccountData(configuration: UnreadWidgetConfiguration): UnreadWidgetData {
|
||||
val searchAccount = getSearchAccount(configuration.accountUuid)
|
||||
val title = searchAccount.name ?: searchAccount.email
|
||||
val title = searchAccount.name
|
||||
val unreadCount = messagingController.getUnreadMessageCount(searchAccount)
|
||||
val clickIntent = MessageList.intentDisplaySearch(context, searchAccount.relatedSearch, false, true, true)
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.fsck.k9
|
||||
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.fsck.k9.ui.changelog.ChangeLogMode
|
||||
import com.fsck.k9.ui.changelog.ChangelogViewModel
|
||||
|
@ -26,10 +25,10 @@ import org.robolectric.annotation.Config
|
|||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(application = App::class)
|
||||
class DependencyInjectionTest : AutoCloseKoinTest() {
|
||||
val lifecycleOwner = mock<LifecycleOwner> {
|
||||
on { lifecycle } doReturn mock<Lifecycle>()
|
||||
private val lifecycleOwner = mock<LifecycleOwner> {
|
||||
on { lifecycle } doReturn mock()
|
||||
}
|
||||
val autocryptTransferView = mock<AutocryptKeyTransferActivity>()
|
||||
private val autocryptTransferView = mock<AutocryptKeyTransferActivity>()
|
||||
|
||||
@KoinInternalApi
|
||||
@Test
|
||||
|
@ -38,9 +37,9 @@ class DependencyInjectionTest : AutoCloseKoinTest() {
|
|||
|
||||
getKoin().checkModules {
|
||||
withParameter<OpenPgpApiManager> { lifecycleOwner }
|
||||
create<AutocryptKeyTransferPresenter> { parametersOf(lifecycleOwner, autocryptTransferView) }
|
||||
withParameter<FolderNameFormatter> { RuntimeEnvironment.application }
|
||||
withParameter<SizeFormatter> { RuntimeEnvironment.application }
|
||||
withParameters<AutocryptKeyTransferPresenter> { parametersOf(lifecycleOwner, autocryptTransferView) }
|
||||
withParameter<FolderNameFormatter> { RuntimeEnvironment.getApplication() }
|
||||
withParameter<SizeFormatter> { RuntimeEnvironment.getApplication() }
|
||||
withParameter<ChangelogViewModel> { ChangeLogMode.CHANGE_LOG }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.mockito.kotlin.mock
|
|||
import org.robolectric.RuntimeEnvironment
|
||||
|
||||
class UnreadWidgetDataProviderTest : AppRobolectricTest() {
|
||||
val context: Context = RuntimeEnvironment.application
|
||||
val context: Context = RuntimeEnvironment.getApplication()
|
||||
val account = createAccount()
|
||||
val preferences = createPreferences()
|
||||
val messagingController = createMessagingController()
|
||||
|
|
|
@ -15,7 +15,7 @@ internal class FlagMessageOperations(private val lockableDatabase: LockableDatab
|
|||
if (flag in SPECIAL_FLAGS) {
|
||||
setSpecialFlags(messageIds, flag, set)
|
||||
} else {
|
||||
rebuildFlagsColumnValue(messageIds, flag, set)
|
||||
throw UnsupportedOperationException("not implemented")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,10 +54,6 @@ internal class FlagMessageOperations(private val lockableDatabase: LockableDatab
|
|||
}
|
||||
}
|
||||
|
||||
private fun rebuildFlagsColumnValue(messageIds: Collection<Long>, flag: Flag, set: Boolean) {
|
||||
throw UnsupportedOperationException("not implemented")
|
||||
}
|
||||
|
||||
private fun rebuildFlagsColumnValue(folderId: Long, messageServerId: String, flag: Flag, set: Boolean) {
|
||||
lockableDatabase.execute(true) { database ->
|
||||
val oldFlags = database.readFlagsColumn(folderId, messageServerId)
|
||||
|
|
|
@ -18,7 +18,7 @@ import org.mockito.kotlin.verifyNoMoreInteractions
|
|||
import org.robolectric.RuntimeEnvironment
|
||||
|
||||
class StoragePersisterTest : K9RobolectricTest() {
|
||||
private var context: Context = RuntimeEnvironment.application
|
||||
private var context: Context = RuntimeEnvironment.getApplication()
|
||||
private var storagePersister = K9StoragePersister(context)
|
||||
|
||||
@Test
|
||||
|
|
|
@ -45,7 +45,7 @@ public class StoreSchemaDefinitionTest extends K9RobolectricTest {
|
|||
public void setUp() throws MessagingException {
|
||||
ShadowLog.stream = System.out;
|
||||
|
||||
Application application = RuntimeEnvironment.application;
|
||||
Application application = RuntimeEnvironment.getApplication();
|
||||
StorageManager.getInstance(application);
|
||||
|
||||
storeSchemaDefinition = createStoreSchemaDefinition();
|
||||
|
|
|
@ -155,7 +155,7 @@ public abstract class AccountList extends K9ListActivity implements OnItemClickL
|
|||
class LoadAccounts extends AsyncTask<Void, Void, List<Account>> {
|
||||
@Override
|
||||
protected List<Account> doInBackground(Void... params) {
|
||||
return Preferences.getPreferences(getApplicationContext()).getAccounts();
|
||||
return Preferences.getPreferences().getAccounts();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -37,7 +37,7 @@ public class ChooseIdentity extends K9ListActivity {
|
|||
getListView().setChoiceMode(ListView.CHOICE_MODE_NONE);
|
||||
Intent intent = getIntent();
|
||||
String accountUuid = intent.getStringExtra(EXTRA_ACCOUNT);
|
||||
mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
|
||||
mAccount = Preferences.getPreferences().getAccount(accountUuid);
|
||||
|
||||
adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1);
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class EditIdentity : K9Activity() {
|
|||
|
||||
identityIndex = intent.getIntExtra(EXTRA_IDENTITY_INDEX, -1)
|
||||
val accountUuid = intent.getStringExtra(EXTRA_ACCOUNT) ?: error("Missing account UUID")
|
||||
account = Preferences.getPreferences(this).getAccount(accountUuid) ?: error("Couldn't find account")
|
||||
account = Preferences.getPreferences().getAccount(accountUuid) ?: error("Couldn't find account")
|
||||
|
||||
identity = when {
|
||||
savedInstanceState != null -> savedInstanceState.getParcelable(EXTRA_IDENTITY) ?: error("Missing state")
|
||||
|
@ -91,7 +91,7 @@ class EditIdentity : K9Activity() {
|
|||
identities.add(identityIndex, identity)
|
||||
}
|
||||
|
||||
Preferences.getPreferences(applicationContext).saveAccount(account)
|
||||
Preferences.getPreferences().saveAccount(account)
|
||||
|
||||
finish()
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ public class ManageIdentities extends ChooseIdentity {
|
|||
private void saveIdentities() {
|
||||
if (mIdentitiesChanged) {
|
||||
mAccount.setIdentities(identities);
|
||||
Preferences.getPreferences(getApplicationContext()).saveAccount(mAccount);
|
||||
Preferences.getPreferences().saveAccount(mAccount);
|
||||
}
|
||||
finish();
|
||||
}
|
||||
|
|
|
@ -936,7 +936,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
|||
updateSignature();
|
||||
updateMessageFormat();
|
||||
replyToPresenter.setIdentity(identity);
|
||||
recipientPresenter.onSwitchIdentity(identity);
|
||||
recipientPresenter.onSwitchIdentity();
|
||||
}
|
||||
|
||||
private void updateFrom() {
|
||||
|
|
|
@ -973,8 +973,8 @@ open class MessageList :
|
|||
progressBar!!.visibility = if (enable) View.VISIBLE else View.INVISIBLE
|
||||
}
|
||||
|
||||
override fun setMessageListProgress(progress: Int) {
|
||||
progressBar!!.progress = progress
|
||||
override fun setMessageListProgress(level: Int) {
|
||||
progressBar!!.progress = level
|
||||
}
|
||||
|
||||
override fun openMessage(messageReference: MessageReference) {
|
||||
|
|
|
@ -115,7 +115,7 @@ public class MessageLoaderHelper {
|
|||
public void asyncStartOrResumeLoadingMessage(MessageReference messageReference, Parcelable cachedDecryptionResult) {
|
||||
onlyLoadMetadata = false;
|
||||
this.messageReference = messageReference;
|
||||
this.account = Preferences.getPreferences(context).getAccount(messageReference.getAccountUuid());
|
||||
this.account = Preferences.getPreferences().getAccount(messageReference.getAccountUuid());
|
||||
|
||||
if (cachedDecryptionResult != null) {
|
||||
if (cachedDecryptionResult instanceof OpenPgpDecryptionResult) {
|
||||
|
@ -132,7 +132,7 @@ public class MessageLoaderHelper {
|
|||
public void asyncStartOrResumeLoadingMessageMetadata(MessageReference messageReference) {
|
||||
onlyLoadMetadata = true;
|
||||
this.messageReference = messageReference;
|
||||
this.account = Preferences.getPreferences(context).getAccount(messageReference.getAccountUuid());
|
||||
this.account = Preferences.getPreferences().getAccount(messageReference.getAccountUuid());
|
||||
|
||||
startOrResumeLocalMessageLoader();
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ public class UpgradeDatabases extends K9Activity {
|
|||
return;
|
||||
}
|
||||
|
||||
mPreferences = Preferences.getPreferences(getApplicationContext());
|
||||
mPreferences = Preferences.getPreferences();
|
||||
|
||||
initializeLayout();
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ public class IdentityAdapter extends BaseAdapter {
|
|||
Context.LAYOUT_INFLATER_SERVICE);
|
||||
|
||||
List<Object> items = new ArrayList<>();
|
||||
Preferences prefs = Preferences.getPreferences(context.getApplicationContext());
|
||||
Preferences prefs = Preferences.getPreferences();
|
||||
Collection<Account> accounts = prefs.getAccounts();
|
||||
for (Account account : accounts) {
|
||||
items.add(account);
|
||||
|
|
|
@ -17,7 +17,7 @@ public class MessageActions {
|
|||
* activity.
|
||||
*/
|
||||
public static void actionCompose(Context context, Account account) {
|
||||
Account defaultAccount = Preferences.getPreferences(context).getDefaultAccount();
|
||||
Account defaultAccount = Preferences.getPreferences().getDefaultAccount();
|
||||
if (account == null && defaultAccount == null) {
|
||||
AccountSetupBasics.actionNewAccount(context);
|
||||
} else {
|
||||
|
|
|
@ -12,7 +12,6 @@ import android.view.Menu
|
|||
import androidx.core.content.ContextCompat
|
||||
import androidx.loader.app.LoaderManager
|
||||
import com.fsck.k9.Account
|
||||
import com.fsck.k9.Identity
|
||||
import com.fsck.k9.K9
|
||||
import com.fsck.k9.activity.compose.ComposeCryptoStatus.AttachErrorState
|
||||
import com.fsck.k9.activity.compose.ComposeCryptoStatus.SendErrorState
|
||||
|
@ -323,7 +322,7 @@ class RecipientPresenter(
|
|||
openPgpApiManager.setOpenPgpProvider(openPgpProvider, openPgpCallback)
|
||||
}
|
||||
|
||||
fun onSwitchIdentity(identity: Identity) {
|
||||
fun onSwitchIdentity() {
|
||||
// TODO decide what actually to do on identity switch?
|
||||
asyncUpdateCryptoStatus()
|
||||
}
|
||||
|
@ -623,14 +622,12 @@ class RecipientPresenter(
|
|||
SendErrorState.ENABLED_ERROR -> recipientMvpView.showOpenPgpEnabledErrorDialog(false)
|
||||
SendErrorState.PROVIDER_ERROR -> recipientMvpView.showErrorOpenPgpConnection()
|
||||
SendErrorState.KEY_CONFIG_ERROR -> recipientMvpView.showErrorNoKeyConfigured()
|
||||
else -> throw AssertionError("not all error states handled, this is a bug!")
|
||||
}
|
||||
}
|
||||
|
||||
fun showPgpAttachError(attachErrorState: AttachErrorState) {
|
||||
when (attachErrorState) {
|
||||
AttachErrorState.IS_INLINE -> recipientMvpView.showErrorInlineAttach()
|
||||
else -> throw AssertionError("not all error states handled, this is a bug!")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ public class AccountSetupComposition extends K9Activity {
|
|||
super.onCreate(savedInstanceState);
|
||||
|
||||
String accountUuid = getIntent().getStringExtra(EXTRA_ACCOUNT);
|
||||
mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
|
||||
mAccount = Preferences.getPreferences().getAccount(accountUuid);
|
||||
|
||||
setLayout(R.layout.account_setup_composition);
|
||||
setTitle(R.string.account_settings_composition_title);
|
||||
|
@ -61,7 +61,7 @@ public class AccountSetupComposition extends K9Activity {
|
|||
*/
|
||||
if (savedInstanceState != null && savedInstanceState.containsKey(EXTRA_ACCOUNT)) {
|
||||
accountUuid = savedInstanceState.getString(EXTRA_ACCOUNT);
|
||||
mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
|
||||
mAccount = Preferences.getPreferences().getAccount(accountUuid);
|
||||
}
|
||||
|
||||
mAccountName = findViewById(R.id.account_name);
|
||||
|
@ -129,7 +129,7 @@ public class AccountSetupComposition extends K9Activity {
|
|||
mAccount.setSignatureBeforeQuotedText(isSignatureBeforeQuotedText);
|
||||
}
|
||||
|
||||
Preferences.getPreferences(getApplicationContext()).saveAccount(mAccount);
|
||||
Preferences.getPreferences().saveAccount(mAccount);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -158,7 +158,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
|
|||
mPortView.setKeyListener(DigitsKeyListener.getInstance("0123456789"));
|
||||
|
||||
String accountUuid = getIntent().getStringExtra(EXTRA_ACCOUNT);
|
||||
mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
|
||||
mAccount = Preferences.getPreferences().getAccount(accountUuid);
|
||||
mMakeDefault = getIntent().getBooleanExtra(EXTRA_MAKE_DEFAULT, false);
|
||||
|
||||
/*
|
||||
|
@ -167,7 +167,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
|
|||
*/
|
||||
if (savedInstanceState != null && savedInstanceState.containsKey(EXTRA_ACCOUNT)) {
|
||||
accountUuid = savedInstanceState.getString(EXTRA_ACCOUNT);
|
||||
mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
|
||||
mAccount = Preferences.getPreferences().getAccount(accountUuid);
|
||||
}
|
||||
|
||||
boolean oAuthSupported = mAccount.getIncomingServerSettings().type.equals(Protocols.IMAP);
|
||||
|
@ -539,7 +539,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
|
|||
|
||||
if (resultCode == RESULT_OK) {
|
||||
if (Intent.ACTION_EDIT.equals(getIntent().getAction())) {
|
||||
Preferences.getPreferences(getApplicationContext()).saveAccount(mAccount);
|
||||
Preferences.getPreferences().saveAccount(mAccount);
|
||||
finish();
|
||||
} else {
|
||||
/*
|
||||
|
|
|
@ -65,7 +65,7 @@ public class AccountSetupNames extends K9Activity implements OnClickListener {
|
|||
mName.setKeyListener(TextKeyListener.getInstance(false, Capitalize.WORDS));
|
||||
|
||||
String accountUuid = getIntent().getStringExtra(EXTRA_ACCOUNT);
|
||||
mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
|
||||
mAccount = Preferences.getPreferences().getAccount(accountUuid);
|
||||
|
||||
String senderName = mAccount.getSenderName();
|
||||
if (senderName != null) {
|
||||
|
@ -88,7 +88,7 @@ public class AccountSetupNames extends K9Activity implements OnClickListener {
|
|||
}
|
||||
mAccount.setSenderName(mName.getText().toString());
|
||||
mAccount.markSetupFinished();
|
||||
Preferences.getPreferences(getApplicationContext()).saveAccount(mAccount);
|
||||
Preferences.getPreferences().saveAccount(mAccount);
|
||||
finishAffinity();
|
||||
MessageList.launch(this, mAccount);
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ public class AccountSetupOptions extends K9Activity implements OnClickListener {
|
|||
mDisplayCountView.setAdapter(displayCountsAdapter);
|
||||
|
||||
String accountUuid = getIntent().getStringExtra(EXTRA_ACCOUNT);
|
||||
mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
|
||||
mAccount = Preferences.getPreferences().getAccount(accountUuid);
|
||||
|
||||
mNotifyView.setChecked(mAccount.isNotifyNewMail());
|
||||
SpinnerOption.setSpinnerOptionValue(mCheckFrequencyView, mAccount
|
||||
|
@ -111,7 +111,7 @@ public class AccountSetupOptions extends K9Activity implements OnClickListener {
|
|||
|
||||
mAccount.setFolderPushMode(Account.FolderMode.NONE);
|
||||
|
||||
Preferences.getPreferences(getApplicationContext()).saveAccount(mAccount);
|
||||
Preferences.getPreferences().saveAccount(mAccount);
|
||||
Core.setServicesEnabled(this);
|
||||
AccountSetupNames.actionSetNames(this, mAccount);
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
|
|||
setTitle(R.string.account_setup_outgoing_title);
|
||||
|
||||
String accountUuid = getIntent().getStringExtra(EXTRA_ACCOUNT);
|
||||
mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
|
||||
mAccount = Preferences.getPreferences().getAccount(accountUuid);
|
||||
|
||||
ServerSettings incomingServerSettings = mAccount.getIncomingServerSettings();
|
||||
if (incomingServerSettings.type.equals(Protocols.WEBDAV)) {
|
||||
|
@ -138,7 +138,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
|
|||
|
||||
//FIXME: get Account object again?
|
||||
accountUuid = getIntent().getStringExtra(EXTRA_ACCOUNT);
|
||||
mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
|
||||
mAccount = Preferences.getPreferences().getAccount(accountUuid);
|
||||
|
||||
/*
|
||||
* If we're being reloaded we override the original account with the one
|
||||
|
@ -146,7 +146,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
|
|||
*/
|
||||
if (savedInstanceState != null && savedInstanceState.containsKey(EXTRA_ACCOUNT)) {
|
||||
accountUuid = savedInstanceState.getString(EXTRA_ACCOUNT);
|
||||
mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
|
||||
mAccount = Preferences.getPreferences().getAccount(accountUuid);
|
||||
}
|
||||
|
||||
boolean editSettings = Intent.ACTION_EDIT.equals(getIntent().getAction());
|
||||
|
@ -495,7 +495,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
|
|||
|
||||
if (resultCode == RESULT_OK) {
|
||||
if (Intent.ACTION_EDIT.equals(getIntent().getAction())) {
|
||||
Preferences.getPreferences(getApplicationContext()).saveAccount(mAccount);
|
||||
Preferences.getPreferences().saveAccount(mAccount);
|
||||
finish();
|
||||
} else {
|
||||
AccountSetupOptions.actionOptions(this, mAccount);
|
||||
|
|
|
@ -86,7 +86,7 @@ public class AttachmentController {
|
|||
|
||||
private void downloadAttachment(LocalPart localPart, final Runnable attachmentDownloadedCallback) {
|
||||
String accountUuid = localPart.getAccountUuid();
|
||||
Account account = Preferences.getPreferences(context).getAccount(accountUuid);
|
||||
Account account = Preferences.getPreferences().getAccount(accountUuid);
|
||||
LocalMessage message = localPart.getMessage();
|
||||
|
||||
messageViewFragment.showAttachmentLoadingDialog();
|
||||
|
@ -220,11 +220,6 @@ public class AttachmentController {
|
|||
|
||||
private class ViewAttachmentAsyncTask extends AsyncTask<Void, Void, Intent> {
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
messageViewFragment.disableAttachmentButtons(attachment);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Intent doInBackground(Void... params) {
|
||||
return getBestViewIntent();
|
||||
|
@ -233,7 +228,6 @@ public class AttachmentController {
|
|||
@Override
|
||||
protected void onPostExecute(Intent intent) {
|
||||
viewAttachment(intent);
|
||||
messageViewFragment.enableAttachmentButtons(attachment);
|
||||
}
|
||||
|
||||
private void viewAttachment(Intent intent) {
|
||||
|
@ -250,11 +244,6 @@ public class AttachmentController {
|
|||
|
||||
private class SaveAttachmentAsyncTask extends AsyncTask<Uri, Void, Boolean> {
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
messageViewFragment.disableAttachmentButtons(attachment);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Boolean doInBackground(Uri... params) {
|
||||
try {
|
||||
|
@ -269,7 +258,6 @@ public class AttachmentController {
|
|||
|
||||
@Override
|
||||
protected void onPostExecute(Boolean success) {
|
||||
messageViewFragment.enableAttachmentButtons(attachment);
|
||||
if (!success) {
|
||||
displayAttachmentNotSavedMessage();
|
||||
}
|
||||
|
|
|
@ -736,10 +736,6 @@ class MessageViewFragment :
|
|||
startActivity(intent)
|
||||
}
|
||||
|
||||
fun disableAttachmentButtons(attachment: AttachmentViewInfo?) = Unit
|
||||
|
||||
fun enableAttachmentButtons(attachment: AttachmentViewInfo?) = Unit
|
||||
|
||||
fun runOnMainThread(runnable: Runnable) {
|
||||
requireActivity().runOnUiThread(runnable)
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public class OpenPgpAppSelectDialog extends K9Activity {
|
|||
super.onCreate(savedInstanceState);
|
||||
|
||||
String accountUuid = getIntent().getStringExtra(EXTRA_ACCOUNT);
|
||||
account = Preferences.getPreferences(this).getAccount(accountUuid);
|
||||
account = Preferences.getPreferences().getAccount(accountUuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -283,7 +283,7 @@ public class OpenPgpAppSelectDialog extends K9Activity {
|
|||
|
||||
private void persistOpenPgpProviderSetting(String selectedPackage) {
|
||||
account.setOpenPgpProvider(selectedPackage);
|
||||
Preferences.getPreferences(getApplicationContext()).saveAccount(account);
|
||||
Preferences.getPreferences().saveAccount(account);
|
||||
}
|
||||
|
||||
private static class OpenPgpProviderEntry {
|
||||
|
|
|
@ -77,7 +77,7 @@ public class RecipientLoaderTest extends RobolectricTest {
|
|||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
Application application = RuntimeEnvironment.application;
|
||||
Application application = RuntimeEnvironment.getApplication();
|
||||
shadowApp = Shadows.shadowOf(application);
|
||||
shadowApp.grantPermissions(Manifest.permission.READ_CONTACTS);
|
||||
shadowApp.grantPermissions(Manifest.permission.WRITE_CONTACTS);
|
||||
|
|
|
@ -81,7 +81,7 @@ class PgpMessageBuilderTest : K9RobolectricTest() {
|
|||
@Before
|
||||
@Throws(Exception::class)
|
||||
fun setUp() {
|
||||
BinaryTempFileBody.setTempDirectory(RuntimeEnvironment.application.cacheDir)
|
||||
BinaryTempFileBody.setTempDirectory(RuntimeEnvironment.getApplication().cacheDir)
|
||||
`when`(autocryptOpenPgpApiInteractor.getKeyMaterialForKeyId(openPgpApi, TEST_KEY_ID, SENDER_EMAIL))
|
||||
.thenReturn(AUTOCRYPT_KEY_MATERIAL)
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import org.robolectric.RuntimeEnvironment
|
|||
class K9DrawerTest : RobolectricTest() {
|
||||
@Test
|
||||
fun testAccountColorLengthEqualsDrawerColorLength() {
|
||||
val resources = RuntimeEnvironment.application.resources
|
||||
val resources = RuntimeEnvironment.getApplication().resources
|
||||
|
||||
val lightColors = resources.getIntArray(R.array.account_colors)
|
||||
val darkColors = resources.getIntArray(R.array.drawer_account_accent_color_dark_theme)
|
||||
|
|
|
@ -70,7 +70,7 @@ public class MessageCryptoHelperTest extends RobolectricTest {
|
|||
when(openPgpApiFactory.createOpenPgpApi(any(Context.class), nullable(IOpenPgpService2.class)))
|
||||
.thenReturn(openPgpApi);
|
||||
|
||||
messageCryptoHelper = new MessageCryptoHelper(RuntimeEnvironment.application, openPgpApiFactory,
|
||||
messageCryptoHelper = new MessageCryptoHelper(RuntimeEnvironment.getApplication(), openPgpApiFactory,
|
||||
autocryptOperations, "org.example.dummy");
|
||||
messageCryptoCallback = mock(MessageCryptoCallback.class);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import org.robolectric.annotation.Config
|
|||
@Config(qualifiers = "en")
|
||||
class RelativeDateTimeFormatterTest : RobolectricTest() {
|
||||
|
||||
private val context = RuntimeEnvironment.application.applicationContext
|
||||
private val context = RuntimeEnvironment.getApplication().applicationContext
|
||||
private val clock = TestClock()
|
||||
private val dateTimeFormatter = RelativeDateTimeFormatter(context, clock)
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import org.robolectric.annotation.Config
|
|||
|
||||
@Config(qualifiers = "en")
|
||||
class SizeFormatterTest : RobolectricTest() {
|
||||
private val sizeFormatter = SizeFormatter(RuntimeEnvironment.application.resources)
|
||||
private val sizeFormatter = SizeFormatter(RuntimeEnvironment.getApplication().resources)
|
||||
|
||||
@Test
|
||||
fun bytes_lower_bound() {
|
||||
|
|
|
@ -21,7 +21,7 @@ interface Backend {
|
|||
fun refreshFolderList()
|
||||
|
||||
// TODO: Add a way to cancel the sync process
|
||||
fun sync(folder: String, syncConfig: SyncConfig, listener: SyncListener)
|
||||
fun sync(folderServerId: String, syncConfig: SyncConfig, listener: SyncListener)
|
||||
|
||||
@Throws(MessagingException::class)
|
||||
fun downloadMessage(syncConfig: SyncConfig, folderServerId: String, messageServerId: String)
|
||||
|
|
|
@ -51,8 +51,8 @@ class ImapBackend(
|
|||
commandRefreshFolderList.refreshFolderList()
|
||||
}
|
||||
|
||||
override fun sync(folder: String, syncConfig: SyncConfig, listener: SyncListener) {
|
||||
imapSync.sync(folder, syncConfig, listener)
|
||||
override fun sync(folderServerId: String, syncConfig: SyncConfig, listener: SyncListener) {
|
||||
imapSync.sync(folderServerId, syncConfig, listener)
|
||||
}
|
||||
|
||||
override fun downloadMessage(syncConfig: SyncConfig, folderServerId: String, messageServerId: String) {
|
||||
|
|
|
@ -45,8 +45,8 @@ class JmapBackend(
|
|||
commandRefreshFolderList.refreshFolderList()
|
||||
}
|
||||
|
||||
override fun sync(folder: String, syncConfig: SyncConfig, listener: SyncListener) {
|
||||
commandSync.sync(folder, syncConfig, listener)
|
||||
override fun sync(folderServerId: String, syncConfig: SyncConfig, listener: SyncListener) {
|
||||
commandSync.sync(folderServerId, syncConfig, listener)
|
||||
}
|
||||
|
||||
override fun downloadMessage(syncConfig: SyncConfig, folderServerId: String, messageServerId: String) {
|
||||
|
|
|
@ -18,6 +18,7 @@ internal inline fun <reified T : MethodResponse> JmapRequest.Call.getMainRespons
|
|||
return methodResponses.getMainResponseBlocking()
|
||||
}
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
internal inline fun <T> ListenableFuture<T>.futureGetOrThrow(): T {
|
||||
return try {
|
||||
get()
|
||||
|
|
|
@ -38,8 +38,8 @@ class Pop3Backend(
|
|||
commandRefreshFolderList.refreshFolderList()
|
||||
}
|
||||
|
||||
override fun sync(folder: String, syncConfig: SyncConfig, listener: SyncListener) {
|
||||
pop3Sync.sync(folder, syncConfig, listener)
|
||||
override fun sync(folderServerId: String, syncConfig: SyncConfig, listener: SyncListener) {
|
||||
pop3Sync.sync(folderServerId, syncConfig, listener)
|
||||
}
|
||||
|
||||
override fun downloadMessage(syncConfig: SyncConfig, folderServerId: String, messageServerId: String) {
|
||||
|
|
|
@ -35,11 +35,13 @@ class InMemoryBackendStorage : BackendStorage {
|
|||
}
|
||||
|
||||
private inner class InMemoryBackendFolderUpdater : BackendFolderUpdater {
|
||||
override fun createFolders(foldersToCreate: List<FolderInfo>) {
|
||||
foldersToCreate.forEach { folder ->
|
||||
if (folders.containsKey(folder.serverId)) error("Folder ${folder.serverId} already present")
|
||||
override fun createFolders(folders: List<FolderInfo>) {
|
||||
folders.forEach { folder ->
|
||||
if (this@InMemoryBackendStorage.folders.containsKey(folder.serverId)) {
|
||||
error("Folder ${folder.serverId} already present")
|
||||
}
|
||||
|
||||
folders[folder.serverId] = InMemoryBackendFolder(folder.name, folder.type)
|
||||
this@InMemoryBackendStorage.folders[folder.serverId] = InMemoryBackendFolder(folder.name, folder.type)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,8 +42,8 @@ class WebDavBackend(
|
|||
commandGetFolders.refreshFolderList()
|
||||
}
|
||||
|
||||
override fun sync(folder: String, syncConfig: SyncConfig, listener: SyncListener) {
|
||||
webDavSync.sync(folder, syncConfig, listener)
|
||||
override fun sync(folderServerId: String, syncConfig: SyncConfig, listener: SyncListener) {
|
||||
webDavSync.sync(folderServerId, syncConfig, listener)
|
||||
}
|
||||
|
||||
override fun downloadMessage(syncConfig: SyncConfig, folderServerId: String, messageServerId: String) {
|
||||
|
|
|
@ -68,7 +68,7 @@ object Timber {
|
|||
|
||||
@JvmStatic
|
||||
fun e(message: String?, vararg args: Any?) {
|
||||
logger.e(message)
|
||||
logger.e(message, *args)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
|
|
|
@ -2,6 +2,8 @@ package org.openintents.openpgp;
|
|||
|
||||
|
||||
import android.app.PendingIntent;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.Lifecycle.Event;
|
||||
import androidx.lifecycle.LifecycleObserver;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
@ -224,6 +226,7 @@ public class OpenPgpApiManager implements LifecycleObserver {
|
|||
return openPgpProviderName != null ? openPgpProviderName : openPgpProvider;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public OpenPgpProviderState getOpenPgpProviderState() {
|
||||
return openPgpProviderState;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue