crux-bphc / cms-android Goto Github PK
View Code? Open in Web Editor NEWA custom Moodle app for the students of BITS Pilani, Hyderabad Campus.
License: MIT License
A custom Moodle app for the students of BITS Pilani, Hyderabad Campus.
License: MIT License
In the cases where a Progress Dialog is being displayed, it is leaking the window when a new Activity is opened.
Logs for the dialog after TokenActivity
: (This may not be the only usage. Fix all of them)
E/WindowManager: android.view.WindowLeaked: Activity crux.bphc.cms.TokenActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{2a5d01ea V.E..... R......D 0,0-684,232} that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:520)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:287)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
at android.app.Dialog.show(Dialog.java:325)
at crux.bphc.cms.TokenActivity.showProgress(TokenActivity.java:137)
at crux.bphc.cms.TokenActivity.onClickLogin(TokenActivity.java:85)
at crux.bphc.cms.TokenActivity_ViewBinding$2.doClick(TokenActivity_ViewBinding.java:45)
at butterknife.internal.DebouncingOnClickListener.onClick(DebouncingOnClickListener.java:22)
at android.view.View.performClick(View.java:5246)
at android.widget.TextView.performClick(TextView.java:10573)
at android.view.View$PerformClick.run(View.java:21256)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6918)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
This should be easily fixed either by making sure that the dialog is properly being terminated before the new Activity intent is called, or by using a library like LovelyDialog that properly handles the Windows and simplifies the process to a simple function call.
Fixing the bug without adding the library is preferred in order to keep unnecessary dependencies to the minimum. However, it is fine to use it if the custom Dialog implementation is getting complicated.
This issue was faced by a user not registered in any courses. He circumvented the issue by enrolling via the website, after which the app functioned normally. The attached logs were provided by him.
As per the relevant code in CourseRequestHandler
, in the case of no courses being registered, the responseString
should be []
(an empty JSON Array) and is parsed correctly. Bug could not be replicated with another account, which was not registered in any courses. Unclear why it might have happened to him.
Should be fixed if the problem becomes clearer. Replicating the request which causes this wrong response to be returned, and then printing it, would be an ideal way to go about this.
Taking the example of the Graph & Theory course, opening the T2 marks excel file (in the app) does not download and open that file.
It instead opens the already downloaded T1 marks excel file. Most likely reason for this is as both file names have same name.
The job is currently built with setPersisted(true)
and the required permissions in the Manifest. However, it does not seem to be restarting on its own after device reboot. Opening the app manually may or may not be restarting the service correctly.
Some StackOverflow answers suggest that an additional broadcast receiver class is needed, with the corresponding intent filters declared in the Manifest. While we have a DeviceRebootReceiver
the manifest entries are commented and it does not seem to be working.
All these cases must be tested, and if not necessary, the files and Manifest entries must be removed.
Earlier, the only forum available was "Site News" and hence all attachments to a Discussion
were saved in the hard-coded "Site News" folder. Recently, the app was improved to be able to support any course forums. However, the files are still saved in the "Site News" folder.
This bug does not break the app unless there are multiple files of the same name across courses (probably not even then), but it does undermine the directory structure being maintained.
To fix it, pass along the course name to the DiscussionFragment
when it is constructed. For the site news, it will remain "Site News", while for others it will be the name of the course (as is currently being passed in the ModulesAdapter
class). Thus, the files will be saved in the proper folders.
Ask the user to provide Moodle mobile web service token form Preferences > Security Keys (as of Moodle 3.4). Log out the user if the token is reset by the user.
The OS/Phone is restricting background process.
The id's of webpage elements remain same, however, it is unable to run javascript on the webpage
People can comment the features they would like in next update
The folder contents and description need to be listed separately.
A new activity (on-click the module) listing the contents.
Currently, when a folder is clicked all its contents are downloaded/opened recursively.
the search is indexed by pages, and for the final page, there is an empty array returned.
& appears as ย
solution, use Html.fromHtml() whenever using setText in the app.
Secondary solution, create a custom TextView, extending TextView, and override its setText() method.
Use this custom TextView for almost all places in app.
Secondary solution would be more elegant
Module assignment & quiz can have following functionalities as of now -
These features will require web connectivity.
Each course has it's own "Mark All as Read" option in the overflow menu that marks all of it's modules as seen. However, if there are a number of unread notifications across courses, it becomes tedious to navigate into each of them to mark them as read.
Add a menu option to the "My Courses" screen which recursively marks all modules of all courses as read. Since the screen is displayed as a fragment on MainActivity
, care should be taken so that the menu is only visible for this fragment, where it is relevant, and not to other fragments.
The Http get request can be used to get the user's course list.
userid and token is stored in user's database.
Corresponds to version: 7
Relevant Lines in log:
at crux.bphc.cms.fragments.ForumFragment$4.onResponse (ForumFragment.java:187)
Full log:
at crux.bphc.cms.fragments.ForumFragment$4.onResponse (ForumFragment.java:187)
at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run (ExecutorCallAdapterFactory.java:70)
at android.os.Handler.handleCallback (Handler.java:790)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loop (Looper.java:164)
at android.app.ActivityThread.main (ActivityThread.java:6753)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:482)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:807)
When filter is on and internet request finishes, all the courses appear on screen.
The courses returned via API is not to be directly added to course list but to be passed through filter
The standard Discussion
s in a Forum
are in descending order of time i.e. latest on top. Opening the ForumFragment
and fetching the discussions uses a paginated call that returns them in this sorted order.
On the other hand, the "refresh" options in both the CourseSectionFragment
and MyCoursesFragment
use a call that retrieves all discussions at once. Examining the response on Postman shows that these are also sorted.
However, in the app, refreshing on the CourseSectionFragment
and then loading cached data of a Forum (by disconnecting from the internet before navigating there) shows that they are not in proper order. This is not seen when reloading from MyCoursesFragment
for some reason, even though the code is exactly the same.
This is not a major bug yet, but it is better to look into the network calls and Realm calls so that any future bugs can be prevented.
Since the CMS api url has been changed from https://id.bits-hyderabad.ac.in/ to https://td.bits-hyderabad.ac.in/. Due to this, the network calls are returning error responses.
Add the description of file module in UI.
Currently, only the file name is displayed.
Currently the swipe-to-refresh on the main screen only refreshes the list of courses. To refresh any posts, one must navigate to the course and refresh there.
Adding an option to refresh all courses on the main screen (either in the menu, or by modifying the swipe-to-refresh functn.) would be quite useful. The relevant code can be taken from the existing notification service, and should be executed within an AsyncTask. Notifications should not be generated when the user manually starts the sync in this manner.
basically we can download in folders - CourseName/section/file
According to this article Google Sign-In support for embedded web views was removed since sometime last year. However, for some reason I've only noticed this issue recently in our app. Possibly because of the limited usages of our web view.
The article is a couple of years old, but offers alternatives that might still be relevant. Additional research will be needed. The primary objective is to replace all Web View usages in the application that require OAuth.
The simplest way is to find all usages of the WebView in the app, and shift it to use the browser instead. This should only be a temporary and last resort measure.
The ideal way is to find the proper API calls on the Moodle Service and handle them using token authentication, as with the rest of the app.
Where I found this error (not an exhaustive list):
Show password button on the login activity , is not working .
The Notification Channels in Oreo allow great customization and granularity of control to the user. Providing a channel for each course rather than a common "Updates" channel would allow them to assign a lower priority to courses they aren't interested in, or a higher importance level to others.
Creating channels is relatively simple. One only needs to fetch the course list from the server, and create channels for each course with the Channel ID string being, for example, the course ID which is unique and won't have problematic characters. The course name can be assigned as the title.
When a user leaves a course, the channel will not be of use any longer. While leaving it around isn't a big deal considering that users enroll in a limited number of courses, it is inelegant. However, deletion of channels is logged in the Settings page as "x channels deleted". This is visible to the user, and Google may decide to add some anti-spam policies in the future. Thus, unlike Realm, we cannot clear all the channels and make them according to the server response.
In addition, creation of channels should take place such that the failure of a server response doesn't impact it. Thus, points such as the NotifService and the MainActivity should be handling the creation, just before showing notifications or just after syncing courses.
add a more/less html hyperlink type text for expanding/contracting description UI
Prevent from launching a new task, or clear previous task
A lot of users expressed irritation at the almost constantly visible notification that we display when running the NotificationService
foreground service. According to the docs, a ForegroundService
is only needed when either the job is something the user should be aware of, or if it provides any interactive controls (ex: the music player notification lets us change the song).
Our update requirements match that of background services, and hence we are already using the JobScheduler
to periodically repeat the update calls to the server.
The foreground service notif is currently in a separate channel with IMPORTANCE_MIN
and doesn't create any sound. However, hiding it will make the system display a notif that says "CMS BPHC is using the battery" which is undesirable.
Possible ways to resolve the issue would be:
Letting the job run without using startForeground()
as is being done currently, and test if it still works properly. If it does, the issue is resolved.
Reduce the number of times the user sees this notification.
The default job timeout is 5 hours, using an exponential backoff strategy. Given the spotty internet on campus, multiple jobs might be executing as soon as the device gets connected, leading to longer display time. Setting the timeout to something like 1 hour or lesser should fix this. The periodic nature of the job is not affected by this.
Unable to open a file from app, some changes in Android N.
Github supports setting base templates for newly created issues and pull requests. Having well structured templates will ensure that necessary details aren't left out.
Issues should have the following:
For bugs:
For new feature requests / Current feature enhancements:
Pull Requests should have the following:
.docx files shows as no application found to open the file, where as it opens from file manager
If I missed out a feature please comment.
Presently it searches all files in CMS directory. It should search only in the specified course directory.
Topic: CMS BPHC
Project:
As of now users get notification for every registered courses. The Plan is to add functionality so that students can select courses for which they would like to receive notifications.
The notifications are provided by running a background service periodically using IntentService. Apply the same logic using Firebase JobScheduler.
(Optional, if time permits): Shift to MVP architecture.
Skills Required: RecyclerView, Realm Database, Retrofit2, IntentService.
Optional Skills (for 3rd point): RxJava, Dagger2
A SpannableString is a set a contentText to the notification
Reproducing the issue:
Site News > Select any one to get into detail view > (without pressing back button) open navigation drawer and select My Courses
Expected Behaviour:
Both My Courses fragment and SiteNews fragment should not overlap, only MyCourses fragment should be visible.
The individual notifications are shown properly without the groupNotifications(notificationSet)
method. But while grouping notifications it sometimes happens that some of the active previous notifications are getting cancelled and some of them are getting repeated multiple times.
It downloads a .html page. Intead, we must open the link in WebView
Corresponds to version: 7
Relevant line in log:
at crux.bphc.cms.fragments.ForumFragment$4.onFailure (ForumFragment.java:233)
Full log:
java.lang.NullPointerException:
at android.widget.Toast.<init> (Toast.java:103)
at android.widget.Toast.makeText (Toast.java:256)
at crux.bphc.cms.fragments.ForumFragment$4.onFailure (ForumFragment.java:233)
at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$2.run (ExecutorCallAdapterFactory.java:79)
at android.os.Handler.handleCallback (Handler.java:754)
at android.os.Handler.dispatchMessage (Handler.java:95)
at android.os.Looper.loop (Looper.java:163)
at android.app.ActivityThread.main (ActivityThread.java:6228)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:794)
Add Travis CI and update the build tools of the project which is made mandatory in Android Studio 3.1 (latest stable version).
Let's say a file with name 'x.pdf' is downloaded in 'A' course. If there is another file with the same name in course 'B' the ModulesAdapter shows it as downloaded and clicking on eye icon doesn't open the file.
User can mark a module as unread. (in more options menu)
The Get req
'forumid is 1 for site news'
New feature, Low priority
Figuring out the endpoint and listening there would make it possible to send notifications about the notices too. Plus, making the user go to the browser and sign in is bad UX, especially since auto-login isn't working.
Somehow marking new contents in courses. color, bold, etc
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.