TF-3278 Handle open app via deep link at MailboxDashboard screen
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
PODS:
|
||||
- app_links (0.0.2):
|
||||
- Flutter
|
||||
- app_settings (5.1.1):
|
||||
- Flutter
|
||||
- AppAuth (1.7.4):
|
||||
@@ -204,6 +206,7 @@ PODS:
|
||||
- Flutter
|
||||
|
||||
DEPENDENCIES:
|
||||
- app_links (from `.symlinks/plugins/app_links/ios`)
|
||||
- app_settings (from `.symlinks/plugins/app_settings/ios`)
|
||||
- better_open_file (from `.symlinks/plugins/better_open_file/ios`)
|
||||
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
|
||||
@@ -264,6 +267,8 @@ SPEC REPOS:
|
||||
- UniversalDetector2
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
app_links:
|
||||
:path: ".symlinks/plugins/app_links/ios"
|
||||
app_settings:
|
||||
:path: ".symlinks/plugins/app_settings/ios"
|
||||
better_open_file:
|
||||
@@ -334,6 +339,7 @@ EXTERNAL SOURCES:
|
||||
:path: ".symlinks/plugins/workmanager/ios"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
app_links: e7a6750a915a9e161c58d91bc610e8cd1d4d0ad0
|
||||
app_settings: 017320c6a680cdc94c799949d95b84cb69389ebc
|
||||
AppAuth: 182c5b88630569df5acb672720534756c29b3358
|
||||
better_open_file: 03cf320415d4d3f46b6e00adc4a567d76c1a399d
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
<array>
|
||||
<string>ShareMedia-$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<string>teammail.mobile</string>
|
||||
<string>twakemail.mobile</string>
|
||||
<string>mailto</string>
|
||||
</array>
|
||||
</dict>
|
||||
|
||||
@@ -24,6 +24,7 @@ class JmapClient {
|
||||
basicAuth: String?,
|
||||
tokenEndpointUrl: String?,
|
||||
oidcScopes: [String]?,
|
||||
isTWP: Bool?,
|
||||
onComplete: @escaping ([Email], [Error]) -> Void
|
||||
) {
|
||||
if (authenticationType == AuthenticationType.basic) {
|
||||
@@ -42,7 +43,8 @@ class JmapClient {
|
||||
tokenRefreshManager = TokenRefreshManager(
|
||||
refreshToken: tokenOidc?.refreshToken ?? "",
|
||||
tokenEndpoint: tokenEndpointUrl ?? "",
|
||||
scopes: oidcScopes
|
||||
scopes: oidcScopes,
|
||||
isTWP: isTWP
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ class TokenRefreshManager {
|
||||
private let MOBIE_CLIENT_ID = "teammail-mobile"
|
||||
private let MOBIE_REDIRECT_URL = "teammail.mobile://oauthredirect"
|
||||
private let OIDC_SCOPES = ["openid", "profile", "email", "offline_access"]
|
||||
private let TWP_MOBIE_REDIRECT_URL = "twakemail.mobile://redirect"
|
||||
|
||||
private let GRANT_TYPE = "grant_type"
|
||||
private let REFRESH_TOKEN = "refresh_token"
|
||||
@@ -15,11 +16,13 @@ class TokenRefreshManager {
|
||||
let refreshToken: String
|
||||
let tokenEndpoint: String
|
||||
let scopes: [String]?
|
||||
let isTWP: Bool?
|
||||
|
||||
init(refreshToken: String, tokenEndpoint: String, scopes: [String]?) {
|
||||
init(refreshToken: String, tokenEndpoint: String, scopes: [String]?, isTWP: Bool?) {
|
||||
self.refreshToken = refreshToken
|
||||
self.tokenEndpoint = tokenEndpoint
|
||||
self.scopes = scopes
|
||||
self.isTWP = isTWP
|
||||
}
|
||||
|
||||
private func getScopes() -> String {
|
||||
@@ -28,6 +31,14 @@ class TokenRefreshManager {
|
||||
}
|
||||
return OIDC_SCOPES.joined(separator: " ")
|
||||
}
|
||||
|
||||
private func getRedirectUrl() -> String {
|
||||
if (isTWP == true) {
|
||||
return TWP_MOBIE_REDIRECT_URL
|
||||
} else {
|
||||
return MOBIE_REDIRECT_URL
|
||||
}
|
||||
}
|
||||
|
||||
func handleRefreshAccessToken(
|
||||
onSuccess: @escaping (TokenResponse) -> Void,
|
||||
@@ -41,7 +52,7 @@ class TokenRefreshManager {
|
||||
let params = [
|
||||
CLIENT_ID: MOBIE_CLIENT_ID,
|
||||
GRANT_TYPE: REFRESH_TOKEN,
|
||||
REDIRECT_URI: MOBIE_REDIRECT_URL,
|
||||
REDIRECT_URI: getRedirectUrl(),
|
||||
REFRESH_TOKEN: refreshToken,
|
||||
SCOPES: getScopes(),
|
||||
]
|
||||
|
||||
@@ -12,6 +12,7 @@ struct KeychainSharingSession: Codable {
|
||||
let tokenEndpoint: String?
|
||||
let oidcScopes: [String]?
|
||||
let mailboxIdsBlockNotification: [String]?
|
||||
let isTWP: Bool?
|
||||
}
|
||||
|
||||
extension KeychainSharingSession {
|
||||
@@ -27,7 +28,8 @@ extension KeychainSharingSession {
|
||||
basicAuth: self.basicAuth,
|
||||
tokenEndpoint: self.tokenEndpoint,
|
||||
oidcScopes: self.oidcScopes,
|
||||
mailboxIdsBlockNotification: self.mailboxIdsBlockNotification
|
||||
mailboxIdsBlockNotification: self.mailboxIdsBlockNotification,
|
||||
isTWP: self.isTWP
|
||||
)
|
||||
}
|
||||
|
||||
@@ -48,7 +50,8 @@ extension KeychainSharingSession {
|
||||
basicAuth: self.basicAuth,
|
||||
tokenEndpoint: self.tokenEndpoint,
|
||||
oidcScopes: self.oidcScopes,
|
||||
mailboxIdsBlockNotification: self.mailboxIdsBlockNotification
|
||||
mailboxIdsBlockNotification: self.mailboxIdsBlockNotification,
|
||||
isTWP: self.isTWP
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ class NotificationService: UNNotificationServiceExtension {
|
||||
basicAuth: keychainSharingSession.basicAuth,
|
||||
tokenEndpointUrl: keychainSharingSession.tokenEndpoint,
|
||||
oidcScopes: keychainSharingSession.oidcScopes,
|
||||
isTWP: keychainSharingSession.isTWP,
|
||||
onComplete: { (emails, errors) in
|
||||
do {
|
||||
if emails.isEmpty {
|
||||
|
||||
Reference in New Issue
Block a user