12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- import { Injectable } from "@angular/core";
- import { Storage } from "@ionic/storage";
- import * as tweets from './tweet.json';
- @Injectable()
- export class MockProvider {
- friends;
- userId: string;
- mockTweets;
- constructor(
- private storage: Storage
- ) {
- this.storage.get("userId").then(userId => (this.userId = userId));
- }
- /**
- * Retrives the public and private tweets for a user
- * Since it is loaded in batches of 20 public tweets, public and private tweet are used as reference to load next 20 tweets
- * @param userId user id
- * @param oldestPublicTweet oldest public tweet
- * @param oldestPrivateTweet oldest private tweet
- */
- public async loadUserTimeline(
- userId,
- oldestPublicTweet?,
- oldestPrivateTweet?
- )
- {
- }
- /**
- * Retrieves the home feed for the logged in user
- * Since it is loaded in batches of 20 public tweets, public and private tweet are used as reference to load next 20 tweets
- * @param oldestPublicTweet oldest public tweet
- * @param oldestPrivateTweet oldest private tweet
- */
- public async loadHomeTimeline(oldestPublicTweet?, oldestPrivateTweet?) {
- console.log('hometime line called',tweets);
- this.mockTweets = tweets;
- return tweets;
- // Fetch tweets from Twitter
-
- // Determine start and end of time interval to look for private tweets
-
- // Fetch user's friends
- // Extract friends user ids and add own user id
-
- // Fetch ipfs hashs for period
-
- // Combine and sort tweets
-
- }
- public async replyTweet(){
- }
- public async writeTweet(twt:string){
- console.log('inside writetweet',this.mockTweets[0]);
- console.log('inside writetweet obj is:',this.mockTweets[0].full_text);
- let newTweet = Object.assign({}, this.mockTweets[0]);
- newTweet.full_text = twt;
- console.log('new tweet ',newTweet);
- tweets.push(newTweet);
- // this.mockTweets.push(newTweet);
- // var newTweet =JSON.parse(tweet[0]);
- // newTweet.full_text = tweet;
- // console.log('writing tweeet',tweets.push(newTweet));
- // this.loadHomeTimeline();
- }
- private async fetchPrivateTweets(privateTweetsData: object[]) {
-
- }
- }
|