Skip to content

Commit

Permalink
Issue #162: Added sharing of ProofMode public key.
Browse files Browse the repository at this point in the history
  • Loading branch information
tladesignz committed Apr 14, 2023
1 parent 70089d6 commit ae2f50d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Save/Space/MiscSettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class MiscSettingsViewController: FormViewController {

private static let campaignId = "upload_fails"

private static let proofModePublicKeyFile = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
.first? .appendingPathComponent("pub.asc")

private var consent: CampaignConsent? {
CleanInsights.shared.consent(forCampaign: Self.campaignId)
}
Expand Down Expand Up @@ -48,6 +51,21 @@ class MiscSettingsViewController: FormViewController {
Settings.proofMode = row.value ?? false
}

+++ ButtonRow {
$0.title = NSLocalizedString("Share ProofMode Public Key", comment: "")
$0.disabled = .init(booleanLiteral: !(Self.proofModePublicKeyFile?.exists ?? false))
}
.onCellSelection({ [weak self] cell, row in
guard let file = Self.proofModePublicKeyFile, file.exists else {
return
}

let vc = UIActivityViewController(activityItems: [file], applicationActivities: nil)
vc.popoverPresentationController?.sourceView = cell

self?.present(vc, animated: true)
})

+++ uploadFailsRow
.cellUpdate { [weak self] cell, row in
let end = self?.consent?.end
Expand Down
3 changes: 3 additions & 0 deletions Shared/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,9 @@
/* MainViewController */
"Settings" = "Einstellungen";

/* No comment provided by engineer. */
"Share ProofMode Public Key" = "Teile öffentlichen ProofMode Schlüssel";

/* Placeholders will be replaced by newline - ClaimViewController */
"Share%1$@Archive%1$@Verify%1$@Encrypt" = "Teilen%1$@Archivieren%1$@Verifizieren%1$@Verschlüsseln";

Expand Down
3 changes: 3 additions & 0 deletions Shared/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,9 @@
/* MainViewController */
"Settings" = "Settings";

/* No comment provided by engineer. */
"Share ProofMode Public Key" = "Share ProofMode Public Key";

/* Placeholders will be replaced by newline - ClaimViewController */
"Share%1$@Archive%1$@Verify%1$@Encrypt" = "Share%1$@Archive%1$@Verify%1$@Encrypt";

Expand Down

0 comments on commit ae2f50d

Please sign in to comment.