Skip to content

Commit

Permalink
Use base64EncodedStringWithSeparateLine instead of cdv_base64EncodedS…
Browse files Browse the repository at this point in the history
…tring #427, #432
  • Loading branch information
wf9a5m75 committed Mar 11, 2015
1 parent 99de23c commit 1ce0fa9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/ios/GoogleMaps/Map.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#import "GoogleMaps.h"
#import "MyPlgunProtocol.h"
#import "NSData-Base64/NSData+Base64.h"

@interface Map : CDVPlugin<MyPlgunProtocol>
@property (nonatomic, strong) GoogleMapsViewController* mapCtrl;
Expand Down
14 changes: 1 addition & 13 deletions src/ios/GoogleMaps/Map.m
Original file line number Diff line number Diff line change
Expand Up @@ -264,19 +264,7 @@ - (void)toDataURL:(CDVInvokedUrlCommand *)command {

NSData *imageData = UIImagePNGRepresentation(image);
NSString *base64Encoded = nil;
#ifdef __IPHONE_7_0
if ([PluginUtil isIOS7_OR_OVER] == true) {
#ifdef __CORDOVA_3_8_0
base64Encoded = [NSString stringWithFormat:@"data:image/png;base64,%@", [imageData cdv_base64EncodedString]];
#else
base64Encoded = [NSString stringWithFormat:@"data:image/png;base64,%@", [imageData base64EncodedString]];
#endif
} else {
base64Encoded = [NSString stringWithFormat:@"data:image/png;base64,%@", [imageData base64Encoding]];
}
#else
base64Encoded = [NSString stringWithFormat:@"data:image/png;base64,%@", [imageData base64Encoding]];
#endif
base64Encoded = [NSString stringWithFormat:@"data:image/png;base64,%@", [imageData base64EncodedStringWithSeparateLines:NO]];

CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:base64Encoded];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
Expand Down
2 changes: 1 addition & 1 deletion src/ios/GoogleMaps/NSData-Base64/NSData+Base64.m
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ - (NSString *)base64EncodedString
{
size_t outputLength;
char *outputBuffer =
NewBase64Encode([self bytes], [self length], false, &outputLength);
NewBase64Encode([self bytes], [self length], true, &outputLength);

NSString *result =
[[NSString alloc]
Expand Down

0 comments on commit 1ce0fa9

Please sign in to comment.