Fix reblogs in iPad version
This commit is contained in:
parent
34c80c1f19
commit
e601a564d9
|
@ -1348,7 +1348,7 @@
|
||||||
CODE_SIGN_ENTITLEMENTS = VernissageWidget/VernissageWidgetExtension.entitlements;
|
CODE_SIGN_ENTITLEMENTS = VernissageWidget/VernissageWidgetExtension.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "Apple Development";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 255;
|
CURRENT_PROJECT_VERSION = 256;
|
||||||
DEVELOPMENT_TEAM = B2U9FEKYP8;
|
DEVELOPMENT_TEAM = B2U9FEKYP8;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
INFOPLIST_FILE = VernissageWidget/Info.plist;
|
INFOPLIST_FILE = VernissageWidget/Info.plist;
|
||||||
|
@ -1379,7 +1379,7 @@
|
||||||
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
|
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
|
||||||
CODE_SIGN_ENTITLEMENTS = VernissageWidget/VernissageWidgetExtension.entitlements;
|
CODE_SIGN_ENTITLEMENTS = VernissageWidget/VernissageWidgetExtension.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 255;
|
CURRENT_PROJECT_VERSION = 256;
|
||||||
DEVELOPMENT_TEAM = B2U9FEKYP8;
|
DEVELOPMENT_TEAM = B2U9FEKYP8;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
INFOPLIST_FILE = VernissageWidget/Info.plist;
|
INFOPLIST_FILE = VernissageWidget/Info.plist;
|
||||||
|
@ -1409,7 +1409,7 @@
|
||||||
CODE_SIGN_ENTITLEMENTS = VernissageShare/VernissageShareExtension.entitlements;
|
CODE_SIGN_ENTITLEMENTS = VernissageShare/VernissageShareExtension.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "Apple Development";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 255;
|
CURRENT_PROJECT_VERSION = 256;
|
||||||
DEVELOPMENT_TEAM = B2U9FEKYP8;
|
DEVELOPMENT_TEAM = B2U9FEKYP8;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
INFOPLIST_FILE = VernissageShare/Info.plist;
|
INFOPLIST_FILE = VernissageShare/Info.plist;
|
||||||
|
@ -1438,7 +1438,7 @@
|
||||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = NO;
|
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = NO;
|
||||||
CODE_SIGN_ENTITLEMENTS = VernissageShare/VernissageShareExtension.entitlements;
|
CODE_SIGN_ENTITLEMENTS = VernissageShare/VernissageShareExtension.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 255;
|
CURRENT_PROJECT_VERSION = 256;
|
||||||
DEVELOPMENT_TEAM = B2U9FEKYP8;
|
DEVELOPMENT_TEAM = B2U9FEKYP8;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
INFOPLIST_FILE = VernissageShare/Info.plist;
|
INFOPLIST_FILE = VernissageShare/Info.plist;
|
||||||
|
@ -1592,7 +1592,7 @@
|
||||||
CODE_SIGN_ENTITLEMENTS = Vernissage/Vernissage.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Vernissage/Vernissage.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "Apple Development";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 255;
|
CURRENT_PROJECT_VERSION = 256;
|
||||||
DEVELOPMENT_ASSET_PATHS = "\"Vernissage/Preview Content\"";
|
DEVELOPMENT_ASSET_PATHS = "\"Vernissage/Preview Content\"";
|
||||||
DEVELOPMENT_TEAM = B2U9FEKYP8;
|
DEVELOPMENT_TEAM = B2U9FEKYP8;
|
||||||
ENABLE_PREVIEWS = YES;
|
ENABLE_PREVIEWS = YES;
|
||||||
|
@ -1635,7 +1635,7 @@
|
||||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
CODE_SIGN_ENTITLEMENTS = Vernissage/Vernissage.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Vernissage/Vernissage.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 255;
|
CURRENT_PROJECT_VERSION = 256;
|
||||||
DEVELOPMENT_ASSET_PATHS = "\"Vernissage/Preview Content\"";
|
DEVELOPMENT_ASSET_PATHS = "\"Vernissage/Preview Content\"";
|
||||||
DEVELOPMENT_TEAM = B2U9FEKYP8;
|
DEVELOPMENT_TEAM = B2U9FEKYP8;
|
||||||
ENABLE_PREVIEWS = YES;
|
ENABLE_PREVIEWS = YES;
|
||||||
|
|
|
@ -81,7 +81,7 @@ struct PaginableStatusesView: View {
|
||||||
private func list() -> some View {
|
private func list() -> some View {
|
||||||
ScrollView {
|
ScrollView {
|
||||||
if self.imageColumns > 1 {
|
if self.imageColumns > 1 {
|
||||||
WaterfallGrid($statusViewModels, columns: $imageColumns, hideLoadMore: $allItemsLoaded) { item in
|
WaterfallGrid($statusViewModels, refreshId: Binding.constant(""), columns: $imageColumns, hideLoadMore: $allItemsLoaded) { item in
|
||||||
ImageRowAsync(statusViewModel: item, containerWidth: $containerWidth)
|
ImageRowAsync(statusViewModel: item, containerWidth: $containerWidth)
|
||||||
} onLoadMore: {
|
} onLoadMore: {
|
||||||
do {
|
do {
|
||||||
|
|
|
@ -52,6 +52,7 @@ struct StatusesView: View {
|
||||||
@State private var statusViewModels: [StatusModel] = []
|
@State private var statusViewModels: [StatusModel] = []
|
||||||
@State private var state: ViewState = .loading
|
@State private var state: ViewState = .loading
|
||||||
@State private var lastStatusId: String?
|
@State private var lastStatusId: String?
|
||||||
|
@State private var waterfallId: String = String.randomString(length: 8)
|
||||||
|
|
||||||
// Gallery parameters.
|
// Gallery parameters.
|
||||||
@State private var imageColumns = 3
|
@State private var imageColumns = 3
|
||||||
|
@ -96,7 +97,7 @@ struct StatusesView: View {
|
||||||
private func list() -> some View {
|
private func list() -> some View {
|
||||||
ScrollView {
|
ScrollView {
|
||||||
if self.imageColumns > 1 {
|
if self.imageColumns > 1 {
|
||||||
WaterfallGrid($statusViewModels, columns: $imageColumns, hideLoadMore: $allItemsLoaded) { item in
|
WaterfallGrid($statusViewModels, refreshId: $waterfallId, columns: $imageColumns, hideLoadMore: $allItemsLoaded) { item in
|
||||||
ImageRowAsync(statusViewModel: item, containerWidth: $containerWidth)
|
ImageRowAsync(statusViewModel: item, containerWidth: $containerWidth)
|
||||||
} onLoadMore: {
|
} onLoadMore: {
|
||||||
do {
|
do {
|
||||||
|
@ -142,6 +143,17 @@ struct StatusesView: View {
|
||||||
ErrorService.shared.handle(error, message: "statuses.error.loadingStatusesFailed", showToastr: !Task.isCancelled)
|
ErrorService.shared.handle(error, message: "statuses.error.loadingStatusesFailed", showToastr: !Task.isCancelled)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.onChange(of: self.applicationState.showReboostedStatuses) { _ in
|
||||||
|
if self.listType != .home {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
Task { @MainActor in
|
||||||
|
HapticService.shared.fireHaptic(of: .dataRefresh(intensity: 0.3))
|
||||||
|
try await self.loadTopStatuses()
|
||||||
|
HapticService.shared.fireHaptic(of: .dataRefresh(intensity: 0.7))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func loadData() async {
|
private func loadData() async {
|
||||||
|
@ -228,7 +240,11 @@ struct StatusesView: View {
|
||||||
inPlaceStatuses.append(StatusModel(status: item))
|
inPlaceStatuses.append(StatusModel(status: item))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prefetch images.
|
||||||
|
self.prefetch(statusModels: inPlaceStatuses)
|
||||||
|
|
||||||
// Replace old collection with new one.
|
// Replace old collection with new one.
|
||||||
|
self.waterfallId = String.randomString(length: 8)
|
||||||
self.statusViewModels = inPlaceStatuses
|
self.statusViewModels = inPlaceStatuses
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ struct TrendStatusesView: View {
|
||||||
NoDataView(imageSystemName: "photo.on.rectangle.angled", text: "trendingStatuses.title.noPhotos")
|
NoDataView(imageSystemName: "photo.on.rectangle.angled", text: "trendingStatuses.title.noPhotos")
|
||||||
} else {
|
} else {
|
||||||
if self.imageColumns > 1 {
|
if self.imageColumns > 1 {
|
||||||
WaterfallGrid($statusViewModels, columns: $imageColumns, hideLoadMore: Binding.constant(true)) { item in
|
WaterfallGrid($statusViewModels, refreshId: Binding.constant(""), columns: $imageColumns, hideLoadMore: Binding.constant(true)) { item in
|
||||||
ImageRowAsync(statusViewModel: item, containerWidth: $containerWidth)
|
ImageRowAsync(statusViewModel: item, containerWidth: $containerWidth)
|
||||||
} onLoadMore: { }
|
} onLoadMore: { }
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -42,7 +42,7 @@ struct UserProfileStatusesView: View {
|
||||||
var body: some View {
|
var body: some View {
|
||||||
if firstLoadFinished == true {
|
if firstLoadFinished == true {
|
||||||
if self.imageColumns > 1 {
|
if self.imageColumns > 1 {
|
||||||
WaterfallGrid($statusViewModels, columns: $imageColumns, hideLoadMore: $allItemsLoaded) { item in
|
WaterfallGrid($statusViewModels, refreshId: Binding.constant(""), columns: $imageColumns, hideLoadMore: $allItemsLoaded) { item in
|
||||||
ImageRowAsync(statusViewModel: item, withAvatar: false, containerWidth: $containerWidth)
|
ImageRowAsync(statusViewModel: item, withAvatar: false, containerWidth: $containerWidth)
|
||||||
} onLoadMore: {
|
} onLoadMore: {
|
||||||
do {
|
do {
|
||||||
|
|
|
@ -13,11 +13,13 @@ struct WaterfallGrid<Data, ID, Content>: View where Data: RandomAccessCollection
|
||||||
@Binding private var columns: Int
|
@Binding private var columns: Int
|
||||||
@Binding private var hideLoadMore: Bool
|
@Binding private var hideLoadMore: Bool
|
||||||
@Binding private var data: Data
|
@Binding private var data: Data
|
||||||
|
@Binding private var refreshId: String
|
||||||
|
|
||||||
private let content: (Data.Element) -> Content
|
private let content: (Data.Element) -> Content
|
||||||
|
|
||||||
@State private var columnsData: [ColumnData<Data.Element>] = []
|
@State private var columnsData: [ColumnData<Data.Element>] = []
|
||||||
@State private var processedItems: [Data.Element.ID] = []
|
@State private var processedItems: [Data.Element.ID] = []
|
||||||
|
@State private var shouldRecalculate = false
|
||||||
|
|
||||||
private let onLoadMore: () async -> Void
|
private let onLoadMore: () async -> Void
|
||||||
private let semaphore = AsyncSemaphore(value: 1)
|
private let semaphore = AsyncSemaphore(value: 1)
|
||||||
|
@ -46,9 +48,17 @@ struct WaterfallGrid<Data, ID, Content>: View where Data: RandomAccessCollection
|
||||||
.onFirstAppear {
|
.onFirstAppear {
|
||||||
self.recalculateArrays()
|
self.recalculateArrays()
|
||||||
}
|
}
|
||||||
|
.onChange(of: self.refreshId) { _ in
|
||||||
|
self.shouldRecalculate = true
|
||||||
|
}
|
||||||
.onChange(of: self.data) { _ in
|
.onChange(of: self.data) { _ in
|
||||||
|
if self.shouldRecalculate {
|
||||||
|
self.recalculateArrays()
|
||||||
|
self.shouldRecalculate = false
|
||||||
|
} else {
|
||||||
self.appendToArrays()
|
self.appendToArrays()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
.onChange(of: self.columns) { _ in
|
.onChange(of: self.columns) { _ in
|
||||||
self.recalculateArrays()
|
self.recalculateArrays()
|
||||||
}
|
}
|
||||||
|
@ -113,25 +123,37 @@ struct WaterfallGrid<Data, ID, Content>: View where Data: RandomAccessCollection
|
||||||
}
|
}
|
||||||
|
|
||||||
extension WaterfallGrid {
|
extension WaterfallGrid {
|
||||||
init(_ data: Binding<Data>, id: KeyPath<Data.Element, ID>, columns: Binding<Int>,
|
init(_ data: Binding<Data>,
|
||||||
hideLoadMore: Binding<Bool>, content: @escaping (Data.Element) -> Content, onLoadMore: @escaping () async -> Void) {
|
refreshId: Binding<String>,
|
||||||
|
columns: Binding<Int>,
|
||||||
|
hideLoadMore: Binding<Bool>,
|
||||||
|
content: @escaping (Data.Element) -> Content,
|
||||||
|
onLoadMore: @escaping () async -> Void) {
|
||||||
|
|
||||||
self.content = content
|
self.content = content
|
||||||
self.onLoadMore = onLoadMore
|
self.onLoadMore = onLoadMore
|
||||||
|
|
||||||
self._data = data
|
self._data = data
|
||||||
self._columns = columns
|
self._columns = columns
|
||||||
self._hideLoadMore = hideLoadMore
|
self._hideLoadMore = hideLoadMore
|
||||||
|
self._refreshId = refreshId
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension WaterfallGrid where ID == Data.Element.ID, Data.Element: Identifiable {
|
extension WaterfallGrid where ID == Data.Element.ID, Data.Element: Identifiable {
|
||||||
init(_ data: Binding<Data>, columns: Binding<Int>,
|
init(_ data: Binding<Data>,
|
||||||
hideLoadMore: Binding<Bool>, content: @escaping (Data.Element) -> Content, onLoadMore: @escaping () async -> Void) {
|
refreshId: Binding<String>,
|
||||||
|
columns: Binding<Int>,
|
||||||
|
hideLoadMore: Binding<Bool>,
|
||||||
|
content: @escaping (Data.Element) -> Content,
|
||||||
|
onLoadMore: @escaping () async -> Void) {
|
||||||
|
|
||||||
self.content = content
|
self.content = content
|
||||||
self.onLoadMore = onLoadMore
|
self.onLoadMore = onLoadMore
|
||||||
|
|
||||||
self._data = data
|
self._data = data
|
||||||
self._columns = columns
|
self._columns = columns
|
||||||
self._hideLoadMore = hideLoadMore
|
self._hideLoadMore = hideLoadMore
|
||||||
|
self._refreshId = refreshId
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue