Skip to content

Commit

Permalink
Merge pull request #226 from lo-cafe/alpha
Browse files Browse the repository at this point in the history
Alpha
  • Loading branch information
frostplexx authored Nov 10, 2023
2 parents 3c13270 + ebdd069 commit 9ef3e81
Show file tree
Hide file tree
Showing 103 changed files with 3,398 additions and 460 deletions.
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 22 additions & 5 deletions TestFlight/WhatToTest.en-US.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
A big update is coming soon, sorry for the wait.
# Added

--- QUICK EXPRESS UPDATE ---
- Fixed subs order
- Fixed subs filtering
- Fixed favoriting subs not working properly
- Live Text
- Whats new Sheet
- Lock the app
- Theme Store
- Subscribed indicator / button when searching for subs
- Add settings import / export
- Add line spacing option for themes
- New comments indicator
- Added flairs in comments

# Fixed

- "Streamable" videos now working
- Blur nsfw when searching for subs
- Default search sort in settings
- Save sort per subreddit
- Save comment search per port
- Support for themable user flairs
- Add theming for load more button

Special thanks to rbertus2000, mmynk, Nelson Dane, Zander Bobronnikov and ben-wheeler for contributing to this release!
37 changes: 37 additions & 0 deletions TestFlight/changelog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"title": "What's new in Winston",
"version": "1.0.0",
"features": [
{
"subtitle": "We've added a cool new What's New sheet!",
"systemImage": "star",
"title": "What's New sheet"
},
{
"subtitle": "Want to copy text you see in an image? Now you can!",
"systemImage": "text.viewfinder",
"title": "Live Text"
},
{
"subtitle": "You can now lock Winston with a pin or biometrics.",
"systemImage": "lock",
"title": "Lock Winston"
},
{
"subtitle": "Download other peoples themes with the all new Theme Store.",
"systemImage": "paintpalette",
"title": "Theme Store"
},
{
"subtitle": "Wait didn't I read this already? With new comments indicators you dont need to ask yourself this question anymore!",
"systemImage": "person",
"title": "New Comments Indicator"
},
{
"subtitle": "Show some flair with...flairs! Winston now displays flairs in comments.",
"systemImage": "flag",
"title": "User Flairs in Comments"
}
],

}
4 changes: 2 additions & 2 deletions managed/CachedSub+CoreDataProperties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ extension CachedSub {
@NSManaged public var icon_img: String?
@NSManaged public var key_color: String?
@NSManaged public var name: String?
@NSManaged public var over_18: Bool
@NSManaged public var over18: Bool
@NSManaged public var primary_color: String?
@NSManaged public var restrict_commenting: Bool
@NSManaged public var subscribers: Double
Expand All @@ -51,7 +51,7 @@ extension CachedSub {
self.allow_galleries = x.allow_galleries ?? false
self.allow_images = x.allow_images ?? false
self.allow_videos = x.allow_videos ?? false
self.over_18 = x.over_18 ?? false
self.over18 = x.over18 ?? false
self.restrict_commenting = x.restrict_commenting ?? false
self.user_has_favorited = x.user_has_favorited ?? false
self.user_is_banned = x.user_is_banned ?? false
Expand Down
10 changes: 10 additions & 0 deletions winston.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:app.winston.lo.cafe</string>
</array>
</dict>
</plist>
166 changes: 160 additions & 6 deletions winston.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@
"version" : "12.1.6"
}
},
{
"identity" : "observed-optional-object",
"kind" : "remoteSourceControl",
"location" : "https://github.com/fourplusone/observed-optional-object.git",
"state" : {
"revision" : "74aa40a398688b90ee7724797861185e5a696aca",
"version" : "0.1.1"
}
},
{
"identity" : "opengraph",
"kind" : "remoteSourceControl",
Expand Down Expand Up @@ -189,6 +198,15 @@
"version" : "1.5.0"
}
},
{
"identity" : "whatsnewkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SvenTiigi/WhatsNewKit.git",
"state" : {
"revision" : "238dadc14dd58885f51037e63d08baf4275c480e",
"version" : "2.1.0"
}
},
{
"identity" : "youtubeplayerkit",
"kind" : "remoteSourceControl",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
endingColumnNumber = "9223372036854775807"
startingLineNumber = "50"
endingLineNumber = "50"
landmarkName = "sort(_:)"
landmarkType = "7">
landmarkName = "body"
landmarkType = "24">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
Expand Down
Binary file added winston/.DS_Store
Binary file not shown.
19 changes: 18 additions & 1 deletion winston/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,22 @@ import AVKit
import AVFoundation
import Nuke

class AppDelegate: NSObject, UIApplicationDelegate {
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
try? AVAudioSession.sharedInstance().setCategory(.playback, mode: .default, options: [.mixWithOthers])
return true
}

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
if let shortcutItem = options.shortcutItem {
shortcutItemToProcess = shortcutItem
}

let sceneConfiguration = UISceneConfiguration(name: "Custom Configuration", sessionRole: connectingSceneSession.role)
sceneConfiguration.delegateClass = CustomSceneDelegate.self

return sceneConfiguration
}
func applicationDidFinishLaunching(_ application: UIApplication) {
let defaultPipeline = ImagePipeline { config in
config.dataCache = try? DataCache(name: "lo.cafe.winston.datacache")
Expand All @@ -32,3 +43,9 @@ class AppDelegate: NSObject, UIApplicationDelegate {
ImagePipeline.shared = defaultPipeline
}
}

class CustomSceneDelegate: UIResponder, UIWindowSceneDelegate {
func windowScene(_ windowScene: UIWindowScene, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) {
shortcutItemToProcess = shortcutItem
}
}
Binary file added winston/Assets.xcassets/.DS_Store
Binary file not shown.
70 changes: 70 additions & 0 deletions winston/Biometrics.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//
// Biometrics.swift
// winston
//
// Created by Nelson Dane on 19/09/23.
//

import SwiftUI
import Foundation
import LocalAuthentication

class Biometrics {
let context = LAContext()
var error: NSError?

func checkIfEnrolled() -> Bool {
var isEnrolled = false
if context.canEvaluatePolicy(.deviceOwnerAuthentication, error: &error) {
print("Biometrics are available on this device")
isEnrolled = true
} else {
print("Biometrics are not available on this device")
}
return isEnrolled
}

func biometricType() -> String {
if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) {
if #available(iOS 11.0, *) {
switch context.biometryType {
case .opticID:
return "Optic ID"
case .faceID:
return "Face ID"
case .touchID:
return "Touch ID"
case .none:
return "None"
@unknown default:
return "Unknown"
}
} else {
// Fallback on earlier versions
return "Touch ID"
}
}
else {
// Fallback to passcode
return "Passcode"
}
}

