Skip to content

Commit

Permalink
Brand new settings
Browse files Browse the repository at this point in the history
  • Loading branch information
yury committed Dec 24, 2021
1 parent 780a3dc commit 9fd92bd
Show file tree
Hide file tree
Showing 11 changed files with 249 additions and 60 deletions.
4 changes: 4 additions & 0 deletions Blink.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@
D2903F3C239BBF5D005F991B /* KeyShortcut.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2903F3B239BBF5D005F991B /* KeyShortcut.swift */; };
D29392B72004D785001FB2AA /* hterm_all.patches.js in Resources */ = {isa = PBXBuildFile; fileRef = D29392B62004D785001FB2AA /* hterm_all.patches.js */; };
D29568B921BE629100480A83 /* bk_getopts.c in Sources */ = {isa = PBXBuildFile; fileRef = D29568B821BE629100480A83 /* bk_getopts.c */; };
D297DF002774962600A20265 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D297DEFF2774962600A20265 /* SettingsView.swift */; };
D29B4A92274D206C00C66ED9 /* BrowserController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D29B4A8D274D1E9F00C66ED9 /* BrowserController.swift */; };
D29D6C3122DB9CA700A84173 /* TermController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D29D6C3022DB9CA700A84173 /* TermController.swift */; };
D29FE54A208DC860004679D0 /* commandDictionary.plist in Resources */ = {isa = PBXBuildFile; fileRef = D29FE548208DC860004679D0 /* commandDictionary.plist */; };
Expand Down Expand Up @@ -984,6 +985,7 @@
D29392B62004D785001FB2AA /* hterm_all.patches.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = hterm_all.patches.js; sourceTree = "<group>"; };
D29568B721BE629100480A83 /* bk_getopts.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = bk_getopts.h; sourceTree = "<group>"; };
D29568B821BE629100480A83 /* bk_getopts.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bk_getopts.c; sourceTree = "<group>"; };
D297DEFF2774962600A20265 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
D29B4A8D274D1E9F00C66ED9 /* BrowserController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrowserController.swift; sourceTree = "<group>"; };
D29D6C3022DB9CA700A84173 /* TermController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TermController.swift; sourceTree = "<group>"; };
D29FE548208DC860004679D0 /* commandDictionary.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = commandDictionary.plist; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1724,6 +1726,7 @@
C9B2E0111D6B612300B89F69 /* Network */,
C9B2E0141D6B612300B89F69 /* ViewControllers */,
803B99E2258381B200DC99C8 /* SettingsHostingController.swift */,
D297DEFF2774962600A20265 /* SettingsView.swift */,
);
path = Settings;
sourceTree = "<group>";
Expand Down Expand Up @@ -3081,6 +3084,7 @@
D20CBA5A2360324100D93301 /* CompleteUtils.swift in Sources */,
D2043EBF2771C283002E29AF /* MigratePageView.swift in Sources */,
D265FBC9231905AC0017EAC4 /* NSCoder+CodingKey.swift in Sources */,
D297DF002774962600A20265 /* SettingsView.swift in Sources */,
D2D878632695AEBA00F78018 /* HostView.swift in Sources */,
D241CBE023040734003D64A5 /* KBKeyViewSymbol.swift in Sources */,
D21DEE4A260DD3FE00D8E640 /* NewSEKeyView.swift in Sources */,
Expand Down
1 change: 1 addition & 0 deletions Blink/Blink-bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,6 @@ extern void ios_exit(int errorCode) __dead2; // set error code and exits from th
#import "BKHosts.h"
#import "UICKeyChainStore.h"
#import "BKiCloudSyncHandler.h"
#import "UIApplication+Version.h"

#endif /* Blink_bridge_h */
8 changes: 5 additions & 3 deletions Blink/SpaceController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -893,9 +893,11 @@ extension SpaceController {
}

DispatchQueue.main.async {
let storyboard = UIStoryboard(name: "Settings", bundle: nil)
let vc = storyboard.instantiateViewController(identifier: "NavSettingsController")
self.present(vc, animated: true, completion: nil)
let navCtrl = UINavigationController()
navCtrl.navigationBar.prefersLargeTitles = true
let s = SettingsHostingController.createSettings(nav: navCtrl)
navCtrl.setViewControllers([s], animated: false)
self.present(navCtrl, animated: true, completion: nil)
}
}

Expand Down
5 changes: 4 additions & 1 deletion Blink/Subscriptions/SubscriptionNag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class SubscriptionNag: NSObject {
return
}

self.nagTimer.invalidate()
self.nagTimer = Timer.scheduledTimer(
withTimeInterval: NagInterval,
repeats: true
Expand All @@ -62,7 +63,9 @@ class SubscriptionNag: NSObject {
NotificationCenter.default.post(name: .subscriptionNag, object: nil)
return
}
UserDefaults.standard.set(self._nagCount() + 1, forKey: NagTimer)
let nag = self._nagCount() + 1
print("nag ", Date.now, nag)
UserDefaults.standard.set(nag, forKey: NagTimer)
}
}

Expand Down
2 changes: 1 addition & 1 deletion KB/Native/Views/General/Chevron.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import SwiftUI
struct Chevron: View {
var body: some View {
Image(systemName:"chevron.right")
.foregroundColor(Color(UIColor.secondaryLabel))
.foregroundColor(Color(UIColor.tertiaryLabel))
.font(Font.subheadline.weight(Font.Weight.semibold))
}
}
14 changes: 14 additions & 0 deletions KB/Native/Views/General/NavButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,17 @@ struct NavButton<Details: View>: View {
}, label: { EmptyView() })
}
}
struct StoryBoardNavButton: View {
@EnvironmentObject var nav: Nav
var storyBoardID: String

var body: some View {
Button(action: {
// let rootView = self.details().environmentObject(self.nav)
// let vc = UIHostingController(rootView: rootView)
let storyboard = UIStoryboard(name: "Settings", bundle: nil)
let vc = storyboard.instantiateViewController(identifier: storyBoardID)
self.nav.navController.pushViewController(vc, animated: true)
}, label: { EmptyView() })
}
}
15 changes: 12 additions & 3 deletions KB/Native/Views/General/Row.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,17 @@ struct Row<Content: View, Details: View>: View {
}
}

struct Row_Previews: PreviewProvider {
static var previews: some View {
Row(content: {Text("Row")}, details: {EmptyView()})

struct RowWithStoryBoardId<Content: View>: View {
var content: () -> Content
var storyBoardId: String

var body: some View {
HStack {
content()
Spacer()
Chevron()
}
.overlay(StoryBoardNavButton(storyBoardID: storyBoardId))
}
}
Loading

0 comments on commit 9fd92bd

Please sign in to comment.