Fix initial rooms fetch

pull/400/head
Niels Andriesse 3 years ago
parent c20c3386da
commit 4eb7d19b3e

@ -59,6 +59,9 @@ final class OpenGroupSuggestionGrid : UIView, UICollectionViewDataSource, UIColl
spinner.startAnimating()
heightConstraint = set(.height, to: OpenGroupSuggestionGrid.cellHeight)
widthAnchor.constraint(greaterThanOrEqualToConstant: OpenGroupSuggestionGrid.cellHeight).isActive = true
if OpenGroupAPIV2.defaultRoomsPromise == nil {
OpenGroupAPIV2.getDefaultRoomsIfNeeded()
}
let _ = OpenGroupAPIV2.defaultRoomsPromise?.done { [weak self] rooms in
self?.rooms = rooms
}
@ -163,7 +166,7 @@ extension OpenGroupSuggestionGrid {
snContentView.layer.shadowPath = newPath
snContentView.layer.shadowColor = UIColor.black.cgColor
snContentView.layer.shadowOffset = CGSize.zero
snContentView.layer.shadowOpacity = 0.2
snContentView.layer.shadowOpacity = isLightMode ? 0.2 : 0.6
snContentView.layer.shadowRadius = 2
}

@ -400,6 +400,9 @@ public final class OpenGroupAPIV2 : NSObject {
let _ = promise.done(on: DispatchQueue.global(qos: .userInitiated)) { items in
items.forEach { getGroupImage(for: $0.id, on: defaultServer).retainUntilComplete() }
}
promise.catch(on: DispatchQueue.global(qos: .userInitiated)) { _ in
OpenGroupAPIV2.defaultRoomsPromise = nil
}
defaultRoomsPromise = promise
})
}

Loading…
Cancel
Save