UA Remote Notification implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://github.com/CocoaPods/Specs.git' | |
platform :ios, '8.0' | |
use_frameworks! | |
inhibit_all_warnings! | |
target :Hepburn do | |
inherit! :search_paths | |
pod 'AFNetworking', '~> 3.1' | |
pod 'FastImageCache', '~> 1.2' | |
pod 'PonyDebugger', '~> 0.4.3' | |
pod 'FLEX', '~> 2.0.3' | |
pod 'SVPullToRefresh' | |
pod 'TTTAttributedLabel', '~> 1.9.5' | |
pod 'Stripe', '~> 8.0' | |
pod 'GoogleMaps', '~> 1.13.2' | |
pod 'FBSDKLoginKit', '~> 4' | |
pod 'SDVersion', '~> 3.6' | |
pod 'ZDCChat', '~> 1.3.2.1' | |
pod 'AppsFlyerFramework', '~> 4.5' | |
pod 'ReactiveObjC', '~> 2.1.2' | |
pod 'SimulatorRemoteNotifications', '~> 0.0.3' | |
pod 'UXCam' | |
pod 'UrbanAirship-iOS-SDK' | |
target :UnitTests do | |
pod 'OHHTTPStubs', '~> 3.0.4' | |
pod 'OCMock', '~> 3.2' | |
end | |
end | |
# Added on 11/01/2016 | |
# Remove string resources provided by the ZDCChat Pod to use our customized strings | |
ZENDESK_TRANSLATED_LOCALE = ['en', 'en-GB'] | |
post_install do |installer| | |
installer.pods_project.targets.each do |target| | |
target.build_configurations.each do |config| | |
preprocessor_definitions = config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] | |
preprocessor_definitions = ['$(inherited)'] if preprocessor_definitions == nil | |
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = preprocessor_definitions | |
end | |
end | |
# Added on 11/01/2016 | |
ZENDESK_TRANSLATED_LOCALE.each do |locale| | |
FileUtils.rm_rf File.join("Pods", "ZDCChat", "ZDCChatStrings.bundle", "#{locale}.lproj") | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES | |
ENABLE_NS_ASSERTIONS = YES | |
FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PODS_ROOT)/UXCam" $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/AFNetworking" "$PODS_CONFIGURATION_BUILD_DIR/Bolts" "$PODS_CONFIGURATION_BUILD_DIR/FBSDKCoreKit" "$PODS_CONFIGURATION_BUILD_DIR/FBSDKLoginKit" "$PODS_CONFIGURATION_BUILD_DIR/FLEX" "$PODS_CONFIGURATION_BUILD_DIR/FastImageCache" "$PODS_CONFIGURATION_BUILD_DIR/PonyDebugger" "$PODS_CONFIGURATION_BUILD_DIR/ReactiveObjC" "$PODS_CONFIGURATION_BUILD_DIR/SDVersion" "$PODS_CONFIGURATION_BUILD_DIR/SVPullToRefresh" "$PODS_CONFIGURATION_BUILD_DIR/SimulatorRemoteNotifications" "$PODS_CONFIGURATION_BUILD_DIR/SocketRocket" "$PODS_CONFIGURATION_BUILD_DIR/Stripe" "$PODS_CONFIGURATION_BUILD_DIR/TTTAttributedLabel" "$PODS_CONFIGURATION_BUILD_DIR/UrbanAirship-iOS-SDK" "${PODS_ROOT}/AppsFlyerFramework" "${PODS_ROOT}/GoogleMaps/Frameworks" "${PODS_ROOT}/UXCam" "${PODS_ROOT}/ZDCChat" | |
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 | |
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AppsFlyerFramework" "${PODS_ROOT}/Headers/Public/GoogleMaps" "${PODS_ROOT}/Headers/Public/UXCam" "${PODS_ROOT}/Headers/Public/ZDCChat" | |
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' | |
OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/AFNetworking/AFNetworking.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Bolts/Bolts.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/FBSDKCoreKit/FBSDKCoreKit.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/FBSDKLoginKit/FBSDKLoginKit.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/FLEX/FLEX.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/FastImageCache/FastImageCache.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/PonyDebugger/PonyDebugger.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/ReactiveObjC/ReactiveObjC.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/SDVersion/SDVersion.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/SVPullToRefresh/SVPullToRefresh.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/SimulatorRemoteNotifications/SimulatorRemoteNotifications.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/SocketRocket/SocketRocket.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Stripe/Stripe.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/TTTAttributedLabel/TTTAttributedLabel.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/UrbanAirship-iOS-SDK/AirshipKit.framework/Headers" -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AppsFlyerFramework" -isystem "${PODS_ROOT}/Headers/Public/GoogleMaps" -isystem "${PODS_ROOT}/Headers/Public/UXCam" -isystem "${PODS_ROOT}/Headers/Public/ZDCChat" | |
OTHER_LDFLAGS = $(inherited) -ObjC -l"ObjC" -l"c++" -l"icucore" -l"z" -framework "AFNetworking" -framework "AVFoundation" -framework "Accelerate" -framework "AdSupport" -framework "AirshipKit" -framework "AppsFlyerLib" -framework "AssetsLibrary" -framework "Bolts" -framework "CoreBluetooth" -framework "CoreData" -framework "CoreGraphics" -framework "CoreLocation" -framework "CoreMedia" -framework "CoreText" -framework "CoreVideo" -framework "FBSDKCoreKit" -framework "FBSDKLoginKit" -framework "FLEX" -framework "FastImageCache" -framework "GLKit" -framework "GoogleMaps" -framework "ImageIO" -framework "MobileCoreServices" -framework "OpenGLES" -framework "PonyDebugger" -framework "QuartzCore" -framework "ReactiveObjC" -framework "SDVersion" -framework "SVPullToRefresh" -framework "Security" -framework "SimulatorRemoteNotifications" -framework "SocketRocket" -framework "Stripe" -framework "SystemConfiguration" -framework "TTTAttributedLabel" -framework "UXCam" -framework "ZDCChat" -framework "ZDCChatAPI" -framework "iAd" | |
PODS_BUILD_DIR = $BUILD_DIR | |
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) | |
PODS_PODFILE_DIR_PATH = ${SRCROOT}/. | |
PODS_ROOT = ${SRCROOT}/Pods |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// UARemoteNotificationHandler.swift | |
// Hepburn | |
// | |
// Created by Charles on 6/19/17. | |
// Copyright © 2017 TaskRabbit. All rights reserved. | |
// | |
import Foundation | |
import AirshipKit | |
@objc(TRUARemoteNotificationHandler) | |
class RemoteNotificationHandler: NSObject, UAPushNotificationDelegate { | |
func receivedBackgroundNotification(_ notificationContent: UANotificationContent, completionHandler: @escaping (UIBackgroundFetchResult) -> Swift.Void) { | |
// Application received a background notification | |
NSLog("receivedBackgroundNotification"); | |
// Call the completion handler | |
completionHandler(.noData) | |
} | |
func receivedForegroundNotification(_ notificationContent: UANotificationContent, completionHandler: @escaping () -> Swift.Void) { | |
// Application received a foreground notification | |
NSLog("receivedForegroundNotification"); | |
// iOS 10 - let foreground presentations options handle it | |
/* | |
if (ProcessInfo().isOperatingSystemAtLeast(OperatingSystemVersion(majorVersion: 10, minorVersion: 0, patchVersion: 0))) { | |
NSLog("Handled by iOS 10"); | |
completionHandler() | |
return | |
} | |
*/ | |
// iOS 8 & 9 - handle notification | |
TRLaunchPad.sharedInstance().didReceiveRemoteNotification(notificationContent.notificationInfo) | |
completionHandler() | |
} | |
func receivedNotificationResponse(_ notificationResponse: UANotificationResponse, completionHandler: @escaping () -> Swift.Void) { | |
NSLog("receivedNotificationResponse identifier:\n\(notificationResponse.actionIdentifier)") | |
let alertController = UIAlertController(title: "DEBUG Notif Response", message: "Action id:\n\(notificationResponse.actionIdentifier)", preferredStyle: .alert) | |
let defaultAction = UIAlertAction(title:"Discard", style: UIAlertActionStyle.default) | |
alertController.addAction(defaultAction) | |
UIApplication.shared.keyWindow?.rootViewController?.present(alertController, animated: true, completion: nil) | |
completionHandler() | |
} | |
@available(iOS 10.0, *) | |
func presentationOptions(for notification: UNNotification) -> UNNotificationPresentationOptions { | |
// return [.badge, .alert, .sound] | |
return [.sound] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment