Skip to content
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

main => beta #227

Merged
merged 50 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
e68b3d9
Added thirdweb ConnectWallet button to LaunchScreen
cameronvoell Dec 11, 2023
1e516e3
Fix iOS build
cameronvoell Dec 13, 2023
bce01b2
Fix Sign Request website info
cameronvoell Dec 14, 2023
41d0934
Make button white
cameronvoell Dec 14, 2023
76feee8
Merge branch 'main' into cameronvoell/example-wallet-auth
cameronvoell Dec 18, 2023
4879782
expo filesystem errors
cameronvoell Dec 21, 2023
f64420f
Added callbacks for logging identity creation and enabling
cameronvoell Dec 21, 2023
c00864f
Merge branch 'main' into cameronvoell/example-wallet-auth
cameronvoell Dec 22, 2023
3289b81
Merge branch 'main' into cameronvoell/example-wallet-auth
cameronvoell Jan 9, 2024
d4619ec
downgrade semantic version until we can verify node update in docs ac…
cameronvoell Jan 10, 2024
ed58e51
fix: return the entire json from custom content type and convert the …
nplasterer Jan 11, 2024
d5ac040
Merge pull request #209 from xmtp/np/fix-custom-content-type-bug
cameronvoell Jan 11, 2024
9c65831
feat: Added support for Java 17
Jan 10, 2024
807f491
fix: Removes sign listeners after auth completion
cameronvoell Jan 13, 2024
ddae69a
Merge pull request #210 from xmtp/cv/fix-extra-sign-listeners
nplasterer Jan 14, 2024
ec17fdb
Merge branch 'main' into cameronvoell/example-wallet-auth
cameronvoell Jan 16, 2024
b840f8e
Added buttons for creating client with connected signer
cameronvoell Jan 16, 2024
ddb7615
Merge pull request #207 from xmtp/ar/java-17-support
alexrisch Jan 16, 2024
64d850f
Update XMTP dependency version to 0.7.6-alpha0
Jan 17, 2024
ced7d50
Update org.xmtp:android dependency to version 0.7.4
Jan 17, 2024
e22c676
Update thirdweb version
cameronvoell Jan 18, 2024
06d9ff9
fix: bump both to latest versions
nplasterer Jan 18, 2024
1431ac7
Added .env loading of Thirdweb client id
cameronvoell Jan 18, 2024
5abd653
Added react-native-config android setup
cameronvoell Jan 18, 2024
4fbdb8e
Updated example/README.md
cameronvoell Jan 18, 2024
fc0d7a5
eslint fixes
cameronvoell Jan 18, 2024
a6afde6
Merge pull request #211 from xmtp/kele/bump-podspec
nplasterer Jan 19, 2024
1d16938
Merge pull request #176 from xmtp/cameronvoell/example-wallet-auth
cameronvoell Jan 20, 2024
c4be902
chore: remove ethers dependency
Jan 22, 2024
c3d7108
Merge branch 'main' into kele/remove-ethers
Jan 22, 2024
b2b0256
fix: update WalletClient
Jan 23, 2024
dfd57c8
fix: update org.xmtp:android to 0.7.6
Jan 24, 2024
3e3b2b5
Merge pull request #219 from xmtp/kele/bump-gradle
nplasterer Jan 24, 2024
cee2572
Schedules PR of main to beta Mon at 1:05AM PT
cameronvoell Jan 24, 2024
08b6396
feat: Key Material
Jan 24, 2024
17e943c
fix: Revert Java Version Upgrade
Jan 23, 2024
06cf2b6
Merge pull request #217 from xmtp/ar/fix-revert-java-upgrade
alexrisch Jan 25, 2024
456b87d
Merge pull request #222 from xmtp/cv/schedule-pr-sync-beta
cameronvoell Jan 25, 2024
9afbe03
Merge pull request #223 from xmtp/ar/keyMaterial-export
alexrisch Jan 25, 2024
47f63ac
fix: Bump Pod Dependency
Jan 25, 2024
6caee4a
Merge pull request #224 from xmtp/ar/fix-bump-pod-keymaterial
alexrisch Jan 25, 2024
9d27cfb
Import static podfiles from libxmtp-swift podspec
cameronvoell Jan 29, 2024
68dbb1d
test against ios 0.7.7 and libxmtp 0.4.1
cameronvoell Jan 30, 2024
d9085f5
Test via pod override before pod publish
cameronvoell Jan 31, 2024
613cc18
Update ios to XMTP 0.7.8-alpha0
cameronvoell Jan 31, 2024
78f6f47
Merge pull request #229 from xmtp/cv/xmtp-ios-static-lib
cameronvoell Jan 31, 2024
670f54d
Merge pull request #215 from xmtp/kele/remove-ethers
cameronvoell Feb 1, 2024
c68bcc5
feat: Added support for handling lowercase addresses
Feb 1, 2024
ed8f7cc
feat: Lowercase Address handling
Feb 2, 2024
9b08182
Merge pull request #233 from xmtp/ar/address-lowercase
alexrisch Feb 2, 2024
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
19 changes: 19 additions & 0 deletions .github/workflows/syncBeta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Auto PR Creation
on:
schedule:
- cron: '5 9 * * 5' # Runs at 1:05 AM PT(-8) every Monday (time in UTC)
workflow_dispatch:

