mirror of
https://github.com/etesync/android
synced 2024-12-23 07:08:16 +00:00
Update deps and adjust code accordingly.
This commit is contained in:
parent
19c0f8988b
commit
b76b9e7f6d
@ -18,7 +18,7 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.etesync.syncadapter"
|
applicationId "com.etesync.syncadapter"
|
||||||
|
|
||||||
minSdkVersion 19
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
|
|
||||||
versionCode 200
|
versionCode 200
|
||||||
@ -126,6 +126,10 @@ android {
|
|||||||
targetCompatibility JavaVersion.VERSION_1_8
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "1.8"
|
||||||
|
}
|
||||||
|
|
||||||
dataBinding.enabled = true
|
dataBinding.enabled = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ import android.provider.ContactsContract
|
|||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import at.bitfire.ical4android.AndroidCalendar
|
import at.bitfire.ical4android.AndroidCalendar
|
||||||
import at.bitfire.ical4android.CalendarStorageException
|
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 at.bitfire.vcard4android.ContactsStorageException
|
||||||
import com.etesync.syncadapter.log.Logger
|
import com.etesync.syncadapter.log.Logger
|
||||||
import com.etesync.syncadapter.model.*
|
import com.etesync.syncadapter.model.*
|
||||||
@ -87,7 +87,7 @@ class App : Application() {
|
|||||||
tasksFilter.addDataScheme("package")
|
tasksFilter.addDataScheme("package")
|
||||||
registerReceiver(PackageChangedReceiver(), tasksFilter)
|
registerReceiver(PackageChangedReceiver(), tasksFilter)
|
||||||
|
|
||||||
OPENTASK_PROVIDERS.forEach {
|
TASK_PROVIDERS.forEach {
|
||||||
// check whether a tasks app is currently installed
|
// check whether a tasks app is currently installed
|
||||||
TaskProviderHandling.updateTaskSync(this@App, it)
|
TaskProviderHandling.updateTaskSync(this@App, it)
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ class PackageChangedReceiver : BroadcastReceiver() {
|
|||||||
@SuppressLint("MissingPermission")
|
@SuppressLint("MissingPermission")
|
||||||
override fun onReceive(context: Context, intent: Intent) {
|
override fun onReceive(context: Context, intent: Intent) {
|
||||||
if (Intent.ACTION_PACKAGE_ADDED == intent.action || Intent.ACTION_PACKAGE_FULLY_REMOVED == intent.action) {
|
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)
|
updateTaskSync(context, it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ import android.provider.CalendarContract
|
|||||||
import android.provider.CalendarContract.Events
|
import android.provider.CalendarContract.Events
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import at.bitfire.ical4android.*
|
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.Constants
|
||||||
import com.etesync.syncadapter.log.Logger
|
import com.etesync.syncadapter.log.Logger
|
||||||
import net.fortuna.ical4j.model.component.VAlarm
|
import net.fortuna.ical4j.model.component.VAlarm
|
||||||
@ -72,8 +72,8 @@ class LocalEvent : AndroidEvent, LocalResource<Event> {
|
|||||||
|
|
||||||
/* process LocalEvent-specific fields */
|
/* process LocalEvent-specific fields */
|
||||||
|
|
||||||
override fun populateEvent(row: ContentValues) {
|
override fun populateEvent(row: ContentValues, groupScheduled: Boolean) {
|
||||||
super.populateEvent(row)
|
super.populateEvent(row, groupScheduled)
|
||||||
fileName = row.getAsString(Events._SYNC_ID)
|
fileName = row.getAsString(Events._SYNC_ID)
|
||||||
eTag = row.getAsString(COLUMN_ETAG)
|
eTag = row.getAsString(COLUMN_ETAG)
|
||||||
event?.uid = row.getAsString(COLUMN_UID)
|
event?.uid = row.getAsString(COLUMN_UID)
|
||||||
@ -119,13 +119,11 @@ class LocalEvent : AndroidEvent, LocalResource<Event> {
|
|||||||
super.insertReminder(batch, idxEvent, modifiedAlarm)
|
super.insertReminder(batch, idxEvent, modifiedAlarm)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Throws(CalendarStorageException::class)
|
|
||||||
fun addAsDirty(): Uri {
|
fun addAsDirty(): Uri {
|
||||||
saveAsDirty = true
|
saveAsDirty = true
|
||||||
return this.add()
|
return this.add()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Throws(CalendarStorageException::class)
|
|
||||||
fun updateAsDirty(event: Event): Uri {
|
fun updateAsDirty(event: Event): Uri {
|
||||||
saveAsDirty = true
|
saveAsDirty = true
|
||||||
return this.update(event)
|
return this.update(event)
|
||||||
|
@ -41,7 +41,7 @@ class TasksSyncAdapterService: SyncAdapterService() {
|
|||||||
): SyncAdapter(context) {
|
): SyncAdapter(context) {
|
||||||
override fun onPerformSyncDo(account: Account, extras: Bundle, authority: String, provider: ContentProviderClient, syncResult: SyncResult) {
|
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
|
// make sure account can be seen by OpenTasks
|
||||||
if (Build.VERSION.SDK_INT >= 26)
|
if (Build.VERSION.SDK_INT >= 26)
|
||||||
|
@ -25,7 +25,7 @@ import android.widget.*
|
|||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.appcompat.widget.Toolbar
|
import androidx.appcompat.widget.Toolbar
|
||||||
import androidx.core.content.ContextCompat
|
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 at.bitfire.vcard4android.ContactsStorageException
|
||||||
import com.etebase.client.CollectionAccessLevel
|
import com.etebase.client.CollectionAccessLevel
|
||||||
import com.etebase.client.CollectionManager
|
import com.etebase.client.CollectionManager
|
||||||
@ -455,7 +455,7 @@ class AccountActivity : BaseActivity(), Toolbar.OnMenuItemClickListener, PopupMe
|
|||||||
CollectionInfo.Type.TASKS -> {
|
CollectionInfo.Type.TASKS -> {
|
||||||
info.taskdav = AccountInfo.ServiceInfo()
|
info.taskdav = AccountInfo.ServiceInfo()
|
||||||
info.taskdav!!.refreshing = davService != null && davService!!.isRefreshing(id) ||
|
info.taskdav!!.refreshing = davService != null && davService!!.isRefreshing(id) ||
|
||||||
OPENTASK_PROVIDERS.any {
|
TASK_PROVIDERS.any {
|
||||||
ContentResolver.isSyncActive(account, it.authority)
|
ContentResolver.isSyncActive(account, it.authority)
|
||||||
}
|
}
|
||||||
info.taskdav!!.infos = getLegacyJournals(data, serviceEntity)
|
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.caldav!!.infos = getCollections(etebaseLocalCache, colMgr, CollectionInfo.Type.CALENDAR)
|
||||||
|
|
||||||
info.taskdav = AccountInfo.ServiceInfo()
|
info.taskdav = AccountInfo.ServiceInfo()
|
||||||
info.taskdav!!.refreshing = OPENTASK_PROVIDERS.any {
|
info.taskdav!!.refreshing = TASK_PROVIDERS.any {
|
||||||
ContentResolver.isSyncActive(account, it.authority)
|
ContentResolver.isSyncActive(account, it.authority)
|
||||||
}
|
}
|
||||||
info.taskdav!!.infos = getCollections(etebaseLocalCache, colMgr, CollectionInfo.Type.TASKS)
|
info.taskdav!!.infos = getCollections(etebaseLocalCache, colMgr, CollectionInfo.Type.TASKS)
|
||||||
|
@ -24,7 +24,7 @@ import androidx.loader.app.LoaderManager
|
|||||||
import androidx.loader.content.AsyncTaskLoader
|
import androidx.loader.content.AsyncTaskLoader
|
||||||
import androidx.loader.content.Loader
|
import androidx.loader.content.Loader
|
||||||
import androidx.preference.*
|
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.*
|
||||||
import com.etesync.syncadapter.Constants.KEY_ACCOUNT
|
import com.etesync.syncadapter.Constants.KEY_ACCOUNT
|
||||||
import com.etesync.syncadapter.R
|
import com.etesync.syncadapter.R
|
||||||
@ -115,7 +115,7 @@ class AccountSettingsFragment() : PreferenceFragmentCompat(), LoaderManager.Load
|
|||||||
val newInterval = java.lang.Long.parseLong(newValue as String)
|
val newInterval = java.lang.Long.parseLong(newValue as String)
|
||||||
settings.setSyncInterval(App.addressBooksAuthority, newInterval)
|
settings.setSyncInterval(App.addressBooksAuthority, newInterval)
|
||||||
settings.setSyncInterval(CalendarContract.AUTHORITY, newInterval)
|
settings.setSyncInterval(CalendarContract.AUTHORITY, newInterval)
|
||||||
OPENTASK_PROVIDERS.forEach {
|
TASK_PROVIDERS.forEach {
|
||||||
settings.setSyncInterval(it.authority, newInterval)
|
settings.setSyncInterval(it.authority, newInterval)
|
||||||
}
|
}
|
||||||
loaderManager.restartLoader(0, arguments, this@AccountSettingsFragment)
|
loaderManager.restartLoader(0, arguments, this@AccountSettingsFragment)
|
||||||
@ -215,7 +215,7 @@ class LegacyAccountSettingsFragment : PreferenceFragmentCompat(), LoaderManager.
|
|||||||
val newInterval = java.lang.Long.parseLong(newValue as String)
|
val newInterval = java.lang.Long.parseLong(newValue as String)
|
||||||
settings.setSyncInterval(App.addressBooksAuthority, newInterval)
|
settings.setSyncInterval(App.addressBooksAuthority, newInterval)
|
||||||
settings.setSyncInterval(CalendarContract.AUTHORITY, newInterval)
|
settings.setSyncInterval(CalendarContract.AUTHORITY, newInterval)
|
||||||
OPENTASK_PROVIDERS.forEach {
|
TASK_PROVIDERS.forEach {
|
||||||
settings.setSyncInterval(it.authority, newInterval)
|
settings.setSyncInterval(it.authority, newInterval)
|
||||||
}
|
}
|
||||||
loaderManager.restartLoader(0, arguments, this@LegacyAccountSettingsFragment)
|
loaderManager.restartLoader(0, arguments, this@LegacyAccountSettingsFragment)
|
||||||
|
@ -16,7 +16,7 @@ import android.view.View
|
|||||||
import androidx.annotation.IdRes
|
import androidx.annotation.IdRes
|
||||||
import androidx.core.app.ActivityCompat
|
import androidx.core.app.ActivityCompat
|
||||||
import androidx.core.app.NotificationManagerCompat
|
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 at.bitfire.ical4android.TaskProvider.ProviderName
|
||||||
import com.etesync.syncadapter.Constants
|
import com.etesync.syncadapter.Constants
|
||||||
import com.etesync.syncadapter.R
|
import com.etesync.syncadapter.R
|
||||||
@ -86,7 +86,7 @@ class PermissionsActivity : BaseActivity() {
|
|||||||
private val REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS = 124
|
private val REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS = 124
|
||||||
|
|
||||||
fun requestAllPermissions(activity: Activity) {
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ import android.app.ProgressDialog
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.provider.CalendarContract
|
import android.provider.CalendarContract
|
||||||
import androidx.fragment.app.DialogFragment
|
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.*
|
||||||
import com.etesync.syncadapter.log.Logger
|
import com.etesync.syncadapter.log.Logger
|
||||||
import com.etesync.syncadapter.ui.setup.BaseConfigurationFinder.Configuration
|
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
|
// calendar sync is automatically enabled by isAlwaysSyncable="true" in res/xml/sync_contacts.xml
|
||||||
settings.setSyncInterval(CalendarContract.AUTHORITY, Constants.DEFAULT_SYNC_INTERVAL.toLong())
|
settings.setSyncInterval(CalendarContract.AUTHORITY, Constants.DEFAULT_SYNC_INTERVAL.toLong())
|
||||||
|
|
||||||
OPENTASK_PROVIDERS.forEach {
|
TASK_PROVIDERS.forEach {
|
||||||
// enable task sync if OpenTasks is installed
|
// enable task sync if OpenTasks is installed
|
||||||
// further changes will be handled by PackageChangedReceiver
|
// further changes will be handled by PackageChangedReceiver
|
||||||
TaskProviderHandling.updateTaskSync(requireContext(), it)
|
TaskProviderHandling.updateTaskSync(requireContext(), it)
|
||||||
|
@ -19,7 +19,7 @@ import android.os.Bundle
|
|||||||
import android.provider.CalendarContract
|
import android.provider.CalendarContract
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.fragment.app.DialogFragment
|
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.Crypto
|
||||||
import com.etesync.journalmanager.Exceptions
|
import com.etesync.journalmanager.Exceptions
|
||||||
import com.etesync.syncadapter.*
|
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
|
// calendar sync is automatically enabled by isAlwaysSyncable="true" in res/xml/sync_contacts.xml
|
||||||
settings.setSyncInterval(CalendarContract.AUTHORITY, Constants.DEFAULT_SYNC_INTERVAL.toLong())
|
settings.setSyncInterval(CalendarContract.AUTHORITY, Constants.DEFAULT_SYNC_INTERVAL.toLong())
|
||||||
|
|
||||||
OPENTASK_PROVIDERS.forEach {
|
TASK_PROVIDERS.forEach {
|
||||||
// enable task sync if OpenTasks is installed
|
// enable task sync if OpenTasks is installed
|
||||||
// further changes will be handled by PackageChangedReceiver
|
// further changes will be handled by PackageChangedReceiver
|
||||||
TaskProviderHandling.updateTaskSync(context!!, it)
|
TaskProviderHandling.updateTaskSync(context!!, it)
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
kotlin_version = '1.3.30'
|
kotlin_version = '1.4.10'
|
||||||
gradle_version = '4.0.0'
|
gradle_version = '4.0.0'
|
||||||
compileSdkVersion = 28
|
compileSdkVersion = 28
|
||||||
buildToolsVersion = '29.0.3'
|
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.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.3.30'
|
ext.kotlin_version = '1.4.10'
|
||||||
ext.gradle_version = '4.0.0'
|
ext.gradle_version = '4.0.0'
|
||||||
|
|
||||||
repositories {
|
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
|
Loading…
Reference in New Issue
Block a user