fix : file
Deskripsi: - lihat atau share file - view file ios pada home divisi > ga pake loading No Issues
This commit is contained in:
@@ -155,7 +155,7 @@ export default function BannerList() {
|
|||||||
/>
|
/>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<MaterialCommunityIcons name="file-eye" color="black" size={25} />}
|
icon={<MaterialCommunityIcons name="file-eye" color="black" size={25} />}
|
||||||
title="Lihat File"
|
title="Lihat / Share"
|
||||||
onPress={() => { openFile() }}
|
onPress={() => { openFile() }}
|
||||||
/>
|
/>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export default function FileDivisionDetail() {
|
|||||||
|
|
||||||
|
|
||||||
const openFile = (item: Props) => {
|
const openFile = (item: Props) => {
|
||||||
setLoadingOpen(true)
|
if (Platform.OS == 'android') setLoadingOpen(true)
|
||||||
let remoteUrl = 'https://wibu-storage.wibudev.com/api/files/' + item.idStorage;
|
let remoteUrl = 'https://wibu-storage.wibudev.com/api/files/' + item.idStorage;
|
||||||
const fileName = item.name + '.' + item.extension;
|
const fileName = item.name + '.' + item.extension;
|
||||||
let localPath = `${FileSystem.documentDirectory}/${fileName}`;
|
let localPath = `${FileSystem.documentDirectory}/${fileName}`;
|
||||||
@@ -59,6 +59,7 @@ export default function FileDivisionDetail() {
|
|||||||
|
|
||||||
FileSystem.downloadAsync(remoteUrl, localPath).then(async ({ uri }) => {
|
FileSystem.downloadAsync(remoteUrl, localPath).then(async ({ uri }) => {
|
||||||
const contentURL = await FileSystem.getContentUriAsync(uri);
|
const contentURL = await FileSystem.getContentUriAsync(uri);
|
||||||
|
setLoadingOpen(false)
|
||||||
try {
|
try {
|
||||||
if (Platform.OS == 'android') {
|
if (Platform.OS == 'android') {
|
||||||
// open with android intent
|
// open with android intent
|
||||||
@@ -79,7 +80,7 @@ export default function FileDivisionDetail() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
Alert.alert('INFO', 'Gagal membuka file, tidak ada aplikasi yang dapat membuka file ini');
|
Alert.alert('INFO', 'Gagal membuka file, tidak ada aplikasi yang dapat membuka file ini');
|
||||||
} finally {
|
} finally {
|
||||||
setLoadingOpen(false)
|
if (Platform.OS == 'android') setLoadingOpen(false)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ export default function SectionFile({ status, member, refreshing }: { status: nu
|
|||||||
<View style={Styles.rowItemsCenter}>
|
<View style={Styles.rowItemsCenter}>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<MaterialCommunityIcons name="file-eye" color="black" size={25} />}
|
icon={<MaterialCommunityIcons name="file-eye" color="black" size={25} />}
|
||||||
title="Lihat File"
|
title="Lihat / Share"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
openFile()
|
openFile()
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ export default function SectionFileTask({refreshing}: {refreshing: boolean}) {
|
|||||||
<View style={Styles.rowItemsCenter}>
|
<View style={Styles.rowItemsCenter}>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<MaterialCommunityIcons name="file-eye" color="black" size={25} />}
|
icon={<MaterialCommunityIcons name="file-eye" color="black" size={25} />}
|
||||||
title="Lihat File"
|
title="Lihat / Share"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
openFile()
|
openFile()
|
||||||
// setModal(false)
|
// setModal(false)
|
||||||
|
|||||||
Reference in New Issue
Block a user