Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion demo-angular/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ export class AppComponent {
.then((imageAsset: any) => {
this.cameraImage = imageAsset;
let that = this;
imageAsset.getImageAsync(function (nativeImage) {
imageAsset.getImageAsync(function (nativeImage, ex) {
if (ex instanceof Error) {
throw ex;
} else if (typeof ex === "string") {
throw new Error(ex);
}

if (imageAsset.android) {
// get the current density of the screen (dpi) and divide it by the default one to get the scale
that.scale = nativeImage.getDensity() / android.util.DisplayMetrics.DENSITY_DEFAULT;
Expand Down
39 changes: 1 addition & 38 deletions demo-angular/app/package.json
Original file line number Diff line number Diff line change
@@ -1,47 +1,10 @@
{
"private": false,
"nativescript": {
"id": "org.nativescript.helloworldng"
},
"name": "tns-template-hello-world-ng",
"main": "main.js",
"version": "2.3.3",
"author": "Telerik <support@telerik.com>",
"description": "Nativescript Angular Hello World template",
"license": "BSD",
"keywords": [
"telerik",
"mobile",
"angular",
"nativescript",
"{N}",
"tns",
"appbuilder",
"template"
],
"repository": {
"type": "git",
"url": "git://github.com/NativeScript/template-hello-world-ng"
},
"homepage": "https://github.com/NativeScript/template-hello-world-ng",
"android": {
"v8Flags": "--expose_gc",
"markingMode": "none",
"requireModules": ["nativescript-camera"]
},
"dependencies": {
"nativescript-angular": "1.1.0",
"@angular/core": "2.1.0",
"@angular/common": "2.1.0",
"@angular/compiler": "2.1.0",
"@angular/http": "2.1.0",
"@angular/platform-browser": "2.1.0",
"@angular/platform-browser-dynamic": "2.1.0",
"@angular/forms": "2.1.0",
"@angular/router": "3.1.0",
"reflect-metadata": "~0.1.8"
},
"devDependencies": {
"zone.js": "~0.6.21",
"nativescript-dev-typescript": "^0.3.2"
}
}
2 changes: 0 additions & 2 deletions src/camera.android.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import * as typesModule from "tns-core-modules/utils/types";
import * as utilsModule from "tns-core-modules/utils/utils";
import * as applicationModule from "tns-core-modules/application/application";
import * as imageSourceModule from "tns-core-modules/image-source/image-source";
import * as imageAssetModule from "tns-core-modules/image-asset/image-asset";
import * as trace from "tns-core-modules/trace/trace";
import * as platform from "tns-core-modules/platform/platform";
import * as permissions from "nativescript-permissions";

let REQUEST_IMAGE_CAPTURE = 3453;
let REQUEST_REQUIRED_PERMISSIONS = 1234;

export let takePicture = function (options?): Promise<any> {
return new Promise((resolve, reject) => {
Expand Down