Git Product home page Git Product logo

nativescript-feedback's Introduction

NativeScript Feedback

Build Status NPM version Downloads Twitter Follow

๐Ÿ’ก Plugin version 2.0.0+ is compatible with NativeScript 7+. If you need to target older NativeScript versions, please stick to plugin version 1.5.0.

ย ย ย ย ย ย ย 

iOS and Android running the included demo - much better framerate on YouTube!

Demo apps

NativeScript-Core (XML)

Check out the demo folder. This is how to clone and run it:

git clone https://github.com/EddyVerbruggen/nativescript-feedback
cd nativescript-feedback/src
npm run demo.ios # or demo.android

NativeScript-Angular

This plugin is part of the plugin showcase app I built using Angular.

NativeScript-Vue

Check out the demo-vue folder. This is how to clone and run it:

git clone https://github.com/EddyVerbruggen/nativescript-feedback
cd nativescript-feedback/src
npm run demo-vue.ios # or demo-vue.android

Installation

tns plugin add nativescript-feedback

API

requiring / importing the plugin

JavaScript

var FeedbackPlugin = require("nativescript-feedback");
var feedback = new FeedbackPlugin.Feedback();

TypeScript

import { Feedback, FeedbackType, FeedbackPosition } from "nativescript-feedback";

export class MyClassWithFeedback {
  private feedback: Feedback;
  
  constructor() {
    this.feedback = new Feedback();
  }
}

show

Showing feedback can be as easy as:

this.feedback.show({
  message: "Easiest thing ever, right?"
});

That uses a bunch of sane defaults. However, there are a lot of things you may want to tweak. All of which are optional:

Property Default Description
title undefined The bold title at the top.
titleColor new Color("white") The title's color.
titleFont Bold system font iOS needs the font name and android the file name. See the demo for examples.
titleSize 16 The size of the title font.
message undefined The message below the title.
messageColor new Color("white") The message's color.
messageFont System font iOS needs the font name and android the file name. See the demo for examples.
messageSize 13 The size of the message font.
duration 4000 The duration to show the feedback (milliseconds).
type FeedbackType.Custom One of .Custom, .Success, .Warning, .Error, .Info. Each with a distinct style as show in the animations above. You can still override all other properties according to your liking.
position FeedbackPosition.Top Either .Top or .Bottom.
backgroundColor Depends on the type The background's color.
icon Depends on the type A custom icon shown on the left. Loaded from App_Resources/<platform> folders. Example here. Want no icon at all? Don't set a type.
android.iconColor See description On iOS the icon color is as-is, but on Android it's white. Set this color to override the latter (also see the TypeScript example below).
android.iconPulseEnabled true On Android you can disable the pulsating effect of the icon.
onTap undefined A callback function that gets invoked when the user tapped your feedback.
onShow undefined A callback for when the feedback is shown. iOS note: is called twice: once when animating and once when done.
onHide undefined A callback for when the feedback is hidden.

One of the examples in the demo app shows a custom icon and alternative colors. You'd get there by doing:

JavaScript

var FeedbackType = require ("nativescript-feedback").FeedbackType;
var FeedbackPosition = require ("nativescript-feedback").FeedbackPosition;
var color = require("color");

this.feedback.show({
  title: "Thumbs up!",
  titleColor: new color.Color("#222222"),
  position: FeedbackPosition.Bottom, // iOS only
  type: FeedbackType.Custom, // this is the default type, by the way
  message: "Custom colors and icon. Loaded from the App_Resources folder.",
  messageColor: new color.Color("#333333"),
  duration: 3000,
  backgroundColor: new color.Color("yellowgreen"),
  icon: "customicon", // in App_Resources/platform folders
  onTap: function() { console.log("showCustomIcon tapped") },
  onShow: function(animating) { console.log(animating ? "showCustomIcon animating" : "showCustomIcon shown") },
  onHide: function() { console.log("showCustomIcon hidden") }
});

TypeScript

import { FeedbackType, FeedbackPosition } from "nativescript-feedback";
import { Color } from "tns-core-modules/color";

this.feedback.show({
  title: "Thumbs up!",
  titleColor: new Color("#222222"),
  position: FeedbackPosition.Bottom,
  type: FeedbackType.Custom, // this is the default type, by the way
  message: "Custom colors and icon. Loaded from the App_Resources folder.",
  messageColor: new Color("#333333"),
  duration: 3000,
  backgroundColor: new Color("yellowgreen"),
  icon: "customicon", // in App_Resources/platform folders
  android: {
    iconColor: new Color("#222222") // optional, leave out if you don't need it
  },
  onTap: () => console.log("showCustomIcon tapped"),
  onShow: animating => console.log(animating ? "showCustomIcon animating" : "showCustomIcon shown"),
  onHide: () => console.log("showCustomIcon hidden")
});

hide

Hiding a message can be done automatically (see duration), by a gesture (tap / swipe), or programmatically as shown here:

this.feedback.hide();

Convenience functions

Since in many cases you want to only show success / info / warning / error messages anyway, this plugin's got you covered. You can call any of these functions and still pass in any of the aforementioned properties to tweak it to your liking:

success

this.feedback.success({
  title: "Awesome",
  message: "That was great!"
});

info

