Skip to content

Commit

Permalink
chore: apply QR profile feature flag to deeplink processing (WPB-1192…
Browse files Browse the repository at this point in the history
…1) (#3581)
  • Loading branch information
yamilmedina authored Nov 5, 2024
1 parent c07f69f commit ccb1b8b
Showing 1 changed file with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import com.wire.android.feature.AccountSwitchUseCase
import com.wire.android.feature.SwitchAccountParam
import com.wire.android.feature.SwitchAccountResult
import com.wire.android.util.EMPTY
import com.wire.android.util.debug.FeatureVisibilityFlags
import com.wire.kalium.logic.CoreLogic
import com.wire.kalium.logic.data.auth.AccountInfo
import com.wire.kalium.logic.data.id.ConversationId
Expand Down Expand Up @@ -147,22 +148,35 @@ class DeepLinkProcessor @Inject constructor(
}
}

/**
* TODO(Rewrite)
* Wait for definitions of Deeplink processing RFC (https://wearezeta.atlassian.net/wiki/x/AgAsWg)
*
* REF: WPB-10532
*/
private fun getConnectingUserProfile(uri: Uri, switchedAccount: Boolean, accountInfo: AccountInfo.Valid): DeepLinkResult {
return uri.lastPathSegment?.toDefaultQualifiedId(accountInfo.userId.domain)?.let {
DeepLinkResult.OpenOtherUserProfile(it, switchedAccount)
} ?: DeepLinkResult.Unknown
return if (FeatureVisibilityFlags.QRCodeEnabled) {
// TODO: Wait for definitions of Deeplink processing RFC (https://wearezeta.atlassian.net/wiki/x/AgAsWg)
// TODO: define format of deeplink wire://user/domain/user-id
uri.lastPathSegment?.toDefaultQualifiedId(accountInfo.userId.domain)?.let {
DeepLinkResult.OpenOtherUserProfile(it, switchedAccount)
}
DeepLinkResult.Unknown
} else {
DeepLinkResult.Unknown
}
}

/**
* Currently the DeepLinks sent from web are not qualified.
* This is way to default to the current account domain as a best effort.
* TODO(Rewrite)
* Wait for definitions of Deeplink processing RFC (https://wearezeta.atlassian.net/wiki/x/AgAsWg)
* i.e. Define format of deeplink wire://user/domain/user-id
*
* TODO: replace and remove this with String.toQualifiedID() when web sends qualified id.
* REF: WPB-10532
*/
private fun String.toDefaultQualifiedId(currentUserDomain: String?): QualifiedID {
val domain = currentUserDomain ?: "wire.com"
// This lowercase is important, since web/iOS is sending/handling this as uppercase.
// TODO. This lowercase is important, since web/iOS is sending/handling this as uppercase!!
return QualifiedID(this.lowercase(), domain)
}

Expand Down

0 comments on commit ccb1b8b

Please sign in to comment.