Skip to content

Commit

Permalink
Merge pull request #156 from blackboxembedded/dashboards
Browse files Browse the repository at this point in the history
Portrait Dashboards
  • Loading branch information
blackboxembedded authored Oct 27, 2024
2 parents d261a3a + edd95dc commit 38b3e51
Show file tree
Hide file tree
Showing 35 changed files with 10,424 additions and 7,788 deletions.
10 changes: 10 additions & 0 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,13 @@ target 'WunderLINQ' do
pod 'UIMultiPicker', '~> 0.6.2'
pod 'Popovers', '~> 1.3.0'
end

post_install do |installer|
installer.generated_projects.each do |project|
project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0'
end
end
end
end
4 changes: 2 additions & 2 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ SPEC CHECKSUMS:
Popovers: 8690b055b2c9ef433492b40e081b1a0be5859437
UIMultiPicker: 29bf824c5251822ca4040b933f6204e617e6ba3f

PODFILE CHECKSUM: 7106fa9323947c6f0a08ae50fffa5d2e9e744694
PODFILE CHECKSUM: 38722fa9b39e37c5cad35620797a9b3d80da744a

COCOAPODS: 1.11.3
COCOAPODS: 1.14.3
4 changes: 2 additions & 2 deletions Pods/Manifest.lock

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

173 changes: 89 additions & 84 deletions Pods/Pods.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

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

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

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

2 changes: 1 addition & 1 deletion Pods/Target Support Files/CoreGPX/CoreGPX-Info.plist

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

3 changes: 2 additions & 1 deletion Pods/Target Support Files/CoreGPX/CoreGPX.debug.xcconfig

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

3 changes: 2 additions & 1 deletion Pods/Target Support Files/CoreGPX/CoreGPX.release.xcconfig

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

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

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

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

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

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

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

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

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

2 changes: 1 addition & 1 deletion Pods/Target Support Files/Popovers/Popovers-Info.plist

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

3 changes: 2 additions & 1 deletion Pods/Target Support Files/Popovers/Popovers.debug.xcconfig

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

3 changes: 2 additions & 1 deletion Pods/Target Support Files/Popovers/Popovers.release.xcconfig

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

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

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

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

4 changes: 2 additions & 2 deletions WunderLINQ.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1227,8 +1227,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/spotify/ios-sdk";
requirement = {
branch = master;
kind = branch;
kind = exactVersion;
version = 1.0.0;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down
45 changes: 23 additions & 22 deletions WunderLINQ/DashViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -191,22 +191,9 @@ class DashViewController: UIViewController, UIWebViewDelegate {
}

private func setupScreenOrientation() {
if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene {
let interfaceOrientation = windowScene.interfaceOrientation
if (interfaceOrientation.isPortrait){
// Remove next 3 lines for portrait dashboards
let offset = (dashView.frame.size.height / 2.0) - (dashView.frame.size.width / 2.0)
let translate = CGAffineTransform(translationX: 0.0, y: offset)
webView.transform = translate
// End
webView.frame.size.width = dashView.frame.size.width
webView.frame.size.height = dashView.frame.size.height
} else {
webView.transform = CGAffineTransform.identity
webView.frame.size.width = dashView.frame.size.width
webView.frame.size.height = dashView.frame.size.height
}
}
webView.transform = CGAffineTransform.identity
webView.frame.size.width = dashView.frame.size.width
webView.frame.size.height = dashView.frame.size.height
}

override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
Expand Down Expand Up @@ -345,6 +332,8 @@ class DashViewController: UIViewController, UIWebViewDelegate {
} else {
currentDashboard = currentDashboard + 1
}
// Save away current dashboard
UserDefaults.standard.set(currentDashboard, forKey: "lastDashboard")
updateDashboard()
}

Expand All @@ -355,6 +344,8 @@ class DashViewController: UIViewController, UIWebViewDelegate {
} else {
currentDashboard = currentDashboard - 1
}
// Save away current dashboard
UserDefaults.standard.set(currentDashboard, forKey: "lastDashboard")
updateDashboard()
}

Expand Down Expand Up @@ -386,6 +377,16 @@ class DashViewController: UIViewController, UIWebViewDelegate {
}

@objc func updateDashboard(){
// Orientation Check
var isPortrait = true
if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
windowScene.interfaceOrientation.isLandscape {
isPortrait = false
}
let safeArea = view.safeAreaLayoutGuide.layoutFrame
let usableWidth = safeArea.width * 2.5
let usableHeight = safeArea.height * 2.5

// Update Buttons
if (faults.getallActiveDesc().isEmpty){
faultsBtn.tintColor = UIColor.clear
Expand All @@ -398,28 +399,28 @@ class DashViewController: UIViewController, UIWebViewDelegate {
if (currentDashboard == 1){
DispatchQueue.global(qos: .userInitiated).async {
// Do long running task here
let xml = StandardDashboard.updateDashboard(self.currentInfoLine)
let xml = StandardDashboard.updateDashboard(self.currentInfoLine, isPortrait, usableHeight, usableWidth)
// Bounce back to the main thread to update the UI
DispatchQueue.main.async {
self.webView.loadHTMLString(xml.description, baseURL: nil)
self.webView.loadHTMLString(xml!.description, baseURL: nil)
}
}
} else if (currentDashboard == 2){
DispatchQueue.global(qos: .userInitiated).async {
// Do long running task here
let xml = SportDashboard.updateDashboard(self.currentInfoLine)
let xml = SportDashboard.updateDashboard(self.currentInfoLine, isPortrait, usableHeight, usableWidth)
// Bounce back to the main thread to update the UI
DispatchQueue.main.async {
self.webView.loadHTMLString(xml.description, baseURL: nil)
self.webView.loadHTMLString(xml!.description, baseURL: nil)
}
}
} else if (currentDashboard == 3){
DispatchQueue.global(qos: .userInitiated).async {
// Do long running task here
let xml = ADVDashboard.updateDashboard(self.currentInfoLine)
let xml = ADVDashboard.updateDashboard(self.currentInfoLine, isPortrait, usableHeight, usableWidth)
// Bounce back to the main thread to update the UI
DispatchQueue.main.async {
self.webView.loadHTMLString(xml.description, baseURL: nil)
self.webView.loadHTMLString(xml!.description, baseURL: nil)
}
}
}
Expand Down
Loading

0 comments on commit 38b3e51

Please sign in to comment.