func authenticateUser(completion: @escaping (Bool) -> Void) {
// Check if biomtrics are available
if !checkIfEnrolled() {
completion(false)
return
}
// We're all good, let's authenticate
context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: "Identify Yourself!") { success, error in
if success {
print("Auth Success")
completion(true)
} else {
print("Auth Failure: \(error?.localizedDescription ?? "Failed to authenticate")")
completion(false)
}
}
}
}
43 changes: 25 additions & 18 deletions winston/Tabber.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,27 @@ class TabPayload: ObservableObject {
struct Tabber: View {
@ObservedObject var tempGlobalState = TempGlobalState.shared
@ObservedObject var errorAlert = Oops.shared
@State var activeTab = TabIdentifier.posts
@State var activeTab: TabIdentifier

@State var credModalOpen = false
@State var importedThemeAlert = false

// @State var tabBarHeight: CGFloat?
// @State var tabBarHeight: CGFloat?
@StateObject private var inboxPayload = TabPayload("inboxRouter")
@StateObject private var mePayload = TabPayload("meRouter")
@StateObject private var postsPayload = TabPayload("postsRouter")
@StateObject private var searchPayload = TabPayload("searchRouter")
@StateObject private var settingsPayload = TabPayload("settingsRouter")
@Environment(\.useTheme) private var currentTheme
@Environment(\.colorScheme) private var colorScheme
@EnvironmentObject var themeStoreAPI: ThemeStoreAPI
@Default(.showUsernameInTabBar) private var showUsernameInTabBar
@Default(.showTestersCelebrationModal) private var showTestersCelebrationModal
@Default(.showTipJarModal) private var showTipJarModal


@State var sharedTheme: ThemeData? = nil
@State var showingSharedThemeSheet: Bool = false

var payload: [TabIdentifier:TabPayload] { [
.inbox: inboxPayload,
.me: mePayload,
Expand All @@ -79,7 +83,8 @@ struct Tabber: View {
}
}

init(theme: WinstonTheme, cs: ColorScheme) {
init(theme: WinstonTheme, cs: ColorScheme, activeTab: TabIdentifier) {
_activeTab = State(initialValue: activeTab) // Initialize activeTab
Tabber.updateTabAndNavBar(tabTheme: theme.general.tabBarBG, navTheme: theme.general.navPanelBG, cs)
}

Expand Down Expand Up @@ -216,9 +221,6 @@ struct Tabber: View {
Text("The theme was imported successfully. Enable it in \"Themes\" section in the Settings tab.")
}
.onAppear {
if showTestersCelebrationModal {
showTipJarModal = false
}
Defaults[.themesPresets] = Defaults[.themesPresets].filter { $0.id != "default" }
if Defaults[.multis].count != 0 || Defaults[.subreddits].count != 0 {
Defaults[.multis] = []
Expand All @@ -235,20 +237,28 @@ struct Tabber: View {
}
}
}
// .onChange(of: currentTheme.general.tabBarBG, perform: { val in
// Tabber.updateTabAndNavBar(tabTheme: val, navTheme: currentTheme.general.navPanelBG, colorScheme)
// })
// .onChange(of: currentTheme.general.navPanelBG, perform: { val in
// Tabber.updateTabAndNavBar(tabTheme: currentTheme.general.tabBarBG, navTheme: val, colorScheme)
// })
.onChange(of: RedditAPI.shared.loggedUser) { user in
if user.apiAppID == nil || user.apiAppSecret == nil {
withAnimation(spring) {
credModalOpen = true
}
}
}
.sheet(isPresented: $showingSharedThemeSheet, content: {
if let theme = sharedTheme {
ThemeStoreDetailsView(themeData: theme)
}
})
.onOpenURL { url in

if url.absoluteString.contains("winstonapp://theme/") {
let themeID = url.lastPathComponent
Task {
sharedTheme = await themeStoreAPI.fetchThemeByID(id: themeID)
showingSharedThemeSheet.toggle()
}
}

if url.absoluteString.hasSuffix(".winston") || url.absoluteString.hasSuffix(".zip") {
TempGlobalState.shared.globalLoader.enable("Importing...")
let result = importTheme(at: url)
Expand All @@ -275,9 +285,6 @@ struct Tabber: View {
}
}
}
.sheet(isPresented: $showTestersCelebrationModal) {
TestersCelebration()
}
.sheet(isPresented: $showTipJarModal) {
TipJar()
}
Expand All @@ -286,7 +293,7 @@ struct Tabber: View {
.interactiveDismissDisabled(true)
}
.accentColor(currentTheme.general.accentColor.cs(colorScheme).color())
// .id(currentTheme.general.tabBarBG)
// .id(currentTheme.general.tabBarBG)
}
}

Expand Down
Loading

0 comments on commit 9ef3e81

Please sign in to comment.