Skip to content

fix: macOS folder permissions#435

Merged
PartyDonut merged 1 commit intodevelopfrom
fix/macos-folder-permissions
Aug 4, 2025
Merged

fix: macOS folder permissions#435
PartyDonut merged 1 commit intodevelopfrom
fix/macos-folder-permissions

Conversation

@PartyDonut
Copy link
Copy Markdown
Collaborator

Pull Request Description

This adds the needed permissions for macOS. Fixing the bug report where Isar/drift was unable to open the database because of read/write errors.

Issue Being Fixed

Resolves #416

@PartyDonut PartyDonut added the bug Something isn't working label Aug 4, 2025
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Aug 4, 2025

Reviewer's Guide

Wraps sync operations in robust error handling and refactors directory selection logic in the Flutter sync provider, and updates the macOS Runner to support secure state restoration with updated folder access entitlements.

Sequence diagram for improved sync item addition with error handling

sequenceDiagram
    actor User
    participant UI as Flutter UI
    participant SyncNotifier
    participant FilePicker
    participant ClientSettingsProvider
    participant Snackbar
    User->>UI: Initiate addSyncItem
    UI->>SyncNotifier: addSyncItem(context, item)
    alt saveDirectory is null
        SyncNotifier->>FilePicker: getDirectoryPath()
        FilePicker-->>SyncNotifier: selectedDirectory
        alt selectedDirectory is empty
            SyncNotifier->>Snackbar: syncNoFolderSetup
            SyncNotifier-->>UI: return
        else selectedDirectory is valid
            SyncNotifier->>ClientSettingsProvider: setSyncPath(selectedDirectory)
        end
    end
    SyncNotifier->>Snackbar: syncAddItemForSyncing
    SyncNotifier->>SyncNotifier: syncSeries/syncMovie
    SyncNotifier->>Snackbar: startedSyncingItem/unableToSyncItem
    Note over SyncNotifier: If error occurs
    SyncNotifier->>Snackbar: somethingWentWrong
    SyncNotifier-->>UI: return
Loading

File-Level Changes

Change Details Files
Enhanced error handling and restructured addSyncItem logic
  • Encapsulated entire method in try-catch to log errors and show a fallback snackbar
  • Merged saveDirectory assignment into a single conditional block
  • Reorganized snackbar notifications and sync calls to eliminate redundant returns
lib/providers/sync_provider.dart
Enabled secure restorable state in macOS AppDelegate
  • Added applicationSupportsSecureRestorableState override returning true
macos/Runner/AppDelegate.swift
Updated macOS entitlements for folder read/write access
  • Added required folder permission keys to both DebugProfile.entitlements and Release.entitlements
macos/Runner/DebugProfile.entitlements
macos/Runner/Release.entitlements

Assessment against linked issues

Issue Objective Addressed Explanation
#416 Fix the login process on macOS so that users can successfully log in without the app hanging or failing.
#416 Resolve the underlying file permission/read-write error (as indicated by the Isar/drift database error) that prevents the app from functioning correctly on macOS.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @PartyDonut - I've reviewed your changes - here's some feedback:

  • It looks like the entitlements files weren’t updated with the com.apple.security.files.user-selected.read-write entitlement, which is required for folder read/write access—please add it to both DebugProfile.entitlements and Release.entitlements.
  • The try/catch in addSyncItem now wraps the entire method and may swallow non‐I/O errors; consider narrowing the try block or catching specific exceptions to avoid masking other issues.
  • The new applicationSupportsSecureRestorableState override in AppDelegate.swift seems unrelated to folder permissions, so please confirm its necessity or move it to a separate PR.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- It looks like the entitlements files weren’t updated with the com.apple.security.files.user-selected.read-write entitlement, which is required for folder read/write access—please add it to both DebugProfile.entitlements and Release.entitlements.
- The try/catch in addSyncItem now wraps the entire method and may swallow non‐I/O errors; consider narrowing the try block or catching specific exceptions to avoid masking other issues.
- The new applicationSupportsSecureRestorableState override in AppDelegate.swift seems unrelated to folder permissions, so please confirm its necessity or move it to a separate PR.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@PartyDonut PartyDonut merged commit 23385d8 into develop Aug 4, 2025
1 check passed
@PartyDonut PartyDonut deleted the fix/macos-folder-permissions branch August 4, 2025 14:37
@github-project-automation github-project-automation bot moved this to Done in Fladder Aug 4, 2025
Julien9969 pushed a commit to Julien9969/Fladder that referenced this pull request Sep 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

🐛 Login Broken on Mac

1 participant