From 440c0058e6f1d089a26af559d229635884419293 Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Wed, 13 Sep 2023 15:50:56 -0700 Subject: [PATCH 1/4] fix: the reaction codec crash --- .../expo/modules/xmtpreactnativesdk/wrappers/ContentJson.kt | 4 ++-- src/XMTP.types.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/ContentJson.kt b/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/ContentJson.kt index 5912ce076..a9daa162b 100644 --- a/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/ContentJson.kt +++ b/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/ContentJson.kt @@ -80,8 +80,8 @@ class ContentJson( val reaction = obj.get("reaction").asJsonObject return ContentJson(ContentTypeReaction, Reaction( reference = reaction.get("reference").asString, - action = ReactionAction.valueOf(reaction.get("action").asString), - schema = ReactionSchema.valueOf(reaction.get("schema").asString), + action = ReactionAction.valueOf(reaction.get("action").asString.lowercase()), + schema = ReactionSchema.valueOf(reaction.get("schema").asString.lowercase()), content = reaction.get("content").asString, )) } else if (obj.has("reply")) { diff --git a/src/XMTP.types.ts b/src/XMTP.types.ts index c92ee67a1..15e347402 100644 --- a/src/XMTP.types.ts +++ b/src/XMTP.types.ts @@ -9,8 +9,8 @@ export type ReplyContent = { export type ReactionContent = { reference: string; - action: "added" | "removed"; - schema: "unicode" | "shortcode" | "custom"; + action: "added" | "removed" | "unknown"; + schema: "unicode" | "shortcode" | "custom" | "unknown"; content: string; }; From 2494dfcaa91fa92af43ce1f9bc17929e0023256c Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Wed, 13 Sep 2023 21:54:50 -0700 Subject: [PATCH 2/4] get the enums correctly --- android/build.gradle | 2 +- .../expo/modules/xmtpreactnativesdk/wrappers/ContentJson.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 815f26921..6ee798f8c 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -95,7 +95,7 @@ repositories { dependencies { implementation project(':expo-modules-core') implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}" - implementation "org.xmtp:android:0.5.6" + implementation "org.xmtp:android:0.6.1" implementation 'com.google.code.gson:gson:2.10.1' implementation 'com.facebook.react:react-native:0.71.3' implementation "com.daveanthonythomas.moshipack:moshipack:1.0.1" diff --git a/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/ContentJson.kt b/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/ContentJson.kt index a9daa162b..9fb5a4d2a 100644 --- a/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/ContentJson.kt +++ b/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/ContentJson.kt @@ -80,8 +80,8 @@ class ContentJson( val reaction = obj.get("reaction").asJsonObject return ContentJson(ContentTypeReaction, Reaction( reference = reaction.get("reference").asString, - action = ReactionAction.valueOf(reaction.get("action").asString.lowercase()), - schema = ReactionSchema.valueOf(reaction.get("schema").asString.lowercase()), + action = getReactionAction(reaction.get("action").asString.lowercase()), + schema = getReactionSchema(reaction.get("schema").asString.lowercase()), content = reaction.get("content").asString, )) } else if (obj.has("reply")) { From 6851f64f661226a5b48a5cc5f1f4b4d72299fa43 Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Thu, 14 Sep 2023 08:52:26 -0700 Subject: [PATCH 3/4] bump the pod spec --- android/build.gradle | 2 +- example/ios/Podfile.lock | 20 ++++++++++---------- ios/XMTPReactNative.podspec | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 6ee798f8c..4ee13370e 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -95,7 +95,7 @@ repositories { dependencies { implementation project(':expo-modules-core') implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}" - implementation "org.xmtp:android:0.6.1" + implementation "org.xmtp:android:0.6.2" implementation 'com.google.code.gson:gson:2.10.1' implementation 'com.facebook.react:react-native:0.71.3' implementation "com.daveanthonythomas.moshipack:moshipack:1.0.1" diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index aee84f772..4de709fdc 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1,8 +1,8 @@ PODS: - BigInt (5.0.0) - boost (1.76.0) - - Connect-Swift (0.6.0): - - SwiftProtobuf (~> 1.22.0) + - Connect-Swift (0.7.0): + - SwiftProtobuf (~> 1.23.0) - DoubleConversion (1.1.6) - EXApplication (5.1.1): - ExpoModulesCore @@ -409,13 +409,13 @@ PODS: - RNSVG (13.9.0): - React-Core - secp256k1.swift (0.1.4) - - SwiftProtobuf (1.22.1) + - SwiftProtobuf (1.23.0) - web3.swift (1.6.0): - BigInt (~> 5.0.0) - GenericJSON (~> 2.0) - Logging (~> 1.0.0) - secp256k1.swift (~> 0.1) - - XMTP (0.5.3-alpha0): + - XMTP (0.5.4-alpha0): - Connect-Swift - GzipSwift - web3.swift @@ -423,7 +423,7 @@ PODS: - XMTPReactNative (0.1.0): - ExpoModulesCore - MessagePacker - - XMTP (= 0.5.3-alpha0) + - XMTP (= 0.5.4-alpha0) - XMTPRust (0.3.1-beta0) - Yoga (1.14.0) @@ -617,7 +617,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: BigInt: 74b4d88367b0e819d9f77393549226d36faeb0d8 boost: 57d2868c099736d80fcd648bf211b4431e51a558 - Connect-Swift: ba76bc64b2153cacce4f7985a21d4d81473dac90 + Connect-Swift: 3b305e8305a8b88a33be087dad207d84aad57dd2 DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54 EXApplication: d8f53a7eee90a870a75656280e8d4b85726ea903 EXConstants: f348da07e21b23d2b085e270d7b74f282df1a7d9 @@ -678,13 +678,13 @@ SPEC CHECKSUMS: RNScreens: 218801c16a2782546d30bd2026bb625c0302d70f RNSVG: 53c661b76829783cdaf9b7a57258f3d3b4c28315 secp256k1.swift: a7e7a214f6db6ce5db32cc6b2b45e5c4dd633634 - SwiftProtobuf: 7773c4e96a99d7b8ab7cda0fc30a883732ff93b1 + SwiftProtobuf: b70d65f419fbfe61a2d58003456ca5da58e337d6 web3.swift: 2263d1e12e121b2c42ffb63a5a7beb1acaf33959 - XMTP: 01fd25bc966b9546f1a04210d4162764861b076d - XMTPReactNative: 6feac2b747871f469660b43b85576efaa6c558d1 + XMTP: 8e220d6c064c293911d88adb08087b90d06c22c5 + XMTPReactNative: cfa66e30fa730f3b5f6cb4fed64eb3d11552e4b6 XMTPRust: 78f65f77b1454392980da244961777aee955652f Yoga: 065f0b74dba4832d6e328238de46eb72c5de9556 PODFILE CHECKSUM: 522d88edc2d5fac4825e60a121c24abc18983367 -COCOAPODS: 1.12.1 +COCOAPODS: 1.11.3 diff --git a/ios/XMTPReactNative.podspec b/ios/XMTPReactNative.podspec index 2e3262bfb..b215b654c 100644 --- a/ios/XMTPReactNative.podspec +++ b/ios/XMTPReactNative.podspec @@ -25,5 +25,5 @@ Pod::Spec.new do |s| s.source_files = "**/*.{h,m,swift}" s.dependency "MessagePacker" - s.dependency "XMTP", "= 0.5.3-alpha0" + s.dependency "XMTP", "= 0.5.4-alpha0" end From 577b944ff6ff524d5d4ceed90da013e4d24710cd Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Thu, 14 Sep 2023 09:59:02 -0700 Subject: [PATCH 4/4] get the reactions working --- .../expo/modules/xmtpreactnativesdk/wrappers/ContentJson.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/ContentJson.kt b/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/ContentJson.kt index 9fb5a4d2a..35078224d 100644 --- a/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/ContentJson.kt +++ b/android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/ContentJson.kt @@ -25,6 +25,8 @@ import org.xmtp.android.library.codecs.Reply import org.xmtp.android.library.codecs.ReplyCodec import org.xmtp.android.library.codecs.TextCodec import org.xmtp.android.library.codecs.description +import org.xmtp.android.library.codecs.getReactionAction +import org.xmtp.android.library.codecs.getReactionSchema import org.xmtp.android.library.codecs.id import java.lang.Exception