Skip to content

Commit

Permalink
Fix icon, update display name, search in toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimillian committed Jul 29, 2020
1 parent d1101ad commit 1fda685
Show file tree
Hide file tree
Showing 22 changed files with 249 additions and 48 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ A SwiftUI Reddit client for macOS
This is bleeding edge, you need macOS Big Sur beta and Xcode 12 beta.

![Image](Images/image1.png?)

If you want to login with your Reddit account building the project from the source you'll need to create a file `secrets.plist` in `Packages/Backend/Sources/Backend/Resources` with your Reddit app secret as `client_id` key/value.

I'll periodically release pre built version of the app in the repository.

The app is still early and SwiftUI on macOS is not that fast (yet) but I'm planning to release it on the Mac App Store with the release of Big Sur.
68 changes: 48 additions & 20 deletions RedditOs.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions RedditOs.xcodeproj/xcshareddata/xcschemes/RedditOs.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "69EACEFE24B63D5800303A16"
BuildableName = "RedditOs.app"
BuildableName = "Curiosity.app"
BlueprintName = "RedditOs"
ReferencedContainer = "container:RedditOs.xcodeproj">
</BuildableReference>
Expand Down Expand Up @@ -45,7 +45,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "69EACEFE24B63D5800303A16"
BuildableName = "RedditOs.app"
BuildableName = "Curiosity.app"
BlueprintName = "RedditOs"
ReferencedContainer = "container:RedditOs.xcodeproj">
</BuildableReference>
Expand All @@ -62,7 +62,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "69EACEFE24B63D5800303A16"
BuildableName = "RedditOs.app"
BuildableName = "Curiosity.app"
BlueprintName = "RedditOs"
ReferencedContainer = "container:RedditOs.xcodeproj">
</BuildableReference>
Expand Down
Binary file modified RedditOs/Assets.xcassets/AppIcon.appiconset/1024.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified RedditOs/Assets.xcassets/AppIcon.appiconset/128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified RedditOs/Assets.xcassets/AppIcon.appiconset/16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified RedditOs/Assets.xcassets/AppIcon.appiconset/256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified RedditOs/Assets.xcassets/AppIcon.appiconset/32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified RedditOs/Assets.xcassets/AppIcon.appiconset/512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified RedditOs/Assets.xcassets/AppIcon.appiconset/64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions RedditOs/Extensions/NSTextField.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// NSTextField.swift
// RedditOs
//
// Created by Thomas Ricouard on 28/07/2020.
//

import Foundation
import AppKit

extension NSTextField {
open override var focusRingType: NSFocusRingType {
get { .none }
set { }
}
}
6 changes: 3 additions & 3 deletions RedditOs/Features/Search/SearchSubredditsPopover.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import SwiftUI
import Backend

