navigator.share() doesn't work as expected in iOS email - ios

I'm trying to implement a share button on my website, but I'm having problems with iOS Safari.
var title = "Subject";
var text = "Body";
var url = "https://google.com";
if (navigator.share) {
navigator.share({
title: title,
text: text,
// url: url,
})
.then(() => console.log('Successful share'))
.catch((error) => console.log('Error sharing', error));
}
else{
window.open("mailto:?subject="+encodeURIComponent(title)+"&body="+encodeURIComponent(text)+" "+encodeURIComponent(url), '_blank');
}
It works fine on android, but if I try to send an email from an iPad the subject is not set, and when I send the email the subject becomes the whole message. I suspect the iOS' mail app doesn't receive the data in the same way as the android's gmail app.
Is it a known issue? Is there a workaround?
Thank you!

If you only pass the title navigator.share({ title, }) you'll find that in Apple's Mail, it becomes the body of the email, not the subject. This is contrary to Gmail on Android which uses the title to populate the subject.
Unfortunately, the spec doesn't spell out how the title should be used:
title member The title of the document being shared. May be ignored by the target.
See this article for more nuances and examples of navigator.share in iOS/Mac OS.`

Related

Mandrill embed image cannot get interpreted properly

I'm using Mandrill in Nodejs to send emails to customers, and want to embed an image in my html content attached to the emails. I found some solutions from https://mandrill.zendesk.com/hc/en-us/articles/205582457-Tips-for-using-images-in-Mandrill-emails and decided to use the 4th one, which includes the image inline in the html. The code is as below:
var message = {
html: htmlContent,
subject: "Subject",
...
images = [{
"type": logo.logoType, // which is "image/jpeg"
"name": "logo",
"content": content // the content is valid when using in <img src="data:image/jpeg;base64,content"> directly
}]
};
mandrillClient.messages.send({
message: message
}, function() {
callback(null);
}, function(err) {
callback(err);
})
And the corresponding html code in htmlContent is
<img src="cid:logo">
However, when I checked with the sent email in Mandrill Outbound Activity, "View Content" doesn't show the image correctly. And I looked at the html source, found the image code was still as
<img src="cid:logo">
The plain text didn't get replaced by image data.
How can I get it work properly? Any ideas?
Thanks in advance.
Finally I found it just didn't work when checking the sent email in Mandrill Outbound Activity, but it works fine in your actual email inbox. So it means you will never see the embedded image when do testing, you must send it with production api key and see the results in a real email inbox.
Just FYI. Hope no one will waste any time on this like I did. :)

Worklight: Push message formatting

In Worklight, I have setup Push message for iOS and it works fine. Now for testing purpose, when i am sending push via URL call then the message title comes correctly while the body (payload) part truncates all spaces and shows all words together.
For example:
http://mydomain/myApp/invoke?adapter=aaPushAdapter&procedure=sendPush&parameters=["aahad","General Title 2", "This is General message body 2"]
then , title comes as "General Title 2" and the body part comes as "ThisisGeneralmessagebody2"
My Adapter is declared as:
function sendPush(userId, msgTitle, MsgContents){
var userSubscription = WL.Server.getUserNotificationSubscription('aaPushAdapter.PushEventSource', userId);
if (userSubscription==null){
return { result: "No subscription found for user :: " + userId };
}
WL.Server.notifyAllDevices(userSubscription, {
badge: 1,
sound: "sound.mp3",
activateButtonLabel: "Read",
alert: msgTitle,
payload: {
msg : MsgContents
}
});
return { result: "Notification sent to user :: " + userId };
}
(1) Now how I can preserve this formatting ?
(2) If i have to send URL then how i format and send my message?
Please suggest. Thanks
If %20 does not work, then change all spaces to something like '|', and then unencode this in your app. Or hex encode the whole string so it's one continuous alphanumeric string.
I am not entirely sure how you are using the URL as a means to send the push notification. Do you mean that you actually go to the browser and type this text in the address bar...? You're not supposed to do that (for other than quick tests). There are backend systems that should do that for you.
Anyway, instead of the space between words, use "%20" (w/out the quotation marks) and see if the text is then displayed with spaces in the dialog.

Facebook Private Message in Titanium

I am trying to send Facebook Private in my Titanium Application.I have tried in following two ways but i didn't get any success.
Method 1:
var data = {
link: "https://developer.mozilla.org/en/JavaScript",
name: "Best online Javascript reference",
message: "Use Mozilla's online Javascript reference",
test: [ {foo:'Encoding test', bar:'Durp durp'}, 'test' ]
};
var friendFbId = "xxx"
var path = friendFbId+"/feed"
Titanium.Facebook.requestWithGraphPath(path, 'POST', data, showRequestResult);
It is works fine but it is posted in my friend's timeline. But I need a private message(should be visible to my friend only).
Method 2:
var data1 = {
link: "https://developer.mozilla.org/en/JavaScript",
name: "Best online Javascript reference"
};
Titanium.Facebook.dialog("send", data1, showRequestResult);
I am getting folowing error
error_code=3&error_msg=This+method+is+not+supported+for+this+display+type
Any one help me to solve this issue. I am using Titanium 1.7.5 and ios. Thanks in Advance
According to Facebook the send dialog is currently not supported on mobile devices:
https://developers.facebook.com/docs/reference/dialogs/send/
The API doesn't allow for private messages, the closest you'll get would be to use the send dialog.
http://developers.facebook.com/blog/post/514/
https://developers.facebook.com/docs/reference/dialogs/send/
I'd suggest playing around with the different display parameter settings to see if one of them might work
http://developers.facebook.com/docs/reference/dialogs/#display
page
popup
iframe
touch
wap

Problem attaching file programmatically to blackberry Email Client

I am attempting to attach an excel spreadsheet to an email programmatically, and then launch the default blackberry email client with the message as an argument. Unfortunately, I receive the error: "Email service does not support these types of attachments. Change the Send Using field or remove the attachments." The send button is not present, and there is no "Send" option in the menu; this is blocking the ability to send the email.
This error occurs when I load the package onto my physical blackberry phone, as well as in the simulator.
I am able to send the email without a hitch if I use the API instead (the commented transport.send line).
Any and all input would be greatly appreciated, and if I've overlooked some details please let me know.
public Email()
{
try{
message = new Message();
multipart = new Multipart(); //Multi part can hold attachment AND body (and more)
subject = "Service Change Request";
multipart.addBodyPart( new TextBodyPart( multipart, "Hi XXXXXX, \n Here are the details for CLIENT" ) );
byte[] data = null;
InputStream stream = MyAPP.getUiApplication().getClass().getResourceAsStream("/blank_form.xls");
data = IOUtilities.streamToBytes(stream);
stream.close();
multipart.addBodyPart( new SupportedAttachmentPart( multipart, "application/octet-stream", "ServiceUpdate.xls", data ) );
Address recipients[] = new Address[1];
recipients[0]= new Address("*******#gmail.com", "user");
message.setSubject(subject);
message.setContent( multipart );
message.addRecipients(Message.RecipientType.TO, recipients);
//Transport.send(message);
}catch(Exception e){
}
}
public void send(){
Invoke.invokeApplication( Invoke.APP_TYPE_MESSAGES, new MessageArguments( message ) );
}
EDIT:
The error comes up because the simulator has no email account configured. It should work just fine on any phone that has an email account properly configured.
I hope this helps and I am not too late to lend a hand on this post.
I've worked with attachments before, and they are a pain to work with in Blckberry.
The only issue I can think of is the MIME type you are trying to use.
"Application/octet-stream", try using the MIME corresponding to the extension of the attachment, for example "application/excel" for .xls files. You can find the complete list here , its the longest one I could find.
There are also some issues with the Blackberry email service and attachments that are mentioned on several Knowledge Base Articles on the official Developers page like this one, they sometimes say that the attachments have to be prefixed with "x-rimdevice" in the file name, like "x-rimdevice-serviceupdate.xls". Although I'm not really sure this affects on outgoing email, but I thought it was worth mentioning.
By the way, I'm trying to use your code for an App I'm coding right now, so I'm kind of hoping it works.

Facebook Graph Feed Post Not Including Message

I have the following snippet to post to a user's feed on Facebook:
require 'httparty'
token = "..."
message = "..."
url = URI.escape("https://graph.facebook.com/me/feed?access_token=#{token}")
response = HTTParty.post(url, body: { message: message })
This posts to the wall, but no message is included. Any ideas what's wrong?
Edit:
I tried changing out the message for a caption or description and both failed as well.
Solution is to change HTTParty from using body to query for posting form data:
require 'httparty'
token = "..."
message = "..."
url = URI.escape("https://graph.facebook.com/me/feed?access_token=#{token}")
response = HTTParty.post(url, query: { message: message })
Based on the link cited above, it appears message functionality has been completely removed from the feed connection since July 12.
This is a problem for my current app as it is specifically a public opinion site. Asking users to express their opinions authentically is an important part of our design and we'd like to give them the option to post that to their feeds on Facebook as well.
Per the Facebook terms of use IV.2, "You must not pre-fill any of the fields associated with the following products, unless the user manually generated the content earlier in the workflow." The new change appears to change the terms of service: in my use, I am specifically asking the user to generate the content earlier in the workflow, but I still can't use it to pre-fill the feed dialog.
Anyone have any ideas or insight?

Resources