Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(YouTube - Swipe controls): Save and restore brightness and add auto-brightness toggle #610

Merged
merged 27 commits into from
Apr 20, 2024

Conversation

MarcaDian
Copy link
Contributor

@MarcaDian MarcaDian changed the title feat(YouTube - Swipe controls): Remember current brightness at all times feat(YouTube - Swipe controls): Remember current brightness at all times and add a toggle to disable auto-brightness gesture Apr 5, 2024
@oSumAtrIX oSumAtrIX self-requested a review April 10, 2024 22:41
@MarcaDian
Copy link
Contributor Author

now tests are needed, probably everything is fixed. I didn't think it would be so difficult to do in such a simple code

set -1f as default (auto-brightness)
need to override -1f in fun restore(), because in some cases the brightness is not restored after force closing app
set -1f as default (auto-brightness)
need to override -1f in fun restore(), because in some cases the brightness is not restored after force closing app
sorry Liso 🙂
*/
var savedScreenBrightnessValue: Float
get() = Settings.SWIPE_BRIGHTNESS_VALUE.get()
set(value) = Settings.SWIPE_BRIGHTNESS_VALUE.save(value)
Copy link
Member

Choose a reason for hiding this comment

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

In the future, this can be simplified by adding get set operators and delegating getter setter properties, not a matter of this PR though.

@MarcaDian
Copy link
Contributor Author

@LisoUseInAIKyrios Can you also check the code and fix something if necessary? You still have more experience in coding

@LisoUseInAIKyrios
Copy link
Contributor

@MarcaDian I have never used the swipe controls, and I'm not familiar with how it works or should work 😕

@MarcaDian MarcaDian marked this pull request as draft April 17, 2024 16:34
@MarcaDian MarcaDian closed this Apr 19, 2024
@oSumAtrIX
Copy link
Member

Why was the PR closed?

@MarcaDian
Copy link
Contributor Author

MarcaDian commented Apr 19, 2024

Hello. I can't overcome the fact that after soft close the brightness is reset to auto (-1f), but if after that force close and reopen app, then the brightness is saved and restored normally. I can't understand where this reset is, so I decided to close the PR. Perhaps the problem is in the firmware. I looked the implementation of this in Extended, but there it is on crutches.

Every time when the player type is changed, restoreDefaultBrightness() is called 3 times, maybe somewhere during this time, during soft close/reopen, rawScreenBrightness is overwritten, and then restore() restored overwritten value of brightness

If i find a fix i will reopen PR.

@MarcaDian
Copy link
Contributor Author

If I patched without Minimized playback this is work fine.

At the first i tested with 4 patches: Ads, Video ads, Gms support and Swipes. And this PR worked. Then i patched all 57 patches and it doesnt work after soft reboot app (when app is closed but youtube task is still working in background) if i then start app and go to video fullscreen brightness doesnt restore. I guess Minimized playback can affect on it.

@oSumAtrIX
Copy link
Member

This means the issue would occur for Premium users that have this feature turned on.

@MarcaDian
Copy link
Contributor Author

Probably fixed

@MarcaDian MarcaDian reopened this Apr 20, 2024
fixed brightness reset after soft close
comments
@MarcaDian MarcaDian marked this pull request as ready for review April 20, 2024 09:23
@oSumAtrIX oSumAtrIX changed the title feat(YouTube - Swipe controls): Remember current brightness at all times and add a toggle to disable auto-brightness gesture feat(YouTube - Swipe controls): Save brightness and add auto-brightness toggle Apr 20, 2024
@oSumAtrIX oSumAtrIX changed the title feat(YouTube - Swipe controls): Save brightness and add auto-brightness toggle feat(YouTube - Swipe controls): Save and restore brightness and add auto-brightness toggle Apr 20, 2024
@oSumAtrIX oSumAtrIX merged commit 1c8e2b2 into ReVanced:dev Apr 20, 2024
2 checks passed
revanced-bot pushed a commit that referenced this pull request Apr 21, 2024
# [1.8.0-dev.20](v1.8.0-dev.19...v1.8.0-dev.20) (2024-04-21)

