Skip to content
This repository has been archived by the owner on Aug 4, 2019. It is now read-only.

Commit

Permalink
Merge branch 'dvor/trying-to-fix-crash-on-startup'
Browse files Browse the repository at this point in the history
  • Loading branch information
dvor committed Oct 2, 2016
2 parents e66b70b + b4a573a commit d8f0c5c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
26 changes: 19 additions & 7 deletions Antidote/AppCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,31 @@ private extension AppCoordinator {
successBlock(manager)
}
else {
let profileName = UserDefaultsManager().lastActiveProfile!
let deleteActiveAccountAndRetry: Void -> Void = { [unowned self] in
KeychainManager().deleteActiveAccountData()
self.recreateActiveCoordinator(options: options,
manager: manager,
skipAuthorizationChallenge: skipAuthorizationChallenge)
}

guard let profileName = UserDefaultsManager().lastActiveProfile else {
deleteActiveAccountAndRetry()
return
}

let path = ProfileManager().pathForProfileWithName(profileName)
let configuration = OCTManagerConfiguration.configurationWithBaseDirectory(path)!

guard let configuration = OCTManagerConfiguration.configurationWithBaseDirectory(path) else {
deleteActiveAccountAndRetry()
return
}

OCTManager.managerWithConfiguration(configuration,
encryptPassword: password,
successBlock: successBlock,
failureBlock: { [unowned self] _ in
failureBlock: { _ in
log("Cannot create tox with configuration \(configuration)")
KeychainManager().deleteActiveAccountData()
self.recreateActiveCoordinator(options: options,
manager: manager,
skipAuthorizationChallenge: skipAuthorizationChallenge)
deleteActiveAccountAndRetry()
})
}
}
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased][unreleased]
### Fixed
- Crash on startup that happened on app reinstall.

## [1.0.0-rc.2] - 2016-10-02
### Added
Expand Down

0 comments on commit d8f0c5c

Please sign in to comment.