Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
VLC-iOS
Commits
3a9b4d86
Commit
3a9b4d86
authored
Aug 22, 2018
by
David Cordero
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a few warnings because of referencing private atributes from
closures. Using private properties instead.
parent
02e76ea2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
99 additions
and
88 deletions
+99
-88
Apple-TV/Playback/Playback Info/VLCPlaybackInfoSubtitlesFetcherViewController.m
...back Info/VLCPlaybackInfoSubtitlesFetcherViewController.m
+38
-34
Apple-TV/Playback/Playback Info/VLCPlaybackInfoTVCollectionViewCell.m
...yback/Playback Info/VLCPlaybackInfoTVCollectionViewCell.m
+13
-8
Sources/VLCDropboxController.m
Sources/VLCDropboxController.m
+48
-46
No files found.
Apple-TV/Playback/Playback Info/VLCPlaybackInfoSubtitlesFetcherViewController.m
View file @
3a9b4d86
...
...
@@ -18,11 +18,11 @@
#define SPUDownloadHeaderReUseIdentifier @"SPUDownloadHeaderReUseIdentifier"
@interface
VLCPlaybackInfoSubtitlesFetcherViewController
()
<
UITableViewDataSource
,
UITableViewDelegate
,
MDFOSOFetcherDataRecipient
>
{
MDFOSOFetcher
*
_
osoFetcher
;
NSArray
<
MDFSubtitleItem
*>*
_
searchResults
;
UIActivityIndicatorView
*
_
activityIndicatorView
;
}
@property
(
strong
,
nonatomic
)
MDFOSOFetcher
*
osoFetcher
;
@property
(
strong
,
nonatomic
)
NSArray
<
MDFSubtitleItem
*>*
searchResults
;
@property
(
strong
,
nonatomic
)
UIActivityIndicatorView
*
activityIndicatorView
;
@end
@implementation
VLCPlaybackInfoSubtitlesFetcherViewController
...
...
@@ -33,10 +33,10 @@
self
.
titleLabel
.
text
=
self
.
title
;
self
.
tableView
.
backgroundColor
=
[
UIColor
clearColor
];
_
osoFetcher
=
[[
MDFOSOFetcher
alloc
]
init
];
_
osoFetcher
.
userAgentKey
=
@"VLSub 0.9"
;
_
osoFetcher
.
dataRecipient
=
self
;
[
_
osoFetcher
prepareForFetching
];
self
.
osoFetcher
=
[[
MDFOSOFetcher
alloc
]
init
];
self
.
osoFetcher
.
userAgentKey
=
@"VLSub 0.9"
;
self
.
osoFetcher
.
dataRecipient
=
self
;
[
self
.
osoFetcher
prepareForFetching
];
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
NSString
*
selectedLocale
=
[
defaults
stringForKey
:
kVLCSettingLastUsedSubtitlesSearchLanguage
];
...
...
@@ -53,15 +53,15 @@
}
[
defaults
setObject
:
selectedLocale
forKey
:
kVLCSettingLastUsedSubtitlesSearchLanguage
];
}
_
osoFetcher
.
subtitleLanguageId
=
selectedLocale
;
self
.
osoFetcher
.
subtitleLanguageId
=
selectedLocale
;
_
activityIndicatorView
=
[[
UIActivityIndicatorView
alloc
]
initWithActivityIndicatorStyle
:
UIActivityIndicatorViewStyleWhiteLarge
];
[
_
activityIndicatorView
sizeToFit
];
[
_
activityIndicatorView
setTranslatesAutoresizingMaskIntoConstraints
:
NO
];
_
activityIndicatorView
.
hidesWhenStopped
=
YES
;
[
self
.
view
addSubview
:
_
activityIndicatorView
];
self
.
activityIndicatorView
=
[[
UIActivityIndicatorView
alloc
]
initWithActivityIndicatorStyle
:
UIActivityIndicatorViewStyleWhiteLarge
];
[
self
.
activityIndicatorView
sizeToFit
];
[
self
.
activityIndicatorView
setTranslatesAutoresizingMaskIntoConstraints
:
NO
];
self
.
activityIndicatorView
.
hidesWhenStopped
=
YES
;
[
self
.
view
addSubview
:
self
.
activityIndicatorView
];
NSLayoutConstraint
*
yConstraint
=
[
NSLayoutConstraint
constraintWithItem
:
_
activityIndicatorView
NSLayoutConstraint
*
yConstraint
=
[
NSLayoutConstraint
constraintWithItem
:
self
.
activityIndicatorView
attribute:
NSLayoutAttributeCenterY
relatedBy:
NSLayoutRelationEqual
toItem:
self
.
view
...
...
@@ -69,7 +69,7 @@
multiplier:
1
.
0
constant:
0
.
0
];
[
self
.
view
addConstraint
:
yConstraint
];
NSLayoutConstraint
*
xConstraint
=
[
NSLayoutConstraint
constraintWithItem
:
_
activityIndicatorView
NSLayoutConstraint
*
xConstraint
=
[
NSLayoutConstraint
constraintWithItem
:
self
.
activityIndicatorView
attribute:
NSLayoutAttributeCenterX
relatedBy:
NSLayoutRelationEqual
toItem:
self
.
view
...
...
@@ -96,8 +96,9 @@
-
(
void
)
MDFOSOFetcher
:(
MDFOSOFetcher
*
)
aFetcher
readyToSearch
:(
BOOL
)
bValue
{
if
(
!
bValue
)
if
(
!
bValue
)
{
return
;
}
[
self
searchForMedia
];
}
...
...
@@ -107,14 +108,14 @@
[
self
startActivity
];
VLCPlaybackController
*
vpc
=
[
VLCPlaybackController
sharedInstance
];
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
_
osoFetcher
.
subtitleLanguageId
=
[
defaults
stringForKey
:
kVLCSettingLastUsedSubtitlesSearchLanguage
];
[
_
osoFetcher
searchForSubtitlesWithQuery
:
vpc
.
metadata
.
title
];
self
.
osoFetcher
.
subtitleLanguageId
=
[
defaults
stringForKey
:
kVLCSettingLastUsedSubtitlesSearchLanguage
];
[
self
.
osoFetcher
searchForSubtitlesWithQuery
:
vpc
.
metadata
.
title
];
}
-
(
void
)
MDFOSOFetcher
:(
MDFOSOFetcher
*
)
aFetcher
didFindSubtitles
:(
NSArray
<
MDFSubtitleItem
*>
*
)
subtitles
forSearchRequest
:(
NSString
*
)
searchRequest
{
[
self
stopActivity
];
_
searchResults
=
subtitles
;
self
.
searchResults
=
subtitles
;
[
self
.
tableView
reloadData
];
}
...
...
@@ -143,11 +144,12 @@
-
(
NSInteger
)
tableView
:(
UITableView
*
)
tableView
numberOfRowsInSection
:(
NSInteger
)
section
{
if
(
section
==
0
)
if
(
section
==
0
)
{
return
1
;
}
if
(
_
searchResults
)
{
return
_
searchResults
.
count
;
if
(
self
.
searchResults
)
{
return
self
.
searchResults
.
count
;
}
return
0
;
...
...
@@ -157,11 +159,12 @@
{
UITableViewCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
SPUDownloadReUseIdentifier
];
if
(
!
cell
)
if
(
!
cell
)
{
cell
=
[[
UITableViewCell
alloc
]
initWithStyle
:
UITableViewCellStyleValue1
reuseIdentifier
:
SPUDownloadReUseIdentifier
];
}
if
(
indexPath
.
section
!=
0
)
{
MDFSubtitleItem
*
item
=
_
searchResults
[
indexPath
.
row
];
MDFSubtitleItem
*
item
=
self
.
searchResults
[
indexPath
.
row
];
cell
.
textLabel
.
text
=
item
.
name
;
cell
.
detailTextLabel
.
text
=
[
NSString
stringWithFormat
:
@"%@ - %@"
,
item
.
rating
,
[
item
.
format
uppercaseStringWithLocale
:[
NSLocale
currentLocale
]]];
cell
.
accessoryType
=
UITableViewCellAccessoryNone
;
...
...
@@ -178,8 +181,9 @@
-
(
NSString
*
)
tableView
:(
UITableView
*
)
tableView
titleForHeaderInSection
:(
NSInteger
)
section
{
if
(
section
==
0
)
if
(
section
==
0
)
{
return
@""
;
}
return
NSLocalizedString
(
@"FOUND_SUBS"
,
nil
);
}
...
...
@@ -192,7 +196,7 @@
UIAlertController
*
alertController
=
[
UIAlertController
alertControllerWithTitle
:
NSLocalizedString
(
@"LANGUAGE"
,
nil
)
message:
nil
preferredStyle
:
UIAlertControllerStyleActionSheet
];
NSArray
<
MDFSubtitleLanguage
*>
*
languages
=
_
osoFetcher
.
availableLanguages
;
NSArray
<
MDFSubtitleLanguage
*>
*
languages
=
self
.
osoFetcher
.
availableLanguages
;
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
NSString
*
currentCode
=
[
defaults
stringForKey
:
kVLCSettingLastUsedSubtitlesSearchLanguage
];
...
...
@@ -201,7 +205,7 @@
UIAlertAction
*
action
=
[
UIAlertAction
actionWithTitle
:
item
.
localizedName
style:
UIAlertActionStyleDefault
handler:
^
(
UIAlertAction
*
_Nonnull
action
)
{
_
osoFetcher
.
subtitleLanguageId
=
itemID
;
self
.
osoFetcher
.
subtitleLanguageId
=
itemID
;
[
defaults
setObject
:
itemID
forKey
:
kVLCSettingLastUsedSubtitlesSearchLanguage
];
[
self
searchForMedia
];
[
self
.
tableView
reloadData
];
...
...
@@ -218,24 +222,24 @@
[
self
presentViewController
:
alertController
animated
:
YES
completion
:
nil
];
}
else
{
[
self
startActivity
];
MDFSubtitleItem
*
item
=
_
searchResults
[
indexPath
.
row
];
MDFSubtitleItem
*
item
=
self
.
searchResults
[
indexPath
.
row
];
NSArray
*
searchPaths
=
NSSearchPathForDirectoriesInDomains
(
NSCachesDirectory
,
NSUserDomainMask
,
YES
);
NSString
*
folderPath
=
[
searchPaths
[
0
]
stringByAppendingPathComponent
:
@"tempsubs"
];
[[
NSFileManager
defaultManager
]
createDirectoryAtPath
:
folderPath
withIntermediateDirectories
:
YES
attributes
:
nil
error
:
nil
];
NSString
*
subStorageLocation
=
[
folderPath
stringByAppendingPathComponent
:
item
.
name
];
[
_
osoFetcher
downloadSubtitleItem
:
item
toPath
:
subStorageLocation
];
[
self
.
osoFetcher
downloadSubtitleItem
:
item
toPath
:
subStorageLocation
];
}
}
-
(
void
)
startActivity
{
[
_
activityIndicatorView
startAnimating
];
[
self
.
activityIndicatorView
startAnimating
];
self
.
tableView
.
userInteractionEnabled
=
NO
;
}
-
(
void
)
stopActivity
{
[
_
activityIndicatorView
stopAnimating
];
[
self
.
activityIndicatorView
stopAnimating
];
self
.
tableView
.
userInteractionEnabled
=
YES
;
}
...
...
Apple-TV/Playback/Playback Info/VLCPlaybackInfoTVCollectionViewCell.m
View file @
3a9b4d86
...
...
@@ -11,9 +11,14 @@
#import "VLCPlaybackInfoTVCollectionViewCell.h"
@implementation
VLCPlaybackInfoTVCollectionViewCell
{
UIColor
*
textColor
;
}
@interface
VLCPlaybackInfoTVCollectionViewCell
()
@property
(
strong
,
nonatomic
)
UIColor
*
textColor
;
@end
@implementation
VLCPlaybackInfoTVCollectionViewCell
+
(
NSString
*
)
identifier
{
...
...
@@ -42,19 +47,19 @@
self
.
selectionMarkerVisible
=
NO
;
self
.
titleLabel
.
text
=
nil
;
if
([
UIScreen
mainScreen
].
traitCollection
.
userInterfaceStyle
==
UIUserInterfaceStyleDark
)
{
textColor
=
[
UIColor
VLCDarkFadedTextColor
];
self
.
textColor
=
[
UIColor
VLCDarkFadedTextColor
];
}
else
{
textColor
=
[
UIColor
VLCDarkTextColor
];
self
.
textColor
=
[
UIColor
VLCDarkTextColor
];
}
self
.
selectionMarkerView
.
textColor
=
textColor
;
self
.
titleLabel
.
textColor
=
textColor
;
self
.
selectionMarkerView
.
textColor
=
self
.
textColor
;
self
.
titleLabel
.
textColor
=
self
.
textColor
;
}
-
(
void
)
didUpdateFocusInContext
:(
UIFocusUpdateContext
*
)
context
withAnimationCoordinator
:(
UIFocusAnimationCoordinator
*
)
coordinator
{
[
super
didUpdateFocusInContext
:
context
withAnimationCoordinator
:
coordinator
];
[
coordinator
addCoordinatedAnimations
:
^
{
self
.
titleLabel
.
textColor
=
self
.
focused
?
[
UIColor
whiteColor
]
:
textColor
;
self
.
titleLabel
.
textColor
=
self
.
focused
?
[
UIColor
whiteColor
]
:
self
.
textColor
;
}
completion
:
nil
];
}
...
...
Sources/VLCDropboxController.m
View file @
3a9b4d86
...
...
@@ -19,19 +19,18 @@
#import "VLCDropboxConstants.h"
@interface
VLCDropboxController
()
{
DBUserClient
*
_client
;
NSArray
*
_currentFileList
;
NSMutableArray
*
_listOfDropboxFilesToDownload
;
BOOL
_downloadInProgress
;
@property
(
strong
,
nonatomic
)
DBUserClient
*
client
;
@property
(
strong
,
nonatomic
)
NSArray
*
currentFileList
;
CGFloat
_averageSpeed
;
NSTimeInterval
_startDL
;
NSTimeInterval
_lastStatsUpdate
;
@property
(
strong
,
nonatomic
)
NSMutableArray
*
listOfDropboxFilesToDownload
;
@property
(
assign
,
nonatomic
)
BOOL
downloadInProgress
;
UINavigationController
*
_lastKnownNavigationController
;
}
@property
(
assign
,
nonatomic
)
CGFloat
averageSpeed
;
@property
(
assign
,
nonatomic
)
NSTimeInterval
startDL
;
@property
(
assign
,
nonatomic
)
NSTimeInterval
lastStatsUpdate
;
@property
(
strong
,
nonatomic
)
UINavigationController
*
lastKnownNavigationController
;
@end
...
...
@@ -69,8 +68,9 @@
NSUbiquitousKeyValueStore
*
ubiquitousStore
=
[
NSUbiquitousKeyValueStore
defaultStore
];
[
ubiquitousStore
synchronize
];
NSArray
*
credentials
=
[
ubiquitousStore
arrayForKey
:
kVLCStoreDropboxCredentials
];
if
(
!
credentials
)
if
(
!
credentials
)
{
return
NO
;
}
for
(
NSString
*
tmp
in
credentials
)
{
[
DBSDKKeychain
storeValueWithKey
:
kVLCStoreDropboxCredentials
value
:
tmp
];
}
...
...
@@ -122,8 +122,9 @@
NSString
*
rawFileName
=
[
fileName
stringByDeletingPathExtension
];
for
(
NSUInteger
x
=
1
;
x
<
100
;
x
++
)
{
potentialFilename
=
[
NSString
stringWithFormat
:
@"%@_%lu.%@"
,
rawFileName
,
(
unsigned
long
)
x
,
fileExtension
];
if
(
!
[
fileManager
fileExistsAtPath
:[
finalFilePath
stringByAppendingPathComponent
:
potentialFilename
]])
if
(
!
[
fileManager
fileExistsAtPath
:[
finalFilePath
stringByAppendingPathComponent
:
potentialFilename
]])
{
break
;
}
}
return
[
finalFilePath
stringByAppendingPathComponent
:
potentialFilename
];
}
...
...
@@ -137,19 +138,22 @@
-
(
void
)
requestDirectoryListingAtPath
:(
NSString
*
)
path
{
if
(
self
.
isAuthorized
)
if
(
self
.
isAuthorized
)
{
[
self
listFiles
:
path
];
}
}
-
(
void
)
downloadFileToDocumentFolder
:(
DBFILESMetadata
*
)
file
{
if
(
!
[
file
isKindOfClass
:[
DBFILESFolderMetadata
class
]])
{
if
(
!
_listOfDropboxFilesToDownload
)
_listOfDropboxFilesToDownload
=
[[
NSMutableArray
alloc
]
init
];
[
_listOfDropboxFilesToDownload
addObject
:
file
];
if
(
!
self
.
listOfDropboxFilesToDownload
)
{
self
.
listOfDropboxFilesToDownload
=
[[
NSMutableArray
alloc
]
init
];
}
[
self
.
listOfDropboxFilesToDownload
addObject
:
file
];
if
([
self
.
delegate
respondsToSelector
:
@selector
(
numberOfFilesWaitingToBeDownloadedChanged
)])
if
([
self
.
delegate
respondsToSelector
:
@selector
(
numberOfFilesWaitingToBeDownloadedChanged
)])
{
[
self
.
delegate
numberOfFilesWaitingToBeDownloadedChanged
];
}
[
self
_triggerNextDownload
];
}
...
...
@@ -157,12 +161,13 @@
-
(
void
)
_triggerNextDownload
{
if
(
_
listOfDropboxFilesToDownload
.
count
>
0
&&
!
_
downloadInProgress
)
{
[
self
_reallyDownloadFileToDocumentFolder
:
_
listOfDropboxFilesToDownload
[
0
]];
[
_
listOfDropboxFilesToDownload
removeObjectAtIndex
:
0
];
if
(
self
.
listOfDropboxFilesToDownload
.
count
>
0
&&
!
self
.
downloadInProgress
)
{
[
self
_reallyDownloadFileToDocumentFolder
:
self
.
listOfDropboxFilesToDownload
[
0
]];
[
self
.
listOfDropboxFilesToDownload
removeObjectAtIndex
:
0
];
if
([
self
.
delegate
respondsToSelector
:
@selector
(
numberOfFilesWaitingToBeDownloadedChanged
)])
if
([
self
.
delegate
respondsToSelector
:
@selector
(
numberOfFilesWaitingToBeDownloadedChanged
)])
{
[
self
.
delegate
numberOfFilesWaitingToBeDownloadedChanged
];
}
}
}
...
...
@@ -170,14 +175,15 @@
{
NSArray
*
searchPaths
=
NSSearchPathForDirectoriesInDomains
(
NSDocumentDirectory
,
NSUserDomainMask
,
YES
);
NSString
*
filePath
=
[
searchPaths
[
0
]
stringByAppendingFormat
:
@"/%@"
,
file
.
name
];
_
startDL
=
[
NSDate
timeIntervalSinceReferenceDate
];
self
.
startDL
=
[
NSDate
timeIntervalSinceReferenceDate
];
[
self
downloadFileFrom
:
file
.
pathDisplay
to
:
filePath
];
if
([
self
.
delegate
respondsToSelector
:
@selector
(
operationWithProgressInformationStarted
)])
if
([
self
.
delegate
respondsToSelector
:
@selector
(
operationWithProgressInformationStarted
)])
{
[
self
.
delegate
operationWithProgressInformationStarted
];
}
_
downloadInProgress
=
YES
;
self
.
downloadInProgress
=
YES
;
}
-
(
void
)
streamFile
:(
DBFILESMetadata
*
)
file
currentNavigationController
:(
UINavigationController
*
)
navigationController
...
...
@@ -198,12 +204,12 @@
}
[[[
self
client
].
filesRoutes
listFolder
:
path
]
setResponseBlock
:
^
(
DBFILESListFolderResult
*
_Nullable
result
,
DBFILESListFolderError
*
_Nullable
routeError
,
DBRequestError
*
_Nullable
networkError
)
{
if
(
result
)
{
self
->
_
currentFileList
=
[
result
.
entries
sortedArrayUsingComparator
:
^
NSComparisonResult
(
id
a
,
id
b
)
{
self
.
currentFileList
=
[
result
.
entries
sortedArrayUsingComparator
:
^
NSComparisonResult
(
id
a
,
id
b
)
{
NSString
*
first
=
[(
DBFILESMetadata
*
)
a
name
];
NSString
*
second
=
[(
DBFILESMetadata
*
)
b
name
];
return
[
first
caseInsensitiveCompare
:
second
];
}];
APLog
(
@"found filtered metadata for %lu files"
,
(
unsigned
long
)
self
->
_
currentFileList
.
count
);
APLog
(
@"found filtered metadata for %lu files"
,
(
unsigned
long
)
self
.
currentFileList
.
count
);
if
([
self
.
delegate
respondsToSelector
:
@selector
(
mediaListUpdated
)])
[
self
.
delegate
mediaListUpdated
];
}
else
{
...
...
@@ -230,14 +236,14 @@
destination
=
[
self
_createPotentialNameFrom
:
destination
];
[[[
_
client
.
filesRoutes
downloadUrl
:
path
overwrite
:
YES
destination
:[
NSURL
URLWithString
:
destination
]]
[[[
self
.
client
.
filesRoutes
downloadUrl
:
path
overwrite
:
YES
destination
:[
NSURL
URLWithString
:
destination
]]
setResponseBlock:
^
(
DBFILESFileMetadata
*
_Nullable
result
,
DBFILESDownloadError
*
_Nullable
routeError
,
DBRequestError
*
_Nullable
networkError
,
NSURL
*
_Nonnull
destination
)
{
if
([
self
.
delegate
respondsToSelector
:
@selector
(
operationWithProgressInformationStopped
)])
{
[
self
.
delegate
operationWithProgressInformationStopped
];
}
self
->
_
downloadInProgress
=
NO
;
self
.
downloadInProgress
=
NO
;
[
self
_triggerNextDownload
];
if
(
networkError
)
{
APLog
(
@"downloadFile failed with network error %li and error tag %li"
,
(
long
)
networkError
.
statusCode
,
(
long
)
networkError
.
tag
);
...
...
@@ -248,9 +254,9 @@
UIAccessibilityPostNotification
(
UIAccessibilityAnnouncementNotification
,
NSLocalizedString
(
@"GDRIVE_DOWNLOAD_SUCCESSFUL"
,
nil
));
}
if
((
self
->
_
lastStatsUpdate
>
0
&&
([
NSDate
timeIntervalSinceReferenceDate
]
-
self
->
_
lastStatsUpdate
>
.
5
))
||
self
->
_
lastStatsUpdate
<=
0
)
{
if
((
self
.
lastStatsUpdate
>
0
&&
([
NSDate
timeIntervalSinceReferenceDate
]
-
self
.
lastStatsUpdate
>
.
5
))
||
self
.
lastStatsUpdate
<=
0
)
{
[
self
calculateRemainingTime
:(
CGFloat
)
totalBytesWritten
expectedDownloadSize
:(
CGFloat
)
totalBytesExpectedToWrite
];
self
->
_
lastStatsUpdate
=
[
NSDate
timeIntervalSinceReferenceDate
];
self
.
lastStatsUpdate
=
[
NSDate
timeIntervalSinceReferenceDate
];
}
if
([
self
.
delegate
respondsToSelector
:
@selector
(
currentProgressInformation
:)])
...
...
@@ -266,7 +272,7 @@
return
;
}
[[
_
client
.
filesRoutes
getTemporaryLink
:
path
]
setResponseBlock
:
^
(
DBFILESGetTemporaryLinkResult
*
_Nullable
result
,
DBFILESGetTemporaryLinkError
*
_Nullable
routeError
,
DBRequestError
*
_Nullable
networkError
)
{
[[
self
.
client
.
filesRoutes
getTemporaryLink
:
path
]
setResponseBlock
:
^
(
DBFILESGetTemporaryLinkResult
*
_Nullable
result
,
DBFILESGetTemporaryLinkError
*
_Nullable
routeError
,
DBRequestError
*
_Nullable
networkError
)
{
if
(
result
)
{
VLCMedia
*
media
=
[
VLCMedia
mediaWithURL
:[
NSURL
URLWithString
:
result
.
link
]];
...
...
@@ -274,9 +280,9 @@
[
medialist
addMedia
:
media
];
[[
VLCPlaybackController
sharedInstance
]
playMediaList
:
medialist
firstIndex
:
0
subtitlesFilePath
:
nil
];
#if TARGET_OS_TV
if
(
_
lastKnownNavigationController
)
{
if
(
self
.
lastKnownNavigationController
)
{
VLCFullscreenMovieTVViewController
*
movieVC
=
[
VLCFullscreenMovieTVViewController
fullscreenMovieTVViewController
];
[
_
lastKnownNavigationController
presentViewController
:
movieVC
[
self
.
lastKnownNavigationController
presentViewController
:
movieVC
animated:
YES
completion:
nil
];
}
...
...
@@ -292,11 +298,11 @@
-
(
void
)
calculateRemainingTime
:(
CGFloat
)
receivedDataSize
expectedDownloadSize
:(
CGFloat
)
expectedDownloadSize
{
CGFloat
lastSpeed
=
receivedDataSize
/
([
NSDate
timeIntervalSinceReferenceDate
]
-
_
startDL
);
CGFloat
lastSpeed
=
receivedDataSize
/
([
NSDate
timeIntervalSinceReferenceDate
]
-
self
.
startDL
);
CGFloat
smoothingFactor
=
0
.
005
;
_
averageSpeed
=
isnan
(
_
averageSpeed
)
?
lastSpeed
:
smoothingFactor
*
lastSpeed
+
(
1
-
smoothingFactor
)
*
_
averageSpeed
;
self
.
averageSpeed
=
isnan
(
self
.
averageSpeed
)
?
lastSpeed
:
smoothingFactor
*
lastSpeed
+
(
1
-
smoothingFactor
)
*
self
.
averageSpeed
;
CGFloat
RemainingInSeconds
=
(
expectedDownloadSize
-
receivedDataSize
)
/
_
averageSpeed
;
CGFloat
RemainingInSeconds
=
(
expectedDownloadSize
-
receivedDataSize
)
/
self
.
averageSpeed
;
NSDate
*
date
=
[
NSDate
dateWithTimeIntervalSince1970
:
RemainingInSeconds
];
NSDateFormatter
*
formatter
=
[[
NSDateFormatter
alloc
]
init
];
...
...
@@ -304,20 +310,16 @@
[
formatter
setTimeZone
:[
NSTimeZone
timeZoneForSecondsFromGMT
:
0
]];
NSString
*
remaingTime
=
[
formatter
stringFromDate
:
date
];
if
([
self
.
delegate
respondsToSelector
:
@selector
(
updateRemainingTime
:)])
if
([
self
.
delegate
respondsToSelector
:
@selector
(
updateRemainingTime
:)])
{
[
self
.
delegate
updateRemainingTime
:
remaingTime
];
}
-
(
NSArray
*
)
currentListFiles
{
return
_currentFileList
;
}
}
-
(
NSInteger
)
numberOfFilesWaitingToBeDownloaded
{
if
(
_
listOfDropboxFilesToDownload
)
return
_
listOfDropboxFilesToDownload
.
count
;
if
(
self
.
listOfDropboxFilesToDownload
)
{
return
self
.
listOfDropboxFilesToDownload
.
count
;
}
return
0
;
}
...
...
@@ -340,7 +342,7 @@
-
(
void
)
reset
{
_
currentFileList
=
nil
;
self
.
currentFileList
=
nil
;
}
@end
Soomin Lee
@bubu
mentioned in commit
ab5ce3af
·
Jun 26, 2019
mentioned in commit
ab5ce3af
mentioned in commit ab5ce3af56aeb1abe3d64e4f95945b26dcb2b609
Toggle commit list
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