Skip to content
Snippets Groups Projects
Commit ab4fe097 authored by Kamal Bramwell's avatar Kamal Bramwell
Browse files

Finished implementing Bindings API

parent 58a91bbb
No related branches found
No related tags found
No related merge requests found
package io.elixxir.xxclient.bindings
import io.elixxir.xxclient.backup.Backup
import io.elixxir.xxclient.callbacks.AuthEventListener
import io.elixxir.xxclient.callbacks.UdLookupResultListener
import io.elixxir.xxclient.callbacks.UdSearchResultListener
import io.elixxir.xxclient.callbacks.*
import io.elixxir.xxclient.channel.Channel
import io.elixxir.xxclient.cmix.CMix
import io.elixxir.xxclient.dummytraffic.DummyTraffic
import io.elixxir.xxclient.e2e.E2e
import io.elixxir.xxclient.filetransfer.FileTransfer
import io.elixxir.xxclient.models.*
import io.elixxir.xxclient.models.BackupUpdateListener
import io.elixxir.xxclient.userdiscovery.UserDiscovery
import io.elixxir.xxclient.utils.*
......@@ -129,11 +128,22 @@ interface Bindings {
singleRequestParamsJson: ByteArray
): SingleUseReport
fun newBroadcastChannel(): Channel
fun newBroadcastChannel(cmixId: Long, channelDef: ChannelDef): Channel
fun storeReceptionIdentity()
fun storeReceptionIdentity(
key: String,
identity: ReceptionIdentity,
cmixId: Long
)
fun transmitSingleUse(): ByteArray
fun transmitSingleUse(
e2eId: E2eId,
recipient: Contact,
tag: String,
payload: Payload,
paramsJson: ByteArray,
listener: SingleUseResponseListener
): SingleUseReport
fun updateCommonErrors(errorsJson: String)
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import io.elixxir.xxclient.backup.Backup
import io.elixxir.xxclient.backup.BackupAdapter
import io.elixxir.xxclient.callbacks.*
import io.elixxir.xxclient.channel.Channel
import io.elixxir.xxclient.channel.ChannelAdapter
import io.elixxir.xxclient.cmix.CMix
import io.elixxir.xxclient.cmix.CMixAdapter
import io.elixxir.xxclient.dummytraffic.DummyTraffic
......@@ -266,25 +267,44 @@ open class BindingsAdapter : Bindings {
return decode(result, SingleUseReport::class.java)
}
override fun newBroadcastChannel(): Channel {
TODO()
// return ChannelAdapter(
// CoreBindings.newBroadcastChannel()
// )
override fun newBroadcastChannel(cmixId: Long, channelDef: ChannelDef): Channel {
return ChannelAdapter(
CoreBindings.newBroadcastChannel(cmixId, encode(channelDef))
)
}
override fun storeReceptionIdentity() {
TODO()
// CoreBindings.storeReceptionIdentity()
override fun storeReceptionIdentity(
key: String,
identity: ReceptionIdentity,
cmixId: Long
) {
CoreBindings.storeReceptionIdentity(
key,
encode(identity),
cmixId
)
}
override fun transmitSingleUse(): ByteArray {
TODO()
// return CoreBindings.transmitSingleUse()
override fun transmitSingleUse(
e2eId: E2eId,
recipient: Contact,
tag: String,
payload: Payload,
paramsJson: ByteArray,
listener: SingleUseResponseListener
): SingleUseReport {
val result = CoreBindings.transmitSingleUse(
e2eId,
recipient.encoded(),
tag,
payload,
paramsJson,
SingleUseResponseAdapter(listener)
)
return decode(result, SingleUseReport::class.java)
}
override fun updateCommonErrors(errorsJson: String) {
CoreBindings.updateCommonErrors(errorsJson)
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment