Skip to content

Commit

Permalink
fix(mobile): Fix bookmarkview page on android not showing bookmark ac…
Browse files Browse the repository at this point in the history
…tions. Fixes hoarder-app#603
  • Loading branch information
MohamedBassem committed Oct 31, 2024
1 parent 4c94b37 commit 2efc7c8
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 9 deletions.
6 changes: 3 additions & 3 deletions apps/mobile/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Hoarder App",
"slug": "hoarder",
"scheme": "hoarder",
"version": "1.6.5",
"version": "1.6.6",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "automatic",
Expand All @@ -30,7 +30,7 @@
"NSAllowsLocalNetworking": true
}
},
"buildNumber": "14"
"buildNumber": "15"
},
"android": {
"adaptiveIcon": {
Expand All @@ -48,7 +48,7 @@
}
},
"package": "app.hoarder.hoardermobile",
"versionCode": 14
"versionCode": 15
},
"plugins": [
"expo-router",
Expand Down
34 changes: 29 additions & 5 deletions apps/mobile/app/dashboard/bookmarks/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import BookmarkTextMarkdown from "@/components/bookmarks/BookmarkTextMarkdown";
import ListPickerModal from "@/components/bookmarks/ListPickerModal";
import ViewBookmarkModal from "@/components/bookmarks/ViewBookmarkModal";
import FullPageError from "@/components/FullPageError";
import { TailwindResolver } from "@/components/TailwindResolver";
import { Button } from "@/components/ui/Button";
import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView";
import FullPageSpinner from "@/components/ui/FullPageSpinner";
Expand Down Expand Up @@ -72,31 +73,54 @@ function BottomActions({ bookmark }: { bookmark: ZBookmark }) {
},
],
);

const actions = [
{
id: "lists",
icon: <ClipboardList />,
icon: (
<TailwindResolver
className="text-foreground"
comp={(styles) => <ClipboardList color={styles?.color?.toString()} />}
/>
),
shouldRender: true,
onClick: () => manageListsSheetRef.current?.present(),
disabled: false,
},
{
id: "open",
icon: <ArrowUpFromLine />,
icon: (
<TailwindResolver
className="text-foreground"
comp={(styles) => (
<ArrowUpFromLine color={styles?.color?.toString()} />
)}
/>
),
shouldRender: true,
onClick: () => viewBookmarkModal.current?.present(),
disabled: false,
},
{
id: "delete",
icon: <Trash2 />,
icon: (
<TailwindResolver
className="text-foreground"
comp={(styles) => <Trash2 color={styles?.color?.toString()} />}
/>
),
shouldRender: true,
onClick: deleteBookmarkAlert,
disabled: isDeletionPending,
},
{
id: "browser",
icon: <Globe />,
icon: (
<TailwindResolver
className="text-foreground"
comp={(styles) => <Globe color={styles?.color?.toString()} />}
/>
),
shouldRender: bookmark.content.type == BookmarkTypes.LINK,
onClick: () =>
bookmark.content.type == BookmarkTypes.LINK &&
Expand Down Expand Up @@ -276,7 +300,7 @@ export default function ListView() {
break;
}
return (
<CustomSafeAreaView>
<CustomSafeAreaView edges={["bottom"]}>
<Stack.Screen
options={{
headerTitle: title ?? "",
Expand Down
5 changes: 4 additions & 1 deletion apps/mobile/components/ui/CustomSafeAreaView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import { useHeaderHeight } from "@react-navigation/elements";

export default function CustomSafeAreaView({
children,
edges = ["top", "bottom"],
}: {
children: React.ReactNode;
edges?: ("top" | "bottom")[];
}) {
const insets = useSafeAreaInsets();
const headerHeight = useHeaderHeight();
Expand All @@ -15,11 +17,12 @@ export default function CustomSafeAreaView({
style={{
paddingTop:
// Some ugly hacks to make the app look the same on both android and ios
Platform.OS == "android"
Platform.OS == "android" && edges.includes("top")
? headerHeight > 0
? headerHeight
: insets.top
: undefined,
paddingBottom: edges.includes("bottom") ? insets.bottom : undefined,
}}
>
{children}
Expand Down

0 comments on commit 2efc7c8

Please sign in to comment.