From 4750f463f770f4790d703da30f262e9c26aa2060 Mon Sep 17 00:00:00 2001 From: Mathieu Nayrolles Date: Tue, 14 Mar 2017 16:01:07 -0400 Subject: [PATCH] feat(input): Past native clipboard content on inputs long press Tap in into the native clipboard with cordova. Still not the native pop-over past Fixes #97 --- config.xml | 185 +++++++++--------- package.json | 60 ++---- src/components/mobile-input/mobile-input.html | 2 + src/components/mobile-input/mobile-input.ts | 15 +- 4 files changed, 128 insertions(+), 134 deletions(-) diff --git a/config.xml b/config.xml index 48fd55c..38e3a33 100755 --- a/config.xml +++ b/config.xml @@ -1,93 +1,94 @@ - + - Toolwatch - Watch accuracy app - Measure and track the accuracy of your mechanical watches. Toolwatch is a free watch accuracy app trusted by the watchmaking industry's leaders and 15 000+ monthly users. Is your watch accurate? Should it be serviced? How does it compare versus other watches? Find out now by measuring the accuracy of your watch! - Mathieu Nayrolles - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + Toolwatch - Watch accuracy app + Measure and track the accuracy of your mechanical watches. Toolwatch is a free watch accuracy app trusted by the watchmaking industry's leaders and 15 000+ monthly users. Is your watch accurate? Should it be serviced? How does it compare versus other watches? Find out now by measuring the accuracy of your watch! + Mathieu Nayrolles + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/package.json b/package.json index 9c3564b..459822d 100755 --- a/package.json +++ b/package.json @@ -12,57 +12,35 @@ "prod": "npm run assets && ionic-app-scripts build --prod" }, "dependencies": { - "@angular/common": "2.2.1", - "@angular/compiler": "2.2.1", - "@angular/compiler-cli": "2.2.1", - "@angular/core": "2.2.1", - "@angular/forms": "2.2.1", - "@angular/http": "2.2.1", - "@angular/platform-browser": "2.2.1", - "@angular/platform-browser-dynamic": "2.2.1", - "@angular/platform-server": "2.2.1", - "@ionic/storage": "1.1.7", + "@angular/common": "2.4.8", + "@angular/compiler": "2.4.8", + "@angular/compiler-cli": "2.4.8", + "@angular/core": "2.4.8", + "@angular/forms": "2.4.8", + "@angular/http": "2.4.8", + "@angular/platform-browser": "2.4.8", + "@angular/platform-browser-dynamic": "2.4.8", + "@angular/platform-server": "2.4.8", + "@ionic/storage": "^2.0.0", + "ng2-translate": "5.0.0", "@types/node": "^6.0.45", "gsap": "^1.19.0", - "ionic-angular": "2.0.0-rc.4", - "ionic-native": "2.2.11", + "ionic-angular": "2.2.0", + "ionic-native": "2.4.1", "ionicons": "3.0.0", "moment": "2.15.1", - "ng2-translate": "5.0.0", - "rxjs": "5.0.0-beta.12", - "tw-core": "file:///Users/mathosx/Desktop/toolwatch/tw-core", + "rxjs": "5.0.1", + "sw-toolbox": "3.4.0", "tw-i18n": "github:toolwatchapp/tw-i18n", "tw-watches": "github:toolwatchapp/tw-watches", - "zone.js": "0.6.26" + "zone.js": "0.7.2" }, "devDependencies": { - "@ionic/app-scripts": "1.0.0", - "@types/jasmine": "^2.5.35", - "@types/node": "^6.0.45", - "bulma": "0.2.3", - "core-js": "^2.4.0", - "css-loader": "^0.23.1", + "@ionic/app-scripts": "1.1.4", "cz-conventional-changelog": "^1.2.0", - "es6-promise": "^3.0.2", - "es6-shim": "^0.35.0", - "highlight.js": "^9.1.0", - "html-loader": "^0.4.3", - "intern": "^3.3.2", - "marked": "^0.3.6", - "node-sass": "^3.6.0", - "raw-loader": "^0.5.1", - "reflect-metadata": "0.1.3", - "rxjs": "5.0.0-beta.12", - "sass-loader": "^3.1.2", - "style-loader": "^0.13.1", - "sw-toolbox": "^3.4.0", - "ts-loader": "^1.0.0", - "typescript": "2.0.9", - "typings": "^0.6.8", - "webpack": "2.1.0-beta.25", - "zone.js": "0.6.25" + "typescript": "2.0.9" }, - "description": "tw-mobile-2rc0: An Ionic project", + "description": "tw-mobile: An Ionic project", "cordovaPlugins": [ "cordova-plugin-device", "cordova-plugin-console", diff --git a/src/components/mobile-input/mobile-input.html b/src/components/mobile-input/mobile-input.html index b54e35e..3def67e 100755 --- a/src/components/mobile-input/mobile-input.html +++ b/src/components/mobile-input/mobile-input.html @@ -16,6 +16,7 @@ (blur) = "toggleFocus()" (focus) = "toggleFocus()" (keyup) = "emitChange($event)" + (press) = "onPast()" > @@ -32,6 +33,7 @@ [formControl] = "control" [(ngModel)] = "value" (ngModelChange) = "valueChange.emit($event)" + (press) = "onPast()" > diff --git a/src/components/mobile-input/mobile-input.ts b/src/components/mobile-input/mobile-input.ts index 10786cf..7ba8c88 100755 --- a/src/components/mobile-input/mobile-input.ts +++ b/src/components/mobile-input/mobile-input.ts @@ -2,7 +2,7 @@ import { Component, Input, EventEmitter, Output } from '@angular/core'; import { FormControl } from '@angular/forms'; - +import { Clipboard } from 'ionic-native'; /* Generates a mobile form input @@ -77,6 +77,19 @@ export class MobileInput { } } + onPast(){ + Clipboard.paste().then( + (resolve: string) => { + this.value = resolve; + this.valueChange.emit(this.value); + }, + (reject: string) => { + console.error("Unsucessful pasting") + } + ); + + } + toggleFocus():void{ this.isFocused = !this.isFocused; }