Skip to content

Commit d8aad54

Browse files
committed
Merge branch 'migrate-main-activity' into migrate-intro-about
# Conflicts: # app/src/main/kotlin/at/bitfire/davdroid/ui/MainActivity.kt
2 parents 52fde0c + 5b93526 commit d8aad54

File tree

113 files changed

+1050
-922
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+1050
-922
lines changed

Diff for: .idea/copyright/LICENSE.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: .idea/copyright/profiles_settings.xml

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: AUTHORS

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
# This is the list of significant contributors to DAVx5.
2-
#
3-
# This does not necessarily list everyone who has contributed work.
4-
# To see the full list of contributors, see the revision history in
5-
# source control.
1+
You can view the list of people who have contributed to the code base in the version control history:
2+
https://github.com/bitfireAT/davx5-ose/graphs/contributors
63

7-
Ricki Hirner (bitfire.at)
8-
Bernhard Stockmann (bitfire.at)
4+
Translators are not mentioned in the history explicitly.
5+
The list of translators can be found in the About screen.
96

10-
Sunik Kupfer (bitfire.at)
11-
Patrick Lang (techbee.at)
7+
Every contribution is welcome. There are many other forms of contributing besides writing code!

Diff for: app/build.gradle.kts

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ android {
1919
defaultConfig {
2020
applicationId = "at.bitfire.davdroid"
2121

22-
versionCode = 404060000
23-
versionName = "4.4.6-alpha.1"
22+
versionCode = 404060001
23+
versionName = "4.4.6-beta.1"
2424

2525
setProperty("archivesBaseName", "davx5-ose-$versionName")
2626

Diff for: app/src/androidTest/AndroidManifest.xml

-17
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,4 @@
77
<uses-permission android:name="android.permission.GET_ACCOUNTS" android:maxSdkVersion="22"/>
88
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" android:maxSdkVersion="22"/>
99

10-
<application>
11-
12-
<!-- test account type (without associated sync adapters) -->
13-
<service
14-
android:name="at.bitfire.davdroid.sync.account.TestAccountAuthenticator"
15-
android:exported="false">
16-
<intent-filter>
17-
<action android:name="android.accounts.AccountAuthenticator"/>
18-
</intent-filter>
19-
20-
<meta-data
21-
android:name="android.accounts.AccountAuthenticator"
22-
android:resource="@xml/test_account_authenticator"/>
23-
</service>
24-
25-
</application>
26-
2710
</manifest>

Diff for: app/src/androidTest/kotlin/at/bitfire/davdroid/Dav4jvm.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/***************************************************************************************************
1+
/*
22
* Copyright © All Contributors. See LICENSE and AUTHORS in the root directory for details.
3-
**************************************************************************************************/
3+
*/
44

55
package at.bitfire.davdroid
66

Diff for: app/src/androidTest/kotlin/at/bitfire/davdroid/TestModules.kt

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/*
2+
* Copyright © All Contributors. See LICENSE and AUTHORS in the root directory for details.
3+
*/
4+
15
package at.bitfire.davdroid
26

37
import at.bitfire.davdroid.push.PushRegistrationWorkerManager

Diff for: app/src/androidTest/kotlin/at/bitfire/davdroid/repository/DavCollectionRepositoryTest.kt

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/*
2+
* Copyright © All Contributors. See LICENSE and AUTHORS in the root directory for details.
3+
*/
4+
15
package at.bitfire.davdroid.repository
26

37
import android.content.Context

Diff for: app/src/androidTest/kotlin/at/bitfire/davdroid/repository/DavHomeSetRepositoryTest.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@ class DavHomeSetRepositoryTest {
4141
val entry1 = HomeSet(id=0, serviceId=serviceId, personal=true, url="https://example.com/1".toHttpUrl())
4242
val insertId1 = repository.insertOrUpdateByUrl(entry1)
4343
assertEquals(1L, insertId1)
44-
assertEquals(entry1.apply { id = 1L }, repository.getById(1L))
44+
assertEquals(entry1.copy(id = 1L), repository.getById(1L))
4545

4646
val updatedEntry1 = HomeSet(id=0, serviceId=serviceId, personal=true, url="https://example.com/1".toHttpUrl(), displayName="Updated Entry")
4747
val updateId1 = repository.insertOrUpdateByUrl(updatedEntry1)
4848
assertEquals(1L, updateId1)
49-
assertEquals(updatedEntry1.apply { id = 1L }, repository.getById(1L))
49+
assertEquals(updatedEntry1.copy(id = 1L), repository.getById(1L))
5050

5151
val entry2 = HomeSet(id=0, serviceId=serviceId, personal=true, url= "https://example.com/2".toHttpUrl())
5252
val insertId2 = repository.insertOrUpdateByUrl(entry2)
5353
assertEquals(2L, insertId2)
54-
assertEquals(entry2.apply { id = 2L }, repository.getById(2L))
54+
assertEquals(entry2.copy(id = 2L), repository.getById(2L))
5555
}
5656

5757
@Test

Diff for: app/src/androidTest/kotlin/at/bitfire/davdroid/resource/LocalAddressBookStoreTest.kt

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/*
2+
* Copyright © All Contributors. See LICENSE and AUTHORS in the root directory for details.
3+
*/
4+
15
package at.bitfire.davdroid.resource
26

37
import android.accounts.Account

Diff for: app/src/androidTest/kotlin/at/bitfire/davdroid/resource/LocalAddressBookTest.kt

+11-19
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@ package at.bitfire.davdroid.resource
66

77
import android.Manifest
88
import android.accounts.Account
9-
import android.accounts.AccountManager
109
import android.content.ContentProviderClient
1110
import android.content.ContentUris
1211
import android.content.Context
1312
import android.provider.ContactsContract
1413
import androidx.test.platform.app.InstrumentationRegistry
1514
import androidx.test.rule.GrantPermissionRule
1615
import at.bitfire.vcard4android.Contact
17-
import at.bitfire.vcard4android.GroupMethod
1816
import at.bitfire.vcard4android.LabeledProperty
1917
import dagger.hilt.android.qualifiers.ApplicationContext
2018
import dagger.hilt.android.testing.HiltAndroidRule
@@ -24,7 +22,7 @@ import org.junit.After
2422
import org.junit.AfterClass
2523
import org.junit.Assert.assertEquals
2624
import org.junit.Assert.assertFalse
27-
import org.junit.Assert.assertNotNull
25+
import org.junit.Assert.assertTrue
2826
import org.junit.Before
2927
import org.junit.BeforeClass
3028
import org.junit.ClassRule
@@ -36,16 +34,12 @@ import javax.inject.Inject
3634
@HiltAndroidTest
3735
class LocalAddressBookTest {
3836

37+
@Inject @ApplicationContext
38+
lateinit var context: Context
39+
3940
@get:Rule
4041
val hiltRule = HiltAndroidRule(this)
4142

42-
@Inject
43-
lateinit var addressbookFactory: LocalTestAddressBook.Factory
44-
45-
@Inject
46-
@ApplicationContext
47-
lateinit var context: Context
48-
4943
val account = Account("Test Account", "Test Account Type")
5044
lateinit var addressBook: LocalTestAddressBook
5145

@@ -54,15 +48,13 @@ class LocalAddressBookTest {
5448
fun setUp() {
5549
hiltRule.inject()
5650

57-
addressBook = addressbookFactory.create(account, provider, GroupMethod.CATEGORIES)
58-
LocalTestAddressBook.createAccount(context)
51+
addressBook = LocalTestAddressBook.create(context, account, provider)
5952
}
6053

6154
@After
6255
fun tearDown() {
6356
// remove address book
64-
val accountManager = AccountManager.get(context)
65-
accountManager.removeAccountExplicitly(addressBook.addressBookAccount)
57+
addressBook.remove()
6658
}
6759

6860

@@ -87,7 +79,7 @@ class LocalAddressBookTest {
8779
// rename address book
8880
val newName = "New Name"
8981
addressBook.renameAccount(newName)
90-
assertEquals(Account(newName, LocalTestAddressBook.ACCOUNT.type), addressBook.addressBookAccount)
82+
assertEquals(newName, addressBook.addressBookAccount.name)
9183

9284
// check whether contact is still here (including data rows) and not dirty
9385
val result = addressBook.findContactById(id)
@@ -115,8 +107,8 @@ class LocalAddressBookTest {
115107

116108
// rename address book
117109
val newName = "New Name"
118-
addressBook.renameAccount(newName)
119-
assertEquals(Account(newName, LocalTestAddressBook.ACCOUNT.type), addressBook.addressBookAccount)
110+
assertTrue(addressBook.renameAccount(newName))
111+
assertEquals(newName, addressBook.addressBookAccount.name)
120112

121113
// check whether group is still here and not dirty
122114
val result = addressBook.findGroupById(id)
@@ -126,6 +118,7 @@ class LocalAddressBookTest {
126118
assertEquals("Test Group", group.displayName)
127119
}
128120

121+
129122
companion object {
130123

131124
@JvmField
@@ -137,9 +130,8 @@ class LocalAddressBookTest {
137130
@BeforeClass
138131
@JvmStatic
139132
fun connect() {
140-
val context = InstrumentationRegistry.getInstrumentation().targetContext
133+
val context = InstrumentationRegistry.getInstrumentation().context
141134
provider = context.contentResolver.acquireContentProviderClient(ContactsContract.AUTHORITY)!!
142-
assertNotNull(provider)
143135
}
144136

145137
@AfterClass

Diff for: app/src/androidTest/kotlin/at/bitfire/davdroid/resource/LocalCalendarTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class LocalCalendarTest {
119119
}
120120

121121
@Test
122-
// Flaky, Needs single or rec init of CalendarProvider (InitCalendarProviderRule)
122+
// Needs InitCalendarProviderRule
123123
fun testDeleteDirtyEventsWithoutInstances_Recurring_Instances() {
124124
val event = Event().apply {
125125
dtStart = DtStart("20220120T010203Z")

Diff for: app/src/androidTest/kotlin/at/bitfire/davdroid/resource/LocalEventTest.kt

+25-25
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import android.os.Build
1212
import android.provider.CalendarContract
1313
import android.provider.CalendarContract.ACCOUNT_TYPE_LOCAL
1414
import android.provider.CalendarContract.Events
15-
import androidx.datastore.dataStore
1615
import androidx.test.platform.app.InstrumentationRegistry
1716
import at.bitfire.davdroid.InitCalendarProviderRule
1817
import at.bitfire.ical4android.AndroidCalendar
@@ -41,29 +40,6 @@ import java.util.UUID
4140

4241
class LocalEventTest {
4342

44-
companion object {
45-
46-
@JvmField
47-
@ClassRule
48-
val initCalendarProviderRule: TestRule = InitCalendarProviderRule.getInstance()
49-
50-
private lateinit var provider: ContentProviderClient
51-
52-
@BeforeClass
53-
@JvmStatic
54-
fun setUpClass() {
55-
val context = InstrumentationRegistry.getInstrumentation().targetContext
56-
provider = context.contentResolver.acquireContentProviderClient(CalendarContract.AUTHORITY)!!
57-
}
58-
59-
@AfterClass
60-
@JvmStatic
61-
fun tearDownClass() {
62-
provider.closeCompat()
63-
}
64-
65-
}
66-
6743
private val account = Account("LocalCalendarTest", ACCOUNT_TYPE_LOCAL)
6844
private lateinit var calendar: LocalCalendar
6945

@@ -482,4 +458,28 @@ class LocalEventTest {
482458
}
483459
}
484460

485-
}
461+
462+
companion object {
463+
464+
@JvmField
465+
@ClassRule
466+
val initCalendarProviderRule: TestRule = InitCalendarProviderRule.getInstance()
467+
468+
private lateinit var provider: ContentProviderClient
469+
470+
@BeforeClass
471+
@JvmStatic
472+
fun setUpClass() {
473+
val context = InstrumentationRegistry.getInstrumentation().targetContext
474+
provider = context.contentResolver.acquireContentProviderClient(CalendarContract.AUTHORITY)!!
475+
}
476+
477+
@AfterClass
478+
@JvmStatic
479+
fun tearDownClass() {
480+
provider.closeCompat()
481+
}
482+
483+
}
484+
485+
}

Diff for: app/src/androidTest/kotlin/at/bitfire/davdroid/resource/LocalGroupTest.kt

+34-31
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import at.bitfire.vcard4android.GroupMethod
2121
import dagger.hilt.android.qualifiers.ApplicationContext
2222
import dagger.hilt.android.testing.HiltAndroidRule
2323
import dagger.hilt.android.testing.HiltAndroidTest
24+
import org.junit.After
2425
import org.junit.AfterClass
2526
import org.junit.Assert.assertEquals
2627
import org.junit.Assert.assertFalse
@@ -37,39 +38,12 @@ import javax.inject.Inject
3738
@HiltAndroidTest
3839
class LocalGroupTest {
3940

40-
companion object {
41-
42-
@JvmField
43-
@ClassRule
44-
val permissionRule = GrantPermissionRule.grant(Manifest.permission.READ_CONTACTS, Manifest.permission.WRITE_CONTACTS)!!
45-
46-
private lateinit var provider: ContentProviderClient
47-
48-
@BeforeClass
49-
@JvmStatic
50-
fun connect() {
51-
val context = InstrumentationRegistry.getInstrumentation().targetContext
52-
provider = context.contentResolver.acquireContentProviderClient(ContactsContract.AUTHORITY)!!
53-
assertNotNull(provider)
54-
}
55-
56-
@AfterClass
57-
@JvmStatic
58-
fun disconnect() {
59-
provider.close()
60-
}
61-
}
41+
@Inject @ApplicationContext
42+
lateinit var context: Context
6243

6344
@get:Rule
6445
val hiltRule = HiltAndroidRule(this)
6546

66-
@Inject
67-
@ApplicationContext
68-
lateinit var context: Context
69-
70-
@Inject
71-
lateinit var addressbookFactory: LocalTestAddressBook.Factory
72-
7347
val account = Account("Test Account", "Test Account Type")
7448
private lateinit var addressBookGroupsAsCategories: LocalTestAddressBook
7549
private lateinit var addressBookGroupsAsVCards: LocalTestAddressBook
@@ -78,14 +52,20 @@ class LocalGroupTest {
7852
fun setup() {
7953
hiltRule.inject()
8054

81-
addressBookGroupsAsCategories = addressbookFactory.create(account, provider, GroupMethod.CATEGORIES)
82-
addressBookGroupsAsVCards = addressbookFactory.create(account, provider, GroupMethod.GROUP_VCARDS)
55+
addressBookGroupsAsCategories = LocalTestAddressBook.create(context, account, provider, GroupMethod.CATEGORIES)
56+
addressBookGroupsAsVCards = LocalTestAddressBook.create(context, account, provider, GroupMethod.GROUP_VCARDS)
8357

8458
// clear contacts
8559
addressBookGroupsAsCategories.clear()
8660
addressBookGroupsAsVCards.clear()
8761
}
8862

63+
@After
64+
fun tearDown() {
65+
addressBookGroupsAsCategories.remove()
66+
addressBookGroupsAsVCards.remove()
67+
}
68+
8969

9070
@Test
9171
fun testApplyPendingMemberships_addPendingMembership() {
@@ -279,4 +259,27 @@ class LocalGroupTest {
279259
add()
280260
}
281261

262+
263+
companion object {
264+
265+
@JvmField
266+
@ClassRule
267+
val permissionRule = GrantPermissionRule.grant(Manifest.permission.READ_CONTACTS, Manifest.permission.WRITE_CONTACTS)!!
268+
269+
private lateinit var provider: ContentProviderClient
270+
271+
@BeforeClass
272+
@JvmStatic
273+
fun connect() {
274+
val context = InstrumentationRegistry.getInstrumentation().context
275+
provider = context.contentResolver.acquireContentProviderClient(ContactsContract.AUTHORITY)!!
276+
}
277+
278+
@AfterClass
279+
@JvmStatic
280+
fun disconnect() {
281+
provider.close()
282+
}
283+
}
284+
282285
}

0 commit comments

Comments
 (0)