• Stars
    star
    728
  • Rank 59,727 (Top 2 %)
  • Language
    Swift
  • License
    GNU Affero Genera...
  • Created about 5 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Canvas iOS apps

Canvas iOS Apps

Getting Started on Development

  1. Clone the repository
git clone [email protected]:instructure/canvas-ios.git
  1. Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. CD to the project root folder to install project dependencies defined in the Brewfile
make provision
  1. CD to the project root folder to generate project files and build yarn dependencies
make sync

Troubleshooting

make sync error

If you run into the error xcrun: error: SDK "iphoneos" cannot be located`.

Set Xcode Command Line Tools:

 sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

NPM error

If you have an NPM related error try installing watchman directly.

brew install watchman

and then run

sudo launchctl limit maxfiles 16384 16384 && ulimit -n 16384

Secrets

Any static keys, tokens, passwords, or other secrets that need to be available in the app bundle should be added as a case to Secret.swift.

The secrets necessary for a particular build are generated as data assets using a script.

yarn build-secrets "studentPSPDFKitLicense=token1" "teacherPSPDFKitLicense=token2"

You will need to purchase PSPDFKitLicenses to distribute custom apps. Instructure's licenses are only used for official builds and are not included in the repository.

Debugging Redux

To get redux logs you can add redux-logger as a middleware to the redux store.

We don't want to keep the logger in because it slows down the runtime quite a lot.

In src/redux/store.js

import logger from 'redux-logger'

let middleware = [promiseMiddleware, errorHandler, createPersisteMiddleware(500), logger]

The redux logs will now show up in the React Native Debugger.

Contributing Guiding Principles

Simple

Writing an app is complex. Decisions made from the beginning have a big impact on the end result.

We strive to maintain a simple architecture that is easy to understand and pick up. Someone familiar with the platform should be productive within a single day.

Code should be self-documenting and easy to follow.

Ugly code is easy to recognize and its cost is easy to estimate. Neither is true for a wrong abstraction.
- Dan Abramov

Easy to Debug

Surprise! Apps have bugs. Industry average is 15-50 defects per 1000 lines of code.

We build our apps in a way that makes finding and fixing issues is as easy as possible.

Testable

Writing code in a testable way is paramount for long term success. These apps are built in a way that makes our unit testing surface as large as possible.

Conventions

We make and keep strong conventions in order to reduce mental overhead.

No Tricky Stuff

We do things the Apple prescribed way because it offers the best long term predictability with minimal maintenance.

Fat Model, Thin Controller

Models & Presenters handle as much of the business logic as possible. This allows a wide unit testing surface. Views & View Controllers should be as small as possible.

Predictable

By scrutinizing each dependency we bring in, the code we write is our responsibility. Unit tests are a key portion of the code we write, so as time passes, the code that worked 2 years ago still works today.

Automation

We don't do any manual QA of our products. We write code that tests our apps for us.

Prune Legacy Code

😬 One day React Native, Cocoapods, and other old frameworks will be fully replaced by the swift architecture in Core. Eventually. Hopefully. 🀞

Using the Canvas Apps

How to connect to a local canvas instance or a Portal instance

https://instructure.atlassian.net/wiki/spaces/MOBILE/pages/563937366/Manual+Oauth+Login+Bypassing+mobile+verify

If you are connecting to a portal instance you must be connected to the VPN. This requires Full VPN tunnel and not just the typical Employee VPN connection. After you hit connect in the Cisco VPN client to connect to vpn.instructure.com there will be a drop down where you can select Full Tunnel

Generating icons from instructure.design

Most, if not all of the icons used in the Canvas apps can be found in instructure-icons, but are defined as React components, SVG, & Sketch files. Since iOS does not handle SVG files in UIImageViews natively, these are converted to PDF.

yarn build-icons

Generating code coverage report

You can generate code coverage reports with yarn coverage --scheme <SCHEME>

Student

yarn coverage --scheme Student

Core

yarn coverage --scheme Core

To run tests first use yarn test

yarn test --scheme Core
Option Description
scheme The scheme to run against
os Specify simulator os. Only available when running tests

Open Source Licenses Used

We have a script that should ensure the correct license header comments are in place:

yarn update-headers

Our applications are licensed under the AGPLv3 License.

This file is part of Canvas.
Copyright (C) 2019-present  Instructure, Inc.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

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 Affero General Public License for more details.

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

MDM Configurations

MDM Profile settings are saved in UserDefaults.standard and keyed by com.apple.configuration.managed. These logins are added to the list of previous logins on the start screen.

Use our MDMManager to observe changes such as managed logins.

You can test this locally with command line arguments.

Scheme > Edit Scheme > Run > Arguments > Arguments Passed on Launch

-com.apple.configuration.managed '<dict><key>enableLogin</key><true/><key>users</key><array><dict><key>host</key><string>canvas.instructure.com</string><key>username</key><string>student</string><key>password</key><string>Canvas2019</string></dict></array></dict>'

Change the username, password, and host to your test credentials. You can also add host and authenticationProvider strings to the top level dict to skip the "Find my school" screen during login.

More Repositories

1

canvas-lms

The open LMS by Instructure, Inc.
Ruby
4,978
star
2

pdf-annotate.js

Annotation layer for pdf.js (no longer maintained)
JavaScript
527
star
3

instructure-ui

A UI Component Library made by Instructure, Inc.
TypeScript
425
star
4

CKRefreshControl

A pull-to-refresh view for iOS 5, 100% API-compatible with UIRefreshControl in iOS 6
Objective-C
291
star
5

ims-lti

A Ruby library to help implement IMS LTI tool consumers and providers
Ruby
187
star
6

ic-ajax

ember-friendly jQuery.ajax wrapper
JavaScript
167
star
7

paseto

A paseto implementation in rust.
Rust
150
star
8

dynamo-local-admin-docker

A combined docker image with DynamoDB-Local and dynamo-admin.
126
star
9

canvas-android

Canvas Android apps
Kotlin
114
star
10

aws-keychain-util

A small command-line utility to help manage AWS credentials in the OS X keychain.
Ruby
71
star
11

ic-tabs

JavaScript
66
star
12

i18nema

fast i18n backend that doesn't stop up the garbage collector
C
65
star
13

ic-modal

Ember component for modal dialog
JavaScript
62
star
14

switchman

Ruby
60
star
15

ic-autocomplete

accessible ember autocomplete component
JavaScript
57
star
16

canvas-data-cli

Command line tool to connect and download files from Canvas Data
JavaScript
56
star
17

common-cartridge-viewer

View Common Cartridges in the browser
JavaScript
56
star
18

vector

Auto Scaling Groups helper
Ruby
53
star
19

dockerfiles

base docker images and files used by Instructure
Dockerfile
50
star
20

CanvasAPI

Canvas by Instructure library for Android 2.3 +
Java
48
star
21

ic-menu

accessible popup menu component
JavaScript
45
star
22

outrigger

tag your migrations
Ruby
37
star
23

ruby-saml2

SAML 2.0 Library for Ruby
Ruby
37
star
24

dress_code

CSS Documentation and Styleguide Generator
Ruby
36
star
25

CanvasKit

Canvas library for Cocoa.
Objective-C
34
star
26

android-ImageSweep

Python script used to remove all unused image resources.
Python
33
star
27

pandarus

A Ruby library for the Canvas API (and code generator for other languages, eventually)
Ruby
33
star
28

lti1_tool_provider_example

A simple LTI Tool Provider Sinatra app
HTML
33
star
29

straitjacket

a restricted code execution framework
JavaScript
32
star
30

analytics

The official analytics package for Instructure's Canvas LMS.
Ruby
31
star
31

lti_example

an example of using LTI and the Outcomes Service in Instructure Canvas
Ruby
31
star
32

rollcall-attendance

An attendance LTI tool that integrates with Canvas
Ruby
26
star
33

ic-droppable

Ember Component Mixin that wraps native drop events. No longer maintained.
JavaScript
26
star
34

lti_tool_provider_example

This is a basic and simple LTI Tool Provider that uses the [ims-lti](https://github.com/instructure/ims-lti) 2.0.0.beta gem.
Ruby
25
star
35

inst-jobs

Instructure-maintained fork of delayed_job
Ruby
25
star
36

canvas-hosted-data-examples

Collection of examples that use Canvas Hosted Data to answer questions.
23
star
37

i18nliner

I18n made simple
Ruby
23
star
38

tinymce-a11y-checker

An accessibility checker plugin for TinyMCE.
JavaScript
22
star
39

ic-styled

automatically style components with css templates
JavaScript
21
star
40

rack-lti

Rack middleware supporting LTI (http://www.imsglobal.org/toolsinteroperability2.cfm) integration.
Ruby
21
star
41

once-ler

rspec supercharger
Ruby
21
star
42

CheckYourSSeLf

A friendly Slack bot that checks your Amazon AWS accounts for expiring SSL certificates.
Ruby
20
star
43

lti_tool_consumer_example

A simple LTI Tool Consumer Sinatra app
Ruby
20
star
44

instructure-icons

DEPRECATED: see instructure-ui
JavaScript
19
star
45

canvas-rce-api

JavaScript
17
star
46

canvas-data-loader

An Example Application to download data from Canvas Data, and import it into a Database.
Rust
17
star
47

canvas-contrib

No longer supported, see https://github.com/kajigga/canvas-contrib
Visual Basic
16
star
48

ic-ember

library of instructure ember stuff
CSS
16
star
49

tinymce-mediauploader

Media Uploader plugin for TinyMCE
JavaScript
16
star
50

guardrail

ActiveRecord extension to allow multiple database environments (secondary, deploy) enabling least privilege when possible.
Ruby
16
star
51

contests

repository for coding contest problems
JavaScript
15
star
52

aws_dcos_terraform

Terraform modules for DC/OS
HCL
12
star
53

lti-public-resources-eak

Public Resources LTI App (using Ember App Kit)
JavaScript
12
star
54

canvas-alexa-lambda

Instructure's Alexa lambda interface for Canvas-LMS
JavaScript
12
star
55

soap4r-middleware

Expose a soap4r server endpoint using Rack middleware
Ruby
11
star
56

QTIMigrationTool

Source code and software for converting QTI version 1.x data into QTI 2.0 content packages.
Python
11
star
57

mathman

A simple lambda function that converts LaTeX formulae to MathML and SVG.
JavaScript
11
star
58

goro

Four arms for your RSpec.
JavaScript
10
star
59

after_transaction_commit

ActiveRecord::Base.connection.after_transaction_commit { ... }
Ruby
9
star
60

codewarden

a coding competition host
Python
9
star
61

ftl-engine

Build and execute workflows, parallel and safe
TypeScript
9
star
62

dashed_map

Ruby
9
star
63

gergich

Command-line tool for adding Gerrit comments
Ruby
9
star
64

pygmy

mysql -> postgres data migrator
Ruby
8
star
65

fukuzatsu

Ruby
8
star
66

moodle2cc

Convert Moodle 1.9 backup files to Common Cartridge .imscc files
Ruby
7
star
67

lti2_reference_tool_provider

LTI2.1 Tool Provider reference implementation
Ruby
7
star
68

lti_provider_engine

LtiProvider is a mountable engine for handling the LTI launch and exposing LTI parameters in your rails app.
Ruby
7
star
69

folio

Folio is a library for pagination. It's meant to be nearly compatible with WillPaginate, but with broader -- yet more well-defined -- semantics to allow for sources whose page identifiers are non-ordinal.
Ruby
7
star
70

ddb-sync

ddb-sync is a tool used for syncing data from a set of source tables to a set of destination tables in DynamoDB. It's configurable to perform backfill operations, stream consumptions or both by CLI or config file.
Go
7
star
71

qti

Ruby
6
star
72

MinecraftLTI

An LTI tool for integrating Minecraft with LMS applications.
Java
6
star
73

ic-sortable

JavaScript
6
star
74

apollo-link-deep-dedup

Apollo Link for combining queries and issuing minimal requests.
TypeScript
6
star
75

yard-api

A YARD plugin for documenting APIs in Rails projects.
CSS
6
star
76

canvas-app

A quick-start tool for building a front-end app within Canvas
JavaScript
6
star
77

ic-data

Ember Data models, serializers, and adapters for working with the canvas API
JavaScript
6
star
78

ic-buttonset

An accessible, Bootstrap-friendly buttonset component for Ember.js
JavaScript
6
star
79

color-slicer

Generate lists of readable text colors.
JavaScript
6
star
80

canvas_connect

Adobe Connect plugin for Canvas LMS.
Ruby
6
star
81

steps-selective-builds

Bitrise step for selective builds (mono repo support)
Shell
5
star
82

ic-lazy-list

lazily loads remote records
JavaScript
5
star
83

canvas_cc

Ruby
5
star
84

common_cartridge

A ruby library for parsing IMS Common Cartridge files
Ruby
4
star
85

SwiftUITest

Swift UI testing framework
Swift
4
star
86

canvas_oauth_engine

mountable engine to provide canvas OAuth flow in a rails app + canvas api helpers
Ruby
4
star
87

xml_security

Ruby bindings into the XMLSec Library. Work in progress!
C
4
star
88

tf_versioned_lambda

tf_versioned_lambda
HCL
4
star
89

BukkitLTI

An LTI tool plugin for Bukkit.
Java
4
star
90

mobile-shared

Shared open source code for Instructure's mobile apps published as artifacts.
Kotlin
4
star
91

canvas-studio-api-examples

useful example scripts for the Studio team and account administrators to access the public API of Canvas Studio
Python
4
star
92

academic_benchmarks

This repo houses the source code for the academic_benchmarks gem in use by canvas. It implements v3 of the Academic Benchmarks API.
Ruby
4
star
93

api-client-builder

Ruby
3
star
94

expo-ui-test

A quick demo app to test automation with an Expo app
Objective-C
3
star
95

jqui-datepicker

ember component that wraps jquery-ui datepicker
JavaScript
3
star
96

lti_docs

CSS
3
star
97

learn_lti_engine

Rails engine for the Learn LTI course (LTI app)
Ruby
3
star
98

tinymce-light-skin

JavaScript
3
star
99

pandapush

Browser-based, multi-tenant, pub/sub service
JavaScript
3
star
100

bundler-multilock

Support multiple lockfiles
Ruby
3
star