Wednesday, April 17, 2013

How to test Facebook Chat Heads and stickers for iOS right now, even if your account hasn't been enabled for them yet

How to test Facebook Chat Heads and stickers for iOS right now, even if your account hasn't been enabled for them yet

Today Facebook released a fairly major update for the iOS Facebook app. Among the new features are messenger stickers and Chat Heads (a horribly named feature first announced for Facebook Home). Currently these new features have only rolled out to a limited number of users. However, if you have an urgent need to test them out, and you don't mind doing a little tweaking, you can temporarily enable them on your iOS device right now.

The easiest feature to enable is Chat Heads. Chat Heads basically gives you a way to quickly access your current messenger conversations no matter where you are in the app. Whether or not the app shows this feature to you is determined by a key stored in a property list. Using PhoneView, you can navigate to Facebook/Library/Preferences on your device and grab the file com.facebook.Facebook.plist. This plist holds a number of keys and values that the Facebook app uses to determine how it should behave. Open the plist in Xcode (or your favorite plist editor) and look for the key messenger_chat_heads_ios. If this key doesn't exist in your plist, you can just add it to the top level of the file. Simply change this value to YES (or </true> depending on what you're editing it in), save the plist, and drag the modified plist back onto the device using PhoneView. After putting the modified plist onto your device, kill the Facebook app and relaunch it in order for it to read your new settings. Now when you have chat conversations going with people, you should see little circles with their avatars persist on the screen as you navigate around the app.

So what about stickers? A plist value also exists for them, but if you set it to YES the app just sets it back to NO every time you launch the app again. The reason the value keeps getting set back to NO is because the Facebook app is phoning home and checking with the server every time to see if you're supposed to get stickers. Naturally the way to get around this is to change what the server is saying.

While there are a number of tools available to proxy and modify network traffic, my favorite is Charles Proxy. One of the features that Charles Proxy offers is rewrite rules. It's basically Find & Replace for your traffic. The first thing you'll need to do is proxy your device's traffic through Charles. When you launch the Facebook app you should see a request come through that looks something like this https://api.facebook.com/method/fql.multiquery?sdk=ios&queries=%7B%22awholebunchofotherstuffgoeshere. If you look at the response, you'll see the value that is telling the Facebook app to set your sticker permissions to no. You should see a project_name of messenger_sticker that has a result of false. We just need to make this say true instead. In Charles, go up to Tools and click on Rewrite. Click the "Add" button in the lower-right to create a new rewrite rule. First you'll need to specify the location, or URL, that you want Charles to match for this. Click Add below the top pane and in host, enter https://api.facebook.com/method/fql.multiquery. Once you tab to the next field, Charles will parse out the URL how it needs to and you can click OK. Next we need to tell Charles the actual rule we want it to use, so click the Add button below the bottom pane. We'll want to set the type to Body (since this is where we want to change the data), uncheck the Request box and check the Response box. In the Match section, set the value to {"project_name":"messenger_sticker","result":false}. Down below, in the Replace section, set the value to {"project_name":"messenger_sticker","result":true} and leave the Replace All radio button selected. Select OK to add the rule and OK again to close the Rewrite Settings window.

Charles should be good to go now. Close the app and force close it from the background, then relaunch it, and you should see a request go out to https://api.facebook.com/method/fql.multiquery?sdk=ios&queries=%7B%22awholebunchofotherstuffgoeshere. In order to know if your rewrite rule worked, you can look in the Overview tab of the request and in the Notes section you'll see some "Rewrite Tool: body match" text if Charles was able to match and use your rewrite rule. To be extra sure, you can also view the response and see that it is indeed saying true now where it used to say false.

Obviously the downside to the proxy approach is that you have to be proxying your device for it to have the desired affect. Unfortunately this is the only way I've found to enable stickers since Facebook is checking this value server-side each time.

That is, until you're done testing or Facebook officially enables the new features on your account.

    


Source: http://feedproxy.google.com/~r/TheIphoneBlog/~3/6lZy3f6ThAg/story01.htm

north country brian mcknight sbux nfldraft asante samuel salton sea arizona immigration law

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.