Skip to content

Comments

feat: pinning file shortcuts to home screen#1889

Merged
RohitKushvaha01 merged 6 commits intoAcode-Foundation:mainfrom
RohitKushvaha01:main
Feb 21, 2026
Merged

feat: pinning file shortcuts to home screen#1889
RohitKushvaha01 merged 6 commits intoAcode-Foundation:mainfrom
RohitKushvaha01:main

Conversation

@RohitKushvaha01
Copy link
Member

@RohitKushvaha01 RohitKushvaha01 commented Feb 21, 2026

Original PR #1658

Closes #1452

@github-actions github-actions bot added the translations Anything related to Translations Whether a Issue or PR label Feb 21, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 21, 2026

Greptile Summary

Adds ability to pin file shortcuts to Android home screen, allowing users to quickly open files from their launcher. The feature includes automatic icon generation with file extension colors and labels.

Key Changes:

  • New pinFileShortcut method in Java plugin creates home screen shortcuts with custom intents
  • Icon generation system creates colored badges with file extension labels (e.g., JS, PY, HTML)
  • UI integration adds "Add to home screen" menu item in file context menu
  • Comprehensive i18n support across 32 languages
  • TypeScript definitions and Cordova plugin wrappers

Critical Issues Already Flagged:
Previous reviews identified several important issues in System.java that still need resolution:

  • Null pointer risk when launchIntent is null (line 1112)
  • ImageDecoder API level 28+ compatibility issues without fallback (lines 1136-1143)
  • Deprecated MediaStore.Images.Media.getBitmap() usage (line 1146)
  • Math.abs(Integer.MIN_VALUE) overflow risk in color hashing (line 1383)

Confidence Score: 2/5

  • This PR has unresolved critical bugs in the Java implementation that can cause runtime crashes on certain Android versions and edge cases.
  • The feature implementation is well-structured with proper UI integration, TypeScript definitions, and comprehensive i18n support. However, previous reviews identified critical issues in System.java that remain unaddressed: null pointer exceptions, API compatibility problems that will crash on Android < 9.0, and a Math.abs overflow edge case. The JavaScript/TypeScript layers are solid (score would be 4-5), but the Java layer pulls the overall confidence down to 2/5.
  • Pay close attention to src/plugins/system/android/com/foxdebug/system/System.java - it contains multiple critical bugs that need fixing before this can be safely merged.

Important Files Changed

Filename Overview
src/plugins/system/android/com/foxdebug/system/System.java Adds pinFileShortcut method with icon generation logic. Previous reviews flagged null pointer risks, API level issues with ImageDecoder, and deprecated MediaStore.Images.Media.getBitmap().
src/lib/commands.js Adds pin-file-shortcut command with validation and error handling. Implementation looks solid with proper checks for file URI and system support.
src/plugins/system/www/plugin.js Adds pinFileShortcut wrapper function for Cordova. Simple and correct implementation.
src/plugins/system/system.d.ts Adds TypeScript definitions for FileShortcut interface and pinFileShortcut method. Clean type definitions.
src/views/file-menu.hbs Adds menu item for "add to home screen" with home icon. Simple UI addition.
src/lang/en-us.json Adds English strings for shortcut feature. Includes user-facing messages for success, errors, and unsupported devices.

Sequence Diagram

sequenceDiagram
    participant User
    participant FileMenu as File Menu UI
    participant Commands as commands.js
    participant Plugin as plugin.js (Cordova)
    participant Java as System.java
    participant Android as Android Launcher

    User->>FileMenu: Click "Add to home screen"
    FileMenu->>Commands: pin-file-shortcut command
    Commands->>Commands: Validate file URI exists
    Commands->>Commands: Generate shortcut ID from URI
    Commands->>Plugin: pinFileShortcut(shortcut)
    Plugin->>Java: cordova.exec('pin-file-shortcut')
    Java->>Java: Validate shortcut data
    Java->>Java: Check launcher support
    Java->>Java: Create Intent with file URI
    Java->>Java: Generate icon (bitmap or from URI)
    Java->>Java: Build ShortcutInfoCompat
    Java->>Android: ShortcutManagerCompat.requestPinShortcut()
    Android-->>User: Show "Add to home screen" dialog
    User->>Android: Confirm
    Android-->>Java: Success
    Java-->>Plugin: callback.success()
    Plugin-->>Commands: resolve()
    Commands-->>User: Toast: "Shortcut request opened"
Loading

Last reviewed commit: f991ae3

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

37 files reviewed, 4 comments

Edit Code Review Agent Settings | Greptile

@RohitKushvaha01 RohitKushvaha01 marked this pull request as draft February 21, 2026 10:06
@RohitKushvaha01 RohitKushvaha01 self-assigned this Feb 21, 2026
RohitKushvaha01 and others added 3 commits February 21, 2026 15:58
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@RohitKushvaha01

This comment was marked as outdated.

greptile-apps[bot]

This comment was marked as outdated.

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

37 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@Acode-Foundation Acode-Foundation deleted a comment from greptile-apps bot Feb 21, 2026
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

37 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@RohitKushvaha01
Copy link
Member Author

@greptileai

@RohitKushvaha01 RohitKushvaha01 marked this pull request as ready for review February 21, 2026 11:20
@RohitKushvaha01 RohitKushvaha01 merged commit 896e552 into Acode-Foundation:main Feb 21, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

translations Anything related to Translations Whether a Issue or PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Be able to add Acode-opened file shortcuts to the home screen

1 participant