Skip to content

Commit

Permalink
Issue #379: Support projector screen
Browse files Browse the repository at this point in the history
  • Loading branch information
mipolansk committed May 21, 2024
1 parent cb9e942 commit ad888b8
Show file tree
Hide file tree
Showing 29 changed files with 683 additions and 22 deletions.
46 changes: 45 additions & 1 deletion SUPLA.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,13 @@
A50B5D2D2BF49F7700918D18 /* TerraceAwningWindowState.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50B5D2C2BF49F7700918D18 /* TerraceAwningWindowState.swift */; };
A50B5D302BF4A10200918D18 /* TerraceAwningView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50B5D2F2BF4A10200918D18 /* TerraceAwningView.swift */; };
A50B5D332BF54FF300918D18 /* TerraceAwningVMTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50B5D322BF54FF300918D18 /* TerraceAwningVMTests.swift */; };
A50B5D362BFB6CD100918D18 /* ProjectorScreenVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50B5D352BFB6CD100918D18 /* ProjectorScreenVM.swift */; };
A50B5D382BFB6D1400918D18 /* ProjectorScreenState.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50B5D372BFB6D1400918D18 /* ProjectorScreenState.swift */; };
A50B5D3A2BFB6E3500918D18 /* ProjectorScreenVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50B5D392BFB6E3500918D18 /* ProjectorScreenVC.swift */; };
A50B5D3D2BFB6EA200918D18 /* ProjectorScreenView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50B5D3C2BFB6EA200918D18 /* ProjectorScreenView.swift */; };
A50B5D3F2BFC8BEA00918D18 /* ProjectorScreenColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50B5D3E2BFC8BEA00918D18 /* ProjectorScreenColors.swift */; };
A50B5D412BFC914000918D18 /* TerraceAwningColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50B5D402BFC914000918D18 /* TerraceAwningColors.swift */; };
A50B5D432BFC921B00918D18 /* RoofWindowColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50B5D422BFC921B00918D18 /* RoofWindowColors.swift */; };
A50CD3D12A4D78610012DD9B /* libc++abi.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = A50CD3D02A4D78610012DD9B /* libc++abi.tbd */; };
A50CD3D32A4D82ED0012DD9B /* DateProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50CD3D22A4D82ED0012DD9B /* DateProvider.swift */; };
A50CD3D62A4D99E60012DD9B /* UpdateTokenTaskTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50CD3D52A4D99E60012DD9B /* UpdateTokenTaskTests.swift */; };
Expand Down Expand Up @@ -1636,6 +1643,13 @@
A50B5D2C2BF49F7700918D18 /* TerraceAwningWindowState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TerraceAwningWindowState.swift; sourceTree = "<group>"; };
A50B5D2F2BF4A10200918D18 /* TerraceAwningView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TerraceAwningView.swift; sourceTree = "<group>"; };
A50B5D322BF54FF300918D18 /* TerraceAwningVMTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TerraceAwningVMTests.swift; sourceTree = "<group>"; };
A50B5D352BFB6CD100918D18 /* ProjectorScreenVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProjectorScreenVM.swift; sourceTree = "<group>"; };
A50B5D372BFB6D1400918D18 /* ProjectorScreenState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProjectorScreenState.swift; sourceTree = "<group>"; };
A50B5D392BFB6E3500918D18 /* ProjectorScreenVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProjectorScreenVC.swift; sourceTree = "<group>"; };
A50B5D3C2BFB6EA200918D18 /* ProjectorScreenView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProjectorScreenView.swift; sourceTree = "<group>"; };
A50B5D3E2BFC8BEA00918D18 /* ProjectorScreenColors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProjectorScreenColors.swift; sourceTree = "<group>"; };
A50B5D402BFC914000918D18 /* TerraceAwningColors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TerraceAwningColors.swift; sourceTree = "<group>"; };
A50B5D422BFC921B00918D18 /* RoofWindowColors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoofWindowColors.swift; sourceTree = "<group>"; };
A50CD3D02A4D78610012DD9B /* libc++abi.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++abi.tbd"; path = "usr/lib/libc++abi.tbd"; sourceTree = SDKROOT; };
A50CD3D22A4D82ED0012DD9B /* DateProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateProvider.swift; sourceTree = "<group>"; };
A50CD3D52A4D99E60012DD9B /* UpdateTokenTaskTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateTokenTaskTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3020,13 +3034,13 @@
A5074BBB2BCE5CBF0081B6B1 /* UI */ = {
isa = PBXGroup;
children = (
A50B5D3B2BFB6E9100918D18 /* ProjectorScreen */,
A50B5D2E2BF4A02B00918D18 /* TerraceAwning */,
A5074BCA2BCE6F2C0081B6B1 /* FacadeBlinds */,
A5074BC32BCE64A30081B6B1 /* WindowView */,
A5B3A4B72BB57B4D0001D006 /* RoofWindow */,
A5B3A4B62BB57B410001D006 /* RollerShutter */,
A55A8D832BAAD06C00C540D4 /* UpDownControllButton.swift */,
A55A8D812BA9B6B400C540D4 /* WindowColors.swift */,
A5B3A4BA2BB5B8F20001D006 /* WindowType.swift */,
A50B5D012BEA41D700918D18 /* WindowGroupedValue.swift */,
);
Expand All @@ -3045,6 +3059,7 @@
A5074BC32BCE64A30081B6B1 /* WindowView */ = {
isa = PBXGroup;
children = (
A55A8D812BA9B6B400C540D4 /* WindowColors.swift */,
A5B3A4B22BB552590001D006 /* BaseWindowView.swift */,
A5074BC42BCE66070081B6B1 /* DefaultWindowDimens.swift */,
A5074BC62BCE66930081B6B1 /* RuntimeWindowDimens.swift */,
Expand Down Expand Up @@ -3202,6 +3217,7 @@
isa = PBXGroup;
children = (
A50B5D2F2BF4A10200918D18 /* TerraceAwningView.swift */,
A50B5D402BFC914000918D18 /* TerraceAwningColors.swift */,
);
path = TerraceAwning;
sourceTree = "<group>";
Expand All @@ -3214,6 +3230,24 @@
path = TerraceAwning;
sourceTree = "<group>";
};
A50B5D342BFB6BDB00918D18 /* ProjectorScreen */ = {
isa = PBXGroup;
children = (
A50B5D352BFB6CD100918D18 /* ProjectorScreenVM.swift */,
A50B5D392BFB6E3500918D18 /* ProjectorScreenVC.swift */,
);
path = ProjectorScreen;
sourceTree = "<group>";
};
A50B5D3B2BFB6E9100918D18 /* ProjectorScreen */ = {
isa = PBXGroup;
children = (
A50B5D3C2BFB6EA200918D18 /* ProjectorScreenView.swift */,
A50B5D3E2BFC8BEA00918D18 /* ProjectorScreenColors.swift */,
);
path = ProjectorScreen;
sourceTree = "<group>";
};
A50CD3D42A4D99CF0012DD9B /* UpdateToken */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -3817,6 +3851,7 @@
A55A8D6C2BA831AD00C540D4 /* WindowDetail */ = {
isa = PBXGroup;
children = (
A50B5D342BFB6BDB00918D18 /* ProjectorScreen */,
A50B5D272BF49F0D00918D18 /* TerraceAwning */,
A5074BB62BCE58B30081B6B1 /* Base */,
A5074BCD2BCE72110081B6B1 /* FacadeBlinds */,
Expand Down Expand Up @@ -3886,6 +3921,7 @@
A50B5D072BEA4E2A00918D18 /* FacadeBlindWindowState.swift */,
A50B5D092BEA4EC700918D18 /* FacadeBlindMarker.swift */,
A50B5D2C2BF49F7700918D18 /* TerraceAwningWindowState.swift */,
A50B5D372BFB6D1400918D18 /* ProjectorScreenState.swift */,
);
path = Model;
sourceTree = "<group>";
Expand Down Expand Up @@ -4631,6 +4667,7 @@
children = (
A5B3A4B42BB558B70001D006 /* RoofWindowView.swift */,
A5B3A4B82BB57B690001D006 /* RoofWindowDimensBuilder.swift */,
A50B5D422BFC921B00918D18 /* RoofWindowColors.swift */,
);
path = RoofWindow;
sourceTree = "<group>";
Expand Down Expand Up @@ -5672,6 +5709,7 @@
A5F29BE62A27739000ED700A /* MoveableCell.swift in Sources */,
A5AE7A8F2A3AE0290097FA8B /* TitleArrowButtonCell.swift in Sources */,
A5CE73292B4607AE003F882C /* EspConfigResult.swift in Sources */,
A50B5D382BFB6D1400918D18 /* ProjectorScreenState.swift in Sources */,
A55A8D752BA84D5400C540D4 /* RollerShutterVM.swift in Sources */,
A530EE1A2A56FBBC00F8DAEE /* PowerSwitchIconNameProducer.swift in Sources */,
A5F29B962A20B97B00ED700A /* CreateProfileChannelsListUseCase.swift in Sources */,
Expand Down Expand Up @@ -5785,6 +5823,7 @@
A50B5D022BEA41D700918D18 /* WindowGroupedValue.swift in Sources */,
A54149372B63BC0500B44BD6 /* DownloadGeneralPurposeMeasurementLogUseCase.swift in Sources */,
01511CFA24F50B470081A1EC /* SAPreloaderPopup.m in Sources */,
A50B5D412BFC914000918D18 /* TerraceAwningColors.swift in Sources */,
A52BFEAF2B060EAA00A2F64C /* Hour.swift in Sources */,
A530EE1C2A56FC5000F8DAEE /* LightSwitchIconNameProducer.swift in Sources */,
A530EE2E2A57E23D00F8DAEE /* DigiglassHorizontalIconNameProducer.swift in Sources */,
Expand Down Expand Up @@ -5812,6 +5851,7 @@
A530EE282A57E02C00F8DAEE /* MailSensorIconNameProducer.swift in Sources */,
01D0616E22C294D90043C947 /* ElectricityMeterDetailView.m in Sources */,
A5FE67692A666FF800147D1F /* RequestHelper.swift in Sources */,
A50B5D362BFB6CD100918D18 /* ProjectorScreenVM.swift in Sources */,
01F8856C22E5E79100D18373 /* SAUserIcon+CoreDataClass.m in Sources */,
013D73B022DD105400E3515A /* SAChartFilterField.m in Sources */,
A5F29C022A2DC56600ED700A /* NSPersistentStoreCoordinator+Ext.swift in Sources */,
Expand Down Expand Up @@ -5948,6 +5988,7 @@
A51BE9132AAAFFEB00718F2F /* SuplaChannelConfig.swift in Sources */,
A51BE9182AAB027400718F2F /* QuarterOfHour.swift in Sources */,
A530EE4E2A5C357100F8DAEE /* StartTimerUseCase.swift in Sources */,
A50B5D3A2BFB6E3500918D18 /* ProjectorScreenVC.swift in Sources */,
A56233E92AB31A26001CB948 /* CGPoint+Ext.swift in Sources */,
A5B3CC0E2B62934D00F95AC3 /* SAChannelConfig+Ext.swift in Sources */,
A530EE4C2A5C2A3E00F8DAEE /* UIBorderedButton.swift in Sources */,
Expand Down Expand Up @@ -6039,13 +6080,15 @@
A5074BAA2BC945DA0081B6B1 /* WebContentVM.swift in Sources */,
A503ABB32B6A9ED9008CDA1F /* GeneralPurposeMeterItemRepository.swift in Sources */,
A57668ED2AEA85150025509D /* Array+Ext.swift in Sources */,
A50B5D3F2BFC8BEA00918D18 /* ProjectorScreenColors.swift in Sources */,
A5074BA82BC923AE0081B6B1 /* BrandingConfiguration.swift in Sources */,
A51BE90D2AAAF82000718F2F /* GetChannelConfigUseCase.swift in Sources */,
A5F29B5B2A1E15D600ED700A /* MainVC.swift in Sources */,
011021D325CC4DE700621D41 /* SAChannelBasicCfg.m in Sources */,
A573B0962A5FD152001E19D0 /* FatalError.swift in Sources */,
A5AE7A8D2A3ADFAD0097FA8B /* RsOpenningClosingPersentageCell.swift in Sources */,
A57B03C62B29D68B00C22966 /* HomePlusDetailRefreshHelper.swift in Sources */,
A50B5D432BFC921B00918D18 /* RoofWindowColors.swift in Sources */,
A5F29B742A1E33AC00ED700A /* NSManagedObjectContext+Rx.swift in Sources */,
40E8BE8A1FC06A5600FB2FE6 /* XPathQuery.m in Sources */,
01EE9BBC22BA50D90029A142 /* SAChannelValueBase+CoreDataProperties.m in Sources */,
Expand Down Expand Up @@ -6202,6 +6245,7 @@
A57785BF29E80406001C631E /* SuplaAppWrapper.swift in Sources */,
A5E490502A3C79A4006801FE /* UserNotificationCenter.swift in Sources */,
A55A8D702BA831D900C540D4 /* WindowDetailVM.swift in Sources */,
A50B5D3D2BFB6EA200918D18 /* ProjectorScreenView.swift in Sources */,
A51BE9112AAAFFC200718F2F /* SuplaChannelWeeklyScheduleConfig.swift in Sources */,
A55501F32B8382C500FD3296 /* NotificationsLogVM.swift in Sources */,
AEB195DE276E5A040091D314 /* FadeTransition.swift in Sources */,
Expand Down
13 changes: 13 additions & 0 deletions SUPLA/Core/UI/Details/StandardDetailVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ class StandardDetailVC<S : ViewState, E : ViewEvent, VM : StandardDetailVM<S, E>
viewControllers.append(facadeBlindDetail())
case .terraceAwning:
viewControllers.append(terraceAwningDetail())
case .projectorScreen:
viewControllers.append(projectorScreenDetail())
}
}

Expand Down Expand Up @@ -250,6 +252,17 @@ class StandardDetailVC<S : ViewState, E : ViewEvent, VM : StandardDetailVM<S, E>
)
return vc
}

