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.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.RecyclerView
import butterknife.BindView
@ -45,7 +46,7 @@ internal class SubheaderViewHolder(
when (subheader.subheaderType) {
SubheaderType.PREFERENCE -> preferences.setBoolean(subheader.id.toInt(), collapsed)
SubheaderType.GOOGLE_TASKS -> googleTaskDao.setCollapsed(subheader.id, collapsed)
SubheaderType.CALDAV, SubheaderType.TASKS ->
SubheaderType.CALDAV, SubheaderType.TASKS, SubheaderType.ETESYNC ->
caldavDao.setCollapsed(subheader.id, collapsed)
}
localBroadcastManager.broadcastRefreshList()
@ -55,7 +56,17 @@ internal class SubheaderViewHolder(
fun bind(subheader: NavigationDrawerSubheader) {
this.subheader = subheader
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(
itemView.context,
text,

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

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

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

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

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

@ -124,6 +124,7 @@ public class NavigationDrawerSubheader extends FilterListItem {
PREFERENCE,
GOOGLE_TASKS,
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) {
pref.setTitle(R.string.gtasks_GPr_header)
pref.setIcon(R.drawable.ic_google)
pref.summary = account.account
setupErrorIcon(pref, account.error)
setupErrorIcon(pref, account.hasError)
pref.setOnPreferenceClickListener {
(activity as MainPreferences).startPreference(
this,
@ -190,19 +190,22 @@ class MainSettingsFragment : InjectingPreferenceFragment() {
}
}
private fun setupErrorIcon(pref: IconPreference, error: String?) {
val hasError = !error.isNullOrBlank()
private fun setupErrorIcon(
pref: IconPreference,
hasError: Boolean,
hasWarning: Boolean = false
) {
pref.drawable = ContextCompat
.getDrawable(requireContext(), if (hasError) {
R.drawable.ic_outline_error_outline_24px
} else {
R.drawable.ic_keyboard_arrow_right_24px
.getDrawable(requireContext(), when {
hasError -> R.drawable.ic_outline_error_outline_24px
hasWarning -> R.drawable.ic_outline_error_outline_24px
else -> R.drawable.ic_keyboard_arrow_right_24px
})
?.mutate()
pref.tint = context?.getColor(if (hasError) {
R.color.overdue
} else {
R.color.icon_tint_with_alpha
pref.tint = context?.getColor(when {
hasError -> R.color.overdue
hasWarning -> R.color.orange_500
else -> R.color.icon_tint_with_alpha
})
}

@ -17,6 +17,7 @@
<string name="decsync">DecSync CC</string>
<string name="tasks_org">Tasks.org</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="help_url_sync">https://tasks.org/sync</string>

Loading…
Cancel
Save