forked from github/szkolny
[API] Rename response parameters to fix compatibility.
This commit is contained in:
parent
bd2a9524c6
commit
810cfd8092
@ -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) {
|
||||
|
@ -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()
|
||||
|
@ -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(
|
||||
|
@ -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()
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user