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

[WIP] MX3PidAddManager: New class to handle add 3pids to HS and to bind to IS #726

Merged
merged 14 commits into from
Oct 4, 2019

Conversation

manuroe
Copy link
Contributor

@manuroe manuroe commented Oct 2, 2019

This manager handles all HS flags. It adds, binds, unbinds 3pids, accordingly.
Apps should use it instead of MXK3Pid.

Note: All possible IS configurations are already managed by the MXIdentityService this manager uses.

Part of element-hq/element-ios#2713:

  • Detect whether HS supports MSC2290 (look for unstable flag m.separate_add_and_bind)
  • Add SDK support for POST /_matrix/client/r0/account/3pid/bind, POST /_matrix/client/r0/account/3pid/unbind, and POST /_matrix/client/r0/account/3pid/add
  • Implement new 3PID add flow for MSC2290 servers
  • Implement new 3PID bind flow for MSC2290 servers
  • Use /unstable prefix for APIs

@@ -1365,6 +1368,27 @@ public extension MXRestClient {
@nonobjc @discardableResult func addThirdPartyIdentifier(_ sid: String, clientSecret: String, bind: Bool, completion: @escaping (_ response: MXResponse<Void>) -> Void) -> MXHTTPOperation {
Copy link
Contributor

Choose a reason for hiding this comment

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

We can add depreciation annotation on method like this:
@available(*, deprecated, message: "use addThirdPartyIdentifierOnly instead")

} failure:failure];
}

- (MXHTTPOperation *)doesServerSupportSeparateAddAndBind:(void (^)(bool doesServerSupportSeparateAddAndBind))success
Copy link
Contributor

Choose a reason for hiding this comment

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

Prefer use BOOL instead bool for doesServerSupportSeparateAddAndBind.


#pragma mark - Bind Email

- (MX3PidAddSession*)startIdentityServerEmailSessionWithEmail:(NSString*)email
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe rename startIdentityServerBindEmailSessionWithEmail to add more context like startAddEmailSessionWithEmail above.

return threePidAddSession;
}

- (void)tryFinaliseIdentityServerEmailSession:(MX3PidAddSession*)threePidAddSession
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe rename tryFinaliseIdentityServerBindEmailSession to add more context like tryFinaliseAddEmailSession` above.


threePidAddSession.httpOperation = nil;

NSLog(@"[MX3PidAddManager] tryFinaliseIdentityServer3PidSessionWithNewHomeserver: DONE: threePid: %@", threePidAddSession);
Copy link
Contributor

Choose a reason for hiding this comment

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

startIdentityServer3PidSession instead of tryFinaliseIdentityServer3PidSessionWithNewHomeserver.

@manuroe manuroe merged commit d7fa394 into privacy Oct 4, 2019
@manuroe manuroe deleted the riot_2718 branch October 4, 2019 09:46
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