Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
263 changes: 237 additions & 26 deletions android/src/main/kotlin/sncf/connect/tech/eventide/CalendarApi.g.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Autogenerated from Pigeon (v26.1.7), do not edit directly.
// Autogenerated from Pigeon (v26.3.4), do not edit directly.
// See also: https://pub.dev/packages/pigeon
@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass")

Expand Down Expand Up @@ -34,36 +34,150 @@ private object CalendarApiPigeonUtils {
)
}
}
fun doubleEquals(a: Double, b: Double): Boolean {
// Normalize -0.0 to 0.0 and handle NaN equality.
return (if (a == 0.0) 0.0 else a) == (if (b == 0.0) 0.0 else b) || (a.isNaN() && b.isNaN())
}

fun floatEquals(a: Float, b: Float): Boolean {
// Normalize -0.0 to 0.0 and handle NaN equality.
return (if (a == 0.0f) 0.0f else a) == (if (b == 0.0f) 0.0f else b) || (a.isNaN() && b.isNaN())
}

fun doubleHash(d: Double): Int {
// Normalize -0.0 to 0.0 and handle NaN to ensure consistent hash codes.
val normalized = if (d == 0.0) 0.0 else d
val bits = java.lang.Double.doubleToLongBits(normalized)
return (bits xor (bits ushr 32)).toInt()
}

fun floatHash(f: Float): Int {
// Normalize -0.0 to 0.0 and handle NaN to ensure consistent hash codes.
val normalized = if (f == 0.0f) 0.0f else f
return java.lang.Float.floatToIntBits(normalized)
}

fun deepEquals(a: Any?, b: Any?): Boolean {
if (a === b) {
return true
}
if (a == null || b == null) {
return false
}
if (a is ByteArray && b is ByteArray) {
return a.contentEquals(b)
return a.contentEquals(b)
}
if (a is IntArray && b is IntArray) {
return a.contentEquals(b)
return a.contentEquals(b)
}
if (a is LongArray && b is LongArray) {
return a.contentEquals(b)
return a.contentEquals(b)
}
if (a is DoubleArray && b is DoubleArray) {
return a.contentEquals(b)
if (a.size != b.size) return false
for (i in a.indices) {
if (!doubleEquals(a[i], b[i])) return false
}
return true
}
if (a is FloatArray && b is FloatArray) {
if (a.size != b.size) return false
for (i in a.indices) {
if (!floatEquals(a[i], b[i])) return false
}
return true
}
if (a is Array<*> && b is Array<*>) {
return a.size == b.size &&
a.indices.all{ deepEquals(a[it], b[it]) }
if (a.size != b.size) return false
for (i in a.indices) {
if (!deepEquals(a[i], b[i])) return false
}
return true
}
if (a is List<*> && b is List<*>) {
return a.size == b.size &&
a.indices.all{ deepEquals(a[it], b[it]) }
if (a.size != b.size) return false
val iterA = a.iterator()
val iterB = b.iterator()
while (iterA.hasNext() && iterB.hasNext()) {
if (!deepEquals(iterA.next(), iterB.next())) return false
}
return true
}
if (a is Map<*, *> && b is Map<*, *>) {
return a.size == b.size && a.all {
(b as Map<Any?, Any?>).contains(it.key) &&
deepEquals(it.value, b[it.key])
if (a.size != b.size) return false
for (entry in a) {
val key = entry.key
var found = false
for (bEntry in b) {
if (deepEquals(key, bEntry.key)) {
if (deepEquals(entry.value, bEntry.value)) {
found = true
break
} else {
return false
}
}
}
if (!found) return false
}
return true
}
if (a is Double && b is Double) {
return doubleEquals(a, b)
}
if (a is Float && b is Float) {
return floatEquals(a, b)
}
return a == b
}


fun deepHash(value: Any?): Int {
return when (value) {
null -> 0
is ByteArray -> value.contentHashCode()
is IntArray -> value.contentHashCode()
is LongArray -> value.contentHashCode()
is DoubleArray -> {
var result = 1
for (item in value) {
result = 31 * result + doubleHash(item)
}
result
}
is FloatArray -> {
var result = 1
for (item in value) {
result = 31 * result + floatHash(item)
}
result
}
is Array<*> -> {
var result = 1
for (item in value) {
result = 31 * result + deepHash(item)
}
result
}
is List<*> -> {
var result = 1
for (item in value) {
result = 31 * result + deepHash(item)
}
result
}
is Map<*, *> -> {
var result = 0
for (entry in value) {
result += ((deepHash(entry.key) * 31) xor deepHash(entry.value))
}
result
}
is Double -> doubleHash(value)
is Float -> floatHash(value)
else -> value.hashCode()
}
}

}

