Skip to content

Commit

Permalink
Merge pull request #443 from SUPLA/develop
Browse files Browse the repository at this point in the history
v24.11.01
  • Loading branch information
przemyslawzygmunt authored Nov 22, 2024
2 parents b65fbf3 + 772b513 commit 567d6f1
Show file tree
Hide file tree
Showing 62 changed files with 62,587 additions and 1,279 deletions.
16 changes: 8 additions & 8 deletions SUPLA.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@
A598CACB2CC2572300A784FA /* SwitchWithImpulseCounterValueStringProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = A598CACA2CC2572300A784FA /* SwitchWithImpulseCounterValueStringProvider.swift */; };
A598CACD2CC2998300A784FA /* DoubleFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = A598CACC2CC2997900A784FA /* DoubleFormatter.swift */; };
A598CAD12CC6D6A700A784FA /* GetChannelActionStringUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = A598CAD02CC6D6A400A784FA /* GetChannelActionStringUseCase.swift */; };
A598CAD32CC6E5DA00A784FA /* LocalizedString+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = A598CAD22CC6E5CE00A784FA /* LocalizedString+Ext.swift */; };
A598CAD32CC6E5DA00A784FA /* LocalizedStringId+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = A598CAD22CC6E5CE00A784FA /* LocalizedStringId+Ext.swift */; };
A598CAD62CC6E92400A784FA /* Int+SuplaChannelFunction.swift in Sources */ = {isa = PBXBuildFile; fileRef = A598CAD52CC6E91D00A784FA /* Int+SuplaChannelFunction.swift */; };
A598CAD82CC77D3F00A784FA /* PieChartData.swift in Sources */ = {isa = PBXBuildFile; fileRef = A598CAD72CC77D3A00A784FA /* PieChartData.swift */; };
A598CADA2CC7977700A784FA /* SuplaPieChartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A598CAD92CC7977200A784FA /* SuplaPieChartView.swift */; };
Expand Down Expand Up @@ -2240,7 +2240,7 @@
A598CACA2CC2572300A784FA /* SwitchWithImpulseCounterValueStringProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwitchWithImpulseCounterValueStringProvider.swift; sourceTree = "<group>"; };
A598CACC2CC2997900A784FA /* DoubleFormatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DoubleFormatter.swift; sourceTree = "<group>"; };
A598CAD02CC6D6A400A784FA /* GetChannelActionStringUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetChannelActionStringUseCase.swift; sourceTree = "<group>"; };
A598CAD22CC6E5CE00A784FA /* LocalizedString+Ext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "LocalizedString+Ext.swift"; sourceTree = "<group>"; };
A598CAD22CC6E5CE00A784FA /* LocalizedStringId+Ext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "LocalizedStringId+Ext.swift"; sourceTree = "<group>"; };
A598CAD52CC6E91D00A784FA /* Int+SuplaChannelFunction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Int+SuplaChannelFunction.swift"; sourceTree = "<group>"; };
A598CAD72CC77D3A00A784FA /* PieChartData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PieChartData.swift; sourceTree = "<group>"; };
A598CAD92CC7977200A784FA /* SuplaPieChartView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SuplaPieChartView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3214,7 +3214,7 @@
407E7C331BBEB81B00D8878C /* Resources */ = {
isa = PBXGroup;
children = (
A598CAD22CC6E5CE00A784FA /* LocalizedString+Ext.swift */,
A598CAD22CC6E5CE00A784FA /* LocalizedStringId+Ext.swift */,
A5074BD42BCE9DB60081B6B1 /* Values */,
A530EE0B2A56C5C700F8DAEE /* Extensions */,
401CA1CC1BA067DB00117AF4 /* Resources.xcassets */,
Expand Down Expand Up @@ -7237,7 +7237,7 @@
A5F29BDA2A268DDE00ED700A /* DisposeBagContainer.swift in Sources */,
A5B3CBFE2B6274B800F95AC3 /* BaseDistanceValueStringProvider.swift in Sources */,
A5F29BD62A2623E500ED700A /* UserIconRepository.swift in Sources */,
A598CAD32CC6E5DA00A784FA /* LocalizedString+Ext.swift in Sources */,
A598CAD32CC6E5DA00A784FA /* LocalizedStringId+Ext.swift in Sources */,
A5E05BAF2CB46E3D00202583 /* BaseHumidityEntity.swift in Sources */,
A5AD70252C012F5300A36318 /* WindowControls.swift in Sources */,
A5D712632C37EB4900A8EF52 /* LockScreenVM.swift in Sources */,
Expand Down Expand Up @@ -8063,7 +8063,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = SUPLA/SUPLA.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CURRENT_PROJECT_VERSION = 206;
CURRENT_PROJECT_VERSION = 207;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = T6ZPGSWA75;
GCC_PREPROCESSOR_DEFINITIONS = (
Expand All @@ -8082,7 +8082,7 @@
"$(inherited)",
"$(PROJECT_DIR)/SUPLA/lib",
);
MARKETING_VERSION = 24.11;
MARKETING_VERSION = 24.11.01;
OTHER_SWIFT_FLAGS = "$(inherited) -D COCOAPODS -D DEBUG";
PRODUCT_BUNDLE_IDENTIFIER = com.acsoftware.ios.supla;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -8102,7 +8102,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = SUPLA/SUPLA.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CURRENT_PROJECT_VERSION = 206;
CURRENT_PROJECT_VERSION = 207;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = T6ZPGSWA75;
GCC_PREPROCESSOR_DEFINITIONS = (
Expand All @@ -8121,7 +8121,7 @@
"$(inherited)",
"$(PROJECT_DIR)/SUPLA/lib",
);
MARKETING_VERSION = 24.11;
MARKETING_VERSION = 24.11.01;
PRODUCT_BUNDLE_IDENTIFIER = com.acsoftware.ios.supla;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "SUPLA/SUPLA-Bridging-Header.h";
Expand Down
34 changes: 12 additions & 22 deletions SUPLA/ChannelCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#import "SuplaApp.h"
#import "proto.h"
#import "SUPLA-Swift.h"
#import "SharedCore/SharedCore.h"


@interface MGSwipeTableCell (ExposePrivateMethods)
Expand Down Expand Up @@ -54,6 +55,7 @@ @implementation SAChannelCell {
UITapGestureRecognizer *tapGr1;
UITapGestureRecognizer *tapGr2;
UILongPressGestureRecognizer *longPressGr;
SharedCoreGetChannelActionStringUseCase *getChannelActionStringUseCase;
}

@synthesize captionEditable;
Expand All @@ -67,6 +69,7 @@ -(void) prepareForReuse {
self.delegate = savedDelegate;

_disposeBagContainer = [[DisposeBagContainer alloc] init];
getChannelActionStringUseCase = [[SharedCoreGetChannelActionStringUseCase alloc] init];
}

- (void)initialize {
Expand Down Expand Up @@ -373,40 +376,27 @@ -(void) updateCellView {
MGSwipeButton *bl = nil;
MGSwipeButton *br = nil;

NSString *leftButtonText = [self leftButtonText:getChannelActionStringUseCase :_channelBase];
if (leftButtonText != nil) {
bl = [MGSwipeButton buttonWithTitle:leftButtonText icon:nil backgroundColor:[UIColor blackColor]];
}
NSString *rightButtonText = [self rightButtonText:getChannelActionStringUseCase :_channelBase];
if (rightButtonText != nil) {
br = [MGSwipeButton buttonWithTitle:rightButtonText icon:nil backgroundColor:[UIColor blackColor]];
}

switch(_channelBase.func) {
case SUPLA_CHANNELFNC_CONTROLLINGTHEDOORLOCK:
case SUPLA_CHANNELFNC_CONTROLLINGTHEGATEWAYLOCK:
br = [MGSwipeButton buttonWithTitle:NSLocalizedString(@"Open", nil) icon:nil backgroundColor:[UIColor blackColor]];
break;
case SUPLA_CHANNELFNC_CONTROLLINGTHEGATE:
case SUPLA_CHANNELFNC_CONTROLLINGTHEGARAGEDOOR:
br = [MGSwipeButton buttonWithTitle:NSLocalizedString(@"Open Close", nil) icon:nil backgroundColor:[UIColor blackColor]];
break;
case SUPLA_CHANNELFNC_POWERSWITCH:
case SUPLA_CHANNELFNC_LIGHTSWITCH:
case SUPLA_CHANNELFNC_STAIRCASETIMER:
case SUPLA_CHANNELFNC_RGBLIGHTING:
case SUPLA_CHANNELFNC_DIMMER:
case SUPLA_CHANNELFNC_DIMMERANDRGBLIGHTING:
case SUPLA_CHANNELFNC_THERMOSTAT_HEATPOL_HOMEPLUS:
br = [self makeButtonWithTitle: NSLocalizedString(@"On", nil)];
bl = [self makeButtonWithTitle: NSLocalizedString(@"Off", nil)];

if (_measurementSubChannel) {
[self.measuredValue setText:[[_channelBase attrStringValue] string]];
}
break;
case SUPLA_CHANNELFNC_VALVE_OPENCLOSE:
case SUPLA_CHANNELFNC_CONTROLLINGTHEROOFWINDOW:
case SUPLA_CHANNELFNC_CONTROLLINGTHEROLLERSHUTTER:
case SUPLA_CHANNELFNC_TERRACE_AWNING:
case SUPLA_CHANNELFNC_PROJECTOR_SCREEN:
case SUPLA_CHANNELFNC_CURTAIN:
case SUPLA_CHANNELFNC_VERTICAL_BLIND:
case SUPLA_CHANNELFNC_ROLLER_GARAGE_DOOR:
br = [MGSwipeButton buttonWithTitle:NSLocalizedString(@"Open", nil) icon:nil backgroundColor:[UIColor blackColor]];
bl = [MGSwipeButton buttonWithTitle:NSLocalizedString(@"Close", nil) icon:nil backgroundColor:[UIColor blackColor]];
break;
}

if ( br ) {
Expand Down
27 changes: 26 additions & 1 deletion SUPLA/Core/Branding/BrandingConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,37 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

import SwiftUI

@objc public final class BrandingConfiguration: NSObject {

@objc(BrandingConfigurationMenu) public final class Menu: NSObject {
@objc static let DEVICES_OPTION_VISIBLE = true
@objc static let Z_WAVE_OPTION_VISIBLE = true
@objc static let ABOUT_OPTION_VISIBLE = true
@objc static let HELP_OPTION_VISIBLE = true
}

static let SHOW_LICENCE = true
static let ASK_FOR_RATE = true

public enum About {
static let LOGO: ImageResource = .logoLight
static let COLOR_FILLER: Color = .Supla.onBackground
}

public enum Status {
static let LOGO: ImageResource = .logoLight
static let COLOR_FILLER: Color = .Supla.primary
}

public enum LockScreen {
static let LOGO: ImageResource = .logoWithName
}

public enum ProjectorScreen {
static let LOGO: UIImage = .logo!.withTintColor(.primary)
static let ALPHA: CGFloat = 0.2
static let LOGO_WIDTH: CGFloat = 120
static let LOGO_HEIGHT: CGFloat = 137
}
}
11 changes: 11 additions & 0 deletions SUPLA/Core/Legacy/ChannelCell+Ext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import Foundation
import RxSwift
import SharedCore

extension SAChannelCell {

Expand Down Expand Up @@ -78,6 +79,16 @@ extension SAChannelCell {
}
}

@objc
func leftButtonText(_ getChannelActionStringUseCase: SharedCore.GetChannelActionStringUseCase, _ channelBase: SAChannelBase) -> String? {
getChannelActionStringUseCase.leftButton(function: channelBase.func.suplaFunction())?.value
}

@objc
func rightButtonText(_ getChannelActionStringUseCase: SharedCore.GetChannelActionStringUseCase, _ channelBase: SAChannelBase) -> String? {
getChannelActionStringUseCase.rightButton(function: channelBase.func.suplaFunction())?.value
}

private func executeSimpleAction(channelBase: SAChannelBase, action: Action) {
DiContainer.shared.resolve(type: VibrationService.self)?.vibrate()

Expand Down
2 changes: 1 addition & 1 deletion SUPLA/Features/About/AboutVM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ extension AboutFeature {
}

func onHomePageClick() {
coordinator.openUrl(url: "https://www.supla.org")
coordinator.openUrl(url: "https://\(Strings.About.address)")
}
}
}
9 changes: 6 additions & 3 deletions SUPLA/Features/About/AboutView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@ extension AboutFeature {
var body: some SwiftUI.View {
BackgroundStack {
VStack(spacing: Dimens.distanceDefault) {
Image(.logoLight)
Spacer()
Image(BrandingConfiguration.About.LOGO)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(maxHeight: 100)
.foregroundColor(Color.Supla.onBackground)
.foregroundColor(BrandingConfiguration.About.COLOR_FILLER)
Text.HeadlineLarge(text: Strings.appName)
Text.BodyMedium(text: Strings.About.version.arguments(viewState.version))
Text.LabelSmall(text: Strings.About.license)
if (BrandingConfiguration.SHOW_LICENCE) {
Text.LabelSmall(text: Strings.About.license)
}
Spacer()
TextButton(
title: Strings.About.address,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ struct ProjectorScreenColors {
let shadow: UIColor
let bottomRect: UIColor
let topRect: UIColor
let logoColor: UIColor
let disabledOverlay: UIColor

static func standard(_ traitCollection: UITraitCollection) -> ProjectorScreenColors {
Expand All @@ -30,7 +29,6 @@ struct ProjectorScreenColors {
shadow: .black,
bottomRect: .rollerShutterSlatBackground.resolvedColor(with: traitCollection),
topRect: .gray.resolvedColor(with: traitCollection),
logoColor: .primary.copy(alpha: 0.2),
disabledOverlay: .rollerShutterDisabledOverlay.resolvedColor(with: traitCollection)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Foundation
final class ProjectorScreenView: BaseWindowView<ProjectorScreenState> {
override var isEnabled: Bool {
didSet {
logo = UIImage.logo?.withTintColor(colors.logoColor)
logo = BrandingConfiguration.ProjectorScreen.LOGO
setNeedsDisplay()
}
}
Expand All @@ -30,7 +30,7 @@ final class ProjectorScreenView: BaseWindowView<ProjectorScreenState> {

private let dimens = RuntimeDimens()
private lazy var colors = ProjectorScreenColors.standard(traitCollection)
private lazy var logo = UIImage.logo?.withTintColor(colors.logoColor)
private lazy var logo = BrandingConfiguration.ProjectorScreen.LOGO

override init(frame: CGRect) {
super.init(frame: frame)
Expand Down Expand Up @@ -69,11 +69,9 @@ final class ProjectorScreenView: BaseWindowView<ProjectorScreenState> {
// Logo
context.saveGState()
context.clip(to: screenRect)
if let logo = logo {
let verticalCorrection = screenHeight - dimens.screenMaxHeight
context.setShadow(offset: .zero, blur: 0)
logo.draw(in: dimens.logoRect.offsetBy(dx: 0, dy: verticalCorrection))
}
let verticalCorrection = screenHeight - dimens.screenMaxHeight
context.setShadow(offset: .zero, blur: 0)
logo.draw(in: dimens.logoRect.offsetBy(dx: 0, dy: verticalCorrection), blendMode: .normal, alpha: BrandingConfiguration.ProjectorScreen.ALPHA)
context.restoreGState()
// top part
drawPath(context, fillColor: colors.topRect, withShadow: true) {
Expand Down Expand Up @@ -143,8 +141,8 @@ private enum DefaultDimens {
static let bottomRectWidth: CGFloat = 304
static let screenWidth: CGFloat = 288

static let logoWidth: CGFloat = 120
static let logoHeight: CGFloat = 137
static let logoWidth: CGFloat = BrandingConfiguration.ProjectorScreen.LOGO_WIDTH
static let logoHeight: CGFloat = BrandingConfiguration.ProjectorScreen.LOGO_HEIGHT
static let logoTopMargin: CGFloat = 50
}

Expand Down
5 changes: 4 additions & 1 deletion SUPLA/Features/LockScreen/LockScreenView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ extension LockScreenFeature {
BackgroundStack {
VStack(spacing: Dimens.distanceSmall) {
if (viewState.unlockAction?.showLogo == true) {
Image(.logoWithName)
Image(BrandingConfiguration.LockScreen.LOGO)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(maxWidth: 144)
}
if let message = viewState.unlockAction?.message {
Text.HeadlineSmall(text: message)
Expand Down
4 changes: 2 additions & 2 deletions SUPLA/Features/LockScreen/UnlockAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ extension LockScreenFeature {
switch (self) {
case .authorizeApplication: Strings.LockScreen.hello
case .turnOffPin: Strings.LockScreen.removePin
case .confirmAuthorizeApplication: Strings.LockScreen.confirmAuthorizeApp
case .confirmAuthorizeAccounts: Strings.LockScreen.confirmAuthorizeAccounts
case .confirmAuthorizeApplication, .confirmAuthorizeAccounts:
Strings.LockScreen.confirmAuthorizeRangeChange
default: nil
}
}
Expand Down
4 changes: 3 additions & 1 deletion SUPLA/Features/Main/MainVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ class MainVC: SuplaTabBarController<MainViewState, MainViewEvent, MainViewModel>
} else {
viewModel.onViewAppear()
showNewGestureInfoView()
SARateApp().showDialog(withDelay: 1)
if (BrandingConfiguration.ASK_FOR_RATE) {
SARateApp().showDialog(withDelay: 1)
}
updateBottomBarLabels()
tabBar.isHidden = !settings.showBottomMenu
}
Expand Down
4 changes: 2 additions & 2 deletions SUPLA/Features/Status/StatusView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ private struct ConnectionStatusView: View {
var body: some View {
VStack(spacing: Dimens.distanceSmall) {
Spacer()
Image(uiImage: .logoLight!)
Image(BrandingConfiguration.Status.LOGO)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 140, height: 140)
.foregroundColor(.Supla.primary)
.foregroundColor(BrandingConfiguration.Status.COLOR_FILLER)
Text.BodyMedium(text: text)
Spacer()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import SharedCore

extension Int32 {
var suplaFuntion: SuplaChannelFunction {
return SuplaChannelFunction.companion.from(value: self)
var suplaFuntion: SuplaFunction {
return SuplaFunction.companion.from(value: self)
}
}
4 changes: 1 addition & 3 deletions SUPLA/Resources/Default.strings
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@
"thermostat_detail_main_thermostat" = "Main thermostat";
"thermostat_detail_other_thermostats" = "Ohter thermostats";


/* Combined Chart */
"history_range_label" = "Range";
"history_data_type" = "Data type";
Expand Down Expand Up @@ -273,8 +272,7 @@
"lock_screen_hello" = "Welcome back!";
"lock_screen_enter_pin" = "Enter PIN";
"lock_screen_remove_pin" = "PIN removal";
"lock_screen_confirm_authorize_app" = "Authorization scope change - application";
"lock_screen_confirm_authorize_accounts" = "Authorization scope change - accounts";
"lock_screen_confirm_authorize_range_change" = "Authorization scope change";
"lock_screen_wrong_pin" = "Entered PIN is wrong!";
"lock_screen_forgotten_code" = "I don\'t remember my PIN code";
"lock_screen_forgotten_code_title" = "Access code";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@

import SharedCore

extension LocalizedString {
extension LocalizedStringId {
var value: String {
switch (self) {
case .generalClose: Strings.General.close
case .generalOpen: Strings.General.open
case .generalOpenClose: Strings.General.openClose
case .generalTurnOn: Strings.General.turnOn
case .generalTurnOff: Strings.General.turnOff
case .generalShut: Strings.General.shut
Expand Down
Loading

0 comments on commit 567d6f1

Please sign in to comment.