Add persistent EteSync v1 deprecation warning

pull/1375/head
Alex Baker 5 years ago
parent e18edfe161
commit 4ffb122cb1

@ -5,6 +5,7 @@ import android.view.View
import android.widget.ImageView import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import butterknife.BindView import butterknife.BindView
@ -45,7 +46,7 @@ internal class SubheaderViewHolder(
when (subheader.subheaderType) { when (subheader.subheaderType) {
SubheaderType.PREFERENCE -> preferences.setBoolean(subheader.id.toInt(), collapsed) SubheaderType.PREFERENCE -> preferences.setBoolean(subheader.id.toInt(), collapsed)
SubheaderType.GOOGLE_TASKS -> googleTaskDao.setCollapsed(subheader.id, collapsed) SubheaderType.GOOGLE_TASKS -> googleTaskDao.setCollapsed(subheader.id, collapsed)
SubheaderType.CALDAV, SubheaderType.TASKS -> SubheaderType.CALDAV, SubheaderType.TASKS, SubheaderType.ETESYNC ->
caldavDao.setCollapsed(subheader.id, collapsed) caldavDao.setCollapsed(subheader.id, collapsed)
} }
localBroadcastManager.broadcastRefreshList() localBroadcastManager.broadcastRefreshList()
@ -55,7 +56,17 @@ internal class SubheaderViewHolder(
fun bind(subheader: NavigationDrawerSubheader) { fun bind(subheader: NavigationDrawerSubheader) {
this.subheader = subheader this.subheader = subheader
text.text = subheader.listingTitle text.text = subheader.listingTitle
errorIcon.visibility = if (subheader.error) View.VISIBLE else View.GONE when {
subheader.error -> with(errorIcon) {
setColorFilter(ContextCompat.getColor(activity, R.color.overdue))
visibility = View.VISIBLE
}
subheader.subheaderType == SubheaderType.ETESYNC -> with(errorIcon) {
setColorFilter(ContextCompat.getColor(activity, R.color.orange_500))
visibility = View.VISIBLE
}
else -> errorIcon.visibility = View.GONE
}
DrawableUtil.setRightDrawable( DrawableUtil.setRightDrawable(
itemView.context, itemView.context,
text, text,

@ -195,6 +195,9 @@ class CaldavAccount : Parcelable {
fun isPaymentRequired() = error.isPaymentRequired() fun isPaymentRequired() = error.isPaymentRequired()
val hasError: Boolean
get() = !error.isNullOrBlank()
val prefTitle: Int val prefTitle: Int
get() = when { get() = when {
isTasksOrg -> R.string.tasks_org isTasksOrg -> R.string.tasks_org

@ -11,6 +11,7 @@ import com.todoroo.astrid.helper.UUIDHelper
import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock import kotlinx.coroutines.sync.withLock
import org.tasks.R import org.tasks.R
import org.tasks.data.CaldavAccount.Companion.TYPE_ETESYNC
import org.tasks.data.CaldavAccount.Companion.TYPE_LOCAL import org.tasks.data.CaldavAccount.Companion.TYPE_LOCAL
import org.tasks.data.CaldavAccount.Companion.TYPE_OPENTASKS import org.tasks.data.CaldavAccount.Companion.TYPE_OPENTASKS
import org.tasks.data.CaldavAccount.Companion.TYPE_TASKS import org.tasks.data.CaldavAccount.Companion.TYPE_TASKS
@ -195,6 +196,7 @@ SELECT EXISTS(SELECT 1
FROM caldav_lists FROM caldav_lists
INNER JOIN caldav_accounts ON cdl_account = cda_uuid INNER JOIN caldav_accounts ON cdl_account = cda_uuid
WHERE cda_account_type != $TYPE_OPENTASKS WHERE cda_account_type != $TYPE_OPENTASKS
AND cda_account_type != $TYPE_ETESYNC
AND cdl_url IN (:urls)) AND cdl_url IN (:urls))
""") """)
abstract suspend fun anyExist(urls: List<String>): Boolean abstract suspend fun anyExist(urls: List<String>): Boolean

@ -82,6 +82,9 @@ class GoogleTaskAccount : Parcelable {
override fun toString(): String = override fun toString(): String =
"GoogleTaskAccount(id=$id, account=$account, error=$error, etag=$etag, isCollapsed=$isCollapsed)" "GoogleTaskAccount(id=$id, account=$account, error=$error, etag=$etag, isCollapsed=$isCollapsed)"
val hasError: Boolean
get() = !error.isNullOrBlank()
companion object { companion object {
val TABLE = Table("google_task_accounts") val TABLE = Table("google_task_accounts")
val ACCOUNT = TABLE.column("gta_account") val ACCOUNT = TABLE.column("gta_account")

@ -6,6 +6,7 @@ import android.os.Bundle
import android.view.View import android.view.View
import androidx.activity.viewModels import androidx.activity.viewModels
import androidx.appcompat.widget.Toolbar import androidx.appcompat.widget.Toolbar
import androidx.core.content.ContextCompat
import androidx.core.util.Pair import androidx.core.util.Pair
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import butterknife.OnCheckedChanged import butterknife.OnCheckedChanged
@ -37,9 +38,14 @@ class EteSyncAccountSettingsActivity : BaseCaldavAccountSettingsActivity(), Tool
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
binding.repeat.visibility = View.GONE binding.repeat.visibility = View.GONE
binding.showAdvanced.visibility = View.VISIBLE binding.showAdvanced.visibility = View.VISIBLE
binding.description.visibility = View.VISIBLE
binding.description.setTextColor(ContextCompat.getColor(this, R.color.overdue))
binding.description.setText(description)
updateUrlVisibility() updateUrlVisibility()
} }
override val description = R.string.etesync_deprecated
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
if (!isFinishing) { if (!isFinishing) {

@ -240,7 +240,11 @@ class FilterProvider @Inject constructor(
}, },
account.error?.isNotBlank() ?: false, account.error?.isNotBlank() ?: false,
account.isCollapsed, account.isCollapsed,
if (account.isTasksOrg) SubheaderType.TASKS else SubheaderType.CALDAV, when {
account.isTasksOrg -> SubheaderType.TASKS
account.isEteSyncAccount -> SubheaderType.ETESYNC
else -> SubheaderType.CALDAV
},
account.id)) account.id))
.apply { if (account.isCollapsed) return this } .apply { if (account.isCollapsed) return this }
.plus(caldavDao .plus(caldavDao

@ -124,6 +124,7 @@ public class NavigationDrawerSubheader extends FilterListItem {
PREFERENCE, PREFERENCE,
GOOGLE_TASKS, GOOGLE_TASKS,
CALDAV, CALDAV,
TASKS TASKS,
@Deprecated ETESYNC
} }
} }

@ -172,14 +172,14 @@ class MainSettingsFragment : InjectingPreferenceFragment() {
} }
} }
} }
setupErrorIcon(pref, account.error) setupErrorIcon(pref, account.hasError, account.isEteSyncAccount)
} }
private fun setup(account: GoogleTaskAccount, pref: IconPreference) { private fun setup(account: GoogleTaskAccount, pref: IconPreference) {
pref.setTitle(R.string.gtasks_GPr_header) pref.setTitle(R.string.gtasks_GPr_header)
pref.setIcon(R.drawable.ic_google) pref.setIcon(R.drawable.ic_google)
pref.summary = account.account pref.summary = account.account
setupErrorIcon(pref, account.error) setupErrorIcon(pref, account.hasError)
pref.setOnPreferenceClickListener { pref.setOnPreferenceClickListener {
(activity as MainPreferences).startPreference( (activity as MainPreferences).startPreference(
this, this,
@ -190,19 +190,22 @@ class MainSettingsFragment : InjectingPreferenceFragment() {
} }
} }
private fun setupErrorIcon(pref: IconPreference, error: String?) { private fun setupErrorIcon(
val hasError = !error.isNullOrBlank() pref: IconPreference,
hasError: Boolean,
hasWarning: Boolean = false
) {
pref.drawable = ContextCompat pref.drawable = ContextCompat
.getDrawable(requireContext(), if (hasError) { .getDrawable(requireContext(), when {
R.drawable.ic_outline_error_outline_24px hasError -> R.drawable.ic_outline_error_outline_24px
} else { hasWarning -> R.drawable.ic_outline_error_outline_24px
R.drawable.ic_keyboard_arrow_right_24px else -> R.drawable.ic_keyboard_arrow_right_24px
}) })
?.mutate() ?.mutate()
pref.tint = context?.getColor(if (hasError) { pref.tint = context?.getColor(when {
R.color.overdue hasError -> R.color.overdue
} else { hasWarning -> R.color.orange_500
R.color.icon_tint_with_alpha else -> R.color.icon_tint_with_alpha
}) })
} }

@ -17,6 +17,7 @@
<string name="decsync">DecSync CC</string> <string name="decsync">DecSync CC</string>
<string name="tasks_org">Tasks.org</string> <string name="tasks_org">Tasks.org</string>
<string name="etesync_url">https://api.etesync.com</string> <string name="etesync_url">https://api.etesync.com</string>
<string name="etesync_deprecated">Native EteSync v1 support is deprecated and will be removed soon! Please switch to the EteSync client to continue synchronizing your EteSync v1 account, or migrate to EteSync v2</string>
<string name="etebase_url">https://api.etebase.com/partner/tasksorg/</string> <string name="etebase_url">https://api.etebase.com/partner/tasksorg/</string>
<string name="help_url_sync">https://tasks.org/sync</string> <string name="help_url_sync">https://tasks.org/sync</string>

Loading…
Cancel
Save