Skip to content

Commit 69bae31

Browse files
fadi-georgeclaude
andauthored
chore: [SDK-5634] add extra IAM type buttons to demo app (#1787)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 6a22dea commit 69bae31

3 files changed

Lines changed: 27 additions & 10 deletions

File tree

‎examples/demo/App/Models/AppModels.swift‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,14 @@ enum NotificationType: String, CaseIterable, Identifiable {
5252

5353
/// Sample in-app message layouts triggered by the iam_type trigger
5454
enum InAppMessageType: String, CaseIterable, Identifiable {
55-
case topBanner = "Top Banner"
56-
case bottomBanner = "Bottom Banner"
57-
case centerModal = "Center Modal"
58-
case fullScreen = "Full Screen"
55+
case topBanner = "Top"
56+
case bottomBanner = "Bottom"
57+
case centerModal = "Center"
58+
case html = "HTML"
59+
case fullScreen = "Full"
60+
case fullBleed = "Full Bleed"
61+
case carousel = "Carousel"
62+
case carouselBleed = "Carousel Bleed"
5963

6064
var id: String { rawValue }
6165

@@ -65,7 +69,11 @@ enum InAppMessageType: String, CaseIterable, Identifiable {
6569
case .topBanner: return "top_banner"
6670
case .bottomBanner: return "bottom_banner"
6771
case .centerModal: return "center_modal"
72+
case .html: return "html"
6873
case .fullScreen: return "full_screen"
74+
case .fullBleed: return "full_bleed"
75+
case .carousel: return "carousel"
76+
case .carouselBleed: return "carousel_bleed"
6977
}
7078
}
7179
}

‎examples/demo/App/Views/Components/ActionButton.swift‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ struct ActionButton: View {
7272
Text(title)
7373
.font(OS.Font.bodyMedium.weight(.semibold))
7474
.lineLimit(1)
75+
.minimumScaleFactor(0.7)
7576
}
77+
.padding(.horizontal, 8)
7678
.frame(maxWidth: .infinity)
7779
.frame(height: OS.Layout.buttonHeight)
7880
.foregroundColor(foregroundColor)

‎examples/demo/App/Views/Sections/SendIamSection.swift‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,25 @@ import SwiftUI
3131
struct SendIamSection: View {
3232
@EnvironmentObject var viewModel: OneSignalViewModel
3333

34+
private let columns = Array(
35+
repeating: GridItem(.flexible(), spacing: OS.Spacing.cardGap),
36+
count: 2
37+
)
38+
3439
var body: some View {
3540
SectionCard(
3641
title: "SEND IN-APP MESSAGE",
3742
sectionKey: "send_iam",
3843
onInfoTap: { viewModel.showTooltip(for: "sendInAppMessage") }
3944
) {
40-
ForEach(InAppMessageType.allCases) { type in
41-
ActionButton(
42-
type.rawValue.uppercased(),
43-
accessibilityID: "send_iam_\(type.triggerValue)_button"
44-
) {
45-
viewModel.sendIamTrigger(type)
45+
LazyVGrid(columns: columns, spacing: OS.Spacing.cardGap) {
46+
ForEach(InAppMessageType.allCases) { type in
47+
ActionButton(
48+
type.rawValue.uppercased(),
49+
accessibilityID: "send_iam_\(type.triggerValue)_button"
50+
) {
51+
viewModel.sendIamTrigger(type)
52+
}
4653
}
4754
}
4855
}

0 commit comments

Comments
 (0)