Best way to find determine friendship of users (FacebookSDK) - ios

I'm working on an iOS app which at one point displays a feed of information items to the user, that contain information about other users. These feed items are stored on a server that I run as well. I want to add a functionality that allows this user to filter the information and display only items of his facebook friends. It seems to me that there are three ways to achieve this
1
Client fetches all items.For each item run that FB SDK query /user-id/friends to determine friendship
2
Save all of the facebook ID's of the users friends on the client (each set time),and after fetching all items, determine if item is posted by friend with comparison to local database of friends.
3
The server with the feed items would run the query in the backend, and filter the content it provides to the client
Each of these has it's weakness and advantages, but I'd like to hear which is the preferred and "best" overall. I'm trying to achieve something like VENMO's home feed functionality if that makes sense.
Thanks for the help!

Related

How to limit access to a database (or a document within a database) based on invitation

From what i've been able to discern so far, Firebase/Firestore seem like the perfect platform to use for an app I am writing. However I can't quite connect all the dots when trying to design my backend. I am hoping that someone will be able to give answer a couple of basic questions about the use of FB/FS.
With my app, a user will be able to share a small piece of data with a select group of friends. ie if the data is to be a To-Do list, the user would create the list on his device (iphone only) and then invite a small group of friends (probably less than 10) to share that data. The friends would have read-only access by default, however, the user can assign any number of them to be "admins" which would allow them read/write permission. When any changes occur to the data, all "friends" who have access to the data will be notified (by some means - push notifications etc). They can manually sync or setup the app to automatically sync. It seems like FB/FS can be used for this right out of the box. However there are a couple of concepts that I can't get my head around.
The database I setup is accessible by ALL users of my app by default. It's not clear (at least to me) how I would set it up so when a user creates (in this case) a to-do list and invites 5 friends, only those 5 friends can access or even know about that data. This is main stumbling block in my development path.
Regarding invitations. I read in the FB/FS documentation that invitations and notifications are among the many features available. I'm not clear on how this will work if a) the recipient doesn't have my app installed and b) how the inviter would get feedback when the invitation was accepted or declined.
Any guidance that anyone is willing to share to help me get started will be a huge help and will be greatly appreciated. Thanks.
You can create new privates collections inside the main collection, and set different rules for access.
Check at: Firebase Firestore get private fields

Get list of Google Business Reviews for any business?

Can I get a list of reviews from an arbitrary business?
It appears like you get a list of the reviews for a specific account and location.
https://mybusiness.googleapis.com/v3/accounts/account_name/locations/location_name/reviews
However, you can only get a list of account for an authenticated user.
https://mybusiness.googleapis.com/v3/accounts
Is there an endpoint or way to list out the reviews for any business? I just need the number or reviews, and really don't want to have to look at screen scraping type solutions.
The Places API returns only 5 for a business, GMB API requires the user as you’ve mentioned to authenticate; there’s no official endpoint for getting all listed reviews unless you either scrape the data; like Yelp, Google didn’t make it available to pull all user contributed content such as reviews; alternatively you can create your own DB for some businesses and manually update by pulling reviews off a third party site (eg: ReviewsMaker.com) where you can copy data to a table and keep track, but there’s no other real-time solution other than using the GMB API (which is restricted only to authenticated users)

How do i implement followers and following with homefeed in Firebase?

I'm making a Twitter like ios app (just for practicing my programming). I just wondered, because i couldn't find that much online about this stuff, what is the best way (or the most ideal way), to implement following/followers system in Firebase? Like say Mark follows Derek, then Derek makes a tweet, then Mark gets Derek's tweet in his home feed.
Would be great if someone could share their thoughts on this.
One way to do this is: If user A activates the follow-function on user B, the uid of user B gets in the following-node of user A, and user A gets in the followers-node of user B.
After that, there are multiple ways to implement the feed. One way is to go to the tweets of user B and push them to the feed of user A. If user B posts a tweet, loop through his followers and push the key of that tweet to the feeds of his followers. So user A now has the old tweet keys and potential new tweet keys on his feed-node. You can now loop through these keys and get the data from an alltweets-node.
Another way is to let user A loop through his following-node and get the tweets of all the people he follows from their tweet-nodes. You can than join these tweets and sort them by date. A tweet now only has to be posted in the alltweets-node and in the tweets-node of one user, instead of pushing the tweet key to the feed-node of every follower he has.
Just two ways to achieve this, there are certainly more ways to do this, depending on what you want to achieve.

About getting a friendship network through the new Twitter api

Do you know whether it is possible to retrieve the "friendship" network in a group of Twitter users (where #X is considered to be friend of #Y when #X follows #Y) through the new Twitter api?
In other words, given two arbitrary Twitter users, do you know whether Twitter api replies to queries whether one of them follows the other one or not, when this query is made by some third party (using different authorization credentials from the ones of the former two users)?
If yes, how's is it done?
You can use Twitter REST API
The REST APIs provide programmatic access to read and write Twitter data. Author a new Tweet, read author profile and follower data, and more. The REST API identifies Twitter applications and users using OAuth; responses are available in JSON.
Specifically, you will need to use these two calls:
GET friends
Returns a cursored collection of user IDs for every user the specified user is following (otherwise known as their “friends”).
GET followers
Returns a cursored collection of user IDs for every user following the specified user.
There is not such a query exactly as you want, with input arguments #X and #Y, but with these two you should be fine.

Google Analytics reporting doesn't display individual users for iOS app

We've implemented user-level tracking using the documentation https://support.google.com/analytics/answer/3123666?hl=en, including creating specific reporting views User Behavior and Monitor User. Despite this, we cannot see any views in GA which display the individual user ids. How to do this? I'd like to be able to answer these kinds of questions:
Which individual users are heaviest users of app, are what are
specific flows, events that they are doing? What is their behavior
like?
Which individuals are lightest users of app?
Which users have never used certain features?
Thanks!
What you are describing comes very close violating the Google Analytics TOS. You need to ensure that you do not send any Personally identifiable information to Google Analytics.
The user id feature is more practically intended to understand aggregate user behavior and unify cross device sessions. If you rephrased your query to not get at individual users but groups you could easily answer some of your questions.
Which user groups are heaviest users of the application? create a segment which contains your definition for a user which makes heavy use of your application and query for the specific pages that segment visits.

Resources