Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/openhab/openhab-ios into…
Browse files Browse the repository at this point in the history
… settings2swiftui
  • Loading branch information
timbms committed Sep 12, 2024
2 parents 879e4e7 + fc036ee commit fbb03ac
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 28 deletions.
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
type: choice
description: 'Select version bump type:'
options:
- none
- patch
- minor
- major
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ import Foundation

public class OpenHABCommandOptions: Decodable {
public var command = ""
public var label = ""
public var label: String? = ""
}
2 changes: 1 addition & 1 deletion OpenHABCore/Sources/OpenHABCore/Model/OpenHABWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public class OpenHABWidget: NSObject, MKAnnotation, Identifiable {

public var mappingsOrItemOptions: [OpenHABWidgetMapping] {
if mappings.isEmpty, let commandOptions = item?.commandDescription?.commandOptions {
commandOptions.map { OpenHABWidgetMapping(command: $0.command, label: $0.label) }
commandOptions.map { OpenHABWidgetMapping(command: $0.command, label: $0.label ?? "") }
} else if mappings.isEmpty, let stateOptions = item?.stateDescription?.options {
stateOptions.map { OpenHABWidgetMapping(command: $0.value, label: $0.label) }
} else {
Expand Down
2 changes: 1 addition & 1 deletion fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ platform :ios do

type = options[:bump]

if !options[:isfeaturebuild]
if !options[:isfeaturebuild] && type != 'none'
increment_version_number_in_xcodeproj(
bump_type: type,
xcodeproj: 'openHAB.xcodeproj',
Expand Down
48 changes: 24 additions & 24 deletions openHAB.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1643,7 +1643,7 @@
CODE_SIGN_ENTITLEMENTS = openHABIntents/openHABIntents.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 12;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = PBAPXHRAM9;
GCC_C_LANGUAGE_STANDARD = gnu11;
Expand All @@ -1657,7 +1657,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 3.0.5;
MARKETING_VERSION = 3.0.6;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = org.openhab.app.openHABIntents;
Expand Down Expand Up @@ -1686,7 +1686,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 12;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = PBAPXHRAM9;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = PBAPXHRAM9;
Expand All @@ -1700,7 +1700,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 3.0.5;
MARKETING_VERSION = 3.0.6;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = org.openhab.app.openHABIntents;
Expand All @@ -1727,7 +1727,7 @@
CODE_SIGN_ENTITLEMENTS = NotificationService/NotificationService.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 12;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = PBAPXHRAM9;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
Expand All @@ -1746,7 +1746,7 @@
"@executable_path/../../Frameworks",
);
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MARKETING_VERSION = 3.0.5;
MARKETING_VERSION = 3.0.6;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = org.openhab.app.NotificationService;
Expand Down Expand Up @@ -1774,7 +1774,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 12;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = PBAPXHRAM9;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = PBAPXHRAM9;
Expand All @@ -1793,7 +1793,7 @@
"@executable_path/../../Frameworks",
);
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MARKETING_VERSION = 3.0.5;
MARKETING_VERSION = 3.0.6;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = org.openhab.app.NotificationService;
Expand All @@ -1820,7 +1820,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 12;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = PBAPXHRAM9;
GCC_C_LANGUAGE_STANDARD = gnu11;
Expand All @@ -1831,7 +1831,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 3.0.5;
MARKETING_VERSION = 3.0.6;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = es.spaphone.openHABUITests;
Expand Down Expand Up @@ -1866,7 +1866,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 12;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = PBAPXHRAM9;
GCC_C_LANGUAGE_STANDARD = gnu11;
Expand All @@ -1877,7 +1877,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 3.0.5;
MARKETING_VERSION = 3.0.6;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = es.spaphone.openHABUITests;
Expand Down Expand Up @@ -1911,7 +1911,7 @@
CODE_SIGN_ENTITLEMENTS = "openHABWatch Extension/openHABWatch Extension.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 12;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = PBAPXHRAM9;
GCC_C_LANGUAGE_STANDARD = "compiler-default";
Expand All @@ -1922,7 +1922,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 3.0.5;
MARKETING_VERSION = 3.0.6;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = org.openhab.app.watchkitapp;
Expand Down Expand Up @@ -1957,7 +1957,7 @@
"CODE_SIGN_IDENTITY[sdk=watchos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 12;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = PBAPXHRAM9;
"DEVELOPMENT_TEAM[sdk=watchos*]" = PBAPXHRAM9;
Expand All @@ -1969,7 +1969,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 3.0.5;
MARKETING_VERSION = 3.0.6;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = org.openhab.app.watchkitapp;
Expand Down Expand Up @@ -2001,7 +2001,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 12;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = PBAPXHRAM9;
GCC_C_LANGUAGE_STANDARD = gnu11;
Expand All @@ -2012,7 +2012,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 3.0.5;
MARKETING_VERSION = 3.0.6;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.reg-labs.openHABTestsSwift";
Expand Down Expand Up @@ -2044,7 +2044,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 12;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = PBAPXHRAM9;
GCC_C_LANGUAGE_STANDARD = gnu11;
Expand All @@ -2055,7 +2055,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 3.0.5;
MARKETING_VERSION = 3.0.6;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.reg-labs.openHABTestsSwift";
Expand Down Expand Up @@ -2203,7 +2203,7 @@
CODE_SIGN_ENTITLEMENTS = openHAB/openHAB.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 12;
DEVELOPMENT_TEAM = PBAPXHRAM9;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "openHAB/openHAB-Prefix.pch";
Expand All @@ -2218,7 +2218,7 @@
"@loader_path/../../Frameworks",
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
MARKETING_VERSION = 3.0.5;
MARKETING_VERSION = 3.0.6;
OTHER_SWIFT_FLAGS = "$(inherited) -DDEBUG -Xfrontend -warn-long-expression-type-checking=200 -Xfrontend -warn-long-function-bodies=200";
PRODUCT_BUNDLE_IDENTIFIER = org.openhab.app;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -2247,7 +2247,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 12;
DEVELOPMENT_TEAM = PBAPXHRAM9;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = PBAPXHRAM9;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
Expand All @@ -2263,7 +2263,7 @@
"@loader_path/../../Frameworks",
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
MARKETING_VERSION = 3.0.5;
MARKETING_VERSION = 3.0.6;
PRODUCT_BUNDLE_IDENTIFIER = org.openhab.app;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
Expand Down
5 changes: 5 additions & 0 deletions openHAB/OpenHABSitemapViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,12 @@ class OpenHABSitemapViewController: OpenHABViewController, GenericUITableViewCel
return sitemapPageCodingData.openHABSitemapPage
}()
} catch {
//Printing the error is the only way to actually get the real issue, localizedDescription is pretty useless here
print(error)
os_log("Should not throw %{PUBLIC}@", log: OSLog.remoteAccess, type: .error, error.localizedDescription)
DispatchQueue.main.async {
self.showPopupMessage(seconds: 5, title: NSLocalizedString("error", comment: ""), message: error.localizedDescription, theme: .error)
}
}

