UIViewController+VLCAlert.m 1.7 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /*****************************************************************************
  2. * VLC for iOS
  3. *****************************************************************************
  4. * Copyright (c) 2015 VideoLAN. All rights reserved.
  5. * $Id$
  6. *
  7. * Authors: Tobias Conradi <videolan # tobias-conradi.de>
  8. *
  9. * Refer to the COPYING file of the official project for license.
  10. *****************************************************************************/
  11. #import "UIViewController+VLCAlert.h"
  12. #import "VLC_iOS-Swift.h"
  13. @implementation UIViewController (UIViewController_VLCAlert)
  14. #if TARGET_OS_TV
  15. - (void)vlc_showAlertWithTitle:(NSString *)title message:(NSString *)message buttonTitle:(NSString *)buttonTitle
  16. {
  17. UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
  18. [alertController addAction:[UIAlertAction actionWithTitle:buttonTitle style:UIAlertActionStyleDefault handler:nil]];
  19. [self presentViewController:alertController animated:YES completion:nil];
  20. }
  21. #else
  22. - (void)vlc_showAlertWithTitle:(NSString *)title message:(NSString *)message buttonTitle:(NSString *)buttonTitle
  23. {
  24. NSArray<VLCAlertButton *> *buttonsAction = @[[[VLCAlertButton alloc] initWithTitle: buttonTitle
  25. action: ^(UIAlertAction* action){}]
  26. ];
  27. [VLCAlertViewController alertViewManagerWithTitle:title
  28. errorMessage:message
  29. viewController:self
  30. buttonsAction:buttonsAction];
  31. }
  32. #endif
  33. @end