jobs:
create-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Create Pull Request
uses: repo-sync/pull-request@v2
with:
source_branch: "main"
destination_branch: "beta"
pr_title: "`main` => `beta`"
github_token: ${{ secrets.GITHUB_TOKEN }}
19 changes: 11 additions & 8 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,18 @@ afterEvaluate {
}

android {
compileSdkVersion safeExtGet("compileSdkVersion", 31)
compileSdkVersion safeExtGet("compileSdkVersion", 33)

compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
if (agpVersion.tokenize('.')[0].toInteger() < 8) {
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.majorVersion
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.majorVersion
}
}

defaultConfig {
Expand All @@ -95,7 +98,7 @@ repositories {
dependencies {
implementation project(':expo-modules-core')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
implementation "org.xmtp:android:0.7.3"
implementation "org.xmtp:android:0.7.6"
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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import kotlinx.coroutines.suspendCancellableCoroutine
import org.json.JSONObject
import org.xmtp.android.library.Client
import org.xmtp.android.library.ClientOptions
import org.xmtp.android.library.ConsentState
import org.xmtp.android.library.Conversation
import org.xmtp.android.library.PreEventCallback
import org.xmtp.android.library.PreparedMessage
Expand Down Expand Up @@ -156,9 +155,9 @@ class XMTPModule : Module() {
val reactSigner = ReactNativeSigner(module = this@XMTPModule, address = address)
signer = reactSigner

if (hasCreateIdentityCallback == true)
if (hasCreateIdentityCallback == true)
preCreateIdentityCallbackDeferred = CompletableDeferred()
if (hasEnableIdentityCallback == true)
if (hasEnableIdentityCallback == true)
preEnableIdentityCallbackDeferred = CompletableDeferred()
val preCreateIdentityCallback: PreEventCallback? =
preCreateIdentityCallback.takeIf { hasCreateIdentityCallback == true }
Expand All @@ -185,9 +184,9 @@ class XMTPModule : Module() {
logV("createRandom")
val privateKey = PrivateKeyBuilder()

if (hasCreateIdentityCallback == true)
if (hasCreateIdentityCallback == true)
preCreateIdentityCallbackDeferred = CompletableDeferred()
if (hasEnableIdentityCallback == true)
if (hasEnableIdentityCallback == true)
preEnableIdentityCallbackDeferred = CompletableDeferred()
val preCreateIdentityCallback: PreEventCallback? =
preCreateIdentityCallback.takeIf { hasCreateIdentityCallback == true }
Expand Down Expand Up @@ -476,7 +475,7 @@ class XMTPModule : Module() {
}
}
val encodedContent = EncodedContent.parseFrom(encodedContentDataBytes)

val prepared = conversation.prepareMessage(
encodedContent = encodedContent,
)
Expand Down Expand Up @@ -643,7 +642,7 @@ class XMTPModule : Module() {
preCreateIdentityCallbackDeferred?.complete(Unit)
}

Function("preEnableIdentityCallbackCompleted") {
Function("preEnableIdentityCallbackCompleted") {
logV("preEnableIdentityCallbackCompleted")
preEnableIdentityCallbackDeferred?.complete(Unit)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ class ContentJson(
Client.register(RemoteAttachmentCodec())
Client.register(ReplyCodec())
Client.register(ReadReceiptCodec())
// TODO:
//Client.register(CompositeCodec())
}

fun fromJsonObject(obj: JsonObject): ContentJson {
Expand Down Expand Up @@ -121,8 +119,8 @@ class ContentJson(
return fromJsonObject(obj);
}

fun bytesFrom64(bytes64: String): ByteArray = Base64.decode(bytes64, Base64.DEFAULT)
fun bytesTo64(bytes: ByteArray): String = Base64.encodeToString(bytes, Base64.DEFAULT)
fun bytesFrom64(bytes64: String): ByteArray = Base64.decode(bytes64, Base64.NO_WRAP)
fun bytesTo64(bytes: ByteArray): String = Base64.encodeToString(bytes, Base64.NO_WRAP)
}

fun toJsonMap(): Map<String, Any> {
Expand Down Expand Up @@ -186,6 +184,8 @@ class ContentJson(
json.addProperty("fallback", encodedContent.fallback)
json.add("parameters", JsonParser.parseString(parameters))
json.add("type", typeJson)
json.addProperty("content", bytesTo64(encodedContent.content.toByteArray()))

}
val encodedContentJSON = json.toString()
if (encodedContentJSON.isNotBlank()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package expo.modules.xmtpreactnativesdk.wrappers

import android.util.Base64
import com.google.gson.GsonBuilder
import org.xmtp.android.library.Client
import org.xmtp.android.library.Conversation
Expand All @@ -24,7 +25,8 @@ class ConversationWrapper {
"topic" to conversation.topic,
"peerAddress" to conversation.peerAddress,
"version" to if (conversation.version == Conversation.Version.V1) "v1" else "v2",
"conversationID" to (conversation.conversationId ?: "")
"conversationID" to (conversation.conversationId ?: ""),
"keyMaterial" to Base64.encodeToString(conversation.keyMaterial, Base64.NO_WRAP)
)
}

Expand Down
3 changes: 3 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ web-build/

# Temporary files created by Metro to check the health of the file watcher
.metro-health-check*

# Environment settings
.env
138 changes: 79 additions & 59 deletions example/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,68 +9,88 @@ import HomeScreen from './src/HomeScreen'
import LaunchScreen from './src/LaunchScreen'
import { Navigator } from './src/Navigation'
import TestScreen from './src/TestScreen'
import { ThirdwebProvider, metamaskWallet, rainbowWallet } from '@thirdweb-dev/react-native'
import { Ethereum } from '@thirdweb-dev/chains'
import Config from 'react-native-config'

const queryClient = new QueryClient()

export default function App() {
// Uncomment below to ensure correct id loaded from .env
// console.log("Thirdweb client id: " + Config.THIRD_WEB_CLIENT_ID)
return (
<QueryClientProvider client={queryClient}>
<XmtpProvider>
<NavigationContainer>
<Navigator.Navigator>
<Navigator.Screen
name="launch"
component={LaunchScreen}
options={{
title: 'XMTP RN Example',
headerStyle: {
backgroundColor: 'rgb(49 0 110)',
},
headerTintColor: '#fff',
headerTitleStyle: {
fontWeight: 'bold',
},
}}
/>
<Navigator.Screen
name="test"
component={TestScreen}
options={{ title: 'Unit Tests' }}
/>
<Navigator.Screen
name="home"
component={HomeScreen}
options={({ navigation }) => ({
title: 'My Conversations',
headerStyle: {
backgroundColor: 'rgb(49 0 110)',
},
headerTintColor: '#fff',
headerTitleStyle: {
fontWeight: 'bold',
},
headerRight: () => (
<Button
onPress={() => navigation.navigate('conversationCreate')}
title="New"
color={Platform.OS === 'ios' ? '#fff' : 'rgb(49 0 110)'}
/>
),
})}
/>
<Navigator.Screen
name="conversation"
component={ConversationScreen}
options={{ title: 'Conversation' }}
initialParams={{ topic: '' }}
/>
<Navigator.Screen
name="conversationCreate"
component={ConversationCreateScreen}
options={{ title: 'New Conversation' }}
/>
</Navigator.Navigator>
</NavigationContainer>
</XmtpProvider>
</QueryClientProvider>
<ThirdwebProvider
activeChain={ Ethereum }
supportedChains={ [ Ethereum ] }
clientId={ Config.THIRD_WEB_CLIENT_ID }
dAppMeta={{
name: 'XMTP Example',
description: 'Example app from xmtp-react-native repo',
logoUrl: 'https://pbs.twimg.com/profile_images/1668323456935510016/2c_Ue8dF_400x400.jpg',
url: 'https://xmtp.org',
}}
supportedWallets={[
metamaskWallet(), rainbowWallet()
]}>
<QueryClientProvider client={queryClient}>
<XmtpProvider>
<NavigationContainer>
<Navigator.Navigator>
<Navigator.Screen
name="launch"
component={LaunchScreen}
options={{
title: 'XMTP RN Example',
headerStyle: {
backgroundColor: 'rgb(49 0 110)',
},
headerTintColor: '#fff',
headerTitleStyle: {
fontWeight: 'bold',
},
}}
/>
<Navigator.Screen
name="test"
component={TestScreen}
options={{ title: 'Unit Tests' }}
/>
<Navigator.Screen
name="home"
component={HomeScreen}
options={({ navigation }) => ({
title: 'My Conversations',
headerStyle: {
backgroundColor: 'rgb(49 0 110)',
},
headerTintColor: '#fff',
headerTitleStyle: {
fontWeight: 'bold',
},
headerRight: () => (
<Button
onPress={() => navigation.navigate('conversationCreate')}
title="New"
color={Platform.OS === 'ios' ? '#fff' : 'rgb(49 0 110)'}
/>
),
})}
/>
<Navigator.Screen
name="conversation"
component={ConversationScreen}
options={{ title: 'Conversation' }}
initialParams={{ topic: '' }}
/>
<Navigator.Screen
name="conversationCreate"
component={ConversationCreateScreen}
options={{ title: 'New Conversation' }}
/>
</Navigator.Navigator>
</NavigationContainer>
</XmtpProvider>
</QueryClientProvider>
</ThirdwebProvider>
)
}
1 change: 1 addition & 0 deletions example/EXAMPLE.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
THIRD_WEB_CLIENT_ID=INSERT_CLIENT_ID_HERE
20 changes: 19 additions & 1 deletion example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This basic messaging app has an intentionally unopinionated UI to help make it e
## Run the example app
Follow the [React Native guide](https://reactnative.dev/docs/environment-setup) to set up a CLI environment.

To use the example app, run:
### To use the example app, run:

```bash
yarn
Expand All @@ -15,6 +15,24 @@ npx pod-install
yarn run [ios or android]
```

### Configure ThirdWeb Client API

> Note - The connect wallet button will still work without adding a client id, you just may see some extra network errors when viewing account info in the Thirdweb button after connecting.

First create a free account and download your client id from https://thirdweb.com/dashboard/settings/api-keys. Next create your .env file in the example directory

```
cd example
cp EXAMPLE.env .env
```
Finally, insert yout Thirdweb client id in specified location of `example/.env` file:
```
THIRD_WEB_CLIENT_ID=INSERT_CLIENT_ID_HERE
```

If your app doesn't appear to be picking up changes in the .env file, you can try editing the TypeScript file you're reading the env variable from (`App.tsx`) or building the app with the `--no-build-cache` flag added.


## Run example app unit tests on local emulators
Running tests locally is useful when updating GitHub actions, or locally testing between changes.

Expand Down
5 changes: 5 additions & 0 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apply plugin: "com.android.application"
apply plugin: "com.facebook.react"
apply plugin: 'kotlin-android'

apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"

import com.android.build.OutputFile

def projectRoot = rootDir.getAbsoluteFile().getParentFile().getAbsolutePath()
Expand Down Expand Up @@ -268,6 +270,9 @@ dependencies {
androidTestImplementation "androidx.test.ext:junit-ktx:1.1.5"
androidTestUtil "androidx.test.services:test-services:1.4.2"
androidTestUtil 'androidx.test:orchestrator:1.4.2'

// For loading .env
implementation project(':react-native-config')
}

apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
Expand Down
3 changes: 3 additions & 0 deletions example/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ applyNativeModulesSettingsGradle(settings)

include ':app'
includeBuild(new File(["node", "--print", "require.resolve('react-native-gradle-plugin/package.json')"].execute(null, rootDir).text.trim()).getParentFile())

include ':react-native-config'
project(':react-native-config').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-config/android')
2 changes: 2 additions & 0 deletions example/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import "@thirdweb-dev/react-native-compat";

import { registerRootComponent } from 'expo'

import App from './App'
Expand Down
3 changes: 3 additions & 0 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ target 'xmtpreactnativesdkexample' do
# Flags change depending on the env values.
flags = get_default_flags()

# See https://github.com/margelo/react-native-quick-crypto/issues/189#issuecomment-1711561970
pod "OpenSSL-Universal", "1.1.2200"

use_react_native!(
:path => config[:reactNativePath],
:hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes',
Expand Down
Loading
Loading