<commit_before>package edu.byu.cs456.journall.social_journal;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

import com.facebook.AccessToken;
import com.facebook.GraphRequest;
import com.facebook.GraphResponse;
import com.facebook.HttpMethod;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.auth.UserInfo;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Locale;

import edu.byu.cs456.journall.social_journal.post.FacebookPost;
import edu.byu.cs456.journall.social_journal.post.ImagePost;
import edu.byu.cs456.journall.social_journal.post.NotePost;
import edu.byu.cs456.journall.social_journal.post.Post;
import edu.byu.cs456.journall.social_journal.post.PostComparatorByDate;
import edu.byu.cs456.journall.social_journal.post.WebPost;


public class MainActivity extends AppCompatActivity
        implements NavigationView.OnNavigationItemSelectedListener {
    private final String TAG = MainActivity.class.getCanonicalName();
    static final int SELECT_IMAGE = 1;
    static final int SELECT_DATE = 2;
    static final int ADD_NOTE = 3;

    private static final String LOADING_IMAGE_URL = "https://www.google.com/images/spin-32.gif";

    private RecyclerView myRecyclerView;
    private RecyclerView.Adapter adapter;
    private RecyclerView.LayoutManager layoutManager;

    private List<Post> posts;
    private FirebaseDatabase mDatabase;
    private FirebaseAuth mFirebaseAuth;
    private FirebaseUser mFirebaseUser;
    private String mPhotoUrl;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = initializeToolbar();

        //Javascript that https://developers.facebook.com/docs/plugins/embedded-posts said was necessary
        //It is not necessary when clicking "embed" on a post but it might be needed
        //if we change the way we embed pictures to use the Graph API
//        WebView init = (WebView) findViewById(R.id.init_js);
//        String initData = "<div id=\"fb-root\"></div>\n" +
//                "<script>(function(d, s, id) {\n" +
//                "  var js, fjs = d.getElementsByTagName(s)[0];\n" +
//                "  if (d.getElementById(id)) return;\n" +
//                "  js = d.createElement(s); js.id = id;\n" +
//                "  js.src = \"//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.8&appId=121029951766180\";\n" +
//                "  fjs.parentNode.insertBefore(js, fjs);\n" +
//                "}(document, 'script', 'facebook-jssdk'));</script>";
//        init.loadData(initData, "text/html", null);

        //Funny post about stress
//        WebView firstPost = (WebView) findViewById(R.id.post1);
//        String data = "<iframe src=\"https://www.facebook.com/plugins/post.php?href=https%3A%2F%2Fwww.facebook.com%2FStudentProblems%2Fposts%2F1184336055026459%3A0&width=500\" width=\"500\" height=\"589\" style=\"border:none;overflow:hidden\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\"></iframe>";
//        firstPost.loadDataWithBaseURL("https://www.facebook.com/", data, "text/html", "utf-8", null);

        initializeDrawer(toolbar);
        initializeNavigationView();

        mFirebaseAuth = FirebaseAuth.getInstance();
        mFirebaseUser = mFirebaseAuth.getCurrentUser();
        if (mFirebaseUser != null) {
            mDatabase = FirebaseDatabase.getInstance();
            syncUserProfiles();
            if (mFirebaseUser.getPhotoUrl() != null) {
                mPhotoUrl = mFirebaseUser.getPhotoUrl().toString();
            }
            posts = getFacebookPosts();
            attachPostListeners();
            onBoarding();

            setUpRecyclerView();
        }
    }

    private Toolbar initializeToolbar() {
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        // Get a support ActionBar corresponding to this toolbar
        ActionBar ab = getSupportActionBar();

        // Enable the Up button
        ab.setDisplayHomeAsUpEnabled(true);
        return toolbar;
    }

    private void initializeDrawer(Toolbar toolbar) {
        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
                this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
        drawer.addDrawerListener(toggle);
        toggle.syncState();
    }

    private void initializeNavigationView() {
        NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
        navigationView.setNavigationItemSelectedListener(this);
    }

    private void setUpRecyclerView() {
        myRecyclerView = (RecyclerView) findViewById(R.id.recycler_view);

        myRecyclerView.setHasFixedSize(false);

        layoutManager = new LinearLayoutManager(this);
        myRecyclerView.setLayoutManager(layoutManager);

        adapter = new SocialJournalAdapter(posts, this);
        myRecyclerView.setAdapter(adapter);
    }

    private void syncUserProfiles() {
        String uid = mFirebaseUser.getUid();
        DatabaseReference users = mDatabase.getReference("/users");
        users.child(uid).child("email").setValue(mFirebaseUser.getEmail());
        users.child(uid).child("name").setValue(mFirebaseUser.getDisplayName());
        for (UserInfo userInfo : mFirebaseUser.getProviderData()) {
            if (!userInfo.getProviderId().equals("firebase")) {
                users.child(uid).child(userInfo.getProviderId().split("\\.")[0]).setValue(userInfo.getUid());
            }
        }
    }

    private void onBoarding() {
        final String uid = mFirebaseUser.getUid();
        mDatabase.getReference("/users").child(uid).child("onboarding").addListenerForSingleValueEvent(new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot dataSnapshot) {
                if (!dataSnapshot.exists()) {
                    importExistingPosts(uid);
                }
            }

            @Override
            public void onCancelled(DatabaseError databaseError) {

            }
        });

    }

    private void importExistingPosts(final String uid) {
        /* make the API call */
        new GraphRequest(
                AccessToken.getCurrentAccessToken(),
                "/me/feed?fields=id,created_time,message,story,picture,type",
                null,
                HttpMethod.GET,
                new ImportExistingPostsCallback(uid)
        ).executeAsync();
    }

    private class ImportExistingPostsCallback implements GraphRequest.Callback {
        private String uid;

        ImportExistingPostsCallback(String uid) {
            this.uid = uid;
        }

        @Override
        public void onCompleted(GraphResponse response) {
            Log.d(TAG, response.toString());
            try {
                JSONArray data = (JSONArray) response.getJSONObject().get("data");
                if (data.length() != 0) {
                    int length = data.length() > 25 ? 25 : data.length();
                    for (int i = 0; i < length; ++i) {
                        JSONObject row = data.getJSONObject(i);
                        FacebookPost post = getFacebookPostFromRow(row);
                        mDatabase.getReference("/posts").child(uid).child("facebook_posts").push().setValue(post);
                    }
                    mDatabase.getReference("/users").child(uid).child("onboarding").setValue(true);
                } else {
                    throw new Exception("This app needs access to posts, and isn't getting them");
                }

            } catch (Exception e) {
                Toast.makeText(getApplicationContext(), "Something went wrong with importing your existing posts", Toast.LENGTH_SHORT).show();
            }
        }

        @NonNull
        private FacebookPost getFacebookPostFromRow(JSONObject row) throws JSONException, ParseException {
            String postId = row.getString("id");
            Date date = getFacebookDate(row.getString("created_time"));
            String message = null;
            try {
                message = row.getString("message");
            } catch (JSONException ignored) {

            }
            String story = null;
            try {
                story = row.getString("story");
            } catch (JSONException ignored) {

            }
            String pictureUrl = null;
            try {
                pictureUrl = row.getString("picture");
            } catch (JSONException ignored) {

            }
            String type = null;
            try {
                type = row.getString("type");
            } catch (JSONException ignored) {

            }
            FacebookPost facebookPost = new FacebookPost(uid, date, postId, message, story);
            facebookPost.photoUrl = MainActivity.this.mPhotoUrl;
            facebookPost.attachmentUrl = pictureUrl;
            facebookPost.type = type;
            return facebookPost;
        }
    }

    private Date getFacebookDate(String createdTime) throws ParseException {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ENGLISH);
        return dateFormat.parse(createdTime);
    }

    /**
     * Initializes posts displayed on home page
     *
     * @return List of Strings. Strings represent each post.
     */
    private List<Post> getFacebookPosts() {
        List<Post> listOfPosts = new ArrayList<>();
        WebPost post1 = new WebPost();
        post1.url = "<iframe src=\"https://www.facebook.com/plugins/post.php?href=https%3A%2F%2Fwww.facebook.com%2FStudentProblems%2Fposts%2F1184336055026459%3A0&width=480\" width=\"480\" height=\"589\" style=\"border:none;overflow:hidden\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\"></iframe>";
        post1.date = getDate(2017, 3, 25);
        listOfPosts.add(post1);
        WebPost post2 = new WebPost();
        post2.url = "<iframe src=\"https://www.facebook.com/plugins/post.php?href=https%3A%2F%2Fwww.facebook.com%2Fverycleanfunnypics%2Fposts%2F1564340500243860%3A0&width=480\" width=\"480\" height=\"502\" style=\"border:none;overflow:hidden\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\"></iframe>";
        post2.date = getDate(2017, 3, 24);
        listOfPosts.add(post2);
        WebPost post3 = new WebPost();
        post3.url = "<iframe src=\"https://www.facebook.com/plugins/post.php?href=https%3A%2F%2Fwww.facebook.com%2Fmcall2%2Fposts%2F10154420774477759&width=480\" width=\"480\" height=\"607\" style=\"border:none;overflow:hidden\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\"></iframe>";
        post3.date = getDate(2017, 2, 15);
        listOfPosts.add(post3);
        WebPost post4 = new WebPost();
        post4.url = "<iframe src=\"https://www.facebook.com/plugins/post.php?href=https%3A%2F%2Fwww.facebook.com%2Fmcall2%2Fposts%2F10154301387472759&width=480\" width=\"480\" height=\"442\" style=\"border:none;overflow:hidden\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\"></iframe>";
        post4.date = getDate(2017, 1, 12);
        listOfPosts.add(post4);
        WebPost post5 = new WebPost();
        post5.url = "<iframe src=\"https://www.facebook.com/plugins/post.php?href=https%3A%2F%2Fwww.facebook.com%2Fmcall2%2Ftimeline%2Fstory%3Fut%3D32%26wstart%3D-2051193600%26wend%3D2147483647%26hash%3D10151102807557759%26pagefilter%3D3%26ustart%3D1&width=480\" width=\"480\" height=\"249\" style=\"border:none;overflow:hidden\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\"></iframe>";
        post5.date = getDate(2013, 8, 15);
        listOfPosts.add(post5);

        return listOfPosts;
    }<commit_msg>Commented out the hard coded posts<commit_after>package edu.byu.cs456.journall.social_journal;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

