Skip to content

Commit 37b6619

Browse files
committed
use smt_private for the private account name
1 parent e5862e7 commit 37b6619

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/CreateNewGroupDialog.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import com.simplemobiletools.commons.extensions.toast
1010
import com.simplemobiletools.commons.extensions.value
1111
import com.simplemobiletools.commons.models.RadioItem
1212
import com.simplemobiletools.contacts.pro.R
13+
import com.simplemobiletools.contacts.pro.extensions.getPrivateContactSource
1314
import com.simplemobiletools.contacts.pro.helpers.ContactsHelper
14-
import com.simplemobiletools.contacts.pro.helpers.SMT_PRIVATE
1515
import com.simplemobiletools.contacts.pro.models.ContactSource
1616
import com.simplemobiletools.contacts.pro.models.Group
1717
import kotlinx.android.synthetic.main.dialog_create_new_group.view.*
@@ -36,8 +36,7 @@ class CreateNewGroupDialog(val activity: BaseSimpleActivity, val callback: (newG
3636
val contactSources = ArrayList<ContactSource>()
3737
ContactsHelper(activity).getContactSources {
3838
it.filter { it.type.contains("google", true) }.mapTo(contactSources) { ContactSource(it.name, it.type, it.name) }
39-
val phoneSecret = activity.getString(R.string.phone_storage_hidden)
40-
contactSources.add(ContactSource(phoneSecret, SMT_PRIVATE, phoneSecret))
39+
contactSources.add(activity.getPrivateContactSource())
4140

4241
val items = ArrayList<RadioItem>()
4342
contactSources.forEachIndexed { index, contactSource ->

app/src/main/kotlin/com/simplemobiletools/contacts/pro/extensions/Context.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,13 +307,12 @@ fun Context.getVisibleContactSources(): ArrayList<String> {
307307
val sources = getAllContactSources()
308308
val ignoredContactSources = config.ignoredContactSources
309309
return ArrayList(sources).filter { !ignoredContactSources.contains(it.getFullIdentifier()) }
310-
.map { if (it.type == SMT_PRIVATE) SMT_PRIVATE else it.name }.toMutableList() as ArrayList<String>
310+
.map { it.name }.toMutableList() as ArrayList<String>
311311
}
312312

313313
fun Context.getAllContactSources(): List<ContactSource> {
314314
val sources = ContactsHelper(this).getDeviceContactSources()
315-
val phoneSecret = getString(R.string.phone_storage_hidden)
316-
sources.add(ContactSource(phoneSecret, SMT_PRIVATE, phoneSecret))
315+
sources.add(getPrivateContactSource())
317316
return sources.toMutableList()
318317
}
319318

@@ -372,3 +371,5 @@ fun Context.deleteBlockedNumber(number: String) {
372371

373372
@TargetApi(Build.VERSION_CODES.M)
374373
fun Context.isDefaultDialer() = isMarshmallowPlus() && telecomManager.defaultDialerPackage == packageName
374+
375+
fun Context.getPrivateContactSource() = ContactSource(SMT_PRIVATE, SMT_PRIVATE, getString(R.string.phone_storage_hidden))

app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -845,8 +845,7 @@ class ContactsHelper(val context: Context) {
845845

846846
private fun getContactSourcesSync(): ArrayList<ContactSource> {
847847
val sources = getDeviceContactSources()
848-
val phoneSecret = context.getString(R.string.phone_storage_hidden)
849-
sources.add(ContactSource(phoneSecret, SMT_PRIVATE, phoneSecret))
848+
sources.add(context.getPrivateContactSource())
850849
return ArrayList(sources)
851850
}
852851

0 commit comments

Comments
 (0)