Skip to content

Commit 8c5c9ea

Browse files
authored
Merge pull request #44 from CleverTap/develop
Release v0.3.0
2 parents af1a253 + 17503d2 commit 8c5c9ea

File tree

41 files changed

+2311
-1184
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2311
-1184
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
Change Log
22
==========
3+
Version 0.3.0 (10 April, 2025)
4+
-----------------------------------------------
5+
- Added support for bold, italic, underline, and strikethrough HTML tags in title and message for rich push notifications.
6+
37
Version 0.2.7 (17 April, 2024)
48
-----------------------------------------------
59
- Fixes a build error related to privacy manifests when statically linking the SDK using Cocoapods.

CTNotificationContent.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "CTNotificationContent"
3-
s.version = "0.2.7"
3+
s.version = "0.3.0"
44
s.summary = "A Notification Content Extension class to display custom content interfaces for iOS 10 push notifications"
55
s.homepage = "https://github.com/CleverTap/CTNotificationContent"
66
s.license = "MIT"

CTNotificationContent.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
0B0115BE2CAFFD8C00985815 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B0115BD2CAFFD8900985815 /* Extensions.swift */; };
1011
3270BFDA28E4D80E003528ED /* CTProductDisplayVerticalViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3270BFD328E4D80E003528ED /* CTProductDisplayVerticalViewController.swift */; };
1112
3270BFDB28E4D80E003528ED /* CTProductDisplayLinearViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3270BFD428E4D80E003528ED /* CTProductDisplayLinearViewController.swift */; };
1213
3270BFDC28E4D80E003528ED /* ProductDisplayProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3270BFD628E4D80E003528ED /* ProductDisplayProperties.swift */; };
@@ -46,6 +47,7 @@
4647
/* End PBXBuildFile section */
4748

4849
/* Begin PBXFileReference section */
50+
0B0115BD2CAFFD8900985815 /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = "<group>"; };
4951
3270BFD328E4D80E003528ED /* CTProductDisplayVerticalViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CTProductDisplayVerticalViewController.swift; sourceTree = "<group>"; };
5052
3270BFD428E4D80E003528ED /* CTProductDisplayLinearViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CTProductDisplayLinearViewController.swift; sourceTree = "<group>"; };
5153
3270BFD628E4D80E003528ED /* ProductDisplayProperties.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProductDisplayProperties.swift; sourceTree = "<group>"; };
@@ -304,6 +306,7 @@
304306
32DFD84328BCCCBB00E72588 /* Utility */ = {
305307
isa = PBXGroup;
306308
children = (
309+
0B0115BD2CAFFD8900985815 /* Extensions.swift */,
307310
32DFD84428BCCCBB00E72588 /* GlobalConstants.swift */,
308311
32DFD84528BCCCBB00E72588 /* CTUtility.swift */,
309312
);
@@ -484,6 +487,7 @@
484487
isa = PBXSourcesBuildPhase;
485488
buildActionMask = 2147483647;
486489
files = (
490+
0B0115BE2CAFFD8C00985815 /* Extensions.swift in Sources */,
487491
488F31AF2817000200AE3AC8 /* CTCaptionedImageView.swift in Sources */,
488492
32C575EE28F744E600BF0A3F /* CTRatingsViewController.swift in Sources */,
489493
32DFD85128BCCCBB00E72588 /* CTUtility.swift in Sources */,

CTNotificationContent/Templates/ProductDisplay/Controller/CTProductDisplayVerticalViewController.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,24 +61,24 @@ import UserNotificationsUI
6161
switch sender.view?.tag{
6262
case 1:
6363
self.bigImageView.image = smallImageBtn1.image
64-
self.titleLabel.text = jsonContent?.pt_bt1
65-
self.subTitleLabel.text = jsonContent?.pt_st1
64+
self.titleLabel.setHTMLText(jsonContent?.pt_bt1 ?? "")
65+
self.subTitleLabel.setHTMLText(jsonContent?.pt_st1 ?? "")
6666
let priceText = "" + (jsonContent?.pt_price1 ?? "")
6767
self.priceLabel.text = priceText
6868
self.deeplink = jsonContent?.pt_dl1 ?? ""
6969
break
7070
case 2:
7171
self.bigImageView.image = smallImageBtn2.image
72-
self.titleLabel.text = jsonContent?.pt_bt2
72+
self.titleLabel.setHTMLText(jsonContent?.pt_bt2 ?? "")
7373
let priceText = "" + (jsonContent?.pt_price2 ?? "")
7474
self.priceLabel.text = priceText
75-
self.subTitleLabel.text = jsonContent?.pt_st2
75+
self.subTitleLabel.setHTMLText(jsonContent?.pt_st2 ?? "")
7676
self.deeplink = jsonContent?.pt_dl2 ?? ""
7777
break
7878
case 3:
7979
self.bigImageView.image = smallImageBtn3.image
80-
self.titleLabel.text = jsonContent?.pt_bt3
81-
self.subTitleLabel.text = jsonContent?.pt_st3
80+
self.titleLabel.setHTMLText(jsonContent?.pt_bt3 ?? "")
81+
self.subTitleLabel.setHTMLText(jsonContent?.pt_st3 ?? "")
8282
let priceText = "" + (jsonContent?.pt_price3 ?? "")
8383
self.priceLabel.text = priceText
8484
self.deeplink = jsonContent?.pt_dl3 ?? ""
@@ -100,8 +100,8 @@ import UserNotificationsUI
100100
preferredContentSize = CGSize(width: viewWidth, height: viewHeight)
101101

102102
self.deeplink = jsonContent.pt_dl1
103-
self.titleLabel.text = jsonContent.pt_bt1
104-
self.subTitleLabel.text = jsonContent.pt_st1
103+
self.titleLabel.setHTMLText(jsonContent.pt_bt1)
104+
self.subTitleLabel.setHTMLText(jsonContent.pt_st1)
105105

106106
CTUtiltiy.checkImageUrlValid(imageUrl: jsonContent.pt_img1) { [weak self] (imageData) in
107107
DispatchQueue.main.async {

CTNotificationContent/Templates/Rating/Controller/CTRatingsViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,8 @@ import UIKit
306306
templateBigImage = bigImage
307307
}
308308

309-
self.titleLabel.text = templateCaption
310-
self.subTitleLabel.text = templateSubcaption
309+
self.titleLabel.setHTMLText(templateCaption)
310+
self.subTitleLabel.setHTMLText(templateSubcaption)
311311

312312
if let bigImg = jsonContent.pt_big_img{
313313
CTUtiltiy.checkImageUrlValid(imageUrl: bigImg) { [weak self] (imageData) in

CTNotificationContent/Templates/SingleMedia/Controller/CTSingleMediaController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ import AVFoundation
153153
func createBasicCaptionView() {
154154
contentView.addSubview(captionLabel)
155155
contentView.addSubview(subcaptionLabel)
156-
captionLabel.text = caption
157-
subcaptionLabel.text = subCaption
156+
captionLabel.setHTMLText(caption)
157+
subcaptionLabel.setHTMLText(subCaption)
158158

159159
NSLayoutConstraint.activate([
160160
captionLabel.topAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -(CTUtiltiy.getCaptionHeight() - Constraints.kCaptionTopPadding)),

CTNotificationContent/Templates/Timer/Controller/CTTimerTemplateController.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ import UserNotificationsUI
7474
contentView.addSubview(subcaptionLabel)
7575
contentView.addSubview(timerLabel)
7676

77-
captionLabel.text = templateCaption
78-
subcaptionLabel.text = templateSubcaption
77+
captionLabel.setHTMLText(templateCaption)
78+
subcaptionLabel.setHTMLText(templateSubcaption)
7979

8080
guard let jsonContent = jsonContent else {
8181
return
@@ -91,13 +91,13 @@ import UserNotificationsUI
9191
}
9292

9393
if let title = jsonContent.pt_title, !title.isEmpty {
94-
captionLabel.text = title
94+
captionLabel.setHTMLText(title)
9595
}
9696
if let msg = jsonContent.pt_msg, !msg.isEmpty {
97-
subcaptionLabel.text = msg
97+
subcaptionLabel.setHTMLText(msg)
9898
}
9999
if let msgSummary = jsonContent.pt_msg_summary, !msgSummary.isEmpty {
100-
subcaptionLabel.text = msgSummary
100+
subcaptionLabel.setHTMLText(msgSummary)
101101
}
102102
if let bg = jsonContent.pt_bg, !bg.isEmpty {
103103
bgColor = bg
@@ -179,10 +179,10 @@ import UserNotificationsUI
179179
func updateViewForExpiredTime() {
180180
if let jsonContent = jsonContent {
181181
if let title = jsonContent.pt_title_alt, !title.isEmpty {
182-
captionLabel.text = title
182+
captionLabel.setHTMLText(title)
183183
}
184184
if let msg = jsonContent.pt_msg_alt, !msg.isEmpty {
185-
subcaptionLabel.text = msg
185+
subcaptionLabel.setHTMLText(msg)
186186
}
187187
if let altImage = jsonContent.pt_big_img_alt, !altImage.isEmpty {
188188
// Load expired image, if available.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//
2+
// Extensions.swift
3+
// CTNotificationContent
4+
//
5+
// Created by Kushagra Mishra on 04/10/24.
6+
// Copyright © 2024 CleverTap. All rights reserved.
7+
//
8+
import Foundation
9+
import UIKit
10+
11+
extension UILabel {
12+
func setHTMLText(_ htmlText: String) {
13+
let modifiedFont = NSString(format: "<span style=\"font-family: '-apple-system', 'HelveticaNeue'; font-size: \(self.font!.pointSize)\">%@</span>" as NSString, htmlText) as String
14+
guard let data = modifiedFont.data(using: .unicode) else { return }
15+
do {
16+
let attributedString = try NSAttributedString(data: data,
17+
options: [.documentType: NSAttributedString.DocumentType.html,
18+
.characterEncoding: String.Encoding.utf8.rawValue],
19+
documentAttributes: nil)
20+
self.attributedText = attributedString
21+
} catch {
22+
print("Error setting HTML text: \\(error.localizedDescription)")
23+
self.text = htmlText
24+
}
25+
}
26+
}

CTNotificationContent/Templates/ZeroBezel/Controller/CTZeroBezelController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ import UIKit
103103
templateBigImage = bigImage
104104
}
105105

106-
self.titleLabel.text = templateCaption
107-
self.subTitleLabel.text = templateSubcaption
106+
self.titleLabel.setHTMLText(templateCaption)
107+
self.subTitleLabel.setHTMLText(templateSubcaption)
108108

109109
if let bigImg = jsonContent.pt_big_img{
110110
CTUtiltiy.checkImageUrlValid(imageUrl: bigImg) { [weak self] (imageData) in

CTNotificationContent/Views/CTCaptionedImageView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ class CTCaptionedImageView : UIView {
7070
}
7171
}
7272
}
73-
captionLabel.text = components.caption
74-
subcaptionLabel.text = components.subcaption
73+
captionLabel.setHTMLText(components.caption)
74+
subcaptionLabel.setHTMLText(components.subcaption)
7575
captionLabel.textColor = UIColor(hex: components.captionColor)
7676
subcaptionLabel.textColor = UIColor(hex: components.subcaptionColor)
7777
}

ExampleSwiftPM/CTNotificationContentExampleSPM.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 52;
6+
objectVersion = 54;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -693,7 +693,7 @@
693693
repositoryURL = "https://github.com/CleverTap/clevertap-ios-sdk.git";
694694
requirement = {
695695
kind = upToNextMajorVersion;
696-
minimumVersion = 3.10.0;
696+
minimumVersion = 7.1.1;
697697
};
698698
};
699699
496ED95227589CCC002174B7 /* XCRemoteSwiftPackageReference "CTNotificationService" */ = {
@@ -708,8 +708,8 @@
708708
isa = XCRemoteSwiftPackageReference;
709709
repositoryURL = "https://github.com/CleverTap/CTNotificationContent.git";
710710
requirement = {
711-
kind = upToNextMajorVersion;
712-
minimumVersion = 0.2.0;
711+
branch = "SDK-4068-Add-HTML-support-to-title-and-message-fields";
712+
kind = branch;
713713
};
714714
};
715715
/* End XCRemoteSwiftPackageReference section */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1600"
4+
version = "1.7">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES"
8+
buildArchitectures = "Automatic">
9+
<BuildActionEntries>
10+
<BuildActionEntry
11+
buildForTesting = "YES"
12+
buildForRunning = "YES"
13+
buildForProfiling = "YES"
14+
buildForArchiving = "YES"
15+
buildForAnalyzing = "YES">
16+
<BuildableReference
17+
BuildableIdentifier = "primary"
18+
BlueprintIdentifier = "496ED91027589B88002174B7"
19+
BuildableName = "CTNotificationContentExampleSPM.app"
20+
BlueprintName = "CTNotificationContentExampleSPM"
21+
ReferencedContainer = "container:CTNotificationContentExampleSPM.xcodeproj">
22+
</BuildableReference>
23+
</BuildActionEntry>
24+
</BuildActionEntries>
25+
</BuildAction>
26+
<TestAction
27+
buildConfiguration = "Debug"
28+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
29+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
30+
shouldUseLaunchSchemeArgsEnv = "YES"
31+
shouldAutocreateTestPlan = "YES">
32+
</TestAction>
33+
<LaunchAction
34+
buildConfiguration = "Debug"
35+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37+
launchStyle = "0"
38+
useCustomWorkingDirectory = "NO"
39+
ignoresPersistentStateOnLaunch = "NO"
40+
debugDocumentVersioning = "YES"
41+
debugServiceExtension = "internal"
42+
allowLocationSimulation = "YES">
43+
<BuildableProductRunnable
44+
runnableDebuggingMode = "0">
45+
<BuildableReference
46+
BuildableIdentifier = "primary"
47+
BlueprintIdentifier = "496ED91027589B88002174B7"
48+
BuildableName = "CTNotificationContentExampleSPM.app"
49+
BlueprintName = "CTNotificationContentExampleSPM"
50+
ReferencedContainer = "container:CTNotificationContentExampleSPM.xcodeproj">
51+
</BuildableReference>
52+
</BuildableProductRunnable>
53+
</LaunchAction>
54+
<ProfileAction
55+
buildConfiguration = "Release"
56+
shouldUseLaunchSchemeArgsEnv = "YES"
57+
savedToolIdentifier = ""
58+
useCustomWorkingDirectory = "NO"
59+
debugDocumentVersioning = "YES">
60+
<BuildableProductRunnable
61+
runnableDebuggingMode = "0">
62+
<BuildableReference
63+
BuildableIdentifier = "primary"
64+
BlueprintIdentifier = "496ED91027589B88002174B7"
65+
BuildableName = "CTNotificationContentExampleSPM.app"
66+
BlueprintName = "CTNotificationContentExampleSPM"
67+
ReferencedContainer = "container:CTNotificationContentExampleSPM.xcodeproj">
68+
</BuildableReference>
69+
</BuildableProductRunnable>
70+
</ProfileAction>
71+
<AnalyzeAction
72+
buildConfiguration = "Debug">
73+
</AnalyzeAction>
74+
<ArchiveAction
75+
buildConfiguration = "Release"
76+
revealArchiveInOrganizer = "YES">
77+
</ArchiveAction>
78+
</Scheme>

0 commit comments

Comments
 (0)