-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into bosco/tab-bar-navigation-2
* dev: Restructured onboarding (#613) bumped version (#624) Added a "classic Lemmy" icon (#619) Hacked images to be smooth for TF release (#614) SiteVersion enum (#604) # Conflicts: # Mlem/Views/Shared/Links/Community/CommunityLinkView.swift
- Loading branch information
Showing
20 changed files
with
432 additions
and
122 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
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,87 @@ | ||
// | ||
// APISiteVersionNumber.swift | ||
// Mlem | ||
// | ||
// Created by Sjmarf on 09/09/2023. | ||
// | ||
import Foundation | ||
|
||
enum SiteVersion: Equatable { | ||
|
||
case release(major: Int, minor: Int, patch: Int) | ||
case other(String) | ||
case zero | ||
case infinity | ||
|
||
init(_ version: String) { | ||
|
||
let parts = version.split(separator: "-") | ||
if let firstPart = parts.first { | ||
let components = firstPart.split(separator: ".").compactMap { Int($0) } | ||
if components.count == 3 { | ||
self = .release(major: components[0], minor: components[1], patch: components[2]) | ||
} else { | ||
self = .other(version) | ||
} | ||
} else { | ||
self = .other(version) | ||
} | ||
} | ||
|
||
// swiftlint: disable large_tuple | ||
var parts: (Int, Int, Int)? { | ||
switch self { | ||
case .release(let major, let minor, let patch): | ||
return (major, minor, patch) | ||
default: | ||
return nil | ||
} | ||
} | ||
// swiftlint: enable large_tuple | ||
} | ||
|
||
extension SiteVersion: CustomStringConvertible { | ||
var description: String { | ||
switch self { | ||
case .zero: | ||
return "zero" | ||
case .infinity: | ||
return "infinity" | ||
case .release(let major, let minor, let patch): | ||
return "\(major).\(minor).\(patch)" | ||
case .other(let string): | ||
return string | ||
} | ||
} | ||
} | ||
|
||
extension SiteVersion: Codable { | ||
init(from decoder: Decoder) throws { | ||
let container = try decoder.singleValueContainer() | ||
let versionString = try container.decode(String.self) | ||
self.init(versionString) | ||
} | ||
|
||
func encode(to encoder: Encoder) throws { | ||
var container = encoder.singleValueContainer() | ||
try container.encode(String(describing: self)) | ||
} | ||
} | ||
|
||
extension SiteVersion: Comparable { | ||
static func < (lhs: SiteVersion, rhs: SiteVersion) -> Bool { | ||
|
||
switch (lhs, rhs) { | ||
case (.release, .release): | ||
return lhs.parts! < rhs.parts! | ||
|
||
case (.zero, _), (_, .infinity): | ||
return true | ||
|
||
case (_, .zero), (.infinity, _): | ||
return false | ||
default: | ||
return false | ||
} | ||
} | ||
} |
Binary file added
BIN
+773 KB
...ssets.xcassets/Icons/Classic Lemmy by Eric Andrews.appiconset/Classic Lemmy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions
14
Mlem/Assets.xcassets/Icons/Classic Lemmy by Eric Andrews.appiconset/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,14 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "Classic Lemmy.png", | ||
"idiom" : "universal", | ||
"platform" : "ios", | ||
"size" : "1024x1024" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
File renamed without changes
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// | ||
// LandingPage.swift | ||
// Mlem | ||
// | ||
// Created by mormaer on 14/09/2023. | ||
// | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct LandingPage: View { | ||
@State private var navigationPath = NavigationPath() | ||
|
||
var body: some View { | ||
NavigationStack(path: $navigationPath) { | ||
VStack(spacing: 40) { | ||
Text("Welcome to Mlem!") | ||
.bold() | ||
|
||
LogoView() | ||
|
||
VStack { | ||
newUserButton | ||
existingUserButton | ||
} | ||
} | ||
.padding(.horizontal) | ||
.frame(maxHeight: .infinity) | ||
.navigationDestination(for: OnboardingRoute.self) { route in | ||
switch route { | ||
case .onboard: | ||
OnboardingView(navigationPath: $navigationPath) | ||
case let .login(url): | ||
AddSavedInstanceView(onboarding: true, givenInstance: url?.absoluteString) | ||
} | ||
} | ||
} | ||
} | ||
|
||
@ViewBuilder | ||
var newUserButton: some View { | ||
Button { | ||
navigationPath.append(OnboardingRoute.onboard) | ||
} label: { | ||
Text("I'm new here") | ||
.padding(.vertical, 5) | ||
.frame(maxWidth: .infinity) | ||
} | ||
.buttonStyle(.borderedProminent) | ||
} | ||
|
||
@ViewBuilder | ||
var existingUserButton: some View { | ||
Button { | ||
navigationPath.append(OnboardingRoute.login(nil)) | ||
} label: { | ||
Text("I have a Lemmy account") | ||
.padding(.vertical, 5) | ||
.frame(maxWidth: .infinity) | ||
} | ||
.buttonStyle(.bordered) | ||
} | ||
} |
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,14 @@ | ||
// | ||
// OnboardingRoute.swift | ||
// Mlem | ||
// | ||
// Created by mormaer on 14/09/2023. | ||
// | ||
// | ||
|
||
import Foundation | ||
|
||
enum OnboardingRoute: Hashable { | ||
case onboard | ||
case login(URL?) | ||
} |
Oops, something went wrong.