struct SearchSubredditsPopover: View {
struct PopoverSearchSubredditView: View {
@EnvironmentObject private var userData: LocalDataStore
@StateObject private var viewModel = SearchSubredditsViewModel()

Expand All @@ -21,7 +21,7 @@ struct SearchSubredditsPopover: View {
LoadingRow(text: nil)
} else if let results = viewModel.results {
ForEach(results) { result in
SubredditRow(subreddit: result).onTapGesture {
PopoverSearchSubredditRow(subreddit: result).onTapGesture {
userData.add(favorite: result)
}
}
Expand All @@ -40,6 +40,6 @@ struct SearchSubredditsPopover: View {

struct SearchSheet_Previews: PreviewProvider {
static var previews: some View {
SearchSubredditsPopover()
PopoverSearchSubredditView()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import SwiftUI
import Backend
import SDWebImageSwiftUI

struct SubredditRow: View {
struct PopoverSearchSubredditRow: View {
let subreddit: SubredditSmall

var body: some View {
Expand Down Expand Up @@ -43,10 +43,10 @@ struct SubredditRow: View {
struct SubredditRow_Previews: PreviewProvider {
static var previews: some View {
List {
SubredditRow(subreddit: static_subreddit)
SubredditRow(subreddit: static_subreddit)
SubredditRow(subreddit: static_subreddit)
SubredditRow(subreddit: static_subreddit)
PopoverSearchSubredditRow(subreddit: static_subreddit)
PopoverSearchSubredditRow(subreddit: static_subreddit)
PopoverSearchSubredditRow(subreddit: static_subreddit)
PopoverSearchSubredditRow(subreddit: static_subreddit)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//
// SearchSubredditsPopover.swift
// RedditOs
//
// Created by Thomas Ricouard on 09/07/2020.
//

import SwiftUI
import Backend

struct PopoverSearchSubredditView: View {
@EnvironmentObject private var userData: LocalDataStore
@StateObject private var viewModel = PopoverSearchSubredditViewModel()

var body: some View {
List {
TextField("Search", text: $viewModel.searchText)
.textFieldStyle(RoundedBorderTextFieldStyle())
.padding(.vertical, 8)
if viewModel.isLoading {
LoadingRow(text: nil)
} else if let results = viewModel.results {
ForEach(results) { result in
PopoverSearchSubredditRow(subreddit: result).onTapGesture {
userData.add(favorite: result)
}
}
}
}
.navigationTitle("Search")
.toolbar {
ToolbarItem(placement: .navigation) {
Button(action: {}) {
Image(systemName: "xmark.circle")
}
}
}
}
}

struct SearchSheet_Previews: PreviewProvider {
static var previews: some View {
PopoverSearchSubredditView()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import SwiftUI
import Combine
import Backend

class SearchSubredditsViewModel: ObservableObject {
class PopoverSearchSubredditViewModel: ObservableObject {
@Published var searchText = ""
@Published var results: [SubredditSmall]?
@Published var isLoading = false
Expand Down
34 changes: 34 additions & 0 deletions RedditOs/Features/Search/ToolbarSearchBar.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// ToolbarSearchBar.swift
// RedditOs
//
// Created by Thomas Ricouard on 28/07/2020.
//

import SwiftUI

struct ToolbarSearchBar: View {
@State private var isFocused = false
@State private var searchText = ""

var body: some View {
TextField("Search anything", text: $searchText) { editing in
isFocused = editing
} onCommit: {

}
.keyboardShortcut("f", modifiers: .command)
.padding(8)
.background(RoundedRectangle(cornerRadius: 8)
.stroke(isFocused ? Color.accentColor : Color.clear)
.background(Color.black.opacity(0.2).cornerRadius(8)))
.textFieldStyle(PlainTextFieldStyle())
.frame(width: 500)
}
}

struct ToolbarSearchBar_Previews: PreviewProvider {
static var previews: some View {
ToolbarSearchBar()
}
}
78 changes: 78 additions & 0 deletions RedditOs/Features/Settings/SettingsView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
//
// SettingsView.swift
// RedditOs
//
// Created by Thomas Ricouard on 26/07/2020.
//

import SwiftUI

struct SettingsView: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
.toolbar {
ToolbarItem {
Button(action: {

}, label: {
VStack {
Image(systemName: "gearshape").imageScale(.large)
Text("General")
}
})
}

ToolbarItem {
Button(action: {

}, label: {
VStack {
Image(systemName: "textformat.alt").imageScale(.large)
Text("Apperance")
}
})
}


ToolbarItem {
Button(action: {

}, label: {
VStack {
Image(systemName: "stop.circle").imageScale(.large)
Text("Filters")
}
})
}

ToolbarItem {
Button(action: {

}, label: {
VStack {
Image(systemName: "magnifyingglass").imageScale(.large)
Text("Search")
}
})
}


ToolbarItem {
Button(action: {

}, label: {
VStack {
Image(systemName: "person").imageScale(.large)
Text("Accounts")
}
})
}
}.frame(width: 1000, height: 500)
}
}

struct SettingsView_Previews: PreviewProvider {
static var previews: some View {
SettingsView()
}
}
2 changes: 1 addition & 1 deletion RedditOs/Features/Sidebar/Sidebar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ struct Sidebar: View {
}
.buttonStyle(BorderlessButtonStyle())
.popover(isPresented: $isSearchPopoverPresented) {
SearchSubredditsPopover().environmentObject(localData)
PopoverSearchSubredditView().environmentObject(localData)
}

Button {
Expand Down
16 changes: 4 additions & 12 deletions RedditOs/Features/Subreddit/SubredditPostsListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ struct SubredditPostsListView: View {
@EnvironmentObject private var localData: LocalDataStore
@StateObject private var viewModel: SubredditViewModel
@AppStorage("postDisplayMode") private var displayMode = SubredditPostRow.DisplayMode.large
@State private var isSearchSheetOpen = false

init(name: String) {
_viewModel = StateObject(wrappedValue: SubredditViewModel(name: name))
Expand Down Expand Up @@ -47,6 +46,10 @@ struct SubredditPostsListView: View {
.navigationTitle(viewModel.name.capitalized)
.navigationSubtitle(subtitle)
.toolbar {
ToolbarItem(placement: .primaryAction) {
ToolbarSearchBar()
}

ToolbarItem(placement: .primaryAction) {
Picker(selection: $displayMode,
label: Text("Display"),
Expand Down Expand Up @@ -75,17 +78,6 @@ struct SubredditPostsListView: View {
}
}

ToolbarItem(placement: .primaryAction) {
Button(action: {
isSearchSheetOpen = true
}) {
Image(systemName: "magnifyingglass")
}.popover(isPresented: $isSearchSheetOpen) {
SearchSubredditsPopover().environmentObject(localData)
}
.keyboardShortcut("f", modifiers: .command)
}

ToolbarItem(placement: .primaryAction) {
Button(action: {

Expand Down
2 changes: 2 additions & 0 deletions RedditOs/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
</array>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.news</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
</dict>
Expand Down
6 changes: 3 additions & 3 deletions RedditOs/RedditOsApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ struct RedditOsApp: App {
Button(action: {

}) {
Text("Seach")
}.keyboardShortcut("f", modifiers: .command)
Text("Search")
}
Button(action: {

}) {
Expand Down Expand Up @@ -67,7 +67,7 @@ struct RedditOsApp: App {
}

Settings {
Text("Hello world")
SettingsView()
}
}
}
Binary file added Sketches/AppIcon.sketch
Binary file not shown.

0 comments on commit 1fda685

Please sign in to comment.