├── .gitignore ├── .jazzy.yaml ├── .secret.baseline ├── .slather.yml ├── .swiftlint.yml ├── .travis.yml ├── BMSPush.podspec ├── BMSPush.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ ├── BMSPush.xcscheme │ ├── BMSPushHostApp.xcscheme │ └── BMSPushTests.xcscheme ├── BMSPush.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── Cartfile ├── Cartfile.resolved ├── LICENSE ├── NotificationInterceptor ├── Info.plist └── NotificationService.swift ├── Podfile ├── Podfile.lock ├── Pods ├── BMSAnalyticsAPI │ ├── LICENSE │ ├── README.md │ └── Source │ │ ├── Analytics.swift │ │ ├── Logger.swift │ │ └── RequestMetadata.swift ├── BMSCore │ ├── LICENSE │ ├── README.md │ └── Source │ │ ├── BMSClient.swift │ │ ├── Error.swift │ │ ├── Network Requests │ │ ├── BMSURLSession.swift │ │ ├── BMSURLSessionDelegate.swift │ │ ├── BMSURLSessionUtility.swift │ │ ├── NetworkMonitor.swift │ │ ├── Request.swift │ │ └── Response.swift │ │ ├── Resources │ │ ├── BMSCore.h │ │ └── module.modulemap │ │ └── Security │ │ ├── AuthorizationManager.swift │ │ ├── BaseAuthorizationManager.swift │ │ └── Identity │ │ ├── AppIdentity.swift │ │ ├── BaseAppIdentity.swift │ │ ├── BaseDeviceIdentity.swift │ │ ├── BaseUserIdentity.swift │ │ ├── DeviceIdentity.swift │ │ └── UserIdentity.swift ├── Manifest.lock ├── Pods.xcodeproj │ └── project.pbxproj └── Target Support Files │ ├── BMSAnalyticsAPI │ ├── BMSAnalyticsAPI-Info.plist │ ├── BMSAnalyticsAPI-dummy.m │ ├── BMSAnalyticsAPI-prefix.pch │ ├── BMSAnalyticsAPI-umbrella.h │ ├── BMSAnalyticsAPI.modulemap │ └── BMSAnalyticsAPI.xcconfig │ ├── BMSCore │ ├── BMSCore-Info.plist │ ├── BMSCore-dummy.m │ ├── BMSCore-prefix.pch │ ├── BMSCore.modulemap │ └── BMSCore.xcconfig │ ├── Pods-BMSPush │ ├── Pods-BMSPush-Info.plist │ ├── Pods-BMSPush-acknowledgements.markdown │ ├── Pods-BMSPush-acknowledgements.plist │ ├── Pods-BMSPush-dummy.m │ ├── Pods-BMSPush-umbrella.h │ ├── Pods-BMSPush.debug.xcconfig │ ├── Pods-BMSPush.modulemap │ └── Pods-BMSPush.release.xcconfig │ ├── Pods-BMSPushHostApp │ ├── Pods-BMSPushHostApp-Info.plist │ ├── Pods-BMSPushHostApp-acknowledgements.markdown │ ├── Pods-BMSPushHostApp-acknowledgements.plist │ ├── Pods-BMSPushHostApp-dummy.m │ ├── Pods-BMSPushHostApp-frameworks.sh │ ├── Pods-BMSPushHostApp-umbrella.h │ ├── Pods-BMSPushHostApp.debug.xcconfig │ ├── Pods-BMSPushHostApp.modulemap │ └── Pods-BMSPushHostApp.release.xcconfig │ └── Pods-BMSPushTests │ ├── Pods-BMSPushTests-Info.plist │ ├── Pods-BMSPushTests-acknowledgements.markdown │ ├── Pods-BMSPushTests-acknowledgements.plist │ ├── Pods-BMSPushTests-dummy.m │ ├── Pods-BMSPushTests-frameworks.sh │ ├── Pods-BMSPushTests-umbrella.h │ ├── Pods-BMSPushTests.debug.xcconfig │ ├── Pods-BMSPushTests.modulemap │ └── Pods-BMSPushTests.release.xcconfig ├── README.md ├── Source ├── BMSConstants.swift ├── BMSLocalPush │ └── BMSLocalPushNotification.swift ├── BMSPushClient.swift ├── BMSPushClientOptions.swift ├── BMSPushNotificationAction.swift ├── BMSPushNotificationActionCategory.swift ├── BMSPushUrlBuilder.swift ├── BMSPushUtils.swift ├── BMSResponse.swift ├── BMSRichPushNotificationOptions.swift └── Resource │ ├── BMSPush.h │ └── Info.plist ├── Tests ├── Test Apps │ └── BMSPushHostApp │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── Contents.json │ │ ├── LaunchImage-2.launchimage │ │ │ └── Contents.json │ │ └── LaunchImage.launchimage │ │ │ ├── Contents.json │ │ │ ├── settings_iOS58@2x-2.png │ │ │ ├── settings_iOS58@2x-3.png │ │ │ ├── settings_iOS58@2x-4.png │ │ │ └── settings_iOS58@2x-5.png │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── ViewController.swift └── Unit Tests │ └── BMSPushTests │ ├── BMSLocalPushNotificationTest.swift │ ├── BMSPushClientOptionsTest.swift │ ├── BMSPushNotificationActionCategoryTest.swift │ ├── BMSPushNotificationActionTest.swift │ ├── BMSPushTests.swift │ ├── BMSPushUrlBuilderTest.swift │ ├── BMSPushUtilsTest.swift │ ├── BMSResponseTests.swift │ └── Info.plist ├── run-sonar-swift.sh ├── scripts ├── publish-docs.sh └── release.sh └── sonar-project.properties /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | Build/ 3 | xcuserdata/ 4 | DerivedData/ 5 | Carthage/ 6 | -------------------------------------------------------------------------------- /.jazzy.yaml: -------------------------------------------------------------------------------- 1 | module: BMSPush 2 | author: IBM 3 | github_url: https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-swift-push 4 | xcodebuild_arguments: ["-workspace","BMSPush.xcworkspace","-scheme","BMSPush","-sdk","iphonesimulator"] 5 | 6 | skip_undocumented: true 7 | clean: true 8 | 9 | custom_categories: 10 | - name: Client 11 | children: 12 | - BMSPushClient 13 | 14 | - name: Options 15 | children: 16 | - BMSPushClientOptions 17 | - BMSPushNotificationAction 18 | - BMSPushNotificationActionCategory 19 | 20 | - name: iOS 10 Rich Push 21 | children: 22 | - BMSPushRichPushNotificationOptions 23 | -------------------------------------------------------------------------------- /.secret.baseline: -------------------------------------------------------------------------------- 1 | { 2 | "exclude": { 3 | "files": null, 4 | "lines": null 5 | }, 6 | "generated_at": "2020-11-11T11:59:49Z", 7 | "plugins_used": [ 8 | { 9 | "name": "AWSKeyDetector" 10 | }, 11 | { 12 | "name": "ArtifactoryDetector" 13 | }, 14 | { 15 | "base64_limit": 4.5, 16 | "name": "Base64HighEntropyString" 17 | }, 18 | { 19 | "name": "BasicAuthDetector" 20 | }, 21 | { 22 | "name": "BoxDetector" 23 | }, 24 | { 25 | "name": "CloudantDetector" 26 | }, 27 | { 28 | "name": "Db2Detector" 29 | }, 30 | { 31 | "name": "GheDetector" 32 | }, 33 | { 34 | "hex_limit": 3, 35 | "name": "HexHighEntropyString" 36 | }, 37 | { 38 | "name": "IbmCloudIamDetector" 39 | }, 40 | { 41 | "name": "IbmCosHmacDetector" 42 | }, 43 | { 44 | "name": "JwtTokenDetector" 45 | }, 46 | { 47 | "keyword_exclude": null, 48 | "name": "KeywordDetector" 49 | }, 50 | { 51 | "name": "MailchimpDetector" 52 | }, 53 | { 54 | "name": "PrivateKeyDetector" 55 | }, 56 | { 57 | "name": "SlackDetector" 58 | }, 59 | { 60 | "name": "SoftlayerDetector" 61 | }, 62 | { 63 | "name": "StripeDetector" 64 | }, 65 | { 66 | "name": "TwilioKeyDetector" 67 | } 68 | ], 69 | "results": { 70 | "BMSPush.xcodeproj/xcshareddata/xcschemes/BMSPush.xcscheme": [ 71 | { 72 | "hashed_secret": "ced141401e857993343ff48a9a47c099519a6b40", 73 | "is_secret": false, 74 | "is_verified": false, 75 | "line_number": 36, 76 | "type": "Hex High Entropy String", 77 | "verified_result": null 78 | }, 79 | { 80 | "hashed_secret": "47161f97e071832a5f4821af8e9d5100b419cc78", 81 | "is_secret": false, 82 | "is_verified": false, 83 | "line_number": 87, 84 | "type": "Hex High Entropy String", 85 | "verified_result": null 86 | } 87 | ], 88 | "BMSPush.xcodeproj/xcshareddata/xcschemes/BMSPushHostApp.xcscheme": [ 89 | { 90 | "hashed_secret": "afc1e501e7da5146ac8a81819f1d3feade7b23b9", 91 | "is_secret": false, 92 | "is_verified": false, 93 | "line_number": 36, 94 | "type": "Hex High Entropy String", 95 | "verified_result": null 96 | }, 97 | { 98 | "hashed_secret": "49403ff08d6b0257de0b5315c52303c04b3a7133", 99 | "is_secret": false, 100 | "is_verified": false, 101 | "line_number": 89, 102 | "type": "Hex High Entropy String", 103 | "verified_result": null 104 | } 105 | ], 106 | "BMSPush.xcodeproj/xcshareddata/xcschemes/BMSPushTests.xcscheme": [ 107 | { 108 | "hashed_secret": "ced141401e857993343ff48a9a47c099519a6b40", 109 | "is_secret": false, 110 | "is_verified": false, 111 | "line_number": 21, 112 | "type": "Hex High Entropy String", 113 | "verified_result": null 114 | } 115 | ], 116 | "Podfile.lock": [ 117 | { 118 | "hashed_secret": "72f96fe462f0b45227d704e253fb61bafd3c423d", 119 | "is_secret": false, 120 | "is_verified": false, 121 | "line_number": 18, 122 | "type": "Hex High Entropy String", 123 | "verified_result": null 124 | } 125 | ], 126 | "Pods/Manifest.lock": [ 127 | { 128 | "hashed_secret": "72f96fe462f0b45227d704e253fb61bafd3c423d", 129 | "is_secret": false, 130 | "is_verified": false, 131 | "line_number": 18, 132 | "type": "Hex High Entropy String", 133 | "verified_result": null 134 | } 135 | ], 136 | "README.md": [ 137 | { 138 | "hashed_secret": "1a70e90515ef1357abd3531dead4b53b6eba959f", 139 | "is_secret": false, 140 | "is_verified": false, 141 | "line_number": 325, 142 | "type": "Secret Keyword", 143 | "verified_result": null 144 | } 145 | ], 146 | "Source/BMSConstants.swift": [ 147 | { 148 | "hashed_secret": "8b142a91cfb6e617618ad437cedf74a6745f8926", 149 | "is_secret": false, 150 | "is_verified": false, 151 | "line_number": 64, 152 | "type": "Secret Keyword", 153 | "verified_result": null 154 | } 155 | ] 156 | }, 157 | "version": "0.13.1+ibm.25.dss", 158 | "word_list": { 159 | "file": null, 160 | "hash": null 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /.slather.yml: -------------------------------------------------------------------------------- 1 | coverage_service: coveralls 2 | xcodeproj: BMSPush.xcodeproj 3 | workspace: BMSPush.xcworkspace 4 | scheme: BMSPush 5 | ignore: 6 | - Tests/* 7 | - Source/BMSRichPushNotificationOptions.swift 8 | - Source/BMSPushClient.swift 9 | -------------------------------------------------------------------------------- /.swiftlint.yml: -------------------------------------------------------------------------------- 1 | disabled_rules: # rule identifiers to exclude from running 2 | - colon 3 | - variable_name_min_length # Sonarqube does not recognize this rule 4 | - statement_position # We don't follow this convention 5 | - trailing_whitespace # Trailing whitespace is a natural result of how Xcode handles tabs and returns 6 | - variable_name 7 | - line_length 8 | - trailing_semicolon 9 | - force_cast 10 | - force_try -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | 3 | matrix: 4 | include: 5 | - osx_image: xcode10.1 6 | - osx_image: xcode11.1 7 | 8 | before_install: 9 | - rvm install 2.4.0 10 | 11 | install: 12 | - gem install slather 13 | - gem install cocoapods 14 | - gem install jazzy 15 | 16 | script: 17 | - pod update 18 | - pod lib lint --allow-warnings 19 | - carthage update 20 | - xcodebuild clean build -workspace BMSPush.xcworkspace -scheme BMSPush CODE_SIGN_IDENTITY= CODE_SIGNING_REQUIRED=NO SUPPORTS_MACCATALYST=NO 21 | # For Xcode 7, test with iOS 8.1 22 | - if [[ "${TRAVIS_JOB_NUMBER}" = *".1"* ]]; then 23 | xcodebuild test -workspace BMSPush.xcworkspace -scheme BMSPushTests -destination 'platform=iOS Simulator,name=iPhone 6,OS=10.1'; 24 | fi 25 | # For Xcode 8, test with iOS 10.1 26 | - if [[ "${TRAVIS_JOB_NUMBER}" = *".2"* ]]; then 27 | xcodebuild test -workspace BMSPush.xcworkspace -scheme BMSPushTests -destination 'platform=iOS Simulator,name=iPhone 11 Pro Max,OS=13.1' -enableCodeCoverage YES; 28 | fi 29 | # When merging or pushing to the master branch, release a new version and publish the API documentation 30 | - if [ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_BRANCH}" = "master" ] && [[ "${TRAVIS_JOB_NUMBER}" = *".2"* ]]; then 31 | bash scripts/release.sh; 32 | bash scripts/publish-docs.sh; 33 | fi 34 | after_success: 35 | - if [[ "${TRAVIS_JOB_NUMBER}" = *".2"* ]]; then 36 | slather; 37 | fi 38 | -------------------------------------------------------------------------------- /BMSPush.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | 3 | s.name = 'BMSPush' 4 | 5 | s.version = '3.6.0' 6 | 7 | s.summary = 'Swift client side Push SDK for IBM Bluemix Push notifications services' 8 | s.homepage = 'https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-swift-push' 9 | s.license = 'Apache License, Version 2.0' 10 | s.authors = { 'IBM Bluemix Services Mobile SDK' => 'mobilsdk@us.ibm.com' } 11 | s.source = { :git => 'https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-swift-push.git', :tag => s.version } 12 | s.source_files = 'Source/**/*.swift' 13 | 14 | 15 | s.dependency 'BMSCore', '~> 2.4' 16 | s.ios.deployment_target = '8.0' 17 | 18 | s.requires_arc = true 19 | 20 | end 21 | -------------------------------------------------------------------------------- /BMSPush.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /BMSPush.xcodeproj/xcshareddata/xcschemes/BMSPush.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 34 | 40 | 41 | 42 | 43 | 44 | 50 | 51 | 52 | 53 | 54 | 55 | 66 | 67 | 73 | 74 | 75 | 76 | 77 | 78 | 84 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /BMSPush.xcodeproj/xcshareddata/xcschemes/BMSPushHostApp.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 34 | 40 | 41 | 42 | 43 | 44 | 50 | 51 | 52 | 53 | 54 | 55 | 66 | 68 | 74 | 75 | 76 | 77 | 78 | 79 | 85 | 87 | 93 | 94 | 95 | 96 | 98 | 99 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /BMSPush.xcodeproj/xcshareddata/xcschemes/BMSPushTests.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 16 | 17 | 19 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 42 | 43 | 44 | 45 | 51 | 52 | 54 | 55 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /BMSPush.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /BMSPush.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Cartfile: -------------------------------------------------------------------------------- 1 | github "ibm-bluemix-mobile-services/bms-clientsdk-swift-core" ~> 2.4 2 | -------------------------------------------------------------------------------- /Cartfile.resolved: -------------------------------------------------------------------------------- 1 | github "ibm-bluemix-mobile-services/bms-clientsdk-swift-analytics-api" "2.3.1" 2 | github "ibm-bluemix-mobile-services/bms-clientsdk-swift-core" "2.6.0" 3 | -------------------------------------------------------------------------------- /NotificationInterceptor/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | NotificationInterceptor 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | XPC! 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | NSExtension 24 | 25 | NSExtensionPointIdentifier 26 | com.apple.usernotifications.service 27 | NSExtensionPrincipalClass 28 | $(PRODUCT_MODULE_NAME).NotificationService 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /NotificationInterceptor/NotificationService.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NotificationService.swift 3 | // NotificationInterceptor 4 | // 5 | // Created by Jim Dickens on 12/13/16. 6 | // Copyright © 2016 IBM Corp. All rights reserved. 7 | // 8 | 9 | #if swift(>=3.0) 10 | import UserNotifications 11 | import BMSPush 12 | class NotificationService:BMSPushRichPushNotificationOptions { 13 | 14 | 15 | var contentHandler: ((UNNotificationContent) -> Void)? 16 | var bestAttemptContent: UNMutableNotificationContent? 17 | 18 | override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) { 19 | self.contentHandler = contentHandler 20 | bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent) 21 | 22 | BMSPushRichPushNotificationOptions.didReceive(request, withContentHandler: contentHandler) 23 | } 24 | 25 | override func serviceExtensionTimeWillExpire() { 26 | // Called just before the extension will be terminated by the system. 27 | // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used. 28 | if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent { 29 | contentHandler(bestAttemptContent) 30 | } 31 | } 32 | 33 | } 34 | #endif 35 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | 3 | target 'BMSPush' do 4 | platform :ios, '9.0' 5 | pod 'BMSCore', '~> 2.4' 6 | end 7 | 8 | target 'BMSPushTests' do 9 | platform :ios, '9.0' 10 | pod 'BMSCore', '~> 2.4' 11 | end 12 | 13 | target 'BMSPushHostApp' do 14 | platform :ios, '9.0' 15 | end 16 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - BMSAnalyticsAPI (2.3.1) 3 | - BMSCore (2.6.0): 4 | - BMSAnalyticsAPI (~> 2.3) 5 | 6 | DEPENDENCIES: 7 | - BMSCore (~> 2.4) 8 | 9 | SPEC REPOS: 10 | trunk: 11 | - BMSAnalyticsAPI 12 | - BMSCore 13 | 14 | SPEC CHECKSUMS: 15 | BMSAnalyticsAPI: f9c740eb3c0857c0955e58a10321a96b5d85304e 16 | BMSCore: 969b124f0170d0113a0926e73118057ca7d1eab3 17 | 18 | PODFILE CHECKSUM: e80a7d7ad79933b8fc203a435b3e57055e1352bc 19 | 20 | COCOAPODS: 1.8.4 21 | -------------------------------------------------------------------------------- /Pods/BMSAnalyticsAPI/README.md: -------------------------------------------------------------------------------- 1 | IBM Bluemix Mobile Services - Client SDK Swift Analytics API 2 | =================================================== 3 | 4 | BMSAnalyticsAPI provides interfaces and basic implementation of Logger and Analytics for [BMSCore](https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-swift-core). It is an internal dependency for BMSCore and is not intended for use in any other project. 5 | 6 | [![Build Status](https://travis-ci.org/ibm-bluemix-mobile-services/bms-clientsdk-swift-analytics-api.svg?branch=master)](https://travis-ci.org/ibm-bluemix-mobile-services/bms-clientsdk-swift-analytics-api) 7 | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/28b6315364374afa8bbfc21b6636ce7d)](https://www.codacy.com/app/ibm-bluemix-mobile-services/bms-clientsdk-swift-analytics-api?utm_source=github.com&utm_medium=referral&utm_content=ibm-bluemix-mobile-services/bms-clientsdk-swift-analytics-api&utm_campaign=Badge_Grade) 8 | [![Coverage Status](https://coveralls.io/repos/github/ibm-bluemix-mobile-services/bms-clientsdk-swift-analytics-api/badge.svg?branch=travis-fix)](https://coveralls.io/github/ibm-bluemix-mobile-services/bms-clientsdk-swift-analytics-api?branch=travis-fix) 9 | 10 | ======================= 11 | Copyright 2015 IBM Corp. 12 | 13 | Licensed under the Apache License, Version 2.0 (the "License"); 14 | you may not use this file except in compliance with the License. 15 | You may obtain a copy of the License at 16 | 17 | http://www.apache.org/licenses/LICENSE-2.0 18 | 19 | Unless required by applicable law or agreed to in writing, software 20 | distributed under the License is distributed on an "AS IS" BASIS, 21 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | See the License for the specific language governing permissions and 23 | limitations under the License. 24 | -------------------------------------------------------------------------------- /Pods/BMSAnalyticsAPI/Source/Analytics.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2016 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | 15 | 16 | // MARK: - Swift 3 17 | 18 | #if swift(>=3.0) 19 | 20 | 21 | 22 | // MARK: DeviceEvent 23 | 24 | /** 25 | The set of device events that the `Analytics` class will listen for. Whenever an event of the specified type occurs, analytics data for that event will be recorded. 26 | 27 | - Note: Register DeviceEvents in `Analytics.initialize(appName:apiKey:hasUserContext:deviceEvents:)`. 28 | */ 29 | public enum DeviceEvent { 30 | 31 | /// Records the duration of the app's lifecycle from when it enters the foreground to when it goes to the background. 32 | /// 33 | /// - Note: Only available for iOS apps. For watchOS apps, call the `Analytics.recordApplicationDidBecomeActive()` and `Analytics.recordApplicationWillResignActive()` methods in the app's `ExtensionDelegate` methods of the same name. 34 | case lifecycle 35 | 36 | /// Records metadata for network requests sent by the Bluemix Mobile Services SDKs (BMSCore, BMSAnalytics, BMSPush, BMSSecurity, etc.). 37 | /// To have metadata recorded for your own custom network requests and sent to the Mobile Analytics service, create your requests with `BMSURLSession` from the `BMSCore` framework. 38 | case network 39 | } 40 | 41 | 42 | 43 | // MARK: - AnalyticsDelegate 44 | 45 | // Connects the `Analytics` interface defined in BMSAnalyticsAPI with the implementation in BMSAnalytics. 46 | public protocol AnalyticsDelegate { 47 | 48 | var userIdentity: String? { get set } 49 | } 50 | 51 | 52 | 53 | // MARK: - Analytics 54 | 55 | /** 56 | Records analytics data and sends it to the [Mobile Analytics service](https://console.ng.bluemix.net/docs/services/mobileanalytics/mobileanalytics_overview.html). 57 | 58 | To subscribe to automated analytics recording, pass the `DeviceEvent` options that you want recorded in `initialize(appName:apiKey:hasUserContext:deviceEvents:)`. 59 | 60 | Custom events can be recorded with `log(metadata:)`. You can also define the current application user with `userIdentity` using, for example, the user's login information. 61 | 62 | When you are ready to send all of the recorded data to the Mobile Analytics service, use `send(completionHandler:)`. 63 | */ 64 | public class Analytics { 65 | 66 | 67 | // MARK: Properties 68 | 69 | /// Determines whether analytics data will be recorded. 70 | public static var isEnabled: Bool = true 71 | 72 | /// Identifies the current application user. 73 | /// To reset the `userIdentity`, set the value to nil. 74 | public static var userIdentity: String? { 75 | didSet { 76 | Analytics.delegate?.userIdentity = userIdentity 77 | } 78 | } 79 | 80 | 81 | 82 | // MARK: Properties (internal) 83 | 84 | // Handles all internal implementation of the Analytics class 85 | // Public access required by BMSAnalytics framework, which is required to initialize this property 86 | public static var delegate: AnalyticsDelegate? 87 | 88 | public static let logger = Logger.logger(name: Logger.bmsLoggerPrefix + "analytics") 89 | 90 | 91 | 92 | // MARK: Methods 93 | 94 | /** 95 | Record analytics data. 96 | 97 | Analytics logs are added to the log file until the file size is greater than `Logger.maxLogStoreSize`. At this point, the first half of the stored logs will be deleted to make room for new log data. 98 | 99 | When ready, use `send(completionHandler:)` to send the recorded data to the Mobile Analytics service. 100 | 101 | - Note: Do not supply values for the `file`, `function`, or `line` parameters. These parameters take default values to automatically record the file, function, and line in which this method was called. 102 | 103 | - parameter metadata: The analytics data 104 | */ 105 | public static func log(metadata: [String: Any], file: String = #file, function: String = #function, line: Int = #line) { 106 | 107 | Analytics.logger.analytics(metadata: metadata, file: file, function: function, line: line) 108 | } 109 | 110 | } 111 | 112 | 113 | 114 | 115 | 116 | /**************************************************************************************************/ 117 | 118 | 119 | 120 | 121 | 122 | // MARK: - Swift 2 123 | 124 | #else 125 | 126 | 127 | 128 | // MARK: DeviceEvent 129 | 130 | /** 131 | The set of device events that the `Analytics` class will listen for. Whenever an event of the specified type occurs, analytics data for that event will be recorded. 132 | 133 | - Note: Register DeviceEvents in `Analytics.initialize(appName:apiKey:hasUserContext:deviceEvents:)`. 134 | */ 135 | public enum DeviceEvent { 136 | 137 | /// Records the duration of the app's lifecycle from when it enters the foreground to when it goes to the background. 138 | /// 139 | /// - Note: Only available for iOS apps. For watchOS apps, call the `Analytics.recordApplicationDidBecomeActive()` and `Analytics.recordApplicationWillResignActive()` methods in the app's `ExtensionDelegate` methods of the same name. 140 | case lifecycle 141 | 142 | /// Records metadata for network requests sent by the Bluemix Mobile Services SDKs (BMSCore, BMSAnalytics, BMSPush, BMSSecurity, etc.). 143 | /// To have metadata recorded for your own custom network requests and sent to the Mobile Analytics service, create your requests with `BMSURLSession` from the `BMSCore` framework. 144 | case network 145 | } 146 | 147 | 148 | 149 | // MARK: - AnalyticsDelegate 150 | 151 | // Connects the `Analytics` interface defined in BMSAnalyticsAPI with the implementation in BMSAnalytics. 152 | public protocol AnalyticsDelegate { 153 | 154 | var userIdentity: String? { get set } 155 | } 156 | 157 | 158 | 159 | // MARK: - Analytics 160 | 161 | /** 162 | Records analytics data and sends it to the [Mobile Analytics service](https://console.ng.bluemix.net/docs/services/mobileanalytics/mobileanalytics_overview.html). 163 | 164 | To subscribe to automated analytics recording, pass the `DeviceEvent` options that you want recorded in `initialize(appName:apiKey:hasUserContext:deviceEvents:)`. 165 | 166 | Custom events can be recorded with `log(metadata:)`. You can also define the current application user with `userIdentity` using, for example, the user's login information. 167 | 168 | When you are ready to send all of the recorded data to the Mobile Analytics service, use `send(completionHandler:)`. 169 | */ 170 | public class Analytics { 171 | 172 | 173 | // MARK: Properties 174 | 175 | /// Determines whether analytics data will be recorded. 176 | public static var isEnabled: Bool = true 177 | 178 | /// Identifies the current application user. 179 | /// To reset the `userIdentity`, set the value to nil. 180 | public static var userIdentity: String? { 181 | didSet { 182 | Analytics.delegate?.userIdentity = userIdentity 183 | } 184 | } 185 | 186 | 187 | 188 | // MARK: Properties (internal) 189 | 190 | // Handles all internal implementation of the Analytics class 191 | // Public access required by BMSAnalytics framework, which is required to initialize this property 192 | public static var delegate: AnalyticsDelegate? 193 | 194 | public static let logger = Logger.logger(name: Logger.bmsLoggerPrefix + "analytics") 195 | 196 | 197 | 198 | // MARK: Methods 199 | 200 | /** 201 | Record analytics data. 202 | 203 | Analytics logs are added to the log file until the file size is greater than `Logger.maxLogStoreSize`. At this point, the first half of the stored logs will be deleted to make room for new log data. 204 | 205 | When ready, use `send(completionHandler:)` to send the recorded data to the Mobile Analytics service. 206 | 207 | - Note: Do not supply values for the `file`, `function`, or `line` parameters. These parameters take default values to automatically record the file, function, and line in which this method was called. 208 | 209 | - parameter metadata: The analytics data 210 | */ 211 | public static func log(metadata metadata: [String: AnyObject], file: String = #file, function: String = #function, line: Int = #line) { 212 | 213 | Analytics.logger.analytics(metadata: metadata, file: file, function: function, line: line) 214 | } 215 | 216 | } 217 | 218 | 219 | 220 | #endif 221 | -------------------------------------------------------------------------------- /Pods/BMSAnalyticsAPI/Source/RequestMetadata.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2016 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | 15 | 16 | // MARK: - Swift 3 17 | 18 | #if swift(>=3.0) 19 | 20 | 21 | 22 | /* 23 | Contains all of the metadata for one network request made via the `Request` or `BMSURLSession` APIs in BMSCore. 24 | Once the response is received and all of the metadata has been gathered, the metadata can be logged with Analytics. 25 | 26 | Note: This is not part of the API documentation because it is only meant to be used by BMSCore. 27 | */ 28 | public struct RequestMetadata { 29 | 30 | 31 | // The URL of the resource that the request is being sent to. 32 | public var url: URL? 33 | 34 | // The time at which the request is considered to have started. 35 | public let startTime: Int64 36 | 37 | // Allows Analytics to track each network request and its associated metadata. 38 | public let trackingId: String 39 | 40 | // The response received. 41 | public var response: URLResponse? = nil 42 | 43 | // The request method 44 | public var requestMethod: String? = nil 45 | 46 | // The time at which the request is considered complete. 47 | public var endTime: Int64 = 0 48 | 49 | // Amount of data sent. 50 | public var bytesSent: Int64 = 0 51 | 52 | // Amount of data received in the response. 53 | public var bytesReceived: Int64 = 0 54 | 55 | // Combines all of the metadata into a single JSON object 56 | public var combinedMetadata: [String: Any] { 57 | 58 | var roundTripTime: Int64 = 0 59 | // If this is not true, that means some BMSCore developer forgot to set the endTime somewhere 60 | if endTime > startTime { 61 | roundTripTime = endTime &- startTime 62 | } 63 | 64 | // Data for analytics logging 65 | // NSNumber is used because, for some reason, JSONSerialization fails to convert Int64 to JSON 66 | var responseMetadata: [String: Any] = [:] 67 | responseMetadata["$category"] = "network" 68 | responseMetadata["$trackingid"] = trackingId 69 | responseMetadata["$outboundTimestamp"] = NSNumber(value: startTime) 70 | responseMetadata["$inboundTimestamp"] = NSNumber(value: endTime) 71 | responseMetadata["$roundTripTime"] = NSNumber(value: roundTripTime) 72 | responseMetadata["$bytesSent"] = NSNumber(value: bytesSent) 73 | responseMetadata["$bytesReceived"] = NSNumber(value: bytesReceived) 74 | responseMetadata["$requestMethod"] = requestMethod 75 | 76 | if let urlString = url?.absoluteString { 77 | responseMetadata["$path"] = urlString 78 | } 79 | 80 | if let httpResponse = response as? HTTPURLResponse { 81 | responseMetadata["$responseCode"] = httpResponse.statusCode 82 | } 83 | 84 | return responseMetadata 85 | } 86 | 87 | 88 | 89 | public init(url: URL?, startTime: Int64, trackingId: String) { 90 | self.url = url 91 | self.startTime = startTime 92 | self.trackingId = trackingId 93 | } 94 | 95 | 96 | // Use analytics to record the request metadata 97 | public func recordMetadata() { 98 | 99 | Analytics.log(metadata: combinedMetadata) 100 | } 101 | } 102 | 103 | 104 | 105 | 106 | 107 | /**************************************************************************************************/ 108 | 109 | 110 | 111 | 112 | 113 | // MARK: - Swift 2 114 | 115 | #else 116 | 117 | 118 | 119 | /* 120 | Contains all of the metadata for one network request made via the `Request` or `BMSURLSession` APIs in BMSCore. 121 | Once the response is received and all of the metadata has been gathered, the metadata can be logged with Analytics. 122 | 123 | Note: This is not part of the API documentation because it is only meant to be used by BMSCore. 124 | */ 125 | public struct RequestMetadata { 126 | 127 | 128 | // The URL of the resource that the request is being sent to. 129 | public var url: NSURL? 130 | 131 | // The time at which the request is considered to have started. 132 | public let startTime: Int64 133 | 134 | // Allows Analytics to track each network request and its associated metadata. 135 | public let trackingId: String 136 | 137 | // The response received. 138 | public var response: NSURLResponse? = nil 139 | 140 | // The request method 141 | public var requestMethod: String? = nil 142 | 143 | // The time at which the request is considered complete. 144 | public var endTime: Int64 = 0 145 | 146 | // Amount of data sent. 147 | public var bytesSent: Int64 = 0 148 | 149 | // Amount of data received in the response. 150 | public var bytesReceived: Int64 = 0 151 | 152 | // Combines all of the metadata into a single JSON object 153 | public var combinedMetadata: [String: AnyObject] { 154 | 155 | var roundTripTime = 0 156 | // If this is not true, that means some BMSCore developer forgot to set the endTime somewhere 157 | if endTime > startTime { 158 | roundTripTime = endTime - startTime 159 | } 160 | 161 | // Data for analytics logging 162 | // NSNumber is used because, for some reason, JSONSerialization fails to convert Int64 to JSON 163 | var responseMetadata: [String: AnyObject] = [:] 164 | responseMetadata["$category"] = "network" 165 | responseMetadata["$trackingid"] = trackingId 166 | responseMetadata["$outboundTimestamp"] = NSNumber(longLong: startTime) 167 | responseMetadata["$inboundTimestamp"] = NSNumber(longLong: endTime) 168 | responseMetadata["$roundTripTime"] = NSNumber(integer: roundTripTime) 169 | responseMetadata["$bytesSent"] = NSNumber(longLong: bytesSent) 170 | responseMetadata["$bytesReceived"] = NSNumber(longLong: bytesReceived) 171 | responseMetadata["$requestMethod"] = requestMethod 172 | 173 | if let urlString = url?.absoluteString { 174 | responseMetadata["$path"] = urlString 175 | } 176 | 177 | if let httpResponse = response as? NSHTTPURLResponse { 178 | responseMetadata["$responseCode"] = httpResponse.statusCode 179 | } 180 | 181 | return responseMetadata 182 | } 183 | 184 | 185 | 186 | public init(url: NSURL?, startTime: Int64, trackingId: String) { 187 | self.url = url 188 | self.startTime = startTime 189 | self.trackingId = trackingId 190 | } 191 | 192 | 193 | // Use analytics to record the request metadata 194 | public func recordMetadata() { 195 | 196 | Analytics.log(metadata: combinedMetadata) 197 | } 198 | } 199 | 200 | 201 | 202 | #endif 203 | -------------------------------------------------------------------------------- /Pods/BMSCore/Source/BMSClient.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2016 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | 15 | 16 | // MARK: - Swift 3 17 | 18 | #if swift(>=3.0) 19 | 20 | 21 | 22 | /** 23 | A singleton that serves as the entry point to Bluemix client-server communication. 24 | */ 25 | public class BMSClient { 26 | 27 | 28 | // MARK: - Constants 29 | 30 | /** 31 | The region where your Bluemix service is hosted. 32 | */ 33 | public struct Region { 34 | 35 | 36 | /** 37 | The southern United States Bluemix region. 38 | 39 | - note: Use this in the `BMSClient.initialize(bluemixAppRoute:bluemixAppGUID:bluemixRegion:)` method. 40 | */ 41 | public static let usSouth = ".ng.bluemix.net" 42 | 43 | /** 44 | The United Kingdom Bluemix region. 45 | 46 | - note: Use this in the `BMSClient.initialize(bluemixAppRoute:bluemixAppGUID:bluemixRegion:)` method. 47 | */ 48 | public static let unitedKingdom = ".eu-gb.bluemix.net" 49 | 50 | /** 51 | The Sydney Bluemix region. 52 | 53 | - note: Use this in the `BMSClient.initialize(bluemixAppRoute:bluemixAppGUID:bluemixRegion:)` method. 54 | */ 55 | public static let sydney = ".au-syd.bluemix.net" 56 | 57 | /** 58 | The Germany Bluemix region. 59 | 60 | - note: Use this in the `BMSClient.initialize(bluemixAppRoute:bluemixAppGUID:bluemixRegion:)` method. 61 | */ 62 | public static let germany = ".eu-de.bluemix.net" 63 | 64 | /** 65 | The Washington Bluemix region. 66 | 67 | - note: Use this in the `BMSClient.initialize(bluemixAppRoute:bluemixAppGUID:bluemixRegion:)` method. 68 | */ 69 | public static let usEast = ".us-east.bluemix.net" 70 | 71 | /** 72 | The Tokyo Bluemix region. 73 | 74 | - note: Use this in the `BMSClient.initialize(bluemixAppRoute:bluemixAppGUID:bluemixRegion:)` method. 75 | */ 76 | public static let jpTok = ".jp-tok.bluemix.net" 77 | 78 | } 79 | 80 | 81 | 82 | // MARK: - Properties 83 | 84 | /// The singleton that is used for all `BMSClient` activity. 85 | public static let sharedInstance = BMSClient() 86 | 87 | /// Specifies the base Bluemix application backend URL. 88 | public private(set) var bluemixAppRoute: String? 89 | 90 | /// Specifies the region where the Bluemix service is hosted. 91 | public private(set) var bluemixRegion: String? 92 | 93 | /// Specifies the Bluemix application backend identifier. 94 | public private(set) var bluemixAppGUID: String? 95 | 96 | /// Specifies the allowed timeout (in seconds) for all `Request` network requests. 97 | public var requestTimeout: Double = 20.0 98 | 99 | 100 | 101 | // MARK: - Properties (internal) 102 | 103 | // Handles the authentication process for network requests. 104 | public var authorizationManager: AuthorizationManager 105 | 106 | 107 | 108 | // MARK: - Initializer 109 | 110 | /** 111 | The required intializer for the `BMSClient` class. 112 | 113 | Call this method on `BMSClient.sharedInstance`. 114 | 115 | - Note: The `backendAppRoute` and `backendAppGUID` parameters are not required; they are only used for making network requests to the Bluemix server using the `Request` class. 116 | 117 | - parameter backendAppRoute: (Optional) The base URL for the authorization server. 118 | - parameter backendAppGUID: (Optional) The GUID of the Bluemix application. 119 | - parameter bluemixRegion: The region where your Bluemix application is hosted. Use one of the `BMSClient.Region` constants. 120 | */ 121 | public func initialize(bluemixAppRoute: String? = nil, bluemixAppGUID: String? = nil, bluemixRegion: String...) { 122 | 123 | self.bluemixAppRoute = bluemixAppRoute 124 | self.bluemixAppGUID = bluemixAppGUID 125 | self.bluemixRegion = bluemixRegion[0] 126 | } 127 | 128 | 129 | // Prevent users from using BMSClient() initializer - They must use BMSClient.sharedInstance 130 | private init() { 131 | self.authorizationManager = BaseAuthorizationManager() 132 | } 133 | 134 | } 135 | 136 | 137 | 138 | 139 | 140 | /**************************************************************************************************/ 141 | 142 | 143 | 144 | 145 | 146 | #else 147 | 148 | // MARK: - Swift 2 149 | 150 | 151 | /** 152 | A singleton that serves as the entry point to Bluemix client-server communication. 153 | */ 154 | public class BMSClient { 155 | 156 | 157 | // MARK: - Constants 158 | 159 | /** 160 | The region where your Bluemix service is hosted. 161 | */ 162 | public struct Region { 163 | 164 | 165 | /** 166 | The southern United States Bluemix region. 167 | 168 | - note: Use this in the `BMSClient.initialize(bluemixAppRoute:bluemixAppGUID:bluemixRegion:)` method. 169 | */ 170 | public static let usSouth = ".ng.bluemix.net" 171 | 172 | /** 173 | The United Kingdom Bluemix region. 174 | 175 | - note: Use this in the `BMSClient.initialize(bluemixAppRoute:bluemixAppGUID:bluemixRegion:)` method. 176 | */ 177 | public static let unitedKingdom = ".eu-gb.bluemix.net" 178 | 179 | /** 180 | The Sydney Bluemix region. 181 | 182 | - note: Use this in the `BMSClient.initialize(bluemixAppRoute:bluemixAppGUID:bluemixRegion:)` method. 183 | */ 184 | public static let sydney = ".au-syd.bluemix.net" 185 | 186 | /** 187 | The Germany Bluemix region. 188 | 189 | - note: Use this in the `BMSClient.initialize(bluemixAppRoute:bluemixAppGUID:bluemixRegion:)` method. 190 | */ 191 | public static let germany = ".eu-de.bluemix.net" 192 | 193 | /** 194 | The Washington Bluemix region. 195 | 196 | - note: Use this in the `BMSClient.initialize(bluemixAppRoute:bluemixAppGUID:bluemixRegion:)` method. 197 | */ 198 | public static let usEast = ".us-east.bluemix.net" 199 | } 200 | 201 | 202 | 203 | // MARK: - Properties 204 | 205 | /// The singleton that is used for all `BMSClient` activity. 206 | public static let sharedInstance = BMSClient() 207 | 208 | /// Specifies the base Bluemix application backend URL. 209 | public private(set) var bluemixAppRoute: String? 210 | 211 | /// Specifies the region where the Bluemix service is hosted. 212 | public private(set) var bluemixRegion: String? 213 | 214 | /// Specifies the Bluemix application backend identifier. 215 | public private(set) var bluemixAppGUID: String? 216 | 217 | /// Specifies the allowed timeout (in seconds) for all `Request` network requests. 218 | public var requestTimeout: Double = 20.0 219 | 220 | 221 | 222 | // MARK: - Properties (internal) 223 | 224 | // Handles the authentication process for network requests. 225 | public var authorizationManager: AuthorizationManager 226 | 227 | 228 | 229 | // MARK: - Initializer 230 | 231 | /** 232 | The required intializer for the `BMSClient` class. 233 | 234 | Call this method on `BMSClient.sharedInstance`. 235 | 236 | - Note: The `backendAppRoute` and `backendAppGUID` parameters are not required; they are only used for making network requests to the Bluemix server using the `Request` class. 237 | 238 | - parameter backendAppRoute: (Optional) The base URL for the authorization server. 239 | - parameter backendAppGUID: (Optional) The GUID of the Bluemix application. 240 | - parameter bluemixRegion: The region where your Bluemix application is hosted. Use one of the `BMSClient.Region` constants. 241 | */ 242 | public func initialize(bluemixAppRoute bluemixAppRoute: String? = nil, bluemixAppGUID: String? = nil, bluemixRegion: String...) { 243 | 244 | self.bluemixAppRoute = bluemixAppRoute 245 | self.bluemixAppGUID = bluemixAppGUID 246 | self.bluemixRegion = bluemixRegion[0] 247 | } 248 | 249 | 250 | // Prevent users from using BMSClient() initializer - They must use BMSClient.sharedInstance 251 | private init() { 252 | self.authorizationManager = BaseAuthorizationManager() 253 | } 254 | 255 | } 256 | 257 | 258 | 259 | #endif 260 | -------------------------------------------------------------------------------- /Pods/BMSCore/Source/Error.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2016 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | 15 | 16 | // MARK: - Swift 3 17 | 18 | #if swift(>=3.0) 19 | 20 | 21 | 22 | /** 23 | Indicates a failure that occurred within the BMSCore framework. 24 | */ 25 | public enum BMSCoreError: Error { 26 | 27 | 28 | /// The URL provided in the `Request` initializer is invalid. 29 | case malformedUrl 30 | 31 | /// Need to call the `BMSClient.initialize(bluemixAppRoute:bluemixAppGUID:bluemixRegion:)` method. 32 | case clientNotInitialized 33 | 34 | /// The network request failed due to a 4xx or 5xx status code. 35 | case serverRespondedWithError 36 | 37 | static let domain = "com.ibm.mobilefirstplatform.clientsdk.swift.bmscore" 38 | } 39 | 40 | 41 | 42 | 43 | 44 | /**************************************************************************************************/ 45 | 46 | 47 | 48 | 49 | 50 | // MARK: - Swift 2 51 | 52 | #else 53 | 54 | 55 | 56 | /** 57 | Indicates a failure that occurred within the BMSCore framework. 58 | */ 59 | public enum BMSCoreError: Int, ErrorType { 60 | 61 | 62 | /// The URL provided in the `Request` initializer is invalid. 63 | case malformedUrl 64 | 65 | /// Need to call the `BMSClient.initialize(bluemixAppRoute:bluemixAppGUID:bluemixRegion:)` method. 66 | case clientNotInitialized 67 | 68 | /// The network request failed due to a 4xx or 5xx status code. 69 | case serverRespondedWithError 70 | 71 | static let domain = "com.ibm.mobilefirstplatform.clientsdk.swift.bmscore" 72 | } 73 | 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /Pods/BMSCore/Source/Network Requests/Response.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2016 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | 15 | 16 | // MARK: - Swift 3 17 | 18 | #if swift(>=3.0) 19 | 20 | 21 | 22 | /** 23 | Contains useful response data from an HTTP request made by the `Request` class. 24 | */ 25 | public class Response { 26 | 27 | 28 | // MARK: - Properties 29 | 30 | /// The HTTP status of the response. 31 | public let statusCode: Int? 32 | 33 | /// HTTP headers from the response. 34 | public let headers: [AnyHashable: Any]? 35 | 36 | /// The body of the response. 37 | /// Returns nil if there is no body or the body cannot be converted to a `String`. 38 | public let responseText: String? 39 | 40 | /// The body of the response. 41 | /// Returns nil if there is no body or if the response is not valid `Data`. 42 | public let responseData: Data? 43 | 44 | /// The response is considered successful if the returned status code is in the 2xx range. 45 | public let isSuccessful: Bool 46 | 47 | 48 | 49 | // MARK: - Properties (internal) 50 | 51 | internal let httpResponse: HTTPURLResponse? 52 | 53 | internal let isRedirect: Bool 54 | 55 | 56 | 57 | // MARK: - Initializer 58 | 59 | /** 60 | Converts an `HTTPURLResponse` to a more accessible response object. 61 | 62 | - parameter responseData: Data returned from the server. 63 | - parameter httpResponse: Response object returned from the `URLSession` request. 64 | - parameter isRedirect: True if the response requires a redirect. 65 | */ 66 | public init(responseData: Data?, httpResponse: HTTPURLResponse?, isRedirect: Bool) { 67 | 68 | self.isRedirect = isRedirect 69 | self.httpResponse = httpResponse 70 | self.headers = httpResponse?.allHeaderFields 71 | self.statusCode = httpResponse?.statusCode 72 | 73 | self.responseData = responseData 74 | if let responseData = responseData { 75 | self.responseText = String(data: responseData, encoding: .utf8) 76 | } 77 | else { 78 | self.responseText = nil 79 | } 80 | 81 | if let status = statusCode { 82 | isSuccessful = (200..<300 ~= status) 83 | } 84 | else { 85 | isSuccessful = false 86 | } 87 | } 88 | 89 | } 90 | 91 | 92 | 93 | 94 | 95 | /**************************************************************************************************/ 96 | 97 | 98 | 99 | 100 | 101 | // MARK: - Swift 2 102 | 103 | #else 104 | 105 | 106 | 107 | /** 108 | Contains useful response data from an HTTP request made by the `Request` class. 109 | */ 110 | public class Response { 111 | 112 | 113 | // MARK: - Properties 114 | 115 | /// The HTTP status of the response. 116 | public let statusCode: Int? 117 | 118 | /// HTTP headers from the response. 119 | public let headers: [NSObject: AnyObject]? 120 | 121 | /// The body of the response. 122 | /// Returns nil if there is no body or the body cannot be converted to a `String`. 123 | public let responseText: String? 124 | 125 | /// The body of the response. 126 | /// Returns nil if there is no body or if the response is not valid `NSData`. 127 | public let responseData: NSData? 128 | 129 | /// The response is considered successful if the returned status code is in the 2xx range. 130 | public let isSuccessful: Bool 131 | 132 | 133 | 134 | // MARK: - Properties (internal) 135 | 136 | internal let httpResponse: NSHTTPURLResponse? 137 | 138 | internal let isRedirect: Bool 139 | 140 | 141 | 142 | // MARK: - Initializer 143 | 144 | /** 145 | Converts an `NSHTTPURLResponse` to a more accessible `Response` object. 146 | 147 | - parameter responseData: Data returned from the server. 148 | - parameter httpResponse: Response object returned from the `NSURLSession` request. 149 | - parameter isRedirect: True if the response requires a redirect. 150 | */ 151 | public init(responseData: NSData?, httpResponse: NSHTTPURLResponse?, isRedirect: Bool) { 152 | 153 | self.isRedirect = isRedirect 154 | self.httpResponse = httpResponse 155 | self.headers = httpResponse?.allHeaderFields 156 | self.statusCode = httpResponse?.statusCode 157 | 158 | self.responseData = responseData 159 | if responseData != nil, let responseAsNSString = NSString(data: responseData!, encoding: NSUTF8StringEncoding) { 160 | self.responseText = String(responseAsNSString) 161 | } 162 | else { 163 | self.responseText = nil 164 | } 165 | 166 | if let status = statusCode { 167 | isSuccessful = (200..<300 ~= status) 168 | } 169 | else { 170 | isSuccessful = false 171 | } 172 | } 173 | 174 | } 175 | 176 | 177 | 178 | #endif 179 | -------------------------------------------------------------------------------- /Pods/BMSCore/Source/Resources/BMSCore.h: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2016 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | 15 | @import Foundation; 16 | @import BMSAnalyticsAPI; 17 | 18 | //! Project version number for BMSCore. 19 | FOUNDATION_EXPORT double BMSCoreVersionNumber; 20 | 21 | //! Project version string for BMSCore. 22 | FOUNDATION_EXPORT const unsigned char BMSCoreVersionString[]; 23 | -------------------------------------------------------------------------------- /Pods/BMSCore/Source/Resources/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module BMSCore { 2 | umbrella header "BMSCore.h" 3 | 4 | export * 5 | module * { export * } 6 | } -------------------------------------------------------------------------------- /Pods/BMSCore/Source/Security/AuthorizationManager.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2016 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | 15 | 16 | public enum PersistencePolicy: String { 17 | 18 | case always = "ALWAYS" 19 | case never = "NEVER" 20 | } 21 | 22 | 23 | 24 | public protocol AuthorizationManager { 25 | 26 | /*! 27 | @brief check if authorization is Required, using the responseAuthorizationHeader string 28 | @param statusCode http response status code 29 | @param responseAuthorizationHeader authirization header 30 | 31 | @return Whether authorization is required 32 | */ 33 | func isAuthorizationRequired(for statusCode: Int, httpResponseAuthorizationHeader: String) -> Bool 34 | 35 | /* 36 | @brief Whether authorization is required 37 | @param httpResponse http response ti check 38 | */ 39 | func isAuthorizationRequired(for httpResponse: Response) -> Bool 40 | 41 | /*! 42 | @brief Starts authorization process 43 | @param completionHandler The completion handler 44 | */ 45 | func obtainAuthorization(completionHandler callback: BMSCompletionHandler?) 46 | 47 | /*! 48 | @brief Clears authorization data 49 | */ 50 | func clearAuthorizationData() 51 | 52 | /*! 53 | @brief Returns previously obtained authorization header. The value will be added to all outgoing requests as Authorization header. 54 | @return cached authorization header 55 | */ 56 | var cachedAuthorizationHeader: String? { get } 57 | 58 | /*! 59 | @return UserIdentity object 60 | */ 61 | var userIdentity: UserIdentity? { get } 62 | 63 | /*! 64 | @return DeviceIdentity object 65 | */ 66 | var deviceIdentity: DeviceIdentity { get } 67 | 68 | /*! 69 | @return AppIdentity object 70 | */ 71 | var appIdentity: AppIdentity { get } 72 | } 73 | -------------------------------------------------------------------------------- /Pods/BMSCore/Source/Security/BaseAuthorizationManager.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2016 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | 15 | 16 | internal class BaseAuthorizationManager : AuthorizationManager { 17 | 18 | 19 | internal init() { 20 | 21 | } 22 | 23 | var cachedAuthorizationHeader:String? { 24 | get{ 25 | return nil 26 | } 27 | } 28 | 29 | var userIdentity:UserIdentity? { 30 | get{ 31 | return nil 32 | } 33 | } 34 | 35 | var deviceIdentity:DeviceIdentity { 36 | get{ 37 | return BaseDeviceIdentity() 38 | } 39 | } 40 | 41 | var appIdentity:AppIdentity { 42 | get{ 43 | return BaseAppIdentity() 44 | } 45 | } 46 | 47 | func isAuthorizationRequired(for statusCode: Int, httpResponseAuthorizationHeader: String) -> Bool{ 48 | return false 49 | } 50 | 51 | func isAuthorizationRequired(for httpResponse: Response) -> Bool { 52 | return false 53 | } 54 | 55 | func obtainAuthorization(completionHandler callback: BMSCompletionHandler?) { 56 | callback?(nil, nil) 57 | } 58 | 59 | func clearAuthorizationData() { 60 | 61 | } 62 | 63 | func addCachedAuthorizationHeader(request: NSMutableURLRequest) { 64 | 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /Pods/BMSCore/Source/Security/Identity/AppIdentity.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2015 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | 15 | 16 | public protocol AppIdentity { 17 | 18 | var ID: String? { get } 19 | var version: String? { get } 20 | } 21 | -------------------------------------------------------------------------------- /Pods/BMSCore/Source/Security/Identity/BaseAppIdentity.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2015 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | 15 | 16 | // MARK: - Swift 3 17 | 18 | #if swift(>=3.0) 19 | 20 | 21 | 22 | // This class represents the base app identity class, with default methods and keys 23 | open class BaseAppIdentity: AppIdentity { 24 | 25 | 26 | public struct Key { 27 | 28 | public static let ID = "id" 29 | public static let version = "version" 30 | } 31 | 32 | 33 | public internal(set) var jsonData: [String:String] = ([:]) 34 | public private(set) var extendedJsonData : [String:Any] = [String:Any]() 35 | 36 | public var ID: String? { 37 | get { 38 | return jsonData[BaseAppIdentity.Key.ID] != nil ? jsonData[BaseAppIdentity.Key.ID] : (extendedJsonData[BaseAppIdentity.Key.ID] as? String) 39 | } 40 | } 41 | public var version: String? { 42 | get { 43 | return jsonData[BaseAppIdentity.Key.version] != nil ? jsonData[BaseAppIdentity.Key.version] : (extendedJsonData[BaseAppIdentity.Key.version] as? String) 44 | } 45 | } 46 | 47 | public init() { 48 | 49 | jsonData[BaseAppIdentity.Key.ID] = Bundle.main.bundleIdentifier 50 | jsonData[BaseAppIdentity.Key.version] = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String 51 | } 52 | 53 | public convenience init(map: [String:AnyObject]?) { 54 | self.init(map : map as [String:Any]?) 55 | } 56 | 57 | public init(map: [String:Any]?) { 58 | extendedJsonData = map != nil ? map! : [String:Any]() 59 | guard let json = map as? [String:String] else { 60 | jsonData = ([:]) 61 | return 62 | } 63 | jsonData = json 64 | } 65 | 66 | } 67 | 68 | 69 | 70 | 71 | 72 | /**************************************************************************************************/ 73 | 74 | 75 | 76 | 77 | 78 | // MARK: - Swift 2 79 | 80 | #else 81 | 82 | 83 | 84 | // This class represents the base app identity class, with default methods and keys 85 | public class BaseAppIdentity: AppIdentity { 86 | 87 | 88 | public struct Key { 89 | 90 | public static let ID = "id" 91 | public static let version = "version" 92 | } 93 | 94 | 95 | public internal(set) var jsonData: [String:String] = ([:]) 96 | 97 | public var ID: String? { 98 | get { 99 | return jsonData[BaseAppIdentity.Key.ID] 100 | } 101 | } 102 | public var version: String? { 103 | get { 104 | return jsonData[BaseAppIdentity.Key.version] 105 | } 106 | } 107 | 108 | public init() { 109 | 110 | jsonData[BaseAppIdentity.Key.ID] = NSBundle.mainBundle().bundleIdentifier 111 | jsonData[BaseAppIdentity.Key.version] = NSBundle.mainBundle().infoDictionary?["CFBundleShortVersionString"] as? String 112 | } 113 | 114 | public init(map: [String:AnyObject]?) { 115 | guard let json = map as? [String:String] else { 116 | jsonData = ([:]) 117 | return 118 | } 119 | 120 | jsonData = json 121 | } 122 | 123 | } 124 | 125 | 126 | 127 | #endif 128 | -------------------------------------------------------------------------------- /Pods/BMSCore/Source/Security/Identity/BaseDeviceIdentity.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2015 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | #if !os(iOS) 15 | import WatchKit 16 | #endif 17 | 18 | 19 | // MARK: - Swift 3 20 | 21 | #if swift(>=3.0) 22 | 23 | 24 | 25 | // This class represents the base device identity class, with default methods and keys 26 | open class BaseDeviceIdentity: DeviceIdentity { 27 | 28 | 29 | public struct Key { 30 | 31 | public static let ID = "id" 32 | public static let OS = "platform" 33 | public static let OSVersion = "osVersion" 34 | public static let model = "model" 35 | } 36 | 37 | 38 | public internal(set) var jsonData: [String:String] = ([:]) 39 | public private(set) var extendedJsonData : [String:Any] = [String:Any]() 40 | 41 | public var ID: String? { 42 | get { 43 | return jsonData[BaseDeviceIdentity.Key.ID] != nil ? jsonData[BaseDeviceIdentity.Key.ID] : (extendedJsonData[BaseDeviceIdentity.Key.ID] as? String) 44 | } 45 | } 46 | 47 | public var OS: String? { 48 | get { 49 | return jsonData[BaseDeviceIdentity.Key.OS] != nil ? jsonData[BaseDeviceIdentity.Key.OS] : (extendedJsonData[BaseDeviceIdentity.Key.OS] as? String) 50 | } 51 | } 52 | 53 | 54 | public var OSVersion: String? { 55 | get { 56 | return jsonData[BaseDeviceIdentity.Key.OSVersion] != nil ? jsonData[BaseDeviceIdentity.Key.OSVersion] : (extendedJsonData[BaseDeviceIdentity.Key.OSVersion] as? String) 57 | } 58 | } 59 | 60 | 61 | public var model: String? { 62 | get { 63 | return jsonData[BaseDeviceIdentity.Key.model] != nil ? jsonData[BaseDeviceIdentity.Key.model] : (extendedJsonData[BaseDeviceIdentity.Key.model] as? String) 64 | } 65 | } 66 | 67 | 68 | public init() { 69 | 70 | #if os(watchOS) 71 | jsonData[BaseDeviceIdentity.Key.ID] = "Not Available" 72 | jsonData[BaseDeviceIdentity.Key.OS] = WKInterfaceDevice.current().systemName 73 | jsonData[BaseDeviceIdentity.Key.OSVersion] = WKInterfaceDevice.current().systemVersion 74 | jsonData[BaseDeviceIdentity.Key.model] = WKInterfaceDevice.current().model 75 | #else 76 | jsonData[BaseDeviceIdentity.Key.ID] = UIDevice.current.identifierForVendor?.uuidString 77 | jsonData[BaseDeviceIdentity.Key.OS] = UIDevice.current.systemName 78 | jsonData[BaseDeviceIdentity.Key.OSVersion] = UIDevice.current.systemVersion 79 | jsonData[BaseDeviceIdentity.Key.model] = UIDevice.current.model 80 | #endif 81 | } 82 | public convenience init(map: [String:AnyObject]?) { 83 | self.init(map : map as [String:Any]?) 84 | } 85 | 86 | public init(map: [String:Any]?) { 87 | extendedJsonData = map != nil ? map! : [String:Any]() 88 | guard let json = map as? [String:String] else { 89 | jsonData = ([:]) 90 | return 91 | } 92 | 93 | jsonData = json 94 | } 95 | 96 | } 97 | 98 | 99 | 100 | 101 | 102 | /**************************************************************************************************/ 103 | 104 | 105 | 106 | 107 | 108 | // MARK: - Swift 2 109 | 110 | #else 111 | 112 | 113 | 114 | // This class represents the base device identity class, with default methods and keys 115 | public class BaseDeviceIdentity: DeviceIdentity { 116 | 117 | 118 | public struct Key { 119 | 120 | public static let ID = "id" 121 | public static let OS = "platform" 122 | public static let OSVersion = "osVersion" 123 | public static let model = "model" 124 | } 125 | 126 | 127 | public internal(set) var jsonData: [String:String] = ([:]) 128 | 129 | public var ID: String? { 130 | get { 131 | return jsonData[BaseDeviceIdentity.Key.ID] 132 | } 133 | } 134 | 135 | public var OS: String? { 136 | get { 137 | return jsonData[BaseDeviceIdentity.Key.OS] 138 | } 139 | } 140 | 141 | 142 | public var OSVersion: String? { 143 | get { 144 | return jsonData[BaseDeviceIdentity.Key.OSVersion] 145 | } 146 | } 147 | 148 | 149 | public var model: String? { 150 | get { 151 | return jsonData[BaseDeviceIdentity.Key.model] 152 | } 153 | } 154 | 155 | 156 | public init() { 157 | 158 | #if os(watchOS) 159 | jsonData[BaseDeviceIdentity.Key.ID] = "Not Available" 160 | jsonData[BaseDeviceIdentity.Key.OS] = WKInterfaceDevice.currentDevice().systemName 161 | jsonData[BaseDeviceIdentity.Key.OSVersion] = WKInterfaceDevice.currentDevice().systemVersion 162 | jsonData[BaseDeviceIdentity.Key.model] = WKInterfaceDevice.currentDevice().model 163 | #else 164 | jsonData[BaseDeviceIdentity.Key.ID] = UIDevice.currentDevice().identifierForVendor?.UUIDString 165 | jsonData[BaseDeviceIdentity.Key.OS] = UIDevice.currentDevice().systemName 166 | jsonData[BaseDeviceIdentity.Key.OSVersion] = UIDevice.currentDevice().systemVersion 167 | jsonData[BaseDeviceIdentity.Key.model] = UIDevice.currentDevice().model 168 | #endif 169 | } 170 | 171 | public init(map: [String:AnyObject]?) { 172 | guard let json = map as? [String:String] else { 173 | jsonData = ([:]) 174 | return 175 | } 176 | 177 | jsonData = json 178 | } 179 | 180 | } 181 | 182 | 183 | 184 | #endif 185 | -------------------------------------------------------------------------------- /Pods/BMSCore/Source/Security/Identity/BaseUserIdentity.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2015 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | 15 | // MARK: - Swift 3 16 | 17 | 18 | #if swift(>=3.0) 19 | 20 | 21 | 22 | // This class represents the base user identity class, with default methods and keys 23 | open class BaseUserIdentity: UserIdentity { 24 | 25 | 26 | public struct Key { 27 | 28 | public static let ID = "id" 29 | public static let authorizedBy = "authBy" 30 | public static let displayName = "displayName" 31 | } 32 | 33 | 34 | public private(set) var jsonData : [String:String] = ([:]) 35 | public private(set) var extendedJsonData : [String:Any] = [String:Any]() 36 | 37 | public var ID: String? { 38 | get { 39 | return jsonData[BaseUserIdentity.Key.ID] != nil ? jsonData[BaseUserIdentity.Key.ID] : (extendedJsonData[BaseUserIdentity.Key.ID] as? String) 40 | } 41 | } 42 | 43 | public var authorizedBy: String? { 44 | get { 45 | return jsonData[BaseUserIdentity.Key.authorizedBy] != nil ? jsonData[BaseUserIdentity.Key.authorizedBy] : (extendedJsonData[BaseUserIdentity.Key.authorizedBy] as? String) 46 | } 47 | } 48 | 49 | public var displayName: String? { 50 | get { 51 | return jsonData[BaseUserIdentity.Key.displayName] != nil ? jsonData[BaseUserIdentity.Key.displayName] : (extendedJsonData[BaseUserIdentity.Key.displayName] as? String) 52 | } 53 | } 54 | 55 | public init() { 56 | 57 | } 58 | 59 | public convenience init(map: [String:AnyObject]?) { 60 | self.init(map : map as [String:Any]?) 61 | } 62 | 63 | public init(map: [String:Any]?) { 64 | extendedJsonData = map != nil ? map! : [String:Any]() 65 | guard let json = map as? [String:String] else { 66 | jsonData = ([:]) 67 | return 68 | } 69 | jsonData = json 70 | } 71 | 72 | 73 | } 74 | 75 | 76 | 77 | 78 | 79 | 80 | /**************************************************************************************************/ 81 | 82 | 83 | 84 | 85 | 86 | // MARK: - Swift 2 87 | 88 | #else 89 | 90 | 91 | 92 | // This class represents the base user identity class, with default methods and keys 93 | public class BaseUserIdentity: UserIdentity { 94 | 95 | 96 | public struct Key { 97 | 98 | public static let ID = "id" 99 | public static let authorizedBy = "authBy" 100 | public static let displayName = "displayName" 101 | } 102 | 103 | 104 | public private(set) var jsonData : [String:String] = ([:]) 105 | 106 | public var ID: String? { 107 | get { 108 | return jsonData[BaseUserIdentity.Key.ID] 109 | } 110 | } 111 | 112 | public var authorizedBy: String? { 113 | get { 114 | return jsonData[BaseUserIdentity.Key.authorizedBy] 115 | } 116 | } 117 | 118 | public var displayName: String? { 119 | get { 120 | return jsonData[BaseUserIdentity.Key.displayName] 121 | } 122 | } 123 | 124 | public init() { 125 | 126 | } 127 | 128 | public init(map: [String:AnyObject]?) { 129 | guard let json = map as? [String:String] else { 130 | jsonData = ([:]) 131 | return 132 | } 133 | jsonData = json 134 | } 135 | 136 | 137 | } 138 | 139 | 140 | 141 | #endif 142 | -------------------------------------------------------------------------------- /Pods/BMSCore/Source/Security/Identity/DeviceIdentity.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2015 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | 15 | 16 | public protocol DeviceIdentity { 17 | 18 | var ID: String? { get } 19 | var OS: String? { get } 20 | var OSVersion: String? { get } 21 | var model: String? { get } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /Pods/BMSCore/Source/Security/Identity/UserIdentity.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2015 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | 15 | 16 | public protocol UserIdentity { 17 | 18 | var ID: String? { get } 19 | var authorizedBy: String? { get } 20 | var displayName: String? { get } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - BMSAnalyticsAPI (2.3.1) 3 | - BMSCore (2.6.0): 4 | - BMSAnalyticsAPI (~> 2.3) 5 | 6 | DEPENDENCIES: 7 | - BMSCore (~> 2.4) 8 | 9 | SPEC REPOS: 10 | trunk: 11 | - BMSAnalyticsAPI 12 | - BMSCore 13 | 14 | SPEC CHECKSUMS: 15 | BMSAnalyticsAPI: f9c740eb3c0857c0955e58a10321a96b5d85304e 16 | BMSCore: 969b124f0170d0113a0926e73118057ca7d1eab3 17 | 18 | PODFILE CHECKSUM: e80a7d7ad79933b8fc203a435b3e57055e1352bc 19 | 20 | COCOAPODS: 1.8.4 21 | -------------------------------------------------------------------------------- /Pods/Target Support Files/BMSAnalyticsAPI/BMSAnalyticsAPI-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 2.3.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/BMSAnalyticsAPI/BMSAnalyticsAPI-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_BMSAnalyticsAPI : NSObject 3 | @end 4 | @implementation PodsDummy_BMSAnalyticsAPI 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/BMSAnalyticsAPI/BMSAnalyticsAPI-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/BMSAnalyticsAPI/BMSAnalyticsAPI-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double BMSAnalyticsAPIVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char BMSAnalyticsAPIVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/BMSAnalyticsAPI/BMSAnalyticsAPI.modulemap: -------------------------------------------------------------------------------- 1 | framework module BMSAnalyticsAPI { 2 | umbrella header "BMSAnalyticsAPI-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/BMSAnalyticsAPI/BMSAnalyticsAPI.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/BMSAnalyticsAPI 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/BMSAnalyticsAPI 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 11 | -------------------------------------------------------------------------------- /Pods/Target Support Files/BMSCore/BMSCore-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 2.6.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/BMSCore/BMSCore-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_BMSCore : NSObject 3 | @end 4 | @implementation PodsDummy_BMSCore 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/BMSCore/BMSCore-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/BMSCore/BMSCore.modulemap: -------------------------------------------------------------------------------- 1 | framework module BMSCore { 2 | umbrella header "BMSCore.h" 3 | 4 | export * 5 | module * { export * } 6 | } -------------------------------------------------------------------------------- /Pods/Target Support Files/BMSCore/BMSCore.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/BMSCore 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BMSAnalyticsAPI" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/BMSCore 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 12 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-BMSPush/Pods-BMSPush-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-BMSPush/Pods-BMSPush-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_BMSPush : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_BMSPush 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-BMSPush/Pods-BMSPush-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_BMSPushVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_BMSPushVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-BMSPush/Pods-BMSPush.debug.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BMSAnalyticsAPI" "${PODS_CONFIGURATION_BUILD_DIR}/BMSCore" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BMSAnalyticsAPI/BMSAnalyticsAPI.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/BMSCore/BMSCore.framework/Headers" 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' '@executable_path/../../Frameworks' 5 | OTHER_LDFLAGS = $(inherited) -framework "BMSAnalyticsAPI" -framework "BMSCore" 6 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 7 | PODS_BUILD_DIR = ${BUILD_DIR} 8 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 9 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 10 | PODS_ROOT = ${SRCROOT}/Pods 11 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 12 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-BMSPush/Pods-BMSPush.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_BMSPush { 2 | umbrella header "Pods-BMSPush-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-BMSPush/Pods-BMSPush.release.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BMSAnalyticsAPI" "${PODS_CONFIGURATION_BUILD_DIR}/BMSCore" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BMSAnalyticsAPI/BMSAnalyticsAPI.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/BMSCore/BMSCore.framework/Headers" 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' '@executable_path/../../Frameworks' 5 | OTHER_LDFLAGS = $(inherited) -framework "BMSAnalyticsAPI" -framework "BMSCore" 6 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 7 | PODS_BUILD_DIR = ${BUILD_DIR} 8 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 9 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 10 | PODS_ROOT = ${SRCROOT}/Pods 11 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 12 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-BMSPushHostApp/Pods-BMSPushHostApp-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-BMSPushHostApp/Pods-BMSPushHostApp-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_BMSPushHostApp : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_BMSPushHostApp 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-BMSPushHostApp/Pods-BMSPushHostApp-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | function on_error { 7 | echo "$(realpath -mq "${0}"):$1: error: Unexpected failure" 8 | } 9 | trap 'on_error $LINENO' ERR 10 | 11 | if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then 12 | # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy 13 | # frameworks to, so exit 0 (signalling the script phase was successful). 14 | exit 0 15 | fi 16 | 17 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 18 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 19 | 20 | COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" 21 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 22 | 23 | # Used as a return value for each invocation of `strip_invalid_archs` function. 24 | STRIP_BINARY_RETVAL=0 25 | 26 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 27 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 28 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 29 | 30 | # Copies and strips a vendored framework 31 | install_framework() 32 | { 33 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 34 | local source="${BUILT_PRODUCTS_DIR}/$1" 35 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 36 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 37 | elif [ -r "$1" ]; then 38 | local source="$1" 39 | fi 40 | 41 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 42 | 43 | if [ -L "${source}" ]; then 44 | echo "Symlinked..." 45 | source="$(readlink "${source}")" 46 | fi 47 | 48 | # Use filter instead of exclude so missing patterns don't throw errors. 49 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 50 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 51 | 52 | local basename 53 | basename="$(basename -s .framework "$1")" 54 | binary="${destination}/${basename}.framework/${basename}" 55 | 56 | if ! [ -r "$binary" ]; then 57 | binary="${destination}/${basename}" 58 | elif [ -L "${binary}" ]; then 59 | echo "Destination binary is symlinked..." 60 | dirname="$(dirname "${binary}")" 61 | binary="${dirname}/$(readlink "${binary}")" 62 | fi 63 | 64 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 65 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 66 | strip_invalid_archs "$binary" 67 | fi 68 | 69 | # Resign the code if required by the build settings to avoid unstable apps 70 | code_sign_if_enabled "${destination}/$(basename "$1")" 71 | 72 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 73 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 74 | local swift_runtime_libs 75 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u) 76 | for lib in $swift_runtime_libs; do 77 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 78 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 79 | code_sign_if_enabled "${destination}/${lib}" 80 | done 81 | fi 82 | } 83 | 84 | # Copies and strips a vendored dSYM 85 | install_dsym() { 86 | local source="$1" 87 | if [ -r "$source" ]; then 88 | # Copy the dSYM into a the targets temp dir. 89 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" 90 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" 91 | 92 | local basename 93 | basename="$(basename -s .framework.dSYM "$source")" 94 | binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}" 95 | 96 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 97 | if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then 98 | strip_invalid_archs "$binary" 99 | fi 100 | 101 | if [[ $STRIP_BINARY_RETVAL == 1 ]]; then 102 | # Move the stripped file into its final destination. 103 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" 104 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}" 105 | else 106 | # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. 107 | touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM" 108 | fi 109 | fi 110 | } 111 | 112 | # Copies the bcsymbolmap files of a vendored framework 113 | install_bcsymbolmap() { 114 | local bcsymbolmap_path="$1" 115 | local destination="${BUILT_PRODUCTS_DIR}" 116 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"" 117 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}" 118 | } 119 | 120 | # Signs a framework with the provided identity 121 | code_sign_if_enabled() { 122 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 123 | # Use the current code_sign_identity 124 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 125 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" 126 | 127 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 128 | code_sign_cmd="$code_sign_cmd &" 129 | fi 130 | echo "$code_sign_cmd" 131 | eval "$code_sign_cmd" 132 | fi 133 | } 134 | 135 | # Strip invalid architectures 136 | strip_invalid_archs() { 137 | binary="$1" 138 | # Get architectures for current target binary 139 | binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" 140 | # Intersect them with the architectures we are building for 141 | intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" 142 | # If there are no archs supported by this binary then warn the user 143 | if [[ -z "$intersected_archs" ]]; then 144 | echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." 145 | STRIP_BINARY_RETVAL=0 146 | return 147 | fi 148 | stripped="" 149 | for arch in $binary_archs; do 150 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 151 | # Strip non-valid architectures in-place 152 | lipo -remove "$arch" -output "$binary" "$binary" 153 | stripped="$stripped $arch" 154 | fi 155 | done 156 | if [[ "$stripped" ]]; then 157 | echo "Stripped $binary of architectures:$stripped" 158 | fi 159 | STRIP_BINARY_RETVAL=1 160 | } 161 | 162 | 163 | if [[ "$CONFIGURATION" == "Debug" ]]; then 164 | install_framework "${BUILT_PRODUCTS_DIR}/BMSAnalyticsAPI/BMSAnalyticsAPI.framework" 165 | install_framework "${BUILT_PRODUCTS_DIR}/BMSCore/BMSCore.framework" 166 | fi 167 | if [[ "$CONFIGURATION" == "Release" ]]; then 168 | install_framework "${BUILT_PRODUCTS_DIR}/BMSAnalyticsAPI/BMSAnalyticsAPI.framework" 169 | install_framework "${BUILT_PRODUCTS_DIR}/BMSCore/BMSCore.framework" 170 | fi 171 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 172 | wait 173 | fi 174 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-BMSPushHostApp/Pods-BMSPushHostApp-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_BMSPushHostAppVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_BMSPushHostAppVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-BMSPushHostApp/Pods-BMSPushHostApp.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BMSAnalyticsAPI" "${PODS_CONFIGURATION_BUILD_DIR}/BMSCore" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BMSAnalyticsAPI/BMSAnalyticsAPI.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/BMSCore/BMSCore.framework/Headers" 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 6 | OTHER_LDFLAGS = $(inherited) -framework "BMSAnalyticsAPI" -framework "BMSCore" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-BMSPushHostApp/Pods-BMSPushHostApp.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_BMSPushHostApp { 2 | umbrella header "Pods-BMSPushHostApp-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-BMSPushHostApp/Pods-BMSPushHostApp.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BMSAnalyticsAPI" "${PODS_CONFIGURATION_BUILD_DIR}/BMSCore" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BMSAnalyticsAPI/BMSAnalyticsAPI.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/BMSCore/BMSCore.framework/Headers" 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 6 | OTHER_LDFLAGS = $(inherited) -framework "BMSAnalyticsAPI" -framework "BMSCore" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-BMSPushTests/Pods-BMSPushTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-BMSPushTests/Pods-BMSPushTests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_BMSPushTests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_BMSPushTests 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-BMSPushTests/Pods-BMSPushTests-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | function on_error { 7 | echo "$(realpath -mq "${0}"):$1: error: Unexpected failure" 8 | } 9 | trap 'on_error $LINENO' ERR 10 | 11 | if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then 12 | # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy 13 | # frameworks to, so exit 0 (signalling the script phase was successful). 14 | exit 0 15 | fi 16 | 17 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 18 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 19 | 20 | COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" 21 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 22 | 23 | # Used as a return value for each invocation of `strip_invalid_archs` function. 24 | STRIP_BINARY_RETVAL=0 25 | 26 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 27 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 28 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 29 | 30 | # Copies and strips a vendored framework 31 | install_framework() 32 | { 33 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 34 | local source="${BUILT_PRODUCTS_DIR}/$1" 35 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 36 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 37 | elif [ -r "$1" ]; then 38 | local source="$1" 39 | fi 40 | 41 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 42 | 43 | if [ -L "${source}" ]; then 44 | echo "Symlinked..." 45 | source="$(readlink "${source}")" 46 | fi 47 | 48 | # Use filter instead of exclude so missing patterns don't throw errors. 49 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 50 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 51 | 52 | local basename 53 | basename="$(basename -s .framework "$1")" 54 | binary="${destination}/${basename}.framework/${basename}" 55 | 56 | if ! [ -r "$binary" ]; then 57 | binary="${destination}/${basename}" 58 | elif [ -L "${binary}" ]; then 59 | echo "Destination binary is symlinked..." 60 | dirname="$(dirname "${binary}")" 61 | binary="${dirname}/$(readlink "${binary}")" 62 | fi 63 | 64 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 65 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 66 | strip_invalid_archs "$binary" 67 | fi 68 | 69 | # Resign the code if required by the build settings to avoid unstable apps 70 | code_sign_if_enabled "${destination}/$(basename "$1")" 71 | 72 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 73 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 74 | local swift_runtime_libs 75 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u) 76 | for lib in $swift_runtime_libs; do 77 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 78 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 79 | code_sign_if_enabled "${destination}/${lib}" 80 | done 81 | fi 82 | } 83 | 84 | # Copies and strips a vendored dSYM 85 | install_dsym() { 86 | local source="$1" 87 | if [ -r "$source" ]; then 88 | # Copy the dSYM into a the targets temp dir. 89 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" 90 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" 91 | 92 | local basename 93 | basename="$(basename -s .framework.dSYM "$source")" 94 | binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}" 95 | 96 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 97 | if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then 98 | strip_invalid_archs "$binary" 99 | fi 100 | 101 | if [[ $STRIP_BINARY_RETVAL == 1 ]]; then 102 | # Move the stripped file into its final destination. 103 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" 104 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}" 105 | else 106 | # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. 107 | touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM" 108 | fi 109 | fi 110 | } 111 | 112 | # Copies the bcsymbolmap files of a vendored framework 113 | install_bcsymbolmap() { 114 | local bcsymbolmap_path="$1" 115 | local destination="${BUILT_PRODUCTS_DIR}" 116 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"" 117 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}" 118 | } 119 | 120 | # Signs a framework with the provided identity 121 | code_sign_if_enabled() { 122 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 123 | # Use the current code_sign_identity 124 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 125 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" 126 | 127 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 128 | code_sign_cmd="$code_sign_cmd &" 129 | fi 130 | echo "$code_sign_cmd" 131 | eval "$code_sign_cmd" 132 | fi 133 | } 134 | 135 | # Strip invalid architectures 136 | strip_invalid_archs() { 137 | binary="$1" 138 | # Get architectures for current target binary 139 | binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" 140 | # Intersect them with the architectures we are building for 141 | intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" 142 | # If there are no archs supported by this binary then warn the user 143 | if [[ -z "$intersected_archs" ]]; then 144 | echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." 145 | STRIP_BINARY_RETVAL=0 146 | return 147 | fi 148 | stripped="" 149 | for arch in $binary_archs; do 150 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 151 | # Strip non-valid architectures in-place 152 | lipo -remove "$arch" -output "$binary" "$binary" 153 | stripped="$stripped $arch" 154 | fi 155 | done 156 | if [[ "$stripped" ]]; then 157 | echo "Stripped $binary of architectures:$stripped" 158 | fi 159 | STRIP_BINARY_RETVAL=1 160 | } 161 | 162 | 163 | if [[ "$CONFIGURATION" == "Debug" ]]; then 164 | install_framework "${BUILT_PRODUCTS_DIR}/BMSAnalyticsAPI/BMSAnalyticsAPI.framework" 165 | install_framework "${BUILT_PRODUCTS_DIR}/BMSCore/BMSCore.framework" 166 | fi 167 | if [[ "$CONFIGURATION" == "Release" ]]; then 168 | install_framework "${BUILT_PRODUCTS_DIR}/BMSAnalyticsAPI/BMSAnalyticsAPI.framework" 169 | install_framework "${BUILT_PRODUCTS_DIR}/BMSCore/BMSCore.framework" 170 | fi 171 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 172 | wait 173 | fi 174 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-BMSPushTests/Pods-BMSPushTests-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_BMSPushTestsVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_BMSPushTestsVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-BMSPushTests/Pods-BMSPushTests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BMSAnalyticsAPI" "${PODS_CONFIGURATION_BUILD_DIR}/BMSCore" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BMSAnalyticsAPI/BMSAnalyticsAPI.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/BMSCore/BMSCore.framework/Headers" 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 6 | OTHER_LDFLAGS = $(inherited) -framework "BMSAnalyticsAPI" -framework "BMSCore" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-BMSPushTests/Pods-BMSPushTests.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_BMSPushTests { 2 | umbrella header "Pods-BMSPushTests-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-BMSPushTests/Pods-BMSPushTests.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BMSAnalyticsAPI" "${PODS_CONFIGURATION_BUILD_DIR}/BMSCore" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BMSAnalyticsAPI/BMSAnalyticsAPI.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/BMSCore/BMSCore.framework/Headers" 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 6 | OTHER_LDFLAGS = $(inherited) -framework "BMSAnalyticsAPI" -framework "BMSCore" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 13 | -------------------------------------------------------------------------------- /Source/BMSConstants.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2016 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | internal let IMFPUSH_ACTION_DELETE = "action=delete" 15 | 16 | internal let IMFPUSH_CONTENT_TYPE_JSON = "application/json; charset = UTF-8" 17 | 18 | internal let IMFPUSH_CONTENT_TYPE_KEY = "Content-Type" 19 | 20 | internal let IMFPUSH_DEVICE_ID = "deviceId" 21 | 22 | internal let IMFPUSH_DEVICES = "devices" 23 | 24 | internal let IMFPUSH_USERID = "userId" 25 | 26 | internal let IMFPUSH_CLIENT_SECRET = "clientSecret" 27 | 28 | internal let IMFPUSH_TOKEN = "token" 29 | 30 | internal let IMFPUSH_PLATFORM = "platform" 31 | 32 | internal let IMFPUSH_TAGS = "tags" 33 | 34 | internal let IMFPUSH_TAGNAME = "tagName" 35 | 36 | internal let IMFPUSH_TAGNAMES = "tagNames" 37 | 38 | internal let IMFPUSH_TAGSNOTFOUND = "tagsNotFound" 39 | 40 | internal let IMFPUSH_NAME = "name" 41 | 42 | internal let IMFPUSH_SUBSCRIPTIONS = "subscriptions" 43 | 44 | internal let IMFPUSH_SUBSCRIBED = "subscribed" 45 | 46 | internal let IMFPUSH_SUBSCRIPTIONEXISTS = "subscriptionExists" 47 | 48 | internal let IMFPUSH_UNSUBSCRIBED = "unsubscribed" 49 | 50 | internal let IMFPUSH_UNSUBSCRIPTIONS = "unsubscriptions" 51 | 52 | internal let IMFPUSH_SUBSCRIPTIONNOTEXISTS = "subscriptionNotExists" 53 | 54 | internal let IMFPUSH_OPEN = "open" 55 | 56 | internal let IMFPUSH_RECEIVED = "received" 57 | 58 | internal let IMFPUSH_SEEN = "seen" 59 | 60 | internal let IMFPUSH_X_REWRITE_DOMAIN = "X-REWRITE-DOMAIN" 61 | 62 | internal let IMFPUSH_STATUS = "status" 63 | 64 | internal let BMSPUSH_CLIENT_SECRET = "clientSecret" 65 | 66 | internal let BMSPUSH_APP_GUID = "appGUID" 67 | 68 | internal let BMSPUSH_APP_INSTALL = "isFirstTry" 69 | 70 | internal let IMFPUSH_VARIABLES = "variables" 71 | 72 | internal let HAS_IMFPUSH_VARIABLES = "hasVariables" 73 | -------------------------------------------------------------------------------- /Source/BMSLocalPush/BMSLocalPushNotification.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BMSLocalPushNotification.swift 3 | // BMSPush 4 | // 5 | // Created by Anantha Krishnan K G on 26/02/18. 6 | // Copyright © 2018 IBM Corp. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | #if swift(>=3.0) 11 | import UserNotifications 12 | 13 | @available(iOS 10.0, *) 14 | class BMSLocalPushNotification: NSObject { 15 | 16 | // Optional array of attachments. 17 | open var attachments: String? 18 | 19 | // The application badge number. nil means no change. 0 to hide. 20 | open var badge: NSNumber? 21 | 22 | // The body of the notification. Use -[NSString localizedUserNotificationStringForKey:arguments:] to provide a string that will be localized at the time that the notification is presented. 23 | open var body: String 24 | 25 | // The identifier for a registered UNNotificationCategory that will be used to determine the appropriate actions to display for the notification. 26 | open var categoryIdentifier: String? 27 | 28 | // The sound that will be played for the notification. 29 | open var sound: String? 30 | 31 | // The subtitle of the notification. Use -[NSString localizedUserNotificationStringForKey:arguments:] to provide a string that will be localized at the time that the notification is presented. 32 | open var subtitle: String? 33 | 34 | // The title of the notification. Use -[NSString localizedUserNotificationStringForKey:arguments:] to provide a string that will be localized at the time that the notification is presented. 35 | open var title: String? 36 | 37 | // Apps can set the userInfo for locally scheduled notification requests. The contents of the push payload will be set as the userInfo for remote notifications. 38 | open var userInfo: [AnyHashable : Any]? 39 | 40 | public init(body bodyValue: String, title titleVlaue: String? = "", subtitle subtitleVlaue: String? = "", sound soundValue: String? = "", badge badgeVlaue: NSNumber? = 0, categoryIdentifier categoryIdentifierValue: String? = "", attachments attachmentsValue: String? = "", userInfo userInfoValue: [AnyHashable : Any]? = nil ) { 41 | 42 | self.attachments = attachmentsValue 43 | self.badge = badgeVlaue 44 | self.body = bodyValue 45 | self.categoryIdentifier = categoryIdentifierValue 46 | self.sound = soundValue 47 | self.subtitle = subtitleVlaue 48 | self.title = titleVlaue 49 | self.userInfo = userInfoValue 50 | } 51 | 52 | public func showBMSPushNotification() { 53 | 54 | let notification = UNMutableNotificationContent() 55 | let notificationTrigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false) 56 | notification.body = self.body 57 | if self.title != "" { 58 | notification.title = self.title! 59 | } 60 | if self.subtitle != "" { 61 | notification.subtitle = self.subtitle! 62 | } 63 | if self.badge != 0 { 64 | notification.badge = self.badge! 65 | } 66 | if self.categoryIdentifier != "" { 67 | notification.categoryIdentifier = self.categoryIdentifier! 68 | } 69 | if self.sound != nil { 70 | #if swift(>=4.2) 71 | notification.sound = UNNotificationSound(named: UNNotificationSoundName(rawValue: self.sound!)) 72 | #else 73 | notification.sound = UNNotificationSound(named: self.sound!) 74 | #endif 75 | } 76 | if self.userInfo != nil, self.userInfo?.count != 0 { 77 | notification.userInfo = self.userInfo! 78 | } 79 | 80 | if self.attachments != nil, self.attachments?.count != 0 { 81 | if let fileUrl = URL(string: self.attachments! ) { 82 | // Download the attachment 83 | URLSession.shared.downloadTask(with: fileUrl) { (location, _, _) in 84 | if let location = location { 85 | // Move temporary file to remove .tmp extension 86 | let tmpDirectory = NSTemporaryDirectory() 87 | let tmpFile = "file://".appending(tmpDirectory).appending(fileUrl.lastPathComponent) 88 | let tmpUrl = URL(string: tmpFile)! 89 | try? FileManager.default.moveItem(at: location, to: tmpUrl) 90 | // Add the attachment to the notification content 91 | if let attachment = try? UNNotificationAttachment(identifier: "", url: tmpUrl, options: nil) { 92 | notification.attachments = [attachment] 93 | let request = UNNotificationRequest(identifier: "BMSLocalPushNotification", content: notification, trigger: notificationTrigger) 94 | UNUserNotificationCenter.current().add(request, withCompletionHandler: nil) 95 | } 96 | } 97 | }.resume() 98 | } 99 | } else { 100 | let request = UNNotificationRequest(identifier: "BMSLocalPushNotification", content: notification, trigger: notificationTrigger) 101 | UNUserNotificationCenter.current().add(request, withCompletionHandler: nil) 102 | } 103 | } 104 | 105 | } 106 | #endif 107 | -------------------------------------------------------------------------------- /Source/BMSPushClientOptions.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2016 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | 15 | import Foundation 16 | 17 | // MARK: - Swift 3 & Swift 4 18 | 19 | #if swift(>=3.0) 20 | 21 | /** 22 | This class is to set options for push notifications. 23 | */ 24 | public class BMSPushClientOptions : NSObject { 25 | 26 | // MARK: - Properties 27 | 28 | /// Category value - An array of Push categories. 29 | var category: [BMSPushNotificationActionCategory] 30 | 31 | /// Device for registrations. This is a userinput value. If not given the default deviceId will be used. 32 | var deviceId: String 33 | 34 | /// Push variables - A Key value pair. 35 | var pushvariables: [String:String] 36 | 37 | // MARK: Initializers 38 | 39 | /** 40 | Initialze Method . 41 | */ 42 | public override init() { 43 | self.category = [] 44 | self.deviceId = "" 45 | self.pushvariables = [:] 46 | } 47 | 48 | /** 49 | Initialze Method - Deprecated. 50 | 51 | - parameter categoryName: An array of `BMSPushNotificationActionCategory`. 52 | */ 53 | @available(*, deprecated, message: "This method was deprecated , please use init(categoryName:_ withDeviceId:_ )") 54 | public init (categoryName category: [BMSPushNotificationActionCategory]) { 55 | self.category = category 56 | self.deviceId = "" 57 | self.pushvariables = [:] 58 | } 59 | 60 | /** 61 | set DeviceId Method 62 | 63 | - parameter withDeviceId: (Optional) The DeviceId for applications. 64 | */ 65 | public func setDeviceId(deviceId:String){ 66 | self.deviceId = deviceId 67 | 68 | } 69 | 70 | /** 71 | set Interactive Notification Categories Method 72 | 73 | - parameter categoryName: An array of `BMSPushNotificationActionCategory`. 74 | */ 75 | public func setInteractiveNotificationCategories(categoryName category: [BMSPushNotificationActionCategory]){ 76 | self.category = category 77 | } 78 | 79 | /** 80 | set Push Variables for template based push Notification. 81 | 82 | - parameter pushVariables: a [String:String] values. 83 | */ 84 | public func setPushVariables(pushVariables variables: [String:String]) { 85 | self.pushvariables = variables 86 | } 87 | } 88 | 89 | #endif 90 | -------------------------------------------------------------------------------- /Source/BMSPushNotificationAction.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2016 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | 15 | import Foundation 16 | 17 | /** 18 | Creates action objects for push notifications 19 | */ 20 | public class BMSPushNotificationAction : NSObject { 21 | 22 | // MARK: - Properties 23 | 24 | public static let sharedInstance = BMSPushClient() 25 | 26 | var identifier: String 27 | var title: String 28 | var authenticationRequired: Bool? 29 | var activationMode: UIUserNotificationActivationMode 30 | 31 | // MARK: Initializers 32 | 33 | /** 34 | Initialze Method - Deprecated. 35 | 36 | - parameter identifierName: identifier name for your actions. 37 | - parameter title: Title for your actions. 38 | - parameter authenticationRequired: Authenticationenbling option for your actions. 39 | - parameter activationMode: ActivationMode for your actions. 40 | */ 41 | public init (identifierName identifier: String, buttonTitle title: String, 42 | isAuthenticationRequired authenticationRequired: Bool, 43 | defineActivationMode activationMode: UIUserNotificationActivationMode) { 44 | self.identifier = identifier 45 | self.title = title 46 | self.authenticationRequired = authenticationRequired 47 | self.activationMode = activationMode 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Source/BMSPushNotificationActionCategory.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2016 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | 15 | import Foundation 16 | 17 | /** 18 | Creates Category objects for push notifications 19 | */ 20 | public class BMSPushNotificationActionCategory : NSObject { 21 | 22 | public static let sharedInstance = BMSPushClient() 23 | 24 | var identifier: String 25 | var actions: [BMSPushNotificationAction] 26 | 27 | // MARK: Initializers 28 | 29 | /** 30 | Initialze Method - Deprecated. 31 | 32 | - parameter identifierName: identifier name for category. 33 | - parameter buttonActions: Array of `BMSPushNotificationAction`. 34 | */ 35 | public init (identifierName identifier: String, buttonActions actions: [BMSPushNotificationAction]) { 36 | self.identifier = identifier 37 | self.actions = actions 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Source/BMSPushUrlBuilder.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2016 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | import UIKit 15 | import BMSCore 16 | 17 | // MARK: - Swift 3 & Swift 4 18 | #if swift(>=3.0) 19 | 20 | internal class BMSPushUrlBuilder: NSObject { 21 | 22 | internal let FORWARDSLASH = "/"; 23 | internal let IMFPUSH = "imfpush"; 24 | internal let JPIMFPUSH = "jp-tok.imfpush.cloud.ibm.com" 25 | internal let V1 = "v1"; 26 | internal let APPS = "apps"; 27 | internal let AMPERSAND = "&"; 28 | internal let QUESTIONMARK = "?"; 29 | internal let SUBZONE = "subzone"; 30 | internal let EQUALTO = "="; 31 | internal let SUBSCRIPTIONS = "subscriptions"; 32 | internal let MESSAGES = "messages" 33 | internal let TAGS = "tags"; 34 | internal let DEVICES = "devices"; 35 | internal let TAGNAME = "tagName"; 36 | internal let DEVICEID = "deviceId"; 37 | internal let defaultProtocol = "https"; 38 | internal let HOST_NAME = "imfpush.cloud.ibm.com" 39 | internal let DOT = "." 40 | internal let IMFPUSH_PUSH_WORKS_SERVER_CONTEXT = "imfpush/v1/apps" 41 | 42 | internal final var pwUrl_ = "" 43 | internal final var reWritedomain = "" 44 | internal final var clientSecretHeader = "" 45 | 46 | init(applicationID:String, clientSecret:String) { 47 | 48 | super.init() 49 | 50 | if !clientSecret.isEmpty { 51 | clientSecretHeader = clientSecret 52 | } 53 | 54 | if !BMSPushClient.overrideServerHost.isEmpty { 55 | pwUrl_ += BMSPushClient.overrideServerHost 56 | reWritedomain = BMSPushClient.overrideServerHost 57 | } else { 58 | pwUrl_ += defaultProtocol 59 | pwUrl_ += "://" 60 | pwUrl_ += self.getRegion() 61 | pwUrl_ += DOT 62 | pwUrl_ += HOST_NAME 63 | } 64 | pwUrl_ += FORWARDSLASH 65 | pwUrl_ += IMFPUSH_PUSH_WORKS_SERVER_CONTEXT 66 | pwUrl_ += FORWARDSLASH 67 | pwUrl_ += applicationID 68 | pwUrl_ += FORWARDSLASH 69 | } 70 | 71 | func addHeader() -> [String: String] { 72 | 73 | if reWritedomain.isEmpty { 74 | if clientSecretHeader.isEmpty { 75 | return [IMFPUSH_CONTENT_TYPE_KEY:IMFPUSH_CONTENT_TYPE_JSON] 76 | } 77 | return [IMFPUSH_CONTENT_TYPE_KEY:IMFPUSH_CONTENT_TYPE_JSON, IMFPUSH_CLIENT_SECRET:clientSecretHeader] 78 | } 79 | else{ 80 | if clientSecretHeader.isEmpty { 81 | return [IMFPUSH_CONTENT_TYPE_KEY:IMFPUSH_CONTENT_TYPE_JSON, IMFPUSH_X_REWRITE_DOMAIN:reWritedomain] 82 | } 83 | return [IMFPUSH_CONTENT_TYPE_KEY:IMFPUSH_CONTENT_TYPE_JSON, IMFPUSH_X_REWRITE_DOMAIN:reWritedomain, IMFPUSH_CLIENT_SECRET:clientSecretHeader] 84 | } 85 | 86 | } 87 | 88 | func getSubscribedDevicesUrl(devID:String) -> String { 89 | 90 | var deviceIdUrl:String = getDevicesUrl() 91 | deviceIdUrl += FORWARDSLASH 92 | deviceIdUrl += devID 93 | return deviceIdUrl 94 | } 95 | 96 | func getDevicesUrl() -> String { 97 | 98 | return getCollectionUrl(collectionName: DEVICES) 99 | } 100 | 101 | func getTagsUrl() -> String { 102 | 103 | return getCollectionUrl(collectionName: TAGS) 104 | } 105 | 106 | func getSubscriptionsUrl() -> String { 107 | 108 | return getCollectionUrl(collectionName: SUBSCRIPTIONS) 109 | } 110 | 111 | func getAvailableSubscriptionsUrl(deviceId : String) -> String { 112 | 113 | var subscriptionURL = getCollectionUrl(collectionName: SUBSCRIPTIONS) 114 | subscriptionURL += QUESTIONMARK 115 | subscriptionURL += "deviceId=\(deviceId)" 116 | 117 | return subscriptionURL 118 | } 119 | 120 | func getUnSubscribetagsUrl() -> String { 121 | 122 | var unSubscriptionURL = getCollectionUrl(collectionName: SUBSCRIPTIONS) 123 | unSubscriptionURL += QUESTIONMARK 124 | unSubscriptionURL += IMFPUSH_ACTION_DELETE 125 | 126 | return unSubscriptionURL 127 | } 128 | 129 | func getUnregisterUrl (deviceId : String) -> String { 130 | 131 | var deviceUnregisterUrl:String = getDevicesUrl() 132 | deviceUnregisterUrl += FORWARDSLASH 133 | deviceUnregisterUrl += deviceId 134 | 135 | return deviceUnregisterUrl 136 | } 137 | 138 | func getSendMessageDeliveryStatus (messageId : String) -> String { 139 | 140 | var sendMessageDeliveryStatusUrl:String = getCollectionUrl(collectionName: MESSAGES) 141 | sendMessageDeliveryStatusUrl += FORWARDSLASH 142 | sendMessageDeliveryStatusUrl += messageId 143 | return sendMessageDeliveryStatusUrl 144 | } 145 | 146 | internal func getCollectionUrl (collectionName:String) -> String { 147 | 148 | var collectionUrl:String = pwUrl_ 149 | collectionUrl += collectionName 150 | 151 | return collectionUrl 152 | } 153 | 154 | internal func getRegion() -> String { 155 | 156 | switch BMSClient.sharedInstance.bluemixRegion { 157 | case BMSClient.Region.usSouth: 158 | return "us-south" 159 | case BMSClient.Region.germany: 160 | return "eu-de" 161 | case BMSClient.Region.jpTok: 162 | return "jp-tok" 163 | case BMSClient.Region.sydney: 164 | return "au-syd" 165 | case BMSClient.Region.unitedKingdom: 166 | return "eu-gb" 167 | case BMSClient.Region.usEast: 168 | return "us-east" 169 | default: 170 | return "us-south" 171 | } 172 | } 173 | } 174 | #endif 175 | -------------------------------------------------------------------------------- /Source/BMSPushUtils.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2016 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | import UIKit 15 | import BMSCore 16 | 17 | // MARK: - Swift 3 & Swift 4 18 | 19 | #if swift(>=3.0) 20 | 21 | /** 22 | Utils class for `BMSPush` 23 | */ 24 | open class BMSPushUtils: NSObject { 25 | 26 | static var loggerMessage:String = "" 27 | 28 | @objc dynamic open class func saveValueToNSUserDefaults (value:Any, key:String) { 29 | UserDefaults.standard.set(value, forKey: key) 30 | UserDefaults.standard.synchronize() 31 | loggerMessage = ("Saving value to NSUserDefaults with Key: \(key) and Value: \(value)") 32 | self.sendLoggerData() 33 | } 34 | 35 | @objc dynamic open class func getValueToNSUserDefaults (key:String) -> Any { 36 | var value:Any = "" 37 | if(UserDefaults.standard.value(forKey: key) != nil){ 38 | value = UserDefaults.standard.value(forKey: key) ?? "" 39 | } 40 | loggerMessage = ("Getting value for NSUserDefaults Key: \(key) and Value: \(value)") 41 | self.sendLoggerData() 42 | return value 43 | } 44 | 45 | @objc dynamic open class func getPushOptionsNSUserDefaults (key:String) -> String { 46 | var value = "" 47 | if key == IMFPUSH_VARIABLES { 48 | if let hasVariable = UserDefaults.standard.value(forKey: HAS_IMFPUSH_VARIABLES) as? Bool, hasVariable != true { 49 | return value 50 | } 51 | } 52 | if(UserDefaults.standard.value(forKey: key) != nil){ 53 | let dataValue = UserDefaults.standard.value(forKey: key) as? [String: String] 54 | let jsonData = try! JSONSerialization.data(withJSONObject: dataValue!, options: .prettyPrinted) 55 | value = NSString(data: jsonData, encoding: String.Encoding.utf8.rawValue)! as String 56 | } 57 | loggerMessage = ("Getting value for NSUserDefaults Key: \(key) and Value: \(value)") 58 | self.sendLoggerData() 59 | return value 60 | } 61 | 62 | class func getPushSettingValue() -> Bool { 63 | 64 | 65 | var pushEnabled = false 66 | 67 | if ((UIDevice.current.systemVersion as NSString).floatValue >= 8.0) { 68 | 69 | if (UIApplication.shared.isRegisteredForRemoteNotifications) { 70 | pushEnabled = true 71 | } 72 | else { 73 | pushEnabled = false 74 | } 75 | } else { 76 | 77 | let grantedSettings = UIApplication.shared.currentUserNotificationSettings 78 | 79 | if grantedSettings!.types.rawValue & UIUserNotificationType.alert.rawValue != 0 { 80 | // Alert permission granted 81 | pushEnabled = true 82 | } 83 | else{ 84 | pushEnabled = false 85 | } 86 | } 87 | 88 | return pushEnabled; 89 | } 90 | 91 | class func sendLoggerData () { 92 | 93 | let devId = BMSPushClient.sharedInstance.getDeviceID() 94 | let testLogger = Logger.logger(name:devId) 95 | Logger.logLevelFilter = LogLevel.debug 96 | testLogger.debug(message: loggerMessage) 97 | Logger.logLevelFilter = LogLevel.info 98 | testLogger.info(message: loggerMessage) 99 | 100 | } 101 | 102 | class func checkTemplateNotifications(_ body:String) -> String { 103 | 104 | let regex = "\\{\\{.*?\\}\\}" 105 | var text = body 106 | 107 | guard let optionVariables = UserDefaults.standard.value(forKey: IMFPUSH_VARIABLES) as? [String: String] else { return text } 108 | 109 | do { 110 | let regex = try NSRegularExpression(pattern: regex) 111 | 112 | let results = regex.matches(in: text, 113 | range: NSRange(text.startIndex..., in: text)) 114 | let resultMap = results.flatMap { 115 | Range($0.range, in: text).map { 116 | String(text[$0]) 117 | } 118 | } 119 | 120 | for val in resultMap { 121 | var temp = val 122 | temp = temp.replacingOccurrences(of: "{{", with: "", options: NSString.CompareOptions.literal, range: nil) 123 | temp = temp.replacingOccurrences(of: "}}", with: "", options: NSString.CompareOptions.literal, range: nil) 124 | temp = temp.replacingOccurrences(of: " ", with: "", options: NSString.CompareOptions.literal, range: nil) 125 | 126 | if let templateValue = optionVariables[temp] { 127 | text = text.replacingOccurrences(of: val, with: templateValue) 128 | } 129 | } 130 | return text 131 | 132 | } catch { 133 | return text 134 | } 135 | } 136 | } 137 | #endif 138 | -------------------------------------------------------------------------------- /Source/BMSResponse.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2016 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | import UIKit 15 | import BMSCore 16 | 17 | // MARK: - Swift 3 & Swift 4 18 | 19 | #if swift(>=3.0) 20 | 21 | /** 22 | This is the extension of `Response` class in the `BMSCore`. 23 | It is used to handle the responses from the push REST API calls. 24 | */ 25 | public extension Response { 26 | 27 | // MARK: Methods (Only for using in BMSPushClient) 28 | 29 | /** 30 | This methode will convert the response that get while calling the `retrieveSubscriptionsWithCompletionHandler` in `BMSPushClient' class into an array of Tags and send to the Client app. 31 | 32 | This will use the public property `responseText` in the `Response` Class. 33 | */ 34 | func subscriptions() -> NSMutableArray { 35 | 36 | let subscription = NSMutableArray() 37 | 38 | if let subscriptionDictionary = convertStringToDictionary(text: self.responseText!) as NSDictionary? { 39 | 40 | if let subscriptionArray:[[String:String]] = subscriptionDictionary.object(forKey: IMFPUSH_SUBSCRIPTIONS) as? [[String:String]] { 41 | 42 | let subscriptions = subscriptionArray.map {($0)[IMFPUSH_TAGNAME]!} 43 | subscription.addObjects(from: subscriptions) 44 | } 45 | } 46 | return subscription; 47 | } 48 | 49 | /** 50 | This methode will convert the response that get while calling the `subscribeToTags` in `BMSPushClient' class into an Dictionary of details and send to the Client app. 51 | 52 | This will use the public property `responseText` in the `Response` Class. 53 | */ 54 | func subscribeStatus() -> NSMutableDictionary { 55 | 56 | return getResponseDict() 57 | } 58 | 59 | /** 60 | This methode will convert the response that get while calling the `unsubscribeFromTags` in `BMSPushClient' class into an Dictionary of details and send to the Client app. 61 | 62 | This will use the public property `responseText` in the `Response` Class. 63 | */ 64 | func unsubscribeStatus() -> NSMutableDictionary { 65 | 66 | return getResponseDict() 67 | } 68 | 69 | /** 70 | This methode will convert the response that get while calling the `retrieveAvailableTagsWithCompletionHandler` in `BMSPushClient' class into an array and send to the Client app. 71 | 72 | This will use the public property `responseText` in the `Response` Class. 73 | */ 74 | func availableTags() -> NSMutableArray { 75 | 76 | let tags = NSMutableArray() 77 | 78 | if let tagsDictionary:NSDictionary = convertStringToDictionary(text: self.responseText!) as NSDictionary? { 79 | 80 | if let tag:[[String:String]] = tagsDictionary.object(forKey: IMFPUSH_TAGS) as? [[String:String]] { 81 | let tagsArray = tag.map {($0)[IMFPUSH_NAME]!} 82 | tags.addObjects(from: tagsArray) 83 | } 84 | } 85 | return tags; 86 | } 87 | 88 | 89 | private func convertStringToDictionary(text: String) -> [String:AnyObject]? { 90 | if let data = text.data(using: String.Encoding.utf8) { 91 | 92 | guard let result = try? JSONSerialization.jsonObject(with: data, options: []) as? [String:AnyObject] else { 93 | return [:] 94 | } 95 | return result 96 | } 97 | return [:] 98 | } 99 | 100 | internal func getResponseDict() -> NSMutableDictionary { 101 | 102 | let finalDict = NSMutableDictionary() 103 | 104 | if let subscriptions:NSDictionary = convertStringToDictionary(text: self.responseText!) as NSDictionary? { 105 | 106 | if let arraySub:NSArray = subscriptions.object(forKey: IMFPUSH_SUBSCRIPTIONEXISTS) as? NSArray { 107 | 108 | finalDict.setObject(arraySub, forKey:IMFPUSH_SUBSCRIPTIONEXISTS as NSCopying) 109 | 110 | } 111 | if let dictionarySub:NSDictionary = subscriptions.object(forKey: IMFPUSH_TAGSNOTFOUND) as? NSDictionary { 112 | 113 | 114 | finalDict.setObject(dictionarySub, forKey:IMFPUSH_TAGSNOTFOUND as NSCopying) 115 | 116 | } 117 | if let arraySub:NSArray = subscriptions.object(forKey: IMFPUSH_SUBSCRIBED) as? NSArray { 118 | 119 | finalDict.setObject(arraySub, forKey:IMFPUSH_SUBSCRIPTIONS as NSCopying) 120 | } 121 | } 122 | return finalDict; 123 | } 124 | } 125 | 126 | #endif 127 | -------------------------------------------------------------------------------- /Source/BMSRichPushNotificationOptions.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2016 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | 15 | import Foundation 16 | 17 | // MARK: - Swift 3 & Swift 4 18 | #if swift(>=3.0) 19 | import UserNotifications 20 | 21 | /// Class to Handle iOS10 Rich push notifications. 22 | @available(iOS 10.0, *) 23 | open class BMSPushRichPushNotificationOptions:UNNotificationServiceExtension { 24 | 25 | // MARK: - Public method 26 | 27 | /** 28 | didReceive method is used inside notification extensions. 29 | 30 | - Parameter request: pass the `UNNotificationRequest` from extension 31 | - Parameter contentHandler: pass the `UNNotificationContent` from extension. 32 | */ 33 | open class func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) { 34 | 35 | var bestAttemptContent: UNMutableNotificationContent? 36 | bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent) 37 | 38 | if let urlString = request.content.userInfo["attachment-url"] as? String, urlString != "" { 39 | 40 | if let fileUrl = URL(string: urlString ) { 41 | // Download the attachment 42 | URLSession.shared.downloadTask(with: fileUrl) { (location, _, _) in 43 | if let location = location { 44 | // Move temporary file to remove .tmp extension 45 | let tmpDirectory = NSTemporaryDirectory() 46 | let tmpFile = "file://".appending(tmpDirectory).appending(fileUrl.lastPathComponent) 47 | let tmpUrl = URL(string: tmpFile)! 48 | try! FileManager.default.moveItem(at: location, to: tmpUrl) 49 | 50 | // Add the attachment to the notification content 51 | if let attachment = try? UNNotificationAttachment(identifier: "", url: tmpUrl, options:nil) { 52 | 53 | bestAttemptContent?.attachments = [attachment] 54 | } 55 | } 56 | // Serve the notification content 57 | contentHandler(bestAttemptContent!) 58 | }.resume() 59 | } 60 | 61 | } else { 62 | contentHandler(bestAttemptContent!) 63 | } 64 | } 65 | } 66 | #endif 67 | -------------------------------------------------------------------------------- /Source/Resource/BMSPush.h: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2015 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | 15 | @import Foundation; 16 | @import BMSCore; 17 | @import BMSAnalyticsAPI; 18 | 19 | //! Project version number for BMSPush. 20 | FOUNDATION_EXPORT double BMSPushVersionNumber; 21 | 22 | //! Project version string for BMSPush. 23 | FOUNDATION_EXPORT const unsigned char BMSPushVersionString[]; 24 | 25 | // In this header, you should import all the public headers of your framework using statements like #import 26 | 27 | 28 | -------------------------------------------------------------------------------- /Source/Resource/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Tests/Test Apps/BMSPushHostApp/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /Tests/Test Apps/BMSPushHostApp/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Tests/Test Apps/BMSPushHostApp/Assets.xcassets/LaunchImage-2.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "ipad", 6 | "minimum-system-version" : "7.0", 7 | "extent" : "full-screen", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "landscape", 12 | "idiom" : "ipad", 13 | "minimum-system-version" : "7.0", 14 | "extent" : "full-screen", 15 | "scale" : "1x" 16 | }, 17 | { 18 | "orientation" : "landscape", 19 | "idiom" : "ipad", 20 | "minimum-system-version" : "7.0", 21 | "extent" : "full-screen", 22 | "scale" : "2x" 23 | }, 24 | { 25 | "orientation" : "portrait", 26 | "idiom" : "iphone", 27 | "minimum-system-version" : "7.0", 28 | "scale" : "2x" 29 | }, 30 | { 31 | "orientation" : "portrait", 32 | "idiom" : "iphone", 33 | "minimum-system-version" : "7.0", 34 | "subtype" : "retina4", 35 | "scale" : "2x" 36 | }, 37 | { 38 | "orientation" : "portrait", 39 | "idiom" : "ipad", 40 | "minimum-system-version" : "7.0", 41 | "extent" : "full-screen", 42 | "scale" : "1x" 43 | } 44 | ], 45 | "info" : { 46 | "version" : 1, 47 | "author" : "xcode" 48 | } 49 | } -------------------------------------------------------------------------------- /Tests/Test Apps/BMSPushHostApp/Assets.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "extent" : "full-screen", 5 | "idiom" : "iphone", 6 | "subtype" : "736h", 7 | "filename" : "settings_iOS58@2x-2.png", 8 | "minimum-system-version" : "8.0", 9 | "orientation" : "portrait", 10 | "scale" : "3x" 11 | }, 12 | { 13 | "extent" : "full-screen", 14 | "idiom" : "iphone", 15 | "subtype" : "736h", 16 | "filename" : "settings_iOS58@2x-4.png", 17 | "minimum-system-version" : "8.0", 18 | "orientation" : "landscape", 19 | "scale" : "3x" 20 | }, 21 | { 22 | "extent" : "full-screen", 23 | "idiom" : "iphone", 24 | "subtype" : "667h", 25 | "filename" : "settings_iOS58@2x-3.png", 26 | "minimum-system-version" : "8.0", 27 | "orientation" : "portrait", 28 | "scale" : "2x" 29 | }, 30 | { 31 | "extent" : "full-screen", 32 | "idiom" : "ipad", 33 | "subtype" : "1366h", 34 | "filename" : "settings_iOS58@2x-5.png", 35 | "minimum-system-version" : "8.0", 36 | "orientation" : "portrait", 37 | "scale" : "2x" 38 | } 39 | ], 40 | "info" : { 41 | "version" : 1, 42 | "author" : "xcode" 43 | } 44 | } -------------------------------------------------------------------------------- /Tests/Test Apps/BMSPushHostApp/Assets.xcassets/LaunchImage.launchimage/settings_iOS58@2x-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibm-bluemix-mobile-services/bms-clientsdk-swift-push/c1bb68e24980864cfff47f2cfce648180dfa03b3/Tests/Test Apps/BMSPushHostApp/Assets.xcassets/LaunchImage.launchimage/settings_iOS58@2x-2.png -------------------------------------------------------------------------------- /Tests/Test Apps/BMSPushHostApp/Assets.xcassets/LaunchImage.launchimage/settings_iOS58@2x-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibm-bluemix-mobile-services/bms-clientsdk-swift-push/c1bb68e24980864cfff47f2cfce648180dfa03b3/Tests/Test Apps/BMSPushHostApp/Assets.xcassets/LaunchImage.launchimage/settings_iOS58@2x-3.png -------------------------------------------------------------------------------- /Tests/Test Apps/BMSPushHostApp/Assets.xcassets/LaunchImage.launchimage/settings_iOS58@2x-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibm-bluemix-mobile-services/bms-clientsdk-swift-push/c1bb68e24980864cfff47f2cfce648180dfa03b3/Tests/Test Apps/BMSPushHostApp/Assets.xcassets/LaunchImage.launchimage/settings_iOS58@2x-4.png -------------------------------------------------------------------------------- /Tests/Test Apps/BMSPushHostApp/Assets.xcassets/LaunchImage.launchimage/settings_iOS58@2x-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibm-bluemix-mobile-services/bms-clientsdk-swift-push/c1bb68e24980864cfff47f2cfce648180dfa03b3/Tests/Test Apps/BMSPushHostApp/Assets.xcassets/LaunchImage.launchimage/settings_iOS58@2x-5.png -------------------------------------------------------------------------------- /Tests/Test Apps/BMSPushHostApp/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Tests/Test Apps/BMSPushHostApp/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 30 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /Tests/Test Apps/BMSPushHostApp/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | NSAppTransportSecurity 26 | 27 | NSAllowsArbitraryLoads 28 | 29 | 30 | UIBackgroundModes 31 | 32 | remote-notification 33 | 34 | UILaunchStoryboardName 35 | LaunchScreen 36 | UIMainStoryboardFile 37 | Main 38 | UIRequiredDeviceCapabilities 39 | 40 | armv7 41 | 42 | UISupportedInterfaceOrientations 43 | 44 | UIInterfaceOrientationPortrait 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | UISupportedInterfaceOrientations~ipad 49 | 50 | UIInterfaceOrientationPortrait 51 | UIInterfaceOrientationPortraitUpsideDown 52 | UIInterfaceOrientationLandscapeLeft 53 | UIInterfaceOrientationLandscapeRight 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /Tests/Test Apps/BMSPushHostApp/ViewController.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2015 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | import UIKit 15 | public var responseText: String? 16 | 17 | class ViewController: UIViewController { 18 | 19 | @IBOutlet var textField: UITextView! 20 | @IBOutlet var swictButton: UISwitch! 21 | 22 | 23 | #if swift(>=3.0) 24 | 25 | override func viewDidLoad() { 26 | super.viewDidLoad() 27 | // Do any additional setup after loading the view, typically from a nib. 28 | 29 | NotificationCenter.default.addObserver(self, selector: #selector(ViewController.updateMessage), name: NSNotification.Name(rawValue: "action"), object: nil) 30 | } 31 | 32 | 33 | override func didReceiveMemoryWarning() { 34 | super.didReceiveMemoryWarning() 35 | // Dispose of any resources that can be recreated. 36 | } 37 | 38 | let appDelegate = UIApplication.shared.delegate as! AppDelegate 39 | 40 | @IBAction func switchstateChanged(sender: UISwitch) { 41 | 42 | if sender.isOn{ 43 | 44 | textField.text = "started Registration \n" 45 | appDelegate.registerForPush() 46 | } 47 | else{ 48 | textField.text = ""; 49 | textField.text = "Unregister Push" 50 | appDelegate.unRegisterPush() 51 | } 52 | } 53 | 54 | @objc func updateMessage () { 55 | 56 | DispatchQueue.main.async(execute: { 57 | var responseLabelText = self.textField.text 58 | responseLabelText = "\(String(describing: responseLabelText)) \n Response Text: \(String(describing: responseText)) \n\n" 59 | self.textField.text = responseLabelText 60 | }) 61 | } 62 | 63 | 64 | #else 65 | override func viewDidLoad() { 66 | super.viewDidLoad() 67 | // Do any additional setup after loading the view, typically from a nib. 68 | 69 | NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(ViewController.updateMessage), name: "action", object: nil) 70 | 71 | } 72 | 73 | 74 | override func didReceiveMemoryWarning() { 75 | super.didReceiveMemoryWarning() 76 | // Dispose of any resources that can be recreated. 77 | } 78 | 79 | let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate 80 | 81 | @IBAction func switchstateChanged(sender: UISwitch) { 82 | 83 | if sender.on{ 84 | 85 | textField.text = "started Registration \n" 86 | appDelegate.registerForPush() 87 | } 88 | else{ 89 | textField.text = ""; 90 | textField.text = "Unregister Push" 91 | appDelegate.unRegisterPush() 92 | } 93 | } 94 | 95 | func updateMessage () { 96 | 97 | var responseLabelText = self.textField.text 98 | responseLabelText = "\(responseLabelText) \n Response Text: \(responseText) \n\n" 99 | dispatch_async(dispatch_get_main_queue(), { 100 | self.textField.text = responseLabelText 101 | }) 102 | } 103 | 104 | #endif 105 | 106 | } 107 | 108 | -------------------------------------------------------------------------------- /Tests/Unit Tests/BMSPushTests/BMSLocalPushNotificationTest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BMSLocalPushNotificationTest.swift 3 | // BMSPushTests 4 | // 5 | // Created by Anantha Krishnan K G on 01/03/18. 6 | // Copyright © 2018 IBM Corp. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import BMSPush 11 | 12 | class BMSLocalPushNotificationTest: XCTestCase { 13 | 14 | #if swift(>=3.0) 15 | 16 | func testInit() { 17 | 18 | if #available(iOS 10.0, *) { 19 | let localPush = BMSLocalPushNotification(body: "test message", title: "test Title", subtitle: "test subTitle", sound: "soundName", badge: 3, categoryIdentifier: "identifier", attachments: "https://attchment.png", userInfo: [:]) 20 | XCTAssertEqual(localPush.attachments!, "https://attchment.png") 21 | XCTAssertEqual(localPush.body, "test message") 22 | XCTAssertEqual(localPush.title!, "test Title") 23 | XCTAssertEqual(localPush.subtitle!, "test subTitle") 24 | XCTAssertEqual(localPush.sound!, "soundName") 25 | XCTAssertEqual(localPush.badge!, 3) 26 | XCTAssertEqual(localPush.categoryIdentifier!, "identifier") 27 | } else { 28 | // Fallback on earlier versions 29 | } 30 | } 31 | 32 | func testFail() { 33 | 34 | if #available(iOS 10.0, *) { 35 | let localPush = BMSLocalPushNotification(body: "test message", title: "test Title", subtitle: "test subTitle", sound: "soundName", badge: 3, categoryIdentifier: "identifier", attachments: "https://attchment.png", userInfo: [:]) 36 | XCTAssertNotEqual(localPush.attachments!, "https://attcewhment.png") 37 | XCTAssertNotEqual(localPush.body, "test message 3") 38 | XCTAssertNotEqual(localPush.title!, "test Title testFail") 39 | XCTAssertNotEqual(localPush.subtitle!, "test subTitle testFail") 40 | XCTAssertNotEqual(localPush.sound!, "soundName testFail") 41 | XCTAssertNotEqual(localPush.badge!, 4) 42 | XCTAssertNotEqual(localPush.categoryIdentifier!, "identifier testFail") 43 | } else { 44 | // Fallback on earlier versions 45 | } 46 | } 47 | 48 | func testNotification() { 49 | if #available(iOS 10.0, *) { 50 | let localPush = BMSLocalPushNotification( 51 | body: "test message", 52 | title: "test Title", 53 | subtitle: "test subTitle", 54 | sound: "soundName", badge: 3, 55 | categoryIdentifier: "identifier", 56 | attachments: "https://attchment.png", userInfo: [:]) 57 | localPush.showBMSPushNotification() 58 | 59 | } else { 60 | // Fallback on earlier versions 61 | } 62 | } 63 | 64 | #endif 65 | 66 | } 67 | -------------------------------------------------------------------------------- /Tests/Unit Tests/BMSPushTests/BMSPushClientOptionsTest.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2016 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | 15 | import XCTest 16 | @testable import BMSPush 17 | import BMSCore 18 | 19 | class BMSPushClientOptionsTest: XCTestCase { 20 | 21 | func testInit(){ 22 | let notifOptions = BMSPushClientOptions() 23 | notifOptions.setInteractiveNotificationCategories(categoryName: []) 24 | let variables = ["username":"ananth","accountNumber":"3564758697057869"] 25 | #if swift(>=3.0) 26 | notifOptions.setDeviceId(deviceId: "testDeviceId") 27 | notifOptions.setPushVariables(pushVariables: variables) 28 | XCTAssertEqual(notifOptions.pushvariables, variables) 29 | #else 30 | notifOptions.setDeviceIdValue("testDeviceId") 31 | #endif 32 | XCTAssertEqual(notifOptions.category, []) 33 | XCTAssertEqual(notifOptions.deviceId, "testDeviceId") 34 | 35 | 36 | #if swift(>=3.0) 37 | let actionOne = BMSPushNotificationAction(identifierName: "FIRST", buttonTitle: "Accept", isAuthenticationRequired: false, defineActivationMode: UIUserNotificationActivationMode.background) 38 | 39 | let actionTwo = BMSPushNotificationAction(identifierName: "SECOND", buttonTitle: "Reject", isAuthenticationRequired: false, defineActivationMode: UIUserNotificationActivationMode.background) 40 | #else 41 | let actionOne = BMSPushNotificationAction(identifierName: "FIRST", buttonTitle: "Accept", isAuthenticationRequired: false, defineActivationMode: UIUserNotificationActivationMode.Background) 42 | 43 | let actionTwo = BMSPushNotificationAction(identifierName: "SECOND", buttonTitle: "Reject", isAuthenticationRequired: false, defineActivationMode: UIUserNotificationActivationMode.Background) 44 | #endif 45 | 46 | 47 | let category = BMSPushNotificationActionCategory(identifierName: "category", buttonActions: [actionOne, actionTwo]) 48 | 49 | let notifOptions2 = BMSPushClientOptions() 50 | #if swift(>=3.0) 51 | notifOptions2.setDeviceId(deviceId: "") 52 | #else 53 | notifOptions2.setDeviceIdValue("") 54 | #endif 55 | notifOptions2.setInteractiveNotificationCategories(categoryName: [category]) 56 | XCTAssertEqual(notifOptions2.category, [category]) 57 | XCTAssertEqual(notifOptions2.deviceId, "") 58 | } 59 | 60 | func testInit2(){ 61 | let notifOptions = BMSPushClientOptions(categoryName: []) 62 | 63 | XCTAssertEqual(notifOptions.category, []) 64 | 65 | 66 | #if swift(>=3.0) 67 | let actionOne = BMSPushNotificationAction(identifierName: "FIRST", buttonTitle: "Accept", isAuthenticationRequired: false, defineActivationMode: UIUserNotificationActivationMode.background) 68 | 69 | let actionTwo = BMSPushNotificationAction(identifierName: "SECOND", buttonTitle: "Reject", isAuthenticationRequired: false, defineActivationMode: UIUserNotificationActivationMode.background) 70 | #else 71 | let actionOne = BMSPushNotificationAction(identifierName: "FIRST", buttonTitle: "Accept", isAuthenticationRequired: false, defineActivationMode: UIUserNotificationActivationMode.Background) 72 | 73 | let actionTwo = BMSPushNotificationAction(identifierName: "SECOND", buttonTitle: "Reject", isAuthenticationRequired: false, defineActivationMode: UIUserNotificationActivationMode.Background) 74 | #endif 75 | 76 | 77 | let category = BMSPushNotificationActionCategory(identifierName: "category", buttonActions: [actionOne, actionTwo]) 78 | 79 | let notifOptions2 = BMSPushClientOptions(categoryName: [category]) 80 | XCTAssertEqual(notifOptions2.category, [category]) 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /Tests/Unit Tests/BMSPushTests/BMSPushNotificationActionCategoryTest.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2016 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | import XCTest 15 | @testable import BMSPush 16 | import BMSCore 17 | 18 | class BMSPushNotificationActionCategoryTest: XCTestCase { 19 | 20 | func testInit(){ 21 | #if swift(>=3.0) 22 | let actionOne = BMSPushNotificationAction(identifierName: "FIRST", buttonTitle: "Accept", isAuthenticationRequired: false, defineActivationMode: UIUserNotificationActivationMode.background) 23 | 24 | let actionTwo = BMSPushNotificationAction(identifierName: "SECOND", buttonTitle: "Reject", isAuthenticationRequired: false, defineActivationMode: UIUserNotificationActivationMode.background) 25 | 26 | let actionThree = BMSPushNotificationAction(identifierName: "Third", buttonTitle: "Delete", isAuthenticationRequired: false, defineActivationMode: UIUserNotificationActivationMode.background) 27 | 28 | let actionFour = BMSPushNotificationAction(identifierName: "Fourth", buttonTitle: "View", isAuthenticationRequired: false, defineActivationMode: UIUserNotificationActivationMode.background) 29 | 30 | let actionFive = BMSPushNotificationAction(identifierName: "Fifth", buttonTitle: "Later", isAuthenticationRequired: false, defineActivationMode: UIUserNotificationActivationMode.background) 31 | 32 | #else 33 | let actionOne = BMSPushNotificationAction(identifierName: "FIRST", buttonTitle: "Accept", isAuthenticationRequired: false, defineActivationMode: UIUserNotificationActivationMode.Background) 34 | 35 | let actionTwo = BMSPushNotificationAction(identifierName: "SECOND", buttonTitle: "Reject", isAuthenticationRequired: false, defineActivationMode: UIUserNotificationActivationMode.Background) 36 | 37 | let actionThree = BMSPushNotificationAction(identifierName: "Third", buttonTitle: "Delete", isAuthenticationRequired: false, defineActivationMode: UIUserNotificationActivationMode.Background) 38 | 39 | let actionFour = BMSPushNotificationAction(identifierName: "Fourth", buttonTitle: "View", isAuthenticationRequired: false, defineActivationMode: UIUserNotificationActivationMode.Background) 40 | 41 | let actionFive = BMSPushNotificationAction(identifierName: "Fifth", buttonTitle: "Later", isAuthenticationRequired: false, defineActivationMode: UIUserNotificationActivationMode.Background) 42 | 43 | #endif 44 | 45 | let category = BMSPushNotificationActionCategory(identifierName: "category", buttonActions: [actionOne, actionTwo]) 46 | let categorySecond = BMSPushNotificationActionCategory(identifierName: "category1", buttonActions: [actionOne, actionTwo]) 47 | let categoryThird = BMSPushNotificationActionCategory(identifierName: "category2", buttonActions: [actionOne, actionTwo,actionThree,actionFour,actionFive]) 48 | 49 | XCTAssertEqual(category.identifier, "category") 50 | XCTAssertEqual(category.actions, [actionOne, actionTwo]) 51 | 52 | XCTAssertEqual(categorySecond.identifier, "category1") 53 | XCTAssertEqual(categorySecond.actions, [actionOne, actionTwo]) 54 | 55 | XCTAssertEqual(categoryThird.identifier, "category2") 56 | XCTAssertEqual(categoryThird.actions, [actionOne, actionTwo,actionThree,actionFour,actionFive]) 57 | 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /Tests/Unit Tests/BMSPushTests/BMSPushNotificationActionTest.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2016 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | import XCTest 15 | @testable import BMSPush 16 | import BMSCore 17 | 18 | class BMSPushNotificationActionTest: XCTestCase { 19 | 20 | func testInit(){ 21 | 22 | #if swift(>=3.0) 23 | let actionOne = BMSPushNotificationAction(identifierName: "FIRST", buttonTitle: "Accept", isAuthenticationRequired: false, defineActivationMode: UIUserNotificationActivationMode.background) 24 | let actionTwo = BMSPushNotificationAction(identifierName: "Second", buttonTitle: "decline", isAuthenticationRequired: false, defineActivationMode: UIUserNotificationActivationMode.background) 25 | #else 26 | let actionOne = BMSPushNotificationAction(identifierName: "FIRST", buttonTitle: "Accept", isAuthenticationRequired: false, defineActivationMode: UIUserNotificationActivationMode.Background) 27 | let actionTwo = BMSPushNotificationAction(identifierName: "Second", buttonTitle: "decline", isAuthenticationRequired: false, defineActivationMode: UIUserNotificationActivationMode.Background) 28 | #endif 29 | 30 | 31 | XCTAssertEqual(actionOne.identifier, "FIRST") 32 | XCTAssertEqual(actionOne.title, "Accept") 33 | 34 | XCTAssertEqual(actionTwo.identifier, "Second") 35 | XCTAssertEqual(actionTwo.title, "decline") 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Tests/Unit Tests/BMSPushTests/BMSPushUrlBuilderTest.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2016 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | 15 | import XCTest 16 | @testable import BMSPush 17 | import BMSCore 18 | 19 | class BMSPushUrlBuilderTest: XCTestCase { 20 | 21 | func testAddHeader() { 22 | BMSClient.sharedInstance.initialize(bluemixRegion: BMSClient.Region.usSouth) 23 | let urlBuilder = BMSPushUrlBuilder(applicationID: "dabf5067-5553-48e2-ac96-6e2c03aab216", clientSecret: "6d0cfa42-cf69-4e72-8073-9ff2de3ddf77") 24 | 25 | let headers = urlBuilder.addHeader() 26 | if !(headers.isEmpty) { 27 | print("Success!!") 28 | } 29 | } 30 | 31 | func testAddHeader1() { 32 | 33 | BMSClient.sharedInstance.initialize(bluemixRegion: BMSClient.Region.germany) 34 | let urlBuilder = BMSPushUrlBuilder(applicationID: "dabf5067-5553-48e2-ac96-6e2c03aab216", clientSecret: "6d0cfa42-cf69-4e72-8073-9ff2de3ddf77") 35 | 36 | let headers = urlBuilder.addHeader() 37 | if !(headers.isEmpty) { 38 | print("Success!!") 39 | } 40 | } 41 | 42 | func testAddHeader2() { 43 | 44 | BMSClient.sharedInstance.initialize(bluemixRegion: BMSClient.Region.jpTok) 45 | let urlBuilder = BMSPushUrlBuilder(applicationID: "dabf5067-5553-48e2-ac96-6e2c03aab216",clientSecret:"6d0cfa42-cf69-4e72-8073-9ff2de3ddf77") 46 | 47 | let headers = urlBuilder.addHeader() 48 | if !(headers.isEmpty) { 49 | print("Success!!") 50 | } 51 | } 52 | 53 | func testAddHeader3() { 54 | 55 | BMSClient.sharedInstance.initialize(bluemixRegion: BMSClient.Region.sydney) 56 | let urlBuilder = BMSPushUrlBuilder(applicationID: "dabf5067-5553-48e2-ac96-6e2c03aab216", clientSecret: "6d0cfa42-cf69-4e72-8073-9ff2de3ddf77") 57 | 58 | let headers = urlBuilder.addHeader() 59 | if !(headers.isEmpty) { 60 | print("Success!!") 61 | } 62 | } 63 | 64 | func testAddHeader4() { 65 | 66 | BMSClient.sharedInstance.initialize(bluemixRegion: BMSClient.Region.unitedKingdom) 67 | let urlBuilder = BMSPushUrlBuilder(applicationID: "dabf5067-5553-48e2-ac96-6e2c03aab216", clientSecret: "6d0cfa42-cf69-4e72-8073-9ff2de3ddf77") 68 | 69 | let headers = urlBuilder.addHeader() 70 | if !(headers.isEmpty) { 71 | print("Success!!") 72 | } 73 | } 74 | 75 | func testAddHeader5() { 76 | 77 | BMSClient.sharedInstance.initialize(bluemixRegion: BMSClient.Region.usEast) 78 | let urlBuilder = BMSPushUrlBuilder(applicationID: "dabf5067-5553-48e2-ac96-6e2c03aab216", clientSecret: "6d0cfa42-cf69-4e72-8073-9ff2de3ddf77") 79 | 80 | let headers = urlBuilder.addHeader() 81 | if !(headers.isEmpty) { 82 | print("Success!!") 83 | } 84 | } 85 | 86 | func testAddHeader6() { 87 | 88 | BMSPushClient.overrideServerHost = "192.0.0.2:9080" 89 | 90 | let urlBuilder = BMSPushUrlBuilder(applicationID: "dabf5067-5553-48e2-ac96-6e2c03aab216", clientSecret: "6d0cfa42-cf69-4e72-8073-9ff2de3ddf77") 91 | 92 | let headers = urlBuilder.addHeader() 93 | if !(headers.isEmpty) { 94 | print("Success!!") 95 | } 96 | } 97 | 98 | func testAddHeader7() { 99 | 100 | BMSClient.sharedInstance.initialize(bluemixRegion: BMSClient.Region.usEast) 101 | 102 | let urlBuilder = BMSPushUrlBuilder(applicationID: "dabf5067-5553-48e2-ac96-6e2c03aab216", clientSecret: "") 103 | 104 | let headers = urlBuilder.addHeader() 105 | if !(headers.isEmpty) { 106 | print("Success!!") 107 | } 108 | } 109 | func testAddHeader8() { 110 | 111 | BMSPushClient.overrideServerHost = "192.0.0.2:9080" 112 | 113 | let urlBuilder = BMSPushUrlBuilder(applicationID: "dabf5067-5553-48e2-ac96-6e2c03aab216", clientSecret: "") 114 | 115 | let headers = urlBuilder.addHeader() 116 | if !(headers.isEmpty) { 117 | print("Success!!") 118 | } 119 | } 120 | 121 | func testGetSubscribedDevicesUrl(){ 122 | BMSClient.sharedInstance.initialize(bluemixRegion: BMSClient.Region.usSouth) 123 | let urlBuilder = BMSPushUrlBuilder(applicationID: "dabf5067-5553-48e2-ac96-6e2c03aab216", clientSecret: "6d0cfa42-cf69-4e72-8073-9ff2de3ddf77") 124 | 125 | #if swift(>=3.0) 126 | let subDeviceURL = urlBuilder.getSubscribedDevicesUrl(devID: "testDevice") 127 | #else 128 | let subDeviceURL = urlBuilder.getSubscribedDevicesUrl("testDevice") 129 | #endif 130 | if !(subDeviceURL.isEmpty) { 131 | print("Success!!") 132 | } 133 | } 134 | 135 | func testGetDevicesUrl(){ 136 | BMSClient.sharedInstance.initialize(bluemixRegion: BMSClient.Region.usSouth) 137 | let urlBuilder = BMSPushUrlBuilder(applicationID: "dabf5067-5553-48e2-ac96-6e2c03aab216", clientSecret: "6d0cfa42-cf69-4e72-8073-9ff2de3ddf77") 138 | 139 | let getDeviceURL = urlBuilder.getDevicesUrl() 140 | if !(getDeviceURL.isEmpty) { 141 | print("Success!!") 142 | } 143 | } 144 | 145 | func testGetTagsUrl(){ 146 | BMSClient.sharedInstance.initialize(bluemixRegion: BMSClient.Region.usSouth) 147 | let urlBuilder = BMSPushUrlBuilder(applicationID: "dabf5067-5553-48e2-ac96-6e2c03aab216", clientSecret: "6d0cfa42-cf69-4e72-8073-9ff2de3ddf77") 148 | 149 | let getTagsUrl = urlBuilder.getTagsUrl() 150 | if !(getTagsUrl.isEmpty) { 151 | print("Success!!") 152 | } 153 | } 154 | 155 | func testGetSubscriptionsUrl(){ 156 | BMSClient.sharedInstance.initialize(bluemixRegion: BMSClient.Region.usSouth) 157 | let urlBuilder = BMSPushUrlBuilder(applicationID: "dabf5067-5553-48e2-ac96-6e2c03aab216", clientSecret: "6d0cfa42-cf69-4e72-8073-9ff2de3ddf77") 158 | 159 | let getSubscriptionsUrl = urlBuilder.getSubscriptionsUrl() 160 | if !(getSubscriptionsUrl.isEmpty) { 161 | print("Success!!") 162 | } 163 | } 164 | 165 | func testGetAvailableSubscriptionsUrl(){ 166 | BMSClient.sharedInstance.initialize(bluemixRegion: BMSClient.Region.usSouth) 167 | let urlBuilder = BMSPushUrlBuilder(applicationID: "dabf5067-5553-48e2-ac96-6e2c03aab216", clientSecret: "6d0cfa42-cf69-4e72-8073-9ff2de3ddf77") 168 | #if swift(>=3.0) 169 | let getAvailableSubscriptionsUrl = urlBuilder.getAvailableSubscriptionsUrl(deviceId: "testDevice") 170 | #else 171 | let getAvailableSubscriptionsUrl = urlBuilder.getAvailableSubscriptionsUrl("testDevice") 172 | #endif 173 | if !(getAvailableSubscriptionsUrl.isEmpty) { 174 | print("Success!!") 175 | } 176 | } 177 | 178 | func testGetUnSubscribetagsUrl(){ 179 | BMSClient.sharedInstance.initialize(bluemixRegion: BMSClient.Region.usSouth) 180 | let urlBuilder = BMSPushUrlBuilder(applicationID: "dabf5067-5553-48e2-ac96-6e2c03aab216", clientSecret: "6d0cfa42-cf69-4e72-8073-9ff2de3ddf77") 181 | 182 | let getUnSubscribetagsUrl = urlBuilder.getUnSubscribetagsUrl() 183 | if !(getUnSubscribetagsUrl.isEmpty) { 184 | print("Success!!") 185 | } 186 | } 187 | 188 | func testGetUnregisterUrl(){ 189 | BMSClient.sharedInstance.initialize(bluemixRegion: BMSClient.Region.usSouth) 190 | let urlBuilder = BMSPushUrlBuilder(applicationID: "dabf5067-5553-48e2-ac96-6e2c03aab216", clientSecret: "6d0cfa42-cf69-4e72-8073-9ff2de3ddf77") 191 | #if swift(>=3.0) 192 | let getUnregisterUrl = urlBuilder.getUnregisterUrl(deviceId: "testDevice") 193 | #else 194 | let getUnregisterUrl = urlBuilder.getUnregisterUrl("testDevice") 195 | #endif 196 | if !(getUnregisterUrl.isEmpty) { 197 | print("Success!!") 198 | } 199 | } 200 | 201 | func testGetSendMessageDeliveryStatus(){ 202 | BMSClient.sharedInstance.initialize(bluemixRegion: BMSClient.Region.usSouth) 203 | let urlBuilder = BMSPushUrlBuilder(applicationID: "dabf5067-5553-48e2-ac96-6e2c03aab216", 204 | clientSecret: "6d0cfa42-cf69-4e72-8073-9ff2de3ddf77") 205 | #if swift(>=3.0) 206 | let getSendMessageDeliveryStatus = urlBuilder.getSendMessageDeliveryStatus(messageId: "testMessageId") 207 | #else 208 | let getSendMessageDeliveryStatus = urlBuilder.getSendMessageDeliveryStatus("testMessageId") 209 | #endif 210 | if !(getSendMessageDeliveryStatus.isEmpty) { 211 | print("Success!!") 212 | } 213 | } 214 | 215 | } 216 | -------------------------------------------------------------------------------- /Tests/Unit Tests/BMSPushTests/BMSPushUtilsTest.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2016 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | import XCTest 15 | @testable import BMSPush 16 | 17 | class BMSPushUtilsTest: XCTestCase { 18 | 19 | 20 | func testSaveValueToNSUserDefaults () { 21 | 22 | #if swift(>=3.0) 23 | BMSPushUtils.saveValueToNSUserDefaults(value: "some string", key: "somestring") 24 | 25 | XCTAssertEqual("some string", BMSPushUtils.getValueToNSUserDefaults(key: "somestring") as? String ?? "" ) 26 | #else 27 | BMSPushUtils.saveValueToNSUserDefaults("some string", key: "somestring") 28 | 29 | #endif 30 | } 31 | 32 | func testOptionsDefaults() { 33 | 34 | let variables = [ 35 | "username": "testname", 36 | "accountNumber": "3564758697057869" 37 | ] 38 | 39 | BMSPushUtils.saveValueToNSUserDefaults(value: variables, key: IMFPUSH_VARIABLES) 40 | BMSPushUtils.saveValueToNSUserDefaults(value: true, key: HAS_IMFPUSH_VARIABLES) 41 | 42 | let newVariables = BMSPushUtils.getPushOptionsNSUserDefaults(key: IMFPUSH_VARIABLES) 43 | 44 | if let data = newVariables.data(using: .utf8) { 45 | do { 46 | if let json = try JSONSerialization.jsonObject(with: data, 47 | options: .mutableContainers) as? [String: String] { 48 | XCTAssertEqual(variables["username"], json["username"]) 49 | XCTAssertEqual(variables["accountNumber"], json["accountNumber"]) 50 | } else { 51 | XCTFail("Failed in options check") 52 | } 53 | 54 | } catch { 55 | XCTFail("Failed in options check") 56 | } 57 | } 58 | } 59 | 60 | func testOptionsDefaultlFalse() { 61 | 62 | let variables = [ 63 | "username": "testname", 64 | "accountNumber": "3564758697057869" 65 | ] 66 | 67 | BMSPushUtils.saveValueToNSUserDefaults(value: variables, key: IMFPUSH_VARIABLES) 68 | BMSPushUtils.saveValueToNSUserDefaults(value: false, key: HAS_IMFPUSH_VARIABLES) 69 | 70 | let newVariables = BMSPushUtils.getPushOptionsNSUserDefaults(key: IMFPUSH_VARIABLES) 71 | 72 | XCTAssertEqual(newVariables, "") 73 | } 74 | 75 | func testTemplateNotification() { 76 | 77 | let variables = [ 78 | "username": "Johny", 79 | "accountNumber": "3564758697057869" 80 | ] 81 | 82 | BMSPushUtils.saveValueToNSUserDefaults(value: variables, key: IMFPUSH_VARIABLES) 83 | BMSPushUtils.saveValueToNSUserDefaults(value: true, key: HAS_IMFPUSH_VARIABLES) 84 | 85 | let data = "Hi! {{username}}, your {{accountNumber}} is activated" 86 | let expected = "Hi! Johny, your 3564758697057869 is activated" 87 | 88 | let message = BMSPushUtils.checkTemplateNotifications(data) 89 | 90 | XCTAssertEqual(message, expected) 91 | 92 | } 93 | func testGetPushSettingValue () { 94 | 95 | let pushSettingsValue = BMSPushUtils.getPushSettingValue() 96 | NSLog("\(pushSettingsValue)") 97 | } 98 | 99 | func test () { 100 | 101 | let pushSettingsValue = BMSPushUtils.getPushSettingValue() 102 | NSLog("\(pushSettingsValue)") 103 | } 104 | 105 | func testSendLoggerData () { 106 | 107 | BMSPushUtils.sendLoggerData() 108 | } 109 | 110 | func testGetNotifReg () { 111 | 112 | if (BMSPushUtils.getPushSettingValue()){ 113 | print("Success") 114 | } 115 | } 116 | 117 | } 118 | -------------------------------------------------------------------------------- /Tests/Unit Tests/BMSPushTests/BMSResponseTests.swift: -------------------------------------------------------------------------------- 1 | /* 2 | *     Copyright 2016 IBM Corp. 3 | *     Licensed under the Apache License, Version 2.0 (the "License"); 4 | *     you may not use this file except in compliance with the License. 5 | *     You may obtain a copy of the License at 6 | *     http://www.apache.org/licenses/LICENSE-2.0 7 | *     Unless required by applicable law or agreed to in writing, software 8 | *     distributed under the License is distributed on an "AS IS" BASIS, 9 | *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | *     See the License for the specific language governing permissions and 11 | *     limitations under the License. 12 | */ 13 | 14 | import XCTest 15 | @testable import BMSPush 16 | import BMSCore 17 | 18 | class BMSResponseTests: XCTestCase { 19 | 20 | 21 | var responseArray = NSMutableArray() 22 | var responseDictionary = NSMutableDictionary() 23 | 24 | func testSubscriptions () { 25 | 26 | 27 | let response = "{\"subscriptions\":[{\"tagName\":\"some tag name\",\"subscriptionId\":\"some subscription ID\",\"deviceId\":\"some device ID\",\"href\":\" https:// mybluemix.net\"},{\"tagName\":\"Push.ALL\",\"userId\":\"\",\"subscriptionId\":\"some subscription ID\",\"deviceId\":\"some device ID\",\"href\":\"https:// mybluemix.net\"}]}" 28 | 29 | #if swift(>=3.0) 30 | let responseData = response.data(using: String.Encoding.utf8) 31 | let httpURLResponse = HTTPURLResponse(url: NSURL(string: "http://example.com")! as URL, statusCode: 200, httpVersion: "HTTP/1.1", headerFields: ["key": "value"]) 32 | #else 33 | let responseData = response.dataUsingEncoding(NSUTF8StringEncoding) 34 | let httpURLResponse = NSHTTPURLResponse(URL: NSURL(string: "http://example.com")!, statusCode: 200, HTTPVersion: "HTTP/1.1", headerFields: ["key": "value"]) 35 | #endif 36 | 37 | let testResponse = Response(responseData: responseData!, httpResponse: httpURLResponse, isRedirect: true) 38 | 39 | responseArray = testResponse.subscriptions() 40 | 41 | NSLog("\(responseArray)") 42 | 43 | } 44 | 45 | func testSubscribeStatus () { 46 | 47 | 48 | let response = "{\"tagsNotFound\":{\"tags\":[],\"message\":\"Not Found - Targeted resource 'tagNames' does not exist. Check the 'tags' parameter\",\"code\":\"FPWSE0001E\"},\"subscriptionExists\":[],\"subscribed\":[{\"tagName\":\"some tag name\",\"subscriptionId\":\"some subscription ID\",\"deviceId\":\"some device ID\",\"href\":\"https://mybluemix.net\"}]}" 49 | 50 | #if swift(>=3.0) 51 | let responseData = response.data(using: String.Encoding.utf8) 52 | let httpURLResponse = HTTPURLResponse(url: NSURL(string: "http://example.com")! as URL, statusCode: 207, httpVersion: "HTTP/1.1", headerFields: ["key": "value"]) 53 | #else 54 | let responseData = response.dataUsingEncoding(NSUTF8StringEncoding) 55 | let httpURLResponse = NSHTTPURLResponse(URL: NSURL(string: "http://example.com")!, statusCode: 207, HTTPVersion: "HTTP/1.1", headerFields: ["key": "value"]) 56 | #endif 57 | 58 | let testResponse = Response(responseData: responseData!, httpResponse: httpURLResponse, isRedirect: true) 59 | 60 | responseDictionary = testResponse.subscribeStatus() 61 | 62 | NSLog("\(responseDictionary)") 63 | 64 | } 65 | 66 | func testUnsubscribeStatus () { 67 | 68 | 69 | let response = "{\"tagsNotFound\":{\"tags\":[\"Push.ALL\"],\"message\":\"Not Found - Targeted resource 'tagNames' does not exist. Check the 'tags' parameter\",\"code\":\"FPWSE0001E\"},\"subscriptionExists\":[{\"tagName\":\"Some Tag Name\",\"subscriptionId\":\"some subscription ID\",\"deviceId\":\"some device ID\",\"href\":\"https://mybluemix.net\"}],\"subscribed\":[]}" 70 | 71 | #if swift(>=3.0) 72 | let responseData = response.data(using: String.Encoding.utf8) 73 | let httpURLResponse = HTTPURLResponse(url: NSURL(string: "http://example.com")! as URL, statusCode: 207, httpVersion: "HTTP/1.1", headerFields: ["key": "value"]) 74 | #else 75 | let responseData = response.dataUsingEncoding(NSUTF8StringEncoding) 76 | let httpURLResponse = NSHTTPURLResponse(URL: NSURL(string: "http://example.com")!, statusCode: 207, HTTPVersion: "HTTP/1.1", headerFields: ["key": "value"]) 77 | #endif 78 | 79 | let testResponse = Response(responseData: responseData!, httpResponse: httpURLResponse, isRedirect: true) 80 | 81 | responseDictionary = testResponse.unsubscribeStatus() 82 | 83 | NSLog("\(responseDictionary)") 84 | 85 | } 86 | 87 | 88 | func testAvailableTags () { 89 | 90 | let response = "{\"tags\":[{\"uri\":\"https://mybluemix.net/tags/tagname\",\"name\":\"tagname\",\"createdTime\":\"2016-03-21T10:32:27Z\",\"lastUpdatedTime\":\"2016-03-21T10:32:27Z\",\"createdMode\":\"API\",\"href\":\"https://mybluemix.net\"}]}" 91 | 92 | #if swift(>=3.0) 93 | let responseData = response.data(using: String.Encoding.utf8) 94 | let httpURLResponse = HTTPURLResponse(url: NSURL(string: "http://example.com")! as URL, statusCode: 200, httpVersion: "HTTP/1.1", headerFields: ["key": "value"]) 95 | #else 96 | let responseData = response.dataUsingEncoding(NSUTF8StringEncoding) 97 | let httpURLResponse = NSHTTPURLResponse(URL: NSURL(string: "http://example.com")!, statusCode: 200, HTTPVersion: "HTTP/1.1", headerFields: ["key": "value"]) 98 | #endif 99 | 100 | let testResponse = Response(responseData: responseData!, httpResponse: httpURLResponse, isRedirect: true) 101 | 102 | responseArray = testResponse.availableTags() 103 | 104 | NSLog("\(responseArray)") 105 | } 106 | 107 | } 108 | -------------------------------------------------------------------------------- /Tests/Unit Tests/BMSPushTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /scripts/publish-docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script is used by Travis-CI to automatically rebuild and deploy API documentation. 4 | 5 | # If any part of this script fails, the Travis build will also be marked as failed 6 | set -ev 7 | 8 | # Clone the repository where the docs will be hosted 9 | # GITHUB_TOKEN required for Travis to have permissions to push to the BMSPush repository 10 | git clone https://ibm-bluemix-mobile-services:${GITHUB_TOKEN}@github.com/ibm-bluemix-mobile-services/ibm-bluemix-mobile-services.github.io.git 11 | cd ibm-bluemix-mobile-services.github.io 12 | git remote rm origin 13 | git remote add origin https://ibm-bluemix-mobile-services:${GITHUB_TOKEN}@github.com/ibm-bluemix-mobile-services/ibm-bluemix-mobile-services.github.io.git 14 | cd .. 15 | 16 | # Generate new docs using Jazzy and Sourcekitten 17 | version=$(grep -o 'version.*=.*[0-9]' BMSPush.podspec | cut -f 2 -d "'") 18 | docs_directory='./ibm-bluemix-mobile-services.github.io/API-docs/client-SDK/BMSPush/Swift' 19 | rm -rf "${docs_directory}"/* 20 | jazzy --output "${docs_directory}" 21 | 22 | # Publish docs 23 | cd ibm-bluemix-mobile-services.github.io 24 | git add . 25 | git commit -m "Published docs for BMSPush Swift SDK version ${version}" 26 | git rebase master 27 | git push --set-upstream origin master 28 | -------------------------------------------------------------------------------- /scripts/release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script is used by Travis-CI to automatically release new versions of BMSPush. 4 | # First, we check if the version specified in the .podspec does not already exist as a git tag. 5 | # If the version does not exist yet, we add a git tag for this new version and publish to Cocoapods. 6 | 7 | set -ev 8 | cd ~/Documents 9 | # GITHUB_TOKEN required for Travis to have permissions to push to the BMSPush repository 10 | git clone https://ibm-bluemix-mobile-services:${GITHUB_TOKEN}@github.com/ibm-bluemix-mobile-services/bms-clientsdk-swift-push.git 11 | cd bms-clientsdk-swift-push 12 | git remote rm origin 13 | git remote add origin https://ibm-bluemix-mobile-services:${GITHUB_TOKEN}@github.com/ibm-bluemix-mobile-services/bms-clientsdk-swift-push.git 14 | version=$(grep -o 'version.*=.*[0-9]' BMSPush.podspec | cut -f 2 -d "'") 15 | git fetch --tags 16 | if [[ ! "$(git tag)" =~ "${version}" ]]; then 17 | echo "Publishing new version ${version} "; 18 | git tag $version; 19 | git push origin --tags; 20 | pod trunk push --allow-warnings; 21 | fi 22 | -------------------------------------------------------------------------------- /sonar-project.properties: -------------------------------------------------------------------------------- 1 | ########################## 2 | # Required configuration # 3 | ########################## 4 | 5 | sonar.host.url=http://mblvm007.rtp.raleigh.ibm.com:9000 6 | sonar.projectKey=ibm-bluemix-mobile-services:bms-clientsdk-swift-push 7 | sonar.projectName=bms-clientsdk-swift-push 8 | sonar.projectVersion=master 9 | # Comment if you have a project with mixed ObjC / Swift 10 | sonar.language=swift 11 | sonar.profile=Swift 12 | 13 | # Project description 14 | sonar.projectDescription=Bluemix Mobile Swift Push 15 | 16 | # Path to source directories 17 | sonar.sources=Source 18 | # Path to test directories (comment if no test) 19 | sonar.tests=Tests 20 | 21 | # Destination Simulator to run tests 22 | # As string expected in destination argument of xcodebuild command 23 | # Example = sonar.swift.simulator=platform=iOS Simulator,name=iPhone 6,OS=9.2 24 | sonar.swift.simulator=platform=iOS Simulator,name=iPhone 6s 25 | 26 | # Xcode project configuration (.xcodeproj) 27 | # and use the later to specify which project(s) to include in the analysis (comma separated list) 28 | # Specify either xcodeproj or xcodeproj + xcworkspace 29 | sonar.swift.project=BMSPush.xcodeproj 30 | #sonar.swift.workspace=MyWrkSpc.xcworkspace 31 | 32 | # Scheme to build your application 33 | sonar.swift.appScheme=BMSPush 34 | sonar.swift.testScheme=BMSPushTests 35 | 36 | ########################## 37 | # Optional configuration # 38 | ########################## 39 | 40 | # Encoding of the source code 41 | sonar.sourceEncoding=UTF-8 42 | 43 | 44 | # SCM 45 | # sonar.scm.enabled=true 46 | # sonar.scm.url=scm:git:http://xxx 47 | 48 | # JUnit report generated by run-sonar.sh is stored in sonar-reports/TEST-report.xml 49 | # Change it only if you generate the file on your own 50 | # The XML files have to be prefixed by TEST- otherwise they are not processed 51 | sonar.junit.reportsPath=sonar-reports/ 52 | 53 | # Lizard report generated by run-sonar.sh is stored in sonar-reports/lizard-report.xml 54 | # Change it only if you generate the file on your own 55 | sonar.swift.lizard.report=sonar-reports/lizard-report.xml 56 | 57 | # Cobertura report generated by run-sonar.sh is stored in sonar-reports/coverage.xml 58 | # Change it only if you generate the file on your own 59 | sonar.swift.coverage.reportPattern=sonar-reports/coverage*.xml 60 | 61 | # OCLint report generated by run-sonar.sh is stored in sonar-reports/oclint.xml 62 | # Change it only if you generate the file on your own 63 | sonar.swift.swiftlint.report=sonar-reports/*swiftlint.txt 64 | 65 | # Paths to exclude from coverage report (tests, 3rd party libraries etc.) 66 | # sonar.swift.excludedPathsFromCoverage=pattern1,pattern2 67 | sonar.swift.excludedPathsFromCoverage=.*Tests.* 68 | --------------------------------------------------------------------------------