Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Commit

Permalink
quick hack to fix messages only being sent to the first app to register
Browse files Browse the repository at this point in the history
  • Loading branch information
kirb committed Jun 4, 2013
1 parent 0d2f612 commit 67d7dc6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .theos/packages/ws.hbang.typestatus-1.1~beta
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1~beta-133+debug
1.1~beta-137
2 changes: 1 addition & 1 deletion HBTSMessageServer.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ - (id)init {
self = [super init];

if (self) {
CPDistributedMessagingCenter *messagingCenter = [CPDistributedMessagingCenter centerNamed:@"ws.hbang.typestatus.server"];
CPDistributedMessagingCenter *messagingCenter = [CPDistributedMessagingCenter centerNamed:[@"ws.hbang.typestatus.server_for_app_" stringByAppendingString:[NSBundle mainBundle].bundleIdentifier]];
[messagingCenter runServerOnCurrentThread];
[messagingCenter registerForMessageName:@"SetState" target:self selector:@selector(_receivedMessage:userInfo:)];
}
Expand Down
14 changes: 8 additions & 6 deletions Tweak.xm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ HBTSMessageServer *messageServer;
BOOL firstLoad = YES;
BOOL overlaySlide = YES;
BOOL overlayFade = YES;
BOOL typingStatus = YES;
BOOL readStatus = YES;

void HBTSLoadPrefs();

Expand All @@ -35,8 +37,8 @@ void HBTSSetStatusBar(HBTSStatusBarType type, NSString *string, BOOL typing) {
[overlayView hide];
}

if (IN_SPRINGBOARD) {
[[CPDistributedMessagingCenter centerNamed:@"ws.hbang.typestatus.server"] sendMessageAndReceiveReplyName:@"SetState" userInfo:[NSDictionary dictionaryWithObjectsAndKeys:
if (IN_SPRINGBOARD && [[%c(SBUserAgent) sharedUserAgent] foregroundApplicationDisplayID]) {
[[CPDistributedMessagingCenter centerNamed:[@"ws.hbang.typestatus.server_for_app_" stringByAppendingString:[[%c(SBUserAgent) sharedUserAgent] foregroundApplicationDisplayID]]] sendMessageAndReceiveReplyName:@"SetState" userInfo:[NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:type], @"Type",
string, @"Name",
[NSNumber numberWithBool:typing], @"Typing",
Expand All @@ -57,10 +59,8 @@ NSMutableDictionary *nameCache = [[NSMutableDictionary alloc] init];

BOOL typingHideInMessages = YES;
BOOL typingIcon = YES;
BOOL typingStatus = YES;
BOOL typingTimeout = NO;
BOOL readHideInMessages = YES;
BOOL readStatus = YES;

NSArray *messagesApps = [[NSArray alloc] initWithObjects:@"com.apple.MobileSMS", @"com.bitesms", nil];

Expand Down Expand Up @@ -253,8 +253,6 @@ void HBTSLoadPrefs() {
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)HBTSTestRead, CFSTR("ws.hbang.typestatus/TestRead"), NULL, 0);

%init(HBTSSpringBoard);
} else {
messageServer = [[HBTSMessageServer alloc] init];
}

#pragma mark - Status bar overlay management
Expand All @@ -266,5 +264,9 @@ void HBTSLoadPrefs() {
[[UIApplication sharedApplication].statusBar addSubview:overlayView];

HBTSLoadPrefs();

if (!IN_SPRINGBOARD) {
messageServer = [[HBTSMessageServer alloc] init];
}
}];
}

0 comments on commit 67d7dc6

Please sign in to comment.