Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. package extension.facebook;
  2.  
  3. import flash.net.SharedObject;
  4. import haxe.Json;
  5.  
  6. typedef ProfilePictureSource = { height : Int, is_silhouette : Bool, url : String, width : Int }
  7. typedef UserInvitableFriendPicture = { data : ProfilePictureSource }
  8. typedef UserInvitableFriend = { id : String, name : String, picture : UserInvitableFriendPicture }
  9.  
  10. class FriendList {
  11.  
  12. public static function invitableFriends(
  13. f : Facebook,
  14. onSuccess : Array<UserInvitableFriend>->Void,
  15. onError : Dynamic->Void
  16. ) : Void {
  17. f.getAll(
  18. "/me/invitable_friends",
  19. onSuccess,
  20. onError
  21. );
  22. }
  23.  
  24. public static function friendsWhoHaveInstalled(
  25. f : Facebook,
  26. onSuccess : Array<String>->Array<String>->Void,
  27. onError : Dynamic->Void
  28. ) : Void {
  29. f.getAll(
  30. "/me/friends",
  31. function(data) {
  32. var ids = [];
  33. var names = [];
  34. for (it in data) {
  35. ids.push(it.id);
  36. names.push(it.name);
  37. }
  38. onSuccess(ids, names);
  39. },
  40. ["fields"=>"installed,name"],
  41. onError
  42. );
  43. }
  44.  
  45. //public static function newInstalledFriendsSinceLastTime(
  46. //f : Facebook,
  47. //onSuccess : Int->Void,
  48. //onError : Dynamic->Void
  49. //) : Void {
  50. //friendsWhoHaveInstalled(
  51. //f,
  52. //function (result : Array<String>) {
  53. //var thisTimeCount = result.length;
  54. //var so = SharedObject.getLocal("facebook_extension_friends");
  55. //var lastTimeCount : Int = so.data.lastTimeCount!=null ? 0 : so.data.lastTimeCount;
  56. //onSuccess(thisTimeCount-lastTimeCount);
  57. //so.data.lastTimeCount = thisTimeCount;
  58. //so.flush();
  59. //},
  60. //onError
  61. //);
  62. //}
  63.  
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement