-
Notifications
You must be signed in to change notification settings - Fork 214
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
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
1d3ee3e
MX3PidAddManager: New class to handle add 3pids to HS and to bind to IS.
manuroe f05681b
MX3PidAddManager: Add bind to IS (pre-MSC2290) and swift API
manuroe c7d5be8
MX3PidAddManager: Add cancel3PidAddSession
manuroe 204f9df
MX3PidAddManager: Add unbind
manuroe 935a44b
MX3PidAddManager: Some factorisation to be ready for MSC2290
manuroe 668dced
MX3PidAddManager: Use bind/undbind api from MSC2290.
manuroe 02c8e19
MX3PidAddManager: Use add api from MSC2290.
manuroe b8a1ac9
MX3PidAddManager: swift API and CHANGES
manuroe 1478f84
MX3PidAddManager: Do not validate 3pid for unbind with MSC2290
manuroe 0220c30
MX3PidAddManager: Fix msisdn bind with MSC2290
manuroe 006dd5a
MX3PidAddManager: Add links to sequence diagrams at https://gist.gith…
manuroe d8f39bd
IS: BF: Make it work with old IS (no terms, no v2 access token)
manuroe 84c14c8
MX3PidAddManager: If the IS does not support v2, use legacy APIs
manuroe eb9b39e
MX3PidAddManager: Fix Steve's comment
manuroe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
MatrixSDK/Contrib/Swift/ThreePidAdd/MX3PidAddManager.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
Copyright 2019 The Matrix.org Foundation C.I.C | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
import Foundation | ||
|
||
public extension MX3PidAddManager { | ||
|
||
// MARK: - Setup | ||
@nonobjc convenience init(session: MXSession) { | ||
self.init(__matrixSession: session) | ||
} | ||
|
||
@nonobjc func cancel(session: MX3PidAddSession) { | ||
__cancel3PidAddSession(session) | ||
} | ||
|
||
// MARK: - Email | ||
@nonobjc @discardableResult func startAddEmailSession(_ email: String, nextLink: String?, completion: @escaping (_ response: MXResponse<Void>) -> Void) -> MX3PidAddSession { | ||
return __startAddEmailSession(withEmail: email, nextLink: nextLink, success: currySuccess(completion), failure: curryFailure(completion)) | ||
} | ||
|
||
@nonobjc func tryFinaliseAddEmailSession(_ session: MX3PidAddSession, completion: @escaping (_ response: MXResponse<Void>) -> Void) -> Void { | ||
return __tryFinaliseAddEmailSession(session, success: currySuccess(completion), failure: curryFailure(completion)) | ||
} | ||
|
||
|
||
// MARK: - Add MSISDN | ||
@nonobjc @discardableResult func startAddPhoneNumberSession(_ phoneNumber: String, countryCode: String?, completion: @escaping (_ response: MXResponse<Void>) -> Void) -> MX3PidAddSession { | ||
return __startAddPhoneNumberSession(withPhoneNumber: phoneNumber, countryCode: countryCode, success: currySuccess(completion), failure: curryFailure(completion)) | ||
} | ||
|
||
@nonobjc func finaliseAddPhoneNumberSession(_ session: MX3PidAddSession, token: String, completion: @escaping (_ response: MXResponse<Void>) -> Void) -> Void { | ||
return __finaliseAddPhoneNumber(session, withToken: token, success: currySuccess(completion), failure: curryFailure(completion)) | ||
} | ||
|
||
|
||
// MARK: - Bind Email | ||
@nonobjc @discardableResult func startIdentityServerSession(withEmail email: String, bind: Bool, completion: @escaping (_ response: MXResponse<Bool>) -> Void) -> MX3PidAddSession { | ||
return __startIdentityServerEmailSession(withEmail: email, bind: bind, success: currySuccess(completion), failure: curryFailure(completion)) | ||
} | ||
|
||
@nonobjc func tryFinaliseIdentityServerEmailSession(_ session: MX3PidAddSession, completion: @escaping (_ response: MXResponse<Void>) -> Void) -> Void { | ||
return __tryFinaliseIdentityServerEmailSession(session, success: currySuccess(completion), failure: curryFailure(completion)) | ||
} | ||
|
||
// MARK: - Bind phone number | ||
@nonobjc @discardableResult func startIdentityServerSession(withPhoneNumber phoneNumber: String, countryCode: String?, bind: Bool, completion: @escaping (_ response: MXResponse<Bool>) -> Void) -> MX3PidAddSession { | ||
return __startIdentityServerPhoneNumberSession(withPhoneNumber: phoneNumber, countryCode: countryCode, bind: bind, success: currySuccess(completion), failure: curryFailure(completion)) | ||
} | ||
|
||
@nonobjc func finaliseIdentityServerPhoneNumberSession(_ session: MX3PidAddSession, token: String, completion: @escaping (_ response: MXResponse<Void>) -> Void) -> Void { | ||
return __finaliseIdentityServerPhoneNumber(session, withToken: token, success: currySuccess(completion), failure: curryFailure(completion)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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")