### Features

* **YouTube - Swipe controls:** Save and restore brightness and add auto-brightness toggle ([#610](#610)) ([1c8e2b2](1c8e2b2))
@MarcaDian MarcaDian deleted the feat/save_brightness branch April 21, 2024 00:07
revanced-bot pushed a commit that referenced this pull request Apr 21, 2024
# [1.8.0](v1.7.0...v1.8.0) (2024-04-21)

### Bug Fixes

* Use correct hide playables setting key ([a2b1543](a2b1543))
* **YouTube - Disable suggested video end screen:** Require app restart ([38ae5aa](38ae5aa))
* **YouTube - GmsCore support:** Prompt to disable battery optimizations, if not done already ([#601](#601)) ([c5c9de5](c5c9de5))
* **YouTube - Hide ads:** rename `Hide paid content` to `Hide paid promotion label` ([#616](#616)) ([13dc172](13dc172))
* **YouTube - Hide keyword content:** Correctly hide content in the subscription tab ([c3bfa77](c3bfa77))
* **YouTube - Hide layout components:** Do not hide playlist shelf in library ([c5d38a7](c5d38a7))
* **YouTube - Hide layout components:** Hide horizontal tile shelves ([ba30869](ba30869))
* **YouTube - Hide load more button:** Include patch with `Hide layout components`, and hide button only in search feed  ([#600](#600)) ([c420891](c420891))
* **YouTube - Hide Shorts components:** Correctly hide Shorts if navigation tab is changed using device back button ([#611](#611)) ([ffc3437](ffc3437))
* **YouTube - Hide Shorts components:** Do not show Shorts suggestions in video player, if all hide Shorts options are enabled ([#613](#613)) ([c132670](c132670))
* **YouTube - Hide Shorts components:** Hide paid promotion label ([3ce100c](3ce100c))
* **YouTube - Hide Shorts components:** Hide subscribe button in channel bar ([9938bbf](9938bbf))
* **YouTube - Hide Shorts components:** Hide suggested actions in incognito mode ([bba421d](bba421d))
* **YouTube - Navigation bar hook:** Handle if search is active but hidden behind a maximized player ([cbccb46](cbccb46))
* **YouTube - Player flyout menu:** Add hide Lock screen menu ([#609](#609)) ([b2fe105](b2fe105))
* **YouTube - Return YouTube Dislike:** Do not clip compact text when not using English ([eeaeb49](eeaeb49))
* **YouTube - Return YouTube Dislike:** Do not show error toast if API success response contains new lines ([#612](#612)) ([9108205](9108205))
* **YouTube - Settings:** Do not show a toast if migrating old unknown settings ([f2e15a2](f2e15a2))
* **YouTube - Spoof device dimensions:** Warn about potential performance issues ([#617](#617)) ([786ac9d](786ac9d))

### Features

* **YouTube - Hide layout components:** Add option to hide horizontal shelves ([#598](#598)) ([fedace0](fedace0))
* **YouTube - Hide layout components:** Hide playables ([d6cd550](d6cd550))
* **YouTube - Hide Shorts components:** Hide `Shop`, `Location` and `Save sound to playlist` buttons ([#614](#614)) ([acfa3c9](acfa3c9))
* **YouTube - Hide Shorts components:** Hide tagged products, hide search suggestions ([#615](#615)) ([0586fb7](0586fb7))
* **YouTube - Swipe controls:** Save and restore brightness and add auto-brightness toggle ([#610](#610)) ([1c8e2b2](1c8e2b2))
* **YouTube:** Add 'About' preference to settings menu ([#608](#608)) ([b8f260e](b8f260e))
E85Addict pushed a commit to E85Addict/revanced-integrations that referenced this pull request Apr 21, 2024
# [1.8.0](v1.7.0...v1.8.0) (2024-04-21)

### Bug Fixes

* Use correct hide playables setting key ([a2b1543](a2b1543))
* **YouTube - Disable suggested video end screen:** Require app restart ([38ae5aa](38ae5aa))
* **YouTube - GmsCore support:** Prompt to disable battery optimizations, if not done already ([ReVanced#601](https://github.com/E85Addict/revanced-integrations/issues/601)) ([c5c9de5](c5c9de5))
* **YouTube - Hide ads:** rename `Hide paid content` to `Hide paid promotion label` ([ReVanced#616](https://github.com/E85Addict/revanced-integrations/issues/616)) ([13dc172](13dc172))
* **YouTube - Hide keyword content:** Correctly hide content in the subscription tab ([c3bfa77](c3bfa77))
* **YouTube - Hide layout components:** Do not hide playlist shelf in library ([c5d38a7](c5d38a7))
* **YouTube - Hide layout components:** Hide horizontal tile shelves ([ba30869](ba30869))
* **YouTube - Hide load more button:** Include patch with `Hide layout components`, and hide button only in search feed  ([ReVanced#600](https://github.com/E85Addict/revanced-integrations/issues/600)) ([c420891](c420891))
* **YouTube - Hide Shorts components:** Correctly hide Shorts if navigation tab is changed using device back button ([ReVanced#611](https://github.com/E85Addict/revanced-integrations/issues/611)) ([ffc3437](ffc3437))
* **YouTube - Hide Shorts components:** Do not show Shorts suggestions in video player, if all hide Shorts options are enabled ([ReVanced#613](https://github.com/E85Addict/revanced-integrations/issues/613)) ([c132670](c132670))
* **YouTube - Hide Shorts components:** Hide paid promotion label ([3ce100c](3ce100c))
* **YouTube - Hide Shorts components:** Hide subscribe button in channel bar ([9938bbf](9938bbf))
* **YouTube - Hide Shorts components:** Hide suggested actions in incognito mode ([bba421d](bba421d))
* **YouTube - Navigation bar hook:** Handle if search is active but hidden behind a maximized player ([cbccb46](cbccb46))
* **YouTube - Player flyout menu:** Add hide Lock screen menu ([ReVanced#609](https://github.com/E85Addict/revanced-integrations/issues/609)) ([b2fe105](b2fe105))
* **YouTube - Return YouTube Dislike:** Do not clip compact text when not using English ([eeaeb49](eeaeb49))
* **YouTube - Return YouTube Dislike:** Do not show error toast if API success response contains new lines ([ReVanced#612](https://github.com/E85Addict/revanced-integrations/issues/612)) ([9108205](9108205))
* **YouTube - Settings:** Do not show a toast if migrating old unknown settings ([f2e15a2](f2e15a2))
* **YouTube - Spoof device dimensions:** Warn about potential performance issues ([ReVanced#617](https://github.com/E85Addict/revanced-integrations/issues/617)) ([786ac9d](786ac9d))

### Features

* **YouTube - Hide layout components:** Add option to hide horizontal shelves ([ReVanced#598](https://github.com/E85Addict/revanced-integrations/issues/598)) ([fedace0](fedace0))
* **YouTube - Hide layout components:** Hide playables ([d6cd550](d6cd550))
* **YouTube - Hide Shorts components:** Hide `Shop`, `Location` and `Save sound to playlist` buttons ([ReVanced#614](https://github.com/E85Addict/revanced-integrations/issues/614)) ([acfa3c9](acfa3c9))
* **YouTube - Hide Shorts components:** Hide tagged products, hide search suggestions ([ReVanced#615](https://github.com/E85Addict/revanced-integrations/issues/615)) ([0586fb7](0586fb7))
* **YouTube - Swipe controls:** Save and restore brightness and add auto-brightness toggle ([ReVanced#610](https://github.com/E85Addict/revanced-integrations/issues/610)) ([1c8e2b2](1c8e2b2))
* **YouTube:** Add 'About' preference to settings menu ([ReVanced#608](https://github.com/E85Addict/revanced-integrations/issues/608)) ([b8f260e](b8f260e))

### Performance Improvements

* Add upstream sync ([4ad5c0c](4ad5c0c))
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.

3 participants