Skip to content
This repository has been archived by the owner on Dec 18, 2019. It is now read-only.

docs: Cordova code samples reflecting aerogear-js-sdk changes in API #603

Merged
Merged
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
2 changes: 1 addition & 1 deletion modules/ROOT/pages/_partials/conf-dev-env-cordova.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ const aerogearConfig = {
// Replace with your own configuration
};

init(aerogearConfig);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO this is just showing that our flow and documentation snippets are really confusing. It's almost impossible to find that info (and I know about it). Documentation for this part should be included in each individual SDK so I do not need to jump and find how to configure things. Adding as placeholder for myself to improve stuff afetr.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wtrocki yes, you're right ;)
we should revisit this change

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree this needs to be called out in each as our documentation flow doesn't ever get to this point see #654

const app = init(aerogearConfig);
----
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Import and initialize Auth:
----
const Auth = require('@aerogear/auth').Auth;

const authService = new Auth();
const authService = new Auth(app.config);
const initOptions = { onLoad: "login-required" };

authService.init(initOptions)
Expand Down
4 changes: 2 additions & 2 deletions modules/ROOT/pages/_partials/push/coding.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ const push = PushNotification.init({
// Registration handler
push.on('registration', data => {
// PushRegistration is part of @aerogear/push
new PushRegistration().register(data.registrationId).then(() => {
new PushRegistration(app.config).register(data.registrationId).then(() => {
// Registration with UPS successful, you can now send push notifications from the UPS UI
}).catch(err => {
// Error on device registration
Expand All @@ -218,7 +218,7 @@ const pushObject = new Push().init({
});

pushObject.on('registration').subscribe(data => {
new PushRegistration().register(data.registrationId).then(() => {
new PushRegistration(app.config).register(data.registrationId).then(() => {
// Registration with UPS successful, you can now send push notifications from the UPS UI
}).catch(err => {
//Error on device registration
Expand Down
2 changes: 1 addition & 1 deletion modules/ROOT/pages/_partials/security/coding.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ $ cordova plugin add @aerogear/cordova-plugin-aerogear-security
----
const SecurityService = require("@aerogear/security");

const securityService = new SecurityService();
const securityService = new SecurityService(app.metrics);
----
+
NOTE: Any new instantiation of `SecurityService` returns the same instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Cordova::

[source, javascript]
----
new SecurityService()
new SecurityService(app.metrics)
.check(DeviceCheckType.rootEnabled)
.then(result => {
// Handle the security result metric
Expand Down Expand Up @@ -148,7 +148,7 @@ Cordova::
--
[source, javascript]
----
new SecurityService()
new SecurityService(app.metrics)
.check(DeviceCheckType.debugModeEnabled)
.then(result => {
// Handle the security result metric
Expand Down Expand Up @@ -211,7 +211,7 @@ Cordova::
--
[source, javascript]
----
new SecurityService()
new SecurityService(app.metrics)
.check(DeviceCheckType.isEmulator)
.then(result => {
// Handle the security result metric
Expand Down Expand Up @@ -266,7 +266,7 @@ Cordova::
NOTE: For iOS devices this check requires iOS 8 or above.
[source, javascript]
----
new SecurityService()
new SecurityService(app.metrics)
.check(DeviceCheckType.screenLockEnabled)
.then(result => {
// Handle the security result metric
Expand Down Expand Up @@ -603,7 +603,7 @@ class CustomDeviceCheck implements DeviceCheck {
+
[source, javascript]
----
const securityService = new SecurityService();
const securityService = new SecurityService(app.metrics);

securityService.check(new CustomDeviceCheck())
.then(result => {
Expand Down Expand Up @@ -710,7 +710,7 @@ Report individual checks via the `checkAndPublishMetric` method:

[source, javascript]
----
new SecurityService()
new SecurityService(app.metrics)
.checkAndPublishMetric(DeviceCheckType.rootEnabled)
.then(result => {
// Handle the security result metric
Expand All @@ -722,7 +722,7 @@ Or alternatively report multiple checks using the `checkManyAndPublishMetric` me

[source, javascript]
----
new SecurityService()
new SecurityService(app.metrics)
.checkManyAndPublishMetric(
DeviceCheckType.rootEnabled,
DeviceCheckType.isEmulator,
Expand Down
2 changes: 1 addition & 1 deletion not-published/cordova/adding-security-checks.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ You will also need to retrieve an instance of `SecurityService`:

[source,javascript]
----
const securityService = new SecurityService();
const securityService = new SecurityService(app.metrics);
----

=== Provided Self Defence Checks
Expand Down