Skip to content

Feature/bma/enable polls #1246

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

Merged
merged 4 commits into from
Sep 7, 2023
Merged

Feature/bma/enable polls #1246

merged 4 commits into from
Sep 7, 2023

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Sep 7, 2023

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Small rework of the feature flag module, to improve code clarity and avoid mistake.
Enable polls in release build.

Motivation and context

Fixes #1241

Screenshots / GIFs

Tests

  • Step 1
  • Step 2
  • Step ...

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

@bmarty bmarty requested a review from a team as a code owner September 7, 2023 08:48
@bmarty bmarty requested review from jmartinesp and removed request for a team September 7, 2023 08:48
bmarty and others added 2 commits September 7, 2023 10:50
Fix typo, rename class and interface, add doc, do small refacto, to improve code clarity.
…ue, and `StaticFeatureFlagProvider` return the default value.

This fixes #1241.
@bmarty bmarty force-pushed the feature/bma/enablePolls branch from 74e3cc9 to aacfa0d Compare September 7, 2023 08:51
@github-actions
Copy link
Contributor

github-actions bot commented Sep 7, 2023

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/ZYVJqm

@codecov
Copy link

codecov bot commented Sep 7, 2023

Codecov Report

Patch coverage: 23.07% and no project coverage change.

Comparison is base (4a5a01d) 57.71% compared to head (1dbecaa) 57.71%.
Report is 7 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1246   +/-   ##
========================================
  Coverage    57.71%   57.71%           
========================================
  Files         1078     1078           
  Lines        28038    28039    +1     
  Branches      5777     5777           
========================================
+ Hits         16181    16182    +1     
  Misses        9330     9330           
  Partials      2527     2527           
Files Changed Coverage Δ
...ries/featureflag/impl/DefaultFeatureFlagService.kt 93.33% <0.00%> (ø)
...featureflag/impl/PreferencesFeatureFlagProvider.kt 0.00% <0.00%> (ø)
...ries/featureflag/impl/StaticFeatureFlagProvider.kt 0.00% <0.00%> (ø)
...libraries/featureflag/impl/di/FeatureFlagModule.kt 0.00% <0.00%> (ø)
.../android/libraries/featureflag/api/FeatureFlags.kt 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

enum class FeatureFlags(
override val key: String,
override val title: String,
override val description: String? = null,
override val defaultValue: Boolean = true
override val defaultValue: Boolean
Copy link
Member

Choose a reason for hiding this comment

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

I'd keep the defaultValue to true, so it's enabled by default for debug

Copy link
Member Author

@bmarty bmarty Sep 7, 2023

Choose a reason for hiding this comment

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

I do not agree, for debug, you can enable it in the developer option.

Copy link
Member Author

Choose a reason for hiding this comment

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

But I admit it can be an issue if the flags is impacting the FTUE flow...

Copy link
Member

Choose a reason for hiding this comment

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

Yes of course, but defaultValue was more intended to be use as a fallback value.
We should probably add more comment then, adding a reference to the StaticFeatureFlagProvider.

Copy link
Member Author

Choose a reason for hiding this comment

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

Developers (or people enabling flags) do not have to know about StaticFeatureFlagProvider IMO.

Copy link
Member

Choose a reason for hiding this comment

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

And IMO, it's the only file they have to know :D
We could add a ReleaseFeatureFlags file somewhere, and StaticFeatureFlagProvider would just read from it?

Copy link
Member Author

@bmarty bmarty Sep 7, 2023

Choose a reason for hiding this comment

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

Maybe it's a naming issue with defaultValue.
We can have a flag with defaultValue = false, and the feature enabled in StaticFeatureFlagProvider. Too confusing IMO.

Copy link
Member

Choose a reason for hiding this comment

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

I can't really find a better name like this...default is the value if it's not overridden by any provider...

FeatureFlags.Polls -> false
FeatureFlags.NotificationSettings -> false
}
feature.defaultValue
Copy link
Member

Choose a reason for hiding this comment

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

IMO StaticFeatureFlag should really be clear about which feature is enabled or not.
Using a when makes it exhaustive, so it's the responsability of the developer to enable it or not before the release. Maybe we should just add a comment at the beginning of the when to make it clear

Copy link
Member Author

Choose a reason for hiding this comment

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

Developers forget to update the value here, they just do it in FeatureFlags, like for instance in this PR: #1196.

With this change, I think there is no more possible mistake 🤞

Copy link
Member

@ganfra ganfra Sep 7, 2023

Choose a reason for hiding this comment

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

We should just educate developers, it should be clear which feature or not is enabled in release, and it shouldn't affect other providers.

Copy link
Member Author

Choose a reason for hiding this comment

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

I see. I will try to improve this then.

Ideally we would have a centralized configuration file, that can also be used for gradle Kotlin files.

Copy link
Member

Choose a reason for hiding this comment

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

Yes but we should makes sure it's exhaustive...

… `StaticFeatureFlagProvider.isFeatureEnabled()`.

Iterate after Ganfra's review.
@bmarty
Copy link
Member Author

bmarty commented Sep 7, 2023

Updated with 762a032.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 7, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 10 Code Smells

0.0% 0.0% Coverage
0.5% 0.5% Duplication

@bmarty bmarty merged commit 41de288 into develop Sep 7, 2023
@bmarty bmarty deleted the feature/bma/enablePolls branch September 7, 2023 20:48
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.

v0.16 - Polls are not enabled
2 participants