Skip to content

Instantly share code, notes, and snippets.

@rodericj
Created April 11, 2014 20:26
Show Gist options
  • Save rodericj/10498815 to your computer and use it in GitHub Desktop.
Save rodericj/10498815 to your computer and use it in GitHub Desktop.
// Make sure that we can see all of our associated devices
NSSet * associatedDeviceIDs = [MorseUser currentUser].associatedDevices;
[associatedDeviceIDs map:^(NSString * input)
{
return input.lowercaseString;
}];
NSSet * nearbyDeviceIDs = [[tempNearby allKeys] asSet];
if(![associatedDeviceIDs isSubsetOfSet:nearbyDeviceIDs])
{
for(NSString * deviceID in associatedDeviceIDs)
{
if(![nearbyDeviceIDs containsObject:deviceID.lowercaseString])
{
#ifdef GREEN_APP
NSString * name = [NSString stringWithFormat:@"%@'s Cone", [MorseUser currentUser].firstName];
MorseDevice * device = [[MorseDevice alloc] initWithResourceID:@"tuned" andName:name andMorseID:deviceID.lowercaseString];
#else
MorseDevice * device = [[MorseDevice alloc] initWithResourceID:@"tuned" andName:@"Tiburon" andMorseID:deviceID.lowercaseString];
#endif
[device setLocallyViewable:YES];
tempNearby[deviceID.lowercaseString] = device;
[self subscribeToAssociatedDevice:device];
}
}
}
@rodericj
Copy link
Author

Seems as though we are getting all of the associated devices, then adding them to tempNearby mapping which is self.nearbyDevices. If that is true, we'll never hit ATAssociatedDevicesNotSeen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment