~gardenapple/mitch

ca83f9e7ff83866485ef30a07fc7d2b57a8e4131 — gardenapple 2 months ago 206345a
Fix payment info marquee animation + minor changes
M app/src/main/java/ua/gardenapple/itchupdater/ItchWebsiteUtils.kt => app/src/main/java/ua/gardenapple/itchupdater/ItchWebsiteUtils.kt +4 -4
@@ 63,7 63,7 @@ object ItchWebsiteUtils {
    }

    fun hasGameDownloadLinks(htmlDoc: Document): Boolean {
        return htmlDoc.body().getElementsByClass("download_btn").isNotEmpty()
        return htmlDoc.body().selectFirst(".download_btn") != null
    }

    /**


@@ 85,7 85,7 @@ object ItchWebsiteUtils {
     * @return If htmlDoc is a store page or download page, will return the associated gameID. Otherwise, the behavior is undefined.
     */
    fun getGameId(htmlDoc: Document): Int? {
        return htmlDoc.head().getElementsByAttributeValue("name", "itch:path").first()
        return htmlDoc.head().selectFirst("[name=\"itch:path\"]")
            ?.attr("content")
            ?.substringAfter("games/")?.toInt()
    }


@@ 189,10 189,10 @@ object ItchWebsiteUtils {
    }

    fun isDarkTheme(doc: Document): Boolean {
        return doc.getElementsByClass("main_layout").first()?.hasClass("dark_theme") ?: false
        return doc.selectFirst(".main_layout")?.hasClass("dark_theme") ?: false
    }

    fun getLoggedInUserName(doc: Document): String? {
        return doc.getElementsByClass("user_name").first()?.html()
        return doc.selectFirst(".user_name")?.html()
    }
}
\ No newline at end of file

M app/src/main/java/ua/gardenapple/itchupdater/client/ItchBrowseHandler.kt => app/src/main/java/ua/gardenapple/itchupdater/client/ItchBrowseHandler.kt +0 -2
@@ 75,7 75,6 @@ class ItchBrowseHandler(
                        val username = ItchWebsiteUtils.getLoggedInUserName(doc)

                        bundleLink = SpecialBundleHandler.getLinkForUser(context, false, username)
//                        Log.d(LOGGING_TAG, "Bundle link: $bundleLink")
                        bundlePalestinian = false
                    }



@@ 84,7 83,6 @@ class ItchBrowseHandler(
                        val username = ItchWebsiteUtils.getLoggedInUserName(doc)

                        bundleLink = SpecialBundleHandler.getLinkForUser(context, true, username)
//                        Log.d(LOGGING_TAG, "Bundle link: $bundleLink")
                        bundlePalestinian = true
                    }
                }

M app/src/main/java/ua/gardenapple/itchupdater/database/DatabaseCleanup.kt => app/src/main/java/ua/gardenapple/itchupdater/database/DatabaseCleanup.kt +1 -1
@@ 63,7 63,7 @@ class DatabaseCleanup(private val context: Context) {


        val installsToUpdate = ArrayList<Installation>()
        //TODO: Backwards compatibility with older versions of Mitch
        //TODO: Get rid of this backwards compatibility with older versions of Mitch
        if (sharedPrefs.getBoolean(PREF_DB_RAN_CLEANUP_ONCE, false)) {
            for (i in installs.indices) {
                var install = installs[i]

M app/src/main/java/ua/gardenapple/itchupdater/ui/BrowseFragment.kt => app/src/main/java/ua/gardenapple/itchupdater/ui/BrowseFragment.kt +4 -6
@@ 357,6 357,9 @@ class BrowseFragment : Fragment(), CoroutineScope by MainScope() {
                    } else if (info?.paymentInfo != null) {
                        bottomGameBar.visibility = View.VISIBLE

                        //Required for marquee animation
                        gameButtonInfo.isSelected = true

                        if (!info.paymentInfo.isPaymentOptional)
                            gameButton.text = getString(R.string.game_buy)
                        else if (info.hasAndroidVersion)


@@ 393,12 396,7 @@ class BrowseFragment : Fragment(), CoroutineScope by MainScope() {
            } else if (ItchWebsiteUtils.isUserPage(doc)) {
                val appBarTitle =
                    "<b>${Html.escapeHtml(ItchWebsiteParser.getUserName(doc))}</b>"

                @Suppress("DEPRECATION")
                if (Build.VERSION.SDK_INT >= 24)
                    supportAppBar.title = Html.fromHtml(appBarTitle, 0)
                else
                    supportAppBar.title = Html.fromHtml(appBarTitle)
                supportAppBar.title = Utils.spannedFromHtml(appBarTitle)

                appBar.menu.clear()
                addDefaultAppBarActions(appBar)