-
Notifications
You must be signed in to change notification settings - Fork 155
About screen sui #492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
About screen sui #492
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
0725830
add about view
KirillUzum 731b6e9
add data from bundle
KirillUzum 29d23db
ui fixes
KirillUzum 5461daf
setup for debug
KirillUzum 08e96ac
refactoring
KirillUzum 75b8cd4
restore
KirillUzum bbb8730
add AboutSectionView
KirillUzum 49b2bf8
fix UI
KirillUzum 2716f15
use about view
KirillUzum e4f0e68
use NavigationView
KirillUzum 753cb8c
add some color
KirillUzum fcdcd10
fix color
KirillUzum 7155984
fixes for small screen
KirillUzum 155bfef
refactoring
KirillUzum 4c0be27
swiftformat fixes
KirillUzum d57f83e
add icons
KirillUzum 5170ef2
swift format fixes
KirillUzum d716832
fix style
FuzzzzyBoy aa97bff
add icon
FuzzzzyBoy 7b5e429
fix layout
FuzzzzyBoy 0ee0aa9
Merge branch 'develop' into about-screen-sui
FuzzzzyBoy 12cbb2c
swiftformat
FuzzzzyBoy 3b9c8a8
Merge branch 'develop' into about-screen-sui
mickael-menu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,67 @@ | ||
// | ||
// Copyright 2024 Readium Foundation. All rights reserved. | ||
// Use of this source code is governed by the BSD-style license | ||
// available in the top-level LICENSE file of the project. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct AboutSectionView<Content: View>: View { | ||
enum Icon: String { | ||
case app = "app.badge" | ||
case circle = "c.circle" | ||
case hands = "hands.sparkles" | ||
} | ||
|
||
private let title: String | ||
private let icon: Icon | ||
private var content: () -> Content | ||
|
||
init( | ||
title: String, | ||
icon: Icon, | ||
content: @escaping () -> Content | ||
) { | ||
self.title = title | ||
self.icon = icon | ||
self.content = content | ||
} | ||
|
||
var body: some View { | ||
GroupBox { | ||
content() | ||
.padding(.top, 4) | ||
} label: { | ||
Label { | ||
Text(title) | ||
.bold() | ||
} icon: { | ||
Image(systemName: icon.rawValue) | ||
} | ||
.font(.title2) | ||
} | ||
} | ||
} | ||
|
||
#Preview { | ||
AboutSectionView(title: "Version", icon: .app) { | ||
VStack { | ||
HStack { | ||
Text("App Version:") | ||
.foregroundColor(.gray) | ||
Spacer() | ||
Text("alpha-3.0") | ||
.foregroundColor(.primary) | ||
} | ||
|
||
HStack(spacing: 10) { | ||
Text("Build Version:") | ||
.foregroundColor(.gray) | ||
Spacer() | ||
Text("alpha-3.0") | ||
.foregroundColor(.primary) | ||
} | ||
} | ||
} | ||
.padding() | ||
} |
This file contains hidden or 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,100 @@ | ||
// | ||
// Copyright 2024 Readium Foundation. All rights reserved. | ||
// Use of this source code is governed by the BSD-style license | ||
// available in the top-level LICENSE file of the project. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct AboutView: View { | ||
var body: some View { | ||
ScrollView(showsIndicators: false) { | ||
VStack(alignment: .center, spacing: 20) { | ||
versionSection | ||
copyrightSection | ||
acknowledgementsSection | ||
} | ||
.padding(.horizontal, 16) | ||
} | ||
} | ||
|
||
private var versionSection: some View { | ||
AboutSectionView( | ||
title: "Version", | ||
icon: .app | ||
) { | ||
VStack { | ||
HStack { | ||
Text("App Version:") | ||
.foregroundColor(.secondary) | ||
Spacer() | ||
Text(.appVersion ?? "") | ||
.foregroundColor(.primary) | ||
} | ||
|
||
HStack(spacing: 10) { | ||
Text("Build Version:") | ||
.foregroundColor(.secondary) | ||
Spacer() | ||
Text(.buildVersion ?? "") | ||
.foregroundColor(.primary) | ||
} | ||
} | ||
} | ||
} | ||
|
||
private var copyrightSection: some View { | ||
AboutSectionView( | ||
title: "Copyright", | ||
icon: .circle | ||
) { | ||
VStack(alignment: .leading) { | ||
Link(destination: .edrlab) { | ||
Text("© 2022 European Digital Reading Lab") | ||
.multilineTextAlignment(.leading) | ||
} | ||
|
||
Link(destination: .license) { | ||
Text("[BSD-3 License]") | ||
.multilineTextAlignment(.leading) | ||
} | ||
} | ||
.frame(maxWidth: .infinity, alignment: .leading) | ||
} | ||
} | ||
|
||
private var acknowledgementsSection: some View { | ||
AboutSectionView( | ||
title: "Acknowledgements", | ||
icon: .hands | ||
) { | ||
VStack(alignment: .center) { | ||
Text("R2 Reader wouldn't have been developed without the financial help of the French State.") | ||
.multilineTextAlignment(.center) | ||
.foregroundColor(.primary) | ||
Image("rf") | ||
.resizable() | ||
.scaledToFit() | ||
.frame(width: 200) | ||
.clipShape(RoundedRectangle(cornerRadius: 10)) | ||
} | ||
} | ||
} | ||
} | ||
|
||
struct About_Previews: PreviewProvider { | ||
static var previews: some View { | ||
AboutView() | ||
} | ||
} | ||
|
||
private extension String { | ||
static let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String | ||
|
||
static let buildVersion = Bundle.main.infoDictionary?["CFBundleVersion"] as? String | ||
} | ||
|
||
private extension URL { | ||
static let edrlab = URL(string: "https://www.edrlab.org/")! | ||
static let license = URL(string: "https://opensource.org/licenses/BSD-3-Clause")! | ||
} | ||
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!