this.feedback.info({
  title: "Info <> Data",
  message: "Info is relevant data, not just any data."
});

warning

this.feedback.warning({
  message: "Your battery is almost empty"
});

error

this.feedback.error({
  title: "KABOoooOOM!",
  titleColor: new Color("black")
});

Credits

On Android we're using the Alerter library by Tapadoo, and on iOS ISMessages by ilyainyushin.

nativescript-feedback's People

Contributors

agisboye avatar dependabot[bot] avatar dosomder avatar eddyverbruggen avatar hamdiwanis avatar larssn avatar ticdenis avatar tomasklingen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nativescript-feedback's Issues

Vanilla javascript

Hi! How can i use this plugin in vanilla js? What should 'this' pointing to? It's throws error 'this' undefined. Demo or example would be great! Thanks!

Trigger without tap

Hi Eddy,

Thanks before for the plugin. I test it using Nativescript with Angular and it works fine. But i have a difficulty when using this feedback without a tap activity. It shows error below

JS: ERROR Error: Uncaught (in promise): Error: java.lang.IllegalArgumentException: Activity cannot be null!
JS: com.tapadoo.alerter.Alerter.create(Alerter.java:47)
JS: com.tns.Runtime.callJSMethodNative(Native Method)
JS: com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1088)
JS: com.tns.Runtime.callJSMethodImpl(Runtime.java:970)
JS: com.tns.Runtime.callJSMethod(Runtime.java:957)
JS: com.tns.Runtime.callJSMethod(Runtime.java:941)
JS: com.tns.Runtime.callJSMethod(Runtime.java:933)
JS: com.tns.NativeScriptActivity.onStart(NativeScriptActivity.java:44)
JS: android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1237)
JS: android.app.Activity.performStart(Activity.java:6253)
JS: android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379)
JS: android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
JS: android.app.ActivityThread.-wrap11(ActivityThread.java)
JS: android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
JS: android.os.Handler.dispatchMessage(Handler.java:102)
JS: android.os.Looper.loop(Looper.java:148)
JS: android.app.ActivityThread.main(ActivityThread.java:5417)
JS: java.lang.reflect.Method.invoke(Native Method)
JS: com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
JS: com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
JS: Error: java.lang.IllegalArgumentException: Activity cannot be null!
JS: com.tapadoo.alerter.Alerter.create(Alerter.java:47)
JS: com.tns.Runtime.callJSMethodNative(Native Method)
JS: com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1088)
JS: com.tns.Runtime.callJSMethodImpl(Runtime.java:970)
JS: com.tns.Runtime.callJSMethod(Runtime.java:957)
JS: com.tns.Runtime.callJSMethod(Runtime.java:941)
JS: com.tns.Runtime.callJSMethod(Runtime.java:933)
JS: com.tns.NativeScriptActivity.onStart(NativeScriptActivity.java:44)
JS: android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1237)
JS: android.app.Activity.performStart(Activity.java:6253)
JS: android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379)
JS: android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
JS: android.app.ActivityThread.-wrap11(ActivityThread.java)
JS: android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
JS: android.os.Handler.dispatchMessage(Handler.java:102)
JS: android.os.Looper.loop(Looper.java:148)
JS: android.app.ActivityThread.main(ActivityThread.java:5417)
JS: java.lang.reflect.Method.invoke(Native Method)
JS: com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
JS: com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Is using tap by design? or any idea to tap programmatically? Below is my app.component.ts

import { Component } from "@angular/core";
import * as pages from "tns-core-modules/ui/page";
import { Color } from "tns-core-modules/color";
import { Feedback, FeedbackType, FeedbackPosition } from "nativescript-feedback";

@component({
selector: "ns-app",
template: '<Button text="klik" (tap)="showNoIcon()">',
})

export class AppComponent {
private feedback: Feedback;

constructor() {
    this.feedback = new Feedback();
    this.showNoIcon();
}

public showNoIcon(): void {
  this.feedback.show({
    title: "Title only, not even an icon..",
    duration: 2000,
    // type: FeedbackType.Custom,
    onTap: () => { console.log("showNoIcon tapped"); }
  });
}

public hide(): void {
  this.feedback.hide();
}

}

Without "this.showNoIcon();" this plugin work fine.

TypeError: Cannot read property 'Alerter' of undefined

Unable to use this plugin when using it with angular just used whatever you write to include in your readme file.

After Watching closely this line probably root cause of the error, in your feedback.android.js

var alerter = com.tapadoo.alerter.Alerter.create(application.android.foregroundActivity)
               .setTitle(options.title)
               .setText(options.message)
               .setDuration(options.duration ? options.duration : 4000);

build failing after updating to latest version of NS n NS core modules

I'm getting this after upgrading to the latest version of NS.
image

my packages.json is