import com.facebook.AccessToken;
import com.facebook.GraphRequest;
import com.facebook.GraphResponse;
import com.facebook.HttpMethod;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.auth.UserInfo;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Locale;

import edu.byu.cs456.journall.social_journal.post.FacebookPost;
import edu.byu.cs456.journall.social_journal.post.ImagePost;
import edu.byu.cs456.journall.social_journal.post.NotePost;
import edu.byu.cs456.journall.social_journal.post.Post;
import edu.byu.cs456.journall.social_journal.post.PostComparatorByDate;
import edu.byu.cs456.journall.social_journal.post.WebPost;


public class MainActivity extends AppCompatActivity
        implements NavigationView.OnNavigationItemSelectedListener {
    private final String TAG = MainActivity.class.getCanonicalName();
    static final int SELECT_IMAGE = 1;
    static final int SELECT_DATE = 2;
    static final int ADD_NOTE = 3;

    private static final String LOADING_IMAGE_URL = "https://www.google.com/images/spin-32.gif";

    private RecyclerView myRecyclerView;
    private RecyclerView.Adapter adapter;
    private RecyclerView.LayoutManager layoutManager;

    private List<Post> posts;
    private FirebaseDatabase mDatabase;
    private FirebaseAuth mFirebaseAuth;
    private FirebaseUser mFirebaseUser;
    private String mPhotoUrl;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = initializeToolbar();

        //Javascript that https://developers.facebook.com/docs/plugins/embedded-posts said was necessary
        //It is not necessary when clicking "embed" on a post but it might be needed
        //if we change the way we embed pictures to use the Graph API
//        WebView init = (WebView) findViewById(R.id.init_js);
//        String initData = "<div id=\"fb-root\"></div>\n" +
//                "<script>(function(d, s, id) {\n" +
//                "  var js, fjs = d.getElementsByTagName(s)[0];\n" +
//                "  if (d.getElementById(id)) return;\n" +
//                "  js = d.createElement(s); js.id = id;\n" +
//                "  js.src = \"//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.8&appId=121029951766180\";\n" +
//                "  fjs.parentNode.insertBefore(js, fjs);\n" +
//                "}(document, 'script', 'facebook-jssdk'));</script>";
//        init.loadData(initData, "text/html", null);

        //Funny post about stress
//        WebView firstPost = (WebView) findViewById(R.id.post1);
//        String data = "<iframe src=\"https://www.facebook.com/plugins/post.php?href=https%3A%2F%2Fwww.facebook.com%2FStudentProblems%2Fposts%2F1184336055026459%3A0&width=500\" width=\"500\" height=\"589\" style=\"border:none;overflow:hidden\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\"></iframe>";
//        firstPost.loadDataWithBaseURL("https://www.facebook.com/", data, "text/html", "utf-8", null);

        initializeDrawer(toolbar);
        initializeNavigationView();

        mFirebaseAuth = FirebaseAuth.getInstance();
        mFirebaseUser = mFirebaseAuth.getCurrentUser();
        if (mFirebaseUser != null) {
            mDatabase = FirebaseDatabase.getInstance();
            syncUserProfiles();
            if (mFirebaseUser.getPhotoUrl() != null) {
                mPhotoUrl = mFirebaseUser.getPhotoUrl().toString();
            }
            posts = getFacebookPosts();
            attachPostListeners();
            onBoarding();

            setUpRecyclerView();
        }
    }

    private Toolbar initializeToolbar() {
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        // Get a support ActionBar corresponding to this toolbar
        ActionBar ab = getSupportActionBar();

        // Enable the Up button
        ab.setDisplayHomeAsUpEnabled(true);
        return toolbar;
    }

    private void initializeDrawer(Toolbar toolbar) {
        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
                this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
        drawer.addDrawerListener(toggle);
        toggle.syncState();
    }

    private void initializeNavigationView() {
        NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
        navigationView.setNavigationItemSelectedListener(this);
    }

    private void setUpRecyclerView() {
        myRecyclerView = (RecyclerView) findViewById(R.id.recycler_view);

        myRecyclerView.setHasFixedSize(false);

        layoutManager = new LinearLayoutManager(this);
        myRecyclerView.setLayoutManager(layoutManager);

        adapter = new SocialJournalAdapter(posts, this);
        myRecyclerView.setAdapter(adapter);
    }

    private void syncUserProfiles() {
        String uid = mFirebaseUser.getUid();
        DatabaseReference users = mDatabase.getReference("/users");
        users.child(uid).child("email").setValue(mFirebaseUser.getEmail());
        users.child(uid).child("name").setValue(mFirebaseUser.getDisplayName());
        for (UserInfo userInfo : mFirebaseUser.getProviderData()) {
            if (!userInfo.getProviderId().equals("firebase")) {
                users.child(uid).child(userInfo.getProviderId().split("\\.")[0]).setValue(userInfo.getUid());
            }
        }
    }

    private void onBoarding() {
        final String uid = mFirebaseUser.getUid();
        mDatabase.getReference("/users").child(uid).child("onboarding").addListenerForSingleValueEvent(new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot dataSnapshot) {
                if (!dataSnapshot.exists()) {
                    importExistingPosts(uid);
                }
            }

            @Override
            public void onCancelled(DatabaseError databaseError) {

            }
        });

    }

    private void importExistingPosts(final String uid) {
        /* make the API call */
        new GraphRequest(
                AccessToken.getCurrentAccessToken(),
                "/me/feed?fields=id,created_time,message,story,picture,type",
                null,
                HttpMethod.GET,
                new ImportExistingPostsCallback(uid)
        ).executeAsync();
    }

    private class ImportExistingPostsCallback implements GraphRequest.Callback {
        private String uid;

        ImportExistingPostsCallback(String uid) {
            this.uid = uid;
        }

        @Override
        public void onCompleted(GraphResponse response) {
            Log.d(TAG, response.toString());
            try {
                JSONArray data = (JSONArray) response.getJSONObject().get("data");
                if (data.length() != 0) {
                    int length = data.length() > 25 ? 25 : data.length();
                    for (int i = 0; i < length; ++i) {
                        JSONObject row = data.getJSONObject(i);
                        FacebookPost post = getFacebookPostFromRow(row);
                        mDatabase.getReference("/posts").child(uid).child("facebook_posts").push().setValue(post);
                    }
                    mDatabase.getReference("/users").child(uid).child("onboarding").setValue(true);
                } else {
                    throw new Exception("This app needs access to posts, and isn't getting them");
                }

            } catch (Exception e) {
                Toast.makeText(getApplicationContext(), "Something went wrong with importing your existing posts", Toast.LENGTH_SHORT).show();
            }
        }

        @NonNull
        private FacebookPost getFacebookPostFromRow(JSONObject row) throws JSONException, ParseException {
            String postId = row.getString("id");
            Date date = getFacebookDate(row.getString("created_time"));
            String message = null;
            try {
                message = row.getString("message");
            } catch (JSONException ignored) {

            }
            String story = null;
            try {
                story = row.getString("story");
            } catch (JSONException ignored) {

            }
            String pictureUrl = null;
            try {
                pictureUrl = row.getString("picture");
            } catch (JSONException ignored) {

            }
            String type = null;
            try {
                type = row.getString("type");
            } catch (JSONException ignored) {

            }
            FacebookPost facebookPost = new FacebookPost(uid, date, postId, message, story);
            facebookPost.photoUrl = MainActivity.this.mPhotoUrl;
            facebookPost.attachmentUrl = pictureUrl;
            facebookPost.type = type;
            return facebookPost;
        }
    }

    private Date getFacebookDate(String createdTime) throws ParseException {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.ENGLISH);
        return dateFormat.parse(createdTime);
    }

    /**
     * Initializes posts displayed on home page
     *
     * @return List of Strings. Strings represent each post.
     */
    private List<Post> getFacebookPosts() {
        List<Post> listOfPosts = new ArrayList<>();
//        WebPost post1 = new WebPost();
//        post1.url = "<iframe src=\"https://www.facebook.com/plugins/post.php?href=https%3A%2F%2Fwww.facebook.com%2FStudentProblems%2Fposts%2F1184336055026459%3A0&width=480\" width=\"480\" height=\"589\" style=\"border:none;overflow:hidden\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\"></iframe>";
//        post1.date = getDate(2017, 3, 25);
//        listOfPosts.add(post1);
//        WebPost post2 = new WebPost();
//        post2.url = "<iframe src=\"https://www.facebook.com/plugins/post.php?href=https%3A%2F%2Fwww.facebook.com%2Fverycleanfunnypics%2Fposts%2F1564340500243860%3A0&width=480\" width=\"480\" height=\"502\" style=\"border:none;overflow:hidden\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\"></iframe>";
//        post2.date = getDate(2017, 3, 24);
//        listOfPosts.add(post2);
//        WebPost post3 = new WebPost();
//        post3.url = "<iframe src=\"https://www.facebook.com/plugins/post.php?href=https%3A%2F%2Fwww.facebook.com%2Fmcall2%2Fposts%2F10154420774477759&width=480\" width=\"480\" height=\"607\" style=\"border:none;overflow:hidden\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\"></iframe>";
//        post3.date = getDate(2017, 2, 15);
//        listOfPosts.add(post3);
//        WebPost post4 = new WebPost();
//        post4.url = "<iframe src=\"https://www.facebook.com/plugins/post.php?href=https%3A%2F%2Fwww.facebook.com%2Fmcall2%2Fposts%2F10154301387472759&width=480\" width=\"480\" height=\"442\" style=\"border:none;overflow:hidden\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\"></iframe>";
//        post4.date = getDate(2017, 1, 12);
//        listOfPosts.add(post4);
//        WebPost post5 = new WebPost();
//        post5.url = "<iframe src=\"https://www.facebook.com/plugins/post.php?href=https%3A%2F%2Fwww.facebook.com%2Fmcall2%2Ftimeline%2Fstory%3Fut%3D32%26wstart%3D-2051193600%26wend%3D2147483647%26hash%3D10151102807557759%26pagefilter%3D3%26ustart%3D1&width=480\" width=\"480\" height=\"249\" style=\"border:none;overflow:hidden\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\"></iframe>";
//        post5.date = getDate(2013, 8, 15);
//        listOfPosts.add(post5);

        return listOfPosts;
    }
{'fraction_non_alphanumeric': 0.1239513655345726, 'fraction_numerical': 0.026756347241213643, 'mean_word_length': 2.9070170372509385, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 45, 'https://': 18, 'lorem ipsum': 0, 'www.': 28, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 22, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2148256', 'n_tokens_mistral': 8260, 'n_tokens_neox': 7629, 'n_words': 1381}