Skip to content

Commit

Permalink
Further update the notification UI Cards
Browse files Browse the repository at this point in the history
  • Loading branch information
nriedman committed May 31, 2024
1 parent a64a7ab commit a04ab1e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
12 changes: 8 additions & 4 deletions ENGAGEHF.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
2FF53D8D2A8729D600042B76 /* ENGAGEHFStandard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FF53D8C2A8729D600042B76 /* ENGAGEHFStandard.swift */; };
4D052DB82BE07892006A784E /* MeasurementManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D052DB72BE07892006A784E /* MeasurementManager.swift */; };
4D065BE02C09401700EBB3AE /* StudyApplicationListCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D065BDF2C09401700EBB3AE /* StudyApplicationListCard.swift */; };
4D0F389E2C09779100DA12F7 /* LearnMoreButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D0F389D2C09779000DA12F7 /* LearnMoreButton.swift */; };
4D0F389E2C09779100DA12F7 /* ShowMoreButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D0F389D2C09779000DA12F7 /* ShowMoreButton.swift */; };
4D0F38A22C0A7AD900DA12F7 /* ExpandableText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D0F38A12C0A7AD900DA12F7 /* ExpandableText.swift */; };
4D19ED012BE5CAFC00CDBAA8 /* MeasurementRecordedView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D19ED002BE5CAFC00CDBAA8 /* MeasurementRecordedView.swift */; };
4D49AAFE2BC9D50400C77310 /* BluetoothServices in Frameworks */ = {isa = PBXBuildFile; productRef = 4D49AAFD2BC9D50400C77310 /* BluetoothServices */; };
4D49AB002BC9D50400C77310 /* BluetoothViews in Frameworks */ = {isa = PBXBuildFile; productRef = 4D49AAFF2BC9D50400C77310 /* BluetoothViews */; };
Expand Down Expand Up @@ -139,7 +140,8 @@
2FF53D8C2A8729D600042B76 /* ENGAGEHFStandard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ENGAGEHFStandard.swift; sourceTree = "<group>"; };
4D052DB72BE07892006A784E /* MeasurementManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeasurementManager.swift; sourceTree = "<group>"; };
4D065BDF2C09401700EBB3AE /* StudyApplicationListCard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StudyApplicationListCard.swift; sourceTree = "<group>"; };
4D0F389D2C09779000DA12F7 /* LearnMoreButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LearnMoreButton.swift; sourceTree = "<group>"; };
4D0F389D2C09779000DA12F7 /* ShowMoreButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShowMoreButton.swift; sourceTree = "<group>"; };
4D0F38A12C0A7AD900DA12F7 /* ExpandableText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExpandableText.swift; sourceTree = "<group>"; };
4D19ED002BE5CAFC00CDBAA8 /* MeasurementRecordedView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeasurementRecordedView.swift; sourceTree = "<group>"; };
4D49AB052BC9D56900C77310 /* WeightScaleDevice.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeightScaleDevice.swift; sourceTree = "<group>"; };
4D49AB0C2BC9DF9100C77310 /* WeightScaleFeature.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeightScaleFeature.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -300,7 +302,8 @@
isa = PBXGroup;
children = (
4D065BDF2C09401700EBB3AE /* StudyApplicationListCard.swift */,
4D0F389D2C09779000DA12F7 /* LearnMoreButton.swift */,
4D0F389D2C09779000DA12F7 /* ShowMoreButton.swift */,
4D0F38A12C0A7AD900DA12F7 /* ExpandableText.swift */,
);
path = ReusableElements;
sourceTree = "<group>";
Expand Down Expand Up @@ -723,7 +726,7 @@
buildActionMask = 2147483647;
files = (
2FE5DC4129EDD7EE004B9AB4 /* StorageKeys.swift in Sources */,
4D0F389E2C09779100DA12F7 /* LearnMoreButton.swift in Sources */,
4D0F389E2C09779100DA12F7 /* ShowMoreButton.swift in Sources */,
4D19ED012BE5CAFC00CDBAA8 /* MeasurementRecordedView.swift in Sources */,
4DDFC7652BF350C2002B07A1 /* Education.swift in Sources */,
4DDFC7692BF35113002B07A1 /* HeartHealth.swift in Sources */,
Expand Down Expand Up @@ -766,6 +769,7 @@
A9FE7AD02AA39BAB0077B045 /* AccountSheet.swift in Sources */,
653A2551283387FE005D4D48 /* ENGAGEHF.swift in Sources */,
2F65B44E2A3B8B0600A36932 /* NotificationPermissions.swift in Sources */,
4D0F38A22C0A7AD900DA12F7 /* ExpandableText.swift in Sources */,
2FE5DC2629EDD38A004B9AB4 /* Contacts.swift in Sources */,
4DBDD3462BBFAE2D001FB0CA /* InvitationCodeView.swift in Sources */,
4DDFC73D2BF2C4FA002B07A1 /* Notification.swift in Sources */,
Expand Down
16 changes: 11 additions & 5 deletions ENGAGEHF/Dashboard/Notifications/Views/NotificationRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,35 @@ struct NotificationRow: View {
let notification: Notification

Check failure on line 14 in ENGAGEHF/Dashboard/Notifications/Views/NotificationRow.swift

View workflow job for this annotation

GitHub Actions / SwiftLint / SwiftLint

Type Contents Order Violation: An 'instance_property' should not be placed amongst the type content(s) 'subtype' (type_contents_order)

@ScaledMetric private var spacing: CGFloat = 5

Check failure on line 16 in ENGAGEHF/Dashboard/Notifications/Views/NotificationRow.swift

View workflow job for this annotation

GitHub Actions / SwiftLint / SwiftLint

Type Contents Order Violation: An 'instance_property' should not be placed amongst the type content(s) 'subtype' (type_contents_order)
@ScaledMetric private var typeFontSize: CGFloat = 12

Check failure on line 17 in ENGAGEHF/Dashboard/Notifications/Views/NotificationRow.swift

View workflow job for this annotation

GitHub Actions / SwiftLint / SwiftLint

Type Contents Order Violation: An 'instance_property' should not be placed amongst the type content(s) 'subtype' (type_contents_order)
@ScaledMetric private var titleFontSize: CGFloat = 15

Check failure on line 18 in ENGAGEHF/Dashboard/Notifications/Views/NotificationRow.swift

View workflow job for this annotation

GitHub Actions / SwiftLint / SwiftLint

Type Contents Order Violation: An 'instance_property' should not be placed amongst the type content(s) 'subtype' (type_contents_order)


var body: some View {

Check failure on line 21 in ENGAGEHF/Dashboard/Notifications/Views/NotificationRow.swift

View workflow job for this annotation

GitHub Actions / SwiftLint / SwiftLint

Type Contents Order Violation: An 'instance_property' should not be placed amongst the type content(s) 'subtype' (type_contents_order)
VStack(alignment: .leading) {
VStack(alignment: .leading, spacing: spacing) {
HStack(alignment: .center) {
Text(notification.type.localizedUppercase)
.font(.footnote)
.font(.system(size: typeFontSize, weight: .bold))
.foregroundStyle(.secondary)
Spacer()
XButton(notification: notification)
}
Divider()
Text(notification.title)
.font(.subheadline)
.font(.system(size: titleFontSize, weight: .bold))
.bold()
.multilineTextAlignment(.leading)
.padding(.bottom, spacing)
ExpandableText(text: notification.description, lineLimit: 1, spacing: spacing)
ExpandableText(text: notification.description, lineLimit: 1)
.font(.footnote)
}
}


private struct XButton: View {
@Environment(NotificationManager.self) private var notificationManager
@ScaledMetric private var labelSize: CGFloat = 9

let notification: Notification


Expand All @@ -53,8 +57,10 @@ struct NotificationRow: View {
},
label: {
Image(systemName: "xmark")
.resizable()
.scaledToFit()
.frame(width: labelSize, height: labelSize)
.foregroundStyle(.accent)
.imageScale(.small)
.accessibilityLabel("XButton")
}
)
Expand Down
2 changes: 1 addition & 1 deletion ENGAGEHF/ReusableElements/ExpandableText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import SwiftUI
struct ExpandableText: View {
let text: String
let lineLimit: Int
@ScaledMetric var spacing: CGFloat
@ScaledMetric var spacing: CGFloat = 4

@State private var isExpanded = false
@State private var isTruncated: Bool? = nil

Check failure on line 21 in ENGAGEHF/ReusableElements/ExpandableText.swift

View workflow job for this annotation

GitHub Actions / SwiftLint / SwiftLint

Discouraged Optional Boolean Violation: Prefer non-optional booleans over optional booleans (discouraged_optional_boolean)

Check failure on line 21 in ENGAGEHF/ReusableElements/ExpandableText.swift

View workflow job for this annotation

GitHub Actions / SwiftLint / SwiftLint

Redundant Optional Initialization Violation: Initializing an optional variable with nil is redundant (redundant_optional_initialization)
Expand Down

0 comments on commit a04ab1e

Please sign in to comment.