1
0
mirror of https://github.com/etesync/android synced 2024-12-22 14:48:11 +00:00

Update deps and adjust code accordingly.

This commit is contained in:
Tom Hacohen 2020-10-01 10:03:04 +03:00
parent 19c0f8988b
commit b76b9e7f6d
14 changed files with 29 additions and 27 deletions

View File

@ -18,7 +18,7 @@ android {
defaultConfig {
applicationId "com.etesync.syncadapter"
minSdkVersion 19
minSdkVersion 21
targetSdkVersion 29
versionCode 200
@ -126,6 +126,10 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
dataBinding.enabled = true
}

View File

@ -24,7 +24,7 @@ import android.provider.ContactsContract
import androidx.core.content.ContextCompat
import at.bitfire.ical4android.AndroidCalendar
import at.bitfire.ical4android.CalendarStorageException
import at.bitfire.ical4android.TaskProvider.Companion.OPENTASK_PROVIDERS
import at.bitfire.ical4android.TaskProvider.Companion.TASK_PROVIDERS
import at.bitfire.vcard4android.ContactsStorageException
import com.etesync.syncadapter.log.Logger
import com.etesync.syncadapter.model.*
@ -87,7 +87,7 @@ class App : Application() {
tasksFilter.addDataScheme("package")
registerReceiver(PackageChangedReceiver(), tasksFilter)
OPENTASK_PROVIDERS.forEach {
TASK_PROVIDERS.forEach {
// check whether a tasks app is currently installed
TaskProviderHandling.updateTaskSync(this@App, it)
}

View File

@ -20,7 +20,7 @@ class PackageChangedReceiver : BroadcastReceiver() {
@SuppressLint("MissingPermission")
override fun onReceive(context: Context, intent: Intent) {
if (Intent.ACTION_PACKAGE_ADDED == intent.action || Intent.ACTION_PACKAGE_FULLY_REMOVED == intent.action) {
TaskProvider.OPENTASK_PROVIDERS.forEach {
TaskProvider.TASK_PROVIDERS.forEach {
updateTaskSync(context, it)
}
}

View File

@ -15,7 +15,7 @@ import android.provider.CalendarContract
import android.provider.CalendarContract.Events
import android.text.TextUtils
import at.bitfire.ical4android.*
import at.bitfire.ical4android.Constants.ical4jVersion
import at.bitfire.ical4android.Ical4Android.ical4jVersion
import com.etesync.syncadapter.Constants
import com.etesync.syncadapter.log.Logger
import net.fortuna.ical4j.model.component.VAlarm
@ -72,8 +72,8 @@ class LocalEvent : AndroidEvent, LocalResource<Event> {
/* process LocalEvent-specific fields */
override fun populateEvent(row: ContentValues) {
super.populateEvent(row)
override fun populateEvent(row: ContentValues, groupScheduled: Boolean) {
super.populateEvent(row, groupScheduled)
fileName = row.getAsString(Events._SYNC_ID)
eTag = row.getAsString(COLUMN_ETAG)
event?.uid = row.getAsString(COLUMN_UID)
@ -119,13 +119,11 @@ class LocalEvent : AndroidEvent, LocalResource<Event> {
super.insertReminder(batch, idxEvent, modifiedAlarm)
}
@Throws(CalendarStorageException::class)
fun addAsDirty(): Uri {
saveAsDirty = true
return this.add()
}
@Throws(CalendarStorageException::class)
fun updateAsDirty(event: Event): Uri {
saveAsDirty = true
return this.update(event)

View File

@ -41,7 +41,7 @@ class TasksSyncAdapterService: SyncAdapterService() {
): SyncAdapter(context) {
override fun onPerformSyncDo(account: Account, extras: Bundle, authority: String, provider: ContentProviderClient, syncResult: SyncResult) {
val taskProvider = TaskProvider.fromProviderClient(context, provider, name)
val taskProvider = TaskProvider.fromProviderClient(context, name, provider)
// make sure account can be seen by OpenTasks
if (Build.VERSION.SDK_INT >= 26)

View File

@ -25,7 +25,7 @@ import android.widget.*
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.widget.Toolbar
import androidx.core.content.ContextCompat
import at.bitfire.ical4android.TaskProvider.Companion.OPENTASK_PROVIDERS
import at.bitfire.ical4android.TaskProvider.Companion.TASK_PROVIDERS
import at.bitfire.vcard4android.ContactsStorageException
import com.etebase.client.CollectionAccessLevel
import com.etebase.client.CollectionManager
@ -455,7 +455,7 @@ class AccountActivity : BaseActivity(), Toolbar.OnMenuItemClickListener, PopupMe
CollectionInfo.Type.TASKS -> {
info.taskdav = AccountInfo.ServiceInfo()
info.taskdav!!.refreshing = davService != null && davService!!.isRefreshing(id) ||
OPENTASK_PROVIDERS.any {
TASK_PROVIDERS.any {
ContentResolver.isSyncActive(account, it.authority)
}
info.taskdav!!.infos = getLegacyJournals(data, serviceEntity)
@ -490,7 +490,7 @@ class AccountActivity : BaseActivity(), Toolbar.OnMenuItemClickListener, PopupMe
info.caldav!!.infos = getCollections(etebaseLocalCache, colMgr, CollectionInfo.Type.CALENDAR)
info.taskdav = AccountInfo.ServiceInfo()
info.taskdav!!.refreshing = OPENTASK_PROVIDERS.any {
info.taskdav!!.refreshing = TASK_PROVIDERS.any {
ContentResolver.isSyncActive(account, it.authority)
}
info.taskdav!!.infos = getCollections(etebaseLocalCache, colMgr, CollectionInfo.Type.TASKS)

View File

@ -24,7 +24,7 @@ import androidx.loader.app.LoaderManager
import androidx.loader.content.AsyncTaskLoader
import androidx.loader.content.Loader
import androidx.preference.*
import at.bitfire.ical4android.TaskProvider.Companion.OPENTASK_PROVIDERS
import at.bitfire.ical4android.TaskProvider.Companion.TASK_PROVIDERS
import com.etesync.syncadapter.*
import com.etesync.syncadapter.Constants.KEY_ACCOUNT
import com.etesync.syncadapter.R
@ -115,7 +115,7 @@ class AccountSettingsFragment() : PreferenceFragmentCompat(), LoaderManager.Load
val newInterval = java.lang.Long.parseLong(newValue as String)
settings.setSyncInterval(App.addressBooksAuthority, newInterval)
settings.setSyncInterval(CalendarContract.AUTHORITY, newInterval)
OPENTASK_PROVIDERS.forEach {
TASK_PROVIDERS.forEach {
settings.setSyncInterval(it.authority, newInterval)
}
loaderManager.restartLoader(0, arguments, this@AccountSettingsFragment)
@ -215,7 +215,7 @@ class LegacyAccountSettingsFragment : PreferenceFragmentCompat(), LoaderManager.
val newInterval = java.lang.Long.parseLong(newValue as String)
settings.setSyncInterval(App.addressBooksAuthority, newInterval)
settings.setSyncInterval(CalendarContract.AUTHORITY, newInterval)
OPENTASK_PROVIDERS.forEach {
TASK_PROVIDERS.forEach {
settings.setSyncInterval(it.authority, newInterval)
}
loaderManager.restartLoader(0, arguments, this@LegacyAccountSettingsFragment)

View File

@ -16,7 +16,7 @@ import android.view.View
import androidx.annotation.IdRes
import androidx.core.app.ActivityCompat
import androidx.core.app.NotificationManagerCompat
import at.bitfire.ical4android.TaskProvider.Companion.OPENTASK_PROVIDERS
import at.bitfire.ical4android.TaskProvider.Companion.TASK_PROVIDERS
import at.bitfire.ical4android.TaskProvider.ProviderName
import com.etesync.syncadapter.Constants
import com.etesync.syncadapter.R
@ -86,7 +86,7 @@ class PermissionsActivity : BaseActivity() {
private val REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS = 124
fun requestAllPermissions(activity: Activity) {
ActivityCompat.requestPermissions(activity, arrayOf(Manifest.permission.READ_CALENDAR, Manifest.permission.WRITE_CALENDAR, Manifest.permission.READ_CONTACTS, Manifest.permission.WRITE_CONTACTS) + OPENTASK_PROVIDERS.flatMap { it.permissions.toList() }, REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS)
ActivityCompat.requestPermissions(activity, arrayOf(Manifest.permission.READ_CALENDAR, Manifest.permission.WRITE_CALENDAR, Manifest.permission.READ_CONTACTS, Manifest.permission.WRITE_CONTACTS) + TASK_PROVIDERS.flatMap { it.permissions.toList() }, REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS)
}
}
}

View File

@ -16,7 +16,7 @@ import android.app.ProgressDialog
import android.os.Bundle
import android.provider.CalendarContract
import androidx.fragment.app.DialogFragment
import at.bitfire.ical4android.TaskProvider.Companion.OPENTASK_PROVIDERS
import at.bitfire.ical4android.TaskProvider.Companion.TASK_PROVIDERS
import com.etesync.syncadapter.*
import com.etesync.syncadapter.log.Logger
import com.etesync.syncadapter.ui.setup.BaseConfigurationFinder.Configuration
@ -74,7 +74,7 @@ class CreateAccountFragment : DialogFragment() {
// calendar sync is automatically enabled by isAlwaysSyncable="true" in res/xml/sync_contacts.xml
settings.setSyncInterval(CalendarContract.AUTHORITY, Constants.DEFAULT_SYNC_INTERVAL.toLong())
OPENTASK_PROVIDERS.forEach {
TASK_PROVIDERS.forEach {
// enable task sync if OpenTasks is installed
// further changes will be handled by PackageChangedReceiver
TaskProviderHandling.updateTaskSync(requireContext(), it)

View File

@ -19,7 +19,7 @@ import android.os.Bundle
import android.provider.CalendarContract
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.DialogFragment
import at.bitfire.ical4android.TaskProvider.Companion.OPENTASK_PROVIDERS
import at.bitfire.ical4android.TaskProvider.Companion.TASK_PROVIDERS
import com.etesync.journalmanager.Crypto
import com.etesync.journalmanager.Exceptions
import com.etesync.syncadapter.*
@ -145,7 +145,7 @@ class SetupEncryptionFragment : DialogFragment() {
// calendar sync is automatically enabled by isAlwaysSyncable="true" in res/xml/sync_contacts.xml
settings.setSyncInterval(CalendarContract.AUTHORITY, Constants.DEFAULT_SYNC_INTERVAL.toLong())
OPENTASK_PROVIDERS.forEach {
TASK_PROVIDERS.forEach {
// enable task sync if OpenTasks is installed
// further changes will be handled by PackageChangedReceiver
TaskProviderHandling.updateTaskSync(context!!, it)

View File

@ -7,7 +7,7 @@
*/
ext {
kotlin_version = '1.3.30'
kotlin_version = '1.4.10'
gradle_version = '4.0.0'
compileSdkVersion = 28
buildToolsVersion = '29.0.3'
@ -15,7 +15,7 @@ ext {
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.30'
ext.kotlin_version = '1.4.10'
ext.gradle_version = '4.0.0'
repositories {

@ -1 +1 @@
Subproject commit 678e1db318e8e252cba4d2175f3cf265d7468d0a
Subproject commit 47bc6842daf9b93b28ae2ad8b65754dae2bc3ece

@ -1 +1 @@
Subproject commit 0a070c7866792756d90be429522127ef9108eff8
Subproject commit 3429dd1747e076c70535e6e36fb8130b3c718df7

@ -1 +1 @@
Subproject commit 6e5ea1b2bb2d9e6233c5dbfeda5b88592d146fdd
Subproject commit c6d8560a2e958dcdf8b98e3f0c0e8c0a417b0962