Skip to content

style: refine share dialog in export settings - #203

Closed
OsamaX0X wants to merge 1 commit into
NextAlone:devfrom
OsamaX0X:style-refine-share-export-setting
Closed

OsamaX0X wants to merge 1 commit into
NextAlone:devfrom
OsamaX0X:style-refine-share-export-setting

Conversation

@OsamaX0X

@OsamaX0X OsamaX0X commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Improved the style of the dialog.

Summary by Sourcery

Replace the export settings file share flow with an integrated Telegram share dialog.

New Features:

  • Use the native share dialog to send exported settings directly to selected chats.

Enhancements:

  • Improve export sharing feedback with topic-aware document sending and confirmation notifications.

@sourcery-ai

sourcery-ai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

The export-settings backup flow now opens Telegram’s native ShareAlert instead of invoking the generic ShareUtil helper, sends the generated JSON file to selected chats with forum-topic support, and displays a themed success bulletin while routing broader failures through the existing alert handler.

Sequence diagram for export settings sharing

sequenceDiagram
    participant User
    participant NekoSettingsActivity
    participant ShareAlert
    participant SendMessagesHelper
    participant BulletinFactory

    User->>NekoSettingsActivity: backupSettings()
    NekoSettingsActivity->>NekoSettingsActivity: backupSettingsJson()
    NekoSettingsActivity->>ShareAlert: showDialog(shareAlert)
    User->>ShareAlert: select chats and send
    ShareAlert->>NekoSettingsActivity: onSend(dids, count, topic, showToast)
    loop selected dialogs
        NekoSettingsActivity->>SendMessagesHelper: prepareSendingDocument(..., did, replyTopMsg, ...)
    end
    opt showToast
        NekoSettingsActivity->>BulletinFactory: createInviteSentBulletin(...)
        BulletinFactory-->>User: show success bulletin
    end
Loading

File-Level Changes

Change Details Files
Replace the generic file-sharing utility with Telegram’s native share dialog and document-send flow.
  • Instantiate and display a ShareAlert for the generated JSON backup.
  • Send the backup document to each selected dialog, including forum-topic reply metadata when applicable.
  • Show the standard invite-sent bulletin after sharing, with themed colors and recipient counts.
TMessagesProj/src/main/java/tw/nekomimi/nekogram/settings/NekoSettingsActivity.java
Update backup error handling and dependencies to support the native sharing implementation.
  • Add Telegram UI, message, dialog, topic, and collection dependencies required by ShareAlert.
  • Handle all sharing-time exceptions through the existing simple-alert mechanism.
TMessagesProj/src/main/java/tw/nekomimi/nekogram/settings/NekoSettingsActivity.java

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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="TMessagesProj/src/main/java/tw/nekomimi/nekogram/settings/NekoSettingsActivity.java" line_range="283" />
<code_context>
             FileUtil.writeUtf8String(backupSettingsJson(), cacheFile);
-            ShareUtil.shareFile(getParentActivity(), cacheFile);
-        } catch (JSONException e) {
+            ShareAlert shareAlert = new ShareAlert(getParentActivity(), null, null, false, null, false) {
+                @Override
+                protected void onSend(LongSparseArray<TLRPC.Dialog> dids, int count, TLRPC.TL_forumTopic topic, boolean showToast) {
</code_context>
<issue_to_address>
**Export sends nothing**

When the user selects chats and taps Send in the export dialog, `ShareAlert` receives null messages and null text, so `sendInternal` skips the content branches and never calls the overridden `onSend`; `prepareSendingDocument` is never reached and no file is sent.

Make the document-only export invoke `onSend` for the selected chats.
</issue_to_address>

### Comment 2
<location path="TMessagesProj/src/main/java/tw/nekomimi/nekogram/settings/NekoSettingsActivity.java" line_range="300" />
<code_context>
+                                getAccountInstance(),
+                                cacheFile.getAbsolutePath(),
+                                cacheFile.getAbsolutePath(),
+                                null,
+                                null,
+                                "application/json",
</code_context>
<issue_to_address>
**Share comments are discarded**

When the user adds a comment in the share dialog, the document is sent with a null caption and the callback never reads the share dialog’s comment, so recipients get the file without any comment the user typed.

Include the entered comment in the document send or send it as a separate message, matching the native share dialog’s comment behavior.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 2 findings to address first, and the backup file is now sent as a document into selected Telegram dialogs, so an implementation mistake could expose settings data or deliver it to the wrong recipients. Reverting stops future sends but cannot retract files or messages already delivered.

Blocking findings: TMessagesProj/src/main/java/tw/nekomimi/nekogram/settings/NekoSettingsActivity.java:283, TMessagesProj/src/main/java/tw/nekomimi/nekogram/settings/NekoSettingsActivity.java:300


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

FileUtil.writeUtf8String(backupSettingsJson(), cacheFile);
ShareUtil.shareFile(getParentActivity(), cacheFile);
} catch (JSONException e) {
ShareAlert shareAlert = new ShareAlert(getParentActivity(), null, null, false, null, false) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 High · Export sends nothing

When the user selects chats and taps Send in the export dialog, ShareAlert receives null messages and null text, so sendInternal skips the content branches and never calls the overridden onSend; prepareSendingDocument is never reached and no file is sent.

Make the document-only export invoke onSend for the selected chats.

Prompt for AI agents
In `TMessagesProj/src/main/java/tw/nekomimi/nekogram/settings/NekoSettingsActivity.java` at line 283:

**Export sends nothing**

When the user selects chats and taps Send in the export dialog, `ShareAlert` receives null messages and null text, so `sendInternal` skips the content branches and never calls the overridden `onSend`; `prepareSendingDocument` is never reached and no file is sent.

Make the document-only export invoke `onSend` for the selected chats.

cacheFile.getAbsolutePath(),
cacheFile.getAbsolutePath(),
null,
null,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Share comments are discarded

When the user adds a comment in the share dialog, the document is sent with a null caption and the callback never reads the share dialog’s comment, so recipients get the file without any comment the user typed.

Include the entered comment in the document send or send it as a separate message, matching the native share dialog’s comment behavior.

Prompt for AI agents
In `TMessagesProj/src/main/java/tw/nekomimi/nekogram/settings/NekoSettingsActivity.java` at line 300:

**Share comments are discarded**

When the user adds a comment in the share dialog, the document is sent with a null caption and the callback never reads the share dialog’s comment, so recipients get the file without any comment the user typed.

Include the entered comment in the document send or send it as a separate message, matching the native share dialog’s comment behavior.

@omg-xtao

omg-xtao commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

This makes the method complicated and unnecessary.

@omg-xtao omg-xtao closed this Oct 8, 2026
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