Passbook Update Notification Message - ios

I have a small problem with the notification message shown on the device when the pass is updated. I want the message to be what I set in the "changeMessage" in one of the Pass Structure Dictionary Keys. Instead what is displayed is what I am assuming to be the default change message which is "Coupon changed". I have "changeMessage" key in the "backFields" key. I have set the value of that key to some text of my own (which does not include "%#" as said in the description of key here).
Due to the requirements I am working on, I cannot use "%#" there, as it will just replace it with the whole value against the "value" key. So any way to accomplish this yet still ?

Unless %# is present in the message, you will only ever see the generic message "Coupon Changed" that you have described.
If you do not want the field value to show then you can include the message you want then pad with spaces before ending in %#. The spaces will ensure that the value is not shown on the lock screen and should help achieve your goal.

Related

iMessage identifiers converted to phone number instead of name

I’m developing an Messages extension. When it comes time to send a message, I want it to show up as something like: “Jeff sent a message.”
However, the MSConversation APIs only give us identifiers. When you use these identifiers in the MSMessage layout, it’s supposed to convert them to a name. When I attempt to do this, I see that it does indeed convert the identifier, but it converts it to the phone number of the participant rather than their name.
In other words, the following:
layout.caption = "$\(uuidOfTheParticipant) sent a message"
Shows up as “+15555551234 sent a message”. I’d like it to show a name instead of the phone number.
I searched the documentation to verify that this should be the behavior. I found out it was documented in the WWDC 2016 session 224 video. This was called “iMessage Apps and Stickers Part 2”. The video has been taken down since, so I had to rely on this transcript, where it states:
similarly, you can use these identifiers in the text passed to the Messages sumamaryText. When Messages displays the UI for the bubbles with this type of formatting in their text, it will replace the identifiers with the contact name of the person that their identifier maps to.
In both cases, it sounds like the name of the participant should be showing up rather than their phone number.
I tried updating my contact’s number to look exactly like the one that’s being output (I.e. “+1” in front), but it’s still showing the phone number rather than the name.
Does the API no longer show names, or am I doing something wrong?

How to transmit alert variables by E-mail message

I’m a newbie in AggreGate IoT platform and I’m trying to use its Alerts feature. I need to insert the name of the device that triggered the alert into the email message being sent.
I see some Alert Examples in the documentation but I can’t find the way to extract the context of the current device. I’ve tried to write the Alert Message expression like {env/context} or cell({env/context},"value") but it has no effect.
Please help me to make it work.
You need to send e-mail when Alert rises or deactivates, but with your own subject and message format.
Open "Automatic Corrective Actions" tab
Add action "Execution type" - Rise, "Action" - Send E-mail and click on "Parameters" field.
You should see e-mail sending parameters, such as Recipients, Subject, message, etc. You can write it by yourself or use bindings, in our case we will use bindings.
To get variables from alert we should use an expression for ex. "cell({env/value},"trigger")". This expression will return "Trigger message". You can get any variables that we have in Alert Event (see attached screenshot).
When you get variable value, you can use it with AggreGate expression language. For example, if you get cell({env/value}, "context") it will return context of the device for which this alert was set. You need to get name of this device, using context - you can write expression cell(getVariable(cell({env/value}, "context"),"genericProperties"),"name").

How to load contact field token in email template based on condition

I want to show the contact first name in the e-mail, but if the first name field is empty I want to show some other field. Is this possible?
Something like this:
Hi {contactfield=firstname} or if empty {contactfield=email}
Thank you in advance.
Yes it is possible, you can use "Dynamic Content" option available in slot type. it allows you to use variations in the content based on value of the the field.
simply add the slot, then put in a default value, click Add Variant and at the bottom right you can choose the field and comparison option.

Firebase (Swift) - generate unique ID with numbers only?

Right now, I'm generating unique IDs with childByAutoId(), but was wondering if there was a way to do this only generating numbers, no letters or other characters?
The reason is I need to be able to automatically send this key through imessage (part of how I send invites) and when it contains letters you're not able to automatically select and copy the key without copying the entire text message. With numbers only the key will be underlined and selectable.
Is there a way to either generate an ID with numbers only, or to selectively underline part of an iMessage with MFMessage in Swift?
Thanks!
I've need a similar option. When i create a new user; it will have a numberID which will be unique. I've tried .push() method which is for android, creates a uniqueID but with characters(letters) included. What i've done was something like this;
When i add a new user, i increment a value from different branch which is User2Key in this situation. And gave the value as key(parent) of newly added user.
When i delete or update a user, User2Key will be the same. If i add a new user then it will be incremented so every user will have uniqueID.
You can use a similar approach.
Hope this helps! Cheers!

iOS: Accessibility support for dynamic labels / validation errors?

I want to enable accessibility support in my app where i have In-line validation message (e.g As per below screenshot) when user enters something invalid data. My app doesn't show any error message.
What can be best and intuitive way to inform visual impaired/blind user about wrong data entries. e.g. Username & password mismatch, invalid.
First off, there is no "correct" way to do this. There are just a bunch of ways that work. The "best" way to do this, would be for iOS to have a "required" trait (IMO). But this is not supported, so we have to work with what iOS has given us... hints and labels.
Step 1:
Tell the user what is required. I would do this by adding the information to the hint. I like to add information to the hint that only non-familiar users need. "Power users" of your application will get use to what fields are required (assuming you're going to have return users, some views are just "hit and run" types). But, point being, don't flood users with unnecessary information. Users who visit a particular view frequently will get use to what is required, so keep non-crucial information in the hint. What you want is voiceover to read out the text input fields like this: "Email(accessibilityLabel) text field (the type of object), (pause) This field is required.(hint)" Don't wait until after a failure to provide this information to VoiceOver users. It should just always be set this way. If the type of failure changes, change the hint to adapt to this particular type of failure. If you'd like to keep the hint in sync with the Red highlighted labels, you can consider overriding the functions from the UIAccessibilityProtocol to pull out this information EX:
- (NSString*)accessibilityHint {
return myUILabel.text;
}
This should cause to keep the hint of the object, and the text of your UILabel in sync.
Step 2:
Mark all elements that are not the text input fields, as not accessibility elements. All of the information a user needs about those fields is either stored in the type of the field (a text input field), the label (email/password), or the hint (whether or not it is required). Therefore, we don't want VoiceOver to look at the other elements, because this would be duplicate information.
Step 3:
Use the following line of code:
UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, anAccessibilityElement);
In your login action. On a failed login action, you should shift voiceover focus to the element that caused the failure. This informs the user that their action was attempted, and that it failed. It also allows them to easily know which element caused the failure, and that it needs fixed. In the event of multiple failures, make sure you shift focus to the first failure!

Resources