Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ionic deploy to version v5.0.9 #5

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,14 @@
<plugin name="edu.berkeley.eecs.emission.cordova.datacollection" spec="https://github.com/e-mission/e-mission-data-collection.git" />
<plugin name="edu.berkeley.eecs.emission.cordova.serversync" spec="https://github.com/e-mission/cordova-server-sync.git" />
<plugin name="edu.berkeley.eecs.emission.cordova.transitionnotify" spec="https://github.com/e-mission/e-mission-transition-notify.git" />
<plugin name="cordova-plugin-ionic" spec="~3.0.0">
<variable name="APP_ID" value="6ab82e2d" />
<plugin name="cordova-plugin-ionic" spec="^5.0.9">
<variable name="APP_ID" value="e0d8cdec" />
<variable name="CHANNEL_NAME" value="Production" />
<variable name="UPDATE_METHOD" value="none" />
<variable name="WARN_DEBUG" value="true" />
<variable name="UPDATE_API" value="https://api.ionicjs.com" />
<variable name="MAX_STORE" value="2" />
<variable name="MIN_BACKGROUND_DURATION" value="30" />
</plugin>
<plugin name="edu.berkeley.eecs.emission.cordova.auth" spec="https://github.com/e-mission/cordova-jwt-auth.git" />
<preference name="SplashShowOnlyFirstTime" value="false" />
Expand Down
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@
"edu.berkeley.eecs.emission.cordova.datacollection": {},
"edu.berkeley.eecs.emission.cordova.serversync": {},
"cordova-plugin-ionic": {
"APP_ID": "6ab82e2d",
"APP_ID": "e0d8cdec",
"CHANNEL_NAME": "Production",
"UPDATE_METHOD": "none"
"UPDATE_METHOD": "none",
"WARN_DEBUG": "true",
"UPDATE_API": "https://api.ionicjs.com",
"MAX_STORE": "2",
"MIN_BACKGROUND_DURATION": "30"
},
"edu.berkeley.eecs.emission.cordova.auth": {},
"cordova-plugin-whitelist": {},
Expand All @@ -50,7 +54,9 @@
"cordova-plugin-email-composer": "~0.8.12",
"cordova-plugin-file": "~6.0.1",
"cordova-plugin-inappbrowser": "https://github.com/shankari/cordova-plugin-inappbrowser.git",
"cordova-plugin-ionic": "~3.0.0",
"cordova-plugin-ionic": "^5.0.9",
"cordova-plugin-ionic-webview": "^2.1.0",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-whitelist": "~1.3.3",
"cordova-plugin-x-socialsharing": "~5.2.1",
"de.appplant.cordova.plugin.local-notification-ios9-fix": "https://github.com/shankari/cordova-plugin-local-notifications.git",
Expand Down
2 changes: 1 addition & 1 deletion www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com http://nominatim.openstreetmap.org https://e-mission.eecs.berkeley.edu https://api.ionic.io/push/tokens emission: 'unsafe-eval';
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com http://nominatim.openstreetmap.org https://e-mission.eecs.berkeley.edu https://api.ionicjs.com https://pro-deploy.ionicjs.com emission: 'unsafe-eval';
style-src 'self' 'unsafe-inline';
script-src 'self' 'unsafe-inline' 'unsafe-eval';
img-src 'self' data: http://*.tile.openstreetmap.org http://tile.stamen.com https://*.tile.stamen.com http://*.tile.stamen.com
Expand Down
55 changes: 17 additions & 38 deletions www/js/splash/updatecheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@ angular.module('emission.splash.updatecheck', ['emission.plugin.logger',
Logger.log("currChannel == null, skipping deploy init");
return Promise.resolve(null);
} else {
return new Promise(function(resolve, reject) {
var config = {
appId: "e0d8cdec",
channel: currChannel
}
deploy.init(config, resolve, reject);
});
var config = {
appId: "e0d8cdec",
channel: currChannel
}
return deploy.configure(config);
}
};

Expand All @@ -52,44 +50,27 @@ angular.module('emission.splash.updatecheck', ['emission.plugin.logger',

uc.checkPromise = function() {
var deploy = $window.IonicCordova.deploy;
return new Promise(function(resolve, reject) {
deploy.check(resolve, reject);
});
return deploy.checkForUpdate();
};

uc.downloadPromise = function() {
var deploy = $window.IonicCordova.deploy;
return new Promise(function(resolve, reject) {
deploy.download(function(res) {
if(res == 'true') {
resolve(res);
} else {
updateProgress(res);
}
}, reject);
return deploy.downloadUpdate(function(res) {
updateProgress(res);
});
};

uc.extractPromise = function() {
var deploy = $window.IonicCordova.deploy;
return new Promise(function(resolve, reject) {
deploy.extract(function(res) {
console.log("extract progress = "+res);
var expectedResult = $window.cordova.platformId == "ios"? "done": "true";
if(res == expectedResult) {
resolve(res);
} else {
updateProgress(res);
}
}, reject);
return deploy.extractUpdate(function(res) {
console.log("extract progress = "+res);
updateProgress(res);
});
};

uc.redirectPromise = function() {
var deploy = $window.IonicCordova.deploy;
return new Promise(function(resolve, reject) {
deploy.redirect(resolve, reject);
});
return deploy.reloadApp();
};

uc.handleClientChangeURL = function(urlComponents) {
Expand All @@ -106,7 +87,7 @@ angular.module('emission.splash.updatecheck', ['emission.plugin.logger',
uc.checkForUpdates();
};

// Default to dev
// Default to blank == Production
var getChannelToUse = function() {
var channel = uc.getChannel();
if (channel == null || channel == "") {
Expand All @@ -117,9 +98,6 @@ angular.module('emission.splash.updatecheck', ['emission.plugin.logger',
return channel;
}

var showProgressDialog = function(title) {
}

var applyUpdate = function() {
if ($rootScope.isDownloading) {
return;
Expand All @@ -132,6 +110,7 @@ angular.module('emission.splash.updatecheck', ['emission.plugin.logger',
buttons: []
});
uc.downloadPromise().then(function() {
Logger.log("downloadPromise resolved!!");
$rootScope.progress = 0;
downloadPop.close();
// alert("download -> extract");
Expand Down Expand Up @@ -162,9 +141,9 @@ angular.module('emission.splash.updatecheck', ['emission.plugin.logger',
var currChannel = getChannelToUse();
uc.setChannelPromise(currChannel).then(function() {
Logger.log("deploy init complete ");
uc.checkPromise().then(function(hasUpdate) {
Logger.log('Ionic Deploy: Update available: ' + hasUpdate);
if (hasUpdate == 'true') {
uc.checkPromise().then(function(updateResponse) {
Logger.log('Ionic Deploy: Update available: ' + JSON.stringify(updateResponse));
if (updateResponse.available == true) {
Logger.log('Ionic Deploy: found update, asking user: ');

$ionicPopup.show({
Expand Down