Prefer setProperty over the private setter

This commit is contained in:
Sebastián Katzer 2017-01-19 10:09:17 +01:00
parent d7dd8a913c
commit ca3530d232

View File

@ -252,9 +252,9 @@ NSString* const kAPPBackgroundEventFailure = @"failure";
/**
* Method to swizzle.
*/
+ (NSString*) swizzleMethod
+ (NSString*) wkProperty
{
NSString* str = @"X3NldEFsd2F5c1J1bnNBdEZvcmVncm91bmRQcmlvcml0eTo=";
NSString* str = @"X2Fsd2F5c1J1bnNBdEZvcmVncm91bmRQcmlvcml0eQ==";
NSData* data = [[NSData alloc] initWithBase64EncodedString:str options:0];
return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
@ -275,8 +275,8 @@ NSString* const kAPPBackgroundEventFailure = @"failure";
^(CDVPlugin *self, NSDictionary *settings) {
id obj = ((id (*)(id, SEL, NSDictionary*))_imp)(self, _cmd, settings);
SEL sel = NSSelectorFromString([APPBackgroundMode swizzleMethod]);
((void (*)(id, SEL, BOOL))[obj methodForSelector:sel])(obj, sel, YES);
[obj setValue:[NSNumber numberWithBool:YES]
forKey:[APPBackgroundMode wkProperty]];
return obj;
}