-
Notifications
You must be signed in to change notification settings - Fork 35
Problems
#PageViewController + Multiple UIScrollView issues fixed & refactored There is a problem in WebStepViewController. When the text of the step is wider than the screen size, the content is not scrolling. There is no such problem in release 1.1, because there are no multiple UIScrollViews used to present a step.
The text of the lesson can contain images, rich text and even LaTeX formulas. Sometimes LaTeX formulas and code can be wider than the screen, like this. At first this seemed as an easy task. The expected behavior is described on the following screenshots.
On the first screenshot you can see a code, which has a long line. The user should have the possibility to scroll it and then swipe to the next «step» of the lesson.
UIWebView contains an inner UIScrollView, which, when content reaches it's end horizontally, allows parent to scroll content, so UIPageView UIPanGestureRecognizer is fired and everything works smoothly.
The mechanic is nearly the same, but the parent is another UIScrollView used to display both text and quiz. So there is no UIPageView UIPanGestureRecognizer fired.
Here is the commit, which fixed this bad behavior. And here is a code, refactored in a helper. The core idea is to add the third UIPanGestureRecognizer, which will handle all pan gestures and decide if it should be fired simultaneously with the recognizer of either UIPageViewController or UIWebView's UIScrollView. Also offsets should be counted precisely.
Notifications with logout PR
When user logs out, he doesn't want to receive any notifications. Analysis of some popular applications like VK and Twitter has shown that there is no simple solution. VK does not allow user to logout if the unsubscribe request can't be sent, Twitter still receives notifications in case of the offline logout.
To unsubscribe from the notifications on the server side, the client sends DELETE request to API. If there is no connection, no request is being sent and the client continues receiving pushes from server.
The solution is to make some queue of persistent tasks, which is executed when some event happens. In our case it is an ExecutionQueue object, which consists of DeleteDeviceExecutableTask objects, stored and recovered with a PersistentRecoveryManager's subclass - PersistentTaskRecoveryManager. The solution allows to execute any persistent task for any event type. So, further, there could be easily implemented some "killer features", such as sending offline submissions.