aboutsummaryrefslogtreecommitdiffstats
path: root/Source/NSNotificationAdditions.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/NSNotificationAdditions.m')
-rw-r--r--Source/NSNotificationAdditions.m60
1 files changed, 59 insertions, 1 deletions
diff --git a/Source/NSNotificationAdditions.m b/Source/NSNotificationAdditions.m
index ae949347..8b64c1f2 100644
--- a/Source/NSNotificationAdditions.m
+++ b/Source/NSNotificationAdditions.m
@@ -27,42 +27,84 @@
#import "pthread.h"
@interface NSNotificationCenter (NSNotificationCenterAdditions_PrivateAPI)
+#ifndef SP_REFACTOR
+ (void)_postNotification:(NSNotification *)notification;
+ (void)_postNotificationName:(NSDictionary *)info;
+ (void)_postNotificationForwarder:(NSDictionary *)info;
+#else
++ (void)_sequelProPostNotification:(NSNotification *)notification;
++ (void)_sequelProPostNotificationName:(NSDictionary *)info;
++ (void)_sequelProPostNotificationForwarder:(NSDictionary *)info;
+#endif
@end
@implementation NSNotificationCenter (NSNotificationCenterAdditions)
+#ifndef SP_REFACTOR
- (void)postNotificationOnMainThread:(NSNotification *)notification
+#else
+- (void)sequelProPostNotificationOnMainThread:(NSNotification *)notification
+#endif
{
if (pthread_main_np()) return [self postNotification:notification];
+#ifndef SP_REFACTOR
[self postNotificationOnMainThread:notification waitUntilDone:NO];
+#else
+ [self sequelProPostNotificationOnMainThread:notification waitUntilDone:NO];
+#endif
}
+#ifndef SP_REFACTOR
- (void)postNotificationOnMainThread:(NSNotification *)notification waitUntilDone:(BOOL)shouldWaitUntilDone
+#else
+- (void)sequelProPostNotificationOnMainThread:(NSNotification *)notification waitUntilDone:(BOOL)shouldWaitUntilDone
+#endif
{
if (pthread_main_np()) return [self postNotification:notification];
-
+
+#ifndef SP_REFACTOR
[self performSelectorOnMainThread:@selector(_postNotification:) withObject:notification waitUntilDone:shouldWaitUntilDone];
+#else
+ [self performSelectorOnMainThread:@selector(_sequelProPostNotification:) withObject:notification waitUntilDone:shouldWaitUntilDone];
+#endif
}
+#ifndef SP_REFACTOR
- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object
+#else
+- (void)sequelProPostNotificationOnMainThreadWithName:(NSString *)name object:(id)object
+#endif
{
if (pthread_main_np()) return [self postNotificationName:name object:object userInfo:nil];
+#ifndef SP_REFACTOR
[self postNotificationOnMainThreadWithName:name object:object userInfo:nil waitUntilDone:NO];
+#else
+ [self sequelProPostNotificationOnMainThreadWithName:name object:object userInfo:nil waitUntilDone:NO];
+#endif
}
+#ifndef SP_REFACTOR
- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo
+#else
+- (void)sequelProPostNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo
+#endif
{
if(pthread_main_np()) return [self postNotificationName:name object:object userInfo:userInfo];
+#ifndef SP_REFACTOR
[self postNotificationOnMainThreadWithName:name object:object userInfo:userInfo waitUntilDone:NO];
+#else
+ [self sequelProPostNotificationOnMainThreadWithName:name object:object userInfo:userInfo waitUntilDone:NO];
+#endif
}
+#ifndef SP_REFACTOR
- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo waitUntilDone:(BOOL)shouldWaitUntilDone
+#else
+- (void)sequelProPostNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo waitUntilDone:(BOOL)shouldWaitUntilDone
+#endif
{
if (pthread_main_np()) return [self postNotificationName:name object:object userInfo:userInfo];
@@ -72,7 +114,11 @@
if (object) [info setObject:object forKey:@"object"];
if (userInfo) [info setObject:userInfo forKey:@"userInfo"];
+#ifndef SP_REFACTOR
[[self class] performSelectorOnMainThread:@selector(_postNotificationName:) withObject:info waitUntilDone:shouldWaitUntilDone];
+#else
+ [[self class] performSelectorOnMainThread:@selector(_sequelProPostNotificationName:) withObject:info waitUntilDone:shouldWaitUntilDone];
+#endif
[info release];
}
@@ -81,12 +127,20 @@
@implementation NSNotificationCenter (NSNotificationCenterAdditions_PrivateAPI)
+#ifndef SP_REFACTOR
+ (void)_postNotification:(NSNotification *)notification
+#else
++ (void)_sequelProPostNotification:(NSNotification *)notification
+#endif
{
[[self defaultCenter] postNotification:notification];
}
+#ifndef SP_REFACTOR
+ (void)_postNotificationName:(NSDictionary *)info
+#else
++ (void)_sequelProPostNotificationName:(NSDictionary *)info
+#endif
{
NSString *name = [info objectForKey:@"name"];
@@ -97,7 +151,11 @@
[[self defaultCenter] postNotificationName:name object:object userInfo:userInfo];
}
+#ifndef SP_REFACTOR
+ (void)_postNotificationForwarder:(NSDictionary *)info
+#else
++ (void)_sequelProPostNotificationForwarder:(NSDictionary *)info
+#endif
{
NSString *name = [info objectForKey:@"name"];