Skip to content

Commit f5b84a1

Browse files
committed
feat: add getVersion() on android
1 parent ecf9f39 commit f5b84a1

File tree

5 files changed

+25
-2
lines changed

5 files changed

+25
-2
lines changed

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
8787
dependencies {
8888
implementation "com.facebook.react:react-android"
8989
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
90-
implementation 'app.akiles:sdk:2.0.0-g9ea73de'
90+
implementation 'app.akiles:sdk:2.0.0-g682a88a'
9191
}
9292

9393
react {

android/src/main/java/app/akiles/reactnative/AkilesModule.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ class AkilesModule(reactContext: ReactApplicationContext) :
6969
.emit(eventName, params)
7070
}
7171

72-
// Add override to all methods that are in the NativeAkilesSpec (matching the TypeScript Spec)
72+
@ReactMethod
73+
override fun getVersion(): String {
74+
return akiles.version
75+
}
76+
7377
@ReactMethod
7478
override fun getSessionIDs(promise: Promise) {
7579
try {

example/src/App.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ export default function App() {
5858
const [cardEmulationSupported, setCardEmulationSupported] = useState<
5959
boolean | null
6060
>(null);
61+
const [sdkVersion, setSdkVersion] = useState<string>('');
6162

6263
useEffect(() => {
64+
setSdkVersion(ak.getVersion());
6365
setBluetoothSupported(ak.isBluetoothSupported());
6466
ak.isCardEmulationSupported().then(setCardEmulationSupported);
6567
}, []);
@@ -336,6 +338,12 @@ export default function App() {
336338
keyboardShouldPersistTaps="handled"
337339
>
338340
<View style={styles.container}>
341+
{/* Show SDK Version */}
342+
<Text style={styles.label}>
343+
Akiles SDK Version:{' '}
344+
<Text style={{ color: '#b0bec5' }}>{sdkVersion || 'Loading...'}</Text>
345+
</Text>
346+
339347
{/* Show Bluetooth and Card Emulation support */}
340348
<Text style={styles.label}>
341349
Bluetooth Supported:{' '}

src/NativeAkiles.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ export interface ScheduleRange {
362362
}
363363

364364
export interface Spec extends TurboModule {
365+
getVersion(): string;
365366
getSessionIDs(): Promise<{ error?: ErrorInfo; data?: string[] }>;
366367
addSession(token: string): Promise<{ error?: ErrorInfo; data?: string }>;
367368
removeSession(id: string): Promise<{ error?: ErrorInfo }>;

src/index.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,17 @@ function convertError(e: ErrorInfo): AkilesError {
512512
return error;
513513
}
514514

515+
/**
516+
* Get the version of the Akiles SDK.
517+
*
518+
* @returns The version string of the SDK.
519+
*/
520+
export function getVersion(): string {
521+
return Akiles.getVersion();
522+
}
523+
515524
export default {
525+
getVersion,
516526
getSessionIDs,
517527
addSession,
518528
removeSession,

0 commit comments

Comments
 (0)