@@ -12,12 +12,17 @@ import lila.round.RoundGame.*
12
12
13
13
object RoundMobile :
14
14
15
- enum UseCase (val socketStatus : Option [SocketStatus ], val chat : Boolean , val prefs : Boolean ):
15
+ enum UseCase (
16
+ val socketStatus : Option [SocketStatus ],
17
+ val chat : Boolean ,
18
+ val prefs : Boolean ,
19
+ val bookmark : Boolean
20
+ ):
16
21
// full round for every-day use
17
- case Online (socket : SocketStatus ) extends UseCase (socket.some, chat = true , prefs = true )
22
+ case Online (socket : SocketStatus ) extends UseCase (socket.some, chat = true , prefs = true , bookmark = true )
18
23
// correspondence game sent through firebase data
19
24
// https://github.com/lichess-org/mobile/blob/main/lib/src/model/correspondence/offline_correspondence_game.dart
20
- case Offline extends UseCase (none, chat = false , prefs = false )
25
+ case Offline extends UseCase (none, chat = false , prefs = false , bookmark = false )
21
26
22
27
final class RoundMobile (
23
28
lightUserGet : LightUser .Getter ,
@@ -28,7 +33,8 @@ final class RoundMobile(
28
33
takebacker : Takebacker ,
29
34
moretimer : Moretimer ,
30
35
isOfferingRematch : lila.core.round.IsOfferingRematch ,
31
- chatApi : lila.chat.ChatApi
36
+ chatApi : lila.chat.ChatApi ,
37
+ bookmarkExists : lila.core.bookmark.BookmarkExists
32
38
)(using Executor , lila.core.user.FlairGetMap ):
33
39
34
40
import RoundMobile .*
@@ -58,6 +64,7 @@ final class RoundMobile(
58
64
moretimeable <- moretimer.isAllowedIn(game, Preload (prefs))
59
65
chat <- use.chat.so(getPlayerChat(game, myPlayer.exists(_.hasUser)))
60
66
chatLines <- chat.map(_.chat).soFu(lila.chat.JsonView .asyncLines)
67
+ bookmarked <- use.bookmark.so(bookmarkExists(game, myPlayer.flatMap(_.userId)))
61
68
yield
62
69
def playerJson (color : Color ) =
63
70
val pov = Pov (game, color)
@@ -98,6 +105,7 @@ final class RoundMobile(
98
105
.obj(" lines" -> chatLines)
99
106
.add(" restricted" , c.restricted)
100
107
)
108
+ .add(" bookmarked" , bookmarked)
101
109
102
110
private def prefsJson (game : Game , pref : Pref ): JsObject = Json
103
111
.obj(
0 commit comments