From 4bbfee5e8f9032e18ed567b9fa0bcdb4c3d23905 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Thu, 31 Jan 2019 17:03:40 -0800 Subject: [PATCH] Seeds Harmony database on launch if not yet seeded --- Delta/Launch/LaunchViewController.swift | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Delta/Launch/LaunchViewController.swift b/Delta/Launch/LaunchViewController.swift index cf66c3f..8ee0936 100644 --- a/Delta/Launch/LaunchViewController.swift +++ b/Delta/Launch/LaunchViewController.swift @@ -61,7 +61,17 @@ extension LaunchViewController } } - return [isDatabaseManagerStarted, isSyncingManagerStarted] + let isRecordControllerSeeded = RSTLaunchCondition(condition: { SyncManager.shared.syncCoordinator.recordController.isSeeded }) { (completionHandler) in + SyncManager.shared.syncCoordinator.recordController.seedFromPersistentContainer() { (result) in + switch result + { + case .success: completionHandler(nil) + case .failure(let error): completionHandler(error.error) + } + } + } + + return [isDatabaseManagerStarted, isSyncingManagerStarted, isRecordControllerSeeded] } override func handleLaunchError(_ error: Error)