├── platforms
├── ios
│ └── Podfile
└── android
│ └── include.gradle
├── demo
├── app
│ ├── tests
│ │ ├── misc.d.ts
│ │ ├── 01-mobile-service-client.ts
│ │ ├── 02-mobile-service-push.ts
│ │ ├── 03-mobile-service-table.ts
│ │ └── 04-mobile-service-query.ts
│ ├── App_Resources
│ │ ├── iOS
│ │ │ ├── Assets.xcassets
│ │ │ │ ├── Contents.json
│ │ │ │ ├── AppIcon.appiconset
│ │ │ │ │ ├── icon-29.png
│ │ │ │ │ ├── icon-40.png
│ │ │ │ │ ├── icon-50.png
│ │ │ │ │ ├── icon-57.png
│ │ │ │ │ ├── icon-72.png
│ │ │ │ │ ├── icon-76.png
│ │ │ │ │ ├── icon-29@2x.png
│ │ │ │ │ ├── icon-29@3x.png
│ │ │ │ │ ├── icon-40@2x.png
│ │ │ │ │ ├── icon-40@3x.png
│ │ │ │ │ ├── icon-50@2x.png
│ │ │ │ │ ├── icon-57@2x.png
│ │ │ │ │ ├── icon-60@2x.png
│ │ │ │ │ ├── icon-60@3x.png
│ │ │ │ │ ├── icon-72@2x.png
│ │ │ │ │ ├── icon-76@2x.png
│ │ │ │ │ ├── icon-83.5@2x.png
│ │ │ │ │ └── Contents.json
│ │ │ │ ├── LaunchImage.launchimage
│ │ │ │ │ ├── Default.png
│ │ │ │ │ ├── Default@2x.png
│ │ │ │ │ ├── Default-568h@2x.png
│ │ │ │ │ ├── Default-667h@2x.png
│ │ │ │ │ ├── Default-736h@3x.png
│ │ │ │ │ ├── Default-Landscape.png
│ │ │ │ │ ├── Default-Portrait.png
│ │ │ │ │ ├── Default-Portrait@2x.png
│ │ │ │ │ ├── Default-Landscape@2x.png
│ │ │ │ │ ├── Default-Landscape@3x.png
│ │ │ │ │ └── Contents.json
│ │ │ │ ├── LaunchScreen.Center.imageset
│ │ │ │ │ ├── LaunchScreen-Center.png
│ │ │ │ │ ├── LaunchScreen-Center@2x.png
│ │ │ │ │ └── Contents.json
│ │ │ │ └── LaunchScreen.AspectFill.imageset
│ │ │ │ │ ├── LaunchScreen-AspectFill.png
│ │ │ │ │ ├── LaunchScreen-AspectFill@2x.png
│ │ │ │ │ └── Contents.json
│ │ │ ├── demo.entitlements
│ │ │ ├── build.xcconfig
│ │ │ ├── Info.plist
│ │ │ └── LaunchScreen.storyboard
│ │ └── Android
│ │ │ ├── drawable-hdpi
│ │ │ └── icon.png
│ │ │ ├── drawable-ldpi
│ │ │ └── icon.png
│ │ │ ├── drawable-mdpi
│ │ │ └── icon.png
│ │ │ ├── drawable-nodpi
│ │ │ └── splashscreen.9.png
│ │ │ ├── app.gradle
│ │ │ ├── google-services.json
│ │ │ └── AndroidManifest.xml
│ ├── references.d.ts
│ ├── vendor-platform.ios.ts
│ ├── bundle-config.ts
│ ├── app.css
│ ├── vendor.ts
│ ├── app.ts
│ ├── vendor-platform.android.ts
│ ├── package.json
│ ├── main-page.xml
│ └── main-page.ts
├── firebase.nativescript.json
├── references.d.ts
├── tsconfig.tns.json
├── .vscode
│ └── settings.json
├── typings
│ ├── assertion-error
│ │ └── assertion-error.d.ts
│ ├── mocha
│ │ └── mocha.d.ts
│ └── chai
│ │ └── chai.d.ts
├── tsconfig.json
├── package.json
├── karma.conf.js
└── webpack.config.js
├── push
├── package.json
├── push.d.ts
├── push-common.ts
├── push.android.ts
└── push.ios.ts
├── user
├── package.json
├── user.d.ts
├── user.ios.ts
├── user.android.ts
└── user-common.ts
├── query
├── package.json
├── query.d.ts
├── query-common.ts
├── query.android.ts
└── query.ios.ts
├── table
├── package.json
├── table.d.ts
├── table-common.ts
├── table.android.ts
└── table.ios.ts
├── client
├── package.json
├── client.d.ts
├── clientauth-app-delegate.ts
├── client-common.ts
├── client.android.ts
└── client.ios.ts
├── references.d.ts
├── azure-mobile-apps.d.ts
├── .vscode
├── settings.json
└── tasks.json
├── typings
└── com.google.common.d.ts
├── tsconfig.json
├── .gitignore
├── utils.d.ts
├── tslint.json
├── package.json
├── .travis.yml
├── utils.android.ts
├── utils.ios.ts
├── gruntfile.js
├── LICENSE
└── README.md
/platforms/ios/Podfile:
--------------------------------------------------------------------------------
1 | pod 'MicrosoftAzureMobile', '~> 3.4.0'
--------------------------------------------------------------------------------
/demo/app/tests/misc.d.ts:
--------------------------------------------------------------------------------
1 | declare const assert: Chai.AssertStatic;
--------------------------------------------------------------------------------
/push/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "push",
3 | "main": "push",
4 | "types": "push.d.ts"
5 | }
--------------------------------------------------------------------------------
/user/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "user",
3 | "main": "user",
4 | "types": "user.d.ts"
5 | }
--------------------------------------------------------------------------------
/query/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "query",
3 | "main": "query",
4 | "types": "query.d.ts"
5 | }
--------------------------------------------------------------------------------
/table/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "table",
3 | "main": "table",
4 | "types": "table.d.ts"
5 | }
--------------------------------------------------------------------------------
/client/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "client",
3 | "main": "client",
4 | "types": "client.d.ts"
5 | }
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/demo/firebase.nativescript.json:
--------------------------------------------------------------------------------
1 | {
2 | "external_push_client_only": true,
3 | "using_ios": true,
4 | "using_android": true
5 | }
--------------------------------------------------------------------------------
/demo/references.d.ts:
--------------------------------------------------------------------------------
1 | /// Needed for autocompletion and compilation.
--------------------------------------------------------------------------------
/references.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
--------------------------------------------------------------------------------
/demo/tsconfig.tns.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig",
3 | "compilerOptions": {
4 | "module": "es2015",
5 | "moduleResolution": "node"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/Android/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-ldpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/Android/drawable-ldpi/icon.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/Android/drawable-mdpi/icon.png
--------------------------------------------------------------------------------
/demo/app/references.d.ts:
--------------------------------------------------------------------------------
1 | /// Enable smart suggestions and completions in Visual Studio Code JavaScript projects.
2 |
3 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-nodpi/splashscreen.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/Android/drawable-nodpi/splashscreen.9.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png
--------------------------------------------------------------------------------
/demo/app/vendor-platform.ios.ts:
--------------------------------------------------------------------------------
1 | // There is a bug in angular: https://github.com/angular/angular-cli/pull/8589/files
2 | // Legendary stuff, its webpack plugin pretty much doesn't work with empty TypeScript files in v1.8.3
3 | void 0;
4 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png
--------------------------------------------------------------------------------
/azure-mobile-apps.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 | ///
4 | ///
5 | ///
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeterStaev/nativescript-azure-mobile-apps/HEAD/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/demo.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | aps-environment
6 | development
7 |
8 |
9 |
--------------------------------------------------------------------------------
/demo/app/bundle-config.ts:
--------------------------------------------------------------------------------
1 | if ((global as any).TNS_WEBPACK) {
2 | // registers tns-core-modules UI framework modules
3 | // tslint:disable-next-line:no-var-requires
4 | require("bundle-entry-points");
5 |
6 | // Views
7 | global.registerModule("main-page", () => require("./main-page"));
8 | }
9 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "files.exclude": {
3 | "**/.git": true,
4 | "**/.svn": true,
5 | "**/.hg": true,
6 | "**/CVS": true,
7 | "**/.DS_Store": true,
8 | "bin/**": true,
9 | "demo/**": true
10 | },
11 | "typescript.tsdk": "node_modules/typescript/lib"
12 | }
--------------------------------------------------------------------------------
/demo/app/app.css:
--------------------------------------------------------------------------------
1 | .title {
2 | font-size: 30;
3 | horizontal-align: center;
4 | margin: 20;
5 | }
6 |
7 | button {
8 | font-size: 32;
9 | horizontal-align: center;
10 | }
11 |
12 | .message {
13 | font-size: 20;
14 | color: #284848;
15 | horizontal-align: center;
16 | margin: 0 20;
17 | text-align: center;
18 | }
19 |
--------------------------------------------------------------------------------
/demo/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "files.exclude": {
3 | "**/.git": true,
4 | "**/.svn": true,
5 | "**/.hg": true,
6 | "**/CVS": true,
7 | "**/.DS_Store": true,
8 | "app/**/*.js": true,
9 | "app/**/*.js.map": true,
10 | "platforms": true
11 | },
12 | "typescript.tsdk": "node_modules/typescript/lib"
13 | }
--------------------------------------------------------------------------------
/demo/app/vendor.ts:
--------------------------------------------------------------------------------
1 | // Snapshot the ~/app.css and the theme
2 | const application = require("application");
3 | require("ui/styling/style-scope");
4 | const appCssContext = require.context("~/", false, /^\.\/app\.(css|scss|less|sass)$/);
5 | global.registerWebpackModules(appCssContext);
6 | application.loadAppCss();
7 |
8 | require("./vendor-platform");
9 |
10 | require("bundle-entry-points");
11 |
--------------------------------------------------------------------------------
/platforms/android/include.gradle:
--------------------------------------------------------------------------------
1 | dependencies {
2 | // Deps taken from https://github.com/Azure/azure-mobile-apps-android-client/blob/3.4.0/e2etest/build.gradle
3 | // since they are not correctly included in the AAR
4 | compile 'com.google.code.gson:gson:2.3'
5 | compile 'com.google.guava:guava:18.0'
6 | compile 'com.squareup.okhttp:okhttp:2.5.0'
7 | compile 'com.microsoft.azure:azure-mobile-android:3.4.0@aar'
8 | }
--------------------------------------------------------------------------------
/demo/app/app.ts:
--------------------------------------------------------------------------------
1 | import "./bundle-config";
2 |
3 | import * as application from "application";
4 |
5 | // This needs to be first as we override the whole app delegate!
6 | // Needed only if you are using authentication.
7 | require("nativescript-azure-mobile-apps/client").MobileServiceClient.configureClientAuthAppDelegate();
8 |
9 | require("nativescript-plugin-firebase");
10 |
11 | application.start({ moduleName: "main-page" });
12 |
--------------------------------------------------------------------------------
/demo/app/vendor-platform.android.ts:
--------------------------------------------------------------------------------
1 | require("application");
2 | if (!global["__snapshot"]) {
3 | // In case snapshot generation is enabled these modules will get into the bundle
4 | // but will not be required/evaluated.
5 | // The snapshot webpack plugin will add them to the tns-java-classes.js bundle file.
6 | // This way, they will be evaluated on app start as early as possible.
7 | require("ui/frame");
8 | require("ui/frame/activity");
9 | }
10 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/app.gradle:
--------------------------------------------------------------------------------
1 | // Add your native dependencies here:
2 |
3 | // Uncomment to add recyclerview-v7 dependency
4 | //dependencies {
5 | // compile 'com.android.support:recyclerview-v7:+'
6 | //}
7 |
8 | android {
9 | defaultConfig {
10 | generatedDensities = []
11 | applicationId = "inc.tangra.azuremobileservicessample"
12 | minSdkVersion 19
13 | }
14 | aaptOptions {
15 | additionalParameters "--no-version-vectors"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | // See https://go.microsoft.com/fwlink/?LinkId=733558
3 | // for the documentation about the tasks.json format
4 | "version": "2.0.0",
5 | "tasks": [
6 | {
7 | "type": "grunt",
8 | "task": "build",
9 | "problemMatcher": [
10 | "$tsc",
11 | "$tslint4"
12 | ],
13 | "group": {
14 | "kind": "build",
15 | "isDefault": true
16 | }
17 | }
18 | ]
19 | }
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchScreen-Center.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchScreen-Center@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchScreen-AspectFill.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchScreen-AspectFill@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/demo/typings/assertion-error/assertion-error.d.ts:
--------------------------------------------------------------------------------
1 | // Type definitions for assertion-error 1.0.0
2 | // Project: https://github.com/chaijs/assertion-error
3 | // Definitions by: Bart van der Schoor
4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5 |
6 | declare module 'assertion-error' {
7 | class AssertionError implements Error {
8 | constructor(message: string, props?: any, ssf?: Function);
9 | name: string;
10 | message: string;
11 | showDiff: boolean;
12 | stack: string;
13 | }
14 | export = AssertionError;
15 | }
16 |
--------------------------------------------------------------------------------
/typings/com.google.common.d.ts:
--------------------------------------------------------------------------------
1 | declare namespace com {
2 | export namespace google {
3 | export namespace common {
4 | export namespace util {
5 | export namespace concurrent {
6 | export class ListenableFuture { }
7 | export class Futures {
8 | public static addCallback(param0: ListenableFuture, param1: FutureCallback);
9 | }
10 | export class FutureCallback {
11 | constructor(implementation: any);
12 | }
13 | }
14 | }
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/build.xcconfig:
--------------------------------------------------------------------------------
1 | // You can add custom settings here
2 | // for example you can uncomment the following line to force distribution code signing
3 | // CODE_SIGN_IDENTITY = iPhone Distribution
4 | // To build for device with XCode 8 you need to specify your development team. More info: https://developer.apple.com/library/prerelease/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html
5 | // DEVELOPMENT_TEAM = YOUR_TEAM_ID;
6 | CODE_SIGN_ENTITLEMENTS = demo/Resources/demo.entitlements;
7 |
8 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
9 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
10 |
11 | DEVELOPMENT_TEAM = 9832T735TV
12 |
--------------------------------------------------------------------------------
/demo/app/package.json:
--------------------------------------------------------------------------------
1 | {"name":"tns-template-hello-world","main":"app.js","version":"2.0.0","author":{"name":"Telerik","email":"support@telerik.com"},"description":"Nativescript hello-world project template","license":"Apache-2.0","keywords":["telerik","mobile","nativescript","{N}","tns","appbuilder","template"],"repository":{"type":"git","url":"git://github.com/NativeScript/template-hello-world.git"},"bugs":{"url":"https://github.com/NativeScript/template-hello-world/issues"},"homepage":"https://github.com/NativeScript/template-hello-world","android":{"v8Flags":"--expose_gc"},"readme":"ERROR: No README data found!","_id":"tns-template-hello-world@2.0.0","_from":"tns-template-hello-world@2.0.0"}
--------------------------------------------------------------------------------
/demo/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "commonjs",
4 | "target": "es5",
5 | "experimentalDecorators": true,
6 | "emitDecoratorMetadata": true,
7 | "noEmitHelpers": true,
8 | "noEmitOnError": true,
9 | "lib": [
10 | "es6",
11 | "dom"
12 | ],
13 | "baseUrl": ".",
14 | "paths": {
15 | "*": [
16 | "./node_modules/tns-core-modules/*",
17 | "./node_modules/*"
18 | ],
19 | "~/*": [
20 | "app/*"
21 | ]
22 | }
23 | },
24 | "exclude": [
25 | "node_modules",
26 | "platforms"
27 | ]
28 | }
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "noEmitOnError": true,
4 | "noEmitHelpers": true,
5 | "noUnusedLocals": true,
6 | "experimentalDecorators": true,
7 | "noLib": false,
8 | "sourceMap": false,
9 | "target": "es5",
10 | "module": "commonjs",
11 | "outDir": "bin/dist",
12 | "lib": ["es6", "dom"],
13 | "rootDir": ".",
14 | "baseUrl": ".",
15 | "paths": {
16 | "*": [
17 | "./node_modules/tns-core-modules/*",
18 | "./node_modules/*"
19 | ]
20 | }
21 | },
22 | "exclude": [
23 | "node_modules/**/*.*",
24 | "demo/**/*.*",
25 | "bin/**/*.*"
26 | ]
27 | }
--------------------------------------------------------------------------------
/demo/app/tests/01-mobile-service-client.ts:
--------------------------------------------------------------------------------
1 | import { MobileServiceClient } from "nativescript-azure-mobile-apps/client";
2 | import { MobileServiceTable } from "nativescript-azure-mobile-apps/table";
3 | import { MobileServicePush } from "nativescript-azure-mobile-apps/push";
4 |
5 | describe("MobileServiceClient", () => {
6 | let client: MobileServiceClient;
7 |
8 | it("Should be created with valid URL", () => {
9 | client = new MobileServiceClient("https://tangrainctest.azurewebsites.net");
10 | assert.isTrue(client instanceof MobileServiceClient);
11 | });
12 |
13 | it("Should return a table", () => {
14 | assert.isTrue(client.getTable("TodoItem") instanceof MobileServiceTable);
15 | });
16 |
17 | it("Should init a push object", () => {
18 | assert.isTrue(client.push instanceof MobileServicePush);
19 | });
20 | });
--------------------------------------------------------------------------------
/demo/app/main-page.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Windows image file caches
2 | Thumbs.db
3 | ehthumbs.db
4 |
5 | # Folder config file
6 | Desktop.ini
7 |
8 | # Recycle Bin used on file shares
9 | $RECYCLE.BIN/
10 |
11 | # Windows Installer files
12 | *.cab
13 | *.msi
14 | *.msm
15 | *.msp
16 |
17 | # Windows shortcuts
18 | *.lnk
19 |
20 | # =========================
21 | # Operating System Files
22 | # =========================
23 |
24 | # OSX
25 | # =========================
26 |
27 | .DS_Store
28 | .AppleDouble
29 | .LSOverride
30 |
31 | # Thumbnails
32 | ._*
33 |
34 | # Files that might appear on external disk
35 | .Spotlight-V100
36 | .Trashes
37 |
38 | # Directories potentially created on remote AFP share
39 | .AppleDB
40 | .AppleDesktop
41 | Network Trash Folder
42 | Temporary Items
43 | .apdisk
44 |
45 | bin
46 | obj
47 | .vs
48 | .tscache
49 | *.user
50 | *.js
51 | *.map
52 | !gruntfile.js
53 | node_modules
54 | *.tmp.*
55 | *.log
56 | demo/platforms
57 | demo/lib
58 | !karma.conf.js
59 | !webpack.config.js
60 | report
61 | .tmp_backup
62 |
63 | # IDE's
64 | .idea
--------------------------------------------------------------------------------
/utils.d.ts:
--------------------------------------------------------------------------------
1 | /*! *****************************************************************************
2 | Copyright (c) 2016 Tangra Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | ***************************************************************************** */
16 | export function getJsObject(object: any): any;
17 | export function getNativeObject(object: any): any;
18 | export function getNativeValueForComparison(value: string|number|boolean|Date): any;
19 |
20 | /* Android Only */
21 | export function futureToPromise(future: any /* ListenableFuture */): Promise;
22 |
23 | /* iOS ONLY */
24 | export function deviceTokenToNsData(token: string): NSData;
25 |
--------------------------------------------------------------------------------
/table/table.d.ts:
--------------------------------------------------------------------------------
1 | /*! *****************************************************************************
2 | Copyright (c) 2016 Tangra Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | ***************************************************************************** */
16 | import { MobileServiceQuery } from "../query";
17 |
18 | export class MobileServiceTable {
19 | constructor(nativeValue: any);
20 |
21 | public read(): Promise>
22 | public insert (item: T): Promise;
23 | public update (item: T): Promise;
24 | public deleteById(id: string|number): Promise;
25 | public deleteItem(item: T): Promise;
26 |
27 | public where(): MobileServiceQuery;
28 | }
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/google-services.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_info": {
3 | "project_number": "271351633466",
4 | "firebase_url": "https://azuremobileservicessample.firebaseio.com",
5 | "project_id": "azuremobileservicessample",
6 | "storage_bucket": "azuremobileservicessample.appspot.com"
7 | },
8 | "client": [
9 | {
10 | "client_info": {
11 | "mobilesdk_app_id": "1:271351633466:android:5c4403fe7b0fa5cb",
12 | "android_client_info": {
13 | "package_name": "inc.tangra.azuremobileservicessample"
14 | }
15 | },
16 | "oauth_client": [
17 | {
18 | "client_id": "271351633466-mv2jm3skv1u71ea7jjkot2crs6aof7l1.apps.googleusercontent.com",
19 | "client_type": 3
20 | }
21 | ],
22 | "api_key": [
23 | {
24 | "current_key": "AIzaSyAngm0hDeaaKLOToHhA9tr8zfGZhymsG2M"
25 | }
26 | ],
27 | "services": {
28 | "analytics_service": {
29 | "status": 1
30 | },
31 | "appinvite_service": {
32 | "status": 1,
33 | "other_platform_oauth_client": []
34 | },
35 | "ads_service": {
36 | "status": 2
37 | }
38 | }
39 | }
40 | ],
41 | "configuration_version": "1"
42 | }
--------------------------------------------------------------------------------
/push/push.d.ts:
--------------------------------------------------------------------------------
1 | /*! *****************************************************************************
2 | Copyright (c) 2016 Tangra Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | ***************************************************************************** */
16 | export class MobileServicePush {
17 |
18 | constructor(nativeValue: any);
19 |
20 | public readonly installationId: string;
21 |
22 | public register(registrationId: string): Promise;
23 | public registerWithTemplate(registrationId: string, templateName: string, templateBody: string): Promise;
24 | public registerWithTags(registrationId: string, tags: string[]): Promise;
25 | public registerWithTagsAndTemplate(registrationId: string, tags: string[], templateName: string, templateBody: string): Promise;
26 | public unregister(): Promise;
27 | }
--------------------------------------------------------------------------------
/client/client.d.ts:
--------------------------------------------------------------------------------
1 | /*! *****************************************************************************
2 | Copyright (c) 2016 Tangra Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | ***************************************************************************** */
16 | import { MobileServiceTable } from "../table";
17 | import { MobileServiceUser, AuthenticationProvider } from "../user";
18 | import { MobileServicePush } from "../push";
19 |
20 | export class MobileServiceClient {
21 | public user: MobileServiceUser;
22 | public push: MobileServicePush;
23 |
24 | public static configureClientAuthAppDelegate(): void;
25 |
26 | constructor (url: string);
27 |
28 | public getTable (tableName: string): MobileServiceTable;
29 | public login(provider: AuthenticationProvider, urlScheme?: string): Promise;
30 | public loginFromCache(): boolean;
31 | }
--------------------------------------------------------------------------------
/table/table-common.ts:
--------------------------------------------------------------------------------
1 | /*! *****************************************************************************
2 | Copyright (c) 2016 Tangra Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | ***************************************************************************** */
16 | import * as definition from "../table";
17 | import { MobileServiceQuery } from "../query";
18 |
19 | export abstract class MobileServiceTable implements definition.MobileServiceTable {
20 | protected _msTable;
21 |
22 | constructor(nativeValue: any) {
23 | this._msTable = nativeValue;
24 | }
25 |
26 | abstract read(): Promise>
27 | abstract insert (item: T): Promise;
28 | abstract update (item: T): Promise;
29 | abstract deleteById(id: string|number): Promise;
30 | abstract deleteItem(item: T): Promise;
31 |
32 | abstract where(): MobileServiceQuery;
33 | }
--------------------------------------------------------------------------------
/client/clientauth-app-delegate.ts:
--------------------------------------------------------------------------------
1 | @ObjCClass(UIApplicationDelegate)
2 | export class ClientAuthAppDelegate extends UIResponder implements UIApplicationDelegate {
3 | private static _msClient: MSClient;
4 | private static _urlScheme: string;
5 |
6 | public static setAzureConfig(msClient: MSClient, urlScheme: string) {
7 | this._msClient = msClient;
8 | this._urlScheme = urlScheme;
9 | };
10 |
11 | // iOS >= 10
12 | public applicationOpenURLOptions(application: UIApplication, url: NSURL, options: NSDictionary): boolean {
13 | return this.handleIncomingUrl(url);
14 | }
15 |
16 | // iOS < 10
17 | public applicationOpenURLSourceApplicationAnnotation?(application: UIApplication, url: NSURL, sourceApplication: string, annotation: any): boolean {
18 | return this.handleIncomingUrl(url);
19 | };
20 |
21 | private handleIncomingUrl(url: NSURL): boolean {
22 | if (!ClientAuthAppDelegate._msClient || !ClientAuthAppDelegate._urlScheme) {
23 | // the delegate wasn't wired to the msClient, that should have resulted in an errormessage already
24 | console.log("IMPORTANT: Could not complete Azure login flow. Please check previous messages.");
25 | return false;
26 | }
27 |
28 | if (url.scheme.toLowerCase() === ClientAuthAppDelegate._urlScheme) {
29 | ClientAuthAppDelegate._msClient.resumeWithURL(url);
30 | return true;
31 | } else {
32 | return false;
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
16 |
17 |
18 |
19 |
20 |
21 |
27 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | "class-name": true,
4 | "comment-format": [ true, "check-space" ],
5 | "curly": true,
6 | "eofline": false,
7 | "forin": false,
8 | "indent": [ true, "spaces" ],
9 | "label-position": true,
10 | "max-line-length": [ false ],
11 | "member-ordering": [
12 | true,
13 | "static-before-instance",
14 | "variables-before-functions"
15 | ],
16 | "no-arg": true,
17 | "no-bitwise": false,
18 | "no-console": [
19 | true,
20 | "debug",
21 | "info",
22 | "time",
23 | "timeEnd",
24 | "trace"
25 | ],
26 | "no-construct": true,
27 | "no-debugger": true,
28 | "no-duplicate-variable": true,
29 | "no-empty": true,
30 | "no-eval": true,
31 | "no-inferrable-types": true,
32 | "no-shadowed-variable": true,
33 | "no-string-literal": true,
34 | "no-switch-case-fall-through": true,
35 | "no-trailing-whitespace": false,
36 | "no-unused-expression": true,
37 | "no-use-before-declare": true,
38 | "no-var-keyword": true,
39 | "object-literal-sort-keys": false,
40 | "one-line": [ false ],
41 | "quotemark": [ true, "double" ],
42 | "radix": true,
43 | "semicolon": true,
44 | "triple-equals": [ true ],
45 | "variable-name": false,
46 | "whitespace": [
47 | true,
48 | "check-branch",
49 | "check-decl",
50 | "check-operator",
51 | "check-separator",
52 | "check-type"
53 | ]
54 | }
55 | }
--------------------------------------------------------------------------------
/push/push-common.ts:
--------------------------------------------------------------------------------
1 | /*! *****************************************************************************
2 | Copyright (c) 2016 Tangra Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | ***************************************************************************** */
16 | import * as definition from "../push";
17 |
18 | export abstract class MobileServicePush implements definition.MobileServicePush {
19 | protected _msPush;
20 |
21 | abstract get installationId(): string;
22 |
23 | constructor(nativeValue: any) {
24 | this._msPush = nativeValue;
25 | }
26 |
27 | abstract register(registrationId: string): Promise;
28 | abstract registerWithTemplate(registrationId: string, templateName: string, templateBody: string): Promise;
29 | abstract registerWithTags(registrationId: string, tags: string[]): Promise;
30 | abstract registerWithTagsAndTemplate(registrationId: string, tags: string[], templateName: string, templateBody: string): Promise;
31 | abstract unregister(): Promise;
32 |
33 | }
--------------------------------------------------------------------------------
/demo/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "Azure Mobile Apps Service application",
3 | "license": "Apache-2.0",
4 | "readme": "Azure Mobile Apps Service application",
5 | "nativescript": {
6 | "id": "inc.tangra.azuremobileservicessample",
7 | "tns-ios": {
8 | "version": "5.2.0"
9 | },
10 | "tns-android": {
11 | "version": "5.2.1"
12 | }
13 | },
14 | "scripts": {
15 | "test.android": "npm uninstall nativescript-azure-mobile-apps && tns test android --justlaunch",
16 | "test.ios": "npm uninstall nativescript-azure-mobile-apps && tns test ios --emulator --justlaunch",
17 | "ios": "npm uninstall nativescript-azure-mobile-apps && tns deploy ios",
18 | "android": "npm uninstall nativescript-azure-mobile-apps && tns deploy android"
19 | },
20 | "dependencies": {
21 | "nativescript-azure-mobile-apps": "file:../bin/dist",
22 | "nativescript-plugin-firebase": "^8.3.1",
23 | "nativescript-unit-test-runner": "^0.6.2",
24 | "tns-core-modules": "~5.2.2"
25 | },
26 | "devDependencies": {
27 | "babel-traverse": "6.8.0",
28 | "babel-types": "6.8.1",
29 | "babylon": "6.8.0",
30 | "chai": "3.5.0",
31 | "filewalker": "0.1.2",
32 | "karma": "1.3.0",
33 | "karma-chai": "0.1.0",
34 | "karma-mocha": "1.3.0",
35 | "karma-mocha-reporter": "2.2.1",
36 | "karma-nativescript-launcher": "^0.4.0",
37 | "lazy": "1.0.11",
38 | "mocha": "3.2.0",
39 | "nativescript-css-loader": "~0.26.0",
40 | "nativescript-dev-typescript": "^0.9.0",
41 | "nativescript-dev-webpack": "^0.21.0",
42 | "typescript": "~3.1.6"
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/client/client-common.ts:
--------------------------------------------------------------------------------
1 | /*! *****************************************************************************
2 | Copyright (c) 2016 Tangra Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | ***************************************************************************** */
16 | import * as definition from "../client";
17 | import { MobileServiceTable } from "../table";
18 | import { MobileServiceUser, AuthenticationProvider } from "../user";
19 | import { MobileServicePush } from "../push";
20 |
21 | export abstract class MobileServiceClient implements definition.MobileServiceClient {
22 | protected _msClient;
23 | protected _url;
24 |
25 | public user: MobileServiceUser;
26 | public push: MobileServicePush;
27 |
28 | public static configureClientAuthAppDelegate(): void {
29 | // nothing to do by default
30 | }
31 |
32 | constructor(url: string) {
33 | this._url = url;
34 | }
35 |
36 | abstract getTable(tableName: string): MobileServiceTable;
37 | abstract login(provider: AuthenticationProvider, urlScheme?: string): Promise;
38 | abstract loginFromCache(): boolean;
39 | }
40 |
--------------------------------------------------------------------------------
/query/query.d.ts:
--------------------------------------------------------------------------------
1 | /*! *****************************************************************************
2 | Copyright (c) 2016 Tangra Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | ***************************************************************************** */
16 | export class MobileServiceQuery {
17 | constructor(nativeValue: any);
18 |
19 | public read(): Promise>;
20 |
21 | public field(fieldName: string): this;
22 | public eq(value: string|number|boolean|Date): this;
23 | public ne(value: string|number|boolean|Date): this;
24 | public gt(value: string|number|Date): this;
25 | public ge(value: string|number|Date): this;
26 | public lt(value: number|Date): this;
27 | public le(value: number|Date): this;
28 |
29 | public startsWith(field: string, value: string): this;
30 | public endsWith(field: string, value: string): this;
31 |
32 | public and(): this;
33 | public or(): this;
34 |
35 | public orderBy(field: string, dir: SortDir): this;
36 |
37 | public skip(count: number): this;
38 | public top(count: number): this;
39 | }
40 |
41 | export enum SortDir {
42 | Asc,
43 | Desc
44 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nativescript-azure-mobile-apps",
3 | "version": "2.0.4",
4 | "description": "A NativeScript plugin for working with Azure Mobile Apps",
5 | "main": "azure-mobile-apps",
6 | "types": "azure-mobile-apps.d.ts",
7 | "nativescript": {
8 | "platforms": {
9 | "android": "3.0.0",
10 | "ios": "3.0.0"
11 | },
12 | "plugin": {
13 | "nan": "true",
14 | "pan": "true",
15 | "core3": "true",
16 | "category": "Utilities"
17 | }
18 | },
19 |
20 | "repository": {
21 | "type": "git",
22 | "url": "https://github.com/PeterStaev/nativescript-azure-mobile-apps"
23 | },
24 | "scripts": {
25 | "tslint": "tslint --project tsconfig.json",
26 | "tsc": "tsc --project tsconfig.json",
27 | "demo-ios": "grunt build && cd demo && tns run ios",
28 | "demo-android": "grunt build && cd demo && tns run android"
29 | },
30 | "keywords": [
31 | "NativeScript",
32 | "Azure",
33 | "Mobile Apps",
34 | "Social Sign In",
35 | "Push Notifications",
36 | "tangra"
37 | ],
38 | "author": "Peter Staev ",
39 | "contributors": [
40 | "George Edwards (https://github.com/georgeedwards)",
41 | "Eddy Verbruggen (https://github.com/eddyverbruggen)"
42 | ],
43 | "license": "Apache-2.0",
44 | "peerDependencies": {
45 | "tns-core-modules": ">=3"
46 | },
47 | "devDependencies": {
48 | "typescript": "~2.2.0",
49 | "tslint": "^4.5.1",
50 | "tns-core-modules": "3.4.0",
51 | "tns-platform-declarations": "3.4.0",
52 |
53 | "grunt": "1.0.1",
54 | "grunt-contrib-copy": "1.0.0",
55 | "grunt-contrib-clean": "1.0.0",
56 | "grunt-exec": "2.0.0"
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | sudo: false
2 |
3 | android:
4 | components:
5 | - tools
6 | - platform-tools
7 | - build-tools-28.0.3
8 | - android-24 # needed for test vms
9 | - android-28
10 | - extra-android-m2repository
11 | - sys-img-arm64-v8a-android-24
12 |
13 | before_cache:
14 | - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
15 |
16 | cache:
17 | directories:
18 | - .nvm
19 | - $HOME/.gradle/caches/
20 | - $HOME/.gradle/wrapper/
21 |
22 | install:
23 | - echo no | npm install -g nativescript
24 | - tns usage-reporting disable
25 | - tns error-reporting disable
26 | - echo no | npm install -g grunt-cli
27 | - npm install
28 | - grunt compile
29 |
30 | matrix:
31 | include:
32 | - stage: lint
33 | language: node_js
34 | os: linux
35 | node_js: "8"
36 | script: grunt lint
37 |
38 | - stage: deploy
39 | if: branch = release
40 | language: node_js
41 | node_js: "8"
42 | before_deploy:
43 | - cd bin/dist
44 | deploy:
45 | provider: npm
46 | email: "peter@tangrasoft.com"
47 | api_key:
48 | secure: "cquM6mrK7+98oTUN6xSGSg69PzC4iBebDezUEkkwpyjqcfPmd60hZrbhtnc7pQo89Sg7c4tXLS9mBJJQZHYOefsMlx9+a3wMKI5+BzC4373PIXJTj0Zd9WqQl6sVE0BVqrBo/rnOo6Q5GeRrJmmGThTN6JdMCLeEoEPeeq7eEiCghv5sshpacAol4eGE+KvZTPVYZiJXb+qTj0SUGI+nv3p8ls4FTEz7ZoN6/zyIDhLnXXejg/XF3wenIgMaDDHfF1sdiSj/4ZlBnpwY5VLU1W7ILP0GMnl+p6l8qyiiyaeAadPlpgVA+IN1fJ6rPVpwa1TRDe5oARIbAMTGyy3LK1OjSGsTe0g4EAgsV6shuHrhfiTHLeiWVNZ4+2hUFBqVFjL6IN1MBX3CJU4Pw3/xLvERHImvHPjQK1Po+zxfHUBVmCWT82FxLFPyWGkVF1htBWDsbmJghBOc5FCsTRvfRtSIqADmUjgDZmVGD2oU8fcDOi8fTUQNCllq8Lo70sUG9FPIoAz0ZQr1r3IE92PVKk0hPYFTiFnDv4+QmlyxH9oVkIJL1gR8AtkomPzXZXXbB3Cgif8mz1AhM+jDrNSJ98vEzm6jA/RKAnPezfxXr+aGTu74yIqedZC9C2BNsFiTDjje3zyYHpSeXHnrLKvCQ9WRbMEWU52WQJcxUh9tFDY="
49 | skip_cleanup: true
50 | on:
51 | branch: release
52 |
--------------------------------------------------------------------------------
/query/query-common.ts:
--------------------------------------------------------------------------------
1 | /*! *****************************************************************************
2 | Copyright (c) 2016 Tangra Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | ***************************************************************************** */
16 | import * as definition from "../query";
17 |
18 | export abstract class MobileServiceQuery implements definition.MobileServiceQuery {
19 | protected _msQuery;
20 |
21 | constructor(nativeValue: any) {
22 | this._msQuery = nativeValue;
23 | }
24 |
25 | abstract read(): Promise>;
26 |
27 | abstract field(fieldName: string): this;
28 | abstract eq(value: string|number|boolean|Date): this;
29 | abstract ne(value: string|number|boolean|Date): this;
30 | abstract gt(value: string|number|Date): this;
31 | abstract ge(value: string|number|Date): this;
32 | abstract lt(value: number|Date): this;
33 | abstract le(value: number|Date): this;
34 |
35 | abstract startsWith(field: string, value: string): this;
36 | abstract endsWith(field: string, value: string): this;
37 |
38 | abstract and(): this;
39 | abstract or(): this;
40 |
41 | abstract orderBy(field: string, dir: definition.SortDir): this;
42 |
43 | abstract skip(count: number): this;
44 | abstract top(count: number): this;
45 | }
46 |
47 | export enum SortDir {
48 | Asc = 0,
49 | Desc = 1
50 | }
--------------------------------------------------------------------------------
/user/user.d.ts:
--------------------------------------------------------------------------------
1 | /*! *****************************************************************************
2 | Copyright (c) 2016 Tangra Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | ***************************************************************************** */
16 | export enum AuthenticationProvider {
17 | AzureActiveDirectory,
18 | Google,
19 | Facebook,
20 | Twitter,
21 | MicrosoftAccount
22 | }
23 |
24 | export class MobileServiceUser {
25 | public userId: string;
26 | public authenticationToken: string;
27 | public nativeValue: any; /* readonly */
28 |
29 | public static clearCachedAuthenticationInfo(): void;
30 | public static getFromCache(): MobileServiceUser;
31 |
32 | constructor(nativeValue: any, portalUrl: string);
33 |
34 | public getProviderCredentials(): Promise;
35 | }
36 |
37 | export class ProviderCredentials {
38 | public userId: string;
39 | public claims: { [type: string]: string };
40 | public accessToken: string;
41 | public accessTokenSecret: string;
42 | public expiresOn: Date;
43 | public refreshToken: string;
44 | public idToken: string;
45 | public authenticationToken: string;
46 | public provider: AuthenticationProvider;
47 |
48 | public givenName: string; /* readonly */
49 | public surname: string; /* readonly */
50 | public name: string; /* readonly */
51 | }
52 |
--------------------------------------------------------------------------------
/demo/app/tests/02-mobile-service-push.ts:
--------------------------------------------------------------------------------
1 | // Disable push tests as they do not work well with Travis CI!
2 |
3 | // import * as platform from "platform";
4 | // import * as application from "application";
5 | // import { MobileServiceClient } from "nativescript-azure-mobile-apps/client";
6 | // let pushPlugin = require("nativescript-push-notifications");
7 |
8 | // let androidPushSettings = { senderID: "271351633466" };
9 |
10 | // mocha.setup({
11 | // timeout: 110000
12 | // });
13 |
14 | // describe("MobileServicePush", () => {
15 | // let client: MobileServiceClient;
16 |
17 | // before(() => {
18 | // client = new MobileServiceClient("https://tangrainctest.azurewebsites.net");
19 | // });
20 |
21 | // it("Should register", (done) => {
22 | // if (application.android) {
23 | // pushPlugin.register(androidPushSettings, (data) => {
24 | // client.push.register(data).then(done, done);
25 | // }, done);
26 | // }
27 | // else if (application.ios) {
28 | // // iOS Push Notifications do not work on Simulator!
29 | // done();
30 | // }
31 | // });
32 |
33 | // it("Should registerWithTemplate", (done) => {
34 | // if (application.android) {
35 | // pushPlugin.register(androidPushSettings, (data) => {
36 | // client.push.registerWithTemplate(data, "TestTemplate", "{\"data\":{\"message\":\"$(param)\"}}").then(done, done);
37 | // }, done);
38 | // }
39 | // else if (application.ios) {
40 | // // iOS Push Notifications do not work on Simulator!
41 | // done();
42 | // }
43 | // });
44 |
45 | // it("Should unregister", (done) => {
46 | // if (application.android) {
47 | // pushPlugin.unregister(() => {
48 | // client.push.unregister().then(done, done);
49 | // }, done, androidPushSettings);
50 | // }
51 | // else if (application.ios) {
52 | // // iOS Push Notifications do not work on Simulator!
53 | // done();
54 | // }
55 | // });
56 | // });
--------------------------------------------------------------------------------
/demo/karma.conf.js:
--------------------------------------------------------------------------------
1 | module.exports = function(config) {
2 | config.set({
3 |
4 | // base path that will be used to resolve all patterns (eg. files, exclude)
5 | basePath: '',
6 |
7 |
8 | // frameworks to use
9 | // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
10 | frameworks: ['mocha', 'chai'],
11 |
12 |
13 | // list of files / patterns to load in the browser
14 | files: [
15 | 'app/**/*.js',
16 | ],
17 |
18 |
19 | // list of files to exclude
20 | exclude: [
21 | ],
22 |
23 |
24 | // preprocess matching files before serving them to the browser
25 | // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
26 | preprocessors: {
27 | },
28 |
29 |
30 | // test results reporter to use
31 | // possible values: 'dots', 'progress'
32 | // available reporters: https://npmjs.org/browse/keyword/karma-reporter
33 | reporters: ['mocha'],
34 |
35 |
36 | // web server port
37 | port: 9876,
38 |
39 |
40 | // enable / disable colors in the output (reporters and logs)
41 | colors: true,
42 |
43 |
44 | // level of logging
45 | // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
46 | logLevel: config.LOG_INFO,
47 |
48 |
49 | // enable / disable watching file and executing tests whenever any file changes
50 | autoWatch: true,
51 |
52 |
53 | // start these browsers
54 | // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
55 | browsers: [],
56 |
57 | browserDisconnectTimeout: 120000,
58 | browserNoActivityTimeout: 120000,
59 |
60 | customLaunchers: {
61 | android: {
62 | base: 'NS',
63 | platform: 'android'
64 | },
65 | ios: {
66 | base: 'NS',
67 | platform: 'ios'
68 | },
69 | ios_simulator: {
70 | base: 'NS',
71 | platform: 'ios',
72 | arguments: ['--emulator']
73 | }
74 | },
75 |
76 | // Continuous Integration mode
77 | // if true, Karma captures browsers, runs the tests and exits
78 | singleRun: true
79 | })
80 | }
81 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | Azure Sample
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIRequiresFullScreen
28 |
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 | CFBundleURLTypes
47 |
48 |
49 | CFBundleTypeRole
50 | Editor
51 | CFBundleURLName
52 | inc.tangra.azuremobileservicessample
53 | CFBundleURLSchemes
54 |
55 | x-msauth-tns-azure-sample
56 |
57 |
58 |
59 | UseExternalPushProvider
60 |
61 | UIBackgroundModes
62 |
63 | remote-notification
64 |
65 |
66 |
--------------------------------------------------------------------------------
/user/user.ios.ts:
--------------------------------------------------------------------------------
1 | /*! *****************************************************************************
2 | Copyright (c) 2016 Tangra Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | ***************************************************************************** */
16 | import * as common from "./user-common";
17 | import * as applicationSettings from "application-settings";
18 |
19 | export * from "./user-common";
20 |
21 | export class MobileServiceUser extends common.MobileServiceUser {
22 | protected _msUser: MSUser; // Redeclaration for typing info
23 |
24 | public static getFromCache(): MobileServiceUser {
25 | let userId = applicationSettings.getString(common.MobileServiceUser.USER_ID_CACHE_KEY, null);
26 | let authenticationToken = applicationSettings.getString(common.MobileServiceUser.AUTHENTICATION_TOKEN_CACHE_KEY, null);
27 | let portalUrl = applicationSettings.getString(common.MobileServiceUser.PORTAL_URL_CACHE_KEY, null);
28 |
29 | if (userId === null || authenticationToken === null || portalUrl === null) {
30 | return null;
31 | }
32 |
33 | let nativeValue = new MSUser({ userId: userId });
34 | nativeValue.mobileServiceAuthenticationToken = authenticationToken;
35 |
36 | return new MobileServiceUser(nativeValue, portalUrl);
37 | }
38 |
39 | constructor(nativeValue: any, portalUrl: string) {
40 | super(nativeValue, portalUrl);
41 |
42 | if (nativeValue) {
43 | this.userId = nativeValue.userId;
44 | this.authenticationToken = nativeValue.mobileServiceAuthenticationToken;
45 | this._cacheAuthenticationInfo();
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/user/user.android.ts:
--------------------------------------------------------------------------------
1 | /*! *****************************************************************************
2 | Copyright (c) 2016 Tangra Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | ***************************************************************************** */
16 | import * as common from "./user-common";
17 | import * as applicationSettings from "application-settings";
18 |
19 | export * from "./user-common"
20 |
21 | export class MobileServiceUser extends common.MobileServiceUser {
22 | protected _msUser: com.microsoft.windowsazure.mobileservices.authentication.MobileServiceUser; // Redeclaration for typing info
23 |
24 | public static getFromCache(): MobileServiceUser {
25 | let userId = applicationSettings.getString(common.MobileServiceUser.USER_ID_CACHE_KEY, null);
26 | let authenticationToken = applicationSettings.getString(common.MobileServiceUser.AUTHENTICATION_TOKEN_CACHE_KEY, null);
27 | let portalUrl = applicationSettings.getString(common.MobileServiceUser.PORTAL_URL_CACHE_KEY, null);
28 |
29 | if (userId === null || authenticationToken === null || portalUrl === null) {
30 | return null;
31 | }
32 |
33 | let nativeValue = new com.microsoft.windowsazure.mobileservices.authentication.MobileServiceUser(userId);
34 | nativeValue.setAuthenticationToken(authenticationToken);
35 |
36 | return new MobileServiceUser(nativeValue, portalUrl);
37 | }
38 |
39 | constructor(nativeValue: any, portalUrl: string) {
40 | super(nativeValue, portalUrl);
41 |
42 | if (nativeValue) {
43 | this.userId = nativeValue.getUserId();
44 | this.authenticationToken = nativeValue.getAuthenticationToken();
45 | this._cacheAuthenticationInfo();
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/demo/app/tests/03-mobile-service-table.ts:
--------------------------------------------------------------------------------
1 | import * as platform from "platform";
2 | import { MobileServiceClient } from "nativescript-azure-mobile-apps/client";
3 | import { MobileServiceTable } from "nativescript-azure-mobile-apps/table";
4 | import { MobileServiceQuery } from "nativescript-azure-mobile-apps/query";
5 |
6 | mocha.setup({
7 | timeout: 110000
8 | });
9 |
10 | class TodoItem {
11 | public id: string;
12 | public text: string;
13 | public completed: boolean = false;
14 | }
15 |
16 | describe("MobileServiceTable", () => {
17 | let client: MobileServiceClient;
18 | let table: MobileServiceTable;
19 | let item: TodoItem;
20 |
21 | before(() => {
22 | client = new MobileServiceClient("https://tangrainctest.azurewebsites.net");
23 | table = client.getTable(`TodoItem_${platform.device.os.toLowerCase()}`);
24 |
25 | item = new TodoItem();
26 | item.text = "Test run";
27 | });
28 |
29 | it("Should insert a new item", (done) => {
30 | table.insert(item).then((updatedItem) => {
31 | item = updatedItem;
32 |
33 | assert.isDefined(item.id);
34 | assert.isNotNull(item.id);
35 | done();
36 | }, done);
37 | });
38 |
39 | it("Should update an existing item", (done) => {
40 | item.completed = true;
41 |
42 | table.update(item).then((updatedItem) => {
43 | item = updatedItem;
44 |
45 | assert.isTrue(item.completed);
46 | done();
47 | }, done);
48 | });
49 |
50 | it("Should return all items", (done) => {
51 | table.read().then((results) => {
52 | assert.isAbove(results.length, 0);
53 | done();
54 | }, done);
55 | });
56 |
57 | it("Should delete an item", (done) => {
58 | table.deleteItem(item).then(done, done);
59 | });
60 |
61 | it("Should delete an item by ID", (done) => {
62 | let newItem = new TodoItem();
63 | newItem.text = "Test Run 2nd item";
64 |
65 | table.insert(newItem).then((updatedItem) => {
66 | table.deleteById(updatedItem.id).then(done, done);
67 | }, done);
68 | });
69 |
70 | it("Should return query on where()", () => {
71 | assert.isTrue(table.where() instanceof MobileServiceQuery);
72 | });
73 | });
--------------------------------------------------------------------------------
/utils.android.ts:
--------------------------------------------------------------------------------
1 | /*! *****************************************************************************
2 | Copyright (c) 2016 Tangra Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | ***************************************************************************** */
16 | import * as types from "utils/types";
17 |
18 | export function futureToPromise(future: any /* ListenableFuture */): Promise {
19 | return new Promise((resolve, reject) => {
20 | com.google.common.util.concurrent.Futures.addCallback(future, new com.google.common.util.concurrent.FutureCallback({
21 | onSuccess: (result) => {
22 | resolve(result);
23 | }
24 | , onFailure: (t /* Throwable */) => {
25 | reject(new Error(t.getMessage()));
26 | }
27 | }));
28 | });
29 | }
30 |
31 | export function getNativeValueForComparison(value: string|number|boolean|Date): any {
32 | if (types.isNumber(value)) {
33 | // To my understanding Azure does not use the types strictly
34 | // So always use the "bigger" type
35 | if (value.toString().indexOf(".") >= 0) {
36 | return new java.lang.Double(value);
37 | }
38 | else {
39 | return new java.lang.Long(value);
40 | }
41 | }
42 | else if (value instanceof Date) {
43 | return new java.util.Date(value.getTime());
44 | }
45 | else {
46 | return value;
47 | }
48 | }
49 |
50 | export function getNativeObject(jsObject: any): any { /* JsonObject */
51 | let parser = new com.google.gson.JsonParser();
52 | return parser.parse(JSON.stringify(jsObject)).getAsJsonObject();
53 | }
54 |
55 | export function getJsObject(jsonObject: any): any {
56 | let gson = new com.google.gson.Gson();
57 | return JSON.parse(gson.toJson(jsonObject), dateReviver);
58 | }
59 |
60 | function dateReviver(key: string, value: any) {
61 | let isoDateMatcher = /\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/;
62 |
63 | if (typeof value === "string" && (value).match(isoDateMatcher)) {
64 | return new Date(value);
65 | }
66 | return value;
67 | }
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "29x29",
5 | "idiom" : "iphone",
6 | "filename" : "icon-29.png",
7 | "scale" : "1x"
8 | },
9 | {
10 | "size" : "29x29",
11 | "idiom" : "iphone",
12 | "filename" : "icon-29@2x.png",
13 | "scale" : "2x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "icon-29@3x.png",
19 | "scale" : "3x"
20 | },
21 | {
22 | "size" : "40x40",
23 | "idiom" : "iphone",
24 | "filename" : "icon-40@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "40x40",
29 | "idiom" : "iphone",
30 | "filename" : "icon-40@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "57x57",
35 | "idiom" : "iphone",
36 | "filename" : "icon-57.png",
37 | "scale" : "1x"
38 | },
39 | {
40 | "size" : "57x57",
41 | "idiom" : "iphone",
42 | "filename" : "icon-57@2x.png",
43 | "scale" : "2x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "icon-60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "icon-60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "29x29",
59 | "idiom" : "ipad",
60 | "filename" : "icon-29.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "29x29",
65 | "idiom" : "ipad",
66 | "filename" : "icon-29@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "40x40",
71 | "idiom" : "ipad",
72 | "filename" : "icon-40.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "40x40",
77 | "idiom" : "ipad",
78 | "filename" : "icon-40@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "50x50",
83 | "idiom" : "ipad",
84 | "filename" : "icon-50.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "50x50",
89 | "idiom" : "ipad",
90 | "filename" : "icon-50@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "72x72",
95 | "idiom" : "ipad",
96 | "filename" : "icon-72.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "72x72",
101 | "idiom" : "ipad",
102 | "filename" : "icon-72@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "76x76",
107 | "idiom" : "ipad",
108 | "filename" : "icon-76.png",
109 | "scale" : "1x"
110 | },
111 | {
112 | "size" : "76x76",
113 | "idiom" : "ipad",
114 | "filename" : "icon-76@2x.png",
115 | "scale" : "2x"
116 | },
117 | {
118 | "size" : "83.5x83.5",
119 | "idiom" : "ipad",
120 | "filename" : "icon-83.5@2x.png",
121 | "scale" : "2x"
122 | }
123 | ],
124 | "info" : {
125 | "version" : 1,
126 | "author" : "xcode"
127 | }
128 | }
--------------------------------------------------------------------------------
/table/table.android.ts:
--------------------------------------------------------------------------------
1 | /*! *****************************************************************************
2 | Copyright (c) 2016 Tangra Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | ***************************************************************************** */
16 | import * as common from "./table-common";
17 | import * as utils from "../utils";
18 | import { MobileServiceQuery } from "../query";
19 |
20 | export * from "./table-common";
21 |
22 | export class MobileServiceTable extends common.MobileServiceTable {
23 | protected _msTable: com.microsoft.windowsazure.mobileservices.table.MobileServiceTable; // Redeclaration for typing info
24 |
25 | public read(): Promise> {
26 | return new Promise((resolve, reject) => {
27 | try {
28 | let futureResult = this._msTable.execute();
29 | utils.futureToPromise(futureResult).then((result) => { resolve(utils.getJsObject(result)); }, reject);
30 | }
31 | catch (e) {
32 | reject(e);
33 | }
34 | });
35 | }
36 |
37 | public insert(item: T): Promise {
38 | return new Promise((resolve, reject) => {
39 | try {
40 | let futureResult = this._msTable.insert(utils.getNativeObject(item));
41 | utils.futureToPromise(futureResult).then((result) => { resolve(utils.getJsObject(result)); }, reject);
42 | }
43 | catch (e) {
44 | reject(e);
45 | }
46 | });
47 | }
48 |
49 | public update (item: T): Promise {
50 | return new Promise((resolve, reject) => {
51 | try {
52 | let futureResult = this._msTable.update(utils.getNativeObject(item));
53 | utils.futureToPromise(futureResult).then((result) => { resolve(utils.getJsObject(result)); }, reject);
54 | }
55 | catch (e) {
56 | reject(e);
57 | }
58 | });
59 | }
60 |
61 | public deleteById(id: string|number): Promise {
62 | return new Promise((resolve, reject) => {
63 | try {
64 | let futureResult = this._msTable.delete(id);
65 | utils.futureToPromise(futureResult).then(() => { resolve(); }, reject);
66 | }
67 | catch (e) {
68 | reject(e);
69 | }
70 | });
71 | }
72 |
73 | public deleteItem(item: T): Promise {
74 | return new Promise((resolve, reject) => {
75 | try {
76 | let futureResult = this._msTable.delete(utils.getNativeObject(item));
77 | utils.futureToPromise(futureResult).then(() => { resolve(); }, reject);
78 | }
79 | catch (e) {
80 | reject(e);
81 | }
82 | });
83 | }
84 |
85 | public where(): MobileServiceQuery {
86 | return new MobileServiceQuery(this._msTable.where());
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/utils.ios.ts:
--------------------------------------------------------------------------------
1 | /*! *****************************************************************************
2 | Copyright (c) 2016 Tangra Inc.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | ***************************************************************************** */
16 | export function getNativeValueForComparison(value: string|number|boolean|Date): any {
17 | if (value instanceof Date) {
18 | // There is a problem with {N} wrapping NSDate so we just use ISO String to filter
19 | return (value).toISOString();
20 | }
21 |
22 | return value;
23 | }
24 |
25 | export function getNativeObject(object: any): any {
26 | if (object instanceof Array) {
27 | return getNSArrayFromJsArray(object);
28 | }
29 |
30 | if (object !== null && object !== undefined && typeof object === "object" && !(object instanceof Date)) {
31 | return getNSDictionaryFromJsObject(object);
32 | }
33 |
34 | return object;
35 | }
36 |
37 | function getNSArrayFromJsArray(array: Array): NSArray {
38 | let result = NSMutableArray.alloc().init();
39 |
40 | for (let loop = 0; loop < array.length; loop++) {
41 | result.addObject(getNativeObject(array[loop]));
42 | }
43 |
44 | return result;
45 | }
46 |
47 | function getNSDictionaryFromJsObject(object: Object): NSDictionary {
48 | let result = NSMutableDictionary.alloc().init();
49 |
50 | for (let key in object) {
51 | if (object.hasOwnProperty(key)) {
52 | result.setValueForKey(getNativeObject(object[key]), key);
53 | }
54 | }
55 |
56 | return result;
57 | }
58 |
59 | export function getJsObject(object: any): any {
60 | if (object instanceof NSDictionary) {
61 | return getJsObjectFromNSDictionary(object);
62 | }
63 |
64 | if (object instanceof NSArray) {
65 | return getJsArrayFromNSArray(object);
66 | }
67 |
68 | return object;
69 | }
70 |
71 | function getJsArrayFromNSArray(array: NSArray): Array