mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-18 11:49:01 +00:00
fix news not loading. Fixes #833
This commit is contained in:
parent
f24936338c
commit
0f807b3ccd
1 changed files with 16 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package com.habitrpg.android.habitica.ui.fragments
|
||||
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
|
@ -12,6 +13,11 @@ import com.habitrpg.android.habitica.components.AppComponent
|
|||
import com.habitrpg.android.habitica.extensions.inflate
|
||||
|
||||
import kotlinx.android.synthetic.main.fragment_news.*
|
||||
import android.webkit.ConsoleMessage
|
||||
import android.webkit.WebSettings
|
||||
|
||||
|
||||
|
||||
|
||||
class NewsFragment : BaseMainFragment() {
|
||||
|
||||
|
|
@ -23,7 +29,16 @@ class NewsFragment : BaseMainFragment() {
|
|||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
val address = if (BuildConfig.DEBUG) BuildConfig.BASE_URL else context?.getString(R.string.base_url)
|
||||
newsWebview.webChromeClient = WebChromeClient()
|
||||
val webSettings = newsWebview.getSettings()
|
||||
webSettings.setJavaScriptEnabled(true)
|
||||
newsWebview.webChromeClient = object : WebChromeClient() {
|
||||
override fun onConsoleMessage(consoleMessage: ConsoleMessage): Boolean {
|
||||
Log.d("Habitica", consoleMessage.message() + " -- From line "
|
||||
+ consoleMessage.lineNumber() + " of "
|
||||
+ consoleMessage.sourceId())
|
||||
return super.onConsoleMessage(consoleMessage)
|
||||
}
|
||||
}
|
||||
newsWebview.loadUrl(address + "/static/new-stuff")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue