How to use kinvey-nativescript-sdk - 10 common examples

To help you get started, we’ve selected a few kinvey-nativescript-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NativeScript / nativescript-app-templates / packages / template-master-detail-kinvey-ng / src / app / shared / kinvey.common.ts View on Github external
import { Kinvey } from "kinvey-nativescript-sdk";

import { Config } from "./config";

/* ***********************************************************
* The {N} Kinvey plugin initialization is explained in the plugin readme here:
* http://devcenter.kinvey.com/nativescript/guides/getting-started#ConfigureYourApp
* In this template, Kinvey is set up with a custom existing project, so that
* You can build and run this template without creating your own Kinvey project.
*************************************************************/

Kinvey.init({
    appKey: Config.kinveyAppKey,
    appSecret: Config.kinveyAppSecret
});
github NativeScript / nativescript-app-templates / packages / template-enterprise-auth-ng / src / app / app.module.ts View on Github external
@NgModule({
    bootstrap: [
        AppComponent
    ],
    imports: [
        NativeScriptModule,
        AppRoutingModule,

        /* ***********************************************************
        * The {N} Kinvey plugin initialization is explained in the plugin readme here:
        * http://devcenter.kinvey.com/nativescript/guides/getting-started#ConfigureYourApp
        * In this template, Kinvey is set up with a custom existing project, so that
        * You can build and run this template without creating your own Kinvey project.
        *************************************************************/
        KinveyModule.init()
    ],
    declarations: [
        AppComponent
    ],
    providers: [
        LoggedInLazyLoadGuard
    ],
    schemas: [
        NO_ERRORS_SCHEMA
    ]
})
export class AppModule { }
github NativeScript / nativescript-app-templates / packages / template-health-survey-ng / src / app / app.module.ts View on Github external
// TODO: should be imported from kinvey-nativescript-sdk/angular but declaration file is currently missing
import { KinveyModule } from "kinvey-nativescript-sdk/lib/angular";

import { Config } from "./shared/config";
import { AppRoutingModule } from "./app-routing.module";
import { AppComponent } from "./app.component";
import { LoggedInLazyLoadGuard } from "./logged-in-lazy-load.guard";

@NgModule({
    bootstrap: [
        AppComponent
    ],
    imports: [
        NativeScriptModule,
        AppRoutingModule,
        KinveyModule.init({
            appKey: Config.kinveyAppKey,
            appSecret: Config.kinveyAppSecret
        })
    ],
    declarations: [
        AppComponent
    ],
    providers: [
        LoggedInLazyLoadGuard
    ],
    schemas: [
        NO_ERRORS_SCHEMA
    ]
})
export class AppModule { }
github NativeScript / nativescript-app-templates / packages / template-master-detail-kinvey-ng / src / app / app.module.ts View on Github external
@NgModule({
    bootstrap: [
        AppComponent
    ],
    imports: [
        NativeScriptModule,
        AppRoutingModule,

        /* ***********************************************************
        * The {N} Kinvey plugin initialization is explained in the plugin readme here:
        * http://devcenter.kinvey.com/nativescript/guides/getting-started#ConfigureYourApp
        * In this template, Kinvey is set up with a custom existing project, so that
        * You can build and run this template without creating your own Kinvey project.
        *************************************************************/
        KinveyModule.init({
            appKey: Config.kinveyAppKey,
            appSecret: Config.kinveyAppSecret
        })
    ],
    declarations: [
        AppComponent
    ],
    schemas: [
        NO_ERRORS_SCHEMA
    ]
})
export class AppModule { }
github NativeScript / nativescript-app-templates / packages / template-master-detail-kinvey / app / shared / kinvey.common.js View on Github external
const Kinvey = require("kinvey-nativescript-sdk");

const config = require("./config");