/**
Expand All @@ -76,7 +190,7 @@ class FlutterError (
val code: String,
override val message: String? = null,
val details: Any? = null
) : Throwable()
) : RuntimeException()

/** Generated class from Pigeon that represents data sent in messages. */
data class Calendar (
Expand Down Expand Up @@ -107,15 +221,25 @@ data class Calendar (
)
}
override fun equals(other: Any?): Boolean {
if (other !is Calendar) {
if (other == null || other.javaClass != javaClass) {
return false
}
if (this === other) {
return true
}
return CalendarApiPigeonUtils.deepEquals(toList(), other.toList()) }
val other = other as Calendar
return CalendarApiPigeonUtils.deepEquals(this.id, other.id) && CalendarApiPigeonUtils.deepEquals(this.title, other.title) && CalendarApiPigeonUtils.deepEquals(this.color, other.color) && CalendarApiPigeonUtils.deepEquals(this.isWritable, other.isWritable) && CalendarApiPigeonUtils.deepEquals(this.account, other.account)
}

override fun hashCode(): Int = toList().hashCode()
override fun hashCode(): Int {
var result = javaClass.hashCode()
result = 31 * result + CalendarApiPigeonUtils.deepHash(this.id)
result = 31 * result + CalendarApiPigeonUtils.deepHash(this.title)
result = 31 * result + CalendarApiPigeonUtils.deepHash(this.color)
result = 31 * result + CalendarApiPigeonUtils.deepHash(this.isWritable)
result = 31 * result + CalendarApiPigeonUtils.deepHash(this.account)
return result
}
}

/** Generated class from Pigeon that represents data sent in messages. */
Expand Down Expand Up @@ -165,15 +289,31 @@ data class Event (
)
}
override fun equals(other: Any?): Boolean {
if (other !is Event) {
if (other == null || other.javaClass != javaClass) {
return false
}
if (this === other) {
return true
}
return CalendarApiPigeonUtils.deepEquals(toList(), other.toList()) }
val other = other as Event
return CalendarApiPigeonUtils.deepEquals(this.id, other.id) && CalendarApiPigeonUtils.deepEquals(this.calendarId, other.calendarId) && CalendarApiPigeonUtils.deepEquals(this.title, other.title) && CalendarApiPigeonUtils.deepEquals(this.isAllDay, other.isAllDay) && CalendarApiPigeonUtils.deepEquals(this.startDate, other.startDate) && CalendarApiPigeonUtils.deepEquals(this.endDate, other.endDate) && CalendarApiPigeonUtils.deepEquals(this.reminders, other.reminders) && CalendarApiPigeonUtils.deepEquals(this.attendees, other.attendees) && CalendarApiPigeonUtils.deepEquals(this.description, other.description) && CalendarApiPigeonUtils.deepEquals(this.url, other.url) && CalendarApiPigeonUtils.deepEquals(this.location, other.location)
}

override fun hashCode(): Int = toList().hashCode()
override fun hashCode(): Int {
var result = javaClass.hashCode()
result = 31 * result + CalendarApiPigeonUtils.deepHash(this.id)
result = 31 * result + CalendarApiPigeonUtils.deepHash(this.calendarId)
result = 31 * result + CalendarApiPigeonUtils.deepHash(this.title)
result = 31 * result + CalendarApiPigeonUtils.deepHash(this.isAllDay)
result = 31 * result + CalendarApiPigeonUtils.deepHash(this.startDate)
result = 31 * result + CalendarApiPigeonUtils.deepHash(this.endDate)
result = 31 * result + CalendarApiPigeonUtils.deepHash(this.reminders)
result = 31 * result + CalendarApiPigeonUtils.deepHash(this.attendees)
result = 31 * result + CalendarApiPigeonUtils.deepHash(this.description)
result = 31 * result + CalendarApiPigeonUtils.deepHash(this.url)
result = 31 * result + CalendarApiPigeonUtils.deepHash(this.location)
return result
}
}

/** Generated class from Pigeon that represents data sent in messages. */
Expand All @@ -199,15 +339,23 @@ data class Account (
)
}
override fun equals(other: Any?): Boolean {
if (other !is Account) {
if (other == null || other.javaClass != javaClass) {
return false
}
if (this === other) {
return true
}
return CalendarApiPigeonUtils.deepEquals(toList(), other.toList()) }
val other = other as Account
return CalendarApiPigeonUtils.deepEquals(this.id, other.id) && CalendarApiPigeonUtils.deepEquals(this.name, other.name) && CalendarApiPigeonUtils.deepEquals(this.type, other.type)
}

override fun hashCode(): Int = toList().hashCode()
override fun hashCode(): Int {
var result = javaClass.hashCode()
result = 31 * result + CalendarApiPigeonUtils.deepHash(this.id)
result = 31 * result + CalendarApiPigeonUtils.deepHash(this.name)
result = 31 * result + CalendarApiPigeonUtils.deepHash(this.type)
return result
}
}

