├── .gitignore ├── History.md ├── README.md ├── apnagent.xcodeproj └── project.pbxproj ├── apnagent ├── AppDelegate.h ├── AppDelegate.m ├── Default-568h@2x.png ├── Default.png ├── Default@2x.png ├── PushNotification.h ├── PushNotification.m ├── apnDetailsVC.h ├── apnDetailsVC.m ├── apnListVC.h ├── apnListVC.m ├── apnagent-Info.plist ├── apnagent-Prefix.pch ├── en.lproj │ ├── InfoPlist.strings │ └── MainStoryboard.storyboard └── main.m ├── apnagentTests ├── apnagentTests-Info.plist ├── apnagentTests.h ├── apnagentTests.m └── en.lproj │ └── InfoPlist.strings └── screenshot.png /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *xcuserdata/ 3 | *build/ 4 | *.mode1v3 5 | *.pbxuser 6 | *.xcworkspace 7 | *.moved-aside/ 8 | DerivedData 9 | 10 | Resources/Fonts/* 11 | Other Sources/CDIDefines.* 12 | -------------------------------------------------------------------------------- /History.md: -------------------------------------------------------------------------------- 1 | 2 | 1.2.0 / 2013-03-27 3 | ================== 4 | 5 | * Added Push notification's Payload Details screen 6 | * readme: typeo 7 | * readme: update 8 | 9 | 1.1.0 / 2013-03-18 10 | ================== 11 | 12 | * history: add changelog 13 | * project: reset code sign to auto assign 14 | * plist: custom BUNDLE_ID for CFBUndleIdentifier 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # apnagent for iOS 2 | 3 | _apnagent-ios_ is an iOS application that has been developed for use with the [Node.js](http://nodejs.org) 4 | module [apnagent](https://github.com/qualiancy/apnagent) to facilitate testing and demonstration. It can 5 | be used to test any APN server-side tool. 6 | 7 | ## Usage 8 | 9 | This assumes that you have created a new application in your iOS provisioning portal. 10 | 11 | **1. Clone:** Clone a copy of `apnagent-ios`. 12 | 13 | git clone git@github.com:logicalparadox/apnagent-ios.git 14 | 15 | **2. xCode Configure:** Open the project in xCode and specify the `BUNDLE_ID`. Select Project > Build Settings, then 16 | from the bottom right corner click Add Build Setting > Add User-Defined Setting. The key is `BUNDLE_ID` and the value 17 | will be the application's bundle ID as specified in the iOS Provisioning portal. For example: `com.logicalparadox.apnagent`. 18 | 19 | **3. Build/Run:** Run the application on your device. APNs notification cannot be sent to the simulator. Your APN token 20 | will be logged to the console. Then use the server-side framework of your choice to send notifications to your device. 21 | 22 | ## License 23 | 24 | (The MIT License) 25 | 26 | Copyright (c) 2012 Jake Luer 27 | 28 | Permission is hereby granted, free of charge, to any person obtaining a copy 29 | of this software and associated documentation files (the "Software"), to deal 30 | in the Software without restriction, including without limitation the rights 31 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 32 | copies of the Software, and to permit persons to whom the Software is 33 | furnished to do so, subject to the following conditions: 34 | 35 | The above copyright notice and this permission notice shall be included in 36 | all copies or substantial portions of the Software. 37 | 38 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 39 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 40 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 41 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 42 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 43 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 44 | THE SOFTWARE. 45 | -------------------------------------------------------------------------------- /apnagent.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 113011D416A10E75008A3718 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 113011D316A10E75008A3718 /* UIKit.framework */; }; 11 | 113011D616A10E75008A3718 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 113011D516A10E75008A3718 /* Foundation.framework */; }; 12 | 113011D816A10E75008A3718 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 113011D716A10E75008A3718 /* CoreGraphics.framework */; }; 13 | 113011DE16A10E75008A3718 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 113011DC16A10E75008A3718 /* InfoPlist.strings */; }; 14 | 113011E016A10E75008A3718 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 113011DF16A10E75008A3718 /* main.m */; }; 15 | 113011E416A10E75008A3718 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 113011E316A10E75008A3718 /* AppDelegate.m */; }; 16 | 113011E616A10E75008A3718 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 113011E516A10E75008A3718 /* Default.png */; }; 17 | 113011E816A10E75008A3718 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 113011E716A10E75008A3718 /* Default@2x.png */; }; 18 | 113011EA16A10E75008A3718 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 113011E916A10E75008A3718 /* Default-568h@2x.png */; }; 19 | 113011ED16A10E75008A3718 /* MainStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 113011EB16A10E75008A3718 /* MainStoryboard.storyboard */; }; 20 | 113011F816A10E75008A3718 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 113011F716A10E75008A3718 /* SenTestingKit.framework */; }; 21 | 113011F916A10E75008A3718 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 113011D316A10E75008A3718 /* UIKit.framework */; }; 22 | 113011FA16A10E75008A3718 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 113011D516A10E75008A3718 /* Foundation.framework */; }; 23 | 1130120216A10E75008A3718 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1130120016A10E75008A3718 /* InfoPlist.strings */; }; 24 | 1130120516A10E75008A3718 /* apnagentTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1130120416A10E75008A3718 /* apnagentTests.m */; }; 25 | 2800B36A16CE7E4500EF4E16 /* apnListVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 2800B36916CE7E4500EF4E16 /* apnListVC.m */; }; 26 | 2800B37116D228A900EF4E16 /* PushNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = 2800B37016D228A900EF4E16 /* PushNotification.m */; }; 27 | 28E0AE621701956F008881E7 /* apnDetailsVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 28E0AE611701956F008881E7 /* apnDetailsVC.m */; }; 28 | /* End PBXBuildFile section */ 29 | 30 | /* Begin PBXContainerItemProxy section */ 31 | 113011FB16A10E75008A3718 /* PBXContainerItemProxy */ = { 32 | isa = PBXContainerItemProxy; 33 | containerPortal = 113011C616A10E74008A3718 /* Project object */; 34 | proxyType = 1; 35 | remoteGlobalIDString = 113011CE16A10E74008A3718; 36 | remoteInfo = apnagent; 37 | }; 38 | /* End PBXContainerItemProxy section */ 39 | 40 | /* Begin PBXFileReference section */ 41 | 113011CF16A10E75008A3718 /* apnagent.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = apnagent.app; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 113011D316A10E75008A3718 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 43 | 113011D516A10E75008A3718 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 44 | 113011D716A10E75008A3718 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 45 | 113011DB16A10E75008A3718 /* apnagent-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "apnagent-Info.plist"; sourceTree = ""; }; 46 | 113011DD16A10E75008A3718 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 47 | 113011DF16A10E75008A3718 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 48 | 113011E116A10E75008A3718 /* apnagent-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "apnagent-Prefix.pch"; sourceTree = ""; }; 49 | 113011E216A10E75008A3718 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 50 | 113011E316A10E75008A3718 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; wrapsLines = 0; }; 51 | 113011E516A10E75008A3718 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; 52 | 113011E716A10E75008A3718 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; 53 | 113011E916A10E75008A3718 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; 54 | 113011EC16A10E75008A3718 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard.storyboard; sourceTree = ""; }; 55 | 113011F616A10E75008A3718 /* apnagentTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = apnagentTests.octest; sourceTree = BUILT_PRODUCTS_DIR; }; 56 | 113011F716A10E75008A3718 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; }; 57 | 113011FF16A10E75008A3718 /* apnagentTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "apnagentTests-Info.plist"; sourceTree = ""; }; 58 | 1130120116A10E75008A3718 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 59 | 1130120316A10E75008A3718 /* apnagentTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = apnagentTests.h; sourceTree = ""; }; 60 | 1130120416A10E75008A3718 /* apnagentTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = apnagentTests.m; sourceTree = ""; }; 61 | 2800B36816CE7E4500EF4E16 /* apnListVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = apnListVC.h; sourceTree = ""; }; 62 | 2800B36916CE7E4500EF4E16 /* apnListVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = apnListVC.m; sourceTree = ""; }; 63 | 2800B36F16D228A900EF4E16 /* PushNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PushNotification.h; sourceTree = ""; }; 64 | 2800B37016D228A900EF4E16 /* PushNotification.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PushNotification.m; sourceTree = ""; }; 65 | 28E0AE601701956F008881E7 /* apnDetailsVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = apnDetailsVC.h; sourceTree = ""; }; 66 | 28E0AE611701956F008881E7 /* apnDetailsVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = apnDetailsVC.m; sourceTree = ""; }; 67 | /* End PBXFileReference section */ 68 | 69 | /* Begin PBXFrameworksBuildPhase section */ 70 | 113011CC16A10E74008A3718 /* Frameworks */ = { 71 | isa = PBXFrameworksBuildPhase; 72 | buildActionMask = 2147483647; 73 | files = ( 74 | 113011D416A10E75008A3718 /* UIKit.framework in Frameworks */, 75 | 113011D616A10E75008A3718 /* Foundation.framework in Frameworks */, 76 | 113011D816A10E75008A3718 /* CoreGraphics.framework in Frameworks */, 77 | ); 78 | runOnlyForDeploymentPostprocessing = 0; 79 | }; 80 | 113011F216A10E75008A3718 /* Frameworks */ = { 81 | isa = PBXFrameworksBuildPhase; 82 | buildActionMask = 2147483647; 83 | files = ( 84 | 113011F816A10E75008A3718 /* SenTestingKit.framework in Frameworks */, 85 | 113011F916A10E75008A3718 /* UIKit.framework in Frameworks */, 86 | 113011FA16A10E75008A3718 /* Foundation.framework in Frameworks */, 87 | ); 88 | runOnlyForDeploymentPostprocessing = 0; 89 | }; 90 | /* End PBXFrameworksBuildPhase section */ 91 | 92 | /* Begin PBXGroup section */ 93 | 113011C416A10E74008A3718 = { 94 | isa = PBXGroup; 95 | children = ( 96 | 113011D916A10E75008A3718 /* apnagent */, 97 | 113011FD16A10E75008A3718 /* apnagentTests */, 98 | 113011D216A10E75008A3718 /* Frameworks */, 99 | 113011D016A10E75008A3718 /* Products */, 100 | ); 101 | sourceTree = ""; 102 | }; 103 | 113011D016A10E75008A3718 /* Products */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | 113011CF16A10E75008A3718 /* apnagent.app */, 107 | 113011F616A10E75008A3718 /* apnagentTests.octest */, 108 | ); 109 | name = Products; 110 | sourceTree = ""; 111 | }; 112 | 113011D216A10E75008A3718 /* Frameworks */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 113011D316A10E75008A3718 /* UIKit.framework */, 116 | 113011D516A10E75008A3718 /* Foundation.framework */, 117 | 113011D716A10E75008A3718 /* CoreGraphics.framework */, 118 | 113011F716A10E75008A3718 /* SenTestingKit.framework */, 119 | ); 120 | name = Frameworks; 121 | sourceTree = ""; 122 | }; 123 | 113011D916A10E75008A3718 /* apnagent */ = { 124 | isa = PBXGroup; 125 | children = ( 126 | 113011E216A10E75008A3718 /* AppDelegate.h */, 127 | 113011E316A10E75008A3718 /* AppDelegate.m */, 128 | 2800B36816CE7E4500EF4E16 /* apnListVC.h */, 129 | 2800B36916CE7E4500EF4E16 /* apnListVC.m */, 130 | 28E0AE601701956F008881E7 /* apnDetailsVC.h */, 131 | 28E0AE611701956F008881E7 /* apnDetailsVC.m */, 132 | 2800B36F16D228A900EF4E16 /* PushNotification.h */, 133 | 2800B37016D228A900EF4E16 /* PushNotification.m */, 134 | 113011EB16A10E75008A3718 /* MainStoryboard.storyboard */, 135 | 113011DA16A10E75008A3718 /* Supporting Files */, 136 | ); 137 | path = apnagent; 138 | sourceTree = ""; 139 | }; 140 | 113011DA16A10E75008A3718 /* Supporting Files */ = { 141 | isa = PBXGroup; 142 | children = ( 143 | 113011DB16A10E75008A3718 /* apnagent-Info.plist */, 144 | 113011DC16A10E75008A3718 /* InfoPlist.strings */, 145 | 113011DF16A10E75008A3718 /* main.m */, 146 | 113011E116A10E75008A3718 /* apnagent-Prefix.pch */, 147 | 113011E516A10E75008A3718 /* Default.png */, 148 | 113011E716A10E75008A3718 /* Default@2x.png */, 149 | 113011E916A10E75008A3718 /* Default-568h@2x.png */, 150 | ); 151 | name = "Supporting Files"; 152 | sourceTree = ""; 153 | }; 154 | 113011FD16A10E75008A3718 /* apnagentTests */ = { 155 | isa = PBXGroup; 156 | children = ( 157 | 1130120316A10E75008A3718 /* apnagentTests.h */, 158 | 1130120416A10E75008A3718 /* apnagentTests.m */, 159 | 113011FE16A10E75008A3718 /* Supporting Files */, 160 | ); 161 | path = apnagentTests; 162 | sourceTree = ""; 163 | }; 164 | 113011FE16A10E75008A3718 /* Supporting Files */ = { 165 | isa = PBXGroup; 166 | children = ( 167 | 113011FF16A10E75008A3718 /* apnagentTests-Info.plist */, 168 | 1130120016A10E75008A3718 /* InfoPlist.strings */, 169 | ); 170 | name = "Supporting Files"; 171 | sourceTree = ""; 172 | }; 173 | /* End PBXGroup section */ 174 | 175 | /* Begin PBXNativeTarget section */ 176 | 113011CE16A10E74008A3718 /* apnagent */ = { 177 | isa = PBXNativeTarget; 178 | buildConfigurationList = 1130120816A10E75008A3718 /* Build configuration list for PBXNativeTarget "apnagent" */; 179 | buildPhases = ( 180 | 113011CB16A10E74008A3718 /* Sources */, 181 | 113011CC16A10E74008A3718 /* Frameworks */, 182 | 113011CD16A10E74008A3718 /* Resources */, 183 | ); 184 | buildRules = ( 185 | ); 186 | dependencies = ( 187 | ); 188 | name = apnagent; 189 | productName = apnagent; 190 | productReference = 113011CF16A10E75008A3718 /* apnagent.app */; 191 | productType = "com.apple.product-type.application"; 192 | }; 193 | 113011F516A10E75008A3718 /* apnagentTests */ = { 194 | isa = PBXNativeTarget; 195 | buildConfigurationList = 1130120B16A10E75008A3718 /* Build configuration list for PBXNativeTarget "apnagentTests" */; 196 | buildPhases = ( 197 | 113011F116A10E75008A3718 /* Sources */, 198 | 113011F216A10E75008A3718 /* Frameworks */, 199 | 113011F316A10E75008A3718 /* Resources */, 200 | 113011F416A10E75008A3718 /* ShellScript */, 201 | ); 202 | buildRules = ( 203 | ); 204 | dependencies = ( 205 | 113011FC16A10E75008A3718 /* PBXTargetDependency */, 206 | ); 207 | name = apnagentTests; 208 | productName = apnagentTests; 209 | productReference = 113011F616A10E75008A3718 /* apnagentTests.octest */; 210 | productType = "com.apple.product-type.bundle"; 211 | }; 212 | /* End PBXNativeTarget section */ 213 | 214 | /* Begin PBXProject section */ 215 | 113011C616A10E74008A3718 /* Project object */ = { 216 | isa = PBXProject; 217 | attributes = { 218 | LastUpgradeCheck = 0450; 219 | ORGANIZATIONNAME = "Jake Luer"; 220 | }; 221 | buildConfigurationList = 113011C916A10E74008A3718 /* Build configuration list for PBXProject "apnagent" */; 222 | compatibilityVersion = "Xcode 3.2"; 223 | developmentRegion = English; 224 | hasScannedForEncodings = 0; 225 | knownRegions = ( 226 | en, 227 | ); 228 | mainGroup = 113011C416A10E74008A3718; 229 | productRefGroup = 113011D016A10E75008A3718 /* Products */; 230 | projectDirPath = ""; 231 | projectRoot = ""; 232 | targets = ( 233 | 113011CE16A10E74008A3718 /* apnagent */, 234 | 113011F516A10E75008A3718 /* apnagentTests */, 235 | ); 236 | }; 237 | /* End PBXProject section */ 238 | 239 | /* Begin PBXResourcesBuildPhase section */ 240 | 113011CD16A10E74008A3718 /* Resources */ = { 241 | isa = PBXResourcesBuildPhase; 242 | buildActionMask = 2147483647; 243 | files = ( 244 | 113011DE16A10E75008A3718 /* InfoPlist.strings in Resources */, 245 | 113011E616A10E75008A3718 /* Default.png in Resources */, 246 | 113011E816A10E75008A3718 /* Default@2x.png in Resources */, 247 | 113011EA16A10E75008A3718 /* Default-568h@2x.png in Resources */, 248 | 113011ED16A10E75008A3718 /* MainStoryboard.storyboard in Resources */, 249 | ); 250 | runOnlyForDeploymentPostprocessing = 0; 251 | }; 252 | 113011F316A10E75008A3718 /* Resources */ = { 253 | isa = PBXResourcesBuildPhase; 254 | buildActionMask = 2147483647; 255 | files = ( 256 | 1130120216A10E75008A3718 /* InfoPlist.strings in Resources */, 257 | ); 258 | runOnlyForDeploymentPostprocessing = 0; 259 | }; 260 | /* End PBXResourcesBuildPhase section */ 261 | 262 | /* Begin PBXShellScriptBuildPhase section */ 263 | 113011F416A10E75008A3718 /* ShellScript */ = { 264 | isa = PBXShellScriptBuildPhase; 265 | buildActionMask = 2147483647; 266 | files = ( 267 | ); 268 | inputPaths = ( 269 | ); 270 | outputPaths = ( 271 | ); 272 | runOnlyForDeploymentPostprocessing = 0; 273 | shellPath = /bin/sh; 274 | shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n"; 275 | }; 276 | /* End PBXShellScriptBuildPhase section */ 277 | 278 | /* Begin PBXSourcesBuildPhase section */ 279 | 113011CB16A10E74008A3718 /* Sources */ = { 280 | isa = PBXSourcesBuildPhase; 281 | buildActionMask = 2147483647; 282 | files = ( 283 | 113011E016A10E75008A3718 /* main.m in Sources */, 284 | 113011E416A10E75008A3718 /* AppDelegate.m in Sources */, 285 | 2800B36A16CE7E4500EF4E16 /* apnListVC.m in Sources */, 286 | 2800B37116D228A900EF4E16 /* PushNotification.m in Sources */, 287 | 28E0AE621701956F008881E7 /* apnDetailsVC.m in Sources */, 288 | ); 289 | runOnlyForDeploymentPostprocessing = 0; 290 | }; 291 | 113011F116A10E75008A3718 /* Sources */ = { 292 | isa = PBXSourcesBuildPhase; 293 | buildActionMask = 2147483647; 294 | files = ( 295 | 1130120516A10E75008A3718 /* apnagentTests.m in Sources */, 296 | ); 297 | runOnlyForDeploymentPostprocessing = 0; 298 | }; 299 | /* End PBXSourcesBuildPhase section */ 300 | 301 | /* Begin PBXTargetDependency section */ 302 | 113011FC16A10E75008A3718 /* PBXTargetDependency */ = { 303 | isa = PBXTargetDependency; 304 | target = 113011CE16A10E74008A3718 /* apnagent */; 305 | targetProxy = 113011FB16A10E75008A3718 /* PBXContainerItemProxy */; 306 | }; 307 | /* End PBXTargetDependency section */ 308 | 309 | /* Begin PBXVariantGroup section */ 310 | 113011DC16A10E75008A3718 /* InfoPlist.strings */ = { 311 | isa = PBXVariantGroup; 312 | children = ( 313 | 113011DD16A10E75008A3718 /* en */, 314 | ); 315 | name = InfoPlist.strings; 316 | sourceTree = ""; 317 | }; 318 | 113011EB16A10E75008A3718 /* MainStoryboard.storyboard */ = { 319 | isa = PBXVariantGroup; 320 | children = ( 321 | 113011EC16A10E75008A3718 /* en */, 322 | ); 323 | name = MainStoryboard.storyboard; 324 | sourceTree = ""; 325 | }; 326 | 1130120016A10E75008A3718 /* InfoPlist.strings */ = { 327 | isa = PBXVariantGroup; 328 | children = ( 329 | 1130120116A10E75008A3718 /* en */, 330 | ); 331 | name = InfoPlist.strings; 332 | sourceTree = ""; 333 | }; 334 | /* End PBXVariantGroup section */ 335 | 336 | /* Begin XCBuildConfiguration section */ 337 | 1130120616A10E75008A3718 /* Debug */ = { 338 | isa = XCBuildConfiguration; 339 | buildSettings = { 340 | ALWAYS_SEARCH_USER_PATHS = NO; 341 | BUNDLE_ID = com.logicalparadox.apnagent; 342 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 343 | CLANG_CXX_LIBRARY = "libc++"; 344 | CLANG_ENABLE_OBJC_ARC = YES; 345 | CLANG_WARN_EMPTY_BODY = YES; 346 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 347 | CODE_SIGN_IDENTITY = "iPhone Developer"; 348 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 349 | COPY_PHASE_STRIP = NO; 350 | GCC_C_LANGUAGE_STANDARD = gnu99; 351 | GCC_DYNAMIC_NO_PIC = NO; 352 | GCC_OPTIMIZATION_LEVEL = 0; 353 | GCC_PREPROCESSOR_DEFINITIONS = ( 354 | "DEBUG=1", 355 | "$(inherited)", 356 | ); 357 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 358 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 359 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 360 | GCC_WARN_UNUSED_VARIABLE = YES; 361 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 362 | ONLY_ACTIVE_ARCH = YES; 363 | PROVISIONING_PROFILE = ""; 364 | "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; 365 | SDKROOT = iphoneos; 366 | }; 367 | name = Debug; 368 | }; 369 | 1130120716A10E75008A3718 /* Release */ = { 370 | isa = XCBuildConfiguration; 371 | buildSettings = { 372 | ALWAYS_SEARCH_USER_PATHS = NO; 373 | BUNDLE_ID = com.logicalparadox.apnagent; 374 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 375 | CLANG_CXX_LIBRARY = "libc++"; 376 | CLANG_ENABLE_OBJC_ARC = YES; 377 | CLANG_WARN_EMPTY_BODY = YES; 378 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 379 | CODE_SIGN_IDENTITY = "iPhone Developer"; 380 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 381 | COPY_PHASE_STRIP = YES; 382 | GCC_C_LANGUAGE_STANDARD = gnu99; 383 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 384 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 385 | GCC_WARN_UNUSED_VARIABLE = YES; 386 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 387 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 388 | PROVISIONING_PROFILE = ""; 389 | SDKROOT = iphoneos; 390 | VALIDATE_PRODUCT = YES; 391 | }; 392 | name = Release; 393 | }; 394 | 1130120916A10E75008A3718 /* Debug */ = { 395 | isa = XCBuildConfiguration; 396 | buildSettings = { 397 | BUNDLE_ID = com.logicalparadox.apnagent; 398 | CODE_SIGN_IDENTITY = "iPhone Developer"; 399 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 400 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 401 | GCC_PREFIX_HEADER = "apnagent/apnagent-Prefix.pch"; 402 | INFOPLIST_FILE = "apnagent/apnagent-Info.plist"; 403 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 404 | PRODUCT_NAME = "$(TARGET_NAME)"; 405 | PROVISIONING_PROFILE = ""; 406 | "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; 407 | WRAPPER_EXTENSION = app; 408 | }; 409 | name = Debug; 410 | }; 411 | 1130120A16A10E75008A3718 /* Release */ = { 412 | isa = XCBuildConfiguration; 413 | buildSettings = { 414 | BUNDLE_ID = com.logicalparadox.apnagent; 415 | CODE_SIGN_IDENTITY = "iPhone Developer"; 416 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 417 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 418 | GCC_PREFIX_HEADER = "apnagent/apnagent-Prefix.pch"; 419 | INFOPLIST_FILE = "apnagent/apnagent-Info.plist"; 420 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 421 | PRODUCT_NAME = "$(TARGET_NAME)"; 422 | PROVISIONING_PROFILE = ""; 423 | "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; 424 | WRAPPER_EXTENSION = app; 425 | }; 426 | name = Release; 427 | }; 428 | 1130120C16A10E75008A3718 /* Debug */ = { 429 | isa = XCBuildConfiguration; 430 | buildSettings = { 431 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/apnagent.app/apnagent"; 432 | FRAMEWORK_SEARCH_PATHS = ( 433 | "\"$(SDKROOT)/Developer/Library/Frameworks\"", 434 | "\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"", 435 | ); 436 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 437 | GCC_PREFIX_HEADER = "apnagent/apnagent-Prefix.pch"; 438 | INFOPLIST_FILE = "apnagentTests/apnagentTests-Info.plist"; 439 | PRODUCT_NAME = "$(TARGET_NAME)"; 440 | TEST_HOST = "$(BUNDLE_LOADER)"; 441 | WRAPPER_EXTENSION = octest; 442 | }; 443 | name = Debug; 444 | }; 445 | 1130120D16A10E75008A3718 /* Release */ = { 446 | isa = XCBuildConfiguration; 447 | buildSettings = { 448 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/apnagent.app/apnagent"; 449 | FRAMEWORK_SEARCH_PATHS = ( 450 | "\"$(SDKROOT)/Developer/Library/Frameworks\"", 451 | "\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"", 452 | ); 453 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 454 | GCC_PREFIX_HEADER = "apnagent/apnagent-Prefix.pch"; 455 | INFOPLIST_FILE = "apnagentTests/apnagentTests-Info.plist"; 456 | PRODUCT_NAME = "$(TARGET_NAME)"; 457 | TEST_HOST = "$(BUNDLE_LOADER)"; 458 | WRAPPER_EXTENSION = octest; 459 | }; 460 | name = Release; 461 | }; 462 | /* End XCBuildConfiguration section */ 463 | 464 | /* Begin XCConfigurationList section */ 465 | 113011C916A10E74008A3718 /* Build configuration list for PBXProject "apnagent" */ = { 466 | isa = XCConfigurationList; 467 | buildConfigurations = ( 468 | 1130120616A10E75008A3718 /* Debug */, 469 | 1130120716A10E75008A3718 /* Release */, 470 | ); 471 | defaultConfigurationIsVisible = 0; 472 | defaultConfigurationName = Release; 473 | }; 474 | 1130120816A10E75008A3718 /* Build configuration list for PBXNativeTarget "apnagent" */ = { 475 | isa = XCConfigurationList; 476 | buildConfigurations = ( 477 | 1130120916A10E75008A3718 /* Debug */, 478 | 1130120A16A10E75008A3718 /* Release */, 479 | ); 480 | defaultConfigurationIsVisible = 0; 481 | defaultConfigurationName = Release; 482 | }; 483 | 1130120B16A10E75008A3718 /* Build configuration list for PBXNativeTarget "apnagentTests" */ = { 484 | isa = XCConfigurationList; 485 | buildConfigurations = ( 486 | 1130120C16A10E75008A3718 /* Debug */, 487 | 1130120D16A10E75008A3718 /* Release */, 488 | ); 489 | defaultConfigurationIsVisible = 0; 490 | defaultConfigurationName = Release; 491 | }; 492 | /* End XCConfigurationList section */ 493 | }; 494 | rootObject = 113011C616A10E74008A3718 /* Project object */; 495 | } 496 | -------------------------------------------------------------------------------- /apnagent/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // apnagent 4 | // 5 | // Created by Jake Luer on 1/11/13. 6 | // Copyright (c) 2013 Jake Luer. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "apnListVC.h" 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (strong, nonatomic) UIWindow *window; 15 | 16 | @property (strong, nonatomic) apnListVC *pnListVC; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /apnagent/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // apnagent 4 | // 5 | // Created by Jake Luer on 1/11/13. 6 | // Copyright (c) 2013 Jake Luer. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "PushNotification.h" 11 | 12 | @implementation AppDelegate 13 | 14 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 15 | { 16 | // Reference to Push notifs List VC 17 | self.pnListVC = (apnListVC *)[[(UINavigationController *)self.window.rootViewController viewControllers] objectAtIndex:0]; 18 | 19 | // Let the device know we want to receive push notifications 20 | [[UIApplication sharedApplication] registerForRemoteNotificationTypes: 21 | (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)]; 22 | 23 | // Handle APN on Terminated state, app launched because of APN 24 | NSDictionary *payload = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]; 25 | if (payload) 26 | [self.pnListVC addPushNotifWithType:PushNotifTypeTM andUserInfo:payload]; 27 | 28 | return YES; 29 | } 30 | 31 | - (void)applicationWillResignActive:(UIApplication *)application 32 | { 33 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 34 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 35 | } 36 | 37 | - (void)applicationDidEnterBackground:(UIApplication *)application 38 | { 39 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 40 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 41 | } 42 | 43 | - (void)applicationWillEnterForeground:(UIApplication *)application 44 | { 45 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 46 | } 47 | 48 | - (void)applicationDidBecomeActive:(UIApplication *)application 49 | { 50 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 51 | } 52 | 53 | - (void)applicationWillTerminate:(UIApplication *)application 54 | { 55 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 56 | } 57 | 58 | - (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken 59 | { 60 | NSLog(@"My token is: %@", deviceToken); 61 | } 62 | 63 | - (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error 64 | { 65 | NSLog(@"Failed to get token, error: %@", error); 66 | } 67 | 68 | - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { 69 | // Detect if APN is received on Background or Foreground state 70 | if (application.applicationState == UIApplicationStateInactive) 71 | [self.pnListVC addPushNotifWithType:PushNotifTypeBG andUserInfo:userInfo]; 72 | else if (application.applicationState == UIApplicationStateActive) 73 | [self.pnListVC addPushNotifWithType:PushNotifTypeFG andUserInfo:userInfo]; 74 | } 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /apnagent/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/logicalparadox/apnagent-ios/39c6ca16f7d724b47c128ce9358ef8a7d8428dba/apnagent/Default-568h@2x.png -------------------------------------------------------------------------------- /apnagent/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/logicalparadox/apnagent-ios/39c6ca16f7d724b47c128ce9358ef8a7d8428dba/apnagent/Default.png -------------------------------------------------------------------------------- /apnagent/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/logicalparadox/apnagent-ios/39c6ca16f7d724b47c128ce9358ef8a7d8428dba/apnagent/Default@2x.png -------------------------------------------------------------------------------- /apnagent/PushNotification.h: -------------------------------------------------------------------------------- 1 | // 2 | // PushNotification.h 3 | // apnagent 4 | // 5 | // Created by George Paloukis on 18/2/13. 6 | // Copyright (c) 2013 Jake Luer. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /*! 12 | @typedef PushNotifType enum 13 | 14 | @abstract Push Notification Type: Indicates in what state was app when received it (Foreground, Background, Terminated) 15 | 16 | @discussion 17 | */ 18 | typedef enum PushNotifType { 19 | /*! App was on Foreground */ 20 | PushNotifTypeFG = 1, 21 | /*! App was on Background */ 22 | PushNotifTypeBG = 2, 23 | /*! App was terminated and launched again through Push notification */ 24 | PushNotifTypeTM = 3 25 | } PushNotifType; 26 | 27 | @interface PushNotification : NSObject 28 | 29 | @property (nonatomic) PushNotifType typeOfPN; 30 | @property (nonatomic) NSDictionary *theUserInfo; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /apnagent/PushNotification.m: -------------------------------------------------------------------------------- 1 | // 2 | // PushNotification.m 3 | // apnagent 4 | // 5 | // Created by George Paloukis on 18/2/13. 6 | // Copyright (c) 2013 Jake Luer. All rights reserved. 7 | // 8 | 9 | #import "PushNotification.h" 10 | 11 | @implementation PushNotification 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /apnagent/apnDetailsVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // apnDetailsVC.h 3 | // apnagent 4 | // 5 | // Created by George Paloukis on 26/3/13. 6 | // Copyright (c) 2013 Jake Luer. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "PushNotification.h" 11 | 12 | @interface apnDetailsVC : UIViewController 13 | 14 | @property (nonatomic) PushNotification *thePN; 15 | 16 | @property (weak, nonatomic) IBOutlet UITextView *payloadTxtView; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /apnagent/apnDetailsVC.m: -------------------------------------------------------------------------------- 1 | // 2 | // apnDetailsVC.m 3 | // apnagent 4 | // 5 | // Created by George Paloukis on 26/3/13. 6 | // Copyright (c) 2013 Jake Luer. All rights reserved. 7 | // 8 | 9 | #import "apnDetailsVC.h" 10 | 11 | @interface apnDetailsVC () 12 | 13 | @end 14 | 15 | @implementation apnDetailsVC 16 | 17 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 18 | { 19 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 20 | if (self) { 21 | // Custom initialization 22 | } 23 | return self; 24 | } 25 | 26 | - (void)viewDidLoad 27 | { 28 | [super viewDidLoad]; 29 | // Set payload details textView 30 | self.payloadTxtView.text = self.thePN.theUserInfo.description; 31 | } 32 | 33 | - (void)didReceiveMemoryWarning 34 | { 35 | [super didReceiveMemoryWarning]; 36 | // Dispose of any resources that can be recreated. 37 | } 38 | 39 | - (void)viewDidUnload { 40 | [self setPayloadTxtView:nil]; 41 | [super viewDidUnload]; 42 | } 43 | @end 44 | -------------------------------------------------------------------------------- /apnagent/apnListVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // apnListVC.h 3 | // apnagent 4 | // 5 | // Created by George Paloukis on 15/2/13. 6 | // Copyright (c) 2013 Jake Luer. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "PushNotification.h" 11 | 12 | @interface apnListVC : UITableViewController 13 | 14 | @property (nonatomic) NSMutableArray *pushNotifs; 15 | 16 | - (IBAction)resetBadge:(id)sender; 17 | 18 | - (void)addPushNotifWithType:(PushNotifType)pNType andUserInfo:(NSDictionary *)userInfo; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /apnagent/apnListVC.m: -------------------------------------------------------------------------------- 1 | // 2 | // apnListVC.m 3 | // apnagent 4 | // 5 | // Created by George Paloukis on 15/2/13. 6 | // Copyright (c) 2013 Jake Luer. All rights reserved. 7 | // 8 | 9 | #import "apnListVC.h" 10 | #import "apnDetailsVC.h" 11 | 12 | @interface apnListVC () 13 | 14 | @property (nonatomic) PushNotification *selectedAPN; 15 | 16 | @end 17 | 18 | @implementation apnListVC 19 | 20 | - (id)initWithStyle:(UITableViewStyle)style 21 | { 22 | self = [super initWithStyle:style]; 23 | if (self) { 24 | // Custom initialization 25 | } 26 | return self; 27 | } 28 | 29 | - (void)viewDidLoad 30 | { 31 | [super viewDidLoad]; 32 | 33 | // Initialize Data Source: pushNotifs; 34 | if (!self.pushNotifs) 35 | self.pushNotifs = [NSMutableArray arrayWithCapacity:5]; 36 | 37 | // Uncomment the following line to preserve selection between presentations. 38 | // self.clearsSelectionOnViewWillAppear = NO; 39 | 40 | // Uncomment the following line to display an Edit button in the navigation bar for this view controller. 41 | // self.navigationItem.rightBarButtonItem = self.editButtonItem; 42 | } 43 | 44 | - (void)viewDidAppear:(BOOL)animated { 45 | [self.tableView reloadData]; 46 | } 47 | 48 | - (void)didReceiveMemoryWarning 49 | { 50 | [super didReceiveMemoryWarning]; 51 | // Dispose of any resources that can be recreated. 52 | } 53 | 54 | #pragma mark - Table view data source 55 | 56 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 57 | { 58 | // Return the number of sections. 59 | return 1; 60 | } 61 | 62 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 63 | { 64 | // Return the number of rows in the section. 65 | return self.pushNotifs.count; 66 | } 67 | 68 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 69 | { 70 | static NSString *CellIdentifier = @"pushNotifCell"; 71 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; 72 | 73 | // Configure the cell 74 | PushNotification *pushNotif = [self.pushNotifs objectAtIndex:indexPath.row]; 75 | 76 | // Alert message 77 | UILabel *label; 78 | label = (UILabel *)[cell viewWithTag:1]; 79 | if ([[pushNotif.theUserInfo objectForKey:@"aps"] objectForKey:@"alert"]) { 80 | id theAlert = [[pushNotif.theUserInfo objectForKey:@"aps"] objectForKey:@"alert"]; 81 | // Check if alert is just a string 82 | if ([theAlert isKindOfClass:[NSString class]]) 83 | label.text = (NSString *)theAlert; 84 | else if ([theAlert isKindOfClass:[NSDictionary class]] && [(NSDictionary *)theAlert objectForKey:@"body"]) 85 | label.text = [(NSDictionary *)theAlert objectForKey:@"body"]; 86 | } 87 | 88 | // Push notif Type 89 | label = (UILabel *)[cell viewWithTag:2]; 90 | switch (pushNotif.typeOfPN) { 91 | case PushNotifTypeBG: 92 | label.text = @"Background"; 93 | break; 94 | 95 | case PushNotifTypeFG: 96 | label.text = @"Foreground"; 97 | break; 98 | 99 | case PushNotifTypeTM: 100 | label.text = @"Terminated"; 101 | break; 102 | 103 | default: 104 | break; 105 | } 106 | 107 | // Badge number 108 | label = (UILabel *)[cell viewWithTag:3]; 109 | if ([[pushNotif.theUserInfo objectForKey:@"aps"] objectForKey:@"badge"]) { 110 | label.text = [NSString stringWithFormat:@"%@", [[pushNotif.theUserInfo objectForKey:@"aps"] objectForKey:@"badge"]]; 111 | } 112 | 113 | // Sound or not 114 | label = (UILabel *)[cell viewWithTag:4]; 115 | if ([[pushNotif.theUserInfo objectForKey:@"aps"] objectForKey:@"sound"]) { 116 | label.alpha = 1.0; 117 | } 118 | 119 | return cell; 120 | } 121 | 122 | /* 123 | // Override to support conditional editing of the table view. 124 | - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath 125 | { 126 | // Return NO if you do not want the specified item to be editable. 127 | return YES; 128 | } 129 | */ 130 | 131 | /* 132 | // Override to support editing the table view. 133 | - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath 134 | { 135 | if (editingStyle == UITableViewCellEditingStyleDelete) { 136 | // Delete the row from the data source 137 | [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; 138 | } 139 | else if (editingStyle == UITableViewCellEditingStyleInsert) { 140 | // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view 141 | } 142 | } 143 | */ 144 | 145 | /* 146 | // Override to support rearranging the table view. 147 | - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath 148 | { 149 | } 150 | */ 151 | 152 | /* 153 | // Override to support conditional rearranging of the table view. 154 | - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath 155 | { 156 | // Return NO if you do not want the item to be re-orderable. 157 | return YES; 158 | } 159 | */ 160 | 161 | #pragma mark - Table view delegate 162 | - (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath { 163 | // Set the selected Room 164 | self.selectedAPN = [self.pushNotifs objectAtIndex:indexPath.row]; 165 | 166 | return indexPath; 167 | } 168 | 169 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 170 | { 171 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 172 | } 173 | 174 | // Reset application's badge number 175 | - (IBAction)resetBadge:(id)sender { 176 | [UIApplication sharedApplication].applicationIconBadgeNumber = 0; 177 | } 178 | 179 | - (void)addPushNotifWithType:(PushNotifType)pNType andUserInfo:(NSDictionary *)userInfo { 180 | PushNotification *aPushNotif = [[PushNotification alloc] init]; 181 | 182 | aPushNotif.typeOfPN = pNType; 183 | aPushNotif.theUserInfo = userInfo; 184 | 185 | if (!self.pushNotifs) 186 | self.pushNotifs = [NSMutableArray arrayWithCapacity:5]; 187 | [self.pushNotifs addObject:aPushNotif]; 188 | [self.tableView reloadData]; 189 | 190 | NSLog(@"Push Notification added, Type: %d, PushArray count: %d, UserInfo: %@", aPushNotif.typeOfPN, self.pushNotifs.count, aPushNotif.theUserInfo); 191 | } 192 | 193 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 194 | { 195 | if ([segue.identifier isEqualToString:@"ShowPayloadDetailsView"]) { 196 | apnDetailsVC *detailsVC = (apnDetailsVC *)segue.destinationViewController; 197 | detailsVC.thePN = self.selectedAPN; 198 | } 199 | } 200 | 201 | @end 202 | -------------------------------------------------------------------------------- /apnagent/apnagent-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | ${BUNDLE_ID} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.2.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.2.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | MainStoryboard 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /apnagent/apnagent-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'apnagent' target in the 'apnagent' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_5_0 8 | #warning "This project uses features only available in iOS SDK 5.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /apnagent/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /apnagent/en.lproj/MainStoryboard.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 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 50 | 59 | 67 | 74 | 81 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | -------------------------------------------------------------------------------- /apnagent/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // apnagent 4 | // 5 | // Created by Jake Luer on 1/11/13. 6 | // Copyright (c) 2013 Jake Luer. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /apnagentTests/apnagentTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${BUNDLE_ID} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /apnagentTests/apnagentTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // apnagentTests.h 3 | // apnagentTests 4 | // 5 | // Created by Jake Luer on 1/11/13. 6 | // Copyright (c) 2013 Jake Luer. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface apnagentTests : SenTestCase 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /apnagentTests/apnagentTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // apnagentTests.m 3 | // apnagentTests 4 | // 5 | // Created by Jake Luer on 1/11/13. 6 | // Copyright (c) 2013 Jake Luer. All rights reserved. 7 | // 8 | 9 | #import "apnagentTests.h" 10 | 11 | @implementation apnagentTests 12 | 13 | - (void)setUp 14 | { 15 | [super setUp]; 16 | 17 | // Set-up code here. 18 | } 19 | 20 | - (void)tearDown 21 | { 22 | // Tear-down code here. 23 | 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample 28 | { 29 | STFail(@"Unit tests are not implemented yet in apnagentTests"); 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /apnagentTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/logicalparadox/apnagent-ios/39c6ca16f7d724b47c128ce9358ef8a7d8428dba/screenshot.png --------------------------------------------------------------------------------