{
"description": "Darts Solutions Inc. (DSI) has supported a number of Ontario Government and private sector IT initiatives. Experience in social services has led DSI to realize many opportunities to help people with developmental disabilities to achieve their goals, participate in their communities, and have choice about how they and their families receive supports. MyDirectPlan (MDP) is a result of years of studying and meeting Passport and Direct Funding Families.",
"keywords": [
"My direct plan",
"funding management"
],
"license": "SEE LICENSE IN ",
"readme": "NativeScript Application",
"version": "0.1.0",
"homepage": "https://github.com/NativeScript/nativescript-sdk-examples-ng",
"repository": {
"type": "git",
"url": "https://github.com/NativeScript/nativescript-sdk-examples-ng"
},
"nativescript": {
"id": "org.nativescript.MyDirectPlan",
"tns-ios": {
"version": "next"
},
"tns-android": {
"version": "4.0.0-2018.3.22.2"
}
},
"scripts": {
"tslint": "tslint --project tsconfig.json --config tslint.json",
"ns-bundle": "ns-bundle",
"start-android-bundle": "npm run ns-bundle --android --run-app",
"start-ios-bundle": "npm run ns-bundle --ios --run-app",
"build-android-bundle": "npm run ns-bundle --android --build-app",
"build-ios-bundle": "npm run ns-bundle --ios --build-app",
"publish-ios-bundle": "npm run ns-bundle --ios --publish-app",
"generate-android-snapshot": "generate-android-snapshot --targetArchs arm,arm64,ia32 --install"
},
"dependencies": {
"@angular/animations": "^5.2.9",
"@angular/common": "^5.2.9",
"@angular/compiler": "^5.2.9",
"@angular/core": "^5.2.9",
"@angular/forms": "^5.2.9",
"@angular/http": "^5.2.9",
"@angular/platform-browser": "^5.2.9",
"@angular/platform-browser-dynamic": "^5.2.9",
"@angular/router": "^5.2.9",
"moment": "^2.21.0",
"nativescript-angular": "^5.3.0-2018-03-29-03",
"nativescript-background-http": "^3.2.2",
"nativescript-camera": "^3.2.1",
"nativescript-cardview": "^2.0.5",
"nativescript-checkbox": "^3.0.3",
"nativescript-exit": "^1.0.1",
"nativescript-feedback": "1.1.1",
"nativescript-floatingactionbutton": "^4.1.3",
"nativescript-geolocation": "^4.2.6",
"nativescript-image-swipe": "^2.1.0",
"nativescript-imagecropper": "^0.1.2",
"nativescript-imagepicker": "^4.0.1",
"nativescript-intl": "^3.0.0",
"nativescript-iqkeyboardmanager": "^1.3.0",
"nativescript-pdf-view": "^2.0.1",
"nativescript-permissions": "^1.2.3",
"nativescript-pro-ui": "next",
"nativescript-textinputlayout": "^2.0.3",
"nativescript-theme-core": "^1.0.4",
"nativescript-toast": "^1.4.6",
"ngx-order-pipe": "^2.0.1",
"reflect-metadata": "^0.1.12",
"rxjs": "^5.5.8",
"tns-core-modules": "^4.0.0-2018-03-27-02",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/compiler-cli": "^5.2.9",
"@ngtools/webpack": "^1.10.2",
"babel-traverse": "6.26.0",
"babel-types": "6.26.0",
"babylon": "6.10.0",
"clean-webpack-plugin": "~0.1.19",
"codelyzer": "3.2.2",
"copy-webpack-plugin": "~4.3.0",
"css-loader": "^0.28.11",
"extract-text-webpack-plugin": "~3.0.2",
"fs-extra": "^0.30.0",
"glob": "^7.1.2",
"lazy": "1.0.11",
"markdown-snippet-injector": "^0.2.0",
"nativescript-css-loader": "~0.26.0",
"nativescript-dev-sass": "^1.4.0",
"nativescript-dev-typescript": "next",
"nativescript-dev-webpack": "^0.10.0-2018-03-29-01",
"nativescript-worker-loader": "~0.8.1",
"node-sass": "4.5.3",
"opener": "^1.4.1",
"raw-loader": "~0.5.1",
"resolve-url-loader": "~2.2.1",
"rimraf": "^2.5.3",
"sass-loader": "^6.0.7",
"tar.gz": "^1.0.5",
"tns-platform-declarations": "^3.4.1",
"tslint": "5.8.0",
"typescript": "~2.6.2",
"uglifyjs-webpack-plugin": "^1.2.4",
"webpack": "~3.10.0",
"webpack-bundle-analyzer": "^2.11.1",
"webpack-sources": "~1.1.0"
},
"author": "Darts Solutions"
}

Change font

Good afternoon Eddy Verbruggen, you know if there is any way to change the font of alerts, thanks

ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'create' of undefined

: ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'create' of undefined
JS: TypeError: Cannot read property 'create' of undefined
JS: at Promise (file:///data/data/com.ibenchu.muslim/files/app/tns_modules/nativescript-feedback/feedback.js:17:55)
JS: at new ZoneAwarePromise (file:///data/data/com.ibenchu.muslim/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:777:29)
JS: at Feedback.show (file:///data/data/com.ibenchu.muslim/files/app/tns_modules/nativescript-feedback/feedback.js:15:16)
JS: at file:///data/data/com.ibenchu.muslim/files/app/register/register.component.js:69:28
JS: at ZoneDelegate.invoke (file:///data/data/com.ibenchu.muslim/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:365:26)
JS: at Object.onInvoke (file:///data/data/com.ibenchu.muslim/files/app/tns_modules/@angular/core/bundles/core.umd.js:4798:33)
JS: at ZoneDelegate.invoke (file:///data/data/com.ibenchu.muslim/files/app/tns_modules/nativescript-angular/zone-js/dist/zon...

failed to build plugin nativescript feedback

Hello.
when I launch:
"tns run android --bundle" returns the error with the plugin.
see photo.
I have already tried to remove the platform and change "a.p.i" and the emulator's android ... but nothing.
everything returns ok if I remove the plugin.
P.S.
In another project it works well but what you can read from the photo does not resolve dependencies.
eo

package.json:

{
"name": "caio",
"version": "1.0.0",
"description": "ciccio",
"author": "pirriaf",
"license": "MIT",
"nativescript": {
"id": "org.ciccioecaio.www",
"tns-ios": {
"version": "5.0.0"
},
"tns-android": {
"version": "5.2.1"
}
},
"dependencies": {
"@vue/devtools": "^5.0.6",
"nativescript-cardview": "^3.1.1",
"nativescript-fancy-list-view": "0.0.9",
"nativescript-feedback": "^1.3.9",
"nativescript-floatingactionbutton": "^5.0.3",
"nativescript-loading-indicator": "^2.4.0",
"nativescript-orientation": "^2.2.1",
"nativescript-socketio": "^3.2.1",
"nativescript-theme-core": "^1.0.4",
"nativescript-toasty": "^1.3.0",
"nativescript-ui-listview": "^6.3.0",
"nativescript-ui-sidedrawer": "^4.3.0",
"nativescript-vue": "^2.0.0",
"nativescript-vue-devtools": "^1.2.0",
"tns-core-modules": "^5.0.2",
"vuex": "^3.0.1"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"babel-loader": "^8.0.2",
"babel-traverse": "6.26.0",
"babel-types": "6.26.0",
"babylon": "6.18.0",
"clean-webpack-plugin": "^0.1.19",
"copy-webpack-plugin": "^4.5.2",
"css-loader": "^1.0.0",
"lazy": "1.0.11",
"nativescript-dev-webpack": "next",
"nativescript-vue-template-compiler": "^2.0.0",
"nativescript-worker-loader": "~0.9.0",
"node-sass": "^4.9.2",
"sass-loader": "^7.1.0",
"terser-webpack-plugin": "^1.1.0",
"vue-loader": "^15.2.6",
"webpack": "^4.16.4",
"webpack-bundle-analyzer": "~2.13.1",
"webpack-cli": "^3.1.0"
}
}

Icon from url

Hello, I am having an issue where the icon that I am wish to use in the feedback bar I can only access via a url rather than from the App_Resources/ folder. Would there be anyway to pass the icon property a url instead of a file name?

Cannot read property 'Alerter' of undefined

I was trying to use this plugin and when I try to show the alert, the following error is thrown!

ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'Alerter' of undefined JS: TypeError: Cannot read property 'Alerter' of undefined JS: at file:///data/data/org.nativescript.ergymobile/files/app/tns_modules/nativescript-feedback/feedback.js:20:46 JS: at new ZoneAwarePromise (file:///data/data/org.nativescript.ergymobile/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:777:29) JS: at Feedback.show (file:///data/data/org.nativescript.ergymobile/files/app/tns_modules/nativescript-feedback/feedback.js:18:16) JS: at MessageService.showError (file:///data/data/org.nativescript.ergymobile/files/app/shared/services/message.service.js:50:23) JS: at SafeSubscriber._error (file:///data/data/org.nativescript.ergymobile/files/app/login/login.component.js:34:38) JS: at SafeSubscriber.__tryOrUnsub (file:///data/data/org.nativescript.ergymobile/files/app/tns_modules/rxjs/Subscriber.js:242:16) JS: at SafeSubscriber.error (file:///data/data/org.nativescript.ergymobile/files/app/tns_modules/rxjs/Subscriber.js:201:26) JS: at Subscriber._error (file:///data/data/org.nativescript.ergymobile/files/app/tns_modules/rxjs/Subscriber.js:132:26) JS: at Subscriber.error (file:///data/data/org.nativescript.ergymobile/files/app/tns_modules/rxjs/Subscriber.js:106:18) JS: at MapSubscriber.Subscriber._error (file:///data/data/org.nativescript.ergymobile/files/app/tns_modules/rxjs/Subscriber.js:132:26) JS: at MapSubscriber.Subscriber.error (file:///data/data/org.nativescript.ergymobile/files/app/tns_modules/rxjs/Subscriber.js:106:18) JS: at FilterSubscriber.Subscriber._error (file:///data/data/org.nativescript.ergymobile/files/app/tns_modules/rxjs/Subscriber.js:132:26) JS: at FilterSubscriber.Subscriber.error (file:///data/data/org.nativescript.ergymobile/files/app/tns_modules/rxjs/Subscriber.js:106:18) JS: at MergeMapSubscriber.OuterSubscriber.notifyError (file:///data/data/org.nativescript.ergymobile/files/app/tns_modules/rxjs/OuterSubscriber.js:22:26) JS: at InnerSubscriber._error (file:///data/data/org.nativescript.ergymobile/files/app/tns_modules/rxjs/InnerSubscriber.js:26:21)

The error must be in the line
var alerter = com.tapadoo.alerter.Alerter.create(application.android.foregroundActivity) of the feedback.android.js

It seems like it can't find the Alerter native library! Can anyone help me?

IOS build failed ISMessages.m

Hy!

I created a new hello world project with:
tns create HelloWorld --template nativescript-template-ng-tutorial

and add this plugin:
tns plugin add nativescript-feedback

I catch the next error when I run on iOS emulator:

Building project...
Xcode build...
=== BUILD TARGET ISMessages OF PROJECT Pods WITH CONFIGURATION Debug ===
/Users/dembal/HelloWorld/platforms/ios/Pods/ISMessages/ISMessages/Classes/ISMessages.m:145:9: error: unexpected '@'
      in program
    if (@available(iOS 11.0, *)) {
        ^
/Users/dembal/HelloWorld/platforms/ios/Pods/ISMessages/ISMessages/Classes/ISMessages.m:148:38: error: property
      'safeAreaInsets' not found on object of type 'UIWindow *'
            insetCorrection = window.safeAreaInsets.bottom;
                                     ^
/Users/dembal/HelloWorld/platforms/ios/Pods/ISMessages/ISMessages/Classes/ISMessages.m:191:9: error: unexpected '@'
      in program
    if (@available(iOS 11.0, *)) {
        ^
/Users/dembal/HelloWorld/platforms/ios/Pods/ISMessages/ISMessages/Classes/ISMessages.m:194:39: error: property
      'safeAreaInsets' not found on object of type 'UIWindow *'
            insetCorrection = -window.safeAreaInsets.bottom;
                                      ^
4 errors generated.
** BUILD FAILED **

Unable to apply changes on device: ********************** Error is: Command xcodebuild failed with exit code 65.

tons info:
โ”‚ Component โ”‚ Current version โ”‚ Latest version โ”‚ Information โ”‚
โ”‚ nativescript โ”‚ 3.3.1 โ”‚ 3.3.1 โ”‚ Up to date โ”‚
โ”‚ tns-core-modules โ”‚ 3.1.1 โ”‚ 3.3.0 โ”‚ Update available โ”‚
โ”‚ tns-android โ”‚ โ”‚ 3.3.1 โ”‚ Not installed โ”‚
โ”‚ tns-ios โ”‚ 3.3.0 โ”‚ 3.3.0 โ”‚ Up to date โ”‚

TypeScript files are not being transpiled

I'm having trouble using this plugin in a vanilla JS project. It seems that the .ts files are not being transpiled. The plugin folder inside tns_modules contains only TypeScript files.

This is the only plugin I'm having trouble with. All other plugins with .ts sources are transpiled before being installed.

ERROR in app.android.js from UglifyJs Unexpected token: name (Feedback)

Hi first of all thank you for the plugin , i am trying to use the plugin in nativescript-vue but i get this error when compiling .

ERROR in app.android.js from UglifyJs
Unexpected token: name (Feedback)

Steps to reproduce the issue

1 - installing the plugin via npm
2 - adding the plugin

import { Feedback } from 'nativescript-feedback'

3 - adding vue prototype

Vue.prototype.$feedback = new Feedback();

Env

    "nativescript-vue": "^1.2.0",
    "tns-core-modules": "3.4.1",
     "nativescript-feedback": "^1.2.0",

error: unrecognized platform name iOS

tns debug ios --device 1

platforms/ios/Pods/ISMessages/ISMessages/Classes/ISMessages.m:146:20: error: unrecognized platform name iOS
if (@available(iOS 11.0, *)) {
^
platforms/ios/Pods/ISMessages/ISMessages/Classes/ISMessages.m:149:38: error: property 'safeAreaInsets' not found on object of type 'UIWindow *'
insetCorrection = window.safeAreaInsets.bottom;
^
platforms/ios/Pods/ISMessages/ISMessages/Classes/ISMessages.m:201:20: error: unrecognized platform name iOS
if (@available(iOS 11.0, *)) {
^
platforms/ios/Pods/ISMessages/ISMessages/Classes/ISMessages.m:204:39: error: property 'safeAreaInsets' not found on object of type 'UIWindow *'
insetCorrection = -window.safeAreaInsets.bottom;
^
platforms/ios/Pods/ISMessages/ISMessages/Classes/ISMessages.m:183:1: warning: conflicting return type in implementation of
'accessibilityPerformEscape': 'BOOL' (aka 'signed char') vs 'bool' [-Wmismatched-return-types]

  • (bool)accessibilityPerformEscape {
    ^ ~~~~
    In module 'UIKit' imported from /Users/mikemayori/Desktop/aws/aws-transcribe/platforms/ios/Pods/Target Support Files/ISMessages/ISMessages-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibility.h:296:1: note:
    previous definition is here
  • (BOOL)accessibilityPerformEscape NS_AVAILABLE_IOS(5_0);

onTap not executed if the application is in background

Hello, I have an issue trying to navigate to a view in my application after making tap over the push notification, I'm using the feedback plugin to perform this, if the application is running it works without issues but if the application is in the background, I get the push notification but after taping over it I just get my application launched again and nothing happens in my function to navigate to the view I want. This is a reference for the same issue but in a different plugin which is similar.
https://stackoverflow.com/questions/39001751/nativescript-call-to-certain-action-after-tapping-android-push-plugin-notificati

this.feedback.show({
                            title: message.title,
                            message: message.body,
                            icon: "AppIcon",
                            duration: 5000,
                            backgroundColor: new Color("green"),
                            onTap:()=>{
                                this.routerExtensions.navigate(['/message/chat', id], {clearHistory:true});
                            }
                        }).then(()=>{
                        });

If the application is active everything works as expected, it doesn't if the application is running in the background.

Anyway to stop the pulse on the icon on android

Is there anyway to disable the icon pulsing on android, i noticed that the plugin you use for android has an option to disable the pulse on the icon but i can't seem to find a way to disable it in your plugin.

Vue-demo doesn't work

I used the following commands:

git clone https://github.com/EddyVerbruggen/nativescript-feedback
cd nativescript-feedback/src
npm run demo-vue.android

Then I got this error:

The current application is not compatible with NativeScript CLI 6.0.
Use the `tns migrate` command to migrate the app dependencies to a form compatible with NativeScript 6.0.
Running this command will not affect the codebase of the application and you might need to do additional changes manually โ€“ for more information, refer to the instructions in the following blog post: https://www.nativescript.org/blog/nativescript-6.0-application-migration

So I tried to update it to Nativescript 6.0

By the following commands:

cd ..
cd demo-vue
tns migrate
cd ..
cd src/
npm run demo-vue.android

Error log:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\svend\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'demo-vue.android' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predemo-vue.android',
4 verbose run-script   'demo-vue.android',
4 verbose run-script   'postdemo-vue.android' ]
5 info lifecycle [email protected]~predemo-vue.android: [email protected]
6 info lifecycle [email protected]~demo-vue.android: [email protected]
7 verbose lifecycle [email protected]~demo-vue.android: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~demo-vue.android: PATH: C:\Users\svend\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;F:\Dev\TRA\Test\nativescript-feedback\src\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\HP\HP Performance Advisor;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files\dotnet\;F:\Go\bin;C:\ProgramData\chocolatey\bin;C:\Program Files\nodejs;C:\Program Files (x86)\Bitvise SSH Client;C:\Program Files\Git\cmd;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\Java\jdk1.8.0_191\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\Yarn\bin\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\wamp64\bin\php\php7.3.8;C:\ProgramData\ComposerSetup\bin;C:\Users\svend\.cargo\bin;C:\Users\svend\AppData\Local\Microsoft\WindowsApps;C:\Users\svend\AppData\Local\GitHubDesktop\bin;C:\Users\svend\AppData\Local\Microsoft\WindowsApps;;C:\Program Files\Microsoft VS Code\bin;F:\Program Files\SQL Operations Studio\bin;C:\Exercism;C:\Users\svend\AppData\Roaming\npm;C:\Users\svend\AppData\Local\Yarn\bin;C:\Users\svend\AppData\Roaming\Composer\vendor\bin
9 verbose lifecycle [email protected]~demo-vue.android: CWD: F:\Dev\TRA\Test\nativescript-feedback\src
10 silly lifecycle [email protected]~demo-vue.android: Args: [ '/d /s /c',
10 silly lifecycle   'npm run build && cd ../demo-vue && tns run android --bundle' ]
11 info lifecycle [email protected]~demo-vue.android: Failed to exec demo-vue.android script
12 verbose stack Error: [email protected] demo-vue.android: `npm run build && cd ../demo-vue && tns run android --bundle`
12 verbose stack spawn ENOENT
12 verbose stack     at ChildProcess.<anonymous> (C:\Users\svend\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:48:18)
12 verbose stack     at ChildProcess.emit (events.js:182:13)
12 verbose stack     at maybeClose (internal/child_process.js:962:16)
12 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
13 verbose pkgid [email protected]
14 verbose cwd F:\Dev\TRA\Test\nativescript-feedback\src
15 verbose Windows_NT 10.0.18362
16 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\svend\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "demo-vue.android"
17 verbose node v10.13.0
18 verbose npm  v6.4.1
19 error file C:\WINDOWS\system32\cmd.exe
20 error code ELIFECYCLE
21 error errno ENOENT
22 error syscall spawn
23 error [email protected] demo-vue.android: `npm run build && cd ../demo-vue && tns run android --bundle`
23 error spawn ENOENT
24 error Failed at the [email protected] demo-vue.android script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]

Feedback not showing up

Hi,

I am running NS 4.2.2 with updated core-modules (4.2.1) and ios (4.2.0). However, for some reason I don't get, all my feedback calls stopped to work (no errors, nothing, they simply don't show anymore).

Any ideas why?

Color Icon

Good night, excuse me you can tell me if the color of the icon I can change it in the plugin, since when I put an icon it changes to white and I need it in black color.

Thank you.

TypeError: Cannot read property 'create' of undefined

Hi Eddy!

I got mentioned typo error, I have tested in android device.

JS: TypeError: Cannot read property 'create' of undefined JS: at Promise (file:///data/data/org.nativescript.ISM/files/app/tns_modules/nativescript-feedback/feedback.js:17:55) JS: at new ZoneAwarePromise (file:///data/data/org.nativescript.ISM/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:902:29) JS: at Feedback.show (file:///data/data/org.nativescript.ISM/files/app/tns_modules/nativescript-feedback/feedback.js:15:16) JS: at Feedback.success (file:///data/data/org.nativescript.ISM/files/app/tns_modules/nativescript-feedback/feedback.common.js:19:21) JS: at HomeComponent.sendLocation (file:///data/data/org.nativescript.ISM/files/app/home/home.component.js:62:23) JS: at Object.eval [as handleEvent] (ng:///AppModule/HomeComponent.ngfactory.js:20:31) JS: at handleEvent (file:///data/data/org.nativescript.ISM/files/app/tns_modul...

Here is my package.json
{
"description": "NativeScript Application",
"license": "SEE LICENSE IN ",
"readme": "NativeScript Application",
"repository": "",
"nativescript": {
"id": "org.nativescript.ISM",
"tns-android": {
"version": "4.1.3"
},
"tns-ios": {
"version": "4.1.1"
}
},
"scripts": {
"lint": "tslint "app/**/*.ts""
},
"dependencies": {
"@angular/animations": "~6.0.6",
"@angular/common": "~6.0.6",
"@angular/compiler": "~6.0.6",
"@angular/core": "~6.0.6",
"@angular/forms": "~6.0.6",
"@angular/http": "~6.0.6",
"@angular/platform-browser": "~6.0.6",
"@angular/platform-browser-dynamic": "~6.0.6",
"@angular/router": "~6.0.6",
"nativescript-angular": "~6.0.6",
"nativescript-feedback": "^1.2.0",
"nativescript-geolocation": "^4.2.6",
"nativescript-permissions": "^1.2.3",
"nativescript-theme-core": "~1.0.4",
"reflect-metadata": "~0.1.10",
"rxjs": "~6.1.0",
"tns-core-modules": "4.1.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/compiler-cli": "~6.1.0-beta.3",
"@ngtools/webpack": "6.1.0-rc.0",
"babel-traverse": "6.26.0",
"babel-types": "6.26.0",
"babylon": "6.18.0",
"codelyzer": "~4.3.0",
"lazy": "1.0.11",
"nativescript-dev-sass": "~1.6.0",
"nativescript-dev-typescript": "~0.7.0",
"nativescript-dev-webpack": "~0.14.0",
"tslint": "~5.10.0",
"typescript": "~2.7.2"
}
}

.thanks

Iphone X safe area when status bar is off

Currently the feedback is cutoff on iPhone X if you also set the status bar to hidden:

info.plst

<key>UIStatusBarHidden</key>
		<true/>
		<key>UIViewControllerBasedStatusBarAppearance</key>
		<false/>

result:
screen shot 2018-12-05 at 4 29 59 pm

I cannot get feedback to work

Hello, I have nativescript version 5.0 installed and am on windows. I tried to add the feedback plugin to my app but it does not show when I press a button. Here is my code.

capture

Call feedback in a barcode scanner promise

I am trying to call the feedback in a barcode scanner feedback but it does not work. Here is my code.
var barcodescanner = new BarcodeScanner();
barcodescanner.scan({
formats: "QR_CODE", // Pass in of you want to restrict scanning to certain types
.... //more options
}).then(
function(result) {
var r = result.text.split("|");
//1. verification checks such as gps lat, lang range etc.
if(result is not in range){
var feedback = new FeedbackPlugin.Feedback();
feedback.error({
title: "Error: Please enable an internet connection!"
});
} else {
//do something else
}
},
function(error) {
console.log("No scan: " + error);
}
);

It does not work with nativescript 5.0 on the android platform.

It does not work with nativescript 5.0 on the android platform. Nothing happens! Also, nothing appears on the console. On Nativescript 5.0, does work only on IOS platform.

Here the Url repo. You just need generate a android build and install it on your device or simulator, after load the app, in home screen, push the button: "Call Feedback". Note that nothing will happen, even on console, nothing appear.
https://github.com/marcelbonfim182/sidedrawertest

Thanks for support!

Enums aren't converted into JS files for JS users

You have a couple different enums like the .TOP/.BOTTOM, and the type of dialog.

If you check the JS files that are generated -- these enums don't exist in the source so when you try and use them like your examples show it crashes...

2 messages at the same time on iOS

I've noticed I cannot have 2 messages showing up simultaneously (one on top and the other one in the bottom) with the current build.

Is there a way to do that?

[!] Invalid `Podfile` file: The target `Pods` already has a platform set..

I start getting this error . Is something changed in plugin?

 #  from platforms/ios/Podfile:85
 #  -------------------------------------------
 #  # Begin Podfile - node_modules/nativescript-feedback/platforms/ios/Podfile
 >  platform :ios, '9.0'
 #  

Edit I tried to delete content from node_modules/nativescript-feedback/platforms/ios/Podfile it passes build but after that I get error:

ERROR Error: Uncaught (in promise): ReferenceError: Can't find variable: ISMessages
file:///app/vendor.js:83034:37
ZoneAwarePromise@file:///app/vendor.js:80266:37

Enhancement: ability to show multiple message stacking them one over another

Hi and thank you for the awesome plugin!

Would be a cool enhancement if we can instantiate multiple feedbacks and show all of them on the screen, so that the second feedback would stack below the first one (if the position for both is top) if the first one haven't been clicked yet or timed out (with short duration param). This would cover cases where there is a need to show multiple messages one by one and we want to make sure the user read all of them before closing. We sure can show one then wait for the user to click it before showing another, but preferably they would appear in sync with related events, so shown right before the even started.

Feedback runs but doesn't appear on screen

Hello,
I'm stumped by a strange issue where i can see feedback code running and i can step through it in debugger but nothing shows up on the screen. To make the issue even stranger when the same code is run on a Mac in an android emulator feedback messages show up fine. But when compiling on Ubuntu feedback messages don't display anywhere (Android emulator, Genymotion emulator, nor debugging on connected device. I've tried everything i could think of but can't get the feedback to show. Any ideas or pointers would be greatly appreciated.

page.xml:

`
<Page
navigatingTo="onNavigatingTo"
xmlns="http://schemas.nativescript.org/tns.xsd" >

<GridLayout rows=", auto" columns="">
<Label text="Just label" textWrap="true" row="0" col="0" verticalAlign="center" />
<Button text="Feedback test" tap="{{ showMessage }}" row="1" col="0" />

</GridLayout>
</Page>
`

Code behind:

`
import { EventData } from "data/observable";
import { NavigatedData, Page } from "ui/page";
import { TempViewModel } from "./temp-view-model";
export function onNavigatingTo(args: NavigatedData) {
if (args.isBackNavigation) {
return;
}
const page = args.object;
page.bindingContext = new TempViewModel();
}

`

View model:

`
import { Observable } from "data/observable";
import { Feedback, FeedbackPosition, FeedbackType } from "nativescript-feedback";

export class TempViewModel extends Observable {
private feedback: Feedback;
constructor() {
super();
this.feedback = new Feedback();
}
public showMessage(): void {
this.feedback.show({
message: "Message body"
});
}
}
`

app.gradle:

`

android {
defaultConfig {
generatedDensities = []
applicationId = "com.app90dayreporter"
minSdkVersion 17
multiDexEnabled true
}

project.ext {
buildToolsVersion = "27.0.1"
googlePlayServicesVersion = "12.0.1" // should match Firebase plugin gradle
supportVersion = "27.0.1"
compileSdk = 27
targetSdk = 27
firebaseMessagingVersion = "+"
}

aaptOptions {
additionalParameters "--no-version-vectors"
}

}

`

package.json:

`
{
"name": "com.xxxxx",
"license": "SEE LICENSE IN ",
"readme": "NativeScript Application",
"repository": "",
"version": "0.1.0",

"nativescript": {
"id": "com.xxxxx",

"tns-android": {
  "version": "4.0.1"
},

"tns-ios": {
  "version": "4.0.1"
}

},

"scripts": {
"lint": "tslint "app/**/*.ts""
},

"dependencies": {
"nativescript-feedback": "^1.1.2",
"nativescript-plugin-firebase": "^5.3.1",
"nativescript-purchase": "^2.0.0",
"nativescript-theme-core": "1.0.4",
"nativescript-toolbox": "^3.0.1",
"nativescript-ui-dataform": "^3.5.2",
"nativescript-ui-listview": "^3.5.4",
"nativescript-ui-sidedrawer": "^3.5.2",
"node-sass": "^4.9.0",
"tns-core-modules": "^4.0.0"
},

"devDependencies": {
"babel-traverse": "6.26.0",
"babel-types": "6.26.0",
"babylon": "6.18.0",
"lazy": "1.0.11",
"nativescript-dev-sass": "1.3.5",
"nativescript-dev-typescript": "^0.5.1",
"tslint": "5.8.0",
"typescript": "^2.8.3"
}

}
`

Vuejs not showing

Is this working in vue? I tried to register it and dont know if im missing something. Hope someone can give me a hand. Pls kindly check the code bellow. thanks

`
//main.js
import { Feedback } from "nativescript-feedback";
Vue.prototype.$feedback = new Feedback()

//vue component
this.$feedback.success({
title: "Awesome",
message: "That was great!"
});
`

Add support for iPhone X

bildschirmfoto 2017-11-08 um 13 11 03
bildschirmfoto 2017-11-08 um 13 12 03

Currently unfortunately it looks terrible on the new iPhone so the plugin is not usable basically.

Anyone have a working example with $navigateTo?

Listening on a webhook in app.vue which triggers the message. I added the onTap() method with the code this.$navigateTo(MyChats) however it keeps crashing with:

NativeScript encountered a fatal error: TypeError: this.$navigateTo is not a function. (In 'this.$navigateTo(overview_MyChats_vue__WEBPACK_IMPORTED_MODULE_4_["default"])', 'this.$navigateTo' is undefined)

  • I guess the question here is what scope does OnTap() operate it?

I'm using Nativescript with VueJS

exemples on readme inaccurate.

These are the solutions i got to get the attributes set correctly!
Amazing plugin BTW, i'll keep using it since it's way better then Toasts!
And FYI, to get the icons flag set right, go to : ".\platforms\android\src\F0\res\drawable\IconsNamesHere"

feedback.show({
icon: "successicon", // 'success' or 'Success' aren't working, just use that one...
onTap: () => {
feedback.hide(); // don't use 'this.feedback.hide()'
}
});

Thank you so much for doing this Eddy!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.