Merge pull request #563 from omnivore-app/feature/feature-flag-iphone-grid

Add feature flag to enable grid on iphone
This commit is contained in:
Satindar Dhillon 2022-05-06 15:03:20 -07:00 committed by GitHub
commit 3cd96dc580
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 8 deletions

View file

@ -5,6 +5,8 @@ import UserNotifications
import Utils
import Views
private let enableGrid = UIDevice.isIPad || FeatureFlag.enableGridCardsOnPhone
#if os(iOS)
struct HomeFeedContainerView: View {
@EnvironmentObject var dataService: DataService
@ -54,18 +56,22 @@ import Views
Button("", action: {})
.disabled(true)
.overlay {
if viewModel.isLoading, !prefersListLayout {
if viewModel.isLoading, !prefersListLayout, enableGrid {
ProgressView()
}
}
}
ToolbarItem(placement: UIDevice.isIPhone ? .barLeading : .barTrailing) {
Button(
action: { prefersListLayout.toggle() },
label: {
Label("Toggle Feed Layout", systemImage: prefersListLayout ? "square.grid.2x2" : "list.bullet")
}
)
if enableGrid {
Button(
action: { prefersListLayout.toggle() },
label: {
Label("Toggle Feed Layout", systemImage: prefersListLayout ? "square.grid.2x2" : "list.bullet")
}
)
} else {
EmptyView()
}
}
ToolbarItem(placement: .barTrailing) {
if UIDevice.isIPhone {
@ -149,7 +155,7 @@ import Views
}
}
}
if prefersListLayout {
if prefersListLayout || !enableGrid {
HomeFeedListView(prefersListLayout: $prefersListLayout, viewModel: viewModel)
} else {
HomeFeedGridView(viewModel: viewModel)

View file

@ -14,4 +14,5 @@ public enum FeatureFlag {
public static let enablePushNotifications = false
public static let enableShareButton = false
public static let enableSnooze = false
public static let enableGridCardsOnPhone = false
}