Skip to content

refactor(sdcard): convert SDcard implementation from Java to Kotlin - #2718

Closed
batoripX wants to merge 1 commit into
Acode-Foundation:mainfrom
batoripX:patch-1
Closed

refactor(sdcard): convert SDcard implementation from Java to Kotlin#2718
batoripX wants to merge 1 commit into
Acode-Foundation:mainfrom
batoripX:patch-1

Conversation

@batoripX

Copy link
Copy Markdown
  • Migrate SDcard file handling and SAF utilities to idiomatic Kotlin
  • Convert MyFileObserver to Kotlin secondary constructors
  • Use Kotlin bitwise operations and property access syntax

- Migrate SDcard file handling and SAF utilities to idiomatic Kotlin
- Convert MyFileObserver to Kotlin secondary constructors
- Use Kotlin bitwise operations and property access syntax
@greptile-apps

greptile-apps Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR attempts to replace the SD-card Cordova implementation with Kotlin, but the new file contains only a small manager/helper subset and is not wired into the native plugin contract.

  • Deletes the complete Java CordovaPlugin, including its action dispatcher, SAF operations, activity-result handling, and workspace-index integration.
  • Adds Kotlin file-information, URI, write-permission, and file-observer helpers.
  • Leaves the plugin registration and source declaration pointing to the deleted Java implementation.

Confidence Score: 4/5

The PR is not safe to merge because the registered native SD-card service is deleted without a buildable Cordova-compatible replacement.

Every external-storage and workspace-index bridge call still targets com.foxdebug.sdcard.SDcard, while the replacement is an unregistered SDCardManager that does not extend CordovaPlugin or implement action dispatch.

Files Needing Attention: src/plugins/sdcard/src/android/SDcard.kt and src/plugins/sdcard/src/android/SDcard.java

Important Files Changed

Filename Overview
src/plugins/sdcard/src/android/SDcard.java Deletes the complete registered Cordova plugin and its filesystem, SAF, observer, picker, and workspace action implementations without an equivalent replacement.
src/plugins/sdcard/src/android/SDcard.kt Adds an unregistered plain manager under a different package with only a small subset of the former functionality and no Cordova action dispatcher.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    JS[sdcard JavaScript API] -->|cordova.exec service SDcard| Registration[plugin.xml: com.foxdebug.sdcard.SDcard]
    Registration --> Missing[Deleted SDcard CordovaPlugin]
    Kotlin[com.foxbyte.acode.SDCardManager] -. not registered and has no execute dispatcher .-> Registration
    Missing --> Failure[Build failure or all native SDcard actions unavailable]
Loading

Reviews (1): Last reviewed commit: "refactor(sdcard): convert SDcard impleme..." | Re-trigger Greptile

import java.io.OutputStream

// Assuming context, formatUri, filename, and callback exist in the enclosing scope/class
class SDCardManager(private val context: Context) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Cordova plugin entry point removed

When JavaScript invokes any SDcard action, Cordova still resolves com.foxdebug.sdcard.SDcard, but this change deletes that plugin and replaces it with an unregistered SDCardManager that neither extends CordovaPlugin nor implements execute. The plugin manifest also still references the deleted Java source, causing the Android build to fail during plugin installation or, if installation proceeds, leaving all external-storage, SAF picker, file-watching, and workspace-index operations unavailable.

Knowledge Base Used:

@batoripX batoripX closed this Aug 11, 2026
@github-project-automation github-project-automation Bot moved this from Backlog to Done in The Code Board - Acode Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant