xmpp: ios: get user's current status after unblocking - ios

I am developing an iOS chat application using XMPP. My problem is that, I have user A and B, User A blocks User B, while User B is available. Next User B goes busy and User A unblocks User B, User A sees User B as available rather than busy. How can I get user's current status after unblocking? I've read through XMPP documentation but it din't help.
A quick response is very appreciable

Related

How to detect busy state in Twilio iOS SDK?

I have successfully implement a APP to APP calling in iOS app using Twilio iOS SDK.
I have facing a problem in that Twilio SDK. I have explain with some step as below.
There are three user. User A, User B, User C
Step 1 : User A is calling to User B.
Step 2 : Now User C is calling to User A. User A is already talk with User B so what about User C. How can i identify busy state.
You can check this from your server-side app and relay the result to your iOS app.
The Dial verb includes an attribute named action which lets you specify a web application URL for Twilio to request when the call leg ends. That request includes a parameter named DialCallStatus which will tell you why the called ended. The DialCallStatus values include busy indicating Twilio received a busy signal when trying to connect to the called party.
https://www.twilio.com/docs/api/twiml/dial#attributes-action-dial-call-status-values
Once your web application knows the DialCallStatus, you can relay it back to your iOS app and notify User C accordingly.

Creating private messages

I'm writing a simple mini-chat with custom User model and authentication via omniauth. The chat uses web-socket faye-rails to send and display messages instantly without refreshing the page. The matter is that I'd like to add private messages - I mean, that I can choose an user and start our own dialog in a secondary chat window. I've looked for the solutions, but everything I found was about e-mailing - with inbox messages, trash cans and so on. So I wonder if there's any solution easy to implement.
The source code of my chat is here
Welcome to push technology and active web design!
When someone logs in, present them with a list of friended accounts and logged in state. For logged in friends, they can select a friend from the list and start a chat session in a new window. For logged out friends, they can send a message that's delivered the next time the recipient logs in.
You'll then have to create a friending mechanism that allows a user to request a connection to a prospective friend, be notified of pending connection requests, approve friend requests, and an unfriend feature. Hopefully that one won't be used too often.
I've worked with Faye & I like Faye but also take a quick look at the beta release of Rails 5. Action Cable will do the same thing and the framework support is better.

How do I ensure that only one instance of an iOS app is running?

I have an iOS app that permits people to "claim points." I want to prevent a scenario where someone opens the app on their phone, another instance on an iPad and then submits claims in both places.
Presently the app "registers" as the active instance when it starts up. If a second instance starts, it will take control and any attempt by the first instance to save data will result in a redirect that tells the user not to have two apps open. I have seen some games (e.g. Clash) that immediately inform the user of the first app that they are being kicked the moment that the second app opens.
I can think of two ways to do this: submit a "heartbeat" every few seconds to see if we are still the controlling app (wasteful) and some form of notification to all other apps when a new instance opens. Can standard iOS notifications play this role or are they just for popping up notifications to the user?
Any insight into how to post a notice to all other instances of an app when one instance opens up that doesn't require polling would be appreciated!
You can manage this problem on the server side.
Apparently users have to login or at least, your app auto-login with a unique ID with a server.
If you have an API to receive a claim, you can simply check if an identical claim already exists for this Unique ID and return an error to the second device when that is the case.

The deletion of iPhone application data from remote server

What I am trying to do is when a user deletes data from server end & thus
same data saved locally on mobile app should be deleted.
Scenario:
Employee A is working in organisation & employee A is having
organisation app & app data. When Employee A leaves the
organisation, data from his organisation app can be deleted by
organisation authority from server end without asking the Employee A.
The mechanism to do this might be
A. Manually check at regular interval from server whether the data
exists on server side. The mechanism is inefficient.
B. Push Notification: This looks good that whenever data is deleted
from server end, push notification get fires and ask app to delete
respected data. The issue is user i.e Employee A may stop push
notification of app.
C. Both A & B.
Query:
So Please suggest what can be trusted & efficient way (A-C or any) to implement above scenario.
You could simply check, at app launch time or when it is woken from sleep, if data needs to be deleted. You could design a specific API endpoint on the server end which would allow that. Plus, that mechanism would also allow some kind of interaction with the user, to let him know that his data has been deleted.

QuickBlox Chat: How to detect that another user has disconnected?

I am implementing a chat application for iOS. Here is the scenario:
Two QBUUsers engaged in an active exchange of chat messages.
User1 goes offline for some reason (disconnects or app goes to background). Lets assume that the app called logout on the QBChat instance.
User2 sends a ChatMessage to User1 because he thinks User1 is still online.
I should send a Push Notification to User1 instead, but how do I detect that User1 is no longer available to receive a ChatMessage?
I saw that on StackOverflow someone recommended checking the "last_request_at" property on a QBUUser, but that seems heavy-handed since I have to query the server every time I send a ChatMessage. Also that will not tell me when they logged out of the QBChat instance.
My fallback plan is to track user login/logout on our own app server (not rely on QuickBlox server). Any elegant solution here using the QuickBlox SDK?
You have 2 ways what to do:
1) Use contact list http://quickblox.com/developers/SimpleSample-chat_users-ios#Contact_list
With contact list you can track online status of user for your contact list. Contact list is similar to common friends list like in Facebook.
2) send Push Notifications for every message. If user is offline - he will receive it. If user is online - just ignore this push.

Resources