mirror of
https://github.com/etesync/android
synced 2025-01-10 15:51:08 +00:00
Remove redundant code.
This commit is contained in:
parent
dc3db43d70
commit
2284af19a7
@ -13,28 +13,23 @@ import android.accounts.AccountManager
|
|||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.app.Dialog
|
import android.app.Dialog
|
||||||
import android.app.ProgressDialog
|
import android.app.ProgressDialog
|
||||||
import android.content.ContentResolver
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.AsyncTask
|
import android.os.AsyncTask
|
||||||
import android.os.Bundle
|
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
|
|
||||||
import at.bitfire.ical4android.TaskProvider.Companion.OPENTASK_PROVIDERS
|
import at.bitfire.ical4android.TaskProvider.Companion.OPENTASK_PROVIDERS
|
||||||
import com.etesync.syncadapter.*
|
|
||||||
import com.etesync.journalmanager.Crypto
|
import com.etesync.journalmanager.Crypto
|
||||||
import com.etesync.journalmanager.Exceptions
|
import com.etesync.journalmanager.Exceptions
|
||||||
import com.etesync.journalmanager.UserInfoManager
|
import com.etesync.syncadapter.*
|
||||||
import com.etesync.syncadapter.log.Logger
|
import com.etesync.syncadapter.log.Logger
|
||||||
import com.etesync.syncadapter.model.CollectionInfo
|
import com.etesync.syncadapter.model.CollectionInfo
|
||||||
import com.etesync.syncadapter.model.JournalEntity
|
import com.etesync.syncadapter.model.JournalEntity
|
||||||
import com.etesync.syncadapter.model.ServiceEntity
|
import com.etesync.syncadapter.model.ServiceEntity
|
||||||
import com.etesync.syncadapter.resource.LocalTaskList
|
|
||||||
import com.etesync.syncadapter.ui.setup.BaseConfigurationFinder.Configuration
|
import com.etesync.syncadapter.ui.setup.BaseConfigurationFinder.Configuration
|
||||||
import com.etesync.syncadapter.utils.AndroidCompat
|
import com.etesync.syncadapter.utils.AndroidCompat
|
||||||
import com.etesync.syncadapter.utils.TaskProviderHandling
|
import com.etesync.syncadapter.utils.TaskProviderHandling
|
||||||
import okhttp3.HttpUrl
|
|
||||||
import java.util.logging.Level
|
import java.util.logging.Level
|
||||||
|
|
||||||
class SetupEncryptionFragment : DialogFragment() {
|
class SetupEncryptionFragment : DialogFragment() {
|
||||||
@ -138,30 +133,22 @@ class SetupEncryptionFragment : DialogFragment() {
|
|||||||
settings.keyPair = config.keyPair!!
|
settings.keyPair = config.keyPair!!
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.cardDAV != null) {
|
// insert CardDAV service
|
||||||
// insert CardDAV service
|
insertService(accountName, CollectionInfo.Type.ADDRESS_BOOK, config.cardDAV)
|
||||||
insertService(accountName, CollectionInfo.Type.ADDRESS_BOOK, config.cardDAV)
|
|
||||||
|
|
||||||
// contact sync is automatically enabled by isAlwaysSyncable="true" in res/xml/sync_contacts.xml
|
// contact sync is automatically enabled by isAlwaysSyncable="true" in res/xml/sync_contacts.xml
|
||||||
settings.setSyncInterval(App.addressBooksAuthority, Constants.DEFAULT_SYNC_INTERVAL.toLong())
|
settings.setSyncInterval(App.addressBooksAuthority, Constants.DEFAULT_SYNC_INTERVAL.toLong())
|
||||||
} else {
|
|
||||||
ContentResolver.setIsSyncable(account, App.addressBooksAuthority, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.calDAV != null) {
|
// insert CalDAV service
|
||||||
// insert CalDAV service
|
insertService(accountName, CollectionInfo.Type.CALENDAR, config.calDAV)
|
||||||
insertService(accountName, CollectionInfo.Type.CALENDAR, config.calDAV)
|
|
||||||
|
|
||||||
// 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 {
|
OPENTASK_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)
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ContentResolver.setIsSyncable(account, CalendarContract.AUTHORITY, 0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (e: InvalidAccountException) {
|
} catch (e: InvalidAccountException) {
|
||||||
|
Loading…
Reference in New Issue
Block a user