From 0a1154dd2b0922a8724e6d8a0c05fb6b74b8e771 Mon Sep 17 00:00:00 2001 From: ReshabCT Date: Thu, 30 Apr 2026 12:41:02 +0530 Subject: [PATCH 1/5] SDK-5762: Fix left padding for title and message in all push templates --- CTNotificationContent/Templates/Utility/GlobalConstants.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CTNotificationContent/Templates/Utility/GlobalConstants.swift b/CTNotificationContent/Templates/Utility/GlobalConstants.swift index a66e420..a5241fb 100644 --- a/CTNotificationContent/Templates/Utility/GlobalConstants.swift +++ b/CTNotificationContent/Templates/Utility/GlobalConstants.swift @@ -9,7 +9,7 @@ enum Constraints { static let kSubCaptionHeight: CGFloat = 20.0 static let kSubCaptionTopPadding: CGFloat = 8.0 static let kBottomPadding: CGFloat = 18.0 - static let kCaptionLeftPadding: CGFloat = 10.0 + static let kCaptionLeftPadding: CGFloat = 16.0 static let kCaptionTopPadding: CGFloat = 8.0 static let kImageBorderWidth: CGFloat = 1.0 static let kImageLayerBorderWidth: CGFloat = 0.4 From 956b053fc0879da908bd2fceea7cf1464912faa3 Mon Sep 17 00:00:00 2001 From: ReshabCT Date: Thu, 30 Apr 2026 12:49:40 +0530 Subject: [PATCH 2/5] SDK-5762: Fix top left padding for title, subtitle in rating template --- .../Rating/Controller/CTRatingsViewController.swift | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/CTNotificationContent/Templates/Rating/Controller/CTRatingsViewController.swift b/CTNotificationContent/Templates/Rating/Controller/CTRatingsViewController.swift index a37329b..df4bedf 100644 --- a/CTNotificationContent/Templates/Rating/Controller/CTRatingsViewController.swift +++ b/CTNotificationContent/Templates/Rating/Controller/CTRatingsViewController.swift @@ -431,14 +431,13 @@ import SDWebImage func setupConstraints() { NSLayoutConstraint.activate([ - titleLabel.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 8), - titleLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: Constraints.kCaptionLeftPadding), + titleLabel.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 16), + titleLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 16), titleLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -Constraints.kCaptionLeftPadding), titleLabel.heightAnchor.constraint(equalToConstant: Constraints.kCaptionHeight), - titleLabel.bottomAnchor.constraint(equalTo: subTitleLabel.topAnchor, constant: -8), - + subTitleLabel.topAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: 8), - subTitleLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: Constraints.kCaptionLeftPadding), + subTitleLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 16), subTitleLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -Constraints.kCaptionLeftPadding), subTitleLabel.heightAnchor.constraint(equalToConstant: Constraints.kSubCaptionHeight)]) } From b4b33f02140abc52a3dd49993d81c18ee67f0a06 Mon Sep 17 00:00:00 2001 From: ReshabCT Date: Thu, 30 Apr 2026 15:24:48 +0530 Subject: [PATCH 3/5] SDK-5762: Add scrim overlay to zero bezel template for improved text visibility --- .../Controller/CTZeroBezelController.swift | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/CTNotificationContent/Templates/ZeroBezel/Controller/CTZeroBezelController.swift b/CTNotificationContent/Templates/ZeroBezel/Controller/CTZeroBezelController.swift index 79fbb2c..51d548c 100644 --- a/CTNotificationContent/Templates/ZeroBezel/Controller/CTZeroBezelController.swift +++ b/CTNotificationContent/Templates/ZeroBezel/Controller/CTZeroBezelController.swift @@ -16,8 +16,8 @@ import SDWebImage @objc public var templateSubcaption: String = "" @objc public var deeplinkURL: String = "" - var captionColor: String = ConstantKeys.kHexBlackColor - var subcaptionColor: String = ConstantKeys.kHexLightGrayColor + var captionColor: String = ConstantKeys.kHexWhiteColor + var subcaptionColor: String = ConstantKeys.kHexWhiteColor // Dark mode colors var captionColorDark: String = ConstantKeys.kHexWhiteColor @@ -54,6 +54,19 @@ import SDWebImage bigImageView.translatesAutoresizingMaskIntoConstraints = false return bigImageView }() + private let scrimView: UIView = { + let v = UIView() + v.translatesAutoresizingMaskIntoConstraints = false + v.isUserInteractionEnabled = false + return v + }() + private let scrimLayer: CAGradientLayer = { + let g = CAGradientLayer() + g.colors = [UIColor.clear.cgColor, UIColor.black.withAlphaComponent(0.65).cgColor] + g.startPoint = CGPoint(x: 0.5, y: 0) + g.endPoint = CGPoint(x: 0.5, y: 1) + return g + }() @objc public override func viewDidLoad() { super.viewDidLoad() @@ -100,6 +113,8 @@ import SDWebImage func createView() { createFrameWithoutImage() contentView.addSubview(bigImageView) + contentView.addSubview(scrimView) + scrimView.layer.addSublayer(scrimLayer) contentView.addSubview(subTitleLabel) contentView.addSubview(titleLabel) @@ -161,8 +176,18 @@ import SDWebImage } + public override func viewDidLayoutSubviews() { + super.viewDidLayoutSubviews() + scrimLayer.frame = scrimView.bounds + } + func setupConstraints() { NSLayoutConstraint.activate([ + scrimView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor), + scrimView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor), + scrimView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor), + scrimView.heightAnchor.constraint(equalTo: contentView.heightAnchor, multiplier: 0.3), + titleLabel.topAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -(CTUtiltiy.getCaptionHeight() - Constraints.kCaptionTopPadding)), titleLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: Constraints.kCaptionLeftPadding), titleLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -Constraints.kCaptionLeftPadding), From a578335cb63018f7c774a5eb84bc3119e4a728ec Mon Sep 17 00:00:00 2001 From: ReshabCT Date: Thu, 30 Apr 2026 15:36:28 +0530 Subject: [PATCH 4/5] SDK-5762: Persist timer state on expand --- .../CTNotificationViewController.m | 1 + .../Controller/CTTimerTemplateController.swift | 17 ++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CTNotificationContent/CTNotificationViewController.m b/CTNotificationContent/CTNotificationViewController.m index b067399..6c3c7a9 100644 --- a/CTNotificationContent/CTNotificationViewController.m +++ b/CTNotificationContent/CTNotificationViewController.m @@ -127,6 +127,7 @@ - (void)didReceiveNotification:(UNNotification *)notification { break; case CTNotificationContentTypeTimerTemplate: { CTTimerTemplateController *contentController = [[CTTimerTemplateController alloc] init]; + [contentController setNotificationDeliveryDate:notification.date]; [self setupContentController:contentController]; } break; diff --git a/CTNotificationContent/Templates/Timer/Controller/CTTimerTemplateController.swift b/CTNotificationContent/Templates/Timer/Controller/CTTimerTemplateController.swift index ddc23c6..04bd553 100644 --- a/CTNotificationContent/Templates/Timer/Controller/CTTimerTemplateController.swift +++ b/CTNotificationContent/Templates/Timer/Controller/CTTimerTemplateController.swift @@ -8,7 +8,8 @@ import SDWebImage @objc public var templateCaption: String = "" @objc public var templateSubcaption: String = "" @objc public var deeplinkURL: String = "" - + @objc public var notificationDeliveryDate: Date? + var bgColor: String = ConstantKeys.kDefaultColor var captionColor: String = ConstantKeys.kHexBlackColor var subcaptionColor: String = ConstantKeys.kHexLightGrayColor @@ -104,13 +105,15 @@ import SDWebImage return } if let threshold = jsonContent.pt_timer_threshold { - thresholdSeconds = threshold - } else { - if let endTime = jsonContent.pt_timer_end { - let date = NSDate() - let currentTime = date.timeIntervalSince1970 - thresholdSeconds = endTime - Int(currentTime) + if let deliveredAt = notificationDeliveryDate { + let elapsed = Int(Date().timeIntervalSince(deliveredAt)) + thresholdSeconds = max(0, threshold - elapsed) + } else { + thresholdSeconds = threshold } + } else if let endTime = jsonContent.pt_timer_end { + let currentTime = Date().timeIntervalSince1970 + thresholdSeconds = endTime - Int(currentTime) } if let title = jsonContent.pt_title, !title.isEmpty { From b315d5744d1c48f460bab138183441eaabf80cc6 Mon Sep 17 00:00:00 2001 From: ReshabCT Date: Thu, 14 May 2026 15:44:53 +0530 Subject: [PATCH 5/5] Fix timer chrono to show hours --- .../Timer/Controller/CTTimerTemplateController.swift | 10 +++++++--- .../Templates/Utility/GlobalConstants.swift | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CTNotificationContent/Templates/Timer/Controller/CTTimerTemplateController.swift b/CTNotificationContent/Templates/Timer/Controller/CTTimerTemplateController.swift index 04bd553..05455dc 100644 --- a/CTNotificationContent/Templates/Timer/Controller/CTTimerTemplateController.swift +++ b/CTNotificationContent/Templates/Timer/Controller/CTTimerTemplateController.swift @@ -213,15 +213,19 @@ import SDWebImage } func setupConstraints() { + let timerLabelWidth: CGFloat = thresholdSeconds >= 3600 + ? Constraints.kTimerLabelWidthWithHours + : Constraints.kTimerLabelWidth + NSLayoutConstraint.activate([ captionLabel.topAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -(CTUtiltiy.getCaptionHeight() - Constraints.kCaptionTopPadding)), captionLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: Constraints.kCaptionLeftPadding), - captionLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -Constraints.kTimerLabelWidth), + captionLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -timerLabelWidth), captionLabel.heightAnchor.constraint(equalToConstant: Constraints.kCaptionHeight), - + subcaptionLabel.topAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -(Constraints.kSubCaptionHeight + Constraints.kSubCaptionTopPadding)), subcaptionLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: Constraints.kCaptionLeftPadding), - subcaptionLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -Constraints.kTimerLabelWidth), + subcaptionLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -timerLabelWidth), subcaptionLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -Constraints.kSubCaptionTopPadding), subcaptionLabel.heightAnchor.constraint(equalToConstant: Constraints.kSubCaptionHeight), diff --git a/CTNotificationContent/Templates/Utility/GlobalConstants.swift b/CTNotificationContent/Templates/Utility/GlobalConstants.swift index a5241fb..3c45147 100644 --- a/CTNotificationContent/Templates/Utility/GlobalConstants.swift +++ b/CTNotificationContent/Templates/Utility/GlobalConstants.swift @@ -15,6 +15,7 @@ enum Constraints { static let kImageLayerBorderWidth: CGFloat = 0.4 static let kPageControlViewHeight: CGFloat = 20.0 static let kTimerLabelWidth: CGFloat = 100.0 + static let kTimerLabelWidthWithHours: CGFloat = 130.0 static let kLandscapeMultiplier: CGFloat = 0.5625 // 16:9 in landscape static let kPortraitMultiplier: CGFloat = 1.777 // 16:9 in portrait }