From e08db173fd02c91e7c705209f47dcc9ea4eebd56 Mon Sep 17 00:00:00 2001 From: Tommy Lacroix Date: Thu, 15 Aug 2019 19:11:47 -0400 Subject: [PATCH 1/2] Fix from @ptisserand for ITMS-90338: Non-public API usage #606 on cordova-plugin-background-geolocation --- BackgroundGeolocation/CocoaLumberjack.h | 6 +++--- BackgroundGeolocation/CocoaLumberjack.m | 8 ++++---- BackgroundGeolocation/FMDB.h | 8 ++++---- BackgroundGeolocation/FMDB.m | 10 +++++----- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/BackgroundGeolocation/CocoaLumberjack.h b/BackgroundGeolocation/CocoaLumberjack.h index 32a4deb..e98bc4d 100644 --- a/BackgroundGeolocation/CocoaLumberjack.h +++ b/BackgroundGeolocation/CocoaLumberjack.h @@ -24,7 +24,7 @@ Disable legacy macros by importing CocoaLumberjack.h or DDLogMacros.h instead of DDLog.h or add `#define DD_LEGACY_MACROS 0` before importing DDLog.h. #ifndef LOG_LEVEL_DEF - #define LOG_LEVEL_DEF ddLogLevel + #define LOG_LEVEL_DEF myDdLogLevel #endif #define LOG_FLAG_ERROR DDLogFlagError @@ -752,12 +752,12 @@ NSString * DDExtractFileNameWithoutExtension(const char *filePath, BOOL copy); * The implementation can be very straight-forward: * * ``` - * + (int)ddLogLevel + * + (int)myDdLogLevel * { * return ddLogLevel; * } * - * + (void)ddSetLogLevel:(DDLogLevel)level + * + (void)myDdSetLogLevel:(DDLogLevel)level * { * ddLogLevel = level; * } diff --git a/BackgroundGeolocation/CocoaLumberjack.m b/BackgroundGeolocation/CocoaLumberjack.m index e1cec7b..05f0d4d 100644 --- a/BackgroundGeolocation/CocoaLumberjack.m +++ b/BackgroundGeolocation/CocoaLumberjack.m @@ -2993,8 +2993,8 @@ - (void)flushLog { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + (BOOL)isRegisteredClass:(Class)class { - SEL getterSel = @selector(ddLogLevel); - SEL setterSel = @selector(ddSetLogLevel:); + SEL getterSel = @selector(myDdLogLevel); + SEL setterSel = @selector(myDdSetLogLevel:); #if TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR @@ -3122,7 +3122,7 @@ + (NSArray *)registeredClassNames { + (DDLogLevel)levelForClass:(Class)aClass { if ([self isRegisteredClass:aClass]) { - return [aClass ddLogLevel]; + return [aClass myDdLogLevel]; } return (DDLogLevel)-1; } @@ -3135,7 +3135,7 @@ + (DDLogLevel)levelForClassWithName:(NSString *)aClassName { + (void)setLevel:(DDLogLevel)level forClass:(Class)aClass { if ([self isRegisteredClass:aClass]) { - [aClass ddSetLogLevel:level]; + [aClass myDdSetLogLevel:level]; } } diff --git a/BackgroundGeolocation/FMDB.h b/BackgroundGeolocation/FMDB.h index 176be61..b568b91 100644 --- a/BackgroundGeolocation/FMDB.h +++ b/BackgroundGeolocation/FMDB.h @@ -2207,7 +2207,7 @@ typedef int(^FMDBExecuteStatementsCallbackBlock)(NSDictionary *resultsDictionary @return The `FMDatabasePool` object. `nil` on error. */ -+ (instancetype)databasePoolWithPath:(NSString*)aPath; ++ (instancetype)myDatabasePoolWithPath:(NSString*)aPath; /** Create pool using path and specified flags @@ -2217,7 +2217,7 @@ typedef int(^FMDBExecuteStatementsCallbackBlock)(NSDictionary *resultsDictionary @return The `FMDatabasePool` object. `nil` on error. */ -+ (instancetype)databasePoolWithPath:(NSString*)aPath flags:(int)openFlags; ++ (instancetype)myDatabasePoolWithPath:(NSString*)aPath flags:(int)openFlags; /** Create pool using path. @@ -2342,7 +2342,7 @@ typedef int(^FMDBExecuteStatementsCallbackBlock)(NSDictionary *resultsDictionary */ -- (BOOL)databasePool:(FMDatabasePool*)pool shouldAddDatabaseToPool:(FMDatabase*)database; +- (BOOL)myDatabasePool:(FMDatabasePool*)pool shouldAddDatabaseToPool:(FMDatabase*)database; /** Tells the delegate that database was added to the pool. @@ -2351,7 +2351,7 @@ typedef int(^FMDBExecuteStatementsCallbackBlock)(NSDictionary *resultsDictionary */ -- (void)databasePool:(FMDatabasePool*)pool didAddDatabase:(FMDatabase*)database; +- (void)myDatabasePool:(FMDatabasePool*)pool didAddDatabase:(FMDatabase*)database; @end diff --git a/BackgroundGeolocation/FMDB.m b/BackgroundGeolocation/FMDB.m index 552f22a..9c23e7a 100644 --- a/BackgroundGeolocation/FMDB.m +++ b/BackgroundGeolocation/FMDB.m @@ -1755,11 +1755,11 @@ @implementation FMDatabasePool @synthesize openFlags=_openFlags; -+ (instancetype)databasePoolWithPath:(NSString*)aPath { ++ (instancetype)myDatabasePoolWithPath:(NSString*)aPath { return FMDBReturnAutoreleased([[self alloc] initWithPath:aPath]); } -+ (instancetype)databasePoolWithPath:(NSString*)aPath flags:(int)openFlags { ++ (instancetype)myDatabasePoolWithPath:(NSString*)aPath flags:(int)openFlags { return FMDBReturnAutoreleased([[self alloc] initWithPath:aPath flags:openFlags]); } @@ -1872,7 +1872,7 @@ - (FMDatabase*)db { BOOL success = [db open]; #endif if (success) { - if ([self->_delegate respondsToSelector:@selector(databasePool:shouldAddDatabaseToPool:)] && ![self->_delegate databasePool:self shouldAddDatabaseToPool:db]) { + if ([self->_delegate respondsToSelector:@selector(myDatabasePool:shouldAddDatabaseToPool:)] && ![self->_delegate myDatabasePool:self shouldAddDatabaseToPool:db]) { [db close]; db = 0x00; } @@ -1881,8 +1881,8 @@ - (FMDatabase*)db { if (![self->_databaseOutPool containsObject:db]) { [self->_databaseOutPool addObject:db]; - if (shouldNotifyDelegate && [self->_delegate respondsToSelector:@selector(databasePool:didAddDatabase:)]) { - [self->_delegate databasePool:self didAddDatabase:db]; + if (shouldNotifyDelegate && [self->_delegate respondsToSelector:@selector(myDatabasePool:didAddDatabase:)]) { + [self->_delegate myDatabasePool:self didAddDatabase:db]; } } } From 405349ca593f73cc88cb73ac64305679a6f0e08e Mon Sep 17 00:00:00 2001 From: Tommy Lacroix Date: Thu, 15 Aug 2019 19:19:19 -0400 Subject: [PATCH 2/2] Added missing changes from ddLogLevel to myDdLogLevel --- BackgroundGeolocation/CocoaLumberjack.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BackgroundGeolocation/CocoaLumberjack.h b/BackgroundGeolocation/CocoaLumberjack.h index e98bc4d..99a7061 100644 --- a/BackgroundGeolocation/CocoaLumberjack.h +++ b/BackgroundGeolocation/CocoaLumberjack.h @@ -763,12 +763,12 @@ NSString * DDExtractFileNameWithoutExtension(const char *filePath, BOOL copy); * } * ``` **/ -+ (DDLogLevel)ddLogLevel; ++ (DDLogLevel)myDdLogLevel; /** * See the above description for `ddLogLevel` */ -+ (void)ddSetLogLevel:(DDLogLevel)level; ++ (void)myDdSetLogLevel:(DDLogLevel)level; @end