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

MOB-478 : update copy params for new compliance status strings #173

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,42 +24,38 @@ public final class dydxRestrictionsWorker: BaseWorker {
}
.store(in: &subscriptions)

// used in protocol 4.0
AbacusStateManager.shared.state.complianceStatus
.sink { complianceStatus in
Self.handle(complianceStatus: complianceStatus)
// used in protocol 5.0
AbacusStateManager.shared.state.compliance
.sink { compliance in
Self.handle(compliance: compliance)
}
.store(in: &subscriptions)
}

public static func handle(complianceStatus: ComplianceStatus) {
public static func handle(compliance: Compliance) {
let title: String?
let body: String?
switch complianceStatus {
switch compliance.status {
case .compliant:
return
case .firstStrike, .firstStrikeCloseOnly, .closeOnly:
// TODO: add DATE & EMAIL
// [MOB-478 : update copy params for new compliance status strings](https://linear.app/dydx/issue/MOB-478/update-copy-params-for-new-compliance-status-strings)
title = DataLocalizer.shared?.localize(
path: "APP.COMPLIANCE.CLOSE_ONLY_TITLE",
params: nil) ?? ""
body = DataLocalizer.shared?.localize(
path: "APP.COMPLIANCE.CLOSE_ONLY_BODY",
params: [
"DATE": "--",
"EMAIL": "--"
"DATE": compliance.expiresAt ?? "--",
"EMAIL": AbacusStateManager.shared.environment?.links?.complianceSupportEmail ?? "--"
]) ?? ""
case .blocked:
// TODO: add DATE & EMAIL
// [MOB-478 : update copy params for new compliance status strings](https://linear.app/dydx/issue/MOB-478/update-copy-params-for-new-compliance-status-strings)
title = DataLocalizer.shared?.localize(
path: "APP.COMPLIANCE.PERMANENTLY_BLOCKED_TITLE",
params: nil) ?? ""
body = DataLocalizer.shared?.localize(
path: "APP.COMPLIANCE.PERMANENTLY_BLOCKED_BODY",
params: [
"EMAIL": "--"
"EMAIL": AbacusStateManager.shared.environment?.links?.complianceSupportEmail ?? "--"
]) ?? ""
default:
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ public final class AbacusState {
}

// protocol v5.0 and up
public var complianceStatus: AnyPublisher<ComplianceStatus, Never> {
public var compliance: AnyPublisher<Compliance, Never> {
statePublisher
.compactMap { $0?.compliance?.status }
.compactMap { $0?.compliance }
.removeDuplicates()
.share()
.eraseToAnyPublisher()
Expand Down
Loading