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

Map DELETE account data (PSG-647) #1651

Merged
merged 11 commits into from
Dec 13, 2022
Merged

Conversation

alfogrillo
Copy link
Contributor

Description

This PR add a new endpoint to delete user's account data.
More context here (MSC3391).

@alfogrillo alfogrillo requested review from a team and Anderas and removed request for a team December 7, 2022 10:33
@codecov
Copy link

codecov bot commented Dec 7, 2022

Codecov Report

Base: 25.32% // Head: 25.31% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (bbc75c6) compared to base (d72670b).
Patch coverage: 4.91% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1651      +/-   ##
===========================================
- Coverage    25.32%   25.31%   -0.01%     
===========================================
  Files          587      587              
  Lines        92813    92866      +53     
  Branches     40258    40273      +15     
===========================================
+ Hits         23505    23510       +5     
- Misses       68526    68576      +50     
+ Partials       782      780       -2     
Impacted Files Coverage Δ
MatrixSDK/Data/MXAccountData.m 51.66% <0.00%> (-2.72%) ⬇️
MatrixSDK/MXRestClient.m 27.42% <0.00%> (-0.10%) ⬇️
MatrixSDK/MXSession.m 39.50% <0.00%> (-0.13%) ⬇️
MatrixSDKTests/MXAccountDataTests.m 0.00% <0.00%> (ø)
...SDKTests/MXClientInformationServiceUnitTests.swift 0.00% <0.00%> (ø)
MatrixSDKTests/MXSessionTests.m 0.00% <0.00%> (ø)
MatrixSDKTests/Mocks/MXRestClientStub.m 0.00% <0.00%> (ø)
...ClientInformation/MXClientInformationService.swift 31.25% <75.00%> (-1.06%) ⬇️
...xSDK/Crypto/Algorithms/Megolm/MXMegolmEncryption.m 89.36% <0.00%> (-2.30%) ⬇️
...SDK/Crypto/Verification/MXKeyVerificationManager.m 53.46% <0.00%> (-0.08%) ⬇️
... and 5 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@Anderas Anderas 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 incl the added tests. Just a small comment regarding NS_REFINED_FOR_SWIFT.

Unrelatedly, will the application handle recieving {} as account data in sync gracefully? This actually has to be backwards compatible as well, if older clients start recieving this type of response. Or is this what the clients have been effectively doing already?

/**
Delete the account data with the a given type.

For internal use only.
Copy link
Contributor

Choose a reason for hiding this comment

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

If for internal use only, is there another API that a user of the SDK can call, see the alternatives we suggest in updateDataWithType etc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, deleted the new API here -> fe60354

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I just meant the comments itself, looking at the other APIs that mention "For internal use only", they suggest what alternatives to use instead. Having the deleteAccount is probably useful. I think this is a legacy problem, where we have to add "internal" API to a public header file that anyone can call, so we limit the use via the comments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I misunderstood your comment.
Reverted the original implementation and updated the comment here -> 4f9a088

*/
- (MXHTTPOperation*)deleteAccountDataWithType:(NSString*)type
success:(void (^)(void))success
failure:(void (^)(NSError *error))failure NS_REFINED_FOR_SWIFT;
Copy link
Contributor

Choose a reason for hiding this comment

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

If setting the NS_REFINED_FOR_SWIFT macro, you should set the refined swift variant in MXRestClient.swift. Alternatively you could just remove the macro.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for spotting it!
I think I don't need it actually.
Deleted here -> 9582483

@alfogrillo
Copy link
Contributor Author

Unrelatedly, will the application handle recieving {} as account data in sync gracefully? This actually has to be backwards compatible as well, if older clients start recieving this type of response. Or is this what the clients have been effectively doing already?

Yeah, old clients will store locally {}.
A new PR will fix that for new clients. ;-)

@alfogrillo alfogrillo merged commit 3ca0d58 into develop Dec 13, 2022
@alfogrillo alfogrillo deleted the alfogrillo/delete_account_data branch December 13, 2022 13:11
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.

2 participants