[API] Rename response parameters to fix compatibility.

This commit is contained in:
Kuba Szczodrzyński 2020-09-05 19:13:37 +02:00
parent bd2a9524c6
commit 810cfd8092
6 changed files with 16 additions and 16 deletions

View File

@ -647,7 +647,7 @@ class MainActivity : AppCompatActivity(), CoroutineScope {
app.profile.registerName?.let { registerName ->
var status = app.config.sync.registerAvailability[registerName]
if (status == null || status.nextCheck < currentTimeUnix()) {
if (status == null || status.nextCheckAt < currentTimeUnix()) {
withContext(Dispatchers.IO) {
val api = SzkolnyApi(app)
api.runCatching(this@MainActivity) {

View File

@ -93,7 +93,7 @@ open class EdziennikTask(override val profileId: Int, val request: Any) : IApiTa
profile.registerName?.let { registerName ->
var status = app.config.sync.registerAvailability[registerName]
if (status == null || status.nextCheck < currentTimeUnix()) {
if (status == null || status.nextCheckAt < currentTimeUnix()) {
val api = SzkolnyApi(app)
api.runCatching({
val availability = getRegisterAvailability()

View File

@ -11,8 +11,8 @@ import pl.szczodrzynski.edziennik.currentTimeUnix
data class RegisterAvailabilityStatus(
val available: Boolean,
val name: String?,
val message: Message?,
val nextCheck: Long = currentTimeUnix() + 7 * DAY,
val userMessage: Message?,
val nextCheckAt: Long = currentTimeUnix() + 7 * DAY,
val minVersionCode: Int = BuildConfig.VERSION_CODE
) {
data class Message(

View File

@ -47,14 +47,14 @@ class RegisterUnavailableDialog(
onShowListener?.invoke(TAG)
app = activity.applicationContext as App
if (!status.available && status.message != null) {
if (!status.available && status.userMessage != null) {
val b = DialogRegisterUnavailableBinding.inflate(LayoutInflater.from(activity), null, false)
b.message = status.message
if (status.message.image != null)
b.image.load(status.message.image)
if (status.message.url != null) {
b.message = status.userMessage
if (status.userMessage.image != null)
b.image.load(status.userMessage.image)
if (status.userMessage.url != null) {
b.readMore.onClick {
Utils.openUrl(activity, status.message.url)
Utils.openUrl(activity, status.userMessage.url)
}
}
b.text.movementMethod = LinkMovementMethod.getInstance()

View File

@ -58,13 +58,13 @@ class HomeAvailabilityCard(
var onInfoClick = { _: View -> }
if (status != null && !status.available && status.message != null) {
b.homeAvailabilityTitle.text = HtmlCompat.fromHtml(status.message.title, HtmlCompat.FROM_HTML_MODE_LEGACY)
b.homeAvailabilityText.text = HtmlCompat.fromHtml(status.message.contentShort, HtmlCompat.FROM_HTML_MODE_LEGACY)
if (status != null && !status.available && status.userMessage != null) {
b.homeAvailabilityTitle.text = HtmlCompat.fromHtml(status.userMessage.title, HtmlCompat.FROM_HTML_MODE_LEGACY)
b.homeAvailabilityText.text = HtmlCompat.fromHtml(status.userMessage.contentShort, HtmlCompat.FROM_HTML_MODE_LEGACY)
b.homeAvailabilityUpdate.isVisible = false
b.homeAvailabilityIcon.setImageResource(R.drawable.ic_sync)
if (status.message.icon != null)
b.homeAvailabilityIcon.load(status.message.icon)
if (status.userMessage.icon != null)
b.homeAvailabilityIcon.load(status.userMessage.icon)
onInfoClick = {
RegisterUnavailableDialog(activity, status)
}

View File

@ -117,7 +117,7 @@ class LoginChooserFragment : Fragment(), CoroutineScope {
else -> null
}?.let { registerName ->
var status = app.config.sync.registerAvailability[registerName]
if (status == null || status.nextCheck < currentTimeUnix()) {
if (status == null || status.nextCheckAt < currentTimeUnix()) {
withContext(Dispatchers.IO) {
val api = SzkolnyApi(app)
api.runCatching(activity) {