currentPage = openHABSitemapPage
Expand Down
5 changes: 5 additions & 0 deletions openHAB/OpenHABWebViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ class OpenHABWebViewController: OpenHABViewController {
// adds: window.webkit.messageHandlers.xxxx.postMessage to JS env
config.userContentController.add(self, name: "Native")
config.userContentController.addUserScript(WKUserScript(source: js, injectionTime: .atDocumentStart, forMainFrameOnly: false))

let webView = WKWebView(frame: view.bounds, configuration: config)
// Alow rotation of webview
webView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
Expand All @@ -233,6 +234,10 @@ class OpenHABWebViewController: OpenHABViewController {
// support dark mode and avoid white flashing when loading
webView.isOpaque = false
webView.backgroundColor = UIColor.clear
if UIDevice.current.userInterfaceIdiom == .pad {
// since ios 13 Safari sets the user agent to desktop mode on iPads so the view renders correctly with larger screens
webView.customUserAgent = "Mozilla/5.0 (iPad; CPU OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604.1"
}
if #available(iOS 16.4, *) {
webView.isInspectable = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class ObservableOpenHABWidget: NSObject, MKAnnotation, Identifiable, ObservableO

var mappingsOrItemOptions: [OpenHABWidgetMapping] {
if mappings.isEmpty, let commandOptions = item?.commandDescription?.commandOptions {
commandOptions.map { OpenHABWidgetMapping(command: $0.command, label: $0.label) }
commandOptions.map { OpenHABWidgetMapping(command: $0.command, label: $0.label ?? "") }
} else if mappings.isEmpty, let stateOptions = item?.stateDescription?.options {
stateOptions.map { OpenHABWidgetMapping(command: $0.value, label: $0.label) }
} else {
Expand Down

0 comments on commit fbb03ac

Please sign in to comment.