From b23bdf363826d9fb0120fd7f3a42409302c77b07 Mon Sep 17 00:00:00 2001 From: alexstyl <1665273+alexstyl@users.noreply.github.com> Date: Sun, 26 Feb 2023 21:52:31 +0200 Subject: [PATCH] Allow updating of contact groups' InternetAccount --- .../java/com/alexstyl/contactstore/EditGroupTest.kt | 3 +++ .../java/com/alexstyl/contactstore/GroupOperationsFactory.kt | 2 ++ 2 files changed, 5 insertions(+) diff --git a/library/src/androidTest/java/com/alexstyl/contactstore/EditGroupTest.kt b/library/src/androidTest/java/com/alexstyl/contactstore/EditGroupTest.kt index a9ae7de..c67f0a8 100644 --- a/library/src/androidTest/java/com/alexstyl/contactstore/EditGroupTest.kt +++ b/library/src/androidTest/java/com/alexstyl/contactstore/EditGroupTest.kt @@ -34,10 +34,12 @@ internal class EditGroupTest : ContactStoreTestBase() { val group = buildStoreContactGroup { note = "Note" title = "GroupTitle" + account = null } val updatedCopy = group.mutableCopy { note = "Updated Note" title = "Updated Title" + account = InternetAccount("test@test.com", "test.com") } store.execute { updateGroup(updatedCopy) @@ -49,6 +51,7 @@ internal class EditGroupTest : ContactStoreTestBase() { title = "Updated Title", contactCount = 0, note = "Updated Note", + account = InternetAccount("test@test.com", "test.com") ) assertThat(actual, samePropertiesAs(expected)) diff --git a/library/src/main/java/com/alexstyl/contactstore/GroupOperationsFactory.kt b/library/src/main/java/com/alexstyl/contactstore/GroupOperationsFactory.kt index 0089db2..39f0998 100644 --- a/library/src/main/java/com/alexstyl/contactstore/GroupOperationsFactory.kt +++ b/library/src/main/java/com/alexstyl/contactstore/GroupOperationsFactory.kt @@ -21,6 +21,8 @@ internal class GroupOperationsFactory { newUpdate(Groups.CONTENT_URI) .withValue(Groups.TITLE, group.title) .withValue(Groups.NOTES, group.note) + .withValue(Groups.ACCOUNT_TYPE, group.account?.type) + .withValue(Groups.ACCOUNT_NAME, group.account?.name) .withSelection("${Groups._ID} = ${group.groupId}", null) .build() )