Skip to content

HYP-210: Update BridgefySDK on Android to version 0.4.0 #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 1 addition & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
apply plugin: "com.android.application"
apply plugin: 'kotlin-android'
apply plugin: "com.facebook.react"
apply plugin: 'com.google.gms.google-services'

import com.android.build.OutputFile

Expand Down Expand Up @@ -161,7 +160,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"


implementation group: "me.bridgefy", name: "android-sdk", version: "0.3.0-SNAPSHOT", ext: "aar", {
implementation group: "me.bridgefy", name: "android-sdk", version: "0.4.0-SNAPSHOT", ext: "aar", {
transitive = true
}
// The version of react-native is set by the React Native Gradle Plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class BridgefyModule(context: ReactApplicationContext) : ReactContextBaseJavaMod

override fun onConnected(userID: UUID) {
val body: WritableMap = Arguments.createMap().apply {
putString("userID", userID.toString())
putString("userID", userID.toString().uppercase())
}

println("(kotlin-onConnected) Connected with user ID $userID")
Expand All @@ -49,7 +49,7 @@ class BridgefyModule(context: ReactApplicationContext) : ReactContextBaseJavaMod

override fun onDisconnected(userID: UUID) {
val body: WritableMap = Arguments.createMap().apply {
putString("userID", userID.toString())
putString("userID", userID.toString().uppercase())
}

println("(kotlin-onDisconnected) Disconnected with user ID $userID")
Expand All @@ -58,7 +58,7 @@ class BridgefyModule(context: ReactApplicationContext) : ReactContextBaseJavaMod

override fun onSend(messageID: UUID) {
val body: WritableMap = Arguments.createMap().apply {
putString("messageID", messageID.toString())
putString("messageID", messageID.toString().uppercase())
}

println("(kotlin-onSend) Sent message with message ID $messageID")
Expand All @@ -68,7 +68,7 @@ class BridgefyModule(context: ReactApplicationContext) : ReactContextBaseJavaMod
//in the iOS SDK, this also gets passed a BridgefyException
override fun onFailToSend(messageID: UUID) {
val body: WritableMap = Arguments.createMap().apply {
putString("messageID", messageID.toString())
putString("messageID", messageID.toString().uppercase())
}

println("(kotlin-onFailToSend) Failed to send message with message ID $messageID")
Expand Down Expand Up @@ -96,8 +96,8 @@ class BridgefyModule(context: ReactApplicationContext) : ReactContextBaseJavaMod
}

val body: WritableMap = Arguments.createMap().apply {
putString("contactID", senderOrReceiver.toString())
putString("messageID", messageID.toString())
putString("contactID", senderOrReceiver.toString().uppercase())
putString("messageID", messageID.toString().uppercase())
putString("raw", message)
putString("transmission", transmissionModeString)
}
Expand Down Expand Up @@ -125,7 +125,7 @@ class BridgefyModule(context: ReactApplicationContext) : ReactContextBaseJavaMod

override fun onConnectedSecurely(userID: UUID) {
val body: WritableMap = Arguments.createMap().apply {
putString("userID", userID.toString())
putString("userID", userID.toString().uppercase())
}

println("(kotlin-onConnectedSecurely) Established secure connection with $userID")
Expand All @@ -136,6 +136,10 @@ class BridgefyModule(context: ReactApplicationContext) : ReactContextBaseJavaMod
// TODO, implement this properly
println("(kotlin-onProgressOfSend) messageID: $messageID, position: $position, of: $of")
}

override fun onConnectedPeers(connectedPeers: List<UUID>) {
println("(kotlin-onConnectedPeers) connectedPeers: $connectedPeers")
}
}


Expand Down Expand Up @@ -193,17 +197,17 @@ class BridgefyModule(context: ReactApplicationContext) : ReactContextBaseJavaMod
"p2p" -> {
val result = bridgefy.send(message.toByteArray(Charsets.UTF_8),
TransmissionMode.P2P(UUID.fromString(id)))
callback.invoke(false, result.toString())
callback.invoke(false, result.toString().uppercase())
}
"mesh" -> {
val result = bridgefy.send(message.toByteArray(Charsets.UTF_8),
TransmissionMode.Mesh(UUID.fromString(id)))
callback.invoke(false, result.toString())
callback.invoke(false, result.toString().uppercase())
}
"broadcast" -> {
val result = bridgefy.send(message.toByteArray(Charsets.UTF_8),
TransmissionMode.Broadcast(UUID.fromString(id)))
callback.invoke(false, result.toString())
callback.invoke(false, result.toString().uppercase())
}
else -> {
callback.invoke(true, "no-transmission-mode")
Expand Down Expand Up @@ -234,7 +238,7 @@ class BridgefyModule(context: ReactApplicationContext) : ReactContextBaseJavaMod

println("(kotlin-getUserId) User ID: $userId")

callback.invoke(false, userId.toString())
callback.invoke(false, userId.toString().uppercase())
}


Expand All @@ -260,7 +264,7 @@ class BridgefyModule(context: ReactApplicationContext) : ReactContextBaseJavaMod
return
}

bridgefy.connectSecurely(userId = UUID.fromString(userID))
bridgefy.establishSecureConnection(userId = UUID.fromString(userID))
callback.invoke(false, "Success")
}

Expand Down
1 change: 0 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ buildscript {
classpath("com.android.tools.build:gradle:7.3.1")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.15'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down
Loading