diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/MainActivity.kt index 521ab60f..05446eb3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/MainActivity.kt @@ -73,12 +73,10 @@ class MainActivity : SimpleActivity(), RefreshContactsListener { if (it) { handlePermission(PERMISSION_WRITE_CONTACTS) { handlePermission(PERMISSION_GET_ACCOUNTS) { - storeLocalAccountData() initFragments() } } } else { - storeLocalAccountData() initFragments() } } @@ -279,24 +277,6 @@ class MainActivity : SimpleActivity(), RefreshContactsListener { } } - private fun storeLocalAccountData() { - if (config.localAccountType == "-1") { - ContactsHelper(this).getContactSources { sources -> - var localAccountType = "" - var localAccountName = "" - sources.forEach { - if (localAccountTypes.contains(it.type)) { - localAccountType = it.type - localAccountName = it.name - } - } - - config.localAccountType = localAccountType - config.localAccountName = localAccountName - } - } - } - private fun getInactiveTabIndexes(activeIndex: Int) = (0 until tabsList.size).filter { it != activeIndex } private fun initFragments() { diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/FilterContactSourcesAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/FilterContactSourcesAdapter.kt index c125072d..44332eba 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/FilterContactSourcesAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/adapters/FilterContactSourcesAdapter.kt @@ -22,10 +22,6 @@ class FilterContactSourcesAdapter(val activity: SimpleActivity, private val cont selectedKeys.add(contactSource.hashCode()) } - if (contactSource.name == activity.config.localAccountName && contactSource.type == activity.config.localAccountType) { - contactSource.name = activity.getString(R.string.phone_storage) - } - if (contactSource.type == SMT_PRIVATE && displayContactSources.contains(SMT_PRIVATE)) { selectedKeys.add(contactSource.hashCode()) } diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/CreateNewGroupDialog.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/CreateNewGroupDialog.kt index 2126c3c5..a76f57f3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/CreateNewGroupDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/CreateNewGroupDialog.kt @@ -10,7 +10,6 @@ import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.commons.extensions.value import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.contacts.pro.R -import com.simplemobiletools.contacts.pro.extensions.config import com.simplemobiletools.contacts.pro.helpers.ContactsHelper import com.simplemobiletools.contacts.pro.helpers.SMT_PRIVATE import com.simplemobiletools.contacts.pro.models.ContactSource @@ -35,11 +34,6 @@ class CreateNewGroupDialog(val activity: BaseSimpleActivity, val callback: (newG } val contactSources = ArrayList() - if (activity.config.localAccountName.isNotEmpty()) { - val localAccountName = activity.config.localAccountName - contactSources.add(ContactSource(localAccountName, activity.config.localAccountType, localAccountName)) - } - ContactsHelper(activity).getContactSources { it.filter { it.type.contains("google", true) }.mapTo(contactSources) { ContactSource(it.name, it.type, it.name) } val phoneSecret = activity.getString(R.string.phone_storage_hidden) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Activity.kt index 8f416c21..ec023538 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Activity.kt @@ -72,10 +72,6 @@ fun SimpleActivity.showContactSourcePicker(currentSource: String, callback: (new sources.forEachIndexed { index, account -> var publicAccount = account - if (account == config.localAccountName) { - publicAccount = getString(R.string.phone_storage) - } - items.add(RadioItem(index, publicAccount)) if (currentSource == SMT_PRIVATE && account == getString(R.string.phone_storage_hidden)) { currentSourceIndex = index diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Context.kt index 7cd82aad..1b307d40 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Context.kt @@ -197,7 +197,6 @@ fun Context.hasContactPermissions() = hasPermission(PERMISSION_READ_CONTACTS) && fun Context.getPublicContactSource(source: String, callback: (String) -> Unit) { when (source) { - config.localAccountName -> callback(getString(R.string.phone_storage)) SMT_PRIVATE -> callback(getString(R.string.phone_storage_hidden)) else -> { Thread { diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/Config.kt index 2ebed933..1dd4a759 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/Config.kt @@ -32,14 +32,6 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getString(LAST_USED_CONTACT_SOURCE, "") set(lastUsedContactSource) = prefs.edit().putString(LAST_USED_CONTACT_SOURCE, lastUsedContactSource).apply() - var localAccountName: String - get() = prefs.getString(LOCAL_ACCOUNT_NAME, "-1") - set(localAccountName) = prefs.edit().putString(LOCAL_ACCOUNT_NAME, localAccountName).apply() - - var localAccountType: String - get() = prefs.getString(LOCAL_ACCOUNT_TYPE, "-1") - set(localAccountType) = prefs.edit().putString(LOCAL_ACCOUNT_TYPE, localAccountType).apply() - var onContactClick: Int get() = prefs.getInt(ON_CONTACT_CLICK, ON_CLICK_VIEW_CONTACT) set(onContactClick) = prefs.edit().putInt(ON_CONTACT_CLICK, onContactClick).apply() diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/Constants.kt index 743ecfac..f4228e5d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/Constants.kt @@ -10,7 +10,6 @@ const val SHOW_ONLY_CONTACTS_WITH_NUMBERS = "show_only_contacts_with_numbers" const val IGNORED_CONTACT_SOURCES = "ignored_contact_sources_2" const val START_NAME_WITH_SURNAME = "start_name_with_surname" const val LAST_USED_CONTACT_SOURCE = "last_used_contact_source" -const val LOCAL_ACCOUNT_NAME = "local_account_name" const val LOCAL_ACCOUNT_TYPE = "local_account_type" const val ON_CONTACT_CLICK = "on_contact_click" const val SHOW_CONTACT_FIELDS = "show_contact_fields" diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt index 89fe463d..766f5a48 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt @@ -862,10 +862,6 @@ class ContactsHelper(val context: Context) { } sources.addAll(contentResolverAccounts) - if (sources.isEmpty() && context.config.localAccountName.isEmpty() && context.config.localAccountType.isEmpty()) { - sources.add(ContactSource("", "", "")) - } - return sources }