From 4ca8b37418ee4a3dca4f8b37c7fb8347ddcd68d8 Mon Sep 17 00:00:00 2001 From: EthanShoeDev <13422990+EthanShoeDev@users.noreply.github.com> Date: Sat, 13 Sep 2025 00:01:49 -0400 Subject: [PATCH] use init function --- apps/mobile/src/app/index.tsx | 6 ++-- apps/mobile/src/lib/test-uniffi-russh.ts | 40 +++++++++++++----------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/apps/mobile/src/app/index.tsx b/apps/mobile/src/app/index.tsx index b5bbd4d..74c4847 100644 --- a/apps/mobile/src/app/index.tsx +++ b/apps/mobile/src/app/index.tsx @@ -13,7 +13,7 @@ import { secretsManager, } from '../lib/secrets-manager'; import { sshConnectionManager } from '../lib/ssh-connection-manager'; -import { result } from '../lib/test-uniffi-russh'; +import '../lib/test-uniffi-russh'; const defaultValues: ConnectionDetails = { host: 'test.rebex.net', port: 22, @@ -119,9 +119,7 @@ export default function Index() { > fressh - - A fast, friendly SSH client {result} - + A fast, friendly SSH client Connect to SSH Server diff --git a/apps/mobile/src/lib/test-uniffi-russh.ts b/apps/mobile/src/lib/test-uniffi-russh.ts index 7708035..df7d8c3 100644 --- a/apps/mobile/src/lib/test-uniffi-russh.ts +++ b/apps/mobile/src/lib/test-uniffi-russh.ts @@ -3,30 +3,34 @@ import { type BinaryOperator, SafeAddition, type ComputationResult, + uniffiInitAsync, } from '@fressh/react-native-uniffi-russh'; -const calculator = new Calculator(); +void uniffiInitAsync().then(() => { + const calculator = new Calculator(); -const addOp = new SafeAddition(); + const addOp = new SafeAddition(); -class SafeMultiply implements BinaryOperator { - perform(lhs: bigint, rhs: bigint): bigint { - return lhs * rhs; + class SafeMultiply implements BinaryOperator { + perform(lhs: bigint, rhs: bigint): bigint { + return lhs * rhs; + } } -} -const multOp = new SafeMultiply(); + const multOp = new SafeMultiply(); -// bigints -const three = 3n; -const seven = 7n; + // bigints + const three = 3n; + const seven = 7n; -// Perform the calculation, and to get an object -// representing the computation result. -const computation: ComputationResult = calculator - .calculate(addOp, three, three) - .calculateMore(multOp, seven) - .lastResult()!; + // Perform the calculation, and to get an object + // representing the computation result. + const computation: ComputationResult = calculator + .calculate(addOp, three, three) + .calculateMore(multOp, seven) + .lastResult()!; -// Unpack the bigint value into a string. -export const result = computation.value.toString(); + // Unpack the bigint value into a string. + const result = computation.value.toString(); + console.log('AAAAAAAAAAAAAAAAAAAAAAAAAA', result); +});