<commit_before>package torille.fi.lurkforreddit.utils

import android.content.Context
import android.support.customtabs.CustomTabsIntent
import android.support.customtabs.CustomTabsSession
import android.support.v4.content.ContextCompat
import torille.fi.lurkforreddit.R

/**
 * Helper class for parsing urls and media
 */

object MediaHelper {

    fun isContentMedia(url: String?, domain: String?): Boolean {

        if (url == null || url.length < 4) {
            return false
        }

        when (TextHelper.getLastFourChars(url)) {
            ".jpg", ".png", "jpeg", ".gif", ".mp4", "gifv" -> return true
            else -> return checkDomainForMedia(domain)
        }
    }

    fun checkDomainForMedia(domain: String?): Boolean {
        if (domain.isNullOrEmpty()) {
            return false
        }

        when (domain) {
            "gfycat.com", "i.reddituploads.com", "streamable.com" -> return true
            else -> return false<commit_msg>Lift when<commit_after>package torille.fi.lurkforreddit.utils

import android.content.Context
import android.support.customtabs.CustomTabsIntent
import android.support.customtabs.CustomTabsSession
import android.support.v4.content.ContextCompat
import torille.fi.lurkforreddit.R

/**
 * Helper class for parsing urls and media
 */

object MediaHelper {

    fun isContentMedia(url: String?, domain: String?): Boolean {

        if (url == null || url.length < 4) {
            return false
        }

        when (TextHelper.getLastFourChars(url)) {
            ".jpg", ".png", "jpeg", ".gif", ".mp4", "gifv" -> return true
            else -> return checkDomainForMedia(domain)
        }
    }

    fun checkDomainForMedia(domain: String?): Boolean {
        if (domain.isNullOrEmpty()) {
            return false
        }

        return when {
            domain == "gfycat.com" || domain == "i.reddituploads.com" || domain == "streamable.com" -> true
            else -> false
{'fraction_non_alphanumeric': 0.12, 'fraction_numerical': 0.003076923076923077, 'mean_word_length': 2.56021897810219, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6959992', 'n_tokens_mistral': 583, 'n_tokens_neox': 562, 'n_words': 131}