Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions examples/demo/App/Models/AppModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ enum NotificationType: String, CaseIterable, Identifiable {

/// Sample in-app message layouts triggered by the iam_type trigger
enum InAppMessageType: String, CaseIterable, Identifiable {
case topBanner = "Top Banner"
case bottomBanner = "Bottom Banner"
case centerModal = "Center Modal"
case fullScreen = "Full Screen"
case topBanner = "Top"
case bottomBanner = "Bottom"
case centerModal = "Center"
case html = "HTML"
case fullScreen = "Full"
case fullBleed = "Full Bleed"
case carousel = "Carousel"
case carouselBleed = "Carousel Bleed"

var id: String { rawValue }

Expand All @@ -65,7 +69,11 @@ enum InAppMessageType: String, CaseIterable, Identifiable {
case .topBanner: return "top_banner"
case .bottomBanner: return "bottom_banner"
case .centerModal: return "center_modal"
case .html: return "html"
case .fullScreen: return "full_screen"
case .fullBleed: return "full_bleed"
case .carousel: return "carousel"
case .carouselBleed: return "carousel_bleed"
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions examples/demo/App/Views/Components/ActionButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ struct ActionButton: View {
Text(title)
.font(OS.Font.bodyMedium.weight(.semibold))
.lineLimit(1)
.minimumScaleFactor(0.7)
}
.padding(.horizontal, 8)
.frame(maxWidth: .infinity)
.frame(height: OS.Layout.buttonHeight)
.foregroundColor(foregroundColor)
Expand Down
19 changes: 13 additions & 6 deletions examples/demo/App/Views/Sections/SendIamSection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,25 @@ import SwiftUI
struct SendIamSection: View {
@EnvironmentObject var viewModel: OneSignalViewModel

private let columns = Array(
repeating: GridItem(.flexible(), spacing: OS.Spacing.cardGap),
count: 2
)

var body: some View {
SectionCard(
title: "SEND IN-APP MESSAGE",
sectionKey: "send_iam",
onInfoTap: { viewModel.showTooltip(for: "sendInAppMessage") }
) {
ForEach(InAppMessageType.allCases) { type in
ActionButton(
type.rawValue.uppercased(),
accessibilityID: "send_iam_\(type.triggerValue)_button"
) {
viewModel.sendIamTrigger(type)
LazyVGrid(columns: columns, spacing: OS.Spacing.cardGap) {
ForEach(InAppMessageType.allCases) { type in
ActionButton(
type.rawValue.uppercased(),
accessibilityID: "send_iam_\(type.triggerValue)_button"
) {
viewModel.sendIamTrigger(type)
}
}
}
}
Expand Down
Loading