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

Rewrite BatteryOptimizationsPage to M3 #747

Merged
merged 20 commits into from May 15, 2024

Conversation

ArnyminerZ
Copy link
Member

@ArnyminerZ ArnyminerZ commented Apr 24, 2024

The PR should be in Draft state during development. As soon as it's finished, it should be marked as Ready for review and a reviewer should be chosen.

See also: Writing A Great Pull Request Description

Purpose

Update design of the battery optimizations intro page so that it uses M3.

Also updates the architecture of the activity-viewmodel-composables relationship so that it follows best practices as discussed internally, and as recommended by Google.

Short description

  • Replaced M2's typographies with M3:
    • MaterialTheme.typography.body1 :: MaterialTheme.typography.bodyLarge
    • MaterialTheme.typography.body2 :: MaterialTheme.typography.bodyMedium
    • MaterialTheme.typography.h6 :: MaterialTheme.typography.labelLarge
  • All logic has been moved to the ViewModel, no more settings updates in the composable.
  • All callback arguments in composables have {} by default so that it's not required in preview.

Checklist

  • The PR has a proper title, description and label.
  • I have self-reviewed the PR.
  • I have added documentation to complex functions and functions that can be used by other modules.
  • I have added reasonable tests or consciously decided to not add tests.

Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
@ArnyminerZ ArnyminerZ linked an issue Apr 24, 2024 that may be closed by this pull request
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
@ArnyminerZ ArnyminerZ added the refactoring Internal improvement of existing functions label Apr 24, 2024
@ArnyminerZ ArnyminerZ self-assigned this Apr 24, 2024
@ArnyminerZ ArnyminerZ requested a review from rfc2822 April 28, 2024 08:09
@ArnyminerZ ArnyminerZ marked this pull request as ready for review April 28, 2024 08:09
@rfc2822 rfc2822 requested review from sunkup and removed request for rfc2822 April 29, 2024 22:03
Copy link
Member

@sunkup sunkup left a comment

Choose a reason for hiding this comment

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

We want the activity - in this case the IntroPage to be as clean as possible. Hence we should move everything we can out into their own respective files.

In the viewModel we started to use an immutable UiState data class to hold the viewmodel state. Following the guideline and for consistency we should do that everywhere.

Looks good otherwise tho :)

Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
@ArnyminerZ ArnyminerZ requested a review from sunkup April 30, 2024 13:56
@ArnyminerZ
Copy link
Member Author

Should be ready :)

Copy link
Member

@sunkup sunkup left a comment

Choose a reason for hiding this comment

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

Nice. Looks much tidier already.

Not sure if the requested changes introduced this, but I just found the dontShowBattery checkbox is not selectable/updated when tapped anymore.

@rfc2822 rfc2822 force-pushed the main-ose branch 6 times, most recently from 1ae5eb5 to b15cb80 Compare May 2, 2024 11:42
@rfc2822 rfc2822 force-pushed the main-ose branch 11 times, most recently from 47ef18b to 39f8f2e Compare May 2, 2024 12:03
@ArnyminerZ
Copy link
Member Author

dontShowBattery checkbox is not selectable/updated when tapped anymore.

I'm working on it

Signed-off-by: Arnau Mora <arnyminerz@proton.me>
@ArnyminerZ ArnyminerZ requested a review from sunkup May 3, 2024 06:55
Copy link
Member

@sunkup sunkup left a comment

Choose a reason for hiding this comment

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

Checkboxes still weren't selectable. Last commit fixes it :)

@rfc2822
Copy link
Member

rfc2822 commented May 8, 2024

Please rebase to main-ose (better DI)

# Conflicts:
#	app/src/main/kotlin/at/bitfire/davdroid/ui/intro/BatteryOptimizationsPage.kt
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
@ArnyminerZ ArnyminerZ requested a review from sunkup May 8, 2024 14:07
@sunkup sunkup requested a review from rfc2822 May 13, 2024 08:06
Copy link
Member

@rfc2822 rfc2822 left a comment

Choose a reason for hiding this comment

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

Looks good; I just wonder whether we should combine hintBatteryOptimization and hintAutostartOptimization into the uiState too. We can discuss it tomorrow :)

@rfc2822 rfc2822 merged commit 6b86316 into main-ose May 15, 2024
7 checks passed
@rfc2822 rfc2822 deleted the 741-rewrite-batteryoptimizationspage-to-m3 branch May 15, 2024 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Internal improvement of existing functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rewrite BatteryOptimizationsPage to M3
3 participants