![]() |
Ignite Tools
|
00001 /* 00002 Copyright 2009-2011 Urban Airship Inc. All rights reserved. 00003 00004 Redistribution and use in source and binary forms, with or without 00005 modification, are permitted provided that the following conditions are met: 00006 00007 1. Redistributions of source code must retain the above copyright notice, this 00008 list of conditions and the following disclaimer. 00009 00010 2. Redistributions in binaryform must reproduce the above copyright notice, 00011 this list of conditions and the following disclaimer in the documentation 00012 and/or other materials provided withthe distribution. 00013 00014 THIS SOFTWARE IS PROVIDED BY THE URBAN AIRSHIP INC``AS IS'' AND ANY EXPRESS OR 00015 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00016 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 00017 EVENT SHALL URBAN AIRSHIP INC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 00018 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00019 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00020 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00021 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 00022 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 00023 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00024 */ 00025 00026 #import "UAGlobal.h" 00027 #import "UAObservable.h" 00028 #import "UAAnalytics.h" 00029 00030 UA_VERSION_INTERFACE(AirshipVersion) 00031 00032 extern NSString * const UAirshipTakeOffOptionsAirshipConfigKey; 00033 extern NSString * const UAirshipTakeOffOptionsLaunchOptionsKey; 00034 extern NSString * const UAirshipTakeOffOptionsAnalyticsKey; 00035 extern NSString * const UAirshipTakeOffOptionsDefaultUsernameKey; 00036 extern NSString * const UAirshipTakeOffOptionsDefaultPasswordKey; 00037 00038 @class UA_ASIHTTPRequest; 00039 00040 @protocol UARegistrationObserver 00041 @optional 00042 - (void)registerDeviceTokenSucceeded; 00043 - (void)registerDeviceTokenFailed:(UA_ASIHTTPRequest *)request; 00044 - (void)unRegisterDeviceTokenSucceeded; 00045 - (void)unRegisterDeviceTokenFailed:(UA_ASIHTTPRequest *)request; 00046 - (void)addTagToDeviceSucceeded; 00047 - (void)addTagToDeviceFailed:(UA_ASIHTTPRequest *)request; 00048 - (void)removeTagFromDeviceSucceeded; 00049 - (void)removeTagFromDeviceFailed:(UA_ASIHTTPRequest *)request; 00050 @end 00051 00052 00053 @interface UAirship : UAObservable { 00054 NSString *server; 00055 NSString *appId; 00056 NSString *appSecret; 00057 00058 NSString *deviceToken; 00059 NSString *deviceAlias; 00060 BOOL deviceTokenHasChanged; 00061 BOOL ready; 00062 00063 UA_ASIHTTPRequest *registerRequest; 00064 } 00065 00066 @property (nonatomic, retain) NSString *deviceToken; 00067 @property (nonatomic, retain) UAAnalytics *analytics; 00068 00069 @property (retain) NSString *server; 00070 @property (retain) NSString *appId; 00071 @property (retain) NSString *appSecret; 00072 @property (assign) BOOL deviceTokenHasChanged; 00073 @property (assign) BOOL ready; 00074 00075 // Lifecycle 00076 + (UAirship *)shared; 00077 + (void)setLogging:(BOOL)value; 00078 + (void)takeOff:(NSDictionary *)options; 00079 + (void)land; 00080 00081 // callback for succeed register APN device token 00082 - (void)registerDeviceToken:(NSData *)token; 00083 00084 // Register DeviceToken to UA 00085 - (void)registerDeviceTokenWithExtraInfo:(NSDictionary *)info; 00086 - (void)registerDeviceToken:(NSData *)token withAlias:(NSString *)alias; 00087 - (void)registerDeviceToken:(NSData *)token withExtraInfo:(NSDictionary *)info; 00088 - (void)unRegisterDeviceToken; 00089 00090 // Update device token without remote registration 00091 - (void)updateDeviceToken:(NSData *)token; 00092 00093 @end