mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2025-01-31 05:48:19 +01:00
[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 ->
|
app.profile.registerName?.let { registerName ->
|
||||||
var status = app.config.sync.registerAvailability[registerName]
|
var status = app.config.sync.registerAvailability[registerName]
|
||||||
if (status == null || status.nextCheck < currentTimeUnix()) {
|
if (status == null || status.nextCheckAt < currentTimeUnix()) {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
val api = SzkolnyApi(app)
|
val api = SzkolnyApi(app)
|
||||||
api.runCatching(this@MainActivity) {
|
api.runCatching(this@MainActivity) {
|
||||||
|
@ -93,7 +93,7 @@ open class EdziennikTask(override val profileId: Int, val request: Any) : IApiTa
|
|||||||
|
|
||||||
profile.registerName?.let { registerName ->
|
profile.registerName?.let { registerName ->
|
||||||
var status = app.config.sync.registerAvailability[registerName]
|
var status = app.config.sync.registerAvailability[registerName]
|
||||||
if (status == null || status.nextCheck < currentTimeUnix()) {
|
if (status == null || status.nextCheckAt < currentTimeUnix()) {
|
||||||
val api = SzkolnyApi(app)
|
val api = SzkolnyApi(app)
|
||||||
api.runCatching({
|
api.runCatching({
|
||||||
val availability = getRegisterAvailability()
|
val availability = getRegisterAvailability()
|
||||||
|
@ -11,8 +11,8 @@ import pl.szczodrzynski.edziennik.currentTimeUnix
|
|||||||
data class RegisterAvailabilityStatus(
|
data class RegisterAvailabilityStatus(
|
||||||
val available: Boolean,
|
val available: Boolean,
|
||||||
val name: String?,
|
val name: String?,
|
||||||
val message: Message?,
|
val userMessage: Message?,
|
||||||
val nextCheck: Long = currentTimeUnix() + 7 * DAY,
|
val nextCheckAt: Long = currentTimeUnix() + 7 * DAY,
|
||||||
val minVersionCode: Int = BuildConfig.VERSION_CODE
|
val minVersionCode: Int = BuildConfig.VERSION_CODE
|
||||||
) {
|
) {
|
||||||
data class Message(
|
data class Message(
|
||||||
|
@ -47,14 +47,14 @@ class RegisterUnavailableDialog(
|
|||||||
onShowListener?.invoke(TAG)
|
onShowListener?.invoke(TAG)
|
||||||
app = activity.applicationContext as App
|
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)
|
val b = DialogRegisterUnavailableBinding.inflate(LayoutInflater.from(activity), null, false)
|
||||||
b.message = status.message
|
b.message = status.userMessage
|
||||||
if (status.message.image != null)
|
if (status.userMessage.image != null)
|
||||||
b.image.load(status.message.image)
|
b.image.load(status.userMessage.image)
|
||||||
if (status.message.url != null) {
|
if (status.userMessage.url != null) {
|
||||||
b.readMore.onClick {
|
b.readMore.onClick {
|
||||||
Utils.openUrl(activity, status.message.url)
|
Utils.openUrl(activity, status.userMessage.url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
b.text.movementMethod = LinkMovementMethod.getInstance()
|
b.text.movementMethod = LinkMovementMethod.getInstance()
|
||||||
|
@ -58,13 +58,13 @@ class HomeAvailabilityCard(
|
|||||||
|
|
||||||
var onInfoClick = { _: View -> }
|
var onInfoClick = { _: View -> }
|
||||||
|
|
||||||
if (status != null && !status.available && status.message != null) {
|
if (status != null && !status.available && status.userMessage != null) {
|
||||||
b.homeAvailabilityTitle.text = HtmlCompat.fromHtml(status.message.title, HtmlCompat.FROM_HTML_MODE_LEGACY)
|
b.homeAvailabilityTitle.text = HtmlCompat.fromHtml(status.userMessage.title, HtmlCompat.FROM_HTML_MODE_LEGACY)
|
||||||
b.homeAvailabilityText.text = HtmlCompat.fromHtml(status.message.contentShort, HtmlCompat.FROM_HTML_MODE_LEGACY)
|
b.homeAvailabilityText.text = HtmlCompat.fromHtml(status.userMessage.contentShort, HtmlCompat.FROM_HTML_MODE_LEGACY)
|
||||||
b.homeAvailabilityUpdate.isVisible = false
|
b.homeAvailabilityUpdate.isVisible = false
|
||||||
b.homeAvailabilityIcon.setImageResource(R.drawable.ic_sync)
|
b.homeAvailabilityIcon.setImageResource(R.drawable.ic_sync)
|
||||||
if (status.message.icon != null)
|
if (status.userMessage.icon != null)
|
||||||
b.homeAvailabilityIcon.load(status.message.icon)
|
b.homeAvailabilityIcon.load(status.userMessage.icon)
|
||||||
onInfoClick = {
|
onInfoClick = {
|
||||||
RegisterUnavailableDialog(activity, status)
|
RegisterUnavailableDialog(activity, status)
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ class LoginChooserFragment : Fragment(), CoroutineScope {
|
|||||||
else -> null
|
else -> null
|
||||||
}?.let { registerName ->
|
}?.let { registerName ->
|
||||||
var status = app.config.sync.registerAvailability[registerName]
|
var status = app.config.sync.registerAvailability[registerName]
|
||||||
if (status == null || status.nextCheck < currentTimeUnix()) {
|
if (status == null || status.nextCheckAt < currentTimeUnix()) {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
val api = SzkolnyApi(app)
|
val api = SzkolnyApi(app)
|
||||||
api.runCatching(activity) {
|
api.runCatching(activity) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user