Skip to content

feat(mobile): Add user setting for default bookmark view mode #1723

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 17, 2025

Conversation

xuatz
Copy link
Collaborator

@xuatz xuatz commented Jul 11, 2025

Summary

  • Adds a new user setting for default bookmark view mode on mobile devices
  • Allows users to choose between "Reader" and "Browser" as their preferred default view when opening bookmarks
  • Setting is stored locally on the mobile device for instant access and offline capability

Changes Made

  • Added mobileBookmarkClickDefaultViewMode setting to mobile app's local settings
  • Implemented settings UI in mobile Settings > Default Bookmark View
  • Updated bookmark view component to use the user's preferred default view mode
  • Default value is "Reader" for new users

User Experience

  • Users can now set their preferred default view mode (Reader or Browser) for bookmarks
  • The setting is applied immediately when opening bookmarks on mobile
  • No network calls required - setting is stored locally for better performance
  • Setting persists across app sessions

Screenshots/Demo

Tested on ios simulator

I've also tested on the android app on device, connected to a karakeep server on v0.25.0 to make sure that the latest version of the app works even on older server instances.

Resolves #1603

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

@@ -2,7 +2,7 @@

- The database schema lives in `packages/db/schema.ts`.
- Changing the schema, requires a migration.
- You can generate the migration by running `pnpm run db:generate` in the root dir.
- You can generate the migration by running `pnpm run db:generate --name description_of_schema_change` in the root dir.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Give the LLMs everything they need to know to oneshot a solution ^^

@xuatz xuatz marked this pull request as draft July 11, 2025 20:09
@xuatz xuatz requested a review from MohamedBassem July 13, 2025 06:51
@xuatz xuatz marked this pull request as ready for review July 13, 2025 06:52
@@ -561,6 +561,11 @@ export const userSettings = sqliteTable("userSettings", {
})
.notNull()
.default("open_original_link"),
mobileBookmarkClickDefaultViewMode: text("mobileBookmarkClickDefaultViewMode", {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if mobileBookmarkClickDefaultViewMode is the best name ^^
anyone with a better idea please suggest

Copy link
Collaborator

@MohamedBassem MohamedBassem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, looks good to me! I have one question about whether this needs to be stored in the db or not. If not, I think it might simplify things a bit (specially the backward compatibility checks, etc).

GEMINI.md Outdated
Comment on lines 70 to 72
## Development Notes

- When making schema changes, refer to the instructions in docs/docs/07-Development/03-database.md
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can save it a couple of calls if we just quickly tell it how to do the db migration here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My tiny concern is that it will kinda duplicate the information, but otherwise I don't mind either.

@@ -0,0 +1 @@
ALTER TABLE `userSettings` ADD `mobileBookmarkClickDefaultViewMode` text DEFAULT 'reader' NOT NULL;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of storing this in the database, have you considered storing it with the other mobile local settings in /apps/mobile/lib/settings.ts, I feel like it's not one of the those settings that require synchronization as people don't really switch mobile apps that frequently, what do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might not want it now, but I was thinking "might as well".

I'll change the implementation to use local settings to move the PR forward, but feel free to let me know if you change your mind lol.

Comment on lines 15 to 32
const { mutate: updateUserSettings } = api.users.updateSettings.useMutation({
onSuccess: () => {
// Invalidate and refetch user settings cache
utils.users.settings.invalidate();
toast({
message: "Bookmark View Mode updated!",
showProgress: false,
});
router.back();
},
onError: () => {
toast({
message: "Something went wrong",
variant: "destructive",
showProgress: false,
});
},
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use useUpdateUserSettings which takes care of invalidation for you.

Comment on lines 32 to 36
/**
* Don't retry if the endpoint doesn't exist
* maybe we can remove this after x months after release lol
*/
retry: false,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The settings endpoint was added in 0.25 and it's been more than a month, I think it's fair to assume that everyone should have it running by now.

>
<Pressable className="flex flex-row justify-between">
<Text className="text-lg text-accent-foreground">
Bookmark View Mode
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about Default Bookmark View?

@xuatz
Copy link
Collaborator Author

xuatz commented Jul 14, 2025

@MohamedBassem change requests have been applied, please take a look again 🙇

Copy link
Collaborator

@MohamedBassem MohamedBassem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you!

@MohamedBassem MohamedBassem merged commit fe69ca8 into karakeep-app:main Jul 17, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Question] Android App - set preferred view
2 participants