Permalink
Browse files

Updated dependencies, fixed ErrorTrace, and added support for VideoVi…

…ew to automatically pause if playing when hidden to avoid background playing videos (can be configured via `autoPauseOnHide`)
  • Loading branch information...
darkfrog26 committed Jun 7, 2018
1 parent a1adda7 commit 8c64cc3746766d62500210afaa69ce2f398ce8b1
@@ -32,7 +32,7 @@ trait ClientApplication extends YouIApplication with ScreenManager {
if (logJavaScriptErrors) {
js.Dynamic.global.window.onerror = errorFunction
scribe.Logger.root.withHandler(ErrorTrace).replace()
scribe.Logger.root.withHandler(writer = ErrorTrace).replace()
}
connectivityEntries.attachAndFire { entries =>
@@ -5,16 +5,15 @@ import io.youi.{History, _}
import io.youi.net.URL
import io.youi.stream.StreamURL
import org.scalajs.dom.{ErrorEvent, Event}
import scribe.handler.LogHandler
import scribe.modify.LogModifier
import scribe.writer.Writer
import scribe.{Level, LogRecord}
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global
import scala.scalajs._
import scala.scalajs.runtime.StackTrace.Implicits._
object ErrorTrace extends LogHandler {
object ErrorTrace extends Writer {
private var sourceMaps = Map.empty[String, SourceMapConsumer]
def toError(event: ErrorEvent): Future[JavaScriptError] = {
@@ -40,12 +39,9 @@ object ErrorTrace extends LogHandler {
toError(message, source, line, column, Some(throwable))
}
override def modifiers: List[LogModifier] = Nil
override def setModifiers(modifiers: List[LogModifier]): LogHandler = this
override def log[M](record: LogRecord[M]): Unit = if (record.level.value >= Level.Error.value) {
record.messageValue match {
override def write[M](record: LogRecord[M], output: String): Unit = if (record.level.value >= Level.Error.value) {
val value = record.messageValue()
value match {
case evt: Event if evt.`type` == "error" => ClientApplication.sendError(evt.asInstanceOf[ErrorEvent])
case t: Throwable => ClientApplication.sendError(t)
case _ => // Ignore others
@@ -27,7 +27,7 @@ developers in ThisBuild := List(
)
val profigVersion = "2.3.0"
val scribeVersion = "2.4.0"
val scribeVersion = "2.5.0"
val powerScalaVersion = "2.0.5"
val reactifyVersion = "2.3.0"
val hasherVersion = "1.2.1"
@@ -37,13 +37,13 @@ val openTypeVersion = "0.7.3"
val picaVersion = "3.0.5"
val webFontLoaderVersion = "1.6.28"
val akkaVersion = "2.5.12"
val scalaJSDOM = "0.9.5"
val akkaVersion = "2.5.13"
val scalaJSDOM = "0.9.6"
val okHttpVersion = "3.10.0"
val circeVersion = "0.9.3"
val uaDetectorVersion = "2014.10"
val undertowVersion = "2.0.7.Final"
val closureCompilerVersion = "v20180402"
val undertowVersion = "2.0.9.Final"
val closureCompilerVersion = "v20180506"
val jSoupVersion = "1.11.3"
val scalaXMLVersion = "1.1.0"
val scalacticVersion = "3.0.5"
@@ -1 +1 @@
sbt.version=1.1.4
sbt.version=1.1.6
@@ -3,7 +3,7 @@ resolvers += "Typesafe Repository" at "https://repo.typesafe.com/typesafe/releas
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.4.0")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "0.4.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.22")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.23")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.1")
@@ -15,6 +15,10 @@ class VideoView(override protected val element: html.Span = dom.create[html.Span
def isPaused: Boolean = video.isPaused
def isEnded: Boolean = video.isEnded
visible.attach { b =>
if (autoPauseOnHide() && !b) pause()
}
override protected def measuredWidth: Double = video.width.toDouble
override protected def measuredHeight: Double = video.height.toDouble
@@ -6,6 +6,7 @@ import reactify.Var
trait VideoViewTheme extends HTMLComponentTheme {
lazy val video: StyleProp[Video] = style[Video]("video", Video.empty, Some(VideoViewTheme))
lazy val autoPauseOnHide: StyleProp[Boolean] = style[Boolean]("autoPauseOnHide", true, None)
}
object VideoViewTheme extends StyleConnect[Video] {

0 comments on commit 8c64cc3

Please sign in to comment.