private func projectorScreenDetail() -> ProjectorScreenVC {
let vc = ProjectorScreenVC(itemBundle: item)
vc.navigationCoordinator = navigationCoordinator
vc.tabBarItem = UITabBarItem(
title: settings.showBottomLabels ? Strings.StandardDetail.tabGeneral : nil,
image: .iconGeneral,
tag: DetailTabTag.Window.rawValue
)
return vc
}
}

protocol NavigationItemProvider: AnyObject {
Expand Down
4 changes: 3 additions & 1 deletion SUPLA/Core/UI/TableView/BaseTableViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ class BaseTableViewModel<S: ViewState, E: ViewEvent>: BaseViewModel<S, E> {
SUPLA_CHANNELFNC_GENERAL_PURPOSE_MEASUREMENT,
SUPLA_CHANNELFNC_CONTROLLINGTHEROLLERSHUTTER,
SUPLA_CHANNELFNC_CONTROLLINGTHEROOFWINDOW,
SUPLA_CHANNELFNC_CONTROLLINGTHEFACADEBLIND:
SUPLA_CHANNELFNC_CONTROLLINGTHEFACADEBLIND,
SUPLA_CHANNELFNC_TERRACE_AWNING,
SUPLA_CHANNELFNC_PROJECTOR_SCREEN:
return true
case SUPLA_CHANNELFNC_LIGHTSWITCH,
SUPLA_CHANNELFNC_POWERSWITCH,
Expand Down
3 changes: 2 additions & 1 deletion SUPLA/Core/UI/TableView/ChannelBaseTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ class ChannelBaseTableViewController<S: ViewState, E: ViewEvent, VM: BaseTableVi
case SUPLA_CHANNELFNC_CONTROLLINGTHEROOFWINDOW,
SUPLA_CHANNELFNC_CONTROLLINGTHEFACADEBLIND,
SUPLA_CHANNELFNC_CONTROLLINGTHEROLLERSHUTTER,
SUPLA_CHANNELFNC_TERRACE_AWNING:
SUPLA_CHANNELFNC_TERRACE_AWNING,
SUPLA_CHANNELFNC_PROJECTOR_SCREEN:
return cellIdForIcon
default:
return cellIdForChannel
Expand Down
6 changes: 4 additions & 2 deletions SUPLA/Features/ChannelList/Cells/IconCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ final class IconCell: BaseCell<ChannelWithChildren> {
case SUPLA_CHANNELFNC_CONTROLLINGTHEROOFWINDOW,
SUPLA_CHANNELFNC_CONTROLLINGTHEFACADEBLIND,
SUPLA_CHANNELFNC_CONTROLLINGTHEROLLERSHUTTER,
SUPLA_CHANNELFNC_TERRACE_AWNING: true
SUPLA_CHANNELFNC_TERRACE_AWNING,
SUPLA_CHANNELFNC_PROJECTOR_SCREEN: true
default: false
}
}
Expand All @@ -114,7 +115,8 @@ final class IconCell: BaseCell<ChannelWithChildren> {
case SUPLA_CHANNELFNC_CONTROLLINGTHEROOFWINDOW,
SUPLA_CHANNELFNC_CONTROLLINGTHEFACADEBLIND,
SUPLA_CHANNELFNC_CONTROLLINGTHEROLLERSHUTTER,
SUPLA_CHANNELFNC_TERRACE_AWNING: true
SUPLA_CHANNELFNC_TERRACE_AWNING,
SUPLA_CHANNELFNC_PROJECTOR_SCREEN: true
default: false
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
Copyright (C) AC SOFTWARE SP. Z O.O.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

struct ProjectorScreenState: WindowState, Equatable, Changeable {
/**
* The blind roller position in percentage
* 0 - open
* 100 - closed
*/
var position: WindowGroupedValue

var positionTextFormat: WindowGroupedValueFormat = .percentage

/**
* Used for groups - shows positions of single roller shutter
*/
var markers: [CGFloat] = []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
Copyright (C) AC SOFTWARE SP. Z O.O.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

struct ProjectorScreenColors {
let screen: UIColor
let shadow: UIColor
let bottomRect: UIColor
let topRect: UIColor
let logoColor: UIColor

static func standard(_ traitCollection: UITraitCollection) -> ProjectorScreenColors {
ProjectorScreenColors(
screen: .rollerShutterWindow.resolvedColor(with: traitCollection),
shadow: .black,
bottomRect: .rollerShutterSlatBackground.resolvedColor(with: traitCollection),
topRect: .gray.resolvedColor(with: traitCollection),
logoColor: .primaryVariant.copy(alpha: 0.2)
)
}

static func offline(_ traitCollection: UITraitCollection) -> ProjectorScreenColors {
ProjectorScreenColors(
screen: .surface.resolvedColor(with: traitCollection),
shadow: .black,
bottomRect: .rollerShutterSlatBackground.resolvedColor(with: traitCollection),
topRect: .disabled.resolvedColor(with: traitCollection),
logoColor: .disabled.copy(alpha: 0.2)
)
}
}
Loading

0 comments on commit ad888b8

Please sign in to comment.