VLCDialogProvider.m 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*****************************************************************************
  2. * VLCDialogProvider.m: an implementation of the libvlc dialog API
  3. *****************************************************************************
  4. * Copyright (C) 2016 VideoLabs SAS
  5. * $Id$
  6. *
  7. * Authors: Felix Paul Kühne <fkuehne # videolan.org>
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU Lesser General Public License as published by
  11. * the Free Software Foundation; either version 2.1 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public License
  20. * along with this program; if not, write to the Free Software Foundation,
  21. * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  22. *****************************************************************************/
  23. #import "VLCDialogProvider.h"
  24. #import "VLCCustomDialogProvider.h"
  25. #if TARGET_OS_IPHONE
  26. #import "VLCiOSLegacyDialogProvider.h"
  27. #import "VLCEmbeddedDialogProvider.h"
  28. #endif
  29. /* We are the root of a class cluster, not much to see */
  30. @implementation VLCDialogProvider
  31. - (instancetype)initWithLibrary:(VLCLibrary *)library customUI:(BOOL)customUI
  32. {
  33. #if TARGET_OS_IPHONE
  34. if (customUI)
  35. return [[VLCCustomDialogProvider alloc] initWithLibrary:library];
  36. #if !TARGET_OS_TV
  37. if ([UIAlertController class]) {
  38. return [[VLCEmbeddedDialogProvider alloc] initWithLibrary:library];
  39. } else {
  40. return [[VLCiOSLegacyDialogProvider alloc] initWithLibrary:library];
  41. }
  42. #else
  43. return [[VLCEmbeddedDialogProvider alloc] initWithLibrary:library];
  44. #endif
  45. #else
  46. if (customUI) {
  47. return [[VLCCustomDialogProvider alloc] initWithLibrary:library];
  48. } else {
  49. NSLog(@"YOU NEED TO IMPLEMENT YOUR UI YOURSELF ON THE MAC");
  50. return nil;
  51. }
  52. #endif
  53. }
  54. - (void)postAction:(int)buttonNumber forDialogReference:(NSValue *)dialogReference
  55. {
  56. // implemented by respective child class
  57. }
  58. - (void)postUsername:(NSString *)username andPassword:(NSString *)password forDialogReference:(NSValue *)dialogReference store:(BOOL)store
  59. {
  60. // implemented by respective child class
  61. }
  62. - (void)dismissDialogWithReference:(NSValue *)dialogReference
  63. {
  64. // implemented by respective child class
  65. }
  66. @end