Skip to content

Instantly share code, notes, and snippets.

View dueka's full-sized avatar

Ekanem David dueka

View GitHub Profile
// This class represents an authentication middleware used in a web application.
export class AuthMiddleware extends BaseRouterMiddleware {
protected appUtils: AppUtils;
protected loginSessionService: LoginSessionService;
constructor(appRouter: Router) {
super(appRouter);
}
@dueka
dueka / App.tsx
Created April 29, 2023 15:16
App.tsx
return (
<SafeAreaView style={styles.main}>
<Text style={styles.head}>
Agora Interactive Live Streaming Quickstart
</Text>
<View style={styles.btnContainer}>
<Text onPress={join} style={styles.button}>
{isJoinLoading ? 'Joining...' : ' Join'}
</Text>
<Text onPress={leave} style={styles.button}>
@dueka
dueka / App.tsx
Created April 29, 2023 15:15
App.tsx
const startTranscribe = async () => {
setIsTranscribing(true);
const recordingPath = `${RNFS.DocumentDirectoryPath}/audioRecordings`;
const fileName = 'recording.wav';
const filePath = `${recordingPath}/${fileName}`;
// Read the contents of the recorded file
if (!(await RNFS.exists(recordingPath))) {
await RNFS.mkdir(recordingPath);
}
@dueka
dueka / App.tsx
Created April 29, 2023 15:15
App.tsx
const leave = async () => {
setLeaveLoading(true);
try {
agoraEngineRef.current?.leaveChannel();
agoraEngineRef.current
?.getMediaEngine()
.unregisterAudioFrameObserver(iAudioFrameObserver);
console.log('stop recording ');
agoraEngineRef.current?.stopAudioRecording();
@dueka
dueka / App.tsx
Created April 29, 2023 15:15
App.tsx
const leave = async () => {
setLeaveLoading(true);
try {
agoraEngineRef.current?.leaveChannel();
agoraEngineRef.current
?.getMediaEngine()
.unregisterAudioFrameObserver(iAudioFrameObserver);
console.log('stop recording ');
agoraEngineRef.current?.stopAudioRecording();
@dueka
dueka / App.tsx
Created April 29, 2023 15:14
App.tsx
const join = async () => {
setJoinLoading(true);
resetTranscribedData();
const recordingPath = `${RNFS.DocumentDirectoryPath}/audioRecordings`;
RNFS.mkdir(recordingPath);
const fileName = 'recording.wav';
const filePath = `${recordingPath}/${fileName}`;
await RNFS.unlink(filePath).catch(error => {
console.log('Error deleting file:', error);
});
@dueka
dueka / App.tsx
Created April 29, 2023 15:13
App.tsx
import React, {useRef, useState, useEffect} from 'react';
import {
SafeAreaView,
ScrollView,
StyleSheet,
Text,
View,
Switch,
ActivityIndicator,
} from 'react-native';
@dueka
dueka / App.tsx
Created April 29, 2023 14:52
App.tsx
import React, {useRef, useState, useEffect} from 'react';
import {
SafeAreaView,
ScrollView,
StyleSheet,
Text,
View,
Switch,
ActivityIndicator,
} from 'react-native';
@dueka
dueka / TranscribeOutput.tsx
Created April 29, 2023 14:51
TranscribeOutput.tsx
import React from 'react';
import {Text, View, StyleSheet} from 'react-native';
const TranscribedOutput = ({transcribedText, interimTranscribedText}: any) => {
if (transcribedText.length === 0 && interimTranscribedText.length === 0) {
return <Text>...</Text>;
}
return (
<View style={styles.box}>
@dueka
dueka / createRandomData.ts
Created February 22, 2023 16:50
Create random data
interface IData {
name?: string;
department?: string;
teamlead?: string;
role?: string;
location?: string;
lga?: string;
country?: string;
due_date?: string;
children?: JSX.Element | JSX.Element[];