Skip to content
 
 

Repository files navigation

Instructure Android

Instructure's Open Source Android Code

The open source code provided by the Android Team at Instructure.

Local fork changes

This fork adds support for signing in to unofficial or self-hosted Canvas LMS instances with a user-generated Canvas access token.

Login with user token

A new Login with user token option is available from the login landing page in the Student, Teacher, and Parent apps. This option is intended for personal or self-hosted Canvas use cases where the instance is not part of Instructure's official mobile login discovery and mobile_verify flow.

The new flow accepts:

  1. A Canvas base URL, such as https://canvas.example.edu or https://canvas.example.edu:8443
  2. A Canvas access token generated by the user from Canvas Approved Integrations

The app uses the supplied token as a Canvas Open API bearer token. It validates the token by calling the existing Canvas API client for the current user, then stores the successful session in the same shared login preferences used by the rest of the app.

Files added for this flow:

  • libs/login-api-2/src/main/java/com/instructure/loginapi/login/activities/BaseLoginWithTokenActivity.kt
  • libs/login-api-2/src/main/res/layout/activity_login_with_token.xml
  • apps/student/src/main/java/com/instructure/student/activity/LoginWithTokenActivity.kt
  • apps/teacher/src/main/java/com/instructure/teacher/activities/LoginWithTokenActivity.kt
  • apps/parent/src/main/java/com/instructure/parentapp/features/login/LoginWithTokenActivity.kt

Files updated for this flow:

  • libs/login-api-2/src/main/java/com/instructure/loginapi/login/activities/BaseLoginLandingPageActivity.kt
  • libs/login-api-2/src/main/res/layout/activity_login_landing_page.xml
  • libs/login-api-2/src/main/res/layout-land/activity_login_landing_page.xml
  • libs/login-api-2/src/main/res/values/strings.xml
  • Student, Teacher, and Parent login landing activities
  • Student, Teacher, and Parent Android manifests

Important behavior:

  • The regular school-search login path is unchanged.
  • The token login path skips Instructure's official school discovery and mobile_verify check.
  • The URL is normalized to a Canvas host and protocol; https is used when no protocol is supplied.
  • Host ports are preserved, so self-hosted instances on non-standard ports can be used.
  • The token is stored as the session's Canvas API access token.
  • Logging out currently follows the existing app logout behavior, which revokes the stored Canvas token through Canvas when possible. For a manually generated Approved Integrations token, that means Canvas may delete the token and the user may need to generate a new one.

Build script updates

This fork also includes Gradle compatibility fixes needed by newer Gradle and Kotlin plugin versions:

  • libs/instui/build.gradle.kts was migrated from deprecated kotlinOptions.jvmTarget configuration to the Kotlin compilerOptions DSL.
  • The InstUI token generation task was split so dependency installation is a separate Exec task instead of calling the protected exec {} method from inside another task.
  • apps/build.gradle configures the wrapper task outputs to point at the real wrapper files under ../gradle. This avoids Gradle trying to write wrapper files under apps/gradle when that path is checked out as a symlink placeholder file on Windows.

Building

Run ./open_source.sh once. You may now use Gradle to build the apps.

Student, Teacher and native Parent

  1. Open apps/build.gradle in Android Studio
    Android Studio > Import Project > canvas-android/apps/build.gradle
    
  2. Select the app from the list of configurations
  3. Tap 'Run' (^R) to run the app
App Command Build Status
Student ./gradle/gradlew -p apps :student:assembleDevDebug Student
Teacher ./gradle/gradlew -p apps :teacher:assembleDevDebug Teacher
Parent ./gradle/gradlew -p apps :parent:assembleDevDebug Parent

Running tests

To run unit tests for Student, Teacher and native Parent

  1. Open the Build Variants window and set the variant to qaDebug for the app that you wish to test.
  2. You can run the tests by tapping on the play button next to the test case or the test class.

Applications:

The Applications we have published on Google Play.

App Description
Canvas Student Used by Students all over the world to be smarter, go faster, and do more.
Canvas Teacher User by Teachers all over the world to update course content or grade on the go.
Canvas Parent Used by Parents all over the world to be parents.

Modules:

These are things that we use internally to create our applications.

Module Description
annotations A wrapper for the PSPDFKit library and logic for annotation handling and converting in PDF documents.
buildSrc Library for common gradle dependencies and gradle transformers that are used by the project.
canvas-api-2 Canvas for Android Api used to talk to the Canvas LMS and is testable.
dataseedingapi gRPC wrapper for Canvas that enables creating data to test the apps.
espresso The UI testing library built on Espresso.
horizon Canvas Career experience for the Student app.
interactions Interactions for navigation used in the apps.
login-api-2 The libarary used to make logging in and getting a token relative easy and is testable.
pandares Collection of resources used in our apps.
pandautils The core library for the apps. All the common code is implemented here that is reused by the 3 apps.
rceditor A wrapper for rich content editing used in our apps.
recyclerview A fancy RecyclerView library that supports expanding and collapsing, pagination, and stuff like that. (deprecated)

Our applications are licensed under the GPLv3 License.

Copyright (C) 2016 - present  Instructure, Inc.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

Our Modules are licensed under the Apache v2 License.

Copyright (C) 2016 - present Instructure, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

Canvas Android apps

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages