-
Notifications
You must be signed in to change notification settings - Fork 15
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
feat: limited v7 API integration with individual to team migration endpoint - WPB-11961 #2151
base: feat/individual-to-team-migration-ui
Are you sure you want to change the base?
feat: limited v7 API integration with individual to team migration endpoint - WPB-11961 #2151
Conversation
Test Results0 tests 0 ✅ 0s ⏱️ Results for commit d85246c. ♻️ This comment has been updated with latest results. |
WireAPI/Sources/WireAPI/APIs/AccountsAPI/Responses/UpgradeToTeamResponseEnvelopeV7.swift
Outdated
Show resolved
Hide resolved
WireAPI/Sources/WireAPI/Models/Accounts/UpgradeAccountEnvelope.swift
Outdated
Show resolved
Hide resolved
|
||
public struct IndividualToTeamMigrationUseCase { | ||
private let accountsAPI: AccountsAPI | ||
private let logger: WireLogger = WireLogger(tag: "individual-to-team-migration") |
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.
prefer a static one like WireLogger.individualToTeam
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.
?
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.
meaning instead of using the string, declare one in WireLogger+Instances.swift
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.
But then the WireLogger has manual references to all the other modules. Isn't that... weird?
WireDomain/Sources/WireDomain/UseCases/IndividualToTeamMigrationUseCaseImplementation.swift
Outdated
Show resolved
Hide resolved
@@ -42,6 +68,12 @@ open class AuthenticatedSessionFactory { | |||
reachability: Reachability, | |||
minTLSVersion: String? | |||
) { | |||
self.apiService = APIService( | |||
backendURL: environment.backendURL, | |||
// TODO: Use the authentication storage from https://github.com/wireapp/wire-ios/pull/2084 |
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.
👍
import WireDataModel | ||
|
||
|
||
final class InMemoryAuthenticationStorage: AuthenticationStorage { |
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.
I understand this is temporary too until renew access token PR is merged, right?
otherwise I would suggest to move to own file
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.
There already is an InMemoryAuthenticationStorage
so feel free to make it public and use it here.
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.
It's exactly the same code, just copy-pasted.
And it is temporary until the renew access token PR is merged.
@johnxnguyen Do we want the InMemoryAuthentication
to be and remain public?
WireAPI/Sources/WireAPI/APIs/AccountsAPI/Responses/UpgradeToTeamResponseEnvelopeV7.swift
Outdated
Show resolved
Hide resolved
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.
Looks good, I'll wait for the conversations to be resolved before approving.
WireAPI/Sources/WireAPI/APIs/AccountsAPI/AccountsAPIBuilder.swift
Outdated
Show resolved
Hide resolved
WireAPI/Sources/WireAPI/APIs/AccountsAPI/AccountsAPIError.swift
Outdated
Show resolved
Hide resolved
WireAPI/Sources/WireAPI/Models/Accounts/UpgradeAccountEnvelope.swift
Outdated
Show resolved
Hide resolved
WireAPI/Sources/WireAPI/Models/Accounts/UpgradeAccountEnvelope.swift
Outdated
Show resolved
Hide resolved
WireAPI/Sources/WireAPI/Models/Accounts/UpgradeAccountEnvelope.swift
Outdated
Show resolved
Hide resolved
import WireDataModel | ||
|
||
|
||
final class InMemoryAuthenticationStorage: AuthenticationStorage { |
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.
There already is an InMemoryAuthenticationStorage
so feel free to make it public and use it here.
12300f5
to
7ebdca4
Compare
aa88e45
to
d85246c
Compare
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.
Nice work! Feel free to ignore comments which I prefix with optional
.
/// An error occurred while encoding the request body. | ||
case invalidRequestBody | ||
|
||
/// A request url is not invalid. |
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.
/// A request url is not invalid. | |
/// A request url is not valid. |
override func upgradeToTeam(teamName: String) async throws -> UpgradedAccountTeam { | ||
let components = URLComponents(string: "upgrade-personal-to-team") | ||
|
||
guard let url = components?.url else { |
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.
Optional: Personally I might force unwrap this and ensure it is tested
let name: String | ||
|
||
init( | ||
currency: String? = nil, |
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.
Out of interest, do you expect this to be called with default values?
private var accessToken: WireAPI.AccessToken? | ||
private var cookieData: Data? | ||
|
||
func storeAccessToken(_ accessToken: WireAPI.AccessToken) { |
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.
Out of interest, are these custom setters / getters to implement AuthenticationStorage
?
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.
Looks good, I've replied to my comments so you can finish pending points
Issue
Please describe the issue.
A barebones v7 API integration, limited to adding the individual to team migration endpoint, using
APIService
Checklist
[WPB-XXX]
.UI accessibility checklist
If your PR includes UI changes, please utilize this checklist: