Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
VLC-iOS
Commits
d5ac392e
Commit
d5ac392e
authored
Mar 05, 2018
by
Pierre SAGASPE
Committed by
Carola Nitz
Mar 06, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VLCOpenNetworkStreamViewController : remove uialertview deprecated in ios 9
(cherry picked from commit
ddfd714f
)
parent
30ab81b4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
50 deletions
+30
-50
Sources/VLCOpenNetworkStreamViewController.m
Sources/VLCOpenNetworkStreamViewController.m
+30
-50
No files found.
Sources/VLCOpenNetworkStreamViewController.m
View file @
d5ac392e
...
...
@@ -19,7 +19,7 @@
#import "VLCStreamingHistoryCell.h"
#import "UIDevice+VLC.h"
@interface
VLCOpenNetworkStreamViewController
()
<
UITableViewDataSource
,
UITableViewDelegate
,
UITextFieldDelegate
,
UIAlertViewDelegate
,
VLCStreamingHistoryCellMenuItemProtocol
>
@interface
VLCOpenNetworkStreamViewController
()
<
UITableViewDataSource
,
UITableViewDelegate
,
UITextFieldDelegate
,
VLCStreamingHistoryCellMenuItemProtocol
>
{
NSMutableArray
*
_recentURLs
;
NSMutableDictionary
*
_recentURLTitles
;
...
...
@@ -201,50 +201,37 @@
NSString
*
renameString
=
NSLocalizedString
(
@"BUTTON_RENAME"
,
nil
);
NSString
*
cancelString
=
NSLocalizedString
(
@"BUTTON_CANCEL"
,
nil
);
if
(
@available
(
iOS
8
,
*
))
{
UIAlertController
*
alertController
=
[
UIAlertController
alertControllerWithTitle
:
renameString
message:
nil
preferredStyle:
UIAlertControllerStyleAlert
];
UIAlertAction
*
cancelAction
=
[
UIAlertAction
actionWithTitle
:
cancelString
style:
UIAlertActionStyleCancel
handler:
nil
];
UIAlertAction
*
okAction
=
[
UIAlertAction
actionWithTitle
:
@"OK"
style
:
UIAlertActionStyleDefault
handler
:^
(
UIAlertAction
*
_Nonnull
action
)
{
NSString
*
streamTitle
=
alertController
.
textFields
.
firstObject
.
text
;
[
self
renameStreamWithTitle
:
streamTitle
atIndex
:
cellIndexPath
.
row
];
}];
[
alertController
addTextFieldWithConfigurationHandler
:
^
(
UITextField
*
_Nonnull
textField
)
{
textField
.
text
=
cell
.
textLabel
.
text
;
[[
NSNotificationCenter
defaultCenter
]
addObserverForName
:
UITextFieldTextDidChangeNotification
object:
textField
queue:
[
NSOperationQueue
mainQueue
]
usingBlock:
^
(
NSNotification
*
_Nonnull
note
)
{
okAction
.
enabled
=
(
textField
.
text
.
length
!=
0
);
}];
}];
[
alertController
addAction
:
cancelAction
];
[
alertController
addAction
:
okAction
];
[
self
presentViewController
:
alertController
animated
:
YES
completion
:
nil
];
}
else
{
UIAlertView
*
alertView
=
[[
UIAlertView
alloc
]
init
];
alertView
.
delegate
=
self
;
alertView
.
alertViewStyle
=
UIAlertViewStylePlainTextInput
;
alertView
.
title
=
renameString
;
alertView
.
tag
=
cellIndexPath
.
row
;
// Dirty...
[
alertView
addButtonWithTitle
:
cancelString
];
[
alertView
addButtonWithTitle
:
@"OK"
];
[
alertView
show
];
}
UIAlertController
*
alertController
=
[
UIAlertController
alertControllerWithTitle
:
renameString
message:
nil
preferredStyle:
UIAlertControllerStyleAlert
];
UIAlertAction
*
cancelAction
=
[
UIAlertAction
actionWithTitle
:
cancelString
style:
UIAlertActionStyleCancel
handler:
nil
];
UIAlertAction
*
okAction
=
[
UIAlertAction
actionWithTitle
:
@"OK"
style
:
UIAlertActionStyleDefault
handler
:^
(
UIAlertAction
*
_Nonnull
action
)
{
NSString
*
streamTitle
=
alertController
.
textFields
.
firstObject
.
text
;
[
self
renameStreamWithTitle
:
streamTitle
atIndex
:
cellIndexPath
.
row
];
}];
[
alertController
addTextFieldWithConfigurationHandler
:
^
(
UITextField
*
_Nonnull
textField
)
{
textField
.
text
=
cell
.
textLabel
.
text
;
[[
NSNotificationCenter
defaultCenter
]
addObserverForName
:
UITextFieldTextDidChangeNotification
object:
textField
queue:
[
NSOperationQueue
mainQueue
]
usingBlock:
^
(
NSNotification
*
_Nonnull
note
)
{
okAction
.
enabled
=
(
textField
.
text
.
length
!=
0
);
}];
}];
[
alertController
addAction
:
cancelAction
];
[
alertController
addAction
:
okAction
];
[
self
presentViewController
:
alertController
animated
:
YES
completion
:
nil
];
}
-
(
void
)
renameStreamWithTitle
:(
NSString
*
)
title
atIndex
:(
NSInteger
)
index
{
-
(
void
)
renameStreamWithTitle
:(
NSString
*
)
title
atIndex
:(
NSInteger
)
index
{
[
_recentURLTitles
setObject
:
title
forKey
:[
@
(
index
)
stringValue
]];
[[
NSUbiquitousKeyValueStore
defaultStore
]
setDictionary
:
_recentURLTitles
forKey
:
kVLCRecentURLTitles
];
[[
NSOperationQueue
mainQueue
]
addOperationWithBlock
:
^
{
...
...
@@ -252,13 +239,6 @@
}];
}
#pragma mark - alert view delegate (iOS 7)
-
(
void
)
alertView
:(
UIAlertView
*
)
alertView
clickedButtonAtIndex
:(
NSInteger
)
buttonIndex
{
NSString
*
streamTitle
=
[
alertView
textFieldAtIndex
:
0
].
text
;
[
self
renameStreamWithTitle
:
streamTitle
atIndex
:
alertView
.
tag
];
// Dirty...
}
#pragma mark - table view data source
-
(
NSInteger
)
numberOfSectionsInTableView
:(
UITableView
*
)
tableView
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment