Skip to content

Commit

Permalink
Add docs, revert changes to AppView
Browse files Browse the repository at this point in the history
  • Loading branch information
mplorentz committed Dec 27, 2024
1 parent 0dd8f24 commit 9aeed9c
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Download and parse an author’s lists when viewing their profile. [#49](https://github.com/verse-pbc/issues/issues/49)
- Updated fastlane scripts to fix the TestFlight deployment pipeline. [#97](https://github.com/verse-pbc/issues/issues/97)
- Removed inactive accounts from Discover tab. [#94](https://github.com/verse-pbc/issues/issues/94)
- Added the Inject framework for hot reloading. [#1710](https://github.com/planetary-social/nos/pull/1710)

## [1.0.3] - 2024-12-04Z

Expand Down
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ For now `main` is the main branch and code improvements are made in topic branch

A maintainer will review your code and merge it when it has the required number of approvals.

## Hot Reloading

We make use of the [Inject](https://github.com/krzysztofzablocki/Inject) framework for hot reloading debug builds. To set up hot reloading, follow the [documentation](https://github.com/krzysztofzablocki/Inject?tab=readme-ov-file#individual-developer-setup-once-per-machine).

## Dependency Management

We prefer to install dependencies using the Swift Package Manager.
Expand Down
12 changes: 11 additions & 1 deletion Nos.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@
C987F85429BA951E00B44E7A /* ClarityCity-Thin.otf in Resources */ = {isa = PBXBuildFile; fileRef = C987F83129BA951E00B44E7A /* ClarityCity-Thin.otf */; };
C987F85529BA951E00B44E7A /* ClarityCity-Thin.otf in Resources */ = {isa = PBXBuildFile; fileRef = C987F83129BA951E00B44E7A /* ClarityCity-Thin.otf */; };
C987F85B29BA9ED800B44E7A /* Font+Clarity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C987F85729BA981800B44E7A /* Font+Clarity.swift */; };
C98905A22CD3B8CF00C17EE0 /* Inject in Frameworks */ = {isa = PBXBuildFile; productRef = C98905A12CD3B8CF00C17EE0 /* Inject */; };
C9887D812D1EF3C400CF9101 /* Inject in Frameworks */ = {isa = PBXBuildFile; productRef = C98905A12CD3B8CF00C17EE0 /* Inject */; };
C98A32272A05795E00E3FA13 /* Task+Timeout.swift in Sources */ = {isa = PBXBuildFile; fileRef = C98A32262A05795E00E3FA13 /* Task+Timeout.swift */; };
C98A32282A05795E00E3FA13 /* Task+Timeout.swift in Sources */ = {isa = PBXBuildFile; fileRef = C98A32262A05795E00E3FA13 /* Task+Timeout.swift */; };
C98B8B4029FBF83B009789C8 /* NotificationCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = C98B8B3F29FBF83B009789C8 /* NotificationCard.swift */; };
Expand Down Expand Up @@ -1053,6 +1053,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
C9887D812D1EF3C400CF9101 /* Inject in Frameworks */,
C9DEC068298965270078B43A /* Starscream in Frameworks */,
C9FD35132BCED5A6008F8D95 /* NostrSDK in Frameworks */,
C9B71DC02A8E9BAD0031ED9F /* SentrySwiftUI in Frameworks */,
Expand Down Expand Up @@ -2922,6 +2923,7 @@
MACOSX_DEPLOYMENT_TARGET = 13.3;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
OTHER_LDFLAGS = "";
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
};
Expand Down Expand Up @@ -3092,6 +3094,7 @@
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
Expand Down Expand Up @@ -3142,6 +3145,11 @@
LOCALIZED_STRING_SWIFTUI_SUPPORT = NO;
MACOSX_DEPLOYMENT_TARGET = 13.3;
MARKETING_VERSION = 1.0.4;
OTHER_LDFLAGS = "";
"OTHER_LDFLAGS[sdk=iphonesimulator*]" = (
"-Xlinker",
"-interposable",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.verse.Nos-dev";
PRODUCT_MODULE_NAME = Nos;
PRODUCT_NAME = "$(TARGET_NAME) Dev";
Expand Down Expand Up @@ -3309,6 +3317,7 @@
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
Expand Down Expand Up @@ -3367,6 +3376,7 @@
MACOSX_DEPLOYMENT_TARGET = 13.3;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
OTHER_LDFLAGS = "";
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
};
Expand Down
129 changes: 120 additions & 9 deletions Nos/Views/AppView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Inject
struct AppView: View {

@State var showNewPost = false
@State var newPostContents: String?
@State var newPostContents: String?

@Environment(AppController.self) var appController
@EnvironmentObject private var router: Router
Expand All @@ -22,15 +22,126 @@ struct AppView: View {

var body: some View {
ZStack {
switch appController.currentState {
case .loading:
SplashScreenView()
.ignoresSafeArea()
case .onboarding:
if appController.currentState == .onboarding {
OnboardingView(completion: appController.completeOnboarding)
case .loggedIn:
tabView

} else {
TabView(selection: $router.selectedTab) {
if let author = currentUser.author {
HomeTab(user: author)
.tabItem {
VStack {
let text = Text("homeFeed")
if $router.selectedTab.wrappedValue == .home {
Image.tabIconHomeSelected
text
} else {
Image.tabIconHome
text.foregroundColor(.secondaryTxt)
}
}
}
.toolbarBackground(.visible, for: .tabBar)
.toolbarBackground(Color.cardBgBottom, for: .tabBar)
.tag(AppDestination.home)
.onAppear {
// TODO: Move this somewhere better like CurrentUser when it becomes the source of truth
// for who is logged in
if let keyPair = currentUser.keyPair {
analytics.identify(
with: keyPair,
nip05: currentUser.author?.nip05
)
crashReporting.identify(with: keyPair)
}
}
}

DiscoverTab()
.tabItem {
VStack {
let text = Text("discover")
if $router.selectedTab.wrappedValue == .discover {
Image.tabIconEveryoneSelected
text.foregroundColor(.primaryTxt)
} else {
Image.tabIconEveryone
text.foregroundColor(.secondaryTxt)
}
}
}
.toolbarBackground(.visible, for: .tabBar)
.toolbarBackground(Color.cardBgBottom, for: .tabBar)
.tag(AppDestination.discover)

VStack {}
.tabItem {
VStack {
Image.newPostButton
Text("post")
}
}
.tag(AppDestination.noteComposer(nil))

NotificationsView(user: currentUser.author)
.tabItem {
VStack {
let text = Text("notifications")
if $router.selectedTab.wrappedValue == .notifications {
Image.tabIconNotificationsSelected
text.foregroundColor(.primaryTxt)
} else {
Image.tabIconNotifications
text.foregroundColor(.secondaryTxt)
}
}
}
.toolbarBackground(.visible, for: .tabBar)
.toolbarBackground(Color.cardBgBottom, for: .tabBar)
.tag(AppDestination.notifications)
.badge(pushNotificationService.badgeCount)

if let author = currentUser.author {
ProfileTab(author: author, path: $router.profilePath)
.tabItem {
VStack {
let text = Text("profileTitle")
if $router.selectedTab.wrappedValue == .profile {
Image.tabProfileSelected
text.foregroundColor(.primaryTxt)
} else {
Image.tabProfile
text.foregroundColor(.secondaryTxt)
}
}
}
.toolbarBackground(.visible, for: .tabBar)
.toolbarBackground(Color.cardBgBottom, for: .tabBar)
.tag(AppDestination.profile)
}
}
.onChange(of: router.selectedTab) { _, newTab in
if case let AppDestination.noteComposer(contents) = newTab {
newPostContents = contents
showNewPost = true
router.selectedTab = lastSelectedTab
} else if !showNewPost {
lastSelectedTab = newTab
}
}
.overlay {
if router.isLoading {
ZStack {
Rectangle().fill(.black.opacity(0.4))
ProgressView()
}
}
}
.sheet(isPresented: $showNewPost, content: {
NoteComposer(initialContents: newPostContents, isPresented: $showNewPost)
.environment(currentUser)
.interactiveDismissDisabled()
})

SideMenu(
menuWidth: 300,
menuOpened: router.sideMenuOpened,
Expand Down

0 comments on commit 9aeed9c

Please sign in to comment.