add a little tester

This commit is contained in:
Hailey
2024-07-29 16:01:38 -07:00
parent f68114bd47
commit cdbec848b7
4 changed files with 19 additions and 4 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
import * as HLSDownload from './src/HLSDownload'
import * as Referrer from './src/Referrer' import * as Referrer from './src/Referrer'
import * as SharedPrefs from './src/SharedPrefs' import * as SharedPrefs from './src/SharedPrefs'
export {Referrer, SharedPrefs} export {HLSDownload, Referrer, SharedPrefs}
@@ -9,7 +9,7 @@ import ExpoModulesCore
class ExpoHLSDownloadModule: Module { class ExpoHLSDownloadModule: Module {
public func definition() -> ModuleDefinition { public func definition() -> ModuleDefinition {
Name("ExpoHLSDownloadModule") Name("ExpoHLSDownload")
AsyncFunction("downloadAsync") { (sourceUrl: URL, progressCb: JavaScriptFunction<Void>, promise: Promise) in AsyncFunction("downloadAsync") { (sourceUrl: URL, progressCb: JavaScriptFunction<Void>, promise: Promise) in
let hlsDownload = HLSDownload(sourceUrl: sourceUrl) let hlsDownload = HLSDownload(sourceUrl: sourceUrl)
@@ -1,12 +1,12 @@
import {NotImplementedError} from '../NotImplemented' import {NotImplementedError} from '../NotImplemented'
export function downloadAsync( export async function downloadAsync(
sourceUrl: string, sourceUrl: string,
progressCb: (progress: number) => void, progressCb: (progress: number) => void,
): Promise<string> { ): Promise<string> {
throw new NotImplementedError({sourceUrl, progressCb}) throw new NotImplementedError({sourceUrl, progressCb})
} }
export function cancelAsync(sourceUrl: string): Promise<void> { export async function cancelAsync(sourceUrl: string): Promise<void> {
throw new NotImplementedError({sourceUrl}) throw new NotImplementedError({sourceUrl})
} }
+14
View File
@@ -7,6 +7,7 @@ import {CenteredView} from '#/view/com/util/Views'
import {ListContained} from 'view/screens/Storybook/ListContained' import {ListContained} from 'view/screens/Storybook/ListContained'
import {atoms as a, ThemeProvider, useTheme} from '#/alf' import {atoms as a, ThemeProvider, useTheme} from '#/alf'
import {Button, ButtonText} from '#/components/Button' import {Button, ButtonText} from '#/components/Button'
import {HLSDownload} from '../../../../modules/expo-bluesky-swiss-army'
import {Breakpoints} from './Breakpoints' import {Breakpoints} from './Breakpoints'
import {Buttons} from './Buttons' import {Buttons} from './Buttons'
import {Dialogs} from './Dialogs' import {Dialogs} from './Dialogs'
@@ -37,6 +38,19 @@ function StorybookInner() {
return ( return (
<CenteredView style={[t.atoms.bg]}> <CenteredView style={[t.atoms.bg]}>
<View style={[a.p_xl, a.gap_5xl, {paddingBottom: 200}]}> <View style={[a.p_xl, a.gap_5xl, {paddingBottom: 200}]}>
<Button
variant="solid"
color="primary"
size="small"
onPress={async () => {
const res = await HLSDownload.downloadAsync('', progress => {
console.log(`Download progress: ${progress}`)
})
console.log(`Download UR: ${res}`)
}}
label="idk">
<ButtonText>TEST THE DOWNLOAD PLZ</ButtonText>
</Button>
{!showContainedList ? ( {!showContainedList ? (
<> <>
<View style={[a.flex_row, a.align_start, a.gap_md]}> <View style={[a.flex_row, a.align_start, a.gap_md]}>