Skip to content

Commit

Permalink
ui fixes
Browse files Browse the repository at this point in the history
add navigation bar
  • Loading branch information
kosyloa committed Apr 4, 2024
1 parent 2374e2d commit ebd39cb
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 110 deletions.
4 changes: 2 additions & 2 deletions DXFeedFramework.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3083,7 +3083,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 5;
DEVELOPMENT_TEAM = 485XM3FRHB;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Samples/QuoteTableApp/Info.plist;
Expand Down Expand Up @@ -3117,7 +3117,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 5;
DEVELOPMENT_TEAM = 485XM3FRHB;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Samples/QuoteTableApp/Info.plist;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Release"
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
Expand Down
5 changes: 1 addition & 4 deletions Samples/QuoteTableApp/AddSymbolsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import DXFeedFramework

class AddSymbolsViewController: UIViewController {
@IBOutlet var symbolsTableView: UITableView!
@IBOutlet var titleLabel: UILabel!
@IBOutlet var activityIndicator: UIActivityIndicatorView!

var symbols = [InstrumentInfo]()
Expand All @@ -24,8 +23,6 @@ class AddSymbolsViewController: UIViewController {
symbols = dataProvider.allSymbols.sorted()
changeActivityIndicator()

titleLabel.textColor = .text

symbolsTableView.backgroundColor = .tableBackground
symbolsTableView.separatorStyle = .none

Expand Down Expand Up @@ -78,7 +75,7 @@ class AddSymbolsViewController: UIViewController {
@IBAction func cancelTouchUpInside(_ sender: UIButton) {
self.navigationController?.popViewController(animated: true)
}

func reloadData(symbols: [InstrumentInfo]) {
self.symbols = symbols.sorted()
changeActivityIndicator()
Expand Down
148 changes: 53 additions & 95 deletions Samples/QuoteTableApp/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Samples/QuoteTableApp/QuoteModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class QuoteModel {

init() {
formatter.minimumFractionDigits = 0
formatter.maximumFractionDigits = 2
formatter.maximumFractionDigits = 4
}

var ask: String {
Expand Down
19 changes: 15 additions & 4 deletions Samples/QuoteTableApp/QuoteTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,26 @@ class QuoteTableViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.navigationController?.interactivePopGestureRecognizer?.delegate = self
titleLabel.textColor = .text
self.view.backgroundColor = .tableBackground
self.quoteTableView.backgroundColor = .clear

quoteTableView.separatorStyle = .none

NotificationCenter.default.addObserver(forName: .selectedSymbolsChanged, object: nil, queue: nil) { [weak self] (notification) in
guard let strongSelf = self else {
return
}

strongSelf.loadQuotes()
}
loadQuotes()
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
}

func loadQuotes() {
let newSymbols = dataProvider.selectedSymbols
if symbols != newSymbols {
symbols = newSymbols
Expand All @@ -44,7 +55,7 @@ class QuoteTableViewController: UIViewController {
self.subscribe(false)
}
}

func subscribe(_ unlimited: Bool) {
if endpoint == nil {
try? SystemProperty.setProperty(DXEndpoint.ExtraPropery.heartBeatTimeout.rawValue, "15s")
Expand Down
7 changes: 7 additions & 0 deletions Samples/QuoteTableApp/SymbolsDataProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ extension InstrumentInfo: Comparable {
}
}

extension Notification.Name {
static let selectedSymbolsChanged = Notification.Name("selectedSymbolsChanged")

}

class SymbolsDataProvider {
static let kSelectedSymbolsKey = "kSelectedSymbolsKey"
static let kSymbolsKey = "kSymbolsKey"
Expand Down Expand Up @@ -59,10 +64,12 @@ class SymbolsDataProvider {
})
UserDefaults.standard.set(currentSymbols + newValues.sorted(), forKey: SymbolsDataProvider.kSelectedSymbolsKey)
UserDefaults.standard.synchronize()
NotificationCenter.default.post(name: .selectedSymbolsChanged, object: nil)
}

func changeSymbols(_ symbols: [String]) {
UserDefaults.standard.set(symbols, forKey: SymbolsDataProvider.kSelectedSymbolsKey)
UserDefaults.standard.synchronize()
NotificationCenter.default.post(name: .selectedSymbolsChanged, object: nil)
}
}
4 changes: 1 addition & 3 deletions Samples/QuoteTableApp/SymbolsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import Foundation
import UIKit

class SymbolsViewController: UIViewController {
@IBOutlet var titleLabel: UILabel!
@IBOutlet var symbolsTableView: UITableView!

var dataProvider = SymbolsDataProvider()
Expand All @@ -20,7 +19,6 @@ class SymbolsViewController: UIViewController {
symbolsTableView.setEditing(true, animated: false)
symbolsTableView.backgroundColor = .tableBackground
symbolsTableView.separatorStyle = .none
titleLabel.textColor = .text
view.backgroundColor = .tableBackground
}

Expand All @@ -36,7 +34,7 @@ class SymbolsViewController: UIViewController {
}

@IBAction func cancelTouchUpInside(_ sender: UIButton) {
self.dismiss(animated: true)
self.dismiss(animated: true)
}
}

Expand Down

0 comments on commit ebd39cb

Please sign in to comment.