Skip to content

Commit

Permalink
Merge pull request #119 from tunapanda/auto_update_ver
Browse files Browse the repository at this point in the history
update version in cordova config on build, also add version into to login and settings pages
  • Loading branch information
usernamenumber authored Oct 26, 2016
2 parents 0c2b00d + ff2dd38 commit 812dcc5
Show file tree
Hide file tree
Showing 16 changed files with 184 additions and 130 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# custom config
/config/local.js
/config/custom/*
/cordova/config.xml
/public/assets/custom/*

# compiled output
/dist
Expand Down
3 changes: 1 addition & 2 deletions app/pods/application/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export default Ember.Route.extend(ApplicationRouteMixin, {

storeXAPIStatement(user, statement_data) {
console.log("Storing xapi statement");
console.log(statement);
this.store.createRecord('x-api-statement', {
content: statement_data,
user: user
Expand Down Expand Up @@ -165,7 +164,7 @@ export default Ember.Route.extend(ApplicationRouteMixin, {
return statement_data;
});
} else {
resolve(statement_data);
return statement_data;
}
});
},
Expand Down
2 changes: 1 addition & 1 deletion app/pods/components/add-book/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</div>
<div class="modal-body">
{{#if isIdle}}
<p>Enter the code from your teacher to start the download:</p>
<p>Enter the code for your book (ask your teacher if you don't know it)</p>
{{#if hint}}
<p>{{hint}}</p>
{{/if}}
Expand Down
2 changes: 2 additions & 0 deletions app/pods/login/controller.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import Ember from 'ember';
import ENV from 'funzo-app/config/environment';

export default Ember.Controller.extend({
session: Ember.inject.service('session'),
ENV: ENV,

actions: {
selectUser(model) {
Expand Down
3 changes: 2 additions & 1 deletion app/pods/login/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="row">
<div class="col-md-offset-3 col-md-6">
<div class="certel-logo text-center">
<img src="assets/Certell-Logo-2.svg" alt="Logo" >
<img src="{{ENV.APP.logo}}" alt="Logo" >
</div>
{{!-- <h1 class="text-center">Welcome</h1> --}}
<h4 class="text-center"></h4>
Expand All @@ -22,4 +22,5 @@
<div class="row get-started">
<div class="col-md-12 text-center"><button class="btn btn-primary btn-raised btn-lg" onclick={{action 'getStarted'}}>Get Started <i class="material-icons">chevron_right</i></button></div>
</div>
<div class="footer">v{{ENV.APP.version}}</div>
</div>
3 changes: 3 additions & 0 deletions app/pods/settings/controller.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Ember from 'ember';
import ENV from 'funzo-app/config/environment';

function toArray(list) {
return Array.prototype.slice.call(list || [], 0);
Expand Down Expand Up @@ -69,6 +70,8 @@ function loadCourse(coursesPath, name, store) {
}

export default Ember.Controller.extend({
ENV: ENV,

init() {
if (window.cordova) {
if (window.cordova.file.externalRootDirectory) {
Expand Down
3 changes: 3 additions & 0 deletions app/pods/settings/template.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<div>
<strong>Account Type: </strong> {{if currentUser.model.isTeacher 'Teacher' 'Student'}}
</div>
<div>
<strong>App Version: </strong> {{ENV.APP.version}}
</div>
{{#if currentUser.model.isTeacher}}
<h2>Manage Courses</h2>
<button class="btn btn-primary btn-raised" {{action 'addCourse'}}>Import From URL</button>
Expand Down
7 changes: 7 additions & 0 deletions app/styles/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,13 @@ blockquote {
}
}

.footer {
width: 100%;
text-align: center;
font-size: 80%;
color: lightgray;
}

.alert {
font-weight: 500;
}
Expand Down
28 changes: 0 additions & 28 deletions config/TEMPLATE-local.js

This file was deleted.

49 changes: 49 additions & 0 deletions config/custom/TEMPLATE-local.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Create a copy of this file called `config/custom.js` and modify it for your project.
// You can also make environment-specific settings (for example, if you want to
// use a different xAPI record store for production than development) by
// creating a `config/custom/prodution.js` (or development.js, or whatever)
// and running all your ember and cordova commands with
// --environment=production (or development, or whatever).
module.exports = {
update_env: function(app) {
// Basic information for your app
app.name = 'My App';
app.description = 'Powered by Tunapanda Funzo (http://tunapanda.org)'
app.version = '0.0.1';
app.author = {
name: "Your Name",
email: "[email protected]",
website: "http://yourdomain.com"
};

// For a custom logo, place an image in public/assets/custom/logo.png
// and uncomment the next line.
//app.logo = 'assets/custom/logo.png',

// The key used to encrypt your book content. This can be
// any string, but must match the key specified in the
// book.json for your book, or the app will not be able
// to read it.
app.encryptionKeyBase = 'abc123';

// URL of the location from which books can be downloaded
app.bookURLBase = 'http://example.com/books';

// Authentication information for an xAPI learning record
// store (e.g. LearningLocker) to which the app can send
// activity reports.
app.xAPI.recordStores = [{
endpoint: 'https://example.com/lrs',
username: 'XXXX',
password: 'YYYY',
allowFail: false
}];
// Number of decimal places to get from lat/long values
// 3 decimal places = accuracy to ~ 100 meters
// 2 would be closer to ~ 1km
// More details: http://gis.stackexchange.com/questions/8650/measuring-accuracy-of-latitude-and-longitude
// -1 disables location data in xapi reports
app.xAPI.gps_accuracy: -1;
return app;
}
}
47 changes: 23 additions & 24 deletions config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ for (var dev in ifaces) {

module.exports = function(environment) {
var ENV = {
test: "testfoo",
modulePrefix: 'funzo-app',
podModulePrefix: 'funzo-app/pods',
environment: environment,
Expand All @@ -28,31 +27,38 @@ module.exports = function(environment) {
},

APP: {
// This should match the version number in cordova/config.xml
version: '1.0.4',
name: 'My Funzo App (OVERRIDE IN config/custom/default.js)',
description: 'Made with Funzo (github.com/tunapanda/funzo-app)',
logo: 'assets/funzologo.png',
version: '0.0.1',
author: {
name: "OVERRIDE IN config/custom/default.js",
email: "OVERRIDE IN config/custom/default.js",
website: "OVERRIDE IN config/custom/default.js"
},
bookOnlyMode: true,
defaultBook: false,
// Set this to false to have no default
defaultBook: {
code: 'demo',
hint: 'enter code "demo" to download an example book'
},
encryptionKeyBase: 'OVERRIDE IN config/local.js',
encryptionKeyBase: 'OVERRIDE IN config/custom/default.js',
// For directories, be sure to include a trailing '/'!
bookURLBase: 'OVERRIDE IN config/local.js',
bookURLBase: 'OVERRIDE IN config/custom/default.js',
xAPI: {
recordStores: [{
endpoint: 'OVERRIDE IN config/local.js',
username: 'OVERRIDE IN config/local.js',
password: 'OVERRIDE IN config/local.js',
endpoint: 'OVERRIDE IN config/custom/default.js',
username: 'OVERRIDE IN config/custom/default.js',
password: 'OVERRIDE IN config/custom/default.js',
allowFail: false
}],
// Number of decimal places to get from lat/long values
// 3 decimal places = accuracy to ~ 100 meters
// 2 would be closer to ~ 1km
// More details: http://gis.stackexchange.com/questions/8650/measuring-accuracy-of-latitude-and-longitude
// -1 disables location data in xapi reports
gps_accuracy: 2
gps_accuracy: -1
}
},

Expand Down Expand Up @@ -102,28 +108,21 @@ module.exports = function(environment) {
}

if (environment === 'staging') {
ENV.apiUrl = 'http://funzo-app-staging.herokuapp.com/api/v1';
ENV.staging = true;
}

if (environment === 'production') {
ENV.apiUrl = 'http://funzo-app.herokuapp.com/api/v1';
ENV.production = true;
}

try {
var override = require('./local.js');
if (typeof(override) !== "undefined") {
ENV = override.update_env(ENV);
}
} catch(e) {}

try {
var local = require('./' + environment + '.js');
if (typeof(override) !== "undefined") {
ENV = override.update_env(ENV);
}
} catch(e) {}
[ 'default', environment ].forEach((fn) => {
try {
var override = require('./custom/'+fn+'.js');
if (typeof(override) !== "undefined") {
ENV.APP = override.update_config(ENV.APP);
}
} catch(e) {}
});

return ENV;
};
Loading

0 comments on commit 812dcc5

Please sign in to comment.