-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
15042e7
commit d23acbd
Showing
15 changed files
with
241 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
iosHyperskillApp/iosHyperskillApp/Assets.xcassets/NotificationsOnboarding/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...sets/NotificationsOnboarding/notifications-onboarding-illustration.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "notifications-onboarding-illustration-light.pdf", | ||
"idiom" : "universal" | ||
}, | ||
{ | ||
"appearances" : [ | ||
{ | ||
"appearance" : "luminosity", | ||
"value" : "dark" | ||
} | ||
], | ||
"filename" : "notifications-onboarding-illustration-dark.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"preserves-vector-representation" : true | ||
} | ||
} |
Binary file added
BIN
+918 KB
...fications-onboarding-illustration.imageset/notifications-onboarding-illustration-dark.pdf
Binary file not shown.
Binary file added
BIN
+906 KB
...ications-onboarding-illustration.imageset/notifications-onboarding-illustration-light.pdf
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
126 changes: 126 additions & 0 deletions
126
...pp/Sources/Modules/NotificationsOnboarding/Views/NotificationsOnboardingContentView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
import SwiftUI | ||
|
||
extension NotificationsOnboardingContentView { | ||
struct Appearance { | ||
let interitemSpacing = LayoutInsets.smallInset | ||
|
||
let illustrationHeight: CGFloat = 320 | ||
|
||
let maxWidth: CGFloat = DeviceInfo.current.isPad ? 400 : .infinity | ||
|
||
let primaryButtonStyle = RoundedRectangleButtonStyle(style: .violet) | ||
} | ||
} | ||
|
||
struct NotificationsOnboardingContentView: View { | ||
private(set) var appearance = Appearance() | ||
|
||
@Environment(\.horizontalSizeClass) private var horizontalSizeClass | ||
|
||
private let actionButtonsFeedbackGenerator = FeedbackGenerator(feedbackType: .selection) | ||
|
||
let onPrimaryButtonTap: () -> Void | ||
let onSecondaryButtonTap: () -> Void | ||
|
||
var body: some View { | ||
VerticalCenteredScrollView(showsIndicators: false) { | ||
VStack(spacing: 0) { | ||
if horizontalSizeClass == .regular { | ||
Spacer() | ||
} | ||
|
||
VStack(spacing: 0) { | ||
if horizontalSizeClass == .compact { | ||
Spacer() | ||
} | ||
header | ||
.padding(.vertical) | ||
if horizontalSizeClass == .compact { | ||
Spacer() | ||
} | ||
|
||
illustration | ||
.padding(.vertical) | ||
if horizontalSizeClass == .compact { | ||
Spacer() | ||
} | ||
|
||
actionButtons | ||
.padding(.top) | ||
} | ||
|
||
if horizontalSizeClass == .regular { | ||
Spacer() | ||
} | ||
} | ||
.padding() | ||
.frame(maxWidth: appearance.maxWidth) | ||
} | ||
} | ||
|
||
private var header: some View { | ||
VStack(alignment: .center, spacing: appearance.interitemSpacing) { | ||
Text(Strings.NotificationsOnboarding.title) | ||
.font(.title).bold() | ||
.foregroundColor(.primaryText) | ||
|
||
Text(Strings.NotificationsOnboarding.subtitle) | ||
.font(.body) | ||
.foregroundColor(.secondaryText) | ||
} | ||
.multilineTextAlignment(.center) | ||
} | ||
|
||
private var illustration: some View { | ||
Image(Images.NotificationsOnboarding.illustration) | ||
.renderingMode(.original) | ||
.resizable() | ||
.aspectRatio(contentMode: .fit) | ||
.frame(maxWidth: .infinity) | ||
.frame(maxHeight: appearance.illustrationHeight) | ||
} | ||
|
||
@MainActor | ||
private var actionButtons: some View { | ||
VStack(alignment: .center, spacing: appearance.interitemSpacing) { | ||
Button( | ||
Strings.NotificationsOnboarding.buttonPrimary, | ||
action: { | ||
actionButtonsFeedbackGenerator.triggerFeedback() | ||
onPrimaryButtonTap() | ||
} | ||
) | ||
.buttonStyle(appearance.primaryButtonStyle) | ||
.shineEffect() | ||
|
||
Button( | ||
Strings.NotificationsOnboarding.buttonSecondary, | ||
action: { | ||
actionButtonsFeedbackGenerator.triggerFeedback() | ||
onSecondaryButtonTap() | ||
} | ||
) | ||
.frame( | ||
maxWidth: .infinity, | ||
minHeight: appearance.primaryButtonStyle.minHeight, | ||
alignment: .center | ||
) | ||
} | ||
} | ||
} | ||
|
||
struct NotificationsOnboardingContentView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
NotificationsOnboardingContentView( | ||
onPrimaryButtonTap: {}, | ||
onSecondaryButtonTap: {} | ||
) | ||
.previewDevice(PreviewDevice(rawValue: "iPhone 14 Pro")) | ||
|
||
NotificationsOnboardingContentView( | ||
onPrimaryButtonTap: {}, | ||
onSecondaryButtonTap: {} | ||
) | ||
.previewDevice(PreviewDevice(rawValue: "iPad (10th generation)")) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.