VLCDialogProvider.m 2.55 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
/*****************************************************************************
 * VLCDialogProvider.m: an implementation of the libvlc dialog API
 *****************************************************************************
 * Copyright (C) 2016 VideoLabs SAS
 * $Id$
 *
 * Authors: Felix Paul Kühne <fkuehne # videolan.org>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

#import "VLCDialogProvider.h"
25 26 27
#import "VLCCustomDialogProvider.h"

#if TARGET_OS_IPHONE
28 29
#import "VLCiOSLegacyDialogProvider.h"
#import "VLCEmbeddedDialogProvider.h"
30
#endif
31 32 33 34 35 36 37 38

/* We are the root of a class cluster, not much to see */

@implementation VLCDialogProvider

- (instancetype)initWithLibrary:(VLCLibrary *)library customUI:(BOOL)customUI
{
#if TARGET_OS_IPHONE
39 40
    if (customUI)
        return [[VLCCustomDialogProvider alloc] initWithLibrary:library];
41

Felix Paul Kühne's avatar
Felix Paul Kühne committed
42 43 44 45 46 47 48
    #if !TARGET_OS_TV
        if ([UIAlertController class]) {
            return [[VLCEmbeddedDialogProvider alloc] initWithLibrary:library];
        } else {
            return [[VLCiOSLegacyDialogProvider alloc] initWithLibrary:library];
        }
    #else
49
        return [[VLCEmbeddedDialogProvider alloc] initWithLibrary:library];
Felix Paul Kühne's avatar
Felix Paul Kühne committed
50
    #endif
51
#else
52
    if (customUI) {
53
        return [[VLCCustomDialogProvider alloc] initWithLibrary:library];
54
    } else {
55
        NSLog(@"YOU NEED TO IMPLEMENT YOUR UI YOURSELF ON THE MAC");
56 57
        return nil;
    }
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
#endif
}

- (void)postAction:(int)buttonNumber forDialogReference:(NSValue *)dialogReference
{
    // implemented by respective child class
}

- (void)postUsername:(NSString *)username andPassword:(NSString *)password forDialogReference:(NSValue *)dialogReference store:(BOOL)store
{
    // implemented by respective child class
}

- (void)dismissDialogWithReference:(NSValue *)dialogReference
{
    // implemented by respective child class
}

@end