add calc getting started to main app

This commit is contained in:
EthanShoeDev
2025-09-12 23:56:08 -04:00
parent da809ba29d
commit 44746b5f3d
25 changed files with 5070 additions and 476 deletions

View File

@@ -27,6 +27,7 @@
"@dylankenneally/react-native-ssh-sftp": "^1.5.20",
"@expo/vector-icons": "^15.0.2",
"@fressh/assets": "workspace:*",
"@fressh/react-native-uniffi-russh": "workspace:*",
"@react-native-picker/picker": "2.11.1",
"@react-native-segmented-control/segmented-control": "2.5.7",
"@react-navigation/bottom-tabs": "^7.4.0",

View File

@@ -13,7 +13,7 @@ import {
secretsManager,
} from '../lib/secrets-manager';
import { sshConnectionManager } from '../lib/ssh-connection-manager';
import { result } from '../lib/test-uniffi-russh';
const defaultValues: ConnectionDetails = {
host: 'test.rebex.net',
port: 22,
@@ -119,7 +119,9 @@ export default function Index() {
>
<View style={styles.header}>
<Text style={styles.appName}>fressh</Text>
<Text style={styles.appTagline}>A fast, friendly SSH client</Text>
<Text style={styles.appTagline}>
A fast, friendly SSH client {result}
</Text>
</View>
<View style={styles.card}>
<Text style={styles.title}>Connect to SSH Server</Text>

View File

@@ -0,0 +1,32 @@
import {
Calculator,
type BinaryOperator,
SafeAddition,
type ComputationResult,
} from '@fressh/react-native-uniffi-russh';
const calculator = new Calculator();
const addOp = new SafeAddition();
class SafeMultiply implements BinaryOperator {
perform(lhs: bigint, rhs: bigint): bigint {
return lhs * rhs;
}
}
const multOp = new SafeMultiply();
// 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()!;
// Unpack the bigint value into a string.
export const result = computation.value.toString();