/** Generated class from Pigeon that represents data sent in messages. */
Expand Down Expand Up @@ -239,15 +387,25 @@ data class Attendee (
)
}
override fun equals(other: Any?): Boolean {
if (other !is Attendee) {
if (other == null || other.javaClass != javaClass) {
return false
}
if (this === other) {
return true
}
return CalendarApiPigeonUtils.deepEquals(toList(), other.toList()) }
val other = other as Attendee
return CalendarApiPigeonUtils.deepEquals(this.name, other.name) && CalendarApiPigeonUtils.deepEquals(this.email, other.email) && CalendarApiPigeonUtils.deepEquals(this.type, other.type) && CalendarApiPigeonUtils.deepEquals(this.role, other.role) && CalendarApiPigeonUtils.deepEquals(this.status, other.status)
}

override fun hashCode(): Int = toList().hashCode()
override fun hashCode(): Int {
var result = javaClass.hashCode()
result = 31 * result + CalendarApiPigeonUtils.deepHash(this.name)
result = 31 * result + CalendarApiPigeonUtils.deepHash(this.email)
result = 31 * result + CalendarApiPigeonUtils.deepHash(this.type)
result = 31 * result + CalendarApiPigeonUtils.deepHash(this.role)
result = 31 * result + CalendarApiPigeonUtils.deepHash(this.status)
return result
}
}
private open class CalendarApiPigeonCodec : StandardMessageCodec() {
override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? {
Expand Down Expand Up @@ -302,10 +460,12 @@ private open class CalendarApiPigeonCodec : StandardMessageCodec() {
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
interface CalendarApi {
fun createCalendar(title: String, color: Long, account: Account?, callback: (Result<Calendar>) -> Unit)
fun updateCalendar(calendarId: String, title: String, color: Long, callback: (Result<Calendar>) -> Unit)
fun retrieveCalendars(onlyWritableCalendars: Boolean, account: Account?, callback: (Result<List<Calendar>>) -> Unit)
fun retrieveAccounts(callback: (Result<List<Account>>) -> Unit)
fun deleteCalendar(calendarId: String, callback: (Result<Unit>) -> Unit)
fun createEvent(calendarId: String, title: String, startDate: Long, endDate: Long, isAllDay: Boolean, description: String?, url: String?, location: String?, reminders: List<Long>?, callback: (Result<Event>) -> Unit)
fun updateEvent(eventId: String, calendarId: String, title: String, startDate: Long, endDate: Long, isAllDay: Boolean, description: String?, url: String?, location: String?, reminders: List<Long>?, callback: (Result<Event>) -> Unit)
fun createEventInDefaultCalendar(title: String, startDate: Long, endDate: Long, isAllDay: Boolean, description: String?, url: String?, location: String?, reminders: List<Long>?, callback: (Result<Unit>) -> Unit)
fun createEventThroughNativePlatform(title: String?, startDate: Long?, endDate: Long?, isAllDay: Boolean?, description: String?, url: String?, location: String?, reminders: List<Long>?, callback: (Result<Unit>) -> Unit)
fun retrieveEvents(calendarId: String, startDate: Long, endDate: Long, callback: (Result<List<Event>>) -> Unit)
Expand Down Expand Up @@ -346,6 +506,28 @@ interface CalendarApi {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.eventide.CalendarApi.updateCalendar$separatedMessageChannelSuffix", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val calendarIdArg = args[0] as String
val titleArg = args[1] as String
val colorArg = args[2] as Long
api.updateCalendar(calendarIdArg, titleArg, colorArg) { result: Result<Calendar> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(CalendarApiPigeonUtils.wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(CalendarApiPigeonUtils.wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.eventide.CalendarApi.retrieveCalendars$separatedMessageChannelSuffix", codec)
if (api != null) {
Expand Down Expand Up @@ -432,6 +614,35 @@ interface CalendarApi {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.eventide.CalendarApi.updateEvent$separatedMessageChannelSuffix", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val eventIdArg = args[0] as String
val calendarIdArg = args[1] as String
val titleArg = args[2] as String
val startDateArg = args[3] as Long
val endDateArg = args[4] as Long
val isAllDayArg = args[5] as Boolean
val descriptionArg = args[6] as String?
val urlArg = args[7] as String?
val locationArg = args[8] as String?
val remindersArg = args[9] as List<Long>?
api.updateEvent(eventIdArg, calendarIdArg, titleArg, startDateArg, endDateArg, isAllDayArg, descriptionArg, urlArg, locationArg, remindersArg) { result: Result<Event> ->
val error = result.exceptionOrNull()
if (error != null) {
reply.reply(CalendarApiPigeonUtils.wrapError(error))
} else {
val data = result.getOrNull()
reply.reply(CalendarApiPigeonUtils.wrapResult(data))
}
}
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.eventide.CalendarApi.createEventInDefaultCalendar$separatedMessageChannelSuffix", codec)
if (api != null) {
Expand Down
Loading
Loading