diff --git a/.travis.yml b/.travis.yml
index 1f41c2819..70a133db3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,7 @@
sudo: false
language: scala
+jdk:
+ - oraclejdk8
scala:
- 2.11.7
addons:
diff --git a/modules/api/build.sbt b/modules/api/build.sbt
index 85fdbaf95..d3cef84f6 100644
--- a/modules/api/build.sbt
+++ b/modules/api/build.sbt
@@ -1 +1 @@
-platformTarget in Android := "android-23"
\ No newline at end of file
+platformTarget in Android := "android-24"
\ No newline at end of file
diff --git a/modules/app/build.sbt b/modules/app/build.sbt
index 85fdbaf95..d3cef84f6 100644
--- a/modules/app/build.sbt
+++ b/modules/app/build.sbt
@@ -1 +1 @@
-platformTarget in Android := "android-23"
\ No newline at end of file
+platformTarget in Android := "android-24"
\ No newline at end of file
diff --git a/modules/app/src/main/res/values/strings.xml b/modules/app/src/main/res/values/strings.xml
index ed217e55c..0541ad275 100644
--- a/modules/app/src/main/res/values/strings.xml
+++ b/modules/app/src/main/res/values/strings.xml
@@ -140,10 +140,10 @@
Remember, you can create and configure the Collections and Moments in the launcher. Enjoy 9Cards!
- Hi, Its %1$s from the 9 Cards team! I\'d like to tell you something cool about the App Drawer.
- Hi, Its %1$s from the 9 Cards team! I\'d like to tell you something cool about the Collections.
- Hi, Its %1$s from the 9 Cards team! I\'d like to tell you something cool about the Profile.
- Hi, Its %1$s from the 9 Cards team! I\'d like to tell you something cool about the Launcher.
+ Hi, Its %1$s from the 9 Cards team! Let me tell you about the App Drawer.
+ Hi, Its %1$s from the 9 Cards team! Check out the cool features in Collections.
+ Hi, Its %1$s from the 9 Cards team! Want to learn more about the Profile.
+ Hi, Its %1$s from the 9 Cards team! I\'d like to show you some cool things about the Launcher.
Let\'s go!
Got it!
diff --git a/modules/app/src/main/scala/cards/nine/app/receivers/moments/MomentBroadcastReceiver.scala b/modules/app/src/main/scala/cards/nine/app/receivers/moments/MomentBroadcastReceiver.scala
index 509fe251a..58495f8ba 100644
--- a/modules/app/src/main/scala/cards/nine/app/receivers/moments/MomentBroadcastReceiver.scala
+++ b/modules/app/src/main/scala/cards/nine/app/receivers/moments/MomentBroadcastReceiver.scala
@@ -25,7 +25,7 @@ class MomentBroadcastReceiver
def verifyConnectionStatus(maybeNetworkInfo: Option[android.net.NetworkInfo]): Unit =
maybeNetworkInfo foreach { networkInfo =>
if (networkInfo.getType == ConnectivityManager.TYPE_WIFI) {
- connectionStatusTaskRef := connectionStatusChangedJobs.connectionStatusChanged().resolveAsyncDelayed(5.seconds)
+ connectionStatusTaskRef := connectionStatusChangedJobs.connectionStatusChanged().resolveAutoCancelableAsyncDelayed(5.seconds)
}
}
@@ -43,7 +43,7 @@ class MomentBroadcastReceiver
}
maybeService foreach { service =>
- fenceStatusRef := service.resolveAsyncDelayed(500.millis)
+ fenceStatusRef := service.resolveAutoCancelableAsyncDelayed(500.millis)
}
}
diff --git a/modules/app/src/main/scala/cards/nine/app/ui/commons/adapters/sharedcollections/SharedCollectionItem.scala b/modules/app/src/main/scala/cards/nine/app/ui/commons/adapters/sharedcollections/SharedCollectionItem.scala
index 708369120..a5d5f3440 100644
--- a/modules/app/src/main/scala/cards/nine/app/ui/commons/adapters/sharedcollections/SharedCollectionItem.scala
+++ b/modules/app/src/main/scala/cards/nine/app/ui/commons/adapters/sharedcollections/SharedCollectionItem.scala
@@ -85,7 +85,6 @@ trait SharedCollectionItem
background.getPaint.setColor(theme.getRandomIndexColor)
val apps = collection.resolvedPackages
- android.util.Log.d("9cards", s"${collection.name} -- apps: ${apps.map(_.title).mkString(",")}")
(icon <~ ivSrc(collection.getIconCollectionDetail)) ~
(appsIcons <~
vgRemoveAllViews <~
diff --git a/modules/app/src/main/scala/cards/nine/app/ui/commons/ops/TaskServiceOps.scala b/modules/app/src/main/scala/cards/nine/app/ui/commons/ops/TaskServiceOps.scala
index 9adb8244c..b33c2c545 100644
--- a/modules/app/src/main/scala/cards/nine/app/ui/commons/ops/TaskServiceOps.scala
+++ b/modules/app/src/main/scala/cards/nine/app/ui/commons/ops/TaskServiceOps.scala
@@ -54,6 +54,24 @@ object TaskServiceOps {
}
}
+ def resolveAutoCancelableAsyncDelayed[E >: Throwable](
+ finiteDuration: FiniteDuration,
+ onResult: A => Unit = a => (),
+ onException: E => Unit = (e: Throwable) => ()
+ ): Cancelable = {
+ Task.defer(t.value).executeWithOptions(_.enableAutoCancelableRunLoops).delayExecution(finiteDuration).runAsync { result =>
+ result match {
+ case Failure(ex) =>
+ printErrorTaskMessage("=> EXCEPTION Disjunction <=", ex)
+ onException(ex)
+ case Success(Right(value)) => onResult(value)
+ case Success(Left(ex)) =>
+ printErrorTaskMessage(s"=> EXCEPTION Left) <=", ex)
+ onException(ex)
+ }
+ }
+ }
+
def resolveAsyncService[E >: Throwable](
onResult: (A) => TaskService[A] = a => TaskService(Task(Either.right(a))),
onException: (E) => TaskService[A] = (e: NineCardException) => TaskService(Task(Either.left(e)))): Cancelable = {
@@ -70,6 +88,22 @@ object TaskServiceOps {
}
}
+ def resolveAutoCancelableAsyncService[E >: Throwable](
+ onResult: (A) => TaskService[A] = a => TaskService(Task(Either.right(a))),
+ onException: (E) => TaskService[A] = (e: NineCardException) => TaskService(Task(Either.left(e)))): Cancelable = {
+ Task.defer(t.value).executeWithOptions(_.enableAutoCancelableRunLoops).runAsync { result =>
+ result match {
+ case Failure(ex) =>
+ printErrorTaskMessage("=> EXCEPTION Disjunction <=", ex)
+ onException(ex).value.runAsync
+ case Success(Right(response)) => onResult(response).value.coeval
+ case Success(Left(ex)) =>
+ printErrorTaskMessage(s"=> EXCEPTION Left) <=", ex)
+ onException(ex).value.runAsync
+ }
+ }
+ }
+
def resolve[E >: Throwable](
onResult: A => Unit = a => (),
onException: E => Unit = (e: Throwable) => ()): Unit = {
@@ -97,6 +131,9 @@ object TaskServiceOps {
def resolveAsyncServiceOr[E >: Throwable](exception: (E) => TaskService[A]): Cancelable =
resolveAsyncService(onException = exception)
+ def resolveAutoCancelableAsyncServiceOr[E >: Throwable](exception: (E) => TaskService[A]): Cancelable =
+ resolveAutoCancelableAsyncService(onException = exception)
+
}
}
diff --git a/modules/app/src/main/scala/cards/nine/app/ui/components/drawables/PathMorphDrawable.scala b/modules/app/src/main/scala/cards/nine/app/ui/components/drawables/PathMorphDrawable.scala
index d1cdc7456..7745cf5e9 100644
--- a/modules/app/src/main/scala/cards/nine/app/ui/components/drawables/PathMorphDrawable.scala
+++ b/modules/app/src/main/scala/cards/nine/app/ui/components/drawables/PathMorphDrawable.scala
@@ -5,6 +5,7 @@ import android.animation.{Animator, AnimatorListenerAdapter, ValueAnimator}
import android.graphics.Paint.Style
import android.graphics._
import android.graphics.drawable.{Animatable, Drawable}
+import android.support.v4.content.ContextCompat
import android.view.animation.DecelerateInterpolator
import cards.nine.app.ui.components.drawables.IconTypes._
import macroid.ContextWrapper
@@ -99,7 +100,6 @@ case class PathMorphDrawable(
currentIcon.foreach(drawIcon(canvas, _))
}
-
override def setColorFilter(cf: ColorFilter): Unit = iconPaint.setColorFilter(cf)
override def setAlpha(alpha: Int): Unit = iconPaint.setAlpha(alpha)
@@ -131,7 +131,7 @@ case class PathMorphDrawable(
}
def setColorResource(color: Int): Unit = {
- iconPaint.setColor(context.application.getResources.getColor(color))
+ iconPaint.setColor(ContextCompat.getColor(context.application, color))
invalidateSelf()
}
diff --git a/modules/app/src/main/scala/cards/nine/app/ui/launcher/actions/publicollections/PublicCollectionsFragment.scala b/modules/app/src/main/scala/cards/nine/app/ui/launcher/actions/publicollections/PublicCollectionsFragment.scala
index 6726eea41..4d907a76b 100644
--- a/modules/app/src/main/scala/cards/nine/app/ui/launcher/actions/publicollections/PublicCollectionsFragment.scala
+++ b/modules/app/src/main/scala/cards/nine/app/ui/launcher/actions/publicollections/PublicCollectionsFragment.scala
@@ -37,13 +37,13 @@ class PublicCollectionsFragment(implicit launcherJobs: LauncherJobs)
}
override def loadPublicCollectionsByTypeSharedCollection(typeSharedCollection: TypeSharedCollection): Unit =
- serialCancelableTaskRef := collectionJobs.loadPublicCollectionsByTypeSharedCollection(typeSharedCollection).resolveAsyncServiceOr(onError)
+ serialCancelableTaskRef := collectionJobs.loadPublicCollectionsByTypeSharedCollection(typeSharedCollection).resolveAutoCancelableAsyncServiceOr(onError)
override def loadPublicCollectionsByCategory(category: NineCardsCategory): Unit =
- serialCancelableTaskRef := collectionJobs.loadPublicCollectionsByCategory(category).resolveAsyncServiceOr(onError)
+ serialCancelableTaskRef := collectionJobs.loadPublicCollectionsByCategory(category).resolveAutoCancelableAsyncServiceOr(onError)
override def loadPublicCollections(): Unit =
- serialCancelableTaskRef := collectionJobs.loadPublicCollections().resolveAsyncServiceOr(onError)
+ serialCancelableTaskRef := collectionJobs.loadPublicCollections().resolveAutoCancelableAsyncServiceOr(onError)
override def onAddCollection(sharedCollection: SharedCollection): Unit =
(for {
diff --git a/modules/app/src/main/scala/cards/nine/app/ui/profile/ProfileActivity.scala b/modules/app/src/main/scala/cards/nine/app/ui/profile/ProfileActivity.scala
index 95f48514c..8691096c9 100644
--- a/modules/app/src/main/scala/cards/nine/app/ui/profile/ProfileActivity.scala
+++ b/modules/app/src/main/scala/cards/nine/app/ui/profile/ProfileActivity.scala
@@ -176,13 +176,13 @@ class ProfileActivity
tab match {
case AccountsTab =>
serialCancelableTaskRef := withError(jobs.loadUserAccounts())
- .resolveAsyncServiceOr(_ => jobs.profileUiActions.showEmptyAccountsContent(error = true))
+ .resolveAutoCancelableAsyncServiceOr(_ => jobs.profileUiActions.showEmptyAccountsContent(error = true))
case PublicationsTab =>
serialCancelableTaskRef := withError(jobs.loadPublications())
- .resolveAsyncServiceOr(onException(jobs.profileUiActions.showEmptyPublicationsContent(error = true)))
+ .resolveAutoCancelableAsyncServiceOr(onException(jobs.profileUiActions.showEmptyPublicationsContent(error = true)))
case SubscriptionsTab =>
serialCancelableTaskRef := withError(jobs.loadSubscriptions())
- .resolveAsyncServiceOr(onException(jobs.profileUiActions.showEmptySubscriptionsContent(error = true)))
+ .resolveAutoCancelableAsyncServiceOr(onException(jobs.profileUiActions.showEmptySubscriptionsContent(error = true)))
}
}
}
diff --git a/modules/app/src/main/scala/cards/nine/app/ui/wizard/jobs/uiactions/WizardUiActions.scala b/modules/app/src/main/scala/cards/nine/app/ui/wizard/jobs/uiactions/WizardUiActions.scala
index 68c098b80..78a3591f8 100644
--- a/modules/app/src/main/scala/cards/nine/app/ui/wizard/jobs/uiactions/WizardUiActions.scala
+++ b/modules/app/src/main/scala/cards/nine/app/ui/wizard/jobs/uiactions/WizardUiActions.scala
@@ -169,6 +169,7 @@ class WizardUiActions(dom: WizardDOM, listener: WizardUiListener)(implicit val c
case Some(p) if p.nonEmpty => listener.onClickSelectV1DeviceButton(p)
case _ => listener.onClickSelectDeviceButton(None)
}
+ case _ => listener.onClickSelectDeviceButton(None)
}
}
}
diff --git a/modules/commons/build.sbt b/modules/commons/build.sbt
index a76dbd18c..9243df1ea 100644
--- a/modules/commons/build.sbt
+++ b/modules/commons/build.sbt
@@ -1,3 +1,3 @@
android.Plugin.androidBuild
-platformTarget in Android := "android-23"
\ No newline at end of file
+platformTarget in Android := "android-24"
\ No newline at end of file
diff --git a/modules/commons/src/main/scala/cards/nine/commons/services/package.scala b/modules/commons/src/main/scala/cards/nine/commons/services/package.scala
index 7ba3cf513..73ca21b99 100644
--- a/modules/commons/src/main/scala/cards/nine/commons/services/package.scala
+++ b/modules/commons/src/main/scala/cards/nine/commons/services/package.scala
@@ -1,25 +1,15 @@
package cards.nine.commons
import cats.data.EitherT
-import cats.{Functor, Monad}
-import monix.eval.Task
import cats.syntax.either._
+import monix.cats.MonixToCatsConversions
+import monix.eval.Task
import scala.language.{higherKinds, implicitConversions}
package object services {
- object TaskService {
-
- implicit val taskFunctor = new Functor[Task] {
- override def map[A, B](fa: Task[A])(f: (A) => B): Task[B] = fa.map(f)
- }
-
- implicit val taskMonad = new Monad[Task] {
- override def flatMap[A, B](fa: Task[A])(f: (A) => Task[B]): Task[B] = fa.flatMap(f)
- override def pure[A](x: A): Task[A] = Task(x)
- override def tailRecM[A, B](a: A)(f: (A) => Task[Either[A, B]]): Task[B] = defaultTailRecM(a)(f)
- }
+ object TaskService extends MonixToCatsConversions {
trait NineCardException extends RuntimeException {
def message: String
diff --git a/modules/process/build.sbt b/modules/process/build.sbt
index 85fdbaf95..d3cef84f6 100644
--- a/modules/process/build.sbt
+++ b/modules/process/build.sbt
@@ -1 +1 @@
-platformTarget in Android := "android-23"
\ No newline at end of file
+platformTarget in Android := "android-24"
\ No newline at end of file
diff --git a/modules/process/src/main/scala/cards/nine/process/user/impl/UserProcessImpl.scala b/modules/process/src/main/scala/cards/nine/process/user/impl/UserProcessImpl.scala
index bf2a6beb8..6066f9c27 100644
--- a/modules/process/src/main/scala/cards/nine/process/user/impl/UserProcessImpl.scala
+++ b/modules/process/src/main/scala/cards/nine/process/user/impl/UserProcessImpl.scala
@@ -122,7 +122,7 @@ class UserProcessImpl(
androidId <- persistenceServices.getAndroidId
_ <- apiServices.updateInstallation(deviceToken)(RequestConfig(apiKey, sessionToken, androidId))
} yield ()).resolve[UserException]
- case _ => TaskService(Task(Right(0)))
+ case _ => TaskService.right(0)
}
private[this] def findUserById(id: Int): TaskService[User] =
diff --git a/modules/repository/build.sbt b/modules/repository/build.sbt
index 85fdbaf95..d3cef84f6 100644
--- a/modules/repository/build.sbt
+++ b/modules/repository/build.sbt
@@ -1 +1 @@
-platformTarget in Android := "android-23"
\ No newline at end of file
+platformTarget in Android := "android-24"
\ No newline at end of file
diff --git a/modules/services/build.sbt b/modules/services/build.sbt
index a76dbd18c..9243df1ea 100644
--- a/modules/services/build.sbt
+++ b/modules/services/build.sbt
@@ -1,3 +1,3 @@
android.Plugin.androidBuild
-platformTarget in Android := "android-23"
\ No newline at end of file
+platformTarget in Android := "android-24"
\ No newline at end of file
diff --git a/project/Libraries.scala b/project/Libraries.scala
index f0e36c8c2..5a514b21e 100755
--- a/project/Libraries.scala
+++ b/project/Libraries.scala
@@ -19,6 +19,7 @@ object Libraries {
object monix {
lazy val monixTypes = "io.monix" %% "monix-types" % Versions.monixV
lazy val monixEval = "io.monix" %% "monix-eval" % Versions.monixV
+ lazy val monixCats = "io.monix" %% "monix-cats" % Versions.monixV
}
object android {
diff --git a/project/Settings.scala b/project/Settings.scala
index 556f46658..fd5b00e5e 100644
--- a/project/Settings.scala
+++ b/project/Settings.scala
@@ -123,7 +123,7 @@ object Settings extends SiteKeys {
organizationName := "47deg",
scalaVersion := Versions.scalaV,
resolvers ++= commonResolvers,
- libraryDependencies ++= Seq(cats, monixTypes, monixEval)
+ libraryDependencies ++= Seq(cats, monixTypes, monixEval, monixCats)
)
lazy val duplicatedFiles = Set(
diff --git a/project/Versions.scala b/project/Versions.scala
index b48c01dfd..123e9deda 100755
--- a/project/Versions.scala
+++ b/project/Versions.scala
@@ -22,7 +22,7 @@ object Versions {
val crashlyticsV = "2.5.2"
val jodaTimeV = "2.9.2"
val gfcTimeUUIDV = "0.0.6"
- val monixV = "2.0.0"
- val catsV = "0.7.2"
- val flowUpV= "0.1.6"
+ val monixV = "2.1.1"
+ val catsV = "0.8.1"
+ val flowUpV= "0.1.8"
}
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 24bf1053e..acaaf1f61 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -1,6 +1,6 @@
addSbtPlugin("org.brianmckenna" % "sbt-wartremover" % "0.13")
-addSbtPlugin("org.scala-android" % "sbt-android" % "1.6.9")
+addSbtPlugin("org.scala-android" % "sbt-android" % "1.7.1")
resolvers += Resolver.url("scoverage-bintray", url("https://dl.bintray.com/sksamuel/sbt-plugins/"))(Resolver.ivyStylePatterns)