Skip to content

Commit

Permalink
Merge branch 'dev' into bosco/tab-bar-navigation-2
Browse files Browse the repository at this point in the history
* 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
boscojwho committed Sep 19, 2023
2 parents ce893ec + 8f1f9a9 commit 5a5c6df
Show file tree
Hide file tree
Showing 20 changed files with 432 additions and 122 deletions.
44 changes: 38 additions & 6 deletions Mlem.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
030AC0522A64666C00037155 /* UserSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 030AC0512A64666C00037155 /* UserSettingsView.swift */; };
030D4AE62AA1273200A3393D /* ErrorDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = 030D4AE52AA1273200A3393D /* ErrorDetails.swift */; };
030D4AE82AA1278400A3393D /* ErrorDetails+Mock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 030D4AE72AA1278400A3393D /* ErrorDetails+Mock.swift */; };
031BF9532AB24BAF00F4517F /* SiteVersion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 031BF9522AB24BAF00F4517F /* SiteVersion.swift */; };
031BF9552AB25AFB00F4517F /* SiteVersionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 031BF9542AB25AFB00F4517F /* SiteVersionTests.swift */; };
032109472AA7C3FC00912DFC /* CommunityLabelView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 032109462AA7C3FC00912DFC /* CommunityLabelView.swift */; };
032109492AA7C41800912DFC /* AvatarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 032109482AA7C41800912DFC /* AvatarView.swift */; };
034C724F2A82B61200B8A4B8 /* LayoutWidgetTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 034C724E2A82B61200B8A4B8 /* LayoutWidgetTracker.swift */; };
Expand Down Expand Up @@ -42,6 +44,8 @@
504106CD2A744D7F000AAEF8 /* CommentRepository+Dependency.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504106CC2A744D7F000AAEF8 /* CommentRepository+Dependency.swift */; };
504ECBAE2AB45B2A006C0B96 /* LemmyURL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504ECBAD2AB45B2A006C0B96 /* LemmyURL.swift */; };
504ECBB12AB4B101006C0B96 /* LemmyURLTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504ECBB02AB4B101006C0B96 /* LemmyURLTests.swift */; };
504ECBAA2AB27C73006C0B96 /* LandingPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504ECBA92AB27C73006C0B96 /* LandingPage.swift */; };
504ECBAC2AB27CB1006C0B96 /* OnboardingRoute.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504ECBAB2AB27CB1006C0B96 /* OnboardingRoute.swift */; };
505240E32A86916500EA4558 /* FavoriteCommunitiesTracker+Dependency.swift in Sources */ = {isa = PBXBuildFile; fileRef = 505240E22A86916500EA4558 /* FavoriteCommunitiesTracker+Dependency.swift */; };
505240E52A86E32700EA4558 /* CommunityListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 505240E42A86E32700EA4558 /* CommunityListModel.swift */; };
505240E72A88D36D00EA4558 /* SectionIndexTitles.swift in Sources */ = {isa = PBXBuildFile; fileRef = 505240E62A88D36D00EA4558 /* SectionIndexTitles.swift */; };
Expand Down Expand Up @@ -382,7 +386,7 @@
CDDCF6512A677E1B003DA3AC /* FancyTabItemPreferenceKeys.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDDCF6502A677E1B003DA3AC /* FancyTabItemPreferenceKeys.swift */; };
CDDCF6532A677F45003DA3AC /* TabSelection.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDDCF6522A677F45003DA3AC /* TabSelection.swift */; };
CDDCF6572A678298003DA3AC /* FancyTabBarSelection.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDDCF6562A678298003DA3AC /* FancyTabBarSelection.swift */; };
CDE3BA872A8C25B000B972E2 /* Onboarding View.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDE3BA862A8C25B000B972E2 /* Onboarding View.swift */; };
CDE3BA872A8C25B000B972E2 /* OnboardingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDE3BA862A8C25B000B972E2 /* OnboardingView.swift */; };
CDE3BA892A8C64BD00B972E2 /* Collapsible Text Item.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDE3BA882A8C64BD00B972E2 /* Collapsible Text Item.swift */; };
CDE6A80B2A43E9F00062D161 /* CommentSortType.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDE6A80A2A43E9F00062D161 /* CommentSortType.swift */; };
CDE6A80D2A45EAB30062D161 /* Embedded Post.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDE6A80C2A45EAB30062D161 /* Embedded Post.swift */; };
Expand Down Expand Up @@ -457,6 +461,8 @@
030AC0512A64666C00037155 /* UserSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserSettingsView.swift; sourceTree = "<group>"; };
030D4AE52AA1273200A3393D /* ErrorDetails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ErrorDetails.swift; sourceTree = "<group>"; };
030D4AE72AA1278400A3393D /* ErrorDetails+Mock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ErrorDetails+Mock.swift"; sourceTree = "<group>"; };
031BF9522AB24BAF00F4517F /* SiteVersion.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SiteVersion.swift; sourceTree = "<group>"; };
031BF9542AB25AFB00F4517F /* SiteVersionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SiteVersionTests.swift; sourceTree = "<group>"; };
032109462AA7C3FC00912DFC /* CommunityLabelView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityLabelView.swift; sourceTree = "<group>"; };
032109482AA7C41800912DFC /* AvatarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AvatarView.swift; sourceTree = "<group>"; };
034C724E2A82B61200B8A4B8 /* LayoutWidgetTracker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LayoutWidgetTracker.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -488,6 +494,8 @@
504106CC2A744D7F000AAEF8 /* CommentRepository+Dependency.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CommentRepository+Dependency.swift"; sourceTree = "<group>"; };
504ECBAD2AB45B2A006C0B96 /* LemmyURL.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LemmyURL.swift; sourceTree = "<group>"; };
504ECBB02AB4B101006C0B96 /* LemmyURLTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LemmyURLTests.swift; sourceTree = "<group>"; };
504ECBA92AB27C73006C0B96 /* LandingPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LandingPage.swift; sourceTree = "<group>"; };
504ECBAB2AB27CB1006C0B96 /* OnboardingRoute.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingRoute.swift; sourceTree = "<group>"; };
505240E22A86916500EA4558 /* FavoriteCommunitiesTracker+Dependency.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FavoriteCommunitiesTracker+Dependency.swift"; sourceTree = "<group>"; };
505240E42A86E32700EA4558 /* CommunityListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityListModel.swift; sourceTree = "<group>"; };
505240E62A88D36D00EA4558 /* SectionIndexTitles.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SectionIndexTitles.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -826,7 +834,7 @@
CDDCF6502A677E1B003DA3AC /* FancyTabItemPreferenceKeys.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FancyTabItemPreferenceKeys.swift; sourceTree = "<group>"; };
CDDCF6522A677F45003DA3AC /* TabSelection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabSelection.swift; sourceTree = "<group>"; };
CDDCF6562A678298003DA3AC /* FancyTabBarSelection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FancyTabBarSelection.swift; sourceTree = "<group>"; };
CDE3BA862A8C25B000B972E2 /* Onboarding View.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Onboarding View.swift"; sourceTree = "<group>"; };
CDE3BA862A8C25B000B972E2 /* OnboardingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingView.swift; sourceTree = "<group>"; };
CDE3BA882A8C64BD00B972E2 /* Collapsible Text Item.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Collapsible Text Item.swift"; sourceTree = "<group>"; };
CDE6A80A2A43E9F00062D161 /* CommentSortType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommentSortType.swift; sourceTree = "<group>"; };
CDE6A80C2A45EAB30062D161 /* Embedded Post.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Embedded Post.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1010,6 +1018,14 @@
path = User;
sourceTree = "<group>";
};
031BF9562AB25AFE00F4517F /* Model */ = {
isa = PBXGroup;
children = (
031BF9542AB25AFB00F4517F /* SiteVersionTests.swift */,
);
path = Model;
sourceTree = "<group>";
};
032109442AA7C32100912DFC /* User */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1072,6 +1088,16 @@
path = Model;
sourceTree = "<group>";
};
504ECBA82AB27C4C006C0B96 /* Onboarding */ = {
isa = PBXGroup;
children = (
504ECBA92AB27C73006C0B96 /* LandingPage.swift */,
CDE3BA862A8C25B000B972E2 /* OnboardingView.swift */,
504ECBAB2AB27CB1006C0B96 /* OnboardingRoute.swift */,
);
path = Onboarding;
sourceTree = "<group>";
};
5064D03B2A6DE05000B22EE3 /* Notifications */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1360,7 +1386,6 @@
CDCBD7292A8EC06D00387A2C /* Components */,
6332FDCE27EFDD2E0009A98A /* Accounts Page.swift */,
63F0C7B82A0533C700A18C5D /* Add Account View.swift */,
CDE3BA862A8C25B000B972E2 /* Onboarding View.swift */,
CDCBD7252A8D69A200387A2C /* Instance Picker View.swift */,
CDCBD7272A8D6B7700387A2C /* Instance Picker View Logic.swift */,
CDC65D902A86B830007205E5 /* DeleteAccountView.swift */,
Expand Down Expand Up @@ -1494,6 +1519,7 @@
50DBB8DE2A805770002870B1 /* Mocks */,
50C86AB82A7E507200277519 /* Persistence */,
6363D5DA27EE196A00E34822 /* MlemTests.swift */,
031BF9562AB25AFE00F4517F /* Model */,
);
path = MlemTests;
sourceTree = "<group>";
Expand All @@ -1510,6 +1536,7 @@
6363D5F327EE1BA900E34822 /* Views */ = {
isa = PBXGroup;
children = (
504ECBA82AB27C4C006C0B96 /* Onboarding */,
6386E03E2A04570F006B3C1D /* Shared */,
6363D5F427EE1BAE00E34822 /* Tabs */,
);
Expand Down Expand Up @@ -1554,6 +1581,7 @@
isa = PBXGroup;
children = (
637218032A3A2AAD008C4816 /* HierarchicalComment.swift */,
031BF9522AB24BAF00F4517F /* SiteVersion.swift */,
504ECBAD2AB45B2A006C0B96 /* LemmyURL.swift */,
);
path = Internal;
Expand Down Expand Up @@ -2578,6 +2606,7 @@
504ECBAE2AB45B2A006C0B96 /* LemmyURL.swift in Sources */,
CDA217EA2A63093E00BDA173 /* ReportComment.swift in Sources */,
CDA217E82A63029B00BDA173 /* ReportMention.swift in Sources */,
504ECBAA2AB27C73006C0B96 /* LandingPage.swift in Sources */,
508845CF2A3641160088E483 /* JSONDecoder+Default.swift in Sources */,
637218672A3A2AAD008C4816 /* GetPersonDetails.swift in Sources */,
B1A26FE12A44AAB200B91A32 /* Navigation getter.swift in Sources */,
Expand Down Expand Up @@ -2672,6 +2701,7 @@
03E0B9CA2A62B4A400FED265 /* ContributorsView.swift in Sources */,
637218662A3A2AAD008C4816 /* SavePost.swift in Sources */,
CD6F29AC2A78015200F20B6B /* PostRepository+Dependency.swift in Sources */,
031BF9532AB24BAF00F4517F /* SiteVersion.swift in Sources */,
637218452A3A2AAD008C4816 /* APICommentAggregates.swift in Sources */,
6D80037B2A46458800363206 /* Lazy Load Expanded Post.swift in Sources */,
6372184F2A3A2AAD008C4816 /* APIPerson.swift in Sources */,
Expand Down Expand Up @@ -2718,6 +2748,7 @@
637218432A3A2AAD008C4816 /* APIClient.swift in Sources */,
CD82A2572A716D7C00111034 /* PersonRepository+Dependency.swift in Sources */,
63DF71F12A02999C002AC14E /* App Constants.swift in Sources */,
504ECBAC2AB27CB1006C0B96 /* OnboardingRoute.swift in Sources */,
CD82A2532A716B8100111034 /* PersonRepository.swift in Sources */,
CD69F55F2A40121D0028D4F7 /* Ellipsis Menu.swift in Sources */,
638535712A1779BC00815781 /* GeneralSettingsView.swift in Sources */,
Expand Down Expand Up @@ -2751,7 +2782,7 @@
CD6483A62A82FAF200A5AE84 /* ProfileTabLabel.swift in Sources */,
CDEBC3252A9A57D200518D9D /* Content Type.swift in Sources */,
6386E0402A045723006B3C1D /* Website Icon Complex.swift in Sources */,
CDE3BA872A8C25B000B972E2 /* Onboarding View.swift in Sources */,
CDE3BA872A8C25B000B972E2 /* OnboardingView.swift in Sources */,
5064D0412A6E63E000B22EE3 /* Task+Notifiable.swift in Sources */,
63F0C7BD2A058CD200A18C5D /* Check if Endpoint Exists.swift in Sources */,
E4D4DBA02A7C7B9D00C4F3DE /* Comments.swift in Sources */,
Expand Down Expand Up @@ -2857,6 +2888,7 @@
50DBB8E02A805836002870B1 /* MockErrorHandler.swift in Sources */,
6363D5DB27EE196A00E34822 /* MlemTests.swift in Sources */,
50BC1AB92A89744200E3C48B /* CommunityListModelTests.swift in Sources */,
031BF9552AB25AFB00F4517F /* SiteVersionTests.swift in Sources */,
50CC4A782A9CBDF70074C845 /* TimestampedValueTests.swift in Sources */,
50CC4A822AA0D61F0074C845 /* InstanceMetadataParserTests.swift in Sources */,
50C86ABC2A7E50E200277519 /* PersistenceRepositoryTests.swift in Sources */,
Expand Down Expand Up @@ -3032,7 +3064,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.2;
MARKETING_VERSION = 1.1;
PRODUCT_BUNDLE_IDENTIFIER = com.hanners.Mlem;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
Expand Down Expand Up @@ -3073,7 +3105,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.2;
MARKETING_VERSION = 1.1;
PRODUCT_BUNDLE_IDENTIFIER = com.hanners.Mlem;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
Expand Down
87 changes: 87 additions & 0 deletions Mlem/API/Internal/SiteVersion.swift
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
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
}
}
2 changes: 1 addition & 1 deletion Mlem/Extensions/IconSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct IconSettingsView: View {
}
return true
}.sorted(by: { lhs, rhs in
lhs.name > rhs.name
lhs.name < rhs.name
}))

return allIcons
Expand Down
2 changes: 2 additions & 0 deletions Mlem/Models/Trackers/SiteInformationTracker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ class SiteInformationTracker: ObservableObject {
@Dependency(\.apiClient) var apiClient

@Published private(set) var enableDownvotes = true
@Published private(set) var version: SiteVersion?

func load() {
Task {
let information = try await apiClient.loadSiteInformation()
enableDownvotes = information.siteView.localSite.enableDownvotes
version = SiteVersion(information.version)
}
}
}
63 changes: 63 additions & 0 deletions Mlem/Views/Onboarding/LandingPage.swift
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)
}
}
14 changes: 14 additions & 0 deletions Mlem/Views/Onboarding/OnboardingRoute.swift
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?)
}
Loading

0 comments on commit 5a5c6df

Please sign in to comment.