Commit c61d25a9 authored by Felix Paul Kühne's avatar Felix Paul Kühne

Move bug reporter to separate class and allow the shake gesture also in...

Move bug reporter to separate class and allow the shake gesture also in Library view and during playback
parent 99d8187f
......@@ -14,6 +14,7 @@
#import "UIDevice+SpeedCategory.h"
#import "VLCPlaylistViewController.h"
#import "VLCMenuViewController.h"
#import "VLCMovieViewController.h"
#import "PAPasscodeViewController.h"
#import "UINavigationController+Theme.h"
......
//
// VLCBugreporter.h
// VLC for iOS
//
// Created by Felix Paul Kühne on 21.07.13.
// Copyright (c) 2013 VideoLAN. All rights reserved.
//
// Refer to the COPYING file of the official project for license.
//
@interface VLCBugreporter : NSObject
+ (VLCBugreporter *)sharedInstance;
- (void)handleBugreportRequest;
@end
//
// VLCBugreporter.m
// VLC for iOS
//
// Created by Felix Paul Kühne on 21.07.13.
// Copyright (c) 2013 VideoLAN. All rights reserved.
//
// Refer to the COPYING file of the official project for license.
//
#import "VLCBugreporter.h"
@implementation VLCBugreporter
static VLCBugreporter *_sharedInstance = nil;
+ (VLCBugreporter *)sharedInstance
{
return _sharedInstance ? _sharedInstance : [[self alloc] init];
}
#pragma mark -
#pragma mark Initialization
- (id)init
{
if (_sharedInstance) {
self = nil;
return _sharedInstance;
} else
_sharedInstance = [super init];
return _sharedInstance;
}
- (void)handleBugreportRequest
{
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"BUG_REPORT_TITLE", @"")
message:NSLocalizedString(@"BUG_REPORT_MESSAGE", @"") delegate:self
cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", @"")
otherButtonTitles:NSLocalizedString(@"BUG_REPORT_BUTTON", @""), nil];;
[alert show];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 1) {
NSURL *url = [NSURL URLWithString:@"https://trac.videolan.org/vlc/newticket"];
[[UIApplication sharedApplication] openURL:url];
}
}
@end
......@@ -23,6 +23,7 @@
#import "UIBarButtonItem+Theme.h"
#import "VLCOpenNetworkStreamViewController.h"
#import "VLCHTTPDownloadViewController.h"
#import "VLCBugreporter.h"
#import <ifaddrs.h>
#import <arpa/inet.h>
......@@ -213,23 +214,10 @@
}
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event {
if (motion == UIEventSubtypeMotionShake) {
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"BUG_REPORT_TITLE", @"")
message:NSLocalizedString(@"BUG_REPORT_MESSAGE", @"") delegate:self
cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", @"")
otherButtonTitles:NSLocalizedString(@"BUG_REPORT_BUTTON", @""), nil];;
[alert show];
}
if (motion == UIEventSubtypeMotionShake)
[[VLCBugreporter sharedInstance] handleBugreportRequest];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 1) {
NSURL *url = [NSURL URLWithString:@"https://trac.videolan.org/vlc/newticket"];
[[UIApplication sharedApplication] openURL:url];
}
}
- (void)_dismissModalViewController
{
[self dismissModalViewControllerAnimated:YES];
......
......@@ -13,6 +13,7 @@
#import <AVFoundation/AVFoundation.h>
#import <CommonCrypto/CommonDigest.h>
#import "UIDevice+SpeedCategory.h"
#import "VLCBugreporter.h"
#define INPUT_RATE_DEFAULT 1000.
......@@ -384,6 +385,13 @@
return YES;
}
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
if (motion == UIEventSubtypeMotionShake)
[[VLCBugreporter sharedInstance] handleBugreportRequest];
}
- (void)remoteControlReceivedWithEvent:(UIEvent *)event
{
switch (event.subtype) {
......
......@@ -15,6 +15,7 @@
#import "VLCMenuViewController.h"
#import "UINavigationController+Theme.h"
#import "NSString+SupportedMedia.h"
#import "VLCBugreporter.h"
@implementation EmptyLibraryView
@end
......@@ -111,6 +112,17 @@
[[MLMediaLibrary sharedMediaLibrary] libraryDidDisappear];
}
- (BOOL)canBecomeFirstResponder
{
return YES;
}
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
if (motion == UIEventSubtypeMotionShake)
[[VLCBugreporter sharedInstance] handleBugreportRequest];
}
- (void)removeMediaObject:(MLFile *)mediaObject
{
NSFileManager *fileManager = [NSFileManager defaultManager];
......
......@@ -188,6 +188,7 @@
7DBC3B451711FC6C00DCF688 /* VLCAboutViewController~iphone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7DBC3B431711FC6C00DCF688 /* VLCAboutViewController~iphone.xib */; };
7DC87AEE17412A1F009DC250 /* VLCLinearProgressIndicator.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DC87AED17412A1F009DC250 /* VLCLinearProgressIndicator.m */; };
7DC87AF217413EE3009DC250 /* VLCPlaylistGridView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7DC87AF117413EE3009DC250 /* VLCPlaylistGridView.xib */; };
7DD2A3A7179BFAFE003EB537 /* VLCBugreporter.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DD2A3A6179BFAFE003EB537 /* VLCBugreporter.m */; };
7DDABBB71775A3C7003D8937 /* UIDevice+SpeedCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DDABBB61775A3C7003D8937 /* UIDevice+SpeedCategory.m */; };
7DDD0429172D98E5005A7B10 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7DDD0428172D98E5005A7B10 /* CFNetwork.framework */; };
7DE18629175BA9A5006C0173 /* badgeUnread@2x~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 7DE1862B175BA9A5006C0173 /* badgeUnread@2x~ipad.png */; };
......@@ -557,6 +558,8 @@
7DC87AEF17413634009DC250 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = "<group>"; };
7DC87AF017413A17009DC250 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = "<group>"; };
7DC87AF117413EE3009DC250 /* VLCPlaylistGridView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = VLCPlaylistGridView.xib; path = ../Resources/VLCPlaylistGridView.xib; sourceTree = "<group>"; };
7DD2A3A5179BFAFE003EB537 /* VLCBugreporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCBugreporter.h; sourceTree = "<group>"; };
7DD2A3A6179BFAFE003EB537 /* VLCBugreporter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCBugreporter.m; sourceTree = "<group>"; };
7DDABBB51775A3A7003D8937 /* UIDevice+SpeedCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIDevice+SpeedCategory.h"; sourceTree = "<group>"; };
7DDABBB61775A3C7003D8937 /* UIDevice+SpeedCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIDevice+SpeedCategory.m"; sourceTree = "<group>"; };
7DDD0428172D98E5005A7B10 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; };
......@@ -1211,6 +1214,8 @@
7D94FCEE16DE7D1000F2623B /* VLCAppDelegate.m */,
7D07A4E6174EA47800759D10 /* VLCSettingsController.h */,
7D07A4E7174EA47800759D10 /* VLCSettingsController.m */,
7DD2A3A5179BFAFE003EB537 /* VLCBugreporter.h */,
7DD2A3A6179BFAFE003EB537 /* VLCBugreporter.m */,
7D2339AB176DE70E008D223C /* Menu */,
7D5F7ABA175265CB006CCCFA /* HTTP Connectivity */,
7D5F7AB9175265B2006CCCFA /* Playback */,
......@@ -1674,6 +1679,7 @@
7A5061A2176E41160036E15D /* UIBarButtonItem+Theme.m in Sources */,
A7990067176E9CF3009E8267 /* VLCMenuButton.m in Sources */,
7DDABBB71775A3C7003D8937 /* UIDevice+SpeedCategory.m in Sources */,
7DD2A3A7179BFAFE003EB537 /* VLCBugreporter.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment