Is there a way to add line break in react-native-email? - react-native

I have a feedback page, I am looking to have a section where onPress of a button the application opens the users default email service application and sends typed user feedback to a pre-configured email. I have accomplished all of this using react-native-email.
The captured user TextInput does go into the body of the email. However, there are no line breaks and this looks cluttered. I'm hoping to understand if there are any formatting tools to use with react-native-email, or if there is a way to simply add line breaks.
Here is the sample code
handleEmail = () => {
const to = ['caleb.dockal#gmail.com'];
email(to, {
cc: ['caleb.dockal#gmail.com'],
subject: 'Feedback',
body:
'What feature would you like to see in the app?' +
'\n' +
this.state.answer1 +
'\n' +
' How could we improve your experience? ' +
'\n' +
this.state.answer2 +
'\n' +
' How can we improve the rating system? ' +
this.state.answer3 +
' What information would you like to see about listed businesses? ' +
this.state.answer4 +
' How did you hear about the app? ' +
this.state.answer5 +
' What countries would you like to see the app in? '
this.state.answer6,
}).catch(console.error);
};```
I have tried inserting '\n' in between the strings and state objects and this does not work. Does anyone know of a solution?

Related

How to manage response assertion if the values are same but sequence changes in Jmeter

I am getting response, let's suppose {"profiles":{"HLS_1200":[{"profile_id":38,"quality_id":11}],"ADAPTIVE" {"L","XL","XXL"}, now every time when we hit the API the response is same but the sequence is getting changed and therefore assetion is getting failed.
Next time I will get the response like {"profiles":{"HLS_1200":[{"profile_id":38,"quality_id":11}],"ADAPTIVE" {"XL","L","XXL"},
I want to pass this response assertion even if the sequence is changed.
Go for JSONAssert library which performs "deep scans" and doesn't care about the order of the attributes
Obtain the following libraries and drop them to JMeter Classpath:
android-json-0.0.20131108.vaadin1.jar
jsonassert-1.5.0.jar
Restart JMeter to pick up the libraries
Add JSR223 Assertion as a child of the request which returns your JSON
Put the following code into "Script" area:
def expected = '{\n' +
' "profiles": {\n' +
' "HLS_1200": [\n' +
' {\n' +
' "profile_id": 38,\n' +
' "quality_id": 11\n' +
' }\n' +
' ],\n' +
' "ADAPTIVE": [\n' +
' "L",\n' +
' "XL",\n' +
' "XXL"\n' +
' ]\n' +
' }\n' +
'}'
org.skyscreamer.jsonassert.JSONAssert.assertEquals(expected, prev.getResponseDataAsString(), false)
More information:
Introduction to JSONassert
Scripting JMeter Assertions in Groovy - A Tutorial

SDK_ERROR At least one participant (other than self is required)

Hi Once I fill the contact form in and press the submit button i'm getting the following error, can anyone provide any assistance?
Error creating new complaint Error
at new circuit.Error (C:\Users\chrisconnolly\customer-support\node_modules\circuit-sdk\circuit.js:311:22)
at C:\Users\chrisconnolly\customer-support\node_modules\circuit-sdk\circuit.js:55977:28
at new Promise (<anonymous>)
at Object.createGroupConversation (C:\Users\chrisconnolly\customer-support\node_modules\circuit-sdk\circuit.js:55966:20)
at Object.createConversation (C:\Users\chrisconnolly\customer-support\circuit.js:23:19)
at Socket.<anonymous> (C:\Users\chrisconnolly\customer-support\server.js:78:32)
at Socket.emit (events.js:200:13)
at C:\Users\chrisconnolly\customer-support\node_modules\socket.io\lib\socket.js:513:12
at processTicksAndRejections (internal/process/task_queues.js:82:9) {
code: 'SDK_ERROR',
message: 'At least one participant (other than self) is required',
stack: 'Error\n at new circuit.Error ' +
'(C:\\Users\\chrisconnolly\\customer-support\\node_modules\\circuit-sdk\\circuit.js:311:22)\n' +
' at ' +
'C:\\Users\\chrisconnolly\\customer-support\\node_modules\\circuit-sdk\\circuit.js:55977:28\n' +
' at new Promise (<anonymous>)\n at ' +
'Object.createGroupConversation ' +
'(C:\\Users\\chrisconnolly\\customer-support\\node_modules\\circuit-sdk\\circuit.js:55966:20)\n' +
' at Object.createConversation ' +
'(C:\\Users\\chrisconnolly\\customer-support\\circuit.js:23:19)\n at ' +
'Socket.<anonymous> ' +
'(C:\\Users\\chrisconnolly\\customer-support\\server.js:78:32)\n at ' +
'Socket.emit (events.js:200:13)\n at ' +
'C:\\Users\\chrisconnolly\\customer-support\\node_modules\\socket.io\\lib\\socket.js:513:12\n' +
' at processTicksAndRejections ' +
'(internal/process/task_queues.js:82:9)'
Questions on specific example apps are better post in their respective repo's issues page. I.e. https://github.com/circuit/customer-support/issues
Now looking at the error you get, it says "server.js:78" (https://github.com/circuit/customer-support/blob/master/server.js#L78) which is the createConversation API. And given the error says "At least one participant (other than self) is required", I suspect you are not passing any users as first parameter. Looking at https://github.com/circuit/customer-support/blob/master/server.js#L54 shows that those supportUsers come from the config file "config.json".
Did you rename config.json.template to config.json as per instructions in the README? And did you edit the config file (https://github.com/circuit/customer-support/blob/master/config.json.template#L26) with those support users?

supercollider arduino serial communication

I am working on an arduino uno + supercollider 3 project.
Basicly: I have an arduino set up with potentiometers, a sensor and some buttons. I put the data of inputs in an array and send it to my computer trough serial.
Currently, my output in the Arduino serial monitor is as this:
271:189:75:0:0:0:1:0:0:0:0:0
If I open the serial connection in Supercollider, what arrives is this:
271
Only the first value in the array arrives correctly. (The same setup with just 1 Arduino input to Supercollider worked like a charm, by the way. I just can't get it working with an array of inputs from arduino to SC3.)
arduino code to send data at this moment:
teSturen = String(val_lichtPin) + ":" + String(val_Pot1Pin) + ":" + String(val_Pot2Pin) + ":" + String(val_Pot3Pin) + ":" + String(val_Pot4Pin) + ":" + String(val_Pot5Pin) + ":" + String(knop1Staat) + ":" + String(knop2Staat) + ":" + String(knop3Staat) + ":" + String(knop4Staat) + ":" + String(knop5Staat) + ":" + String(knop6Staat);
Serial.println(String(teSturen));
I put all the numbers together in one string with an : as seperator, then send this.
SC3 code to receive:
~ino = ArduinoSMS("/dev/ttyACM0",9600);
~ino.action = {
arg msg;
var amsg;
//amsg = msg.split($:);
msg.postln;
};
There is more code, but that is for appointing vars and args, defining synths, et cetera. I limited this to the bits where it doesn't work.
Any ideas on why SC3 only receives the first number? I have tried for example to recplace the seperator : by , or ;, to send it as multiple integers in stead of one string, ...
The goal of it for me, is to be able to control various synths in supercollider with fysical control potentiometers, because that's a lot more fun to play with than keyboard or mouse controlling synths...
I appreciate any help, thank you!
Pretty late, but this still might help. I used the same setup some years ago. I used
p = ArduinoSMS("/dev/tty.usbmodem3d11", 115200);
while{state==0}{
p.action = { |... msg| m=[msg[0],msg[1]];
do something with m[0] and m[1] ...
};
to parse the message stream. My setup only read arrays of two bytes (msg[0]and msg[1]), but this should be expandable.
The full source code is available on https://github.com/symbolrush/FridgeKiller and another project with the same setup on https://github.com/symbolrush/ColliDuino.
Hope this helps and good luck!

IBM MobileFirst -- get location

I have MobileFirst (V7.O) app . How do I get the current latitude/Longitude for the device. Basically, I am recording some information at various point in my app and user can be moving.. So, at various instance, I would like to get the current lat/log..
Can you please provide some hints and how to get this information
Thanks for your help
Cordova is bundled in your MobileFirst project. As such you can take use of Cordova APIs to achieve this.
See the following (scroll down to the API usage): https://github.com/apache/cordova-plugin-geolocation
// onSuccess Callback
// This method accepts a Position object, which contains the
// current GPS coordinates
//
var onSuccess = function(position) {
alert('Latitude: ' + position.coords.latitude + '\n' +
'Longitude: ' + position.coords.longitude + '\n' +
'Altitude: ' + position.coords.altitude + '\n' +
'Accuracy: ' + position.coords.accuracy + '\n' +
'Altitude Accuracy: ' + position.coords.altitudeAccuracy + '\n' +
'Heading: ' + position.coords.heading + '\n' +
'Speed: ' + position.coords.speed + '\n' +
'Timestamp: ' + position.timestamp + '\n');
};
// onError Callback receives a PositionError object
//
function onError(error) {
alert('code: ' + error.code + '\n' +
'message: ' + error.message + '\n');
}
navigator.geolocation.getCurrentPosition(onSuccess, onError);

How to make a clickable link that executes a command with bukkit

I'm trying to make a bukkit plugin and I can't seem to find any documentation on this but I've seen it done, How would I input commands into a chat message that a user could click on to execute a command on the server like "/motd" in the form of a clickable link like a URL
if (commandLabel.equalsIgnoreCase("cmd") {
player.sendMessage("Pick a command: " + </motd> + ", " + </mail> );
}
replacing "" and "" to output something like this:
Pick a command: MOTD, Mail
and clicking them would execute the command to the server as them. How would I do this?
You could do it like this:
IChatBaseComponent comp = ChatSerializer
.a("{\"text\":\"" + "Choose one: " + "\",\"extra\":[{\"text\":\"" + "MOTD" + "\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"" + "/motd" + "\"}}]}");
PacketPlayOutChat packet = new PacketPlayOutChat(comp, true);
((CraftPlayer) <player>).getHandle().playerConnection.sendPacket(packet);
This would send them a message showing:
Choose one: MOTD
and when the user clicked MOTD, it would run the command /motd as the player. Here's a little breakdown of what we're actually doing:
IChatBaseComponent comp = ChatSerializer
.a("{\"text\":\"" + "<Ignored Message> " +
"\",\"extra\":[{\"text\":\"" + "<Message that will be clicked>" +
"\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"" +
"<Command to be run when message is clicked>" + "\"}}]}");
PacketPlayOutChat packet = new PacketPlayOutChat(comp, true);
((CraftPlayer) <player>).getHandle().playerConnection.sendPacket(packet);
The above code will send the player:
<Ignored Message> <Message that will be clicked>
and when the player clicks <Message that will be clicked>
they will run the command <Command to be run when a message is clicked>, and because it does not start with the command prefix, /, it will force them to chat <Command to be run when a message is clicked>.
Unfortunately, as far as I know, you can only put one click event per message, so you would have to do something like this:
Choose one:
MOTD
Mail
So you would have to do, where the variable player is the player:
player.sendMessage("Choose one:");
IChatBaseComponent comp = ChatSerializer
.a("{\"text\":\"" +
"\",\"extra\":[{\"text\":\"" + "MOTD" +
"\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"" +
"/motd" + "\"}}]}");
PacketPlayOutChat packet = new PacketPlayOutChat(comp, true);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
IChatBaseComponent comp2 = ChatSerializer
.a("{\"text\":\"" +
"\",\"extra\":[{\"text\":\"" + "Mail" +
"\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"" +
"/mail" + "\"}}]}");
PacketPlayOutChat packet2 = new PacketPlayOutChat(comp2, true);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet2);
When MOTD is clicked, /motd will be run by the player, and when Mail is clicked, /mail will be run.
Just as a side note, you will need to include craftbukkit in your build path, along with bukkit to do this
Or you could simply just do this (I did my own, You can edit it)
/execute #a ~ ~ ~ tellraw #p ["",{"text":"Click this to die","color":"dark_red","bold":true,"clickEvent":{"action":"run_command","value":"/kill #p"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"Kills you!"}]}}}]
run_command can be replaced with Open URL too.
You can replace dark red with any colour too. You can replace true with false for bold if you want, /kill #p can be replaced with a command (Or a https:// link if you do Open URL, show_text can be replaced with Show Item, Show entity, or Show Achivement. Text & Kills you can be replaced with the different thing (eg, Show entity) (Entity replaces text)
I found a website if your stuck! Good day :) http://minecraftjson.com/