Skip to content

Enable offline post bookmarking for anonymous users - #3

Draft
fabian-st with Copilot wants to merge 4 commits into
masterfrom
copilot/add-bookmarking-feature
Draft

Enable offline post bookmarking for anonymous users#3
fabian-st with Copilot wants to merge 4 commits into
masterfrom
copilot/add-bookmarking-feature

Conversation

Copilot AI commented Feb 12, 2026

Copy link
Copy Markdown

Anonymous users can now save posts locally without authentication. Previously, save actions were blocked with "login required" toast.

Changes

Database

  • Added SavedPost entity (username+id composite key, timestamp, type) with Room DAO
  • Migration 31→32 creates saved_posts table with CASCADE delete on account removal

Business Logic

  • Extended SaveThing with saveThingLocally()/unsaveThingLocally() methods
  • Async operations post callbacks to main thread via Handler to avoid UI crashes
  • Logged-in users continue using Reddit API (unchanged)

UI

  • Updated save handlers in PostRecyclerViewAdapter, PostDetailRecyclerViewAdapter, ViewPostDetailFragment
  • Anonymous users branch to local storage, logged-in users branch to API calls
// Before: blocked anonymous users
if (mAccountName.equals(Account.ANONYMOUS_ACCOUNT)) {
    Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show();
    return;
}

// After: local storage for anonymous, API for authenticated
if (mAccountName.equals(Account.ANONYMOUS_ACCOUNT)) {
    SaveThing.saveThingLocally(mRedditDataRoomDatabase, mExecutor, 
        mAccountName, post.getId(), SavedPost.TYPE_POST, listener);
} else {
    SaveThing.saveThing(mOauthRetrofit, mAccessToken, 
        post.getFullName(), listener);
}

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.google.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.10.2-bin/a04bxjujx95o3nb99gddekhwo/gradle-8.10.2/lib/gradle-daemon-main-8.10.2.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.10.2-bin/a04bxjujx95o3nb99gddekhwo/gradle-8.10.2/lib/agents/gradle-instrumentation-agent-8.10.2.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 8.10.2 (dns block)
  • jitpack.io
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.10.2-bin/a04bxjujx95o3nb99gddekhwo/gradle-8.10.2/lib/gradle-daemon-main-8.10.2.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.10.2-bin/a04bxjujx95o3nb99gddekhwo/gradle-8.10.2/lib/agents/gradle-instrumentation-agent-8.10.2.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 8.10.2 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 12, 2026 17:21
…dapter

Co-authored-by: fabian-st <67522364+fabian-st@users.noreply.github.com>
…nonymous save

Co-authored-by: fabian-st <67522364+fabian-st@users.noreply.github.com>
Co-authored-by: fabian-st <67522364+fabian-st@users.noreply.github.com>
Copilot AI changed the title [WIP] Add bookmarking capability for users not logged in Enable offline post bookmarking for anonymous users Feb 12, 2026
Copilot AI requested a review from fabian-st February 12, 2026 17:32
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.

2 participants