Skip to content

Commit

Permalink
dep(dev): bump @cordova/eslint-config@^4.0.0 w/ fixes (#144)
Browse files Browse the repository at this point in the history
* dep: bump @cordova/eslint-config@^4.0.0
* chore(eslint): update rule w/ auto applied fix
* chore(eslint): fix disabled line
  • Loading branch information
erisu authored Nov 13, 2021
1 parent aa42eac commit 7e15e2d
Show file tree
Hide file tree
Showing 7 changed files with 6,497 additions and 2,786 deletions.
1 change: 1 addition & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ globals:
cordova: true
rules:
indent: ["error", 2]
no-var: 0

overrides:
- files: [spec/**/*.js, example/server/**/*.js]
Expand Down
38 changes: 19 additions & 19 deletions example/server/pushADM.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

// Client ID and Client Secret received from ADM
// For more info, see: https://developer.amazon.com/public/apis/engage/device-messaging/tech-docs/02-obtaining-adm-credentials
var CLIENT_ID = 'amzn1.application-oa2-client.8e838f6629554e26ae3f43a6c663cd60';
var CLIENT_SECRET = '0af96083320f5d70dc4f358cc783ac65a22e78b297ba257df34d5f723f24543f';
const CLIENT_ID = 'amzn1.application-oa2-client.8e838f6629554e26ae3f43a6c663cd60';
const CLIENT_SECRET = '0af96083320f5d70dc4f358cc783ac65a22e78b297ba257df34d5f723f24543f';

// Registration ID, received on device after it registers with ADM server
var REGISTRATION_IDS = ['amzn1.adm-registration.v2.Y29tLmFtYXpvbi5EZXZpY2VNZXNzYWdpbmcuUmVnaXN0cmF0aW9uSWRFbmNyeXB0aW9uS2V5ITEhOE9rZ2h5TXlhVEFFczg2ejNWL3JMcmhTa255Uk5BclhBbE1XMFZzcnU1aFF6cTlvdU5FbVEwclZmdk5oTFBVRXVDN1luQlRSNnRVRUViREdQSlBvSzRNaXVRRUlyUy9NYWZCYS9VWTJUaGZwb3ZVTHhlRTM0MGhvampBK01hVktsMEhxakdmQStOSXRjUXBTQUhNU1NlVVVUVkFreVRhRTBCYktaQ2ZkUFdqSmIwcHgzRDhMQnllVXdxQ2EwdHNXRmFVNklYL0U4UXovcHg0K3Jjb25VbVFLRUVVOFVabnh4RDhjYmtIcHd1ZThiekorbGtzR2taMG95cC92Y3NtZytrcTRPNjhXUUpiZEk3QzFvQThBRTFWWXM2NHkyMjdYVGV5RlhhMWNHS0k9IW5GNEJMSXNleC9xbWpHSU52NnczY0E9PQ'];
const REGISTRATION_IDS = ['amzn1.adm-registration.v2.Y29tLmFtYXpvbi5EZXZpY2VNZXNzYWdpbmcuUmVnaXN0cmF0aW9uSWRFbmNyeXB0aW9uS2V5ITEhOE9rZ2h5TXlhVEFFczg2ejNWL3JMcmhTa255Uk5BclhBbE1XMFZzcnU1aFF6cTlvdU5FbVEwclZmdk5oTFBVRXVDN1luQlRSNnRVRUViREdQSlBvSzRNaXVRRUlyUy9NYWZCYS9VWTJUaGZwb3ZVTHhlRTM0MGhvampBK01hVktsMEhxakdmQStOSXRjUXBTQUhNU1NlVVVUVkFreVRhRTBCYktaQ2ZkUFdqSmIwcHgzRDhMQnllVXdxQ2EwdHNXRmFVNklYL0U4UXovcHg0K3Jjb25VbVFLRUVVOFVabnh4RDhjYmtIcHd1ZThiekorbGtzR2taMG95cC92Y3NtZytrcTRPNjhXUUpiZEk3QzFvQThBRTFWWXM2NHkyMjdYVGV5RlhhMWNHS0k9IW5GNEJMSXNleC9xbWpHSU52NnczY0E9PQ'];

// Message payload to be sent to client
var payload = {
const payload = {
data: {
message: 'PushPlugin works!!',
sound: 'beep.wav',
Expand All @@ -22,8 +22,8 @@ var payload = {

//* ********************************

var https = require('https');
var querystring = require('querystring');
const https = require('https');
const querystring = require('querystring');

if (CLIENT_ID === '' || CLIENT_SECRET === '' || REGISTRATION_IDS.length === 0) {
console.log('******************\nSetup Error: \nYou need to edit the pushADM.js file and enter your ADM credentials and device registration ID(s).\n******************');
Expand All @@ -32,8 +32,8 @@ if (CLIENT_ID === '' || CLIENT_SECRET === '' || REGISTRATION_IDS.length === 0) {

// Get access token from server, and use it to post message to device
getAccessToken(function (accessToken) {
for (var i = 0; i < REGISTRATION_IDS.length; i++) {
var registrationID = REGISTRATION_IDS[i];
for (let i = 0; i < REGISTRATION_IDS.length; i++) {
const registrationID = REGISTRATION_IDS[i];

postMessage(accessToken, registrationID, payload);
}
Expand All @@ -45,16 +45,16 @@ getAccessToken(function (accessToken) {
function getAccessToken (callback) {
console.log('Requesting access token from server...');

var credentials = {
const credentials = {
scope: 'messaging:push',
grant_type: 'client_credentials',
client_id: CLIENT_ID,
client_secret: CLIENT_SECRET
};

var post_data = querystring.stringify(credentials);
const post_data = querystring.stringify(credentials);

var post_options = {
const post_options = {
host: 'api.amazon.com',
port: '443',
path: '/auth/O2/token',
Expand All @@ -64,16 +64,16 @@ function getAccessToken (callback) {
}
};

var req = https.request(post_options, function (res) {
var data = '';
const req = https.request(post_options, function (res) {
let data = '';

res.on('data', function (chunk) {
data += chunk;
});

res.on('end', function () {
console.log('\nAccess token response:', data);
var accessToken = JSON.parse(data).access_token;
const accessToken = JSON.parse(data).access_token;
callback(accessToken);
});
});
Expand All @@ -96,11 +96,11 @@ function postMessage (accessToken, registrationID, payload) {

console.log('\nSending message...');

var post_data = JSON.stringify(payload);
const post_data = JSON.stringify(payload);

var api_path = '/messaging/registrations/' + registrationID + '/messages';
const api_path = '/messaging/registrations/' + registrationID + '/messages';

var post_options = {
const post_options = {
host: 'api.amazon.com',
port: '443',
path: api_path,
Expand All @@ -114,8 +114,8 @@ function postMessage (accessToken, registrationID, payload) {
}
};

var req = https.request(post_options, function (res) {
var data = '';
const req = https.request(post_options, function (res) {
let data = '';

res.on('data', function (chunk) {
data += chunk;
Expand Down
8 changes: 4 additions & 4 deletions example/server/pushAzure.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
** TodoItem product
** https://azure.microsoft.com/en-us/documentation/articles/app-service-mobile-cordova-get-started/
*/
var azureMobileApps = require('azure-mobile-apps');
var logger = require('azure-mobile-apps/src/logger');
const azureMobileApps = require('azure-mobile-apps');
const logger = require('azure-mobile-apps/src/logger');

// Create a new table definition
var table = azureMobileApps.table();
const table = azureMobileApps.table();

// In the TodoItem product, sends a push notification
// when a new item inserted into the table.
Expand All @@ -19,7 +19,7 @@ table.insert(function (context) {
// Define the push notification template payload.
// Requires template specified in the client app. See
// https://azure.microsoft.com/en-us/documentation/articles/app-service-mobile-cordova-get-started-push/
var payload = '{"message": "' + context.item.text + '" }';
const payload = '{"message": "' + context.item.text + '" }';

// Execute the insert. The insert returns the results as a Promise,
// Do the push as a post-execute action within the promise flow.
Expand Down
Loading

0 comments on commit 7e15e2d

Please sign in to comment.