Skip to content

Commit c36c872

Browse files
committed
Fixed compatibility
With iOS 16 and really small screen
1 parent 96fe22a commit c36c872

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

OPass/Views/MainView.swift

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct MainView: View {
1515

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

@@ -51,12 +51,21 @@ struct MainView: View {
5151
if !(CheckFeatureIsWebview(feature.feature) && feature.url?.processWith(token: eventAPI.accessToken, role: eventAPI.eventScenarioStatus?.role) == nil),
5252
CheckFeatureVisible(feature.visible_roles) {
5353
VStack {
54-
GeometryReader { geometry in
55-
TabButton(feature: feature, selectedFeature: $selectedFeature, eventAPI: eventAPI, width: geometry.size.width)
56-
.frame(width: geometry.size.width, height: geometry.size.width)
57-
}
54+
TabButton(
55+
feature: feature,
56+
selectedFeature: $selectedFeature,
57+
eventAPI: eventAPI,
58+
width: UIScreen.main.bounds.width / 5.394136
59+
)
5860
.aspectRatio(contentMode: .fill)
59-
.clipShape(RoundedRectangle(cornerSize: CGSize(width: 15, height: 15)))
61+
.frame(
62+
width: UIScreen.main.bounds.width / 5.394136,
63+
height: UIScreen.main.bounds.width / 5.394136
64+
)
65+
.clipShape(RoundedRectangle(cornerSize: CGSize(
66+
width: UIScreen.main.bounds.width / 27.6,
67+
height: UIScreen.main.bounds.width / 27.6
68+
)))
6069

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

0 commit comments

Comments
 (0)