/* ***********************************************************
* The {N} Kinvey plugin initialization is explained in the plugin readme here:
* http://devcenter.kinvey.com/nativescript/guides/getting-started#ConfigureYourApp
* In this template, Kinvey is set up with a custom existing project, so that
* You can build and run this template without creating your own Kinvey project.
*************************************************************/
Kinvey.init({
    appKey: config.kinveyAppKey,
    appSecret: config.kinveyAppSecret
});
github NativeScript / nativescript-app-templates / packages / template-enterprise-auth / app / shared / kinvey.common.js View on Github external
const Kinvey = require("kinvey-nativescript-sdk");

/* ***********************************************************
* The {N} Kinvey plugin initialization is explained in the plugin readme here:
* http://devcenter.kinvey.com/nativescript/guides/getting-started#ConfigureYourApp
* In this template, Kinvey is set up with a custom existing project, so that
* You can build and run this template without creating your own Kinvey project.
*************************************************************/
Kinvey.init();
github NativeScript / nativescript-app-templates / packages / template-master-detail-kinvey-ts / app / cars / shared / car-service.ts View on Github external
];

export class CarService {
    static getInstance(): CarService {
        return CarService._instance;
    }

    private static _instance: CarService = new CarService();

    private static cloneUpdateModel(car: Car): object {
        // tslint:disable-next-line:ban-comma-operator
        return editableProperties.reduce((a, e) => (a[e] = car[e], a), { _id: car.id });
    }

    private allCars: Array = [];
    private carsStore = DataStore.collection("cars");

    constructor() {
        if (CarService._instance) {
            throw new Error("Use CarService.getInstance() instead of new.");
        }

        CarService._instance = this;
    }

    load(): Promise {
        return this.login().then(() => {
            return this.carsStore.sync();
        }).then(() => {
            const sortByNameQuery = new Query();
            sortByNameQuery.ascending("name");
            const stream = this.carsStore.find(sortByNameQuery);
github NativeScript / nativescript-app-templates / packages / template-master-detail-kinvey-ng / cars / shared / car.service.ts View on Github external
"luggage",
    "name",
    "price",
    "seats",
    "imageUrl"
];

@Injectable()
export class CarService {
    private static cloneUpdateModel(car: Car): object {
        // tslint:disable-next-line:ban-comma-operator
        return editableProperties.reduce((a, e) => (a[e] = car[e], a), { _id: car.id });
    }

    private allCars: Array = [];
    private carsStore = Kinvey.DataStore.collection("cars");

    getCarById(id: string): Car {
        if (!id) {
            return;
        }

        return this.allCars.filter((car) => {
            return car.id === id;
        })[0];
    }

    load(): Observable {
        return new Observable((observer: any) => {
            this.login().then(() => {
                return this.carsStore.sync();
            }).then(() => {
github NativeScript / nativescript-app-templates / packages / template-enterprise-auth-ts / app / login / login-view-model.ts View on Github external
login() {
        let activeUser = Kinvey.User.getActiveUser();
        if (activeUser == null) {
            Kinvey.User.loginWithMIC()
                .then((user: Kinvey.User) => {
                    activeUser = user;
                    this.navigateHome(activeUser);
                    console.log("user: " + JSON.stringify(user));
                })
                .catch((error: Kinvey.BaseError) => {
                    alert("An error occurred. Check your Kinvey settings.");
                    console.log("error: " + error);
                });
        } else {
            this.navigateHome(activeUser);
        }
    }
github NativeScript / nativescript-app-templates / packages / template-enterprise-auth-ts / app / login / login-view-model.ts View on Github external
login() {
        let activeUser = Kinvey.User.getActiveUser();
        if (activeUser == null) {
            Kinvey.User.loginWithMIC()
                .then((user: Kinvey.User) => {
                    activeUser = user;
                    this.navigateHome(activeUser);
                    console.log("user: " + JSON.stringify(user));
                })
                .catch((error: Kinvey.BaseError) => {
                    alert("An error occurred. Check your Kinvey settings.");
                    console.log("error: " + error);
                });
        } else {
            this.navigateHome(activeUser);
        }
    }