Skip to content

Commit

Permalink
Merge pull request #13 from CleverTap/carthage-support
Browse files Browse the repository at this point in the history
SDK-416: Release v0.1.3
  • Loading branch information
Aditi3 authored Sep 28, 2020
2 parents d50c35d + d287de1 commit c0e2c20
Show file tree
Hide file tree
Showing 99 changed files with 666 additions and 4,076 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ DerivedData
Carthage

Example/Podfile.lock
Example/Pods/
Example/Pods

ExampleSwift/Podfile.lock
ExampleSwift/Pods/
ExampleSwift/Pods
10 changes: 7 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
Change Log
==========

Version 0.1.3 *(28 September, 2020)*
-------------------------------------------
- Adds support for [Carthage](https://github.com/Carthage/Carthage)
- Update Starter Applications

Version 0.1.2 *(22 January, 2020)*
-------------------------------------------
Replace FOUNDATION_EXPORT with extern.
- Replace `FOUNDATION_EXPORT` with extern


Version 0.1.1 *(19 September, 2017)*
-------------------------------------------

update podspec to weak link UserNotifications framework to allow safe linking to < iOS 10 targets
- Update podspec to weak link `UserNotifications` framework to allow safe linking to < iOS 10 targets

Version 0.1.0 *(28 February, 2017)*
-------------------------------------------

Initial release.
- Initial release.
10 changes: 5 additions & 5 deletions CTNotificationService.podspec
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Pod::Spec.new do |s|
s.name = "CTNotificationService"
s.version = "0.1.2"
s.version = "0.1.3"
s.summary = "A simple Notification Service Extension class to add media attachments to iOS 10 rich push notifications."
s.homepage = "https://github.com/CleverTap/CTNotificationService"
s.license = "MIT"
s.author = { "CleverTap" => "http://www.clevertap.com" }
s.source = { :git => "https://github.com/CleverTap/CTNotificationService.git", :tag => s.version.to_s }
s.requires_arc = true
s.platform = :ios, '10.0'
s.weak_frameworks = 'UserNotifications'
s.source_files = 'CTNotificationService/*.{m,h}'
s.requires_arc = true
s.platform = :ios, '10.0'
s.weak_frameworks = 'UserNotifications'
s.source_files = 'CTNotificationService/*.{m,h}'
end
16 changes: 12 additions & 4 deletions CTNotificationService.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 50;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -107,7 +107,7 @@
};
};
buildConfigurationList = 5263891D1E64F6D300C8F9B1 /* Build configuration list for PBXProject "CTNotificationService" */;
compatibilityVersion = "Xcode 3.2";
compatibilityVersion = "Xcode 9.3";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
Expand Down Expand Up @@ -256,7 +256,11 @@
INFOPLIST_FILE = CTNotificationService/CTNotificationService.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.clevertap.CTNotificationService;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -279,7 +283,11 @@
INFOPLIST_FILE = CTNotificationService/CTNotificationService.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.clevertap.CTNotificationService;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1200"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "526389221E64F6D300C8F9B1"
BuildableName = "CTNotificationService.framework"
BlueprintName = "CTNotificationService"
ReferencedContainer = "container:CTNotificationService.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "526389221E64F6D300C8F9B1"
BuildableName = "CTNotificationService.framework"
BlueprintName = "CTNotificationService"
ReferencedContainer = "container:CTNotificationService.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
1 change: 0 additions & 1 deletion CTNotificationService/CTNotificationService.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@


//! Project version number for CTNotificationService.
extern double CTNotificationServiceVersionNumber;

Expand Down
61 changes: 29 additions & 32 deletions CTNotificationService/CTNotificationServiceExtension.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ - (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withConte

NSDictionary *userInfo = request.content.userInfo;
if (userInfo == nil) {
[self contentComplete];
self.contentHandler(self.bestAttemptContent);
return;
}

Expand All @@ -37,35 +37,31 @@ - (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withConte
if (mediaUrl == nil || mediaType == nil) {
#ifdef DEBUG
if (mediaUrl == nil) {
NSLog(@"unable to add attachment: %@ is nil", mediaUrlKey);
NSLog(@"unable to add attachment: %@ is nil", mediaUrlKey);
}

if (mediaType == nil) {
NSLog(@"unable to add attachment: %@ is nil", mediaTypeKey);
}

#endif
[self contentComplete];
self.contentHandler(self.bestAttemptContent);
return;
}

// load the attachment
[self loadAttachmentForUrlString:mediaUrl
withType:mediaType
completionHandler:^(UNNotificationAttachment *attachment) {
if (attachment) {
self.bestAttemptContent.attachments = [NSArray arrayWithObject:attachment];
}
[self contentComplete];
}];
if (attachment) {
self.bestAttemptContent.attachments = [NSArray arrayWithObject:attachment];
}
self.contentHandler(self.bestAttemptContent);
}];

}

- (void)serviceExtensionTimeWillExpire {
[self contentComplete];
}

- (void)contentComplete {
self.contentHandler(self.bestAttemptContent);
}

Expand Down Expand Up @@ -97,25 +93,26 @@ - (void)loadAttachmentForUrlString:(NSString *)urlString withType:(NSString *)ty
NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
[[session downloadTaskWithURL:attachmentURL
completionHandler:^(NSURL *temporaryFileLocation, NSURLResponse *response, NSError *error) {
if (error != nil) {
#ifdef DEBUG
NSLog(@"unable to add attachment: %@", error.localizedDescription);
#endif
} else {
NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *localURL = [NSURL fileURLWithPath:[temporaryFileLocation.path stringByAppendingString:fileExt]];
[fileManager moveItemAtURL:temporaryFileLocation toURL:localURL error:&error];
NSError *attachmentError = nil;
attachment = [UNNotificationAttachment attachmentWithIdentifier:@"" URL:localURL options:nil error:&attachmentError];
if (attachmentError) {
#ifdef DEBUG
NSLog(@"unable to add attchment: %@", attachmentError.localizedDescription);
#endif
}
}
completionHandler(attachment);
}] resume];
if (error != nil) {
#ifdef DEBUG
NSLog(@"unable to add attachment: %@", error.localizedDescription);
#endif
} else {
NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *localURL = [NSURL fileURLWithPath:[temporaryFileLocation.path stringByAppendingString:fileExt]];
[fileManager moveItemAtURL:temporaryFileLocation toURL:localURL error:&error];

NSError *attachmentError = nil;
attachment = [UNNotificationAttachment attachmentWithIdentifier:@"" URL:localURL options:nil error:&attachmentError];
if (attachmentError) {
#ifdef DEBUG
NSLog(@"unable to add attchment: %@", attachmentError.localizedDescription);
#endif
}
}
completionHandler(attachment);
}] resume];
}


@end
Loading

0 comments on commit c0e2c20

Please sign in to comment.