Skip to content

fix: hide stories floating ring - #72

Merged
omg-xtao merged 2 commits into
NextAlone:devfrom
Parsa307:fix-hide-floating-ring
Jul 27, 2026
Merged

fix: hide stories floating ring#72
omg-xtao merged 2 commits into
NextAlone:devfrom
Parsa307:fix-hide-floating-ring

Conversation

@Parsa307

@Parsa307 Parsa307 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

if Disable Stories is enabled it won't hide the floating ring in profile pictures, this PR would solve the issue.

Summary by Sourcery

Bug Fixes:

  • Hide the stories floating ring on profile pictures when the Disable Stories option is enabled.

@sourcery-ai

sourcery-ai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR ensures that when the "Disable Stories" option is enabled, the stories ring is not drawn around profile avatars by short‑circuiting the avatar-with-story drawing logic based on the configuration flag.

Flow diagram for avatar story ring drawing with DisableStories flag

flowchart TD
    A[drawAvatarWithStory] --> B[set params.showProgress]
    B --> C{NaConfig.getDisableStories.Bool}
    C -->|true| D[setImageCoords originalAvatarRect]
    D --> E[scale avatar without story ring]
    C -->|false| F{params.currentState == STATE_EMPTY
&& params.progressToSate == 1f}
    F -->|true| D
    F -->|false| G[continue story ring drawing logic]
Loading

File-Level Changes

Change Details Files
Short-circuit avatar story-ring drawing when stories are disabled via configuration.
  • Extend the condition guarding story-ring drawing to check the Disable Stories configuration flag.
  • Ensure that when stories are disabled, the avatar image coordinates and scaling logic use the base avatar rect without rendering story-specific visuals.
TMessagesProj/src/main/java/org/telegram/ui/Stories/StoriesUtilities.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 1 issue, and left some high level feedback:

  • Consider adding parentheses or extracting a boolean to clarify the new condition NaConfig.INSTANCE.getDisableStories().Bool() || params.currentState == STATE_EMPTY && params.progressToSate == 1f, since the current precedence may be confusing and easy to misinterpret during maintenance.
  • If disabling stories should also prevent setting up or animating params.showProgress and related state, you might want to early-return or gate the earlier logic with the same getDisableStories() check to avoid unnecessary state updates when stories are disabled.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider adding parentheses or extracting a boolean to clarify the new condition `NaConfig.INSTANCE.getDisableStories().Bool() || params.currentState == STATE_EMPTY && params.progressToSate == 1f`, since the current precedence may be confusing and easy to misinterpret during maintenance.
- If disabling stories should also prevent setting up or animating `params.showProgress` and related state, you might want to early-return or gate the earlier logic with the same `getDisableStories()` check to avoid unnecessary state updates when stories are disabled.

## Individual Comments

### Comment 1
<location path="TMessagesProj/src/main/java/org/telegram/ui/Stories/StoriesUtilities.java" line_range="194-196" />
<code_context>
         }
         params.showProgress = showProgress;
-        if (params.currentState == STATE_EMPTY && params.progressToSate == 1f) {
+        if (NaConfig.INSTANCE.getDisableStories().Bool() || params.currentState == STATE_EMPTY && params.progressToSate == 1f) {
             avatarImage.setImageCoords(params.originalAvatarRect);
             canvas.save();
</code_context>
<issue_to_address>
**suggestion:** Clarify boolean condition with explicit parentheses to avoid precedence confusion.

Right now the condition depends on `&&` binding more tightly than `||`, so it effectively evaluates as `disableStories || (currentState == STATE_EMPTY && progressToSate == 1f)`. Adding parentheses around the second part makes this explicit and more robust to future changes:

```java
if (NaConfig.INSTANCE.getDisableStories().Bool() || (params.currentState == STATE_EMPTY && params.progressToSate == 1f)) {
    ...
}
```

```suggestion
        params.showProgress = showProgress;
        if (NaConfig.INSTANCE.getDisableStories().Bool() || (params.currentState == STATE_EMPTY && params.progressToSate == 1f)) {
            avatarImage.setImageCoords(params.originalAvatarRect);
```
</issue_to_address>

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.

@omg-xtao omg-xtao added the bug Something isn't working label Jul 27, 2026
@omg-xtao
omg-xtao merged commit da11b44 into NextAlone:dev Jul 27, 2026
4 of 5 checks passed
@Parsa307
Parsa307 deleted the fix-hide-floating-ring branch July 27, 2026 09:51
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

None yet

Development

Successfully merging this pull request may close these issues.

2 participants