diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2019-03-21 12:49:10 -0400 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2019-03-21 12:49:10 -0400 |
commit | 54d0f394ad758258d7799c6795f7c2f59cb73f3d (patch) | |
tree | 5a59a44cae9c7df571159c8db23cd6e2079f5f92 | |
parent | 8cdf2140dae5388444f699e7b46d96dfd5321494 (diff) | |
download | sdl_ios-54d0f394ad758258d7799c6795f7c2f59cb73f3d.tar.gz |
API cleanup
-rw-r--r-- | SmartDeviceLink/SDLAppServiceData.h | 13 | ||||
-rw-r--r-- | SmartDeviceLink/SDLAppServiceData.m | 16 | ||||
-rw-r--r-- | SmartDeviceLink/SDLAppServiceManifest.h | 12 | ||||
-rw-r--r-- | SmartDeviceLink/SDLAppServiceManifest.m | 10 | ||||
-rw-r--r-- | SmartDeviceLink/SDLGetAppServiceData.h | 19 | ||||
-rw-r--r-- | SmartDeviceLink/SDLGetAppServiceData.m | 14 | ||||
-rw-r--r-- | SmartDeviceLink/SDLManager.h | 5 | ||||
-rw-r--r-- | SmartDeviceLink/SDLManager.m | 4 |
8 files changed, 25 insertions, 68 deletions
diff --git a/SmartDeviceLink/SDLAppServiceData.h b/SmartDeviceLink/SDLAppServiceData.h index ff6d487f5..7e6a96d4c 100644 --- a/SmartDeviceLink/SDLAppServiceData.h +++ b/SmartDeviceLink/SDLAppServiceData.h @@ -23,22 +23,13 @@ NS_ASSUME_NONNULL_BEGIN @interface SDLAppServiceData : SDLRPCStruct /** - * Convenience init for required parameters. - * - * @param serviceType The type of service that is to be offered by this app. - * @param serviceId A unique ID tied to this specific service record. - * @return A SDLAppServiceData object - */ -- (instancetype)initWithServiceType:(NSString *)serviceType serviceId:(NSString *)serviceId NS_DESIGNATED_INITIALIZER; - -/** * Convenience init for service type and service id. * * @param serviceType The type of service that is to be offered by this app. * @param serviceId A unique ID tied to this specific service record. * @return A SDLAppServiceData object */ -- (instancetype)initWithAppServiceType:(SDLAppServiceType)serviceType serviceId:(NSString *)serviceId; +- (instancetype)initWithAppServiceType:(SDLAppServiceType)serviceType serviceId:(NSString *)serviceId NS_DESIGNATED_INITIALIZER; /** * Convenience init for media service data. @@ -77,7 +68,7 @@ NS_ASSUME_NONNULL_BEGIN * @param navigationServiceData The navigation service data * @return A SDLAppServiceData object */ -- (instancetype)initWithServiceType:(NSString *)serviceType serviceId:(NSString *)serviceId mediaServiceData:(nullable SDLMediaServiceData *)mediaServiceData weatherServiceData:(nullable SDLWeatherServiceData *)weatherServiceData navigationServiceData:(nullable SDLNavigationServiceData *)navigationServiceData; +- (instancetype)initWithAppServiceType:(SDLAppServiceType)serviceType serviceId:(NSString *)serviceId mediaServiceData:(nullable SDLMediaServiceData *)mediaServiceData weatherServiceData:(nullable SDLWeatherServiceData *)weatherServiceData navigationServiceData:(nullable SDLNavigationServiceData *)navigationServiceData; /** * The type of service that is to be offered by this app. See `AppServiceType` for known enum equivalent types. Parameter is a string to allow for new service types to be used by apps on older versions of SDL Core. diff --git a/SmartDeviceLink/SDLAppServiceData.m b/SmartDeviceLink/SDLAppServiceData.m index 8453278ff..37771ebd2 100644 --- a/SmartDeviceLink/SDLAppServiceData.m +++ b/SmartDeviceLink/SDLAppServiceData.m @@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN @implementation SDLAppServiceData -- (instancetype)initWithServiceType:(NSString *)serviceType serviceId:(NSString *)serviceId { +- (instancetype)initWithAppServiceType:(SDLAppServiceType)serviceType serviceId:(NSString *)serviceId { self = [super init]; if (!self) { return nil; @@ -31,12 +31,8 @@ NS_ASSUME_NONNULL_BEGIN return self; } -- (instancetype)initWithAppServiceType:(SDLAppServiceType)serviceType serviceId:(NSString *)serviceId { - return [self initWithServiceType:serviceType serviceId:serviceId]; -} - - (instancetype)initWithMediaServiceData:(SDLMediaServiceData *)mediaServiceData serviceId:(NSString *)serviceId { - self = [self initWithServiceType:SDLAppServiceTypeMedia serviceId:serviceId]; + self = [self initWithAppServiceType:SDLAppServiceTypeMedia serviceId:serviceId]; if (!self) { return nil; } @@ -47,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN } - (instancetype)initWithWeatherServiceData:(SDLWeatherServiceData *)weatherServiceData serviceId:(NSString *)serviceId { - self = [self initWithServiceType:SDLAppServiceTypeWeather serviceId:serviceId]; + self = [self initWithAppServiceType:SDLAppServiceTypeWeather serviceId:serviceId]; if (!self) { return nil; } @@ -58,7 +54,7 @@ NS_ASSUME_NONNULL_BEGIN } - (instancetype)initWithNavigationServiceData:(SDLNavigationServiceData *)navigationServiceData serviceId:(NSString *)serviceId { - self = [self initWithServiceType:SDLAppServiceTypeNavigation serviceId:serviceId]; + self = [self initWithAppServiceType:SDLAppServiceTypeNavigation serviceId:serviceId]; if (!self) { return nil; } @@ -68,8 +64,8 @@ NS_ASSUME_NONNULL_BEGIN return self; } -- (instancetype)initWithServiceType:(NSString *)serviceType serviceId:(NSString *)serviceId mediaServiceData:(nullable SDLMediaServiceData *)mediaServiceData weatherServiceData:(nullable SDLWeatherServiceData *)weatherServiceData navigationServiceData:(nullable SDLNavigationServiceData *)navigationServiceData { - self = [self initWithServiceType:serviceType serviceId:serviceId]; +- (instancetype)initWithAppServiceType:(SDLAppServiceType)serviceType serviceId:(NSString *)serviceId mediaServiceData:(nullable SDLMediaServiceData *)mediaServiceData weatherServiceData:(nullable SDLWeatherServiceData *)weatherServiceData navigationServiceData:(nullable SDLNavigationServiceData *)navigationServiceData { + self = [self initWithAppServiceType:serviceType serviceId:serviceId]; if (!self) { return nil; } diff --git a/SmartDeviceLink/SDLAppServiceManifest.h b/SmartDeviceLink/SDLAppServiceManifest.h index dcdbd2138..4622418e1 100644 --- a/SmartDeviceLink/SDLAppServiceManifest.h +++ b/SmartDeviceLink/SDLAppServiceManifest.h @@ -26,20 +26,12 @@ NS_ASSUME_NONNULL_BEGIN @interface SDLAppServiceManifest : SDLRPCStruct /** - * Convenience init for required parameters only. - * - * @param serviceType The type of service that is to be offered by this app. - * @return A SDLAppServiceManifest object - */ -- (instancetype)initWithServiceType:(NSString *)serviceType NS_DESIGNATED_INITIALIZER; - -/** * Convenience init for serviceType. * * @param serviceType The type of service that is to be offered by this app * @return A SDLAppServiceManifest object */ -- (instancetype)initWithAppServiceType:(SDLAppServiceType)serviceType; +- (instancetype)initWithAppServiceType:(SDLAppServiceType)serviceType NS_DESIGNATED_INITIALIZER; /** * Convenience init for a media service manifest. @@ -94,7 +86,7 @@ NS_ASSUME_NONNULL_BEGIN * @param navigationServiceManifest A navigation service manifest * @return A SDLAppServiceManifest object */ -- (instancetype)initWithServiceName:(nullable NSString *)serviceName serviceType:(NSString *)serviceType serviceIcon:(nullable SDLImage *)serviceIcon allowAppConsumers:(BOOL)allowAppConsumers rpcSpecVersion:(nullable SDLSyncMsgVersion *)rpcSpecVersion handledRPCs:(nullable NSArray<NSNumber<SDLInt> *> *)handledRPCs mediaServiceManifest:(nullable SDLMediaServiceManifest *)mediaServiceManifest weatherServiceManifest:(nullable SDLWeatherServiceManifest *)weatherServiceManifest navigationServiceManifest:(nullable SDLNavigationServiceManifest *)navigationServiceManifest; +- (instancetype)initWithServiceName:(nullable NSString *)serviceName serviceType:(SDLAppServiceType)serviceType serviceIcon:(nullable SDLImage *)serviceIcon allowAppConsumers:(BOOL)allowAppConsumers rpcSpecVersion:(nullable SDLSyncMsgVersion *)rpcSpecVersion handledRPCs:(nullable NSArray<NSNumber<SDLInt> *> *)handledRPCs mediaServiceManifest:(nullable SDLMediaServiceManifest *)mediaServiceManifest weatherServiceManifest:(nullable SDLWeatherServiceManifest *)weatherServiceManifest navigationServiceManifest:(nullable SDLNavigationServiceManifest *)navigationServiceManifest; /** * Unique name of this service. diff --git a/SmartDeviceLink/SDLAppServiceManifest.m b/SmartDeviceLink/SDLAppServiceManifest.m index a92470c36..ba1e531d2 100644 --- a/SmartDeviceLink/SDLAppServiceManifest.m +++ b/SmartDeviceLink/SDLAppServiceManifest.m @@ -21,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN @implementation SDLAppServiceManifest -- (instancetype)initWithServiceType:(NSString *)serviceType { +- (instancetype)initWithAppServiceType:(SDLAppServiceType)serviceType { self = [super init]; if (!self) { return self; @@ -32,10 +32,6 @@ NS_ASSUME_NONNULL_BEGIN return self; } -- (instancetype)initWithAppServiceType:(SDLAppServiceType)serviceType { - return [self initWithServiceType:serviceType]; -} - - (instancetype)initWithMediaServiceName:(nullable NSString *)serviceName serviceIcon:(nullable SDLImage *)serviceIcon allowAppConsumers:(BOOL)allowAppConsumers rpcSpecVersion:(nullable SDLSyncMsgVersion *)rpcSpecVersion handledRPCs:(nullable NSArray<NSNumber<SDLInt> *> *)handledRPCs mediaServiceManifest:(nullable SDLMediaServiceManifest *)mediaServiceManifest { return [self initWithServiceName:serviceName serviceType:SDLAppServiceTypeMedia serviceIcon:serviceIcon allowAppConsumers:allowAppConsumers rpcSpecVersion:rpcSpecVersion handledRPCs:handledRPCs mediaServiceManifest:mediaServiceManifest weatherServiceManifest:nil navigationServiceManifest:nil]; } @@ -48,8 +44,8 @@ NS_ASSUME_NONNULL_BEGIN return [self initWithServiceName:serviceName serviceType:SDLAppServiceTypeNavigation serviceIcon:serviceIcon allowAppConsumers:allowAppConsumers rpcSpecVersion:rpcSpecVersion handledRPCs:handledRPCs mediaServiceManifest:nil weatherServiceManifest:nil navigationServiceManifest:navigationServiceManifest]; } -- (instancetype)initWithServiceName:(nullable NSString *)serviceName serviceType:(NSString *)serviceType serviceIcon:(nullable SDLImage *)serviceIcon allowAppConsumers:(BOOL)allowAppConsumers rpcSpecVersion:(nullable SDLSyncMsgVersion *)rpcSpecVersion handledRPCs:(nullable NSArray<NSNumber<SDLInt> *> *)handledRPCs mediaServiceManifest:(nullable SDLMediaServiceManifest *)mediaServiceManifest weatherServiceManifest:(nullable SDLWeatherServiceManifest *)weatherServiceManifest navigationServiceManifest:(nullable SDLNavigationServiceManifest *)navigationServiceManifest { - self = [self initWithServiceType:serviceType]; +- (instancetype)initWithServiceName:(nullable NSString *)serviceName serviceType:(SDLAppServiceType)serviceType serviceIcon:(nullable SDLImage *)serviceIcon allowAppConsumers:(BOOL)allowAppConsumers rpcSpecVersion:(nullable SDLSyncMsgVersion *)rpcSpecVersion handledRPCs:(nullable NSArray<NSNumber<SDLInt> *> *)handledRPCs mediaServiceManifest:(nullable SDLMediaServiceManifest *)mediaServiceManifest weatherServiceManifest:(nullable SDLWeatherServiceManifest *)weatherServiceManifest navigationServiceManifest:(nullable SDLNavigationServiceManifest *)navigationServiceManifest { + self = [self initWithAppServiceType:serviceType]; if (!self) { return self; } diff --git a/SmartDeviceLink/SDLGetAppServiceData.h b/SmartDeviceLink/SDLGetAppServiceData.h index 78ceee436..e1882a350 100644 --- a/SmartDeviceLink/SDLGetAppServiceData.h +++ b/SmartDeviceLink/SDLGetAppServiceData.h @@ -19,14 +19,6 @@ NS_ASSUME_NONNULL_BEGIN @interface SDLGetAppServiceData : SDLRPCRequest /** - * Convenience init for required parameters. - * - * @param serviceType The app service type - * @return A SDLGetAppServiceData object - */ -- (instancetype)initWithServiceType:(NSString *)serviceType; - -/** * Convenience init for service type. * * @param serviceType The app service type @@ -43,13 +35,12 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initAndSubscribeToAppServiceType:(SDLAppServiceType)serviceType; /** - * Convenience init for all parameters. - * - * @param serviceType The app service type - * @param subscribe Whether or not to subcribe to updates - * @return A SDLGetAppServiceData object + Convenience init for unsubscribing to a service type + + @param serviceType The app service type + @return A SDLGetAppServiceData object */ -- (instancetype)initWithServiceType:(NSString *)serviceType subscribe:(BOOL)subscribe; +- (instancetype)initAndUnsubscribeToAppServiceType:(SDLAppServiceType)serviceType; /** * The type of service that is to be offered by this app. See `AppServiceType` for known enum equivalent types. Parameter is a string to allow for new service types to be used by apps on older versions of SDL Core. diff --git a/SmartDeviceLink/SDLGetAppServiceData.m b/SmartDeviceLink/SDLGetAppServiceData.m index 0122fb088..3f5c87552 100644 --- a/SmartDeviceLink/SDLGetAppServiceData.m +++ b/SmartDeviceLink/SDLGetAppServiceData.m @@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN return self; } -- (instancetype)initWithServiceType:(NSString *)serviceType { +- (instancetype)initWithAppServiceType:(SDLAppServiceType)serviceType { self = [self init]; if (!self) { return nil; @@ -33,16 +33,16 @@ NS_ASSUME_NONNULL_BEGIN return self; } -- (instancetype)initWithAppServiceType:(SDLAppServiceType)serviceType { - return [self initWithServiceType:serviceType]; -} - - (instancetype)initAndSubscribeToAppServiceType:(SDLAppServiceType)serviceType { return [self initWithServiceType:serviceType subscribe:YES]; } -- (instancetype)initWithServiceType:(NSString *)serviceType subscribe:(BOOL)subscribe { - self = [self initWithServiceType:serviceType]; +- (instancetype)initAndUnsubscribeToAppServiceType:(SDLAppServiceType)serviceType { + return [self initWithServiceType:serviceType subscribe:NO]; +} + +- (instancetype)initWithServiceType:(SDLAppServiceType)serviceType subscribe:(BOOL)subscribe { + self = [self initWithAppServiceType:serviceType]; if (!self) { return nil; } diff --git a/SmartDeviceLink/SDLManager.h b/SmartDeviceLink/SDLManager.h index 91aece5e5..b0a0fbe08 100644 --- a/SmartDeviceLink/SDLManager.h +++ b/SmartDeviceLink/SDLManager.h @@ -85,11 +85,6 @@ typedef void (^SDLManagerReadyBlock)(BOOL success, NSError *_Nullable error); @property (strong, nonatomic, readonly, nullable) SDLRegisterAppInterfaceResponse *registerResponse; /** - * The auth token, if received. This should be used to log into a user account. Primarily used for cloud apps with companion app stores. - */ -@property (strong, nonatomic, readonly, nullable) NSString *authToken; - -/** * The manager's delegate. */ @property (weak, nonatomic, nullable) id<SDLManagerDelegate> delegate; diff --git a/SmartDeviceLink/SDLManager.m b/SmartDeviceLink/SDLManager.m index 2350a2670..c2e5f5c0f 100644 --- a/SmartDeviceLink/SDLManager.m +++ b/SmartDeviceLink/SDLManager.m @@ -97,10 +97,6 @@ NS_ASSUME_NONNULL_BEGIN return self.lifecycleManager.registerResponse; } --(nullable NSString *)authToken { - return self.lifecycleManager.authToken; -} - - (nullable id<SDLManagerDelegate>)delegate { return self.lifecycleManager.delegate; } |