From 5dfb7d4ba4cb12c175f602760e5468bfdf6fe106 Mon Sep 17 00:00:00 2001 From: relikd Date: Fri, 19 Jun 2020 15:40:34 +0200 Subject: [PATCH] Remove safeSetRange --- main/Data Source/SyncUpdate.swift | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/main/Data Source/SyncUpdate.swift b/main/Data Source/SyncUpdate.swift index 5579684..2bfcc6c 100644 --- a/main/Data Source/SyncUpdate.swift +++ b/main/Data Source/SyncUpdate.swift @@ -123,16 +123,6 @@ class SyncUpdate { range = rows(tsMin, tsMax) } - /// Helper to always set range in case there was none before. Otherwise only update `start`. - private func safeSetRange(start r: SQLiteRowRange) { - range == nil ? (range = r) : (range!.start = r.start) - } - - /// Helper to always set range in case there was none before. Otherwise only update `end`. - private func safeSetRange(end r: SQLiteRowRange) { - range == nil ? (range = r) : (range!.end = r.end) - } - /// Update internal `tsEarliest`, then post `NotifySyncInsert` or `NotifySyncRemove` notification with row ids. /// - Warning: Always call from a background thread! private func set(newEarliest: Timestamp?) { @@ -179,7 +169,8 @@ class SyncUpdate { /// - Warning: Always call from a background thread! private func notify(insert r: SQLiteRowRange, front: Bool) { - front ? safeSetRange(start: r) : safeSetRange(end: r) + if range == nil { range = r } + else { front ? (range!.start = r.start) : (range!.end = r.end) } notifyObservers { $0.syncUpdate(self, insert: r) } }