How to send numbers in User Attributes on Firebase? - ios

I'm trying to send numbers in my Firebase application to send notification to specific users and I noticed that we can use numbers but there's only this function to send string data
FIRAnalytics.setUserPropertyString(numberOfOrders, forName: TrackingConstants.UserAttributeKeys.NumberOfOrders)
Is there an other function for sending numbers or does Firebase threat any numbers sent as a string like a number once it receives the data? I could not find any documentation on how to use numbers for User Attributes.

You can use the operators on the UserProperty just like Numbers even though it is set as a string.

Related

Gmail api get labels avoid capital letters

I'm currently using Gmail api and getting gmail api labels return capitalized letters.
Like Inbox is returned as INBOX
id = INBOX;
name = INBOX;
type = system;
Could anyone please share what query to pass to get correct label names?
In the API, system labels (e.g. INBOX, SPAM, etc.) are capitalized, there's just no way to return them "correct" (as in the UI).
If you want to retrieve the label with only the first letter capitalized, you'll have to modify the label string after it is returned by the API.
Reference:
Types of labels

Find Country Code from Phone Number

In my app , I am using phone numbers like +17896786788,+322657579849.
I would like to retrieve only the country code i.e, +1 or +322 by passing any phone number, that is I will send phone number and it will return the country code of that number.
Is there any API or anything available to get the country code from the phone number?
How can I find that?
I dont know about an API for splitting country code from a phone number,
But you can use this link to get all countries and their corresponding codes. Its a json file. You first parse all codes to an array from this json and then compare each element wth your phone number by using "range" funtion along with + symbol
Try it. U will get it.

Firebase - Query against array values

I have an array with usernames and would like to query that again the available users in the database and get their details (age, number, address, etc.).
How to do that in Firebase using Swift? I was thinking of doing a for loop and within it I could append to array of type Users, but doesn't that mean that number of requests made to Firebase will equal to number of users in the array? That can't be the way to go...
Thanks,

GET request in Rails with big count of params

I want to make some Rails API for a mobile app, and there is the following situation: my app will authorize using a phone number (like Viber / WhatsApp); also it can automatically detect which contacts from a phone book also have my app installed. If I understand right I should create some GET method to take array of numbers and return numbers of users which have been in my system already. There are no problem with GET method for me and arrays in GET params, but phone book of users can be very big, and sending all numbers in GET params is not good solution. How can I do it right? Should I divide numbers in parts and send first 10 numbers, then next 10 numbers etc? Thanks in advance.
Just use a POST request instead. You don't have to always use GET when you're searching for stuff.
You could also optimize your query string:
?ph=5551112222,5552223333...
This at least minimizes the request size. I think Rails should give you params[:ph] as an array. If not then splitting the string on a comma is just one extra line of code.

iOS formatting phone numbers from address book

My app uses the user's phone number as unique username, and it also sync all of his contacts so he can send them messages.
So, I need a way to format all the phone numbers I'm getting from the phone's address book.
I need to know for a given number:
Country code (if exists).
The number itself.
And if the number includes some international call prefix, it should be remove from the number.
So for example if I have a contact with the number
014 1 3728834122
The format should tell me that the country code is 1 and that the number is 3728834122 (I don't care about the 014 prefix)
What interesting is that the native phone address book seems to know how to format the number, I can see it while typing a new number, it added () or spaces when needed.
So my question is:
Can I query the native address book for a given number, what's his country code & number?
Does anyone knows a good library that do this kind of formatting?

Resources