|
| 1 | +// Autogenerated from Pigeon (v25.5.0), do not edit directly. |
| 2 | +// See also: https://pub.dev/packages/pigeon |
| 3 | +@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass") |
| 4 | + |
| 5 | +package com.zulip.flutter |
| 6 | + |
| 7 | +import android.util.Log |
| 8 | +import io.flutter.plugin.common.BasicMessageChannel |
| 9 | +import io.flutter.plugin.common.BinaryMessenger |
| 10 | +import io.flutter.plugin.common.EventChannel |
| 11 | +import io.flutter.plugin.common.MessageCodec |
| 12 | +import io.flutter.plugin.common.StandardMethodCodec |
| 13 | +import io.flutter.plugin.common.StandardMessageCodec |
| 14 | +import java.io.ByteArrayOutputStream |
| 15 | +import java.nio.ByteBuffer |
| 16 | +private object AndroidIntentsPigeonUtils { |
| 17 | + fun deepEquals(a: Any?, b: Any?): Boolean { |
| 18 | + if (a is ByteArray && b is ByteArray) { |
| 19 | + return a.contentEquals(b) |
| 20 | + } |
| 21 | + if (a is IntArray && b is IntArray) { |
| 22 | + return a.contentEquals(b) |
| 23 | + } |
| 24 | + if (a is LongArray && b is LongArray) { |
| 25 | + return a.contentEquals(b) |
| 26 | + } |
| 27 | + if (a is DoubleArray && b is DoubleArray) { |
| 28 | + return a.contentEquals(b) |
| 29 | + } |
| 30 | + if (a is Array<*> && b is Array<*>) { |
| 31 | + return a.size == b.size && |
| 32 | + a.indices.all{ deepEquals(a[it], b[it]) } |
| 33 | + } |
| 34 | + if (a is List<*> && b is List<*>) { |
| 35 | + return a.size == b.size && |
| 36 | + a.indices.all{ deepEquals(a[it], b[it]) } |
| 37 | + } |
| 38 | + if (a is Map<*, *> && b is Map<*, *>) { |
| 39 | + return a.size == b.size && a.all { |
| 40 | + (b as Map<Any?, Any?>).containsKey(it.key) && |
| 41 | + deepEquals(it.value, b[it.key]) |
| 42 | + } |
| 43 | + } |
| 44 | + return a == b |
| 45 | + } |
| 46 | + |
| 47 | +} |
| 48 | + |
| 49 | +/** Generated class from Pigeon that represents data sent in messages. */ |
| 50 | +data class IntentSharedFile ( |
| 51 | + val name: String, |
| 52 | + val mimeType: String? = null, |
| 53 | + val bytes: ByteArray |
| 54 | +) |
| 55 | + { |
| 56 | + companion object { |
| 57 | + fun fromList(pigeonVar_list: List<Any?>): IntentSharedFile { |
| 58 | + val name = pigeonVar_list[0] as String |
| 59 | + val mimeType = pigeonVar_list[1] as String? |
| 60 | + val bytes = pigeonVar_list[2] as ByteArray |
| 61 | + return IntentSharedFile(name, mimeType, bytes) |
| 62 | + } |
| 63 | + } |
| 64 | + fun toList(): List<Any?> { |
| 65 | + return listOf( |
| 66 | + name, |
| 67 | + mimeType, |
| 68 | + bytes, |
| 69 | + ) |
| 70 | + } |
| 71 | + override fun equals(other: Any?): Boolean { |
| 72 | + if (other !is IntentSharedFile) { |
| 73 | + return false |
| 74 | + } |
| 75 | + if (this === other) { |
| 76 | + return true |
| 77 | + } |
| 78 | + return AndroidIntentsPigeonUtils.deepEquals(toList(), other.toList()) } |
| 79 | + |
| 80 | + override fun hashCode(): Int = toList().hashCode() |
| 81 | +} |
| 82 | + |
| 83 | +/** |
| 84 | + * Generated class from Pigeon that represents data sent in messages. |
| 85 | + * This class should not be extended by any user class outside of the generated file. |
| 86 | + */ |
| 87 | +sealed class AndroidIntentEvent |
| 88 | +/** Generated class from Pigeon that represents data sent in messages. */ |
| 89 | +data class AndroidIntentSendEvent ( |
| 90 | + val action: String, |
| 91 | + val extraText: String? = null, |
| 92 | + val extraStream: List<IntentSharedFile>? = null |
| 93 | +) : AndroidIntentEvent() |
| 94 | + { |
| 95 | + companion object { |
| 96 | + fun fromList(pigeonVar_list: List<Any?>): AndroidIntentSendEvent { |
| 97 | + val action = pigeonVar_list[0] as String |
| 98 | + val extraText = pigeonVar_list[1] as String? |
| 99 | + val extraStream = pigeonVar_list[2] as List<IntentSharedFile>? |
| 100 | + return AndroidIntentSendEvent(action, extraText, extraStream) |
| 101 | + } |
| 102 | + } |
| 103 | + fun toList(): List<Any?> { |
| 104 | + return listOf( |
| 105 | + action, |
| 106 | + extraText, |
| 107 | + extraStream, |
| 108 | + ) |
| 109 | + } |
| 110 | + override fun equals(other: Any?): Boolean { |
| 111 | + if (other !is AndroidIntentSendEvent) { |
| 112 | + return false |
| 113 | + } |
| 114 | + if (this === other) { |
| 115 | + return true |
| 116 | + } |
| 117 | + return AndroidIntentsPigeonUtils.deepEquals(toList(), other.toList()) } |
| 118 | + |
| 119 | + override fun hashCode(): Int = toList().hashCode() |
| 120 | +} |
| 121 | +private open class AndroidIntentsPigeonCodec : StandardMessageCodec() { |
| 122 | + override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { |
| 123 | + return when (type) { |
| 124 | + 129.toByte() -> { |
| 125 | + return (readValue(buffer) as? List<Any?>)?.let { |
| 126 | + IntentSharedFile.fromList(it) |
| 127 | + } |
| 128 | + } |
| 129 | + 130.toByte() -> { |
| 130 | + return (readValue(buffer) as? List<Any?>)?.let { |
| 131 | + AndroidIntentSendEvent.fromList(it) |
| 132 | + } |
| 133 | + } |
| 134 | + else -> super.readValueOfType(type, buffer) |
| 135 | + } |
| 136 | + } |
| 137 | + override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { |
| 138 | + when (value) { |
| 139 | + is IntentSharedFile -> { |
| 140 | + stream.write(129) |
| 141 | + writeValue(stream, value.toList()) |
| 142 | + } |
| 143 | + is AndroidIntentSendEvent -> { |
| 144 | + stream.write(130) |
| 145 | + writeValue(stream, value.toList()) |
| 146 | + } |
| 147 | + else -> super.writeValue(stream, value) |
| 148 | + } |
| 149 | + } |
| 150 | +} |
| 151 | + |
| 152 | +val AndroidIntentsPigeonMethodCodec = StandardMethodCodec(AndroidIntentsPigeonCodec()) |
| 153 | + |
| 154 | + |
| 155 | +private class AndroidIntentsPigeonStreamHandler<T>( |
| 156 | + val wrapper: AndroidIntentsPigeonEventChannelWrapper<T> |
| 157 | +) : EventChannel.StreamHandler { |
| 158 | + var pigeonSink: PigeonEventSink<T>? = null |
| 159 | + |
| 160 | + override fun onListen(p0: Any?, sink: EventChannel.EventSink) { |
| 161 | + pigeonSink = PigeonEventSink<T>(sink) |
| 162 | + wrapper.onListen(p0, pigeonSink!!) |
| 163 | + } |
| 164 | + |
| 165 | + override fun onCancel(p0: Any?) { |
| 166 | + pigeonSink = null |
| 167 | + wrapper.onCancel(p0) |
| 168 | + } |
| 169 | +} |
| 170 | + |
| 171 | +interface AndroidIntentsPigeonEventChannelWrapper<T> { |
| 172 | + open fun onListen(p0: Any?, sink: PigeonEventSink<T>) {} |
| 173 | + |
| 174 | + open fun onCancel(p0: Any?) {} |
| 175 | +} |
| 176 | + |
| 177 | +class PigeonEventSink<T>(private val sink: EventChannel.EventSink) { |
| 178 | + fun success(value: T) { |
| 179 | + sink.success(value) |
| 180 | + } |
| 181 | + |
| 182 | + fun error(errorCode: String, errorMessage: String?, errorDetails: Any?) { |
| 183 | + sink.error(errorCode, errorMessage, errorDetails) |
| 184 | + } |
| 185 | + |
| 186 | + fun endOfStream() { |
| 187 | + sink.endOfStream() |
| 188 | + } |
| 189 | +} |
| 190 | + |
| 191 | +abstract class AndroidIntentEventsStreamHandler : AndroidIntentsPigeonEventChannelWrapper<AndroidIntentEvent> { |
| 192 | + companion object { |
| 193 | + fun register(messenger: BinaryMessenger, streamHandler: AndroidIntentEventsStreamHandler, instanceName: String = "") { |
| 194 | + var channelName: String = "dev.flutter.pigeon.zulip.AndroidIntentsEventChannelApi.androidIntentEvents" |
| 195 | + if (instanceName.isNotEmpty()) { |
| 196 | + channelName += ".$instanceName" |
| 197 | + } |
| 198 | + val internalStreamHandler = AndroidIntentsPigeonStreamHandler<AndroidIntentEvent>(streamHandler) |
| 199 | + EventChannel(messenger, channelName, AndroidIntentsPigeonMethodCodec).setStreamHandler(internalStreamHandler) |
| 200 | + } |
| 201 | + } |
| 202 | +} |
| 203 | + |
0 commit comments