Skip to content

Commit

Permalink
fixed priority and outcome buttons issues (#603)
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitgoyalgloballogic authored Jun 21, 2023
1 parent d84c250 commit 74b2803
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -409,5 +409,6 @@ struct LocalizationConstants {
static let claimTitle = NSLocalizedString("claim-title", comment: "")
static let releaseTitle = NSLocalizedString("release-title", comment: "")
static let createdDate = NSLocalizedString("created_date", comment: "")
static let noneTitle = NSLocalizedString("None", comment: "")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,17 @@ class WflowTaskDetailController: NSObject {
priorityBackgroundColor: backgroundColor,
isEditMode: false)
return rowVM
} else if let currentTheme = self.currentTheme {
let textColor = currentTheme.onSurfaceColor
let backgroundColor = currentTheme.surfaceColor

let rowVM = PriorityTableCellViewModel(title: LocalizationConstants.Accessibility.priority,
priority: LocalizationConstants.Workflows.noneTitle,
priorityTextColor: textColor,
priorityBackgroundColor: backgroundColor,
isEditMode: false,
isEmptyValue: true)
return rowVM
}
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,10 @@ class WflowTaskDetailViewController: SystemSearchViewController {
if assigneeUserId == apsUserID || processInstanceStartUserId == apsUserID {
claimTaskView.isHidden = true
releaseTaskButton.isHidden = true
buttonsBaseView.isHidden = false
heightOutputView.constant = 48
if !viewModel.outcomes.isEmpty {
buttonsBaseView.isHidden = false
heightOutputView.constant = 48
}
} else {
hideAllButtons()
}
Expand All @@ -344,8 +346,10 @@ class WflowTaskDetailViewController: SystemSearchViewController {
} else if assigneeUserId == apsUserID { // task is claimed by me. show release button
releaseTaskButton.isHidden = false
claimTaskView.isHidden = true
buttonsBaseView.isHidden = false
heightOutputView.constant = 48
if !viewModel.outcomes.isEmpty {
buttonsBaseView.isHidden = false
heightOutputView.constant = 48
}
} else {
hideAllButtons()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class PriorityTableCellViewModel: RowViewModel {
var isHideEditImage: Bool {
return !isEditMode
}
var isEmptyValue = false
var didSelectEditPriority: (() -> Void)?

func cellIdentifier() -> String {
Expand All @@ -38,11 +39,13 @@ class PriorityTableCellViewModel: RowViewModel {
priority: String?,
priorityTextColor: UIColor,
priorityBackgroundColor: UIColor,
isEditMode: Bool) {
isEditMode: Bool,
isEmptyValue: Bool = false) {
self.title = title
self.priority = priority
self.priorityTextColor = priorityTextColor
self.priorityBackgroundColor = priorityBackgroundColor
self.isEditMode = isEditMode
self.isEmptyValue = isEmptyValue
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ class PriorityTableViewCell: UITableViewCell, CellConfigurable {
@IBOutlet weak var priorityLabel: UILabel!
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var editImageView: UIImageView!
@IBOutlet weak var leadingPriorityLabel: NSLayoutConstraint!
var viewModel: PriorityTableCellViewModel?

// MARK: - Life cycle
override func awakeFromNib() {
super.awakeFromNib()
priorityView.layer.cornerRadius = priorityView.frame.size.height / 2.0
Expand Down Expand Up @@ -55,6 +57,9 @@ class PriorityTableViewCell: UITableViewCell, CellConfigurable {
titleLabel.text = viewModel.title
editImageView.isHidden = viewModel.isHideEditImage
addAccessibility()
if viewModel.isEmptyValue {
leadingPriorityLabel.constant = 0
}
}

private func addAccessibility() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand Down Expand Up @@ -36,6 +36,7 @@
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dJk-YF-kU0" userLabel="priorityLabel">
<rect key="frame" x="10" y="5" width="39.5" height="22"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<accessibility key="accessibilityConfiguration" identifier="nodeTitleLabel">
<bool key="isElement" value="NO"/>
</accessibility>
Expand Down Expand Up @@ -111,6 +112,7 @@
<connections>
<outlet property="baseView" destination="sIe-3z-A0T" id="efK-a0-I4F"/>
<outlet property="editImageView" destination="JDk-Z6-PJw" id="v36-21-8NN"/>
<outlet property="leadingPriorityLabel" destination="yhH-sO-KR3" id="dCk-b2-IRH"/>
<outlet property="priorityIcon" destination="8s2-kM-dFX" id="y0e-Ye-rFF"/>
<outlet property="priorityLabel" destination="dJk-YF-kU0" id="4W7-QC-ieR"/>
<outlet property="priorityView" destination="cAO-KE-zHg" id="ya9-Vs-sym"/>
Expand Down

0 comments on commit 74b2803

Please sign in to comment.