Skip to content

Commit c23d24d

Browse files
committed
Renamed buttonDef to buttonProps on iOS, which would be more consistent.
1 parent 59f1655 commit c23d24d

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/ios/CDVThemeableBrowser.m

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -852,40 +852,40 @@ - (UIImage*) getImage:(NSString*) name altPath:(NSString*) altPath altDensity:(C
852852
return result;
853853
}
854854

855-
- (UIButton*) createButton:(NSDictionary*) buttonDef action:(SEL)action withDescription:(NSString*)description
855+
- (UIButton*) createButton:(NSDictionary*) buttonProps action:(SEL)action withDescription:(NSString*)description
856856
{
857857
UIButton* result = nil;
858-
if (buttonDef) {
858+
if (buttonProps) {
859859
UIImage *buttonImage = nil;
860-
if (buttonDef[kThemeableBrowserPropImage] || buttonDef[kThemeableBrowserPropWwwImage]) {
861-
buttonImage = [self getImage:buttonDef[kThemeableBrowserPropImage]
862-
altPath:buttonDef[kThemeableBrowserPropWwwImage]
863-
altDensity:[buttonDef[kThemeableBrowserPropWwwImageDensity] doubleValue]];
860+
if (buttonProps[kThemeableBrowserPropImage] || buttonProps[kThemeableBrowserPropWwwImage]) {
861+
buttonImage = [self getImage:buttonProps[kThemeableBrowserPropImage]
862+
altPath:buttonProps[kThemeableBrowserPropWwwImage]
863+
altDensity:[buttonProps[kThemeableBrowserPropWwwImageDensity] doubleValue]];
864864

865865
if (!buttonImage) {
866866
[self.navigationDelegate emitError:kThemeableBrowserEmitCodeLoadFail
867867
withMessage:[NSString stringWithFormat:@"Image for %@, %@, failed to load.",
868868
description,
869-
buttonDef[kThemeableBrowserPropImage]
870-
? buttonDef[kThemeableBrowserPropImage] : buttonDef[kThemeableBrowserPropWwwImage]]];
869+
buttonProps[kThemeableBrowserPropImage]
870+
? buttonProps[kThemeableBrowserPropImage] : buttonProps[kThemeableBrowserPropWwwImage]]];
871871
}
872872
} else {
873873
[self.navigationDelegate emitWarning:kThemeableBrowserEmitCodeUndefined
874874
withMessage:[NSString stringWithFormat:@"Image for %@ is not defined. Button will not be shown.", description]];
875875
}
876876

877877
UIImage *buttonImagePressed = nil;
878-
if (buttonDef[kThemeableBrowserPropImagePressed] || buttonDef[kThemeableBrowserPropWwwImagePressed]) {
879-
buttonImagePressed = [self getImage:buttonDef[kThemeableBrowserPropImagePressed]
880-
altPath:buttonDef[kThemeableBrowserPropWwwImagePressed]
881-
altDensity:[buttonDef[kThemeableBrowserPropWwwImageDensity] doubleValue]];;
878+
if (buttonProps[kThemeableBrowserPropImagePressed] || buttonProps[kThemeableBrowserPropWwwImagePressed]) {
879+
buttonImagePressed = [self getImage:buttonProps[kThemeableBrowserPropImagePressed]
880+
altPath:buttonProps[kThemeableBrowserPropWwwImagePressed]
881+
altDensity:[buttonProps[kThemeableBrowserPropWwwImageDensity] doubleValue]];;
882882

883883
if (!buttonImagePressed) {
884884
[self.navigationDelegate emitError:kThemeableBrowserEmitCodeLoadFail
885885
withMessage:[NSString stringWithFormat:@"Pressed image for %@, %@, failed to load.",
886886
description,
887-
buttonDef[kThemeableBrowserPropImagePressed]
888-
? buttonDef[kThemeableBrowserPropImagePressed] : buttonDef[kThemeableBrowserPropWwwImagePressed]]];
887+
buttonProps[kThemeableBrowserPropImagePressed]
888+
? buttonProps[kThemeableBrowserPropImagePressed] : buttonProps[kThemeableBrowserPropWwwImagePressed]]];
889889
}
890890
} else {
891891
[self.navigationDelegate emitWarning:kThemeableBrowserEmitCodeUndefined
@@ -904,10 +904,10 @@ - (UIButton*) createButton:(NSDictionary*) buttonDef action:(SEL)action withDesc
904904
[result setImage:buttonImage forState:UIControlStateNormal];
905905
[result addTarget:self action:action forControlEvents:UIControlEventTouchUpInside];
906906
}
907-
} else if (!buttonDef) {
907+
} else if (!buttonProps) {
908908
[self.navigationDelegate emitWarning:kThemeableBrowserEmitCodeUndefined
909909
withMessage:[NSString stringWithFormat:@"%@ is not defined. Button will not be shown.", description]];
910-
} else if (!buttonDef[kThemeableBrowserPropImage]) {
910+
} else if (!buttonProps[kThemeableBrowserPropImage]) {
911911
}
912912

913913
return result;
@@ -1315,15 +1315,15 @@ - (CGFloat) getWidthFromButton:(UIButton*)button
13151315
return button.frame.size.width;
13161316
}
13171317

1318-
- (void)emitEventForButton:(NSDictionary*)buttonDef
1318+
- (void)emitEventForButton:(NSDictionary*)buttonProps
13191319
{
1320-
[self emitEventForButton:buttonDef withIndex:nil];
1320+
[self emitEventForButton:buttonProps withIndex:nil];
13211321
}
13221322

1323-
- (void)emitEventForButton:(NSDictionary*)buttonDef withIndex:(NSNumber*)index
1323+
- (void)emitEventForButton:(NSDictionary*)buttonProps withIndex:(NSNumber*)index
13241324
{
1325-
if (buttonDef) {
1326-
NSString* event = buttonDef[kThemeableBrowserPropEvent];
1325+
if (buttonProps) {
1326+
NSString* event = buttonProps[kThemeableBrowserPropEvent];
13271327
if (event) {
13281328
NSMutableDictionary* dict = [NSMutableDictionary new];
13291329
[dict setObject:event forKey:@"type"];

0 commit comments

Comments
 (0)