Skip to content

replaced alerts with delegate method invocations #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Classes/ios/RFduinoManagerDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,8 @@
- (void)didConnectRFduino:(RFduino *)rfduino;
- (void)didLoadServiceRFduino:(RFduino *)rfduino;
- (void)didDisconnectRFduino:(RFduino *)rfduino;
- (void)didFailToConnectWithError: (NSError *) error;
- (void)peripheralDidDisconnectWithError: (NSError *) error;
- (void)centralManagerDidEncounterErrorWithMessage: (NSString *) message andCode: (uint) errorCode;

@end
28 changes: 9 additions & 19 deletions Classes/ios/RfduinoManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,9 @@ - (bool)isBluetoothLESupported

}

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Bluetooth LE Support"
message:message
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
if ([delegate respondsToSelector:@selector(centralManagerDidEncounterErrorWithMessage:andCode:)]) {
[delegate centralManagerDidEncounterErrorWithMessage:message andCode:[central state]];
}

return NO;
}
Expand Down Expand Up @@ -189,12 +186,9 @@ - (void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPe
if (error.code) {
cancelBlock = block;

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Peripheral Disconnected with Error"
message:error.description
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
if ([delegate respondsToSelector:@selector(peripheralDidDisconnectWithError:)]) {
[delegate peripheralDidDisconnectWithError:error];
}
}
else
block();
Expand Down Expand Up @@ -273,13 +267,9 @@ - (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeri
- (void)centralManager:(CBCentralManager *)central didFailToConnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error
{
NSLog(@"didFailToConnectPeripheral");

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Connect Failed"
message:error.description
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
if ([delegate respondsToSelector:@selector(didFailToConnectWithError:)]) {
[delegate didFailToConnectWithError:error];
}
}

- (void)centralManager:(CBCentralManager *)central didRetrieveConnectedPeripherals:(NSArray *)peripherals
Expand Down
2 changes: 1 addition & 1 deletion RFduino-library.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "RFduino-library"
s.version = "1.0.0"
s.version = "1.0.1"
s.summary = "RFduino-library is a few classes to manage & communicate with RFduino boards over BlueTooth 4.0"
s.description = "This code provides an easy way to communicate with the RFduino boards. It originally came from https://github.com/RFduino/RFduino, but I have made a few minor changes."
s.homepage = "http://www.rfduino.com"
Expand Down