Adding: [Suggestion(adding pasteboard to environment)]

This commit is contained in:
Francisco Gindre 2021-12-09 13:34:10 -03:00
parent c2e401b3d4
commit 94fe474053
2 changed files with 3 additions and 2 deletions

View File

@ -12,6 +12,7 @@ import UIKit
struct BackupPhraseEnvironment {
var mainQueue: AnySchedulerOf<DispatchQueue>
var newPhrase: () -> Effect<RecoveryPhrase, AppError>
var pasteboard: UIPasteboard = .general
}
typealias RecoveryPhraseDisplayStore = Store<RecoveryPhraseDisplayState, RecoveryPhraseDisplayAction>
@ -61,7 +62,7 @@ extension RecoveryPhraseDisplayReducer {
.catchToEffect(RecoveryPhraseDisplayAction.phraseResponse)
case .copyToBufferPressed:
guard let phrase = state.phrase?.toString() else { return .none }
UIPasteboard.general.string = phrase
environment.pasteboard.string = phrase
state.showCopyToBufferAlert = true
return .none
case .finishedPressed:

View File

@ -25,7 +25,7 @@ class RecoveryPhraseDisplayReducerTests: XCTestCase {
$0.showCopyToBufferAlert = true
}
XCTAssertEqual(UIPasteboard.general.string, phrase.toString())
XCTAssertEqual(environment.pasteboard.string, phrase.toString())
}
func testNewPhrase() {