-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from yandexmobile/release-0.7.0
release-0.7.0: AppMetrica Push SDK release 0.7.0
Showing
13 changed files
with
590 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
PODS: | ||
- YandexMobileMetrica (3.0.0): | ||
- YandexMobileMetrica/Static (= 3.0.0) | ||
- YandexMobileMetrica/Static (3.0.0) | ||
- YandexMobileMetricaPush (0.6.0): | ||
- YandexMobileMetricaPush/Static (= 0.6.0) | ||
- YandexMobileMetricaPush/Static (0.6.0): | ||
- YandexMobileMetrica (3.2.0): | ||
- YandexMobileMetrica/Static (= 3.2.0) | ||
- YandexMobileMetrica/Static (3.2.0) | ||
- YandexMobileMetricaPush (0.7.0): | ||
- YandexMobileMetricaPush/Static (= 0.7.0) | ||
- YandexMobileMetricaPush/Static (0.7.0): | ||
- YandexMobileMetrica (~> 3.0) | ||
|
||
DEPENDENCIES: | ||
- YandexMobileMetrica | ||
- YandexMobileMetricaPush | ||
|
||
SPEC CHECKSUMS: | ||
YandexMobileMetrica: 8dcf67ce99c73f351c55b5a21cff1e1f56b706e0 | ||
YandexMobileMetricaPush: 973073e69b63c9c3ec45ccb1fbfecd997538650a | ||
YandexMobileMetrica: f18374ee6977a4cd1d0a86298a0df4ad7baf4135 | ||
YandexMobileMetricaPush: 43d7c6bbaeee637418a8d3c287af93df1fb512d5 | ||
|
||
PODFILE CHECKSUM: b3e8be638ddfaf8be416cb8ec31ecb57ed3069ce | ||
PODFILE CHECKSUM: cc8115f2d2fb9083ae9a67cafb01c0893499d128 | ||
|
||
COCOAPODS: 1.4.0 |
31 changes: 31 additions & 0 deletions
31
...ples/ObjectiveC/YandexMobileMetricaPushNotificationServiceExtenstionSampleObjC/Info.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>$(DEVELOPMENT_LANGUAGE)</string> | ||
<key>CFBundleDisplayName</key> | ||
<string>YandexMobileMetricaPushNotificationServiceExtenstionSampleObjC</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>XPC!</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
<key>NSExtension</key> | ||
<dict> | ||
<key>NSExtensionPointIdentifier</key> | ||
<string>com.apple.usernotifications.service</string> | ||
<key>NSExtensionPrincipalClass</key> | ||
<string>NotificationService</string> | ||
</dict> | ||
</dict> | ||
</plist> |
16 changes: 16 additions & 0 deletions
16
...iveC/YandexMobileMetricaPushNotificationServiceExtenstionSampleObjC/NotificationService.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// NotificationService.h | ||
// | ||
// This file is a part of the AppMetrica | ||
// | ||
// Version for iOS © 2018 YANDEX | ||
// | ||
// You may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at https://yandex.com/legal/metrica_termsofuse/ | ||
// | ||
|
||
#import <UserNotifications/UserNotifications.h> | ||
|
||
@interface NotificationService : UNNotificationServiceExtension | ||
|
||
@end |
40 changes: 40 additions & 0 deletions
40
...iveC/YandexMobileMetricaPushNotificationServiceExtenstionSampleObjC/NotificationService.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// NotificationService.m | ||
// | ||
// This file is a part of the AppMetrica | ||
// | ||
// Version for iOS © 2018 YANDEX | ||
// | ||
// You may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at https://yandex.com/legal/metrica_termsofuse/ | ||
// | ||
|
||
#import "NotificationService.h" | ||
#import <YandexMobileMetricaPush/YandexMobileMetricaPush.h> | ||
|
||
@interface NotificationService () | ||
|
||
@property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver); | ||
@property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent; | ||
|
||
@end | ||
|
||
@implementation NotificationService | ||
|
||
- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler { | ||
self.contentHandler = contentHandler; | ||
self.bestAttemptContent = [request.content mutableCopy]; | ||
|
||
[YMPYandexMetricaPush setExtensionAppGroup:@"EXTENSION_AND_APP_SHARED_APP_GROUP_NAME"]; | ||
[YMPYandexMetricaPush handleDidReceiveNotificationRequest:request]; | ||
|
||
self.contentHandler(self.bestAttemptContent); | ||
} | ||
|
||
- (void)serviceExtensionTimeWillExpire { | ||
// Called just before the extension will be terminated by the system. | ||
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used. | ||
self.contentHandler(self.bestAttemptContent); | ||
} | ||
|
||
@end |
192 changes: 192 additions & 0 deletions
192
Examples/ObjectiveC/YandexMobileMetricaPushSampleObjC.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
PODS: | ||
- YandexMobileMetrica (3.0.0): | ||
- YandexMobileMetrica/Static (= 3.0.0) | ||
- YandexMobileMetrica/Static (3.0.0) | ||
- YandexMobileMetricaPush (0.6.0): | ||
- YandexMobileMetricaPush/Static (= 0.6.0) | ||
- YandexMobileMetricaPush/Static (0.6.0): | ||
- YandexMobileMetrica (3.2.0): | ||
- YandexMobileMetrica/Static (= 3.2.0) | ||
- YandexMobileMetrica/Static (3.2.0) | ||
- YandexMobileMetricaPush (0.7.0): | ||
- YandexMobileMetricaPush/Static (= 0.7.0) | ||
- YandexMobileMetricaPush/Static (0.7.0): | ||
- YandexMobileMetrica (~> 3.0) | ||
|
||
DEPENDENCIES: | ||
- YandexMobileMetrica | ||
- YandexMobileMetricaPush | ||
|
||
SPEC CHECKSUMS: | ||
YandexMobileMetrica: 8dcf67ce99c73f351c55b5a21cff1e1f56b706e0 | ||
YandexMobileMetricaPush: 973073e69b63c9c3ec45ccb1fbfecd997538650a | ||
YandexMobileMetrica: f18374ee6977a4cd1d0a86298a0df4ad7baf4135 | ||
YandexMobileMetricaPush: 43d7c6bbaeee637418a8d3c287af93df1fb512d5 | ||
|
||
PODFILE CHECKSUM: 138d02e69e9ea0891c989cd6e2622af9fc74675f | ||
PODFILE CHECKSUM: 77beec3b141cf23c0e068dd9c985355b5e453991 | ||
|
||
COCOAPODS: 1.4.0 |
31 changes: 31 additions & 0 deletions
31
Examples/Swift/YandexMobileMetricaPushNotificationServiceExtenstionSampleSwift/Info.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>$(DEVELOPMENT_LANGUAGE)</string> | ||
<key>CFBundleDisplayName</key> | ||
<string>YandexMobileMetricaPushNotificationServiceExtenstionSampleSwift</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>XPC!</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
<key>NSExtension</key> | ||
<dict> | ||
<key>NSExtensionPointIdentifier</key> | ||
<string>com.apple.usernotifications.service</string> | ||
<key>NSExtensionPrincipalClass</key> | ||
<string>$(PRODUCT_MODULE_NAME).NotificationService</string> | ||
</dict> | ||
</dict> | ||
</plist> |
42 changes: 42 additions & 0 deletions
42
...YandexMobileMetricaPushNotificationServiceExtenstionSampleSwift/NotificationService.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// | ||
// NotificationService.swift | ||
// | ||
// This file is a part of the AppMetrica | ||
// | ||
// Version for iOS © 2018 YANDEX | ||
// | ||
// You may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at https://yandex.com/legal/metrica_termsofuse/ | ||
// | ||
|
||
import UserNotifications | ||
import YandexMobileMetricaPush | ||
|
||
class NotificationService: UNNotificationServiceExtension { | ||
|
||
var contentHandler: ((UNNotificationContent) -> Void)? | ||
var bestAttemptContent: UNMutableNotificationContent? | ||
|
||
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) { | ||
self.contentHandler = contentHandler | ||
bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent) | ||
|
||
if let bestAttemptContent = bestAttemptContent { | ||
// Modify the notification content here... | ||
|
||
YMPYandexMetricaPush.setExtensionAppGroup("EXTENSION_AND_APP_SHARED_APP_GROUP_NAME") | ||
YMPYandexMetricaPush.handleDidReceive(request) | ||
|
||
contentHandler(bestAttemptContent) | ||
} | ||
} | ||
|
||
override func serviceExtensionTimeWillExpire() { | ||
// Called just before the extension will be terminated by the system. | ||
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used. | ||
if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent { | ||
contentHandler(bestAttemptContent) | ||
} | ||
} | ||
|
||
} |
194 changes: 193 additions & 1 deletion
194
Examples/Swift/YandexMobileMetricaPushSampleSwift.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters