GithubHelp home page GithubHelp logo

crux-bphc / cms-android Goto Github PK

View Code? Open in Web Editor NEW
28.0 28.0 39.0 15.66 MB

A custom Moodle app for the students of BITS Pilani, Hyderabad Campus.

License: MIT License

Java 16.61% Kotlin 83.39%
android moodle

cms-android's People

Contributors

abhijeetviswa avatar anotherpopoua avatar aoudiamoncef avatar arjav2002 avatar aryanarora180 avatar ashwik avatar codernotfound avatar f2k1de avatar fynngodau avatar harsu-ag avatar justaghost23 avatar nitish7134 avatar plaidbait91 avatar prat-bphc52 avatar shriakhilc avatar skrpl avatar soumitradev avatar vaishnavishri avatar vineeth07 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cms-android's Issues

Already downloaded file is opened if file name is same

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.

Individual Notification channels for each course

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.

Disallowed User Agent error for WebViews

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):

  • The links to 'View on Website', both inside courses and in the nav bar.

Course's sections and files

  • Basic backend
  • Saving files on click
  • Allow a complete section download
  • detect already downloaded files and open the file on click instead of re-downloading
  • UI
  • Offline availability (Realm)

basically we can download in folders - CourseName/section/file

The Get Req

File module

Add the description of file module in UI.
Currently, only the file name is displayed.

My courses filter

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

Hide the "Course contents being updated" notification

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:

  1. 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.

  2. 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.

Parse all texts using Html.fromHtml()

& 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

Manual "Sync All" option

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.

JsonSyntaxException crash on empty course list

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.

cms logs

Winter of Code Project Idea

Topic: CMS BPHC
Project:

  1. 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.

  2. The notifications are provided by running a background service periodically using IntentService. Apply the same logic using Firebase JobScheduler.

  3. (Optional, if time permits): Shift to MVP architecture.
    Skills Required: RecyclerView, Realm Database, Retrofit2, IntentService.
    Optional Skills (for 3rd point): RxJava, Dagger2

"Mark All as Read" option for Courses

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.

Feature List (Update 1)

  • Number of notices not viewed counter (something like unread messages)
  • Auto download courses(selected courses)
  • Option to select courses for which we need notifications

People can comment the features they would like in next update

NullPointerException at ForumFragment.onResponse()

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)

Feature list (1st release)

  • Login
  • User course List
  • Course section
  • Download/open a file
  • Identify as already downloaded
  • Filter through user's courses
  • Search CMS
  • Push Notification
  • Open in Webview with auto login

If I missed out a feature please comment.

Window leaks on Progress Dialog display

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.

Folder Module

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.

Mark as unread

User can mark a module as unread. (in more options menu)

Add templates for Issues and Pull Requests

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:

  • Description of the error faced (mandatory)
  • Logs, in case of crash (if available)
  • Screenshots (if applicable)
  • Expected resolution (if any decisions involved, apart from fixing the crash itself)

For new feature requests / Current feature enhancements:

  • Description of the feature needed (mandatory)
  • Current state of the feature

Pull Requests should have the following:

  • Link to the corresponding issue that is to be closed
  • Overview of method used to fix the bug
  • Mention why a particular implementation was picked, in case multiple options existed.

Verify NotificationService reboot persistence

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.

Add Travis CI

Add Travis CI and update the build tools of the project which is made mandatory in Android Studio 3.1 (latest stable version).

opening .docx files

.docx files shows as no application found to open the file, where as it opens from file manager

Unusual Forum Ordering

The standard Discussions 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.

Mod Assign & mod quiz

Module assignment & quiz can have following functionalities as of now -

  • Add daily reminder
  • Redirect to website(not including the add/see file)
  • Submission status
  • Grades

These features will require web connectivity.

Try integrating announcements/notices into app

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.

NullPointerException at ForumFragment.onFailure()

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)

All forums save downloaded files into the same folder

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.

Fragment Overlapping

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.

User Course list

The Http get request can be used to get the user's course list.

userid and token is stored in user's database.

  • Basic backend
  • Filter
  • Swipe to refresh
  • Offline availability
  • UI

ClassCastException while casting SpannableString to String

A SpannableString is a set a contentText to the notification

.setContentText(Html.fromHtml( notificationSet.getContentText()))

which is then retried and cast as String in
String stackNotificationLine = (String) activeSbn.getNotification().extras.get(NotificationCompat.EXTRA_TEXT);

But a ClassCastException is thrown while doing it.

Bug while grouping notifications

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.

Search Feature

The get req

the search is indexed by pages, and for the final page, there is an empty array returned.

  • Search basic backend
  • support for pagination (auto download when user reaches near end)
  • UI
  • redirect to same course detail activity

Site news

  • add a new section in navigation bar
  • Basic back end
  • UI
  • Download attachments

The Get req
'forumid is 1 for site news'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.