summaryrefslogtreecommitdiff
path: root/Example Apps/Example ObjC/ButtonManager.m
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2019-07-29 14:57:06 -0400
committerJoel Fischer <joeljfischer@gmail.com>2019-07-29 14:57:06 -0400
commitd6d61887c7631238b0a19b934a24aa1e0021f0fb (patch)
treeb7a0bbf8fdbd6f3965bd032f32d3b8cd22ac6925 /Example Apps/Example ObjC/ButtonManager.m
parent37b76fd1221c2f93f50c6881947d5a0d82d952f1 (diff)
downloadsdl_ios-d6d61887c7631238b0a19b934a24aa1e0021f0fb.tar.gz
Update example apps to use alert icon
* Add tests
Diffstat (limited to 'Example Apps/Example ObjC/ButtonManager.m')
-rw-r--r--Example Apps/Example ObjC/ButtonManager.m8
1 files changed, 6 insertions, 2 deletions
diff --git a/Example Apps/Example ObjC/ButtonManager.m b/Example Apps/Example ObjC/ButtonManager.m
index 4befdf726..efa13ee36 100644
--- a/Example Apps/Example ObjC/ButtonManager.m
+++ b/Example Apps/Example ObjC/ButtonManager.m
@@ -73,14 +73,18 @@ NS_ASSUME_NONNULL_BEGIN
}
- (SDLSoftButtonObject *)sdlex_softButtonAlertWithManager:(SDLManager *)manager {
- SDLSoftButtonState *alertImageAndTextState = [[SDLSoftButtonState alloc] initWithStateName:AlertSoftButtonImageState text:AlertSoftButtonText artwork:[SDLArtwork artworkWithImage:[[UIImage imageNamed:CarBWIconImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] asImageFormat:SDLArtworkImageFormatPNG]];
+ SDLSoftButtonState *alertImageAndTextState = [[SDLSoftButtonState alloc] initWithStateName:AlertSoftButtonImageState text:AlertSoftButtonText artwork:[SDLArtwork artworkWithImage:[[UIImage imageNamed:CarBWIconImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] name:CarBWIconImageName asImageFormat:SDLArtworkImageFormatPNG]];
SDLSoftButtonState *alertTextState = [[SDLSoftButtonState alloc] initWithStateName:AlertSoftButtonTextState text:AlertSoftButtonText image:nil];
__weak typeof(self) weakself = self;
SDLSoftButtonObject *alertSoftButton = [[SDLSoftButtonObject alloc] initWithName:AlertSoftButton states:@[alertImageAndTextState, alertTextState] initialStateName:alertImageAndTextState.name handler:^(SDLOnButtonPress * _Nullable buttonPress, SDLOnButtonEvent * _Nullable buttonEvent) {
if (buttonPress == nil) { return; }
- [weakself.sdlManager sendRequest:[AlertManager alertWithMessageAndCloseButton:@"You pushed the soft button!" textField2:nil]];
+ [weakself.sdlManager.fileManager uploadArtwork:[SDLArtwork artworkWithImage:[UIImage imageNamed:CarBWIconImageName] asImageFormat:SDLArtworkImageFormatPNG] completionHandler:^(BOOL success, NSString * _Nonnull artworkName, NSUInteger bytesAvailable, NSError * _Nullable error) {
+ [weakself.sdlManager sendRequest:[AlertManager alertWithMessageAndCloseButton:@"You pushed the soft button!" textField2:nil iconName:@"ABCDEFG"] withResponseHandler:^(__kindof SDLRPCRequest * _Nullable request, __kindof SDLRPCResponse * _Nullable response, NSError * _Nullable error) {
+ NSLog(@"ALERT req: %@, res: %@, err: %@", request, response, error);
+ }];
+ }];
SDLLogD(@"Star icon soft button press fired");
}];