Skip to content

Commit

Permalink
Fixed compatibility
Browse files Browse the repository at this point in the history
With iOS 16 and really small screen
  • Loading branch information
viere1234 committed Jul 25, 2022
1 parent 96fe22a commit c36c872
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions OPass/Views/MainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct MainView: View {

@EnvironmentObject var OPassAPI: OPassAPIViewModel
@ObservedObject var eventAPI: EventAPIViewModel
private let gridItemLayout = Array(repeating: GridItem(spacing: CGFloat(25.0), alignment: Alignment.top), count: 4)
private let gridItemLayout = Array(repeating: GridItem(spacing: CGFloat(UIScreen.main.bounds.width / 16.56), alignment: Alignment.top), count: 4)
private let logger = Logger(subsystem: "app.opass.ccip", category: "MainView")
@State private var selectedFeature: FeatureType? = nil

Expand Down Expand Up @@ -51,12 +51,21 @@ struct MainView: View {
if !(CheckFeatureIsWebview(feature.feature) && feature.url?.processWith(token: eventAPI.accessToken, role: eventAPI.eventScenarioStatus?.role) == nil),
CheckFeatureVisible(feature.visible_roles) {
VStack {
GeometryReader { geometry in
TabButton(feature: feature, selectedFeature: $selectedFeature, eventAPI: eventAPI, width: geometry.size.width)
.frame(width: geometry.size.width, height: geometry.size.width)
}
TabButton(
feature: feature,
selectedFeature: $selectedFeature,
eventAPI: eventAPI,
width: UIScreen.main.bounds.width / 5.394136
)
.aspectRatio(contentMode: .fill)
.clipShape(RoundedRectangle(cornerSize: CGSize(width: 15, height: 15)))
.frame(
width: UIScreen.main.bounds.width / 5.394136,
height: UIScreen.main.bounds.width / 5.394136
)
.clipShape(RoundedRectangle(cornerSize: CGSize(
width: UIScreen.main.bounds.width / 27.6,
height: UIScreen.main.bounds.width / 27.6
)))

Text(LocalizeIn(zh: feature.display_text.zh, en: feature.display_text.en))
.font(.custom("RobotoCondensed-Regular", size: 11, relativeTo: .caption2))
Expand Down

0 comments on commit c36c872

Please sign in to comment.