VLCBugreporter.m 2.36 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
/*****************************************************************************
 * VLCBugreporter.m
 * VLC for iOS
 *****************************************************************************
 * Copyright (c) 2013 VideoLAN. All rights reserved.
 * $Id$
 *
 * Authors: Felix Paul Kühne <fkuehne # videolan.org>
 *          Gleb Pinigin <gpinigin # gmail.com>
 *          Jean-Romain Prévost <jr # 3on.fr>
 *
 * Refer to the COPYING file of the official project for license.
 *****************************************************************************/
14 15 16

#import "VLCBugreporter.h"

17
#import "VLC-Swift.h"
18

19 20
@implementation VLCBugreporter

Gleb Pinigin's avatar
Gleb Pinigin committed
21
#pragma mark - Initialization
22 23 24

+ (VLCBugreporter *)sharedInstance
{
Gleb Pinigin's avatar
Gleb Pinigin committed
25 26 27 28 29
    static dispatch_once_t onceToken;
    static VLCBugreporter *_sharedInstance = nil;
    dispatch_once(&onceToken, ^{
        _sharedInstance = [VLCBugreporter new];
    });
30 31 32 33

    return _sharedInstance;
}

Gleb Pinigin's avatar
Gleb Pinigin committed
34 35
#pragma mark -

36 37
- (void)handleBugreportRequest
{
38
    NSArray<VLCAlertButton *> *buttonsAction = @[[[VLCAlertButton alloc] initWithTitle:NSLocalizedString(@"BUTTON_CANCEL", nil)
39 40
                                                                                 style: UIAlertActionStyleCancel
                                                                                action:nil],
41
                                                 [[VLCAlertButton alloc] initWithTitle:NSLocalizedString(@"BUG_REPORT_BUTTON", nil)
42
                                                                                action: ^(UIAlertAction *action) {
43 44 45 46
                                                                                    NSURL *url = [NSURL URLWithString:@"https://trac.videolan.org/vlc/newticket"];
                                                                                    [[UIApplication sharedApplication] openURL:url];
                                                                                }]
                                                 
47
                                                 ];
48 49 50 51
    [VLCAlertViewController alertViewManagerWithTitle:NSLocalizedString(@"BUG_REPORT_TITLE", nil)
                                         errorMessage:NSLocalizedString(@"BUG_REPORT_MESSAGE", nil)
                                       viewController:[UIApplication sharedApplication].keyWindow.rootViewController
                                        buttonsAction:buttonsAction];
52 53
}
@end