Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
VLC-iOS
Commits
968fa93d
Commit
968fa93d
authored
Jan 04, 2015
by
Felix Paul Kühne
Browse files
cloud services: correctly implement OneDrive session state
parent
a53e2d1d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Sources/VLCCloudServicesTableViewController.m
View file @
968fa93d
...
...
@@ -54,16 +54,23 @@
}
-
(
void
)
viewWillAppear
:(
BOOL
)
animated
{
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
authenticationSessionsChanged
:
)
name
:
VLCOneDriveControllerSessionUpdated
object
:
nil
];
[
self
.
tableView
reloadData
];
[
super
viewWillAppear
:
animated
];
}
-
(
void
)
goBack
{
[[
NSNotificationCenter
defaultCenter
]
removeObserver
:
self
];
VLCAppDelegate
*
appDelegate
=
[
UIApplication
sharedApplication
].
delegate
;
[[
appDelegate
revealController
]
toggleSidebar
:
!
[
appDelegate
revealController
].
sidebarShowing
duration
:
kGHRevealSidebarDefaultAnimationDuration
];
}
-
(
void
)
authenticationSessionsChanged
:(
NSNotification
*
)
notification
{
[
self
.
tableView
reloadData
];
}
#pragma mark - Table view data source
-
(
NSInteger
)
tableView
:(
UITableView
*
)
tableView
numberOfRowsInSection
:(
NSInteger
)
section
...
...
@@ -136,8 +143,6 @@
return
cell
;
}
#pragma mark - Table view delegate
-
(
NSIndexPath
*
)
tableView
:(
UITableView
*
)
tableView
willSelectRowAtIndexPath
:(
NSIndexPath
*
)
indexPath
...
...
Sources/VLCOneDriveController.h
View file @
968fa93d
...
...
@@ -13,6 +13,8 @@
#import "VLCOneDriveTableViewController.h"
#import "VLCOneDriveObject.h"
#define VLCOneDriveControllerSessionUpdated @"VLCOneDriveControllerSessionUpdated"
@protocol
VLCOneDriveControllerDelegate
<
NSObject
>
@required
...
...
Sources/VLCOneDriveController.m
View file @
968fa93d
...
...
@@ -95,20 +95,22 @@
{
APLog
(
@"OneDrive: authCompleted, status %i, state %@"
,
status
,
userState
);
if
(
status
==
1
&&
session
!=
NULL
&&
[
userState
isEqualToString
:
@"init"
])
if
(
session
!=
NULL
&&
[
userState
isEqualToString
:
@"init"
]
&&
status
==
1
)
_activeSession
=
YES
;
else
_activeSession
=
NO
;
if
(
status
==
1
&&
session
!=
NULL
&&
[
userState
isEqualToString
:
@"login"
])
if
(
session
!=
NULL
&&
[
userState
isEqualToString
:
@"login"
]
&&
status
==
1
)
_userAuthenticated
=
YES
;
else
if
(
status
==
0
)
{
_activeSession
=
NO
;
_userAuthenticated
=
NO
;
}
if
(
self
.
delegate
)
{
if
([
self
.
delegate
respondsToSelector
:
@selector
(
sessionWasUpdated
)])
[
self
.
delegate
performSelector
:
@selector
(
sessionWasUpdated
)];
}
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
VLCOneDriveControllerSessionUpdated
object
:
self
];
}
-
(
void
)
authFailed
:(
NSError
*
)
error
userState
:(
id
)
userState
...
...
@@ -120,6 +122,7 @@
if
([
self
.
delegate
respondsToSelector
:
@selector
(
sessionWasUpdated
)])
[
self
.
delegate
performSelector
:
@selector
(
sessionWasUpdated
)];
}
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
VLCOneDriveControllerSessionUpdated
object
:
self
];
}
-
(
void
)
liveOperationSucceeded
:(
LiveDownloadOperation
*
)
operation
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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