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
6ec312e5
Commit
6ec312e5
authored
May 19, 2013
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
expand passcode validator to serve as a way to set the code
parent
d8337552
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
36 additions
and
7 deletions
+36
-7
AspenProject/VLCPasscodeLockViewController.h
AspenProject/VLCPasscodeLockViewController.h
+3
-0
AspenProject/VLCPasscodeLockViewController.m
AspenProject/VLCPasscodeLockViewController.m
+21
-3
AspenProject/VLCPlaylistViewController.m
AspenProject/VLCPlaylistViewController.m
+2
-3
AspenProject/VLCSettingsViewController.m
AspenProject/VLCSettingsViewController.m
+1
-0
Resources/VLCPasscodeLockViewController~iphone.xib
Resources/VLCPasscodeLockViewController~iphone.xib
+9
-1
Resources/de.lproj/Localizable.strings
Resources/de.lproj/Localizable.strings
+0
-0
Resources/en.lproj/Localizable.strings
Resources/en.lproj/Localizable.strings
+0
-0
Resources/fr.lproj/Localizable.strings
Resources/fr.lproj/Localizable.strings
+0
-0
Resources/ru.lproj/Localizable.strings
Resources/ru.lproj/Localizable.strings
+0
-0
No files found.
AspenProject/VLCPasscodeLockViewController.h
View file @
6ec312e5
...
...
@@ -11,6 +11,9 @@
@interface
VLCPasscodeLockViewController
:
UIViewController
{
NSString
*
_passcode
;
NSString
*
_tmpPasscode
;
NSUInteger
_resetStage
;
}
@property
(
nonatomic
,
strong
)
IBOutlet
UILabel
*
enterPasscodeLabel
;
...
...
AspenProject/VLCPasscodeLockViewController.m
View file @
6ec312e5
...
...
@@ -30,6 +30,8 @@
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
_passcode
=
[
defaults
objectForKey
:
@"Passcode"
];
self
.
enterPasscodeLabel
.
text
=
NSLocalizedString
(
@"ENTER_PASSCODE"
,
@""
);
[
self
.
navigationController
setNavigationBarHidden
:
YES
animated
:
NO
];
if
(
UI_USER_INTERFACE_IDIOM
()
==
UIUserInterfaceIdiomPhone
)
[
UIApplication
sharedApplication
].
statusBarStyle
=
UIStatusBarStyleBlackTranslucent
;
...
...
@@ -48,8 +50,24 @@
-
(
IBAction
)
textFieldValueChanged
:(
id
)
sender
{
if
(
self
.
enterCodeField
.
text
.
length
==
4
)
{
if
([
self
.
enterCodeField
.
text
isEqualToString
:
_passcode
])
{
VLCAppDelegate
*
appDelegate
=
[
UIApplication
sharedApplication
].
delegate
;
VLCAppDelegate
*
appDelegate
=
[
UIApplication
sharedApplication
].
delegate
;
if
(
_resetStage
==
1
)
{
_tmpPasscode
=
self
.
enterCodeField
.
text
;
self
.
enterCodeField
.
text
=
@""
;
self
.
enterPasscodeLabel
.
text
=
NSLocalizedString
(
@"REENTER_PASSCODE"
,
@""
);
_resetStage
=
2
;
}
else
if
(
_resetStage
==
2
)
{
if
([
self
.
enterCodeField
.
text
isEqualToString
:
_tmpPasscode
])
{
NSUserDefaults
*
defaults
;
[
defaults
setObject
:
@1
forKey
:
@"PasscodeProtection"
];
[
defaults
setObject
:
_tmpPasscode
forKey
:
@"Passcode"
];
_passcode
=
_tmpPasscode
;
_resetStage
=
0
;
appDelegate
.
playlistViewController
.
nextPasscodeCheckDate
=
[
NSDate
dateWithTimeIntervalSinceNow
:
300
];
// five min
appDelegate
.
playlistViewController
.
passcodeValidated
=
YES
;
[
self
.
view
removeFromSuperview
];
}
}
else
if
([
self
.
enterCodeField
.
text
isEqualToString
:
_passcode
])
{
appDelegate
.
playlistViewController
.
nextPasscodeCheckDate
=
[
NSDate
dateWithTimeIntervalSinceNow
:
300
];
// five min
appDelegate
.
playlistViewController
.
passcodeValidated
=
YES
;
[
self
.
navigationController
popViewControllerAnimated
:
YES
];
...
...
@@ -59,7 +77,7 @@
-
(
void
)
resetPasscode
{
_resetStage
=
1
;
}
@end
AspenProject/VLCPlaylistViewController.m
View file @
6ec312e5
...
...
@@ -52,6 +52,8 @@
self
.
emptyLibraryLongDescriptionLabel
.
numberOfLines
=
0
;
self
.
emptyLibraryLongDescriptionLabel
.
text
=
NSLocalizedString
(
@"EMPTY_LIBRARY_LONG"
,
@""
);
[
self
.
emptyLibraryLongDescriptionLabel
sizeToFit
];
self
.
passcodeLockViewController
=
[[
VLCPasscodeLockViewController
alloc
]
initWithNibName
:
@"VLCPasscodeLockViewController"
bundle
:
nil
];
}
-
(
void
)
viewWillAppear
:(
BOOL
)
animated
...
...
@@ -117,9 +119,6 @@
return
;
}
if
(
!
self
.
passcodeLockViewController
)
self
.
passcodeLockViewController
=
[[
VLCPasscodeLockViewController
alloc
]
initWithNibName
:
@"VLCPasscodeLockViewController"
bundle
:
nil
];
if
(
!
self
.
passcodeValidated
)
{
if
([
self
.
nextPasscodeCheckDate
earlierDate
:[
NSDate
date
]]
==
self
.
nextPasscodeCheckDate
)
[
self
.
navigationController
pushViewController
:
self
.
passcodeLockViewController
animated
:
YES
];
...
...
AspenProject/VLCSettingsViewController.m
View file @
6ec312e5
...
...
@@ -39,6 +39,7 @@
{
if
(
self
.
passcodeLockSwitch
.
on
)
{
VLCAppDelegate
*
appDelegate
=
[
UIApplication
sharedApplication
].
delegate
;
[
self
.
view
addSubview
:
appDelegate
.
playlistViewController
.
passcodeLockViewController
.
view
];
[
appDelegate
.
playlistViewController
.
passcodeLockViewController
resetPasscode
];
}
else
[[
NSUserDefaults
standardUserDefaults
]
setObject
:
@0
forKey
:
@"PasscodeProtection"
];
...
...
Resources/VLCPasscodeLockViewController~iphone.xib
View file @
6ec312e5
...
...
@@ -161,6 +161,14 @@
</object>
<int
key=
"connectionID"
>
32
</int>
</object>
<object
class=
"IBConnectionRecord"
>
<object
class=
"IBCocoaTouchOutletConnection"
key=
"connection"
>
<string
key=
"label"
>
enterPasscodeLabel
</string>
<reference
key=
"source"
ref=
"372490531"
/>
<reference
key=
"destination"
ref=
"186196614"
/>
</object>
<int
key=
"connectionID"
>
36
</int>
</object>
<object
class=
"IBConnectionRecord"
>
<object
class=
"IBCocoaTouchEventConnection"
key=
"connection"
>
<string
key=
"label"
>
textFieldValueChanged:
</string>
...
...
@@ -258,7 +266,7 @@
<nil
key=
"activeLocalization"
/>
<dictionary
class=
"NSMutableDictionary"
key=
"localizations"
/>
<nil
key=
"sourceID"
/>
<int
key=
"maxID"
>
3
5
</int>
<int
key=
"maxID"
>
3
6
</int>
</object>
<object
class=
"IBClassDescriber"
key=
"IBDocument.Classes"
>
<array
class=
"NSMutableArray"
key=
"referencedPartialClassDescriptions"
>
...
...
Resources/de.lproj/Localizable.strings
View file @
6ec312e5
B
"CHOOSE_AUDIO_TRACK"="Audiospur wählen";
...
...
Resources/en.lproj/Localizable.strings
View file @
6ec312e5
B
"CHOOSE_AUDIO_TRACK"="Choose Audio Track";
...
...
Resources/fr.lproj/Localizable.strings
View file @
6ec312e5
B
"CHOOSE_AUDIO_TRACK"="Choisir Piste Audio";
...
...
Resources/ru.lproj/Localizable.strings
View file @
6ec312e5
B
"CHOOSE_AUDIO_TRACK"="Выберите аудио поток";
...
...
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