Skip to content

Commit

Permalink
added format disk during setup
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan6sha committed Apr 6, 2024
1 parent 8db55ca commit 6348e52
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion apps/box/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "box",
"version": "1.6.13",
"version": "1.6.14",
"private": true,
"dependencies": {
"@functionland/fula-sec": "*",
Expand Down
29 changes: 20 additions & 9 deletions apps/box/src/screens/InitialSetup/SetBloxAuthorizer.screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const SetBloxAuthorizerScreen = ({ route }: Props) => {
const logger = useLogger();
const { isManualSetup = false } = route.params || {};
const [showSkipButton, setShowSkipButton] = useState(false);
const [showFormatDiskButton, setShowFormatDiskButton] = useState(false);

const [setAppPeerId, signiture, password] = useUserProfileStore((state) => [
state.setAppPeerId,
Expand Down Expand Up @@ -141,6 +142,15 @@ export const SetBloxAuthorizerScreen = ({ route }: Props) => {
};
}, [data_bloxProperties, error_bloxProperties]);

useEffect(() => {
const timer = setTimeout(() => {
setShowFormatDiskButton(true);
}, 10000); // 10000 milliseconds = 10 seconds

// Cleanup function to clear the timer
return () => clearTimeout(timer);
}, []); // Empty dependency array means this effect runs only once on mount

//echange config with blox when peerId is ready
useEffect(() => {
if (
Expand Down Expand Up @@ -295,6 +305,7 @@ export const SetBloxAuthorizerScreen = ({ route }: Props) => {
};
const handleFormatDisk = () => {
refetch_bloxFormatDisk({ withLoading: true });
goBack();
};
return (
<FxSafeAreaBox flex={1} paddingHorizontal="20" paddingVertical="16">
Expand Down Expand Up @@ -419,15 +430,15 @@ export const SetBloxAuthorizerScreen = ({ route }: Props) => {
onRefreshPress={refetch_bloxProperties}
loading={loading_bloxProperties}
>
{true ||
(data_bloxProperties?.data?.bloxFreeSpace?.size === 0 && (
<FxButton
onPress={loading_bloxFormatDisk ? null : handleFormatDisk}
>
{loading_bloxFormatDisk ? <ActivityIndicator /> : null}
Format Disk
</FxButton>
))}
{(data_bloxProperties?.data?.bloxFreeSpace?.size === 0 ||
showFormatDiskButton) && (
<FxButton
onPress={loading_bloxFormatDisk ? null : handleFormatDisk}
>
{loading_bloxFormatDisk ? <ActivityIndicator /> : null}
Format Disk
</FxButton>
)}
</DeviceCard>
)}
</FxKeyboardAwareScrollView>
Expand Down

0 comments on commit 6348e52

Please sign in to comment.