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

Secure backup: create a feature flag (disabled) #1716

Merged
merged 3 commits into from
Oct 31, 2023

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Oct 31, 2023

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Add a feature flag for chat backup feature, disabled by default.

Motivation and context

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 October 31, 2023 19:56
@bmarty bmarty requested review from ganfra and removed request for a team October 31, 2023 19:56
@bmarty bmarty force-pushed the feature/bma/secureBackupFeatureFlag branch from e0c3546 to c52a50d Compare October 31, 2023 20:01
@@ -47,8 +52,15 @@ class LogoutPresenter @Inject constructor(
mutableStateOf(Async.Uninitialized)
}

val backupUploadState: BackupUploadState by remember {
encryptionService.waitForBackupUploadSteadyState()
val secureStorageFlag by featureFlagService.isFeatureEnabledFlow(FeatureFlags.SecureStorage)
Copy link
Contributor

@ganfra ganfra Oct 31, 2023

Choose a reason for hiding this comment

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

Is setting to false for initial value not enough?
Otherwise we might want to use an Async so we are sure we don't do anything while it's not Success.

Copy link
Member Author

Choose a reason for hiding this comment

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

If we set to false, it's false then true, which is not ideal, both for test (more intermediate states) and for prod.
I am looking how to improve this with Async.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, I start with a null value, and it seems to be OK (still testing it)

Copy link
Contributor

github-actions bot commented Oct 31, 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/4rwA3X

if (secureStorageFlag) {
encryptionService.waitForBackupUploadSteadyState()
} else {
flowOf(BackupUploadState.Done)
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, I'd let the EncryptionService handle this, so we don't have to check that in Presenters.

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 thought about doing like this, but I prefer to avoid this, since we had to give the FeatureFlagService to the SDK which is a bit strange. We may iterate on this later.

Copy link
Contributor

Choose a reason for hiding this comment

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

Our matrix module is not really a sdk. I see what you mean, but it's not really the responsability of the Presenter neither :/

import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import javax.inject.Inject

class LogoutPresenter @Inject constructor(
private val matrixClient: MatrixClient,
private val encryptionService: EncryptionService,
Copy link
Contributor

Choose a reason for hiding this comment

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

Not related to this PR, but could we change the EncryptionService to something else? Maybe MatrixEncryptionService?

@bmarty bmarty mentioned this pull request Oct 31, 2023
14 tasks
Copy link
Contributor

@ganfra ganfra left a comment

Choose a reason for hiding this comment

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

Some remarks, as I'd like to avoid runBlocking...
If we are short on time, let's iterate later.

Copy link

codecov bot commented Oct 31, 2023

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (ba00418) 63.43% compared to head (c52a50d) 63.43%.

❗ Current head c52a50d differs from pull request most recent head 6143ea8. Consider uploading reports for the commit 6143ea8 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1716      +/-   ##
===========================================
- Coverage    63.43%   63.43%   -0.01%     
===========================================
  Files         1282     1279       -3     
  Lines        33247    33184      -63     
  Branches      6883     6865      -18     
===========================================
- Hits         21090    21050      -40     
+ Misses        8975     8959      -16     
+ Partials      3182     3175       -7     
Files Coverage Δ
...ndroid/features/roomlist/impl/RoomListPresenter.kt 87.32% <100.00%> (+0.55%) ⬆️
.../android/libraries/featureflag/api/FeatureFlags.kt 100.00% <100.00%> (ø)
.../preferences/impl/root/PreferencesRootPresenter.kt 84.78% <66.66%> (-1.59%) ⬇️
...ries/featureflag/impl/StaticFeatureFlagProvider.kt 0.00% <0.00%> (ø)
...ibraries/indicator/impl/DefaultIndicatorService.kt 73.91% <75.00%> (+3.91%) ⬆️
...nt/android/features/logout/impl/LogoutPresenter.kt 86.48% <71.42%> (-4.14%) ⬇️

... and 17 files with indirect coverage changes

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

@bmarty bmarty force-pushed the feature/bma/secureBackupFeatureFlag branch from c52a50d to d09d95b Compare October 31, 2023 20:55
@bmarty bmarty added the Z-NextRelease For issues and PRs which should be included in the NextRelease. label Oct 31, 2023
Copy link
Contributor

@jmartinesp jmartinesp left a comment

Choose a reason for hiding this comment

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

LGTM, since I think @ganfra isn't around at the moment and I think everything important is fixed. We can iterate later.

@bmarty bmarty merged commit 93186f0 into develop Oct 31, 2023
12 of 13 checks passed
@bmarty bmarty deleted the feature/bma/secureBackupFeatureFlag branch October 31, 2023 21:52
Copy link

sonarcloud bot commented Oct 31, 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 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Z-NextRelease For issues and PRs which should be included in the NextRelease.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants