Commit da4a18d4 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk Committed by Andreas Traczyk

fix: UI access from backgroung warning

This patch fixes a warning about modifying autolayout engine from
a background thread.

Change-Id: I8343ddfc9814d9d620f824525acce3aad7d5c5aa
Reviewed-by: Andreas Traczyk's avatarAndreas Traczyk <andreas.traczyk@savoirfairelinux.com>
parent f949e20b
...@@ -75,7 +75,9 @@ class CreateAccountViewController: UIViewController, StoryboardBased, ViewModelB ...@@ -75,7 +75,9 @@ class CreateAccountViewController: UIViewController, StoryboardBased, ViewModelB
private func bindViewModelToView() { private func bindViewModelToView() {
// handle username registration visibility // handle username registration visibility
self.viewModel.registerUsername.asObservable().subscribe(onNext: { [unowned self] (isOn) in self.viewModel.registerUsername.asObservable()
.observeOn(MainScheduler.instance)
.subscribe(onNext: { [unowned self] (isOn) in
UIView.animate(withDuration: 0.3, animations: { UIView.animate(withDuration: 0.3, animations: {
if isOn { if isOn {
self.registerUsernameHeightConstraint.constant = self.registerUsernameHeightConstraintConstant self.registerUsernameHeightConstraint.constant = self.registerUsernameHeightConstraintConstant
...@@ -109,7 +111,9 @@ class CreateAccountViewController: UIViewController, StoryboardBased, ViewModelB ...@@ -109,7 +111,9 @@ class CreateAccountViewController: UIViewController, StoryboardBased, ViewModelB
.bind(to: self.registerUsernameErrorLabel.rx.text).disposed(by: self.disposeBag) .bind(to: self.registerUsernameErrorLabel.rx.text).disposed(by: self.disposeBag)
// handle creation state // handle creation state
self.viewModel.createState.subscribe(onNext: { [weak self] (state) in self.viewModel.createState
.observeOn(MainScheduler.instance)
.subscribe(onNext: { [weak self] (state) in
switch state { switch state {
case .started: case .started:
self?.showAccountCreationInProgress() self?.showAccountCreationInProgress()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment