diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index d0ac41937..d718f0080 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -43,19 +43,19 @@
-
+
+ android:windowSoftInputMode="adjustResize" />
-
-
+
+
diff --git a/app/src/main/graphql/com/github/andreyasadchy/xtra/schema.graphqls b/app/src/main/graphql/com/github/andreyasadchy/xtra/schema.graphqls
index ad3db3db7..3884020b5 100644
--- a/app/src/main/graphql/com/github/andreyasadchy/xtra/schema.graphqls
+++ b/app/src/main/graphql/com/github/andreyasadchy/xtra/schema.graphqls
@@ -1,493 +1,493 @@
type Query {
- badges: [Badge]
- cheerConfig: GlobalCheerConfig
- games(first: Int, after: Cursor, options: GameOptions): GameConnection
- game(id: ID, slug: String, name: String): Game
- searchCategories(query: String!, first: Int, after: Cursor): SearchCategoriesConnection
- searchFor(userQuery: String!, platform: String!, target: SearchForTarget): SearchFor
- searchStreams(userQuery: String!, first: Int, after: Cursor): SearchStreamConnection
- searchUsers(userQuery: String!, first: Int, after: Cursor): SearchUserConnection
- streams(first: Int, after: Cursor, options: StreamOptions): StreamConnection
- user(id: ID, login: String, lookupType: UserLookupType): User
- userResultByID(id: ID!): UserResult
- userResultByLogin(login: String!): UserResult
- users(ids: [ID!], logins: [String!]): [User]
- video(id: ID): Video
+ badges: [Badge]
+ cheerConfig: GlobalCheerConfig
+ games(first: Int, after: Cursor, options: GameOptions): GameConnection
+ game(id: ID, slug: String, name: String): Game
+ searchCategories(query: String!, first: Int, after: Cursor): SearchCategoriesConnection
+ searchFor(userQuery: String!, platform: String!, target: SearchForTarget): SearchFor
+ searchStreams(userQuery: String!, first: Int, after: Cursor): SearchStreamConnection
+ searchUsers(userQuery: String!, first: Int, after: Cursor): SearchUserConnection
+ streams(first: Int, after: Cursor, options: StreamOptions): StreamConnection
+ user(id: ID, login: String, lookupType: UserLookupType): User
+ userResultByID(id: ID!): UserResult
+ userResultByLogin(login: String!): UserResult
+ users(ids: [ID!], logins: [String!]): [User]
+ video(id: ID): Video
}
type Badge {
- imageURL(size: BadgeImageSize): String
- setID: ID
- title: String
- version: String
+ imageURL(size: BadgeImageSize): String
+ setID: ID
+ title: String
+ version: String
}
type Broadcast {
- startedAt: Time
+ startedAt: Time
}
type BroadcastSettings {
- title: String
+ title: String
}
type ChannelNotificationSettings {
- isEnabled: Boolean
+ isEnabled: Boolean
}
type CheerInfo {
- cheerGroups: [CheermoteGroup!]
+ cheerGroups: [CheermoteGroup!]
}
type Cheermote {
- prefix: String
- tiers: [CheermoteTier]
+ prefix: String
+ tiers: [CheermoteTier]
}
type CheermoteColorConfig {
- bits: Int
- color: String
+ bits: Int
+ color: String
}
type CheermoteDisplayConfig {
- backgrounds: [String!]
- colors: [CheermoteColorConfig!]
- scales: [String!]
- types: [CheermoteDisplayType!]
+ backgrounds: [String!]
+ colors: [CheermoteColorConfig!]
+ scales: [String!]
+ types: [CheermoteDisplayType!]
}
type CheermoteDisplayType {
- animation: String
- extension: String
+ animation: String
+ extension: String
}
type CheermoteGroup {
- nodes: [Cheermote!]
- templateURL: String
+ nodes: [Cheermote!]
+ templateURL: String
}
type CheermoteTier {
- bits: Int
+ bits: Int
}
type Clip {
- broadcaster: User
- createdAt: Time
- durationSeconds: Int
- game: Game
- id: ID
- slug: String
- thumbnailURL: String
- title: String
- video: Video
- videoOffsetSeconds: Int
- viewCount: Int
+ broadcaster: User
+ createdAt: Time
+ durationSeconds: Int
+ game: Game
+ id: ID
+ slug: String
+ thumbnailURL: String
+ title: String
+ video: Video
+ videoOffsetSeconds: Int
+ viewCount: Int
}
type ClipConnection {
- edges: [ClipEdge]
- pageInfo: PageInfo
+ edges: [ClipEdge]
+ pageInfo: PageInfo
}
type ClipEdge {
- cursor: Cursor
- node: Clip
+ cursor: Cursor
+ node: Clip
}
type Emote {
- id: ID
- owner: User
- setID: ID
- token: String
- type: EmoteType
+ id: ID
+ owner: User
+ setID: ID
+ token: String
+ type: EmoteType
}
type EmoteSet {
- emotes: [Emote]
+ emotes: [Emote]
}
type Follow {
- followedAt: Time
+ followedAt: Time
}
type FollowConnection {
- edges: [FollowEdge]
- pageInfo: PageInfo
- totalCount: Int
+ edges: [FollowEdge]
+ pageInfo: PageInfo
+ totalCount: Int
}
type FollowedGameConnection {
- nodes: [Game]
+ nodes: [Game]
}
type FollowEdge {
- cursor: Cursor
- followedAt: Time
- node: User
+ cursor: Cursor
+ followedAt: Time
+ node: User
}
type FollowedLiveUserConnection {
- edges: [FollowedLiveUserEdge]
- pageInfo: PageInfo
+ edges: [FollowedLiveUserEdge]
+ pageInfo: PageInfo
}
type FollowedLiveUserEdge {
- cursor: Cursor
- node: User
+ cursor: Cursor
+ node: User
}
type FollowerConnection {
- totalCount: Int
+ totalCount: Int
}
type FollowerEdge {
- notificationSettings: ChannelNotificationSettings
+ notificationSettings: ChannelNotificationSettings
}
type FreeformTag {
- name: String
+ name: String
}
type Game {
- boxArtURL(width: Int, height: Int): String
- broadcastersCount: Int
- clips(first: Int, after: Cursor, criteria: GameClipsInput): ClipConnection
- displayName: String
- id: ID
- slug: String
- streams(first: Int, after: Cursor, options: GameStreamOptions): StreamConnection
- tags(tagType: TagType!): [Tag!]
- videos(first: Int, after: Cursor, languages: [String!], types: [BroadcastType!], sort: VideoSort): VideoConnection
- viewersCount: Int
+ boxArtURL(width: Int, height: Int): String
+ broadcastersCount: Int
+ clips(first: Int, after: Cursor, criteria: GameClipsInput): ClipConnection
+ displayName: String
+ id: ID
+ slug: String
+ streams(first: Int, after: Cursor, options: GameStreamOptions): StreamConnection
+ tags(tagType: TagType!): [Tag!]
+ videos(first: Int, after: Cursor, languages: [String!], types: [BroadcastType!], sort: VideoSort): VideoConnection
+ viewersCount: Int
}
type GameConnection {
- edges: [GameEdge]
- pageInfo: PageInfo
+ edges: [GameEdge]
+ pageInfo: PageInfo
}
type GameEdge {
- cursor: Cursor
- node: Game
+ cursor: Cursor
+ node: Game
}
type GlobalCheerConfig {
- displayConfig: CheermoteDisplayConfig
- groups: [CheermoteGroup!]
+ displayConfig: CheermoteDisplayConfig
+ groups: [CheermoteGroup!]
}
type PageInfo {
- hasNextPage: Boolean
- hasPreviousPage: Boolean
+ hasNextPage: Boolean
+ hasPreviousPage: Boolean
}
type SearchCategoriesConnection {
- edges: [SearchCategoriesEdge!]
- pageInfo: PageInfo
+ edges: [SearchCategoriesEdge!]
+ pageInfo: PageInfo
}
type SearchCategoriesEdge {
- cursor: Cursor
- node: Game
+ cursor: Cursor
+ node: Game
}
type SearchFor {
- channels: SearchForResultUsers
- games: SearchForResultGames
- videos: SearchForResultVideos
+ channels: SearchForResultUsers
+ games: SearchForResultGames
+ videos: SearchForResultVideos
}
type SearchForResultGames {
- cursor: String
- items: [Game!]
- pageInfo: PageInfo
+ cursor: String
+ items: [Game!]
+ pageInfo: PageInfo
}
type SearchForResultUsers {
- cursor: String
- items: [User!]
- pageInfo: PageInfo
+ cursor: String
+ items: [User!]
+ pageInfo: PageInfo
}
type SearchForResultVideos {
- cursor: String
- items: [Video!]
- pageInfo: PageInfo
+ cursor: String
+ items: [Video!]
+ pageInfo: PageInfo
}
type SearchStreamConnection {
- edges: [SearchStreamEdge!]
- pageInfo: PageInfo
+ edges: [SearchStreamEdge!]
+ pageInfo: PageInfo
}
type SearchStreamEdge {
- cursor: Cursor
- node: Stream
+ cursor: Cursor
+ node: Stream
}
type SearchUserConnection {
- edges: [SearchUserEdge!]
- pageInfo: PageInfo
+ edges: [SearchUserEdge!]
+ pageInfo: PageInfo
}
type SearchUserEdge {
- cursor: Cursor
- node: User
+ cursor: Cursor
+ node: User
}
type Stream {
- broadcaster: User
- createdAt: Time
- freeformTags: [FreeformTag!]
- game: Game
- id: ID
- previewImageURL: String
- title: String
- type: String
- viewersCount: Int
+ broadcaster: User
+ createdAt: Time
+ freeformTags: [FreeformTag!]
+ game: Game
+ id: ID
+ previewImageURL: String
+ title: String
+ type: String
+ viewersCount: Int
}
type StreamConnection {
- edges: [StreamEdge]
- pageInfo: PageInfo
+ edges: [StreamEdge]
+ pageInfo: PageInfo
}
type StreamEdge {
- cursor: Cursor
- node: Stream
+ cursor: Cursor
+ node: Stream
}
type Tag {
- id: ID
- localizedName: String
- scope: TagScope
+ id: ID
+ localizedName: String
+ scope: TagScope
}
type User {
- bannerImageURL: String
- broadcastBadges: [Badge]
- broadcastSettings: BroadcastSettings,
- cheer: CheerInfo
- clips(first: Int, after: Cursor, criteria: UserClipsInput): ClipConnection
- createdAt: Time
- description: String
- displayName: String
- emoteSets: [EmoteSet!]
- follow(targetID: ID, targetLogin: String): Follow
- followedGames(first: Int, type: FollowedGamesType): FollowedGameConnection
- followedLiveUsers(first: Int, after: Cursor, sort: StreamSort): FollowedLiveUserConnection
- followedVideos(first: Int, after: Cursor, languages: [String!], types: [BroadcastType!], sort: VideoSort): VideoConnection
- followers: FollowerConnection
- follows(first: Int, after: Cursor, order: SortOrder): FollowConnection
- id: ID
- login: String
- lastBroadcast: Broadcast
- profileImageURL(width: Int): String
- roles: UserRoles
- self: UserSelfConnection
- stream: Stream
- videos(first: Int, after: Cursor, types: [BroadcastType!], sort: VideoSort): VideoConnection
+ bannerImageURL: String
+ broadcastBadges: [Badge]
+ broadcastSettings: BroadcastSettings,
+ cheer: CheerInfo
+ clips(first: Int, after: Cursor, criteria: UserClipsInput): ClipConnection
+ createdAt: Time
+ description: String
+ displayName: String
+ emoteSets: [EmoteSet!]
+ follow(targetID: ID, targetLogin: String): Follow
+ followedGames(first: Int, type: FollowedGamesType): FollowedGameConnection
+ followedLiveUsers(first: Int, after: Cursor, sort: StreamSort): FollowedLiveUserConnection
+ followedVideos(first: Int, after: Cursor, languages: [String!], types: [BroadcastType!], sort: VideoSort): VideoConnection
+ followers: FollowerConnection
+ follows(first: Int, after: Cursor, order: SortOrder): FollowConnection
+ id: ID
+ login: String
+ lastBroadcast: Broadcast
+ profileImageURL(width: Int): String
+ roles: UserRoles
+ self: UserSelfConnection
+ stream: Stream
+ videos(first: Int, after: Cursor, types: [BroadcastType!], sort: VideoSort): VideoConnection
}
type UserDoesNotExist {
- key: String!
- reason: String!
+ key: String!
+ reason: String!
}
type UserError {
- key: String!
+ key: String!
}
type UserRoles {
- isAffiliate: Boolean
- isPartner: Boolean
- isStaff: Boolean
+ isAffiliate: Boolean
+ isPartner: Boolean
+ isStaff: Boolean
}
type UserSelfConnection {
- follower: FollowerEdge
+ follower: FollowerEdge
}
type Video {
- animatedPreviewURL: String
- broadcastType: BroadcastType
- contentTags: [Tag!]
- createdAt: Time
- game: Game
- id: ID
- lengthSeconds: Int
- owner: User
- previewThumbnailURL: String
- title: String
- viewCount: Int
+ animatedPreviewURL: String
+ broadcastType: BroadcastType
+ contentTags: [Tag!]
+ createdAt: Time
+ game: Game
+ id: ID
+ lengthSeconds: Int
+ owner: User
+ previewThumbnailURL: String
+ title: String
+ viewCount: Int
}
type VideoConnection {
- edges: [VideoEdge]
- pageInfo: PageInfo
+ edges: [VideoEdge]
+ pageInfo: PageInfo
}
type VideoEdge {
- cursor: Cursor
- node: Video
+ cursor: Cursor
+ node: Video
}
input GameClipsInput {
- languages: [Language!]
- period: ClipsPeriod
- sort: ClipsSort
+ languages: [Language!]
+ period: ClipsPeriod
+ sort: ClipsSort
}
input GameOptions {
- tags: [String!]
+ tags: [String!]
}
input GameStreamOptions {
- freeformTags: [String!]
- sort: StreamSort
+ freeformTags: [String!]
+ sort: StreamSort
}
input SearchForTarget {
- cursor: String
- index: SearchIndex
- limit: Int
+ cursor: String
+ index: SearchIndex
+ limit: Int
}
input StreamOptions {
- freeformTags: [String!]
- sort: StreamSort
+ freeformTags: [String!]
+ sort: StreamSort
}
input UserClipsInput {
- period: ClipsPeriod
- sort: ClipsSort
+ period: ClipsPeriod
+ sort: ClipsSort
}
enum BadgeImageSize {
- NORMAL
- DOUBLE
- QUADRUPLE
+ NORMAL
+ DOUBLE
+ QUADRUPLE
}
enum BroadcastType {
- ARCHIVE
- HIGHLIGHT
- UPLOAD
- PREMIERE_UPLOAD
- PAST_PREMIERE
+ ARCHIVE
+ HIGHLIGHT
+ UPLOAD
+ PREMIERE_UPLOAD
+ PAST_PREMIERE
}
enum ClipsPeriod {
- LAST_DAY
- LAST_WEEK
- LAST_MONTH
- ALL_TIME
+ LAST_DAY
+ LAST_WEEK
+ LAST_MONTH
+ ALL_TIME
}
enum ClipsSort {
- CREATED_AT_ASC
- CREATED_AT_DESC
- VIEWS_ASC
- VIEWS_DESC
- TRENDING
+ CREATED_AT_ASC
+ CREATED_AT_DESC
+ VIEWS_ASC
+ VIEWS_DESC
+ TRENDING
}
enum EmoteType {
- CHANNEL_POINTS
- BITS_BADGE_TIERS
- SUBSCRIPTIONS
- PRIME
- TURBO
- TWO_FACTOR
- SMILIES
- GLOBALS
- LIMITED_TIME
- HYPE_TRAIN
- MEGA_COMMERCE
- ARCHIVE
- FOLLOWER
- UNKNOWN
+ CHANNEL_POINTS
+ BITS_BADGE_TIERS
+ SUBSCRIPTIONS
+ PRIME
+ TURBO
+ TWO_FACTOR
+ SMILIES
+ GLOBALS
+ LIMITED_TIME
+ HYPE_TRAIN
+ MEGA_COMMERCE
+ ARCHIVE
+ FOLLOWER
+ UNKNOWN
}
enum FollowedGamesType {
- LIVE
- ALL
+ LIVE
+ ALL
}
enum Language {
- AR
- ASL
- BG
- CA
- CS
- DA
- DE
- EL
- EN
- ES
- FI
- FR
- HI
- HU
- ID
- IT
- JA
- KO
- MS
- NL
- NO
- OTHER
- PL
- PT
- RO
- RU
- SK
- SV
- TH
- TL
- TR
- UK
- VI
- ZH
- ZH_HK
+ AR
+ ASL
+ BG
+ CA
+ CS
+ DA
+ DE
+ EL
+ EN
+ ES
+ FI
+ FR
+ HI
+ HU
+ ID
+ IT
+ JA
+ KO
+ MS
+ NL
+ NO
+ OTHER
+ PL
+ PT
+ RO
+ RU
+ SK
+ SV
+ TH
+ TL
+ TR
+ UK
+ VI
+ ZH
+ ZH_HK
}
enum SearchIndex {
- GAME
- VOD
- CHANNEL
+ GAME
+ VOD
+ CHANNEL
}
enum SortOrder {
- ASC
- DESC
+ ASC
+ DESC
}
enum StreamSort {
- VIEWER_COUNT
- VIEWER_COUNT_ASC
- RECENT
- RELEVANCE
+ VIEWER_COUNT
+ VIEWER_COUNT_ASC
+ RECENT
+ RELEVANCE
}
enum TagScope {
- ALL
- CATEGORY
+ ALL
+ CATEGORY
}
enum TagType {
- CONTENT
- TOP
+ CONTENT
+ TOP
}
enum UserLookupType {
- ACTIVE
- ALL
+ ACTIVE
+ ALL
}
enum VideoSort {
- TIME
- TIME_ASC
- VIEWS
+ TIME
+ TIME_ASC
+ VIEWS
}
union UserResult = User | UserDoesNotExist | UserError
@@ -496,5 +496,5 @@ scalar Cursor
scalar Time
schema {
- query: Query
+ query: Query
}
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/api/GraphQLApi.kt b/app/src/main/java/com/github/andreyasadchy/xtra/api/GraphQLApi.kt
index 671ea5993..74ebc5446 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/api/GraphQLApi.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/api/GraphQLApi.kt
@@ -47,164 +47,326 @@ import retrofit2.http.POST
interface GraphQLApi {
@POST(".")
- suspend fun getPlaybackAccessToken(@HeaderMap headers: Map, @Body json: JsonObject): PlaybackAccessTokenResponse
+ suspend fun getPlaybackAccessToken(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): PlaybackAccessTokenResponse
@POST(".")
- suspend fun getClipUrls(@HeaderMap headers: Map, @Body json: JsonObject): ClipUrlsResponse
+ suspend fun getClipUrls(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): ClipUrlsResponse
@POST(".")
- suspend fun getClipData(@HeaderMap headers: Map, @Body json: JsonObject): ClipDataResponse
+ suspend fun getClipData(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): ClipDataResponse
@POST(".")
- suspend fun getClipVideo(@HeaderMap headers: Map, @Body json: JsonObject): ClipVideoResponse
+ suspend fun getClipVideo(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): ClipVideoResponse
@POST(".")
- suspend fun getTopGames(@HeaderMap headers: Map, @Body json: JsonObject): GamesResponse
+ suspend fun getTopGames(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): GamesResponse
@POST(".")
- suspend fun getTopStreams(@HeaderMap headers: Map, @Body json: JsonObject): StreamsResponse
+ suspend fun getTopStreams(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): StreamsResponse
@POST(".")
- suspend fun getGameStreams(@HeaderMap headers: Map, @Body json: JsonObject): GameStreamsResponse
+ suspend fun getGameStreams(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): GameStreamsResponse
@POST(".")
- suspend fun getGameVideos(@HeaderMap headers: Map, @Body json: JsonObject): GameVideosResponse
+ suspend fun getGameVideos(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): GameVideosResponse
@POST(".")
- suspend fun getGameClips(@HeaderMap headers: Map, @Body json: JsonObject): GameClipsResponse
+ suspend fun getGameClips(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): GameClipsResponse
@POST(".")
- suspend fun getChannelVideos(@HeaderMap headers: Map, @Body json: JsonObject): ChannelVideosResponse
+ suspend fun getChannelVideos(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): ChannelVideosResponse
@POST(".")
- suspend fun getChannelClips(@HeaderMap headers: Map, @Body json: JsonObject): ChannelClipsResponse
+ suspend fun getChannelClips(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): ChannelClipsResponse
@POST(".")
- suspend fun getSearchChannels(@HeaderMap headers: Map, @Body json: JsonObject): SearchChannelsResponse
+ suspend fun getSearchChannels(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): SearchChannelsResponse
@POST(".")
- suspend fun getSearchGames(@HeaderMap headers: Map, @Body json: JsonObject): SearchGamesResponse
+ suspend fun getSearchGames(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): SearchGamesResponse
@POST(".")
- suspend fun getSearchVideos(@HeaderMap headers: Map, @Body json: JsonObject): SearchVideosResponse
+ suspend fun getSearchVideos(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): SearchVideosResponse
@POST(".")
- suspend fun getFreeformTags(@HeaderMap headers: Map, @Body json: JsonObject): SearchStreamTagsResponse
+ suspend fun getFreeformTags(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): SearchStreamTagsResponse
@POST(".")
- suspend fun getGameTags(@HeaderMap headers: Map, @Body json: JsonObject): SearchGameTagsResponse
+ suspend fun getGameTags(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): SearchGameTagsResponse
@POST(".")
- suspend fun getChatBadges(@HeaderMap headers: Map, @Body json: JsonObject): BadgesResponse
+ suspend fun getChatBadges(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): BadgesResponse
@POST(".")
- suspend fun getGlobalCheerEmotes(@HeaderMap headers: Map, @Body json: JsonObject): GlobalCheerEmotesResponse
+ suspend fun getGlobalCheerEmotes(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): GlobalCheerEmotesResponse
@POST(".")
- suspend fun getChannelCheerEmotes(@HeaderMap headers: Map, @Body json: JsonObject): ChannelCheerEmotesResponse
+ suspend fun getChannelCheerEmotes(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): ChannelCheerEmotesResponse
@POST(".")
- suspend fun getVideoMessages(@HeaderMap headers: Map, @Body json: JsonObject): VideoMessagesResponse
+ suspend fun getVideoMessages(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): VideoMessagesResponse
@POST(".")
- suspend fun getVideoMessagesDownload(@HeaderMap headers: Map, @Body json: JsonObject): JsonElement
+ suspend fun getVideoMessagesDownload(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): JsonElement
@POST(".")
- suspend fun getVideoGames(@HeaderMap headers: Map, @Body json: JsonObject): VideoGamesResponse
+ suspend fun getVideoGames(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): VideoGamesResponse
@POST(".")
- suspend fun getChannelViewerList(@HeaderMap headers: Map, @Body json: JsonObject): ChannelViewerListResponse
+ suspend fun getChannelViewerList(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): ChannelViewerListResponse
@POST(".")
- suspend fun getViewerCount(@HeaderMap headers: Map, @Body json: JsonObject): ViewerCountResponse
+ suspend fun getViewerCount(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): ViewerCountResponse
@POST(".")
- suspend fun getEmoteCard(@HeaderMap headers: Map, @Body json: JsonObject): EmoteCardResponse
+ suspend fun getEmoteCard(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): EmoteCardResponse
@POST(".")
- suspend fun getChannelPanel(@HeaderMap headers: Map, @Body json: JsonObject): Response
+ suspend fun getChannelPanel(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): Response
@POST(".")
- suspend fun getFollowedStreams(@HeaderMap headers: Map, @Body json: JsonObject): FollowedStreamsResponse
+ suspend fun getFollowedStreams(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): FollowedStreamsResponse
@POST(".")
- suspend fun getFollowedVideos(@HeaderMap headers: Map, @Body json: JsonObject): FollowedVideosResponse
+ suspend fun getFollowedVideos(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): FollowedVideosResponse
@POST(".")
- suspend fun getFollowedChannels(@HeaderMap headers: Map, @Body json: JsonObject): FollowedChannelsResponse
+ suspend fun getFollowedChannels(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): FollowedChannelsResponse
@POST(".")
- suspend fun getFollowedGames(@HeaderMap headers: Map, @Body json: JsonObject): FollowedGamesResponse
+ suspend fun getFollowedGames(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): FollowedGamesResponse
@POST(".")
- suspend fun getFollowUser(@HeaderMap headers: Map, @Body json: JsonObject): ErrorResponse
+ suspend fun getFollowUser(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): ErrorResponse
@POST(".")
- suspend fun getUnfollowUser(@HeaderMap headers: Map, @Body json: JsonObject): ErrorResponse
+ suspend fun getUnfollowUser(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): ErrorResponse
@POST(".")
- suspend fun getToggleNotificationsUser(@HeaderMap headers: Map, @Body json: JsonObject): ErrorResponse
+ suspend fun getToggleNotificationsUser(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): ErrorResponse
@POST(".")
- suspend fun getFollowGame(@HeaderMap headers: Map, @Body json: JsonObject): ErrorResponse
+ suspend fun getFollowGame(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): ErrorResponse
@POST(".")
- suspend fun getUnfollowGame(@HeaderMap headers: Map, @Body json: JsonObject): ErrorResponse
+ suspend fun getUnfollowGame(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): ErrorResponse
@POST(".")
- suspend fun getFollowingUser(@HeaderMap headers: Map, @Body json: JsonObject): FollowingUserResponse
+ suspend fun getFollowingUser(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): FollowingUserResponse
@POST(".")
- suspend fun getFollowingGame(@HeaderMap headers: Map, @Body json: JsonObject): FollowingGameResponse
+ suspend fun getFollowingGame(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): FollowingGameResponse
@POST(".")
- suspend fun getChannelPointsContext(@HeaderMap headers: Map, @Body json: JsonObject): ChannelPointContextResponse
+ suspend fun getChannelPointsContext(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): ChannelPointContextResponse
@POST(".")
- suspend fun getClaimPoints(@HeaderMap headers: Map, @Body json: JsonObject): ErrorResponse
+ suspend fun getClaimPoints(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): ErrorResponse
@POST(".")
- suspend fun getJoinRaid(@HeaderMap headers: Map, @Body json: JsonObject): Response
+ suspend fun getJoinRaid(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): Response
@POST(".")
- suspend fun getUserEmotes(@HeaderMap headers: Map, @Body json: JsonObject): UserEmotesResponse
+ suspend fun getUserEmotes(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): UserEmotesResponse
@POST(".")
- suspend fun sendAnnouncement(@HeaderMap headers: Map, @Body json: JsonObject): Response
+ suspend fun sendAnnouncement(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): Response
@POST(".")
- suspend fun banUser(@HeaderMap headers: Map, @Body json: JsonObject): Response
+ suspend fun banUser(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): Response
@POST(".")
- suspend fun unbanUser(@HeaderMap headers: Map, @Body json: JsonObject): Response
+ suspend fun unbanUser(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): Response
@POST(".")
- suspend fun updateChatColor(@HeaderMap headers: Map, @Body json: JsonObject): Response
+ suspend fun updateChatColor(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): Response
@POST(".")
- suspend fun createStreamMarker(@HeaderMap headers: Map, @Body json: JsonObject): Response
+ suspend fun createStreamMarker(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): Response
@POST(".")
- suspend fun getModerators(@HeaderMap headers: Map, @Body json: JsonObject): Response
+ suspend fun getModerators(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): Response
@POST(".")
- suspend fun addModerator(@HeaderMap headers: Map, @Body json: JsonObject): Response
+ suspend fun addModerator(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): Response
@POST(".")
- suspend fun removeModerator(@HeaderMap headers: Map, @Body json: JsonObject): Response
+ suspend fun removeModerator(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): Response
@POST(".")
- suspend fun startRaid(@HeaderMap headers: Map, @Body json: JsonObject): Response
+ suspend fun startRaid(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): Response
@POST(".")
- suspend fun cancelRaid(@HeaderMap headers: Map, @Body json: JsonObject): Response
+ suspend fun cancelRaid(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): Response
@POST(".")
- suspend fun getVips(@HeaderMap headers: Map, @Body json: JsonObject): Response
+ suspend fun getVips(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): Response
@POST(".")
- suspend fun addVip(@HeaderMap headers: Map, @Body json: JsonObject): Response
+ suspend fun addVip(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): Response
@POST(".")
- suspend fun removeVip(@HeaderMap headers: Map, @Body json: JsonObject): Response
+ suspend fun removeVip(
+ @HeaderMap headers: Map,
+ @Body json: JsonObject
+ ): Response
}
\ No newline at end of file
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/api/UsherApi.kt b/app/src/main/java/com/github/andreyasadchy/xtra/api/UsherApi.kt
index e573e57a0..427a7889d 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/api/UsherApi.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/api/UsherApi.kt
@@ -9,8 +9,14 @@ import retrofit2.http.QueryMap
interface UsherApi {
@GET("api/channel/hls/{channel}.m3u8")
- suspend fun getStreamPlaylist(@Path("channel") channel: String?, @QueryMap options: Map): Response
+ suspend fun getStreamPlaylist(
+ @Path("channel") channel: String?,
+ @QueryMap options: Map
+ ): Response
@GET("vod/{id}.m3u8")
- suspend fun getVideoPlaylist(@Path("id") id: String?, @QueryMap options: Map): Response
+ suspend fun getVideoPlaylist(
+ @Path("id") id: String?,
+ @QueryMap options: Map
+ ): Response
}
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/db/AppDatabase.kt b/app/src/main/java/com/github/andreyasadchy/xtra/db/AppDatabase.kt
index 544ef65ca..e3ad6d082 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/db/AppDatabase.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/db/AppDatabase.kt
@@ -14,7 +14,10 @@ import com.github.andreyasadchy.xtra.model.ui.SortChannel
import com.github.andreyasadchy.xtra.model.ui.SortGame
import com.github.andreyasadchy.xtra.model.ui.VodBookmarkIgnoredUser
-@Database(entities = [OfflineVideo::class, RecentEmote::class, VideoPosition::class, LocalFollowChannel::class, LocalFollowGame::class, Bookmark::class, VodBookmarkIgnoredUser::class, SortChannel::class, SortGame::class, ShownNotification::class, NotificationUser::class], version = 28)
+@Database(
+ entities = [OfflineVideo::class, RecentEmote::class, VideoPosition::class, LocalFollowChannel::class, LocalFollowGame::class, Bookmark::class, VodBookmarkIgnoredUser::class, SortChannel::class, SortGame::class, ShownNotification::class, NotificationUser::class],
+ version = 28
+)
abstract class AppDatabase : RoomDatabase() {
abstract fun videos(): VideosDao
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/di/AppInjector.kt b/app/src/main/java/com/github/andreyasadchy/xtra/di/AppInjector.kt
index ab8053f4a..c60c1459a 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/di/AppInjector.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/di/AppInjector.kt
@@ -15,19 +15,21 @@ object AppInjector {
xtraApp.registerActivityLifecycleCallbacks(object : Application.ActivityLifecycleCallbacks {
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
if (activity is FragmentActivity) {
- activity.supportFragmentManager.registerFragmentLifecycleCallbacks(object : FragmentManager.FragmentLifecycleCallbacks() {
- override fun onFragmentCreated(fm: FragmentManager, f: Fragment, savedInstanceState: Bundle?) {
- if (f is LifecycleListener) {
- xtraApp.addLifecycleListener(f)
+ activity.supportFragmentManager.registerFragmentLifecycleCallbacks(
+ object : FragmentManager.FragmentLifecycleCallbacks() {
+ override fun onFragmentCreated(fm: FragmentManager, f: Fragment, savedInstanceState: Bundle?) {
+ if (f is LifecycleListener) {
+ xtraApp.addLifecycleListener(f)
+ }
}
- }
- override fun onFragmentDestroyed(fm: FragmentManager, f: Fragment) {
- if (f is LifecycleListener) {
- xtraApp.removeLifecycleListener(f)
+ override fun onFragmentDestroyed(fm: FragmentManager, f: Fragment) {
+ if (f is LifecycleListener) {
+ xtraApp.removeLifecycleListener(f)
+ }
}
- }
- }, true)
+ }, true
+ )
}
}
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/di/DatabaseModule.kt b/app/src/main/java/com/github/andreyasadchy/xtra/di/DatabaseModule.kt
index 9f464de9e..fdc84cd25 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/di/DatabaseModule.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/di/DatabaseModule.kt
@@ -118,164 +118,164 @@ class DatabaseModule {
@Singleton
@Provides
fun providesAppDatabase(application: Application): AppDatabase =
- Room.databaseBuilder(application, AppDatabase::class.java, "database")
- .addMigrations(
- object : Migration(9, 10) {
- override fun migrate(db: SupportSQLiteDatabase) {
- db.execSQL("DELETE FROM emotes")
- }
- },
- object : Migration(10, 11) {
- override fun migrate(db: SupportSQLiteDatabase) {
- db.execSQL("ALTER TABLE videos ADD COLUMN videoId TEXT DEFAULT null")
- }
- },
- object : Migration(11, 12) {
- override fun migrate(db: SupportSQLiteDatabase) {
- db.execSQL("CREATE TABLE IF NOT EXISTS local_follows_games (game_id TEXT NOT NULL, game_name TEXT, boxArt TEXT, PRIMARY KEY (game_id))")
- }
- },
- object : Migration(12, 13) {
- override fun migrate(db: SupportSQLiteDatabase) {
- db.execSQL("CREATE TABLE IF NOT EXISTS videos1 (url TEXT NOT NULL, source_url TEXT NOT NULL, source_start_position INTEGER, name TEXT, channel_id TEXT, channel_login TEXT, channel_name TEXT, channel_logo TEXT, thumbnail TEXT, gameId TEXT, gameName TEXT, duration INTEGER, upload_date INTEGER, download_date INTEGER NOT NULL, last_watch_position INTEGER, progress INTEGER NOT NULL, max_progress INTEGER NOT NULL, status INTEGER NOT NULL, type TEXT, videoId TEXT, id INTEGER NOT NULL, is_vod INTEGER NOT NULL, PRIMARY KEY (id))")
- db.execSQL("INSERT INTO videos1 (url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, status, type, videoId, id, is_vod) SELECT url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, status, type, videoId, id, is_vod FROM videos")
- db.execSQL("DROP TABLE videos")
- db.execSQL("ALTER TABLE videos1 RENAME TO videos")
- }
- },
- object : Migration(13, 14) {
- override fun migrate(db: SupportSQLiteDatabase) {
- db.execSQL("CREATE TABLE IF NOT EXISTS videos1 (url TEXT NOT NULL, source_url TEXT, source_start_position INTEGER, name TEXT, channel_id TEXT, channel_login TEXT, channel_name TEXT, channel_logo TEXT, thumbnail TEXT, gameId TEXT, gameName TEXT, duration INTEGER, upload_date INTEGER, download_date INTEGER, last_watch_position INTEGER, progress INTEGER NOT NULL, max_progress INTEGER NOT NULL, status INTEGER, type TEXT, videoId TEXT, is_bookmark INTEGER, userType TEXT, id INTEGER NOT NULL, is_vod INTEGER NOT NULL, PRIMARY KEY (id))")
- db.execSQL("INSERT INTO videos1 (url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, status, type, videoId, id, is_vod) SELECT url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, status, type, videoId, id = id, is_vod = is_vod FROM videos")
- db.execSQL("DROP TABLE videos")
- db.execSQL("ALTER TABLE videos1 RENAME TO videos")
- db.execSQL("CREATE TABLE IF NOT EXISTS vod_bookmark_ignored_users (user_id TEXT NOT NULL, PRIMARY KEY (user_id))")
- }
- },
- object : Migration(14, 15) {
- override fun migrate(db: SupportSQLiteDatabase) {
- db.execSQL("CREATE TABLE IF NOT EXISTS videos1 (url TEXT NOT NULL, source_url TEXT, source_start_position INTEGER, name TEXT, channel_id TEXT, channel_login TEXT, channel_name TEXT, channel_logo TEXT, thumbnail TEXT, gameId TEXT, gameName TEXT, duration INTEGER, upload_date INTEGER, download_date INTEGER, last_watch_position INTEGER, progress INTEGER NOT NULL, max_progress INTEGER NOT NULL, status INTEGER NOT NULL, type TEXT, videoId TEXT, id INTEGER NOT NULL, is_vod INTEGER NOT NULL, PRIMARY KEY (id))")
- db.execSQL("INSERT OR IGNORE INTO videos1 (url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, status, type, videoId, id, is_vod) SELECT url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, status, type, videoId, id = id, is_vod = is_vod FROM videos")
- db.execSQL("DROP TABLE videos")
- db.execSQL("ALTER TABLE videos1 RENAME TO videos")
- db.execSQL("CREATE TABLE IF NOT EXISTS bookmarks (id TEXT NOT NULL, userId TEXT, userLogin TEXT, userName TEXT, userLogo TEXT, gameId TEXT, gameName TEXT, title TEXT, createdAt TEXT, thumbnail TEXT, type TEXT, duration TEXT, PRIMARY KEY (id))")
- }
- },
- object : Migration(15, 16) {
- override fun migrate(db: SupportSQLiteDatabase) {
- db.execSQL("ALTER TABLE bookmarks ADD COLUMN userType TEXT DEFAULT null")
- db.execSQL("ALTER TABLE bookmarks ADD COLUMN userBroadcasterType TEXT DEFAULT null")
- }
- },
- object : Migration(16, 17) {
- override fun migrate(db: SupportSQLiteDatabase) {
- db.execSQL("CREATE TABLE IF NOT EXISTS sort_channel (id TEXT NOT NULL, saveSort INTEGER, videoSort TEXT, videoType TEXT, clipPeriod TEXT, PRIMARY KEY (id))")
- db.execSQL("CREATE TABLE IF NOT EXISTS sort_game (id TEXT NOT NULL, saveSort INTEGER, videoSort TEXT, videoPeriod TEXT, videoType TEXT, videoLanguageIndex INTEGER, clipPeriod TEXT, clipLanguageIndex INTEGER, PRIMARY KEY (id))")
- }
- },
- object : Migration(17, 18) {
- override fun migrate(db: SupportSQLiteDatabase) {
- db.execSQL("CREATE TABLE IF NOT EXISTS recent_emotes1 (name TEXT NOT NULL, url1x TEXT, url2x TEXT, url3x TEXT, url4x TEXT, used_at INTEGER NOT NULL, PRIMARY KEY (name))")
- db.execSQL("INSERT INTO recent_emotes1 (name, url1x, used_at) SELECT name, url, used_at FROM recent_emotes")
- db.execSQL("DROP TABLE recent_emotes")
- db.execSQL("ALTER TABLE recent_emotes1 RENAME TO recent_emotes")
- }
- },
- object : Migration(18, 19) {
- override fun migrate(db: SupportSQLiteDatabase) {
- db.execSQL("CREATE TABLE IF NOT EXISTS bookmarks1 (videoId TEXT, userId TEXT, userLogin TEXT, userName TEXT, userType TEXT, userBroadcasterType TEXT, userLogo TEXT, gameId TEXT, gameName TEXT, title TEXT, createdAt TEXT, thumbnail TEXT, type TEXT, duration TEXT, animatedPreviewURL TEXT, id INTEGER NOT NULL, PRIMARY KEY (id))")
- db.execSQL("INSERT INTO bookmarks1 (videoId, userId, userLogin, userName, userType, userBroadcasterType, userLogo, gameId, gameName, title, createdAt, thumbnail, type, duration) SELECT id, userId, userLogin, userName, userType, userBroadcasterType, userLogo, gameId, gameName, title, createdAt, thumbnail, type, duration FROM bookmarks")
- db.execSQL("DROP TABLE bookmarks")
- db.execSQL("ALTER TABLE bookmarks1 RENAME TO bookmarks")
- db.execSQL("CREATE TABLE IF NOT EXISTS local_follows1 (userId TEXT, userLogin TEXT, userName TEXT, channelLogo TEXT, id INTEGER NOT NULL, PRIMARY KEY (id))")
- db.execSQL("INSERT INTO local_follows1 (userId, userLogin, userName, channelLogo) SELECT user_id, user_login, user_name, channelLogo FROM local_follows")
- db.execSQL("DROP TABLE local_follows")
- db.execSQL("ALTER TABLE local_follows1 RENAME TO local_follows")
- db.execSQL("CREATE TABLE IF NOT EXISTS local_follows_games1 (gameId TEXT, gameName TEXT, boxArt TEXT, id INTEGER NOT NULL, PRIMARY KEY (id))")
- db.execSQL("INSERT INTO local_follows_games1 (gameId, gameName, boxArt) SELECT game_id, game_name, boxArt FROM local_follows_games")
- db.execSQL("DROP TABLE local_follows_games")
- db.execSQL("ALTER TABLE local_follows_games1 RENAME TO local_follows_games")
- db.execSQL("CREATE TABLE IF NOT EXISTS requests1 (offline_video_id INTEGER NOT NULL, url TEXT NOT NULL, path TEXT NOT NULL, video_id TEXT, video_type TEXT, segment_from INTEGER, segment_to INTEGER, PRIMARY KEY (offline_video_id), FOREIGN KEY('offline_video_id') REFERENCES videos('id') ON DELETE CASCADE)")
- db.execSQL("INSERT INTO requests1 (offline_video_id, url, path, video_id, segment_from, segment_to) SELECT offline_video_id, url, path, video_id, segment_from, segment_to FROM requests")
- db.execSQL("DROP TABLE requests")
- db.execSQL("ALTER TABLE requests1 RENAME TO requests")
- }
- },
- object : Migration(19, 20) {
- override fun migrate(db: SupportSQLiteDatabase) {
- db.execSQL("CREATE TABLE IF NOT EXISTS recent_emotes1 (name TEXT NOT NULL, used_at INTEGER NOT NULL, PRIMARY KEY (name))")
- db.execSQL("INSERT INTO recent_emotes1 (name, used_at) SELECT name, used_at FROM recent_emotes")
- db.execSQL("DROP TABLE recent_emotes")
- db.execSQL("ALTER TABLE recent_emotes1 RENAME TO recent_emotes")
- }
- },
- object : Migration(20, 21) {
- override fun migrate(db: SupportSQLiteDatabase) {
- db.execSQL("CREATE TABLE IF NOT EXISTS requests1 (offline_video_id INTEGER NOT NULL, url TEXT NOT NULL, path TEXT NOT NULL, PRIMARY KEY (offline_video_id), FOREIGN KEY('offline_video_id') REFERENCES videos('id') ON DELETE CASCADE)")
- db.execSQL("INSERT INTO requests1 (offline_video_id, url, path) SELECT offline_video_id, url, path FROM requests")
- db.execSQL("DROP TABLE requests")
- db.execSQL("ALTER TABLE requests1 RENAME TO requests")
- }
- },
- object : Migration(21, 22) {
- override fun migrate(db: SupportSQLiteDatabase) {
- db.execSQL("CREATE TABLE IF NOT EXISTS videos1 (url TEXT NOT NULL, source_url TEXT, source_start_position INTEGER, name TEXT, channel_id TEXT, channel_login TEXT, channel_name TEXT, channel_logo TEXT, thumbnail TEXT, gameId TEXT, gameSlug TEXT, gameName TEXT, duration INTEGER, upload_date INTEGER, download_date INTEGER, last_watch_position INTEGER, progress INTEGER NOT NULL, max_progress INTEGER NOT NULL, status INTEGER NOT NULL, type TEXT, videoId TEXT, id INTEGER NOT NULL, is_vod INTEGER NOT NULL, PRIMARY KEY (id))")
- db.execSQL("INSERT INTO videos1 (url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, status, type, videoId, id, is_vod) SELECT url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, status, type, videoId, id, is_vod FROM videos")
- db.execSQL("DROP TABLE videos")
- db.execSQL("ALTER TABLE videos1 RENAME TO videos")
- db.execSQL("CREATE TABLE IF NOT EXISTS bookmarks1 (videoId TEXT, userId TEXT, userLogin TEXT, userName TEXT, userType TEXT, userBroadcasterType TEXT, userLogo TEXT, gameId TEXT, gameSlug TEXT, gameName TEXT, title TEXT, createdAt TEXT, thumbnail TEXT, type TEXT, duration TEXT, animatedPreviewURL TEXT, id INTEGER NOT NULL, PRIMARY KEY (id))")
- db.execSQL("INSERT INTO bookmarks1 (videoId, userId, userLogin, userName, userType, userBroadcasterType, userLogo, gameId, gameName, title, createdAt, thumbnail, type, duration, animatedPreviewURL, id) SELECT videoId, userId, userLogin, userName, userType, userBroadcasterType, userLogo, gameId, gameName, title, createdAt, thumbnail, type, duration, animatedPreviewURL, id FROM bookmarks")
- db.execSQL("DROP TABLE bookmarks")
- db.execSQL("ALTER TABLE bookmarks1 RENAME TO bookmarks")
- db.execSQL("CREATE TABLE IF NOT EXISTS local_follows_games1 (gameId TEXT, gameSlug TEXT, gameName TEXT, boxArt TEXT, id INTEGER NOT NULL, PRIMARY KEY (id))")
- db.execSQL("INSERT INTO local_follows_games1 (gameId, gameName, boxArt, id) SELECT gameId, gameName, boxArt, id FROM local_follows_games")
- db.execSQL("DROP TABLE local_follows_games")
- db.execSQL("ALTER TABLE local_follows_games1 RENAME TO local_follows_games")
- }
- },
- object : Migration(22, 23) {
- override fun migrate(db: SupportSQLiteDatabase) {
- db.execSQL("CREATE TABLE IF NOT EXISTS videos1 (url TEXT NOT NULL, source_url TEXT, source_start_position INTEGER, name TEXT, channel_id TEXT, channel_login TEXT, channel_name TEXT, channel_logo TEXT, thumbnail TEXT, gameId TEXT, gameSlug TEXT, gameName TEXT, duration INTEGER, upload_date INTEGER, download_date INTEGER, last_watch_position INTEGER, progress INTEGER NOT NULL, max_progress INTEGER NOT NULL, downloadPath TEXT, fromTime INTEGER, toTime INTEGER, status INTEGER NOT NULL, type TEXT, videoId TEXT, quality TEXT, id INTEGER NOT NULL, is_vod INTEGER NOT NULL, PRIMARY KEY (id))")
- db.execSQL("INSERT INTO videos1 (url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameSlug, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, status, type, videoId, id, is_vod) SELECT url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameSlug, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, status, type, videoId, id, is_vod FROM videos")
- db.execSQL("DROP TABLE videos")
- db.execSQL("ALTER TABLE videos1 RENAME TO videos")
- }
- },
- object : Migration(23, 24) {
- override fun migrate(db: SupportSQLiteDatabase) {
- db.execSQL("CREATE TABLE IF NOT EXISTS videos1 (url TEXT NOT NULL, source_url TEXT, source_start_position INTEGER, name TEXT, channel_id TEXT, channel_login TEXT, channel_name TEXT, channel_logo TEXT, thumbnail TEXT, gameId TEXT, gameSlug TEXT, gameName TEXT, duration INTEGER, upload_date INTEGER, download_date INTEGER, last_watch_position INTEGER, progress INTEGER NOT NULL, max_progress INTEGER NOT NULL, downloadPath TEXT, fromTime INTEGER, toTime INTEGER, status INTEGER NOT NULL, type TEXT, videoId TEXT, quality TEXT, downloadChat INTEGER, downloadChatEmotes INTEGER, chatProgress INTEGER, chatUrl TEXT, id INTEGER NOT NULL, is_vod INTEGER NOT NULL, PRIMARY KEY (id))")
- db.execSQL("INSERT INTO videos1 (url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameSlug, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, downloadPath, fromTime, toTime, status, type, videoId, quality, id, is_vod) SELECT url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameSlug, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, downloadPath, fromTime, toTime, status, type, videoId, quality, id, is_vod FROM videos")
- db.execSQL("DROP TABLE videos")
- db.execSQL("ALTER TABLE videos1 RENAME TO videos")
- }
- },
- object : Migration(24, 25) {
- override fun migrate(db: SupportSQLiteDatabase) {
- db.execSQL("DROP TABLE requests")
- db.execSQL("CREATE TABLE IF NOT EXISTS videos1 (url TEXT, source_url TEXT, source_start_position INTEGER, name TEXT, channel_id TEXT, channel_login TEXT, channel_name TEXT, channel_logo TEXT, thumbnail TEXT, gameId TEXT, gameSlug TEXT, gameName TEXT, duration INTEGER, upload_date INTEGER, download_date INTEGER, last_watch_position INTEGER, progress INTEGER NOT NULL, max_progress INTEGER NOT NULL, bytes INTEGER NOT NULL, downloadPath TEXT, fromTime INTEGER, toTime INTEGER, status INTEGER NOT NULL, type TEXT, videoId TEXT, clipId TEXT, quality TEXT, downloadChat INTEGER NOT NULL, downloadChatEmotes INTEGER NOT NULL, chatProgress INTEGER NOT NULL, maxChatProgress INTEGER NOT NULL, chatBytes INTEGER NOT NULL, chatOffsetSeconds INTEGER NOT NULL, chatUrl TEXT, playlistToFile INTEGER NOT NULL, id INTEGER NOT NULL, PRIMARY KEY (id))")
- db.execSQL("INSERT INTO videos1 (url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameSlug, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, bytes, downloadPath, fromTime, toTime, status, type, videoId, quality, downloadChat, downloadChatEmotes, chatProgress, maxChatProgress, chatBytes, chatOffsetSeconds, chatUrl, playlistToFile, id) SELECT url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameSlug, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, 0, downloadPath, fromTime, toTime, status, type, videoId, quality, 0, 0, 0, 100, 0, 0, chatUrl, 0, id FROM videos")
- db.execSQL("DROP TABLE videos")
- db.execSQL("ALTER TABLE videos1 RENAME TO videos")
- }
- },
- object : Migration(25, 26) {
- override fun migrate(db: SupportSQLiteDatabase) {
- db.execSQL("CREATE TABLE IF NOT EXISTS videos1 (url TEXT, source_url TEXT, source_start_position INTEGER, name TEXT, channel_id TEXT, channel_login TEXT, channel_name TEXT, channel_logo TEXT, thumbnail TEXT, gameId TEXT, gameSlug TEXT, gameName TEXT, duration INTEGER, upload_date INTEGER, download_date INTEGER, last_watch_position INTEGER, progress INTEGER NOT NULL, max_progress INTEGER NOT NULL, bytes INTEGER NOT NULL, downloadPath TEXT, fromTime INTEGER, toTime INTEGER, status INTEGER NOT NULL, type TEXT, videoId TEXT, clipId TEXT, quality TEXT, downloadChat INTEGER NOT NULL, downloadChatEmotes INTEGER NOT NULL, chatProgress INTEGER NOT NULL, maxChatProgress INTEGER NOT NULL, chatBytes INTEGER NOT NULL, chatOffsetSeconds INTEGER NOT NULL, chatUrl TEXT, playlistToFile INTEGER NOT NULL, live INTEGER NOT NULL, lastSegmentUrl TEXT, id INTEGER NOT NULL, PRIMARY KEY (id))")
- db.execSQL("INSERT INTO videos1 (url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameSlug, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, bytes, downloadPath, fromTime, toTime, status, type, videoId, quality, downloadChat, downloadChatEmotes, chatProgress, maxChatProgress, chatBytes, chatOffsetSeconds, chatUrl, playlistToFile, live, id) SELECT url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameSlug, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, max_progress, downloadPath, fromTime, toTime, status, type, videoId, quality, downloadChat, downloadChatEmotes, chatProgress, maxChatProgress, chatBytes, chatOffsetSeconds, chatUrl, playlistToFile, 0, id FROM videos")
- db.execSQL("DROP TABLE videos")
- db.execSQL("ALTER TABLE videos1 RENAME TO videos")
- }
- },
- object : Migration(26, 27) {
- override fun migrate(db: SupportSQLiteDatabase) {
- db.execSQL("CREATE TABLE IF NOT EXISTS shown_notifications (channelId TEXT NOT NULL, startedAt INTEGER NOT NULL, PRIMARY KEY (channelId))")
- }
- },
- object : Migration(27, 28) {
- override fun migrate(db: SupportSQLiteDatabase) {
- db.execSQL("CREATE TABLE IF NOT EXISTS notifications (channelId TEXT NOT NULL, PRIMARY KEY (channelId))")
- }
- },
- )
- .build()
+ Room.databaseBuilder(application, AppDatabase::class.java, "database")
+ .addMigrations(
+ object : Migration(9, 10) {
+ override fun migrate(db: SupportSQLiteDatabase) {
+ db.execSQL("DELETE FROM emotes")
+ }
+ },
+ object : Migration(10, 11) {
+ override fun migrate(db: SupportSQLiteDatabase) {
+ db.execSQL("ALTER TABLE videos ADD COLUMN videoId TEXT DEFAULT null")
+ }
+ },
+ object : Migration(11, 12) {
+ override fun migrate(db: SupportSQLiteDatabase) {
+ db.execSQL("CREATE TABLE IF NOT EXISTS local_follows_games (game_id TEXT NOT NULL, game_name TEXT, boxArt TEXT, PRIMARY KEY (game_id))")
+ }
+ },
+ object : Migration(12, 13) {
+ override fun migrate(db: SupportSQLiteDatabase) {
+ db.execSQL("CREATE TABLE IF NOT EXISTS videos1 (url TEXT NOT NULL, source_url TEXT NOT NULL, source_start_position INTEGER, name TEXT, channel_id TEXT, channel_login TEXT, channel_name TEXT, channel_logo TEXT, thumbnail TEXT, gameId TEXT, gameName TEXT, duration INTEGER, upload_date INTEGER, download_date INTEGER NOT NULL, last_watch_position INTEGER, progress INTEGER NOT NULL, max_progress INTEGER NOT NULL, status INTEGER NOT NULL, type TEXT, videoId TEXT, id INTEGER NOT NULL, is_vod INTEGER NOT NULL, PRIMARY KEY (id))")
+ db.execSQL("INSERT INTO videos1 (url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, status, type, videoId, id, is_vod) SELECT url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, status, type, videoId, id, is_vod FROM videos")
+ db.execSQL("DROP TABLE videos")
+ db.execSQL("ALTER TABLE videos1 RENAME TO videos")
+ }
+ },
+ object : Migration(13, 14) {
+ override fun migrate(db: SupportSQLiteDatabase) {
+ db.execSQL("CREATE TABLE IF NOT EXISTS videos1 (url TEXT NOT NULL, source_url TEXT, source_start_position INTEGER, name TEXT, channel_id TEXT, channel_login TEXT, channel_name TEXT, channel_logo TEXT, thumbnail TEXT, gameId TEXT, gameName TEXT, duration INTEGER, upload_date INTEGER, download_date INTEGER, last_watch_position INTEGER, progress INTEGER NOT NULL, max_progress INTEGER NOT NULL, status INTEGER, type TEXT, videoId TEXT, is_bookmark INTEGER, userType TEXT, id INTEGER NOT NULL, is_vod INTEGER NOT NULL, PRIMARY KEY (id))")
+ db.execSQL("INSERT INTO videos1 (url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, status, type, videoId, id, is_vod) SELECT url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, status, type, videoId, id = id, is_vod = is_vod FROM videos")
+ db.execSQL("DROP TABLE videos")
+ db.execSQL("ALTER TABLE videos1 RENAME TO videos")
+ db.execSQL("CREATE TABLE IF NOT EXISTS vod_bookmark_ignored_users (user_id TEXT NOT NULL, PRIMARY KEY (user_id))")
+ }
+ },
+ object : Migration(14, 15) {
+ override fun migrate(db: SupportSQLiteDatabase) {
+ db.execSQL("CREATE TABLE IF NOT EXISTS videos1 (url TEXT NOT NULL, source_url TEXT, source_start_position INTEGER, name TEXT, channel_id TEXT, channel_login TEXT, channel_name TEXT, channel_logo TEXT, thumbnail TEXT, gameId TEXT, gameName TEXT, duration INTEGER, upload_date INTEGER, download_date INTEGER, last_watch_position INTEGER, progress INTEGER NOT NULL, max_progress INTEGER NOT NULL, status INTEGER NOT NULL, type TEXT, videoId TEXT, id INTEGER NOT NULL, is_vod INTEGER NOT NULL, PRIMARY KEY (id))")
+ db.execSQL("INSERT OR IGNORE INTO videos1 (url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, status, type, videoId, id, is_vod) SELECT url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, status, type, videoId, id = id, is_vod = is_vod FROM videos")
+ db.execSQL("DROP TABLE videos")
+ db.execSQL("ALTER TABLE videos1 RENAME TO videos")
+ db.execSQL("CREATE TABLE IF NOT EXISTS bookmarks (id TEXT NOT NULL, userId TEXT, userLogin TEXT, userName TEXT, userLogo TEXT, gameId TEXT, gameName TEXT, title TEXT, createdAt TEXT, thumbnail TEXT, type TEXT, duration TEXT, PRIMARY KEY (id))")
+ }
+ },
+ object : Migration(15, 16) {
+ override fun migrate(db: SupportSQLiteDatabase) {
+ db.execSQL("ALTER TABLE bookmarks ADD COLUMN userType TEXT DEFAULT null")
+ db.execSQL("ALTER TABLE bookmarks ADD COLUMN userBroadcasterType TEXT DEFAULT null")
+ }
+ },
+ object : Migration(16, 17) {
+ override fun migrate(db: SupportSQLiteDatabase) {
+ db.execSQL("CREATE TABLE IF NOT EXISTS sort_channel (id TEXT NOT NULL, saveSort INTEGER, videoSort TEXT, videoType TEXT, clipPeriod TEXT, PRIMARY KEY (id))")
+ db.execSQL("CREATE TABLE IF NOT EXISTS sort_game (id TEXT NOT NULL, saveSort INTEGER, videoSort TEXT, videoPeriod TEXT, videoType TEXT, videoLanguageIndex INTEGER, clipPeriod TEXT, clipLanguageIndex INTEGER, PRIMARY KEY (id))")
+ }
+ },
+ object : Migration(17, 18) {
+ override fun migrate(db: SupportSQLiteDatabase) {
+ db.execSQL("CREATE TABLE IF NOT EXISTS recent_emotes1 (name TEXT NOT NULL, url1x TEXT, url2x TEXT, url3x TEXT, url4x TEXT, used_at INTEGER NOT NULL, PRIMARY KEY (name))")
+ db.execSQL("INSERT INTO recent_emotes1 (name, url1x, used_at) SELECT name, url, used_at FROM recent_emotes")
+ db.execSQL("DROP TABLE recent_emotes")
+ db.execSQL("ALTER TABLE recent_emotes1 RENAME TO recent_emotes")
+ }
+ },
+ object : Migration(18, 19) {
+ override fun migrate(db: SupportSQLiteDatabase) {
+ db.execSQL("CREATE TABLE IF NOT EXISTS bookmarks1 (videoId TEXT, userId TEXT, userLogin TEXT, userName TEXT, userType TEXT, userBroadcasterType TEXT, userLogo TEXT, gameId TEXT, gameName TEXT, title TEXT, createdAt TEXT, thumbnail TEXT, type TEXT, duration TEXT, animatedPreviewURL TEXT, id INTEGER NOT NULL, PRIMARY KEY (id))")
+ db.execSQL("INSERT INTO bookmarks1 (videoId, userId, userLogin, userName, userType, userBroadcasterType, userLogo, gameId, gameName, title, createdAt, thumbnail, type, duration) SELECT id, userId, userLogin, userName, userType, userBroadcasterType, userLogo, gameId, gameName, title, createdAt, thumbnail, type, duration FROM bookmarks")
+ db.execSQL("DROP TABLE bookmarks")
+ db.execSQL("ALTER TABLE bookmarks1 RENAME TO bookmarks")
+ db.execSQL("CREATE TABLE IF NOT EXISTS local_follows1 (userId TEXT, userLogin TEXT, userName TEXT, channelLogo TEXT, id INTEGER NOT NULL, PRIMARY KEY (id))")
+ db.execSQL("INSERT INTO local_follows1 (userId, userLogin, userName, channelLogo) SELECT user_id, user_login, user_name, channelLogo FROM local_follows")
+ db.execSQL("DROP TABLE local_follows")
+ db.execSQL("ALTER TABLE local_follows1 RENAME TO local_follows")
+ db.execSQL("CREATE TABLE IF NOT EXISTS local_follows_games1 (gameId TEXT, gameName TEXT, boxArt TEXT, id INTEGER NOT NULL, PRIMARY KEY (id))")
+ db.execSQL("INSERT INTO local_follows_games1 (gameId, gameName, boxArt) SELECT game_id, game_name, boxArt FROM local_follows_games")
+ db.execSQL("DROP TABLE local_follows_games")
+ db.execSQL("ALTER TABLE local_follows_games1 RENAME TO local_follows_games")
+ db.execSQL("CREATE TABLE IF NOT EXISTS requests1 (offline_video_id INTEGER NOT NULL, url TEXT NOT NULL, path TEXT NOT NULL, video_id TEXT, video_type TEXT, segment_from INTEGER, segment_to INTEGER, PRIMARY KEY (offline_video_id), FOREIGN KEY('offline_video_id') REFERENCES videos('id') ON DELETE CASCADE)")
+ db.execSQL("INSERT INTO requests1 (offline_video_id, url, path, video_id, segment_from, segment_to) SELECT offline_video_id, url, path, video_id, segment_from, segment_to FROM requests")
+ db.execSQL("DROP TABLE requests")
+ db.execSQL("ALTER TABLE requests1 RENAME TO requests")
+ }
+ },
+ object : Migration(19, 20) {
+ override fun migrate(db: SupportSQLiteDatabase) {
+ db.execSQL("CREATE TABLE IF NOT EXISTS recent_emotes1 (name TEXT NOT NULL, used_at INTEGER NOT NULL, PRIMARY KEY (name))")
+ db.execSQL("INSERT INTO recent_emotes1 (name, used_at) SELECT name, used_at FROM recent_emotes")
+ db.execSQL("DROP TABLE recent_emotes")
+ db.execSQL("ALTER TABLE recent_emotes1 RENAME TO recent_emotes")
+ }
+ },
+ object : Migration(20, 21) {
+ override fun migrate(db: SupportSQLiteDatabase) {
+ db.execSQL("CREATE TABLE IF NOT EXISTS requests1 (offline_video_id INTEGER NOT NULL, url TEXT NOT NULL, path TEXT NOT NULL, PRIMARY KEY (offline_video_id), FOREIGN KEY('offline_video_id') REFERENCES videos('id') ON DELETE CASCADE)")
+ db.execSQL("INSERT INTO requests1 (offline_video_id, url, path) SELECT offline_video_id, url, path FROM requests")
+ db.execSQL("DROP TABLE requests")
+ db.execSQL("ALTER TABLE requests1 RENAME TO requests")
+ }
+ },
+ object : Migration(21, 22) {
+ override fun migrate(db: SupportSQLiteDatabase) {
+ db.execSQL("CREATE TABLE IF NOT EXISTS videos1 (url TEXT NOT NULL, source_url TEXT, source_start_position INTEGER, name TEXT, channel_id TEXT, channel_login TEXT, channel_name TEXT, channel_logo TEXT, thumbnail TEXT, gameId TEXT, gameSlug TEXT, gameName TEXT, duration INTEGER, upload_date INTEGER, download_date INTEGER, last_watch_position INTEGER, progress INTEGER NOT NULL, max_progress INTEGER NOT NULL, status INTEGER NOT NULL, type TEXT, videoId TEXT, id INTEGER NOT NULL, is_vod INTEGER NOT NULL, PRIMARY KEY (id))")
+ db.execSQL("INSERT INTO videos1 (url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, status, type, videoId, id, is_vod) SELECT url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, status, type, videoId, id, is_vod FROM videos")
+ db.execSQL("DROP TABLE videos")
+ db.execSQL("ALTER TABLE videos1 RENAME TO videos")
+ db.execSQL("CREATE TABLE IF NOT EXISTS bookmarks1 (videoId TEXT, userId TEXT, userLogin TEXT, userName TEXT, userType TEXT, userBroadcasterType TEXT, userLogo TEXT, gameId TEXT, gameSlug TEXT, gameName TEXT, title TEXT, createdAt TEXT, thumbnail TEXT, type TEXT, duration TEXT, animatedPreviewURL TEXT, id INTEGER NOT NULL, PRIMARY KEY (id))")
+ db.execSQL("INSERT INTO bookmarks1 (videoId, userId, userLogin, userName, userType, userBroadcasterType, userLogo, gameId, gameName, title, createdAt, thumbnail, type, duration, animatedPreviewURL, id) SELECT videoId, userId, userLogin, userName, userType, userBroadcasterType, userLogo, gameId, gameName, title, createdAt, thumbnail, type, duration, animatedPreviewURL, id FROM bookmarks")
+ db.execSQL("DROP TABLE bookmarks")
+ db.execSQL("ALTER TABLE bookmarks1 RENAME TO bookmarks")
+ db.execSQL("CREATE TABLE IF NOT EXISTS local_follows_games1 (gameId TEXT, gameSlug TEXT, gameName TEXT, boxArt TEXT, id INTEGER NOT NULL, PRIMARY KEY (id))")
+ db.execSQL("INSERT INTO local_follows_games1 (gameId, gameName, boxArt, id) SELECT gameId, gameName, boxArt, id FROM local_follows_games")
+ db.execSQL("DROP TABLE local_follows_games")
+ db.execSQL("ALTER TABLE local_follows_games1 RENAME TO local_follows_games")
+ }
+ },
+ object : Migration(22, 23) {
+ override fun migrate(db: SupportSQLiteDatabase) {
+ db.execSQL("CREATE TABLE IF NOT EXISTS videos1 (url TEXT NOT NULL, source_url TEXT, source_start_position INTEGER, name TEXT, channel_id TEXT, channel_login TEXT, channel_name TEXT, channel_logo TEXT, thumbnail TEXT, gameId TEXT, gameSlug TEXT, gameName TEXT, duration INTEGER, upload_date INTEGER, download_date INTEGER, last_watch_position INTEGER, progress INTEGER NOT NULL, max_progress INTEGER NOT NULL, downloadPath TEXT, fromTime INTEGER, toTime INTEGER, status INTEGER NOT NULL, type TEXT, videoId TEXT, quality TEXT, id INTEGER NOT NULL, is_vod INTEGER NOT NULL, PRIMARY KEY (id))")
+ db.execSQL("INSERT INTO videos1 (url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameSlug, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, status, type, videoId, id, is_vod) SELECT url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameSlug, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, status, type, videoId, id, is_vod FROM videos")
+ db.execSQL("DROP TABLE videos")
+ db.execSQL("ALTER TABLE videos1 RENAME TO videos")
+ }
+ },
+ object : Migration(23, 24) {
+ override fun migrate(db: SupportSQLiteDatabase) {
+ db.execSQL("CREATE TABLE IF NOT EXISTS videos1 (url TEXT NOT NULL, source_url TEXT, source_start_position INTEGER, name TEXT, channel_id TEXT, channel_login TEXT, channel_name TEXT, channel_logo TEXT, thumbnail TEXT, gameId TEXT, gameSlug TEXT, gameName TEXT, duration INTEGER, upload_date INTEGER, download_date INTEGER, last_watch_position INTEGER, progress INTEGER NOT NULL, max_progress INTEGER NOT NULL, downloadPath TEXT, fromTime INTEGER, toTime INTEGER, status INTEGER NOT NULL, type TEXT, videoId TEXT, quality TEXT, downloadChat INTEGER, downloadChatEmotes INTEGER, chatProgress INTEGER, chatUrl TEXT, id INTEGER NOT NULL, is_vod INTEGER NOT NULL, PRIMARY KEY (id))")
+ db.execSQL("INSERT INTO videos1 (url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameSlug, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, downloadPath, fromTime, toTime, status, type, videoId, quality, id, is_vod) SELECT url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameSlug, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, downloadPath, fromTime, toTime, status, type, videoId, quality, id, is_vod FROM videos")
+ db.execSQL("DROP TABLE videos")
+ db.execSQL("ALTER TABLE videos1 RENAME TO videos")
+ }
+ },
+ object : Migration(24, 25) {
+ override fun migrate(db: SupportSQLiteDatabase) {
+ db.execSQL("DROP TABLE requests")
+ db.execSQL("CREATE TABLE IF NOT EXISTS videos1 (url TEXT, source_url TEXT, source_start_position INTEGER, name TEXT, channel_id TEXT, channel_login TEXT, channel_name TEXT, channel_logo TEXT, thumbnail TEXT, gameId TEXT, gameSlug TEXT, gameName TEXT, duration INTEGER, upload_date INTEGER, download_date INTEGER, last_watch_position INTEGER, progress INTEGER NOT NULL, max_progress INTEGER NOT NULL, bytes INTEGER NOT NULL, downloadPath TEXT, fromTime INTEGER, toTime INTEGER, status INTEGER NOT NULL, type TEXT, videoId TEXT, clipId TEXT, quality TEXT, downloadChat INTEGER NOT NULL, downloadChatEmotes INTEGER NOT NULL, chatProgress INTEGER NOT NULL, maxChatProgress INTEGER NOT NULL, chatBytes INTEGER NOT NULL, chatOffsetSeconds INTEGER NOT NULL, chatUrl TEXT, playlistToFile INTEGER NOT NULL, id INTEGER NOT NULL, PRIMARY KEY (id))")
+ db.execSQL("INSERT INTO videos1 (url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameSlug, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, bytes, downloadPath, fromTime, toTime, status, type, videoId, quality, downloadChat, downloadChatEmotes, chatProgress, maxChatProgress, chatBytes, chatOffsetSeconds, chatUrl, playlistToFile, id) SELECT url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameSlug, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, 0, downloadPath, fromTime, toTime, status, type, videoId, quality, 0, 0, 0, 100, 0, 0, chatUrl, 0, id FROM videos")
+ db.execSQL("DROP TABLE videos")
+ db.execSQL("ALTER TABLE videos1 RENAME TO videos")
+ }
+ },
+ object : Migration(25, 26) {
+ override fun migrate(db: SupportSQLiteDatabase) {
+ db.execSQL("CREATE TABLE IF NOT EXISTS videos1 (url TEXT, source_url TEXT, source_start_position INTEGER, name TEXT, channel_id TEXT, channel_login TEXT, channel_name TEXT, channel_logo TEXT, thumbnail TEXT, gameId TEXT, gameSlug TEXT, gameName TEXT, duration INTEGER, upload_date INTEGER, download_date INTEGER, last_watch_position INTEGER, progress INTEGER NOT NULL, max_progress INTEGER NOT NULL, bytes INTEGER NOT NULL, downloadPath TEXT, fromTime INTEGER, toTime INTEGER, status INTEGER NOT NULL, type TEXT, videoId TEXT, clipId TEXT, quality TEXT, downloadChat INTEGER NOT NULL, downloadChatEmotes INTEGER NOT NULL, chatProgress INTEGER NOT NULL, maxChatProgress INTEGER NOT NULL, chatBytes INTEGER NOT NULL, chatOffsetSeconds INTEGER NOT NULL, chatUrl TEXT, playlistToFile INTEGER NOT NULL, live INTEGER NOT NULL, lastSegmentUrl TEXT, id INTEGER NOT NULL, PRIMARY KEY (id))")
+ db.execSQL("INSERT INTO videos1 (url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameSlug, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, bytes, downloadPath, fromTime, toTime, status, type, videoId, quality, downloadChat, downloadChatEmotes, chatProgress, maxChatProgress, chatBytes, chatOffsetSeconds, chatUrl, playlistToFile, live, id) SELECT url, source_url, source_start_position, name, channel_id, channel_login, channel_name, channel_logo, thumbnail, gameId, gameSlug, gameName, duration, upload_date, download_date, last_watch_position, progress, max_progress, max_progress, downloadPath, fromTime, toTime, status, type, videoId, quality, downloadChat, downloadChatEmotes, chatProgress, maxChatProgress, chatBytes, chatOffsetSeconds, chatUrl, playlistToFile, 0, id FROM videos")
+ db.execSQL("DROP TABLE videos")
+ db.execSQL("ALTER TABLE videos1 RENAME TO videos")
+ }
+ },
+ object : Migration(26, 27) {
+ override fun migrate(db: SupportSQLiteDatabase) {
+ db.execSQL("CREATE TABLE IF NOT EXISTS shown_notifications (channelId TEXT NOT NULL, startedAt INTEGER NOT NULL, PRIMARY KEY (channelId))")
+ }
+ },
+ object : Migration(27, 28) {
+ override fun migrate(db: SupportSQLiteDatabase) {
+ db.execSQL("CREATE TABLE IF NOT EXISTS notifications (channelId TEXT NOT NULL, PRIMARY KEY (channelId))")
+ }
+ },
+ )
+ .build()
}
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/di/XtraModule.kt b/app/src/main/java/com/github/andreyasadchy/xtra/di/XtraModule.kt
index 7d95ba15a..222d2e49c 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/di/XtraModule.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/di/XtraModule.kt
@@ -46,55 +46,55 @@ class XtraModule {
@Provides
fun providesHelixApi(client: OkHttpClient, jsonConverterFactory: Converter.Factory): HelixApi {
return Retrofit.Builder()
- .baseUrl("https://api.twitch.tv/helix/")
- .client(client)
- .addConverterFactory(jsonConverterFactory)
- .build()
- .create(HelixApi::class.java)
+ .baseUrl("https://api.twitch.tv/helix/")
+ .client(client)
+ .addConverterFactory(jsonConverterFactory)
+ .build()
+ .create(HelixApi::class.java)
}
@Singleton
@Provides
fun providesUsherApi(client: OkHttpClient, jsonConverterFactory: Converter.Factory): UsherApi {
return Retrofit.Builder()
- .baseUrl("https://usher.ttvnw.net/")
- .client(client)
- .addConverterFactory(jsonConverterFactory)
- .build()
- .create(UsherApi::class.java)
+ .baseUrl("https://usher.ttvnw.net/")
+ .client(client)
+ .addConverterFactory(jsonConverterFactory)
+ .build()
+ .create(UsherApi::class.java)
}
@Singleton
@Provides
fun providesMiscApi(client: OkHttpClient, jsonConverterFactory: Converter.Factory): MiscApi {
return Retrofit.Builder()
- .baseUrl("https://api.twitch.tv/") //placeholder url
- .client(client)
- .addConverterFactory(jsonConverterFactory)
- .build()
- .create(MiscApi::class.java)
+ .baseUrl("https://api.twitch.tv/") //placeholder url
+ .client(client)
+ .addConverterFactory(jsonConverterFactory)
+ .build()
+ .create(MiscApi::class.java)
}
@Singleton
@Provides
fun providesIdApi(client: OkHttpClient, jsonConverterFactory: Converter.Factory): IdApi {
return Retrofit.Builder()
- .baseUrl("https://id.twitch.tv/oauth2/")
- .client(client)
- .addConverterFactory(jsonConverterFactory)
- .build()
- .create(IdApi::class.java)
+ .baseUrl("https://id.twitch.tv/oauth2/")
+ .client(client)
+ .addConverterFactory(jsonConverterFactory)
+ .build()
+ .create(IdApi::class.java)
}
@Singleton
@Provides
fun providesGraphQLApi(client: OkHttpClient, jsonConverterFactory: Converter.Factory): GraphQLApi {
return Retrofit.Builder()
- .baseUrl("https://gql.twitch.tv/gql/")
- .client(client)
- .addConverterFactory(jsonConverterFactory)
- .build()
- .create(GraphQLApi::class.java)
+ .baseUrl("https://gql.twitch.tv/gql/")
+ .client(client)
+ .addConverterFactory(jsonConverterFactory)
+ .build()
+ .create(GraphQLApi::class.java)
}
@Singleton
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/NotificationUser.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/NotificationUser.kt
index 12b0606f7..fbbd1b9d9 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/NotificationUser.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/NotificationUser.kt
@@ -6,4 +6,5 @@ import androidx.room.PrimaryKey
@Entity(tableName = "notifications")
class NotificationUser(
@PrimaryKey
- val channelId: String)
\ No newline at end of file
+ val channelId: String,
+)
\ No newline at end of file
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/ShownNotification.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/ShownNotification.kt
index 84937a414..7e3e075f9 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/ShownNotification.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/ShownNotification.kt
@@ -7,4 +7,5 @@ import androidx.room.PrimaryKey
class ShownNotification(
@PrimaryKey
val channelId: String,
- val startedAt: Long)
\ No newline at end of file
+ val startedAt: Long,
+)
\ No newline at end of file
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/VideoPosition.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/VideoPosition.kt
index e7e7d447b..b640c1b7a 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/VideoPosition.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/VideoPosition.kt
@@ -7,4 +7,5 @@ import androidx.room.PrimaryKey
class VideoPosition(
@PrimaryKey
val id: Long,
- val position: Long)
\ No newline at end of file
+ val position: Long,
+)
\ No newline at end of file
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/Badge.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/Badge.kt
index 0629f994c..32313d5a1 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/Badge.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/Badge.kt
@@ -2,4 +2,5 @@ package com.github.andreyasadchy.xtra.model.chat
class Badge(
val setId: String,
- val version: String)
+ val version: String,
+)
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/ChannelPointReward.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/ChannelPointReward.kt
index 12839cf8c..11abfef4d 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/ChannelPointReward.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/ChannelPointReward.kt
@@ -6,4 +6,5 @@ class ChannelPointReward(
val cost: Int? = null,
val url1x: String? = null,
val url2x: String? = null,
- val url4x: String? = null)
\ No newline at end of file
+ val url4x: String? = null,
+)
\ No newline at end of file
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/ChatMessage.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/ChatMessage.kt
index 5d5a3ac7d..2906617bb 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/ChatMessage.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/ChatMessage.kt
@@ -17,4 +17,5 @@ class ChatMessage(
val reward: ChannelPointReward? = null,
val reply: Reply? = null,
val timestamp: Long? = null,
- val fullMsg: String? = null)
\ No newline at end of file
+ val fullMsg: String? = null,
+)
\ No newline at end of file
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/Chatter.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/Chatter.kt
index 8fab8fa01..a6e087d4b 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/Chatter.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/Chatter.kt
@@ -9,9 +9,7 @@ class Chatter(val name: String?) {
other as Chatter
- if (name != other.name) return false
-
- return true
+ return name == other.name
}
override fun hashCode(): Int {
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/CheerEmote.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/CheerEmote.kt
index 6a9ec2290..0c11fe598 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/CheerEmote.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/CheerEmote.kt
@@ -10,4 +10,5 @@ class CheerEmote(
val format: String? = null,
val isAnimated: Boolean = true,
val minBits: Int,
- val color: String? = null)
\ No newline at end of file
+ val color: String? = null,
+)
\ No newline at end of file
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/Emote.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/Emote.kt
index 761e15e1b..aef73f563 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/Emote.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/Emote.kt
@@ -9,7 +9,8 @@ class Emote(
val url4x: String? = null,
val format: String? = null,
val isAnimated: Boolean = true,
- val isZeroWidth: Boolean = false) {
+ val isZeroWidth: Boolean = false,
+) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/EmoteCard.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/EmoteCard.kt
index 993cb0ae4..85061b1ff 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/EmoteCard.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/EmoteCard.kt
@@ -5,4 +5,5 @@ class EmoteCard(
val subTier: String?,
val bitThreshold: Int?,
val channelLogin: String?,
- val channelName: String?)
+ val channelName: String?,
+)
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/Image.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/Image.kt
index d6c788a6c..37d981acc 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/Image.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/Image.kt
@@ -11,4 +11,5 @@ class Image(
val isZeroWidth: Boolean = false,
val isEmote: Boolean = false,
var start: Int,
- var end: Int)
\ No newline at end of file
+ var end: Int,
+)
\ No newline at end of file
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/NamePaint.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/NamePaint.kt
index 18dd04dde..4361614e3 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/NamePaint.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/NamePaint.kt
@@ -8,12 +8,13 @@ class NamePaint(
val imageUrl: String? = null,
val angle: Int? = null,
val repeat: Boolean? = null,
- val shadows: List? = null) {
+ val shadows: List? = null,
+) {
class Shadow(
val xOffset: Float,
val yOffset: Float,
val radius: Float,
- val color: Int
+ val color: Int,
)
}
\ No newline at end of file
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/Raid.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/Raid.kt
index 8f955c1da..5a41bfa30 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/Raid.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/Raid.kt
@@ -9,7 +9,8 @@ class Raid(
val targetName: String? = null,
val targetProfileImage: String? = null,
val viewerCount: Int? = null,
- val openStream: Boolean) {
+ val openStream: Boolean,
+) {
val targetLogo: String?
get() = TwitchApiHelper.getTemplateUrl(targetProfileImage, "profileimage")
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/RecentEmote.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/RecentEmote.kt
index c689a8255..16847d6bc 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/RecentEmote.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/RecentEmote.kt
@@ -9,7 +9,8 @@ class RecentEmote(
@PrimaryKey
val name: String,
@ColumnInfo(name = "used_at")
- val usedAt: Long) {
+ val usedAt: Long,
+) {
companion object {
const val MAX_SIZE = 50
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/Reply.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/Reply.kt
index b5a1355dc..7f118a0ed 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/Reply.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/Reply.kt
@@ -4,4 +4,5 @@ class Reply(
val threadParentId: String? = null,
val userLogin: String? = null,
val userName: String? = null,
- val message: String? = null)
\ No newline at end of file
+ val message: String? = null,
+)
\ No newline at end of file
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/RoomState.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/RoomState.kt
index 3cd7867c8..d1ddcf47e 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/RoomState.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/RoomState.kt
@@ -5,4 +5,5 @@ class RoomState(
val followers: String?,
val unique: String?,
val slow: String?,
- val subs: String?)
\ No newline at end of file
+ val subs: String?,
+)
\ No newline at end of file
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/StvBadge.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/StvBadge.kt
index c8bcc53ac..c32902379 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/StvBadge.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/StvBadge.kt
@@ -7,4 +7,5 @@ class StvBadge(
val url3x: String?,
val url4x: String?,
val name: String?,
- val format: String?)
+ val format: String?,
+)
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/TwitchBadge.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/TwitchBadge.kt
index 547867f3d..e16405fa7 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/TwitchBadge.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/TwitchBadge.kt
@@ -8,4 +8,5 @@ class TwitchBadge(
val url2x: String? = null,
val url3x: String? = null,
val url4x: String? = null,
- val title: String? = null)
+ val title: String? = null,
+)
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/TwitchEmote.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/TwitchEmote.kt
index 275574cc2..aa7fc2229 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/TwitchEmote.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/TwitchEmote.kt
@@ -13,4 +13,5 @@ class TwitchEmote(
var begin: Int = 0,
var end: Int = 0,
val setId: String? = null,
- val ownerId: String? = null)
+ val ownerId: String? = null,
+)
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/VideoChatMessage.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/VideoChatMessage.kt
index 63a32c9e1..495a06eee 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/VideoChatMessage.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/chat/VideoChatMessage.kt
@@ -10,4 +10,5 @@ class VideoChatMessage(
val color: String?,
val emotes: List?,
val badges: List?,
- val fullMsg: String?)
\ No newline at end of file
+ val fullMsg: String?,
+)
\ No newline at end of file
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/id/DeviceCodeResponse.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/id/DeviceCodeResponse.kt
index f6d96e5f7..9af284e6f 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/id/DeviceCodeResponse.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/id/DeviceCodeResponse.kt
@@ -6,5 +6,5 @@ import kotlinx.serialization.Serializable
@Serializable
class DeviceCodeResponse(
@SerialName("device_code")
- val deviceCode: String
+ val deviceCode: String,
)
\ No newline at end of file
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/id/TokenResponse.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/id/TokenResponse.kt
index 938d421b1..33b2faba4 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/id/TokenResponse.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/id/TokenResponse.kt
@@ -6,5 +6,5 @@ import kotlinx.serialization.Serializable
@Serializable
class TokenResponse(
@SerialName("access_token")
- val token: String
+ val token: String,
)
\ No newline at end of file
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/id/ValidationResponse.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/id/ValidationResponse.kt
index b257784b3..a1cea6eff 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/id/ValidationResponse.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/id/ValidationResponse.kt
@@ -9,5 +9,5 @@ class ValidationResponse(
val clientId: String,
val login: String? = null,
@SerialName("user_id")
- val userId: String? = null
+ val userId: String? = null,
)
\ No newline at end of file
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/misc/RecentMessagesResponse.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/misc/RecentMessagesResponse.kt
index b005674dc..5ae08201d 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/misc/RecentMessagesResponse.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/misc/RecentMessagesResponse.kt
@@ -4,5 +4,5 @@ import kotlinx.serialization.Serializable
@Serializable
class RecentMessagesResponse(
- val messages: List
+ val messages: List,
)
\ No newline at end of file
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/misc/StvChannelResponse.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/misc/StvChannelResponse.kt
index 4dda5d5b3..773619330 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/misc/StvChannelResponse.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/misc/StvChannelResponse.kt
@@ -6,5 +6,5 @@ import kotlinx.serialization.Serializable
@Serializable
class StvChannelResponse(
@SerialName("emote_set")
- val emoteSet: StvGlobalResponse
+ val emoteSet: StvGlobalResponse,
)
\ No newline at end of file
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/misc/StvGlobalResponse.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/misc/StvGlobalResponse.kt
index 5aac1b08d..23249f0e6 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/misc/StvGlobalResponse.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/misc/StvGlobalResponse.kt
@@ -5,5 +5,5 @@ import kotlinx.serialization.Serializable
@Serializable
class StvGlobalResponse(
val id: String? = null,
- val emotes: List
+ val emotes: List,
)
\ No newline at end of file
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/Bookmark.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/Bookmark.kt
index c67bb7af2..9c951dce3 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/Bookmark.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/Bookmark.kt
@@ -20,7 +20,8 @@ class Bookmark(
val thumbnail: String? = null,
val type: String? = null,
val duration: String? = null,
- val animatedPreviewURL: String? = null) {
+ val animatedPreviewURL: String? = null,
+) {
@PrimaryKey(autoGenerate = true)
var id = 0
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/ChannelViewerList.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/ChannelViewerList.kt
index fc9e22252..3ae78cb4c 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/ChannelViewerList.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/ChannelViewerList.kt
@@ -5,4 +5,5 @@ class ChannelViewerList(
val moderators: List,
val vips: List,
val viewers: List,
- val count: Int?)
\ No newline at end of file
+ val count: Int?,
+)
\ No newline at end of file
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/Clip.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/Clip.kt
index 4f5422e3c..e6419e02e 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/Clip.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/Clip.kt
@@ -22,7 +22,8 @@ class Clip(
var gameName: String? = null,
var channelLogin: String? = null,
var profileImageUrl: String? = null,
- val videoAnimatedPreviewURL: String? = null) : Parcelable {
+ val videoAnimatedPreviewURL: String? = null,
+) : Parcelable {
val thumbnail: String?
get() = TwitchApiHelper.getTemplateUrl(thumbnailUrl, "clip")
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/Game.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/Game.kt
index 4907286c5..034925c25 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/Game.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/Game.kt
@@ -18,7 +18,8 @@ class Game(
val vodDuration: Int? = null,
var followAccount: Boolean = false,
- val followLocal: Boolean = false) : Parcelable {
+ val followLocal: Boolean = false,
+) : Parcelable {
val boxArt: String?
get() = TwitchApiHelper.getTemplateUrl(boxArtUrl, "game")
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/LocalFollowChannel.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/LocalFollowChannel.kt
index 669b8a4b4..08d1cb947 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/LocalFollowChannel.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/LocalFollowChannel.kt
@@ -8,7 +8,8 @@ class LocalFollowChannel(
val userId: String? = null,
var userLogin: String? = null,
var userName: String? = null,
- var channelLogo: String? = null) {
+ var channelLogo: String? = null,
+) {
@PrimaryKey(autoGenerate = true)
var id = 0
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/LocalFollowGame.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/LocalFollowGame.kt
index b233878cd..b7fb5b0c4 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/LocalFollowGame.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/LocalFollowGame.kt
@@ -8,7 +8,8 @@ class LocalFollowGame(
val gameId: String? = null,
val gameSlug: String? = null,
var gameName: String? = null,
- var boxArt: String? = null) {
+ var boxArt: String? = null,
+) {
@PrimaryKey(autoGenerate = true)
var id = 0
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/OfflineVideo.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/OfflineVideo.kt
index d3ef2d57e..74b5de7c3 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/OfflineVideo.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/OfflineVideo.kt
@@ -56,7 +56,8 @@ class OfflineVideo(
var chatUrl: String? = null,
val playlistToFile: Boolean = false,
val live: Boolean = false,
- var lastSegmentUrl: String? = null) : Parcelable {
+ var lastSegmentUrl: String? = null,
+) : Parcelable {
@IgnoredOnParcel
@PrimaryKey(autoGenerate = true)
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/SortChannel.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/SortChannel.kt
index e1afc22b5..0ac9f6940 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/SortChannel.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/SortChannel.kt
@@ -10,4 +10,5 @@ class SortChannel(
var saveSort: Boolean? = null,
var videoSort: String? = null,
var videoType: String? = null,
- var clipPeriod: String? = null)
+ var clipPeriod: String? = null,
+)
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/SortGame.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/SortGame.kt
index 3d59a6112..7be582637 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/SortGame.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/SortGame.kt
@@ -13,4 +13,5 @@ class SortGame(
var videoType: String? = null,
var videoLanguageIndex: Int? = null,
var clipPeriod: String? = null,
- var clipLanguageIndex: Int? = null)
+ var clipLanguageIndex: Int? = null,
+)
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/Stream.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/Stream.kt
index 345585878..90b0598f2 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/Stream.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/Stream.kt
@@ -21,7 +21,8 @@ class Stream(
var profileImageUrl: String? = null,
val tags: List? = null,
- val user: User? = null) : Parcelable {
+ val user: User? = null,
+) : Parcelable {
val thumbnail: String?
get() = TwitchApiHelper.getTemplateUrl(thumbnailUrl, "video")
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/Tag.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/Tag.kt
index 813cc94ff..e28a292dd 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/Tag.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/Tag.kt
@@ -7,4 +7,5 @@ import kotlinx.parcelize.Parcelize
class Tag(
val id: String? = null,
val name: String? = null,
- val scope: String? = null) : Parcelable
\ No newline at end of file
+ val scope: String? = null,
+) : Parcelable
\ No newline at end of file
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/User.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/User.kt
index c6bd22a31..f2cf9dfbe 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/User.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/User.kt
@@ -22,7 +22,8 @@ class User(
val stream: Stream? = null,
var followAccount: Boolean = false,
- val followLocal: Boolean = false) : Parcelable {
+ val followLocal: Boolean = false,
+) : Parcelable {
val channelLogo: String?
get() = TwitchApiHelper.getTemplateUrl(profileImageUrl, "profileimage")
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/Video.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/Video.kt
index b7d1d387a..31cc541f2 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/Video.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/Video.kt
@@ -22,7 +22,8 @@ class Video(
var gameName: String? = null,
var profileImageUrl: String? = null,
val tags: List? = null,
- val animatedPreviewURL: String? = null) : Parcelable {
+ val animatedPreviewURL: String? = null,
+) : Parcelable {
val thumbnail: String?
get() = TwitchApiHelper.getTemplateUrl(thumbnailUrl, "video")
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/VodBookmarkIgnoredUser.kt b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/VodBookmarkIgnoredUser.kt
index 7160d5f23..5025e0058 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/VodBookmarkIgnoredUser.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/model/ui/VodBookmarkIgnoredUser.kt
@@ -8,4 +8,5 @@ import androidx.room.PrimaryKey
class VodBookmarkIgnoredUser(
@PrimaryKey
@ColumnInfo(name = "user_id")
- val userId: String)
+ val userId: String,
+)
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/ApiRepository.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/ApiRepository.kt
index af96eecf3..64654bc73 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/ApiRepository.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/ApiRepository.kt
@@ -48,7 +48,8 @@ class ApiRepository @Inject constructor(
private val apolloClient: ApolloClient,
private val helix: HelixApi,
private val gql: GraphQLRepository,
- private val misc: MiscApi) {
+ private val misc: MiscApi,
+) {
private fun getApolloClient(gqlHeaders: Map): ApolloClient {
return apolloClient.newBuilder().apply {
@@ -153,7 +154,7 @@ class ApiRepository @Inject constructor(
duration = it.lengthSeconds?.toString(),
thumbnailUrl = it.previewThumbnailURL,
profileImageUrl = it.owner?.profileImageURL,
- animatedPreviewURL = it.animatedPreviewURL,
+ animatedPreviewURL = it.animatedPreviewURL,
)
}
}
@@ -448,28 +449,33 @@ class ApiRepository @Inject constructor(
suspend fun loadGlobalBadges(helixHeaders: Map, gqlHeaders: Map, emoteQuality: String, checkIntegrity: Boolean): List = withContext(Dispatchers.IO) {
try {
- val response = getApolloClient(gqlHeaders).query(BadgesQuery(Optional.Present(when (emoteQuality) {"4" -> BadgeImageSize.QUADRUPLE "3" -> BadgeImageSize.QUADRUPLE "2" -> BadgeImageSize.DOUBLE else -> BadgeImageSize.NORMAL}))).execute()
+ val response = getApolloClient(gqlHeaders).query(BadgesQuery(Optional.Present(
+ when (emoteQuality) {
+ "4" -> BadgeImageSize.QUADRUPLE
+ "3" -> BadgeImageSize.QUADRUPLE
+ "2" -> BadgeImageSize.DOUBLE
+ else -> BadgeImageSize.NORMAL
+ }
+ ))).execute()
if (checkIntegrity) {
response.errors?.find { it.message == "failed integrity check" }?.let { throw Exception(it.message) }
}
response.data!!.badges?.mapNotNull {
- if (it != null) {
- it.setID?.let { setId ->
- it.version?.let { version ->
- it.imageURL?.let { url ->
- TwitchBadge(
- setId = setId,
- version = version,
- url1x = url,
- url2x = url,
- url3x = url,
- url4x = url,
- title = it.title
- )
- }
+ it?.setID?.let { setId ->
+ it.version?.let { version ->
+ it.imageURL?.let { url ->
+ TwitchBadge(
+ setId = setId,
+ version = version,
+ url1x = url,
+ url2x = url,
+ url3x = url,
+ url4x = url,
+ title = it.title
+ )
}
}
- } else null
+ }
} ?: emptyList()
} catch (e: Exception) {
if (e.message == "failed integrity check") throw e
@@ -522,29 +528,34 @@ class ApiRepository @Inject constructor(
val response = getApolloClient(gqlHeaders).query(UserBadgesQuery(
id = if (!channelId.isNullOrBlank()) Optional.Present(channelId) else Optional.Absent,
login = if (channelId.isNullOrBlank() && !channelLogin.isNullOrBlank()) Optional.Present(channelLogin) else Optional.Absent,
- quality = Optional.Present(when (emoteQuality) {"4" -> BadgeImageSize.QUADRUPLE "3" -> BadgeImageSize.QUADRUPLE "2" -> BadgeImageSize.DOUBLE else -> BadgeImageSize.NORMAL})
+ quality = Optional.Present(
+ when (emoteQuality) {
+ "4" -> BadgeImageSize.QUADRUPLE
+ "3" -> BadgeImageSize.QUADRUPLE
+ "2" -> BadgeImageSize.DOUBLE
+ else -> BadgeImageSize.NORMAL
+ }
+ )
)).execute()
if (checkIntegrity) {
response.errors?.find { it.message == "failed integrity check" }?.let { throw Exception(it.message) }
}
response.data!!.user?.broadcastBadges?.mapNotNull {
- if (it != null) {
- it.setID?.let { setId ->
- it.version?.let { version ->
- it.imageURL?.let { url ->
- TwitchBadge(
- setId = setId,
- version = version,
- url1x = url,
- url2x = url,
- url3x = url,
- url4x = url,
- title = it.title
- )
- }
+ it?.setID?.let { setId ->
+ it.version?.let { version ->
+ it.imageURL?.let { url ->
+ TwitchBadge(
+ setId = setId,
+ version = version,
+ url1x = url,
+ url2x = url,
+ url3x = url,
+ url4x = url,
+ title = it.title
+ )
}
}
- } else null
+ }
} ?: emptyList()
} catch (e: Exception) {
if (e.message == "failed integrity check") throw e
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/AuthRepository.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/AuthRepository.kt
index f3dbbb613..c95fc8da5 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/AuthRepository.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/AuthRepository.kt
@@ -12,7 +12,8 @@ import javax.inject.Singleton
@Singleton
class AuthRepository @Inject constructor(
- private val api: IdApi) {
+ private val api: IdApi,
+) {
suspend fun validate(token: String): ValidationResponse = withContext(Dispatchers.IO) {
api.validateToken(token)
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/BookmarksRepository.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/BookmarksRepository.kt
index 2ada4bd39..c8c9f42ab 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/BookmarksRepository.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/BookmarksRepository.kt
@@ -14,7 +14,8 @@ import javax.inject.Singleton
class BookmarksRepository @Inject constructor(
private val bookmarksDao: BookmarksDao,
private val localFollowsChannelDao: LocalFollowsChannelDao,
- private val videosDao: VideosDao) {
+ private val videosDao: VideosDao,
+) {
fun loadBookmarksPagingSource() = bookmarksDao.getAllPagingSource()
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/GraphQLRepository.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/GraphQLRepository.kt
index cf81f4a94..c3b8e13e3 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/GraphQLRepository.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/GraphQLRepository.kt
@@ -49,7 +49,9 @@ import javax.inject.Inject
import javax.inject.Singleton
@Singleton
-class GraphQLRepository @Inject constructor(private val graphQL: GraphQLApi) {
+class GraphQLRepository @Inject constructor(
+ private val graphQL: GraphQLApi,
+) {
fun getPlaybackAccessTokenRequestBody(login: String?, vodId: String?, playerType: String?): JsonObject {
return buildJsonObject {
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/LocalFollowChannelRepository.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/LocalFollowChannelRepository.kt
index b6b8879f6..2a42c23e5 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/LocalFollowChannelRepository.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/LocalFollowChannelRepository.kt
@@ -14,7 +14,8 @@ import javax.inject.Singleton
class LocalFollowChannelRepository @Inject constructor(
private val localFollowsChannelDao: LocalFollowsChannelDao,
private val videosDao: VideosDao,
- private val bookmarksDao: BookmarksDao) {
+ private val bookmarksDao: BookmarksDao,
+) {
suspend fun loadFollows() = withContext(Dispatchers.IO) {
localFollowsChannelDao.getAll()
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/LocalFollowGameRepository.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/LocalFollowGameRepository.kt
index 84f5f8fed..8ac759c4c 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/LocalFollowGameRepository.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/LocalFollowGameRepository.kt
@@ -10,7 +10,8 @@ import javax.inject.Singleton
@Singleton
class LocalFollowGameRepository @Inject constructor(
- private val localFollowsGameDao: LocalFollowsGameDao) {
+ private val localFollowsGameDao: LocalFollowsGameDao,
+) {
suspend fun loadFollows() = withContext(Dispatchers.IO) {
localFollowsGameDao.getAll()
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/NotificationUsersRepository.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/NotificationUsersRepository.kt
index 7c889eca4..c2e1a43e9 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/NotificationUsersRepository.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/NotificationUsersRepository.kt
@@ -9,7 +9,8 @@ import javax.inject.Singleton
@Singleton
class NotificationUsersRepository @Inject constructor(
- private val notificationUsersDao: NotificationUsersDao) {
+ private val notificationUsersDao: NotificationUsersDao,
+) {
suspend fun loadUsers() = withContext(Dispatchers.IO) {
notificationUsersDao.getAll()
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/OfflineRepository.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/OfflineRepository.kt
index ba00620b7..78e352f9d 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/OfflineRepository.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/OfflineRepository.kt
@@ -12,9 +12,10 @@ import javax.inject.Singleton
@Singleton
class OfflineRepository @Inject constructor(
- private val videosDao: VideosDao,
- private val localFollowsChannelDao: LocalFollowsChannelDao,
- private val bookmarksDao: BookmarksDao) {
+ private val videosDao: VideosDao,
+ private val localFollowsChannelDao: LocalFollowsChannelDao,
+ private val bookmarksDao: BookmarksDao,
+) {
fun loadAllVideos() = videosDao.getAll()
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/PlayerRepository.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/PlayerRepository.kt
index 98c7f4c12..c29968baf 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/PlayerRepository.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/PlayerRepository.kt
@@ -49,7 +49,8 @@ class PlayerRepository @Inject constructor(
private val misc: MiscApi,
private val graphQL: GraphQLRepository,
private val recentEmotes: RecentEmotesDao,
- private val videoPositions: VideoPositionsDao) {
+ private val videoPositions: VideoPositionsDao,
+) {
suspend fun getMediaPlaylist(url: String): MediaPlaylist = withContext(Dispatchers.IO) {
okHttpClient.newCall(Request.Builder().url(url).build()).execute().use { response ->
@@ -270,7 +271,7 @@ class PlayerRepository @Inject constructor(
url3x = urls?.getOrNull(2) ?: if (urls.isNullOrEmpty()) "https:${template}/3x.webp" else null,
url4x = urls?.getOrNull(3) ?: if (urls.isNullOrEmpty()) "https:${template}/4x.webp" else null,
format = urls?.getOrNull(0)?.substringAfterLast(".") ?: "webp",
- isAnimated = data.animated ?: true,
+ isAnimated = data.animated != false,
isZeroWidth = emote.flags == 1
)
}
@@ -321,7 +322,7 @@ class PlayerRepository @Inject constructor(
url3x = "https://cdn.betterttv.net/emote/$id/2x.webp",
url4x = "https://cdn.betterttv.net/emote/$id/3x.webp",
format = "webp",
- isAnimated = emote.animated ?: true,
+ isAnimated = emote.animated != false,
isZeroWidth = list.contains(name)
)
}
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/ShownNotificationsRepository.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/ShownNotificationsRepository.kt
index ba89a3e25..f306600ab 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/ShownNotificationsRepository.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/ShownNotificationsRepository.kt
@@ -17,7 +17,8 @@ import javax.inject.Singleton
@Singleton
class ShownNotificationsRepository @Inject constructor(
- private val shownNotificationsDao: ShownNotificationsDao) {
+ private val shownNotificationsDao: ShownNotificationsDao,
+) {
suspend fun getNewStreams(notificationUsersRepository: NotificationUsersRepository, gqlHeaders: Map, apolloClient: ApolloClient, helixHeaders: Map, helixApi: HelixApi): List = withContext(Dispatchers.IO) {
val list = mutableListOf()
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/SortChannelRepository.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/SortChannelRepository.kt
index c2556dbfc..cee04c087 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/SortChannelRepository.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/SortChannelRepository.kt
@@ -9,7 +9,8 @@ import javax.inject.Singleton
@Singleton
class SortChannelRepository @Inject constructor(
- private val sortChannelDao: SortChannelDao) {
+ private val sortChannelDao: SortChannelDao,
+) {
suspend fun getById(id: String) = withContext(Dispatchers.IO) {
sortChannelDao.getById(id)
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/SortGameRepository.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/SortGameRepository.kt
index 56c4b677f..9263c7ab6 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/SortGameRepository.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/SortGameRepository.kt
@@ -9,7 +9,8 @@ import javax.inject.Singleton
@Singleton
class SortGameRepository @Inject constructor(
- private val sortGameDao: SortGameDao) {
+ private val sortGameDao: SortGameDao,
+) {
suspend fun getById(id: String) = withContext(Dispatchers.IO) {
sortGameDao.getById(id)
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/VodBookmarkIgnoredUsersRepository.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/VodBookmarkIgnoredUsersRepository.kt
index 2f2e02aa9..219ff7452 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/VodBookmarkIgnoredUsersRepository.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/VodBookmarkIgnoredUsersRepository.kt
@@ -9,7 +9,8 @@ import javax.inject.Singleton
@Singleton
class VodBookmarkIgnoredUsersRepository @Inject constructor(
- private val vodBookmarkIgnoredUsersDao: VodBookmarkIgnoredUsersDao) {
+ private val vodBookmarkIgnoredUsersDao: VodBookmarkIgnoredUsersDao,
+) {
fun loadUsersFlow() = vodBookmarkIgnoredUsersDao.getAllFlow()
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/ChannelClipsDataSource.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/ChannelClipsDataSource.kt
index a0ed13c36..298c8c06e 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/ChannelClipsDataSource.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/ChannelClipsDataSource.kt
@@ -24,7 +24,8 @@ class ChannelClipsDataSource(
private val gqlApi: GraphQLRepository,
private val apolloClient: ApolloClient,
private val checkIntegrity: Boolean,
- private val apiPref: List) : PagingSource() {
+ private val apiPref: List,
+) : PagingSource() {
private var api: String? = null
private var offset: String? = null
private var nextPage: Boolean = true
@@ -151,7 +152,7 @@ class ChannelClipsDataSource(
}
}
offset = items.lastOrNull()?.cursor?.toString()
- nextPage = data.clips.pageInfo?.hasNextPage ?: true
+ nextPage = data.clips.pageInfo?.hasNextPage != false
return list
}
@@ -181,7 +182,7 @@ class ChannelClipsDataSource(
}
}
offset = items.lastOrNull()?.cursor
- nextPage = data.clips.pageInfo?.hasNextPage ?: true
+ nextPage = data.clips.pageInfo?.hasNextPage != false
return list
}
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/ChannelVideosDataSource.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/ChannelVideosDataSource.kt
index 3f83b2ba0..efc6a9d24 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/ChannelVideosDataSource.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/ChannelVideosDataSource.kt
@@ -29,7 +29,8 @@ class ChannelVideosDataSource(
private val gqlApi: GraphQLRepository,
private val apolloClient: ApolloClient,
private val checkIntegrity: Boolean,
- private val apiPref: List) : PagingSource() {
+ private val apiPref: List,
+) : PagingSource() {
private var api: String? = null
private var offset: String? = null
private var nextPage: Boolean = true
@@ -146,12 +147,12 @@ class ChannelVideosDataSource(
name = tag.localizedName
)
},
- animatedPreviewURL = it.animatedPreviewURL
+ animatedPreviewURL = it.animatedPreviewURL
)
}
}
offset = items.lastOrNull()?.cursor?.toString()
- nextPage = data.videos.pageInfo?.hasNextPage ?: true
+ nextPage = data.videos.pageInfo?.hasNextPage != false
return list
}
@@ -183,12 +184,12 @@ class ChannelVideosDataSource(
name = tag.localizedName
)
},
- animatedPreviewURL = it.animatedPreviewURL
+ animatedPreviewURL = it.animatedPreviewURL
)
}
}
offset = items.lastOrNull()?.cursor
- nextPage = data.videos.pageInfo?.hasNextPage ?: true
+ nextPage = data.videos.pageInfo?.hasNextPage != false
return list
}
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/FollowedChannelsDataSource.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/FollowedChannelsDataSource.kt
index 88025ee60..60b1b7373 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/FollowedChannelsDataSource.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/FollowedChannelsDataSource.kt
@@ -39,7 +39,8 @@ class FollowedChannelsDataSource(
private val checkIntegrity: Boolean,
private val apiPref: List,
private val sort: String,
- private val order: String) : PagingSource() {
+ private val order: String,
+) : PagingSource() {
private var api: String? = null
private var offset: String? = null
private var nextPage: Boolean = true
@@ -222,7 +223,7 @@ class FollowedChannelsDataSource(
}
}
offset = items.lastOrNull()?.cursor?.toString()
- nextPage = data.pageInfo?.hasNextPage ?: true
+ nextPage = data.pageInfo?.hasNextPage != false
return list
}
@@ -245,7 +246,7 @@ class FollowedChannelsDataSource(
}
}
offset = items.lastOrNull()?.cursor
- nextPage = data.pageInfo?.hasNextPage ?: true
+ nextPage = data.pageInfo?.hasNextPage != false
return list
}
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/FollowedGamesDataSource.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/FollowedGamesDataSource.kt
index 1eafc955b..8452d3bac 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/FollowedGamesDataSource.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/FollowedGamesDataSource.kt
@@ -17,7 +17,8 @@ class FollowedGamesDataSource(
private val gqlApi: GraphQLRepository,
private val apolloClient: ApolloClient,
private val checkIntegrity: Boolean,
- private val apiPref: List) : PagingSource() {
+ private val apiPref: List,
+) : PagingSource() {
override suspend fun load(params: LoadParams): LoadResult {
return try {
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/FollowedStreamsDataSource.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/FollowedStreamsDataSource.kt
index ede0e4eb6..124681bf3 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/FollowedStreamsDataSource.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/FollowedStreamsDataSource.kt
@@ -21,7 +21,8 @@ class FollowedStreamsDataSource(
private val gqlApi: GraphQLRepository,
private val apolloClient: ApolloClient,
private val checkIntegrity: Boolean,
- private val apiPref: List) : PagingSource() {
+ private val apiPref: List,
+) : PagingSource() {
private var api: String? = null
private var offset: String? = null
private var nextPage: Boolean = true
@@ -177,7 +178,7 @@ class FollowedStreamsDataSource(
}
}
offset = items.lastOrNull()?.cursor?.toString()
- nextPage = data.pageInfo?.hasNextPage ?: true
+ nextPage = data.pageInfo?.hasNextPage != false
return list
}
@@ -207,7 +208,7 @@ class FollowedStreamsDataSource(
}
}
offset = items.lastOrNull()?.cursor
- nextPage = data.pageInfo?.hasNextPage ?: true
+ nextPage = data.pageInfo?.hasNextPage != false
return list
}
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/FollowedVideosDataSource.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/FollowedVideosDataSource.kt
index b62129d49..f052cf324 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/FollowedVideosDataSource.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/FollowedVideosDataSource.kt
@@ -19,7 +19,8 @@ class FollowedVideosDataSource(
private val gqlApi: GraphQLRepository,
private val apolloClient: ApolloClient,
private val checkIntegrity: Boolean,
- private val apiPref: List) : PagingSource() {
+ private val apiPref: List,
+) : PagingSource() {
private var api: String? = null
private var offset: String? = null
private var nextPage: Boolean = true
@@ -95,12 +96,12 @@ class FollowedVideosDataSource(
name = tag.localizedName
)
},
- animatedPreviewURL = it.animatedPreviewURL
+ animatedPreviewURL = it.animatedPreviewURL
)
}
}
offset = items.lastOrNull()?.cursor?.toString()
- nextPage = data.pageInfo?.hasNextPage ?: true
+ nextPage = data.pageInfo?.hasNextPage != false
return list
}
@@ -132,12 +133,12 @@ class FollowedVideosDataSource(
name = tag.localizedName
)
},
- animatedPreviewURL = it.animatedPreviewURL
+ animatedPreviewURL = it.animatedPreviewURL
)
}
}
offset = items.lastOrNull()?.cursor
- nextPage = data.pageInfo?.hasNextPage ?: true
+ nextPage = data.pageInfo?.hasNextPage != false
return list
}
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/GameClipsDataSource.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/GameClipsDataSource.kt
index b6e63e75f..7398a958f 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/GameClipsDataSource.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/GameClipsDataSource.kt
@@ -27,7 +27,8 @@ class GameClipsDataSource(
private val gqlApi: GraphQLRepository,
private val apolloClient: ApolloClient,
private val checkIntegrity: Boolean,
- private val apiPref: List) : PagingSource() {
+ private val apiPref: List,
+) : PagingSource() {
private var api: String? = null
private var offset: String? = null
private var nextPage: Boolean = true
@@ -159,7 +160,7 @@ class GameClipsDataSource(
}
}
offset = items.lastOrNull()?.cursor?.toString()
- nextPage = data.pageInfo?.hasNextPage ?: true
+ nextPage = data.pageInfo?.hasNextPage != false
return list
}
@@ -190,7 +191,7 @@ class GameClipsDataSource(
}
}
offset = items.lastOrNull()?.cursor
- nextPage = data.pageInfo?.hasNextPage ?: true
+ nextPage = data.pageInfo?.hasNextPage != false
return list
}
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/GameStreamsDataSource.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/GameStreamsDataSource.kt
index d2435e7a6..9097c4f7e 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/GameStreamsDataSource.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/GameStreamsDataSource.kt
@@ -24,7 +24,8 @@ class GameStreamsDataSource(
private val gqlApi: GraphQLRepository,
private val apolloClient: ApolloClient,
private val checkIntegrity: Boolean,
- private val apiPref: List) : PagingSource() {
+ private val apiPref: List,
+) : PagingSource() {
private var api: String? = null
private var offset: String? = null
private var nextPage: Boolean = true
@@ -149,7 +150,7 @@ class GameStreamsDataSource(
}
}
offset = items.lastOrNull()?.cursor?.toString()
- nextPage = data.pageInfo?.hasNextPage ?: true
+ nextPage = data.pageInfo?.hasNextPage != false
return list
}
@@ -180,7 +181,7 @@ class GameStreamsDataSource(
}
}
offset = items.lastOrNull()?.cursor
- nextPage = data.pageInfo?.hasNextPage ?: true
+ nextPage = data.pageInfo?.hasNextPage != false
return list
}
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/GameVideosDataSource.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/GameVideosDataSource.kt
index d44b5b390..a38e5cbb1 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/GameVideosDataSource.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/GameVideosDataSource.kt
@@ -32,7 +32,8 @@ class GameVideosDataSource(
private val gqlApi: GraphQLRepository,
private val apolloClient: ApolloClient,
private val checkIntegrity: Boolean,
- private val apiPref: List) : PagingSource() {
+ private val apiPref: List,
+) : PagingSource() {
private var api: String? = null
private var offset: String? = null
private var nextPage: Boolean = true
@@ -161,12 +162,12 @@ class GameVideosDataSource(
name = tag.localizedName
)
},
- animatedPreviewURL = it.animatedPreviewURL
+ animatedPreviewURL = it.animatedPreviewURL
)
}
}
offset = items.lastOrNull()?.cursor?.toString()
- nextPage = data.pageInfo?.hasNextPage ?: true
+ nextPage = data.pageInfo?.hasNextPage != false
return list
}
@@ -199,12 +200,12 @@ class GameVideosDataSource(
name = tag.localizedName
)
},
- animatedPreviewURL = it.animatedPreviewURL
+ animatedPreviewURL = it.animatedPreviewURL
)
}
}
offset = items.lastOrNull()?.cursor
- nextPage = data.pageInfo?.hasNextPage ?: true
+ nextPage = data.pageInfo?.hasNextPage != false
return list
}
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/GamesDataSource.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/GamesDataSource.kt
index ce1851597..1af29298e 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/GamesDataSource.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/GamesDataSource.kt
@@ -19,7 +19,8 @@ class GamesDataSource(
private val gqlApi: GraphQLRepository,
private val apolloClient: ApolloClient,
private val checkIntegrity: Boolean,
- private val apiPref: List) : PagingSource() {
+ private val apiPref: List,
+) : PagingSource() {
private var api: String? = null
private var offset: String? = null
private var nextPage: Boolean = true
@@ -119,7 +120,7 @@ class GamesDataSource(
}
}
offset = items.lastOrNull()?.cursor?.toString()
- nextPage = data.pageInfo?.hasNextPage ?: true
+ nextPage = data.pageInfo?.hasNextPage != false
return list
}
@@ -148,7 +149,7 @@ class GamesDataSource(
}
}
offset = items.lastOrNull()?.cursor
- nextPage = data.pageInfo?.hasNextPage ?: true
+ nextPage = data.pageInfo?.hasNextPage != false
return list
}
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/SearchChannelsDataSource.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/SearchChannelsDataSource.kt
index 17379f1c9..e908d7498 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/SearchChannelsDataSource.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/SearchChannelsDataSource.kt
@@ -18,7 +18,8 @@ class SearchChannelsDataSource(
private val gqlApi: GraphQLRepository,
private val apolloClient: ApolloClient,
private val checkIntegrity: Boolean,
- private val apiPref: List) : PagingSource() {
+ private val apiPref: List,
+) : PagingSource() {
private var api: String? = null
private var offset: String? = null
private var nextPage: Boolean = true
@@ -114,7 +115,7 @@ class SearchChannelsDataSource(
}
}
offset = data.edges.lastOrNull()?.cursor?.toString()
- nextPage = data.pageInfo?.hasNextPage ?: true
+ nextPage = data.pageInfo?.hasNextPage != false
return list
}
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/SearchGamesDataSource.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/SearchGamesDataSource.kt
index 8501f0b0a..cdf3a3403 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/SearchGamesDataSource.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/SearchGamesDataSource.kt
@@ -19,7 +19,8 @@ class SearchGamesDataSource(
private val gqlApi: GraphQLRepository,
private val apolloClient: ApolloClient,
private val checkIntegrity: Boolean,
- private val apiPref: List) : PagingSource() {
+ private val apiPref: List,
+) : PagingSource() {
private var api: String? = null
private var offset: String? = null
private var nextPage: Boolean = true
@@ -119,7 +120,7 @@ class SearchGamesDataSource(
}
}
offset = data.edges.lastOrNull()?.cursor?.toString()
- nextPage = data.pageInfo?.hasNextPage ?: true
+ nextPage = data.pageInfo?.hasNextPage != false
return list
}
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/SearchStreamsDataSource.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/SearchStreamsDataSource.kt
index 374b10788..263f7ee02 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/SearchStreamsDataSource.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/SearchStreamsDataSource.kt
@@ -16,7 +16,8 @@ class SearchStreamsDataSource(
private val gqlHeaders: Map,
private val apolloClient: ApolloClient,
private val checkIntegrity: Boolean,
- private val apiPref: List) : PagingSource() {
+ private val apiPref: List,
+) : PagingSource() {
private var api: String? = null
private var offset: String? = null
private var nextPage: Boolean = true
@@ -115,7 +116,7 @@ class SearchStreamsDataSource(
}
}
offset = data.edges.lastOrNull()?.cursor?.toString()
- nextPage = data.pageInfo?.hasNextPage ?: true
+ nextPage = data.pageInfo?.hasNextPage != false
return list
}
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/SearchVideosDataSource.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/SearchVideosDataSource.kt
index 9e39a7fc8..d0505a311 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/SearchVideosDataSource.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/SearchVideosDataSource.kt
@@ -16,7 +16,8 @@ class SearchVideosDataSource(
private val gqlApi: GraphQLRepository,
private val apolloClient: ApolloClient,
private val checkIntegrity: Boolean,
- private val apiPref: List) : PagingSource() {
+ private val apiPref: List,
+) : PagingSource() {
private var api: String? = null
private var offset: String? = null
private var nextPage: Boolean = true
@@ -89,11 +90,11 @@ class SearchVideosDataSource(
name = tag.localizedName
)
},
- animatedPreviewURL = it.animatedPreviewURL
+ animatedPreviewURL = it.animatedPreviewURL
)
}
offset = data.cursor
- nextPage = data.pageInfo?.hasNextPage ?: true
+ nextPage = data.pageInfo?.hasNextPage != false
return list
}
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/StreamsDataSource.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/StreamsDataSource.kt
index f9fc4c129..c569784e4 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/StreamsDataSource.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/StreamsDataSource.kt
@@ -18,7 +18,8 @@ class StreamsDataSource(
private val gqlApi: GraphQLRepository,
private val apolloClient: ApolloClient,
private val checkIntegrity: Boolean,
- private val apiPref: List) : PagingSource() {
+ private val apiPref: List,
+) : PagingSource() {
private var api: String? = null
private var offset: String? = null
private var nextPage: Boolean = true
@@ -138,7 +139,7 @@ class StreamsDataSource(
}
}
offset = items.lastOrNull()?.cursor?.toString()
- nextPage = data.pageInfo?.hasNextPage ?: true
+ nextPage = data.pageInfo?.hasNextPage != false
return list
}
@@ -169,7 +170,7 @@ class StreamsDataSource(
}
}
offset = items.lastOrNull()?.cursor
- nextPage = data.pageInfo?.hasNextPage ?: true
+ nextPage = data.pageInfo?.hasNextPage != false
return list
}
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/TagsDataSource.kt b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/TagsDataSource.kt
index 1f1f514f5..e52c07b6e 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/TagsDataSource.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/repository/datasource/TagsDataSource.kt
@@ -9,7 +9,8 @@ class TagsDataSource(
private val gqlHeaders: Map,
private val getGameTags: Boolean,
private val query: String,
- private val api: GraphQLRepository) : PagingSource() {
+ private val api: GraphQLRepository,
+) : PagingSource() {
override suspend fun load(params: LoadParams): LoadResult {
return try {
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/ui/channel/ChannelPagerAdapter.kt b/app/src/main/java/com/github/andreyasadchy/xtra/ui/channel/ChannelPagerAdapter.kt
index 0b95b25ac..ed0a21937 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/ui/channel/ChannelPagerAdapter.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/ui/channel/ChannelPagerAdapter.kt
@@ -8,7 +8,8 @@ import com.github.andreyasadchy.xtra.ui.videos.channel.ChannelVideosFragment
class ChannelPagerAdapter(
private val fragment: Fragment,
- private val args: ChannelPagerFragmentArgs) : FragmentStateAdapter(fragment) {
+ private val args: ChannelPagerFragmentArgs,
+) : FragmentStateAdapter(fragment) {
override fun createFragment(position: Int): Fragment {
return when (position) {
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/ui/channel/ChannelPagerFragment.kt b/app/src/main/java/com/github/andreyasadchy/xtra/ui/channel/ChannelPagerFragment.kt
index 9d13ea5c7..febf77108 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/ui/channel/ChannelPagerFragment.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/ui/channel/ChannelPagerFragment.kt
@@ -94,7 +94,11 @@ class ChannelPagerFragment : BaseNetworkFragment(), Scrollable, FragmentHost, In
viewLifecycleOwner.lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.STARTED) {
viewModel.integrity.collectLatest {
- if (it != null && it != "done" && requireContext().prefs().getBoolean(C.ENABLE_INTEGRITY, false) && requireContext().prefs().getBoolean(C.USE_WEBVIEW_INTEGRITY, true)) {
+ if (it != null &&
+ it != "done" &&
+ requireContext().prefs().getBoolean(C.ENABLE_INTEGRITY, false) &&
+ requireContext().prefs().getBoolean(C.USE_WEBVIEW_INTEGRITY, true)
+ ) {
IntegrityDialog.show(childFragmentManager, it)
viewModel.integrity.value = "done"
}
@@ -107,12 +111,16 @@ class ChannelPagerFragment : BaseNetworkFragment(), Scrollable, FragmentHost, In
appBar.setExpanded(false, false)
}
if (viewModel.stream.value == null) {
- watchLive.setOnClickListener { activity.startStream(Stream(
- id = args.streamId,
- channelId = args.channelId,
- channelLogin = args.channelLogin,
- channelName = args.channelName,
- profileImageUrl = args.channelLogo))
+ watchLive.setOnClickListener {
+ activity.startStream(
+ Stream(
+ id = args.streamId,
+ channelId = args.channelId,
+ channelLogin = args.channelLogin,
+ channelName = args.channelName,
+ profileImageUrl = args.channelLogo
+ )
+ )
}
}
args.channelName.let {
@@ -136,12 +144,17 @@ class ChannelPagerFragment : BaseNetworkFragment(), Scrollable, FragmentHost, In
if (it != null) {
userLayout.visible()
userImage.visible()
- userImage.loadImage(this@ChannelPagerFragment, it, circle = requireContext().prefs().getBoolean(C.UI_ROUNDUSERIMAGE, true))
+ userImage.loadImage(
+ this@ChannelPagerFragment,
+ it,
+ circle = requireContext().prefs().getBoolean(C.UI_ROUNDUSERIMAGE, true)
+ )
} else {
userImage.gone()
}
}
- val isLoggedIn = !TwitchApiHelper.getGQLHeaders(requireContext(), true)[C.HEADER_TOKEN].isNullOrBlank() || !TwitchApiHelper.getHelixHeaders(requireContext())[C.HEADER_TOKEN].isNullOrBlank()
+ val isLoggedIn = !TwitchApiHelper.getGQLHeaders(requireContext(), true)[C.HEADER_TOKEN].isNullOrBlank() ||
+ !TwitchApiHelper.getHelixHeaders(requireContext())[C.HEADER_TOKEN].isNullOrBlank()
val setting = requireContext().prefs().getString(C.UI_FOLLOW_BUTTON, "0")?.toIntOrNull() ?: 0
val navController = findNavController()
val appBarConfiguration = AppBarConfiguration(setOf(R.id.rootGamesFragment, R.id.rootTopFragment, R.id.followPagerFragment, R.id.followMediaFragment, R.id.savedPagerFragment, R.id.savedMediaFragment))
@@ -200,10 +213,31 @@ class ChannelPagerFragment : BaseNetworkFragment(), Scrollable, FragmentHost, In
}
))
.setNegativeButton(getString(R.string.no), null)
- .setPositiveButton(getString(R.string.yes)) { _, _ -> viewModel.deleteFollowChannel(TwitchApiHelper.getGQLHeaders(requireContext(), true), setting, requireContext().tokenPrefs().getString(C.USER_ID, null), args.channelId) }
+ .setPositiveButton(getString(R.string.yes)) { _, _ ->
+ viewModel.deleteFollowChannel(
+ TwitchApiHelper.getGQLHeaders(requireContext(), true),
+ setting,
+ requireContext().tokenPrefs().getString(C.USER_ID, null),
+ args.channelId
+ )
+ }
.show()
} else {
- viewModel.saveFollowChannel(requireContext().filesDir.path, TwitchApiHelper.getGQLHeaders(requireContext(), true), setting, requireContext().tokenPrefs().getString(C.USER_ID, null), args.channelId, args.channelLogin, args.channelName, if (args.updateLocal) { viewModel.stream.value?.channelLogo ?: viewModel.user.value?.channelLogo } else args.channelLogo, requireContext().prefs().getBoolean(C.LIVE_NOTIFICATIONS_ENABLED, false))
+ viewModel.saveFollowChannel(
+ requireContext().filesDir.path,
+ TwitchApiHelper.getGQLHeaders(requireContext(), true),
+ setting,
+ requireContext().tokenPrefs().getString(C.USER_ID, null),
+ args.channelId,
+ args.channelLogin,
+ args.channelName,
+ if (args.updateLocal) {
+ viewModel.stream.value?.channelLogo ?: viewModel.user.value?.channelLogo
+ } else {
+ args.channelLogo
+ },
+ requireContext().prefs().getBoolean(C.LIVE_NOTIFICATIONS_ENABLED, false)
+ )
}
}
true
@@ -407,7 +441,11 @@ class ChannelPagerFragment : BaseNetworkFragment(), Scrollable, FragmentHost, In
}
override fun initialize() {
- viewModel.loadStream(TwitchApiHelper.getHelixHeaders(requireContext()), TwitchApiHelper.getGQLHeaders(requireContext()), requireContext().prefs().getBoolean(C.ENABLE_INTEGRITY, false) && requireContext().prefs().getBoolean(C.USE_WEBVIEW_INTEGRITY, true))
+ viewModel.loadStream(
+ TwitchApiHelper.getHelixHeaders(requireContext()),
+ TwitchApiHelper.getGQLHeaders(requireContext()),
+ requireContext().prefs().getBoolean(C.ENABLE_INTEGRITY, false) && requireContext().prefs().getBoolean(C.USE_WEBVIEW_INTEGRITY, true)
+ )
viewLifecycleOwner.lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.STARTED) {
viewModel.stream.collectLatest { stream ->
@@ -431,7 +469,15 @@ class ChannelPagerFragment : BaseNetworkFragment(), Scrollable, FragmentHost, In
}
}
}
- viewModel.isFollowingChannel(TwitchApiHelper.getHelixHeaders(requireContext()), TwitchApiHelper.getGQLHeaders(requireContext(), true), requireContext().tokenPrefs().getString(C.USER_ID, null), requireContext().tokenPrefs().getString(C.USERNAME, null), requireContext().prefs().getString(C.UI_FOLLOW_BUTTON, "0")?.toIntOrNull() ?: 0, args.channelId, args.channelLogin)
+ viewModel.isFollowingChannel(
+ TwitchApiHelper.getHelixHeaders(requireContext()),
+ TwitchApiHelper.getGQLHeaders(requireContext(), true),
+ requireContext().tokenPrefs().getString(C.USER_ID, null),
+ requireContext().tokenPrefs().getString(C.USERNAME, null),
+ requireContext().prefs().getString(C.UI_FOLLOW_BUTTON, "0")?.toIntOrNull() ?: 0,
+ args.channelId,
+ args.channelLogin
+ )
}
private fun updateStreamLayout(stream: Stream?) {
@@ -461,7 +507,11 @@ class ChannelPagerFragment : BaseNetworkFragment(), Scrollable, FragmentHost, In
if (it != null) {
userLayout.visible()
userImage.visible()
- userImage.loadImage(this@ChannelPagerFragment, it, circle = requireContext().prefs().getBoolean(C.UI_ROUNDUSERIMAGE, true))
+ userImage.loadImage(
+ this@ChannelPagerFragment,
+ it,
+ circle = requireContext().prefs().getBoolean(C.UI_ROUNDUSERIMAGE, true)
+ )
requireArguments().putString(C.CHANNEL_PROFILEIMAGE, it)
} else {
userImage.gone()
@@ -496,27 +546,27 @@ class ChannelPagerFragment : BaseNetworkFragment(), Scrollable, FragmentHost, In
if (!stream?.title.isNullOrBlank()) {
streamLayout.visible()
title.visible()
- title.text = stream?.title?.trim()
+ title.text = stream.title?.trim()
} else {
title.gone()
}
if (!stream?.gameName.isNullOrBlank()) {
streamLayout.visible()
gameName.visible()
- gameName.text = stream?.gameName
+ gameName.text = stream.gameName
gameName.setOnClickListener {
findNavController().navigate(
if (requireContext().prefs().getBoolean(C.UI_GAMEPAGER, true)) {
GamePagerFragmentDirections.actionGlobalGamePagerFragment(
- gameId = stream?.gameId,
- gameSlug = stream?.gameSlug,
- gameName = stream?.gameName
+ gameId = stream.gameId,
+ gameSlug = stream.gameSlug,
+ gameName = stream.gameName
)
} else {
GameMediaFragmentDirections.actionGlobalGameMediaFragment(
- gameId = stream?.gameId,
- gameSlug = stream?.gameSlug,
- gameName = stream?.gameName
+ gameId = stream.gameId,
+ gameSlug = stream.gameSlug,
+ gameName = stream.gameName
)
}
)
@@ -534,7 +584,7 @@ class ChannelPagerFragment : BaseNetworkFragment(), Scrollable, FragmentHost, In
if (requireContext().prefs().getBoolean(C.UI_UPTIME, true)) {
if (stream?.startedAt != null) {
TwitchApiHelper.getUptime(requireContext(), stream.startedAt).let {
- if (it != null) {
+ if (it != null) {
streamLayout.visible()
uptime.visible()
uptime.text = requireContext().getString(R.string.uptime, it)
@@ -552,7 +602,11 @@ class ChannelPagerFragment : BaseNetworkFragment(), Scrollable, FragmentHost, In
if (!userImage.isVisible && user.channelLogo != null) {
userLayout.visible()
userImage.visible()
- userImage.loadImage(this@ChannelPagerFragment, user.channelLogo, circle = requireContext().prefs().getBoolean(C.UI_ROUNDUSERIMAGE, true))
+ userImage.loadImage(
+ this@ChannelPagerFragment,
+ user.channelLogo,
+ circle = requireContext().prefs().getBoolean(C.UI_ROUNDUSERIMAGE, true)
+ )
requireArguments().putString(C.CHANNEL_PROFILEIMAGE, user.channelLogo)
}
if (user.bannerImageURL != null) {
@@ -612,7 +666,11 @@ class ChannelPagerFragment : BaseNetworkFragment(), Scrollable, FragmentHost, In
}
override fun onNetworkRestored() {
- viewModel.retry(TwitchApiHelper.getHelixHeaders(requireContext()), TwitchApiHelper.getGQLHeaders(requireContext()), requireContext().prefs().getBoolean(C.ENABLE_INTEGRITY, false) && requireContext().prefs().getBoolean(C.USE_WEBVIEW_INTEGRITY, true))
+ viewModel.retry(
+ TwitchApiHelper.getHelixHeaders(requireContext()),
+ TwitchApiHelper.getGQLHeaders(requireContext()),
+ requireContext().prefs().getBoolean(C.ENABLE_INTEGRITY, false) && requireContext().prefs().getBoolean(C.USE_WEBVIEW_INTEGRITY, true)
+ )
}
override fun onIntegrityDialogCallback(callback: String?) {
@@ -621,13 +679,55 @@ class ChannelPagerFragment : BaseNetworkFragment(), Scrollable, FragmentHost, In
repeatOnLifecycle(Lifecycle.State.STARTED) {
when (callback) {
"refresh" -> {
- viewModel.retry(TwitchApiHelper.getHelixHeaders(requireContext()), TwitchApiHelper.getGQLHeaders(requireContext()), requireContext().prefs().getBoolean(C.ENABLE_INTEGRITY, false) && requireContext().prefs().getBoolean(C.USE_WEBVIEW_INTEGRITY, true))
- viewModel.isFollowingChannel(TwitchApiHelper.getHelixHeaders(requireContext()), TwitchApiHelper.getGQLHeaders(requireContext(), true), requireContext().tokenPrefs().getString(C.USER_ID, null), requireContext().tokenPrefs().getString(C.USERNAME, null), requireContext().prefs().getString(C.UI_FOLLOW_BUTTON, "0")?.toIntOrNull() ?: 0, args.channelId, args.channelLogin)
+ viewModel.retry(
+ TwitchApiHelper.getHelixHeaders(requireContext()),
+ TwitchApiHelper.getGQLHeaders(requireContext()),
+ requireContext().prefs().getBoolean(C.ENABLE_INTEGRITY, false) && requireContext().prefs().getBoolean(C.USE_WEBVIEW_INTEGRITY, true)
+ )
+ viewModel.isFollowingChannel(
+ TwitchApiHelper.getHelixHeaders(requireContext()),
+ TwitchApiHelper.getGQLHeaders(requireContext(), true),
+ requireContext().tokenPrefs().getString(C.USER_ID, null),
+ requireContext().tokenPrefs().getString(C.USERNAME, null),
+ requireContext().prefs().getString(C.UI_FOLLOW_BUTTON, "0")?.toIntOrNull() ?: 0,
+ args.channelId,
+ args.channelLogin
+ )
+ }
+ "follow" -> viewModel.saveFollowChannel(
+ requireContext().filesDir.path,
+ TwitchApiHelper.getGQLHeaders(requireContext(), true),
+ requireContext().prefs().getString(C.UI_FOLLOW_BUTTON, "0")?.toIntOrNull() ?: 0,
+ requireContext().tokenPrefs().getString(C.USER_ID, null),
+ args.channelId,
+ args.channelLogin,
+ args.channelName,
+ args.channelLogo,
+ requireContext().prefs().getBoolean(C.LIVE_NOTIFICATIONS_ENABLED, false)
+ )
+ "unfollow" -> viewModel.deleteFollowChannel(
+ TwitchApiHelper.getGQLHeaders(requireContext(), true),
+ requireContext().prefs().getString(C.UI_FOLLOW_BUTTON, "0")?.toIntOrNull() ?: 0,
+ requireContext().tokenPrefs().getString(C.USER_ID, null),
+ args.channelId
+ )
+ "enableNotifications" -> args.channelId?.let {
+ viewModel.enableNotifications(
+ TwitchApiHelper.getGQLHeaders(requireContext(), true),
+ requireContext().prefs().getString(C.UI_FOLLOW_BUTTON, "0")?.toIntOrNull() ?: 0,
+ requireContext().tokenPrefs().getString(C.USER_ID, null),
+ it,
+ requireContext().prefs().getBoolean(C.LIVE_NOTIFICATIONS_ENABLED, false)
+ )
+ }
+ "disableNotifications" -> args.channelId?.let {
+ viewModel.disableNotifications(
+ TwitchApiHelper.getGQLHeaders(requireContext(), true),
+ requireContext().prefs().getString(C.UI_FOLLOW_BUTTON, "0")?.toIntOrNull() ?: 0,
+ requireContext().tokenPrefs().getString(C.USER_ID, null),
+ it
+ )
}
- "follow" -> viewModel.saveFollowChannel(requireContext().filesDir.path, TwitchApiHelper.getGQLHeaders(requireContext(), true), requireContext().prefs().getString(C.UI_FOLLOW_BUTTON, "0")?.toIntOrNull() ?: 0, requireContext().tokenPrefs().getString(C.USER_ID, null), args.channelId, args.channelLogin, args.channelName, args.channelLogo, requireContext().prefs().getBoolean(C.LIVE_NOTIFICATIONS_ENABLED, false))
- "unfollow" -> viewModel.deleteFollowChannel(TwitchApiHelper.getGQLHeaders(requireContext(), true), requireContext().prefs().getString(C.UI_FOLLOW_BUTTON, "0")?.toIntOrNull() ?: 0, requireContext().tokenPrefs().getString(C.USER_ID, null), args.channelId)
- "enableNotifications" -> args.channelId?.let { viewModel.enableNotifications(TwitchApiHelper.getGQLHeaders(requireContext(), true), requireContext().prefs().getString(C.UI_FOLLOW_BUTTON, "0")?.toIntOrNull() ?: 0, requireContext().tokenPrefs().getString(C.USER_ID, null), it, requireContext().prefs().getBoolean(C.LIVE_NOTIFICATIONS_ENABLED, false)) }
- "disableNotifications" -> args.channelId?.let { viewModel.disableNotifications(TwitchApiHelper.getGQLHeaders(requireContext(), true), requireContext().prefs().getString(C.UI_FOLLOW_BUTTON, "0")?.toIntOrNull() ?: 0, requireContext().tokenPrefs().getString(C.USER_ID, null), it) }
}
}
}
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/ui/channel/ChannelPagerViewModel.kt b/app/src/main/java/com/github/andreyasadchy/xtra/ui/channel/ChannelPagerViewModel.kt
index 46cf5c3cc..16c544d2a 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/ui/channel/ChannelPagerViewModel.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/ui/channel/ChannelPagerViewModel.kt
@@ -42,7 +42,8 @@ class ChannelPagerViewModel @Inject constructor(
private val apolloClient: ApolloClient,
private val helixApi: HelixApi,
private val okHttpClient: OkHttpClient,
- savedStateHandle: SavedStateHandle) : ViewModel() {
+ savedStateHandle: SavedStateHandle,
+) : ViewModel() {
val integrity = MutableStateFlow(null)
@@ -78,7 +79,8 @@ class ChannelPagerViewModel @Inject constructor(
viewModelScope.launch {
try {
_user.value = repository.loadUser(args.channelId, args.channelLogin, helixHeaders)
- } catch (e: Exception) {}
+ } catch (e: Exception) {
+ }
}
}
}
@@ -277,7 +279,7 @@ class ChannelPagerViewModel @Inject constructor(
fun updateLocalUser(filesDir: String, user: User) {
if (!updatedLocalUser) {
updatedLocalUser = true
- user.channelId.takeIf { !it.isNullOrBlank()}?.let { userId ->
+ user.channelId.takeIf { !it.isNullOrBlank() }?.let { userId ->
viewModelScope.launch {
val downloadedLogo = user.channelLogo.takeIf { !it.isNullOrBlank() }?.let {
File(filesDir, "profile_pics").mkdir()
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ChatAdapter.kt b/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ChatAdapter.kt
index 9232aa9eb..5ff58a560 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ChatAdapter.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ChatAdapter.kt
@@ -61,7 +61,8 @@ class ChatAdapter(
private val emoteQuality: String,
private val animateGifs: Boolean,
private val enableZeroWidth: Boolean,
- private val channelId: String?) : RecyclerView.Adapter() {
+ private val channelId: String?,
+) : RecyclerView.Adapter() {
var messages: MutableList? = null
set(value) {
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ChatFragment.kt b/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ChatFragment.kt
index 554806c33..eac057ab4 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ChatFragment.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ChatFragment.kt
@@ -48,7 +48,11 @@ class ChatFragment : BaseNetworkFragment(), LifecycleListener, MessageClickedDia
viewLifecycleOwner.lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.STARTED) {
viewModel.integrity.collectLatest {
- if (it != null && it != "done" && requireContext().prefs().getBoolean(C.ENABLE_INTEGRITY, false) && requireContext().prefs().getBoolean(C.USE_WEBVIEW_INTEGRITY, true)) {
+ if (it != null &&
+ it != "done" &&
+ requireContext().prefs().getBoolean(C.ENABLE_INTEGRITY, false) &&
+ requireContext().prefs().getBoolean(C.USE_WEBVIEW_INTEGRITY, true)
+ ) {
IntegrityDialog.show(childFragmentManager, it)
viewModel.integrity.value = "done"
}
@@ -61,7 +65,9 @@ class ChatFragment : BaseNetworkFragment(), LifecycleListener, MessageClickedDia
val channelId = args.getString(KEY_CHANNEL_ID)
val isLive = args.getBoolean(KEY_IS_LIVE)
val accountLogin = requireContext().tokenPrefs().getString(C.USERNAME, null)
- val isLoggedIn = !accountLogin.isNullOrBlank() && (!TwitchApiHelper.getGQLHeaders(requireContext(), true)[C.HEADER_TOKEN].isNullOrBlank() || !TwitchApiHelper.getHelixHeaders(requireContext())[C.HEADER_TOKEN].isNullOrBlank())
+ val isLoggedIn = !accountLogin.isNullOrBlank() &&
+ (!TwitchApiHelper.getGQLHeaders(requireContext(), true)[C.HEADER_TOKEN].isNullOrBlank() ||
+ !TwitchApiHelper.getHelixHeaders(requireContext())[C.HEADER_TOKEN].isNullOrBlank())
val chatUrl = args.getString(KEY_CHAT_URL)
val enableChat: Boolean
if (isLive) {
@@ -81,7 +87,8 @@ class ChatFragment : BaseNetworkFragment(), LifecycleListener, MessageClickedDia
val accountId = requireContext().tokenPrefs().getString(C.USER_ID, null)
val useApiCommands = requireContext().prefs().getBoolean(C.DEBUG_API_COMMANDS, true)
val useApiChatMessages = requireContext().prefs().getBoolean(C.DEBUG_API_CHAT_MESSAGES, false)
- val checkIntegrity = requireContext().prefs().getBoolean(C.ENABLE_INTEGRITY, false) && requireContext().prefs().getBoolean(C.USE_WEBVIEW_INTEGRITY, true)
+ val checkIntegrity = requireContext().prefs().getBoolean(C.ENABLE_INTEGRITY, false) &&
+ requireContext().prefs().getBoolean(C.USE_WEBVIEW_INTEGRITY, true)
chatView.setCallback(object : ChatView.ChatViewCallback {
override fun send(message: CharSequence, replyId: String?) {
viewModel.send(message, replyId, helixHeaders, gqlHeaders, accountId, channelId, channelLogin, useApiCommands, useApiChatMessages, checkIntegrity)
@@ -423,7 +430,10 @@ class ChatFragment : BaseNetworkFragment(), LifecycleListener, MessageClickedDia
}
fun reloadEmotes() {
- viewModel.reloadEmotes(requireArguments().getString(KEY_CHANNEL_ID), requireArguments().getString(KEY_CHANNEL_LOGIN))
+ viewModel.reloadEmotes(
+ requireArguments().getString(KEY_CHANNEL_ID),
+ requireArguments().getString(KEY_CHANNEL_LOGIN)
+ )
}
fun updatePosition(position: Long) {
@@ -452,12 +462,14 @@ class ChatFragment : BaseNetworkFragment(), LifecycleListener, MessageClickedDia
}
private fun onRaidClicked(raid: Raid) {
- (requireActivity() as MainActivity).startStream(Stream(
- channelId = raid.targetId,
- channelLogin = raid.targetLogin,
- channelName = raid.targetName,
- profileImageUrl = raid.targetProfileImage,
- ))
+ (requireActivity() as MainActivity).startStream(
+ Stream(
+ channelId = raid.targetId,
+ channelLogin = raid.targetLogin,
+ channelName = raid.targetName,
+ profileImageUrl = raid.targetProfileImage,
+ )
+ )
}
override fun onCreateMessageClickedChatAdapter(): MessageClickedChatAdapter {
@@ -499,12 +511,14 @@ class ChatFragment : BaseNetworkFragment(), LifecycleListener, MessageClickedDia
}
override fun onViewProfileClicked(id: String?, login: String?, name: String?, channelLogo: String?) {
- findNavController().navigate(ChannelPagerFragmentDirections.actionGlobalChannelPagerFragment(
- channelId = id,
- channelLogin = login,
- channelName = name,
- channelLogo = channelLogo
- ))
+ findNavController().navigate(
+ ChannelPagerFragmentDirections.actionGlobalChannelPagerFragment(
+ channelId = id,
+ channelLogin = login,
+ channelName = name,
+ channelLogo = channelLogo
+ )
+ )
(parentFragment as? BasePlayerFragment)?.minimize()
}
@@ -574,36 +588,42 @@ class ChatFragment : BaseNetworkFragment(), LifecycleListener, MessageClickedDia
private const val KEY_START_TIME_EMPTY = "startTime_empty"
private const val KEY_START_TIME = "startTime"
- fun newInstance(channelId: String?, channelLogin: String?, channelName: String?, streamId: String?) = ChatFragment().apply {
- arguments = Bundle().apply {
- putBoolean(KEY_IS_LIVE, true)
- putString(KEY_CHANNEL_ID, channelId)
- putString(KEY_CHANNEL_LOGIN, channelLogin)
- putString(KEY_CHANNEL_NAME, channelName)
- putString(KEY_STREAM_ID, streamId)
+ fun newInstance(channelId: String?, channelLogin: String?, channelName: String?, streamId: String?): ChatFragment {
+ return ChatFragment().apply {
+ arguments = Bundle().apply {
+ putBoolean(KEY_IS_LIVE, true)
+ putString(KEY_CHANNEL_ID, channelId)
+ putString(KEY_CHANNEL_LOGIN, channelLogin)
+ putString(KEY_CHANNEL_NAME, channelName)
+ putString(KEY_STREAM_ID, streamId)
+ }
}
}
- fun newInstance(channelId: String?, channelLogin: String?, videoId: String?, startTime: Int?) = ChatFragment().apply {
- arguments = Bundle().apply {
- putBoolean(KEY_IS_LIVE, false)
- putString(KEY_CHANNEL_ID, channelId)
- putString(KEY_CHANNEL_LOGIN, channelLogin)
- putString(KEY_VIDEO_ID, videoId)
- if (startTime != null) {
- putBoolean(KEY_START_TIME_EMPTY, false)
- putInt(KEY_START_TIME, startTime)
- } else {
- putBoolean(KEY_START_TIME_EMPTY, true)
+ fun newInstance(channelId: String?, channelLogin: String?, videoId: String?, startTime: Int?): ChatFragment {
+ return ChatFragment().apply {
+ arguments = Bundle().apply {
+ putBoolean(KEY_IS_LIVE, false)
+ putString(KEY_CHANNEL_ID, channelId)
+ putString(KEY_CHANNEL_LOGIN, channelLogin)
+ putString(KEY_VIDEO_ID, videoId)
+ if (startTime != null) {
+ putBoolean(KEY_START_TIME_EMPTY, false)
+ putInt(KEY_START_TIME, startTime)
+ } else {
+ putBoolean(KEY_START_TIME_EMPTY, true)
+ }
}
}
}
- fun newLocalInstance(channelId: String?, channelLogin: String?, chatUrl: String?) = ChatFragment().apply {
- arguments = Bundle().apply {
- putString(KEY_CHANNEL_ID, channelId)
- putString(KEY_CHANNEL_LOGIN, channelLogin)
- putString(KEY_CHAT_URL, chatUrl)
+ fun newLocalInstance(channelId: String?, channelLogin: String?, chatUrl: String?): ChatFragment {
+ return ChatFragment().apply {
+ arguments = Bundle().apply {
+ putString(KEY_CHANNEL_ID, channelId)
+ putString(KEY_CHANNEL_LOGIN, channelLogin)
+ putString(KEY_CHAT_URL, chatUrl)
+ }
}
}
}
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ChatReplayManager.kt b/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ChatReplayManager.kt
index 7581af5b4..26a33e923 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ChatReplayManager.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ChatReplayManager.kt
@@ -25,7 +25,8 @@ class ChatReplayManager @Inject constructor(
private val onMessage: (ChatMessage) -> Unit,
private val clearMessages: () -> Unit,
private val getIntegrityToken: () -> Unit,
- private val coroutineScope: CoroutineScope) {
+ private val coroutineScope: CoroutineScope,
+) {
private var cursor: String? = null
private val list = mutableListOf()
@@ -128,18 +129,20 @@ class ChatReplayManager @Inject constructor(
if (!isActive) {
break
}
- onMessage(ChatMessage(
- id = message.id,
- userId = message.userId,
- userLogin = message.userLogin,
- userName = message.userName,
- message = message.message,
- color = message.color,
- emotes = message.emotes,
- badges = message.badges,
- bits = 0,
- fullMsg = message.fullMsg
- ))
+ onMessage(
+ ChatMessage(
+ id = message.id,
+ userId = message.userId,
+ userLogin = message.userLogin,
+ userName = message.userName,
+ message = message.message,
+ color = message.color,
+ emotes = message.emotes,
+ badges = message.badges,
+ bits = 0,
+ fullMsg = message.fullMsg
+ )
+ )
if (list.size <= 25 && !cursor.isNullOrBlank() && !isLoading) {
load()
}
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ChatReplayManagerLocal.kt b/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ChatReplayManagerLocal.kt
index 1841ed012..8f9580d46 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ChatReplayManagerLocal.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ChatReplayManagerLocal.kt
@@ -18,7 +18,8 @@ class ChatReplayManagerLocal @Inject constructor(
private val getCurrentSpeed: () -> Float?,
private val onMessage: (ChatMessage) -> Unit,
private val clearMessages: () -> Unit,
- private val coroutineScope: CoroutineScope) {
+ private val coroutineScope: CoroutineScope,
+) {
private val list = mutableListOf()
private var isLoading = false
@@ -68,23 +69,25 @@ class ChatReplayManagerLocal @Inject constructor(
if (!isActive) {
break
}
- onMessage(ChatMessage(
- id = message.id,
- userId = message.userId,
- userLogin = message.userLogin,
- userName = message.userName,
- message = message.message,
- color = message.color,
- emotes = message.emotes,
- badges = message.badges,
- isAction = message.isAction,
- isFirst = message.isFirst,
- bits = message.bits,
- systemMsg = message.systemMsg,
- msgId = message.msgId,
- reward = message.reward,
- fullMsg = message.fullMsg
- ))
+ onMessage(
+ ChatMessage(
+ id = message.id,
+ userId = message.userId,
+ userLogin = message.userLogin,
+ userName = message.userName,
+ message = message.message,
+ color = message.color,
+ emotes = message.emotes,
+ badges = message.badges,
+ isAction = message.isAction,
+ isFirst = message.isFirst,
+ bits = message.bits,
+ systemMsg = message.systemMsg,
+ msgId = message.msgId,
+ reward = message.reward,
+ fullMsg = message.fullMsg
+ )
+ )
} else if (!isActive) break
list.remove(message)
}
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ChatView.kt b/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ChatView.kt
index 8b163965e..7cb714320 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ChatView.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ChatView.kt
@@ -309,7 +309,11 @@ class ChatView : ConstraintLayout {
raidLayout.visible()
raidLayout.setOnClickListener { callback?.onRaidClicked(raid) }
raidImage.visible()
- raidImage.loadImage(fragment, raid.targetLogo, circle = context.prefs().getBoolean(C.UI_ROUNDUSERIMAGE, true))
+ raidImage.loadImage(
+ fragment,
+ raid.targetLogo,
+ circle = context.prefs().getBoolean(C.UI_ROUNDUSERIMAGE, true)
+ )
raidText.visible()
raidClose.visible()
raidClose.setOnClickListener {
@@ -785,10 +789,11 @@ class ChatView : ConstraintLayout {
}
inner class AutoCompleteAdapter(
- context: Context,
- private val fragment: Fragment,
- list: List,
- private val emoteQuality: String) : ArrayAdapter(context, 0, list) {
+ context: Context,
+ private val fragment: Fragment,
+ list: List,
+ private val emoteQuality: String,
+ ) : ArrayAdapter(context, 0, list) {
private var mFilter: ArrayFilter? = null
@@ -848,12 +853,16 @@ class ChatView : ConstraintLayout {
}
viewHolder.containerView.apply {
item as Emote
- findViewById(R.id.image)?.loadImage(fragment, when (emoteQuality) {
- "4" -> item.url4x ?: item.url3x ?: item.url2x ?: item.url1x
- "3" -> item.url3x ?: item.url2x ?: item.url1x
- "2" -> item.url2x ?: item.url1x
- else -> item.url1x
- }, diskCacheStrategy = DiskCacheStrategy.DATA)
+ findViewById(R.id.image)?.loadImage(
+ fragment,
+ when (emoteQuality) {
+ "4" -> item.url4x ?: item.url3x ?: item.url2x ?: item.url1x
+ "3" -> item.url3x ?: item.url2x ?: item.url1x
+ "2" -> item.url2x ?: item.url1x
+ else -> item.url1x
+ },
+ diskCacheStrategy = DiskCacheStrategy.DATA
+ )
findViewById(R.id.name)?.text = item.name
}
}
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ChatViewModel.kt b/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ChatViewModel.kt
index 9732fc405..07bef77aa 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ChatViewModel.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ChatViewModel.kt
@@ -64,7 +64,8 @@ class ChatViewModel @Inject constructor(
private val repository: ApiRepository,
private val graphQLRepository: GraphQLRepository,
private val playerRepository: PlayerRepository,
- private val okHttpClient: OkHttpClient) : ViewModel() {
+ private val okHttpClient: OkHttpClient,
+) : ViewModel() {
val integrity = MutableStateFlow(null)
@@ -156,7 +157,9 @@ class ChatViewModel @Inject constructor(
if (applicationContext.prefs().getBoolean(C.CHAT_RECENT, true)) {
loadRecentMessages(channelLogin)
}
- val isLoggedIn = !applicationContext.tokenPrefs().getString(C.USERNAME, null).isNullOrBlank() && (!TwitchApiHelper.getGQLHeaders(applicationContext, true)[C.HEADER_TOKEN].isNullOrBlank() || !TwitchApiHelper.getHelixHeaders(applicationContext)[C.HEADER_TOKEN].isNullOrBlank())
+ val isLoggedIn = !applicationContext.tokenPrefs().getString(C.USERNAME, null).isNullOrBlank() &&
+ (!TwitchApiHelper.getGQLHeaders(applicationContext, true)[C.HEADER_TOKEN].isNullOrBlank() ||
+ !TwitchApiHelper.getHelixHeaders(applicationContext)[C.HEADER_TOKEN].isNullOrBlank())
if (isLoggedIn) {
loadUserEmotes(channelId)
}
@@ -200,7 +203,8 @@ class ChatViewModel @Inject constructor(
val gqlHeaders = TwitchApiHelper.getGQLHeaders(applicationContext, true)
val emoteQuality = applicationContext.prefs().getString(C.CHAT_IMAGE_QUALITY, "4") ?: "4"
val animateGifs = applicationContext.prefs().getBoolean(C.ANIMATED_EMOTES, true)
- val checkIntegrity = applicationContext.prefs().getBoolean(C.ENABLE_INTEGRITY, false) && applicationContext.prefs().getBoolean(C.USE_WEBVIEW_INTEGRITY, true)
+ val checkIntegrity = applicationContext.prefs().getBoolean(C.ENABLE_INTEGRITY, false) &&
+ applicationContext.prefs().getBoolean(C.USE_WEBVIEW_INTEGRITY, true)
savedGlobalBadges.also { saved ->
if (!saved.isNullOrEmpty()) {
_globalBadges.value = saved
@@ -405,22 +409,28 @@ class ChatViewModel @Inject constructor(
private fun loadUserEmotes(channelId: String?) {
savedUserEmotes.also { saved ->
if (!saved.isNullOrEmpty()) {
- addEmotes(saved.map { Emote(
- name = it.name,
- url1x = it.url1x,
- url2x = it.url2x,
- url3x = it.url3x,
- url4x = it.url4x,
- format = it.format
- ) })
- _userEmotes.value = saved.sortedByDescending { it.ownerId == channelId }.map { Emote(
- name = it.name,
- url1x = it.url1x,
- url2x = it.url2x,
- url3x = it.url3x,
- url4x = it.url4x,
- format = it.format
- ) }
+ addEmotes(
+ saved.map {
+ Emote(
+ name = it.name,
+ url1x = it.url1x,
+ url2x = it.url2x,
+ url3x = it.url3x,
+ url4x = it.url4x,
+ format = it.format
+ )
+ }
+ )
+ _userEmotes.value = saved.sortedByDescending { it.ownerId == channelId }.map {
+ Emote(
+ name = it.name,
+ url1x = it.url1x,
+ url2x = it.url2x,
+ url3x = it.url3x,
+ url4x = it.url4x,
+ format = it.format
+ )
+ }
} else {
val helixHeaders = TwitchApiHelper.getHelixHeaders(applicationContext)
val gqlHeaders = TwitchApiHelper.getGQLHeaders(applicationContext, true)
@@ -429,26 +439,33 @@ class ChatViewModel @Inject constructor(
try {
val accountId = applicationContext.tokenPrefs().getString(C.USER_ID, null)
val animateGifs = applicationContext.prefs().getBoolean(C.ANIMATED_EMOTES, true)
- val checkIntegrity = applicationContext.prefs().getBoolean(C.ENABLE_INTEGRITY, false) && applicationContext.prefs().getBoolean(C.USE_WEBVIEW_INTEGRITY, true)
+ val checkIntegrity = applicationContext.prefs().getBoolean(C.ENABLE_INTEGRITY, false) &&
+ applicationContext.prefs().getBoolean(C.USE_WEBVIEW_INTEGRITY, true)
repository.loadUserEmotes(helixHeaders, gqlHeaders, channelId, accountId, animateGifs, checkIntegrity).let { emotes ->
if (emotes.isNotEmpty()) {
val sorted = emotes.sortedByDescending { it.setId }
- addEmotes(sorted.map { Emote(
- name = it.name,
- url1x = it.url1x,
- url2x = it.url2x,
- url3x = it.url3x,
- url4x = it.url4x,
- format = it.format
- ) })
- _userEmotes.value = sorted.sortedByDescending { it.ownerId == channelId }.map { Emote(
- name = it.name,
- url1x = it.url1x,
- url2x = it.url2x,
- url3x = it.url3x,
- url4x = it.url4x,
- format = it.format
- ) }
+ addEmotes(
+ sorted.map {
+ Emote(
+ name = it.name,
+ url1x = it.url1x,
+ url2x = it.url2x,
+ url3x = it.url3x,
+ url4x = it.url4x,
+ format = it.format
+ )
+ }
+ )
+ _userEmotes.value = sorted.sortedByDescending { it.ownerId == channelId }.map {
+ Emote(
+ name = it.name,
+ url1x = it.url1x,
+ url2x = it.url2x,
+ url3x = it.url3x,
+ url4x = it.url4x,
+ format = it.format
+ )
+ }
loadedUserEmotes = true
}
}
@@ -1038,22 +1055,28 @@ class ChatViewModel @Inject constructor(
if (emotes.isNotEmpty()) {
val sorted = emotes.sortedByDescending { it.setId }
savedUserEmotes = sorted
- addEmotes(sorted.map { Emote(
- name = it.name,
- url1x = it.url1x,
- url2x = it.url2x,
- url3x = it.url3x,
- url4x = it.url4x,
- format = it.format
- ) })
- _userEmotes.value = sorted.sortedByDescending { it.ownerId == channelId }.map { Emote(
- name = it.name,
- url1x = it.url1x,
- url2x = it.url2x,
- url3x = it.url3x,
- url4x = it.url4x,
- format = it.format
- ) }
+ addEmotes(
+ sorted.map {
+ Emote(
+ name = it.name,
+ url1x = it.url1x,
+ url2x = it.url2x,
+ url3x = it.url3x,
+ url4x = it.url4x,
+ format = it.format
+ )
+ }
+ )
+ _userEmotes.value = sorted.sortedByDescending { it.ownerId == channelId }.map {
+ Emote(
+ name = it.name,
+ url1x = it.url1x,
+ url2x = it.url2x,
+ url3x = it.url3x,
+ url4x = it.url4x,
+ format = it.format
+ )
+ }
}
} catch (e: Exception) {
Log.e(TAG, "Failed to load emote sets", e)
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/EmotesAdapter.kt b/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/EmotesAdapter.kt
index 98fdf516d..fe5a2b5bb 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/EmotesAdapter.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/EmotesAdapter.kt
@@ -13,32 +13,40 @@ import com.github.andreyasadchy.xtra.model.chat.Emote
import com.github.andreyasadchy.xtra.util.loadImage
class EmotesAdapter(
- private val fragment: Fragment,
- private val clickListener: (Emote) -> Unit,
- private val emoteQuality: String) : ListAdapter(object : DiffUtil.ItemCallback() {
- override fun areItemsTheSame(oldItem: Emote, newItem: Emote): Boolean {
- return oldItem.name == newItem.name
- }
+ private val fragment: Fragment,
+ private val clickListener: (Emote) -> Unit,
+ private val emoteQuality: String,
+) : ListAdapter(
+ object : DiffUtil.ItemCallback() {
+ override fun areItemsTheSame(oldItem: Emote, newItem: Emote): Boolean {
+ return oldItem.name == newItem.name
+ }
- override fun areContentsTheSame(oldItem: Emote, newItem: Emote): Boolean {
- return true
+ override fun areContentsTheSame(oldItem: Emote, newItem: Emote): Boolean {
+ return true
+ }
}
-
-}) {
+) {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
- return object : RecyclerView.ViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.fragment_emotes_list_item, parent, false)) {}
+ return object : RecyclerView.ViewHolder(
+ LayoutInflater.from(parent.context).inflate(R.layout.fragment_emotes_list_item, parent, false)
+ ) {}
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
val emote = getItem(position)
(holder.itemView as ImageView).apply {
- loadImage(fragment, when (emoteQuality) {
- "4" -> emote.url4x ?: emote.url3x ?: emote.url2x ?: emote.url1x
- "3" -> emote.url3x ?: emote.url2x ?: emote.url1x
- "2" -> emote.url2x ?: emote.url1x
- else -> emote.url1x
- }, diskCacheStrategy = DiskCacheStrategy.DATA)
+ loadImage(
+ fragment,
+ when (emoteQuality) {
+ "4" -> emote.url4x ?: emote.url3x ?: emote.url2x ?: emote.url1x
+ "3" -> emote.url3x ?: emote.url2x ?: emote.url1x
+ "2" -> emote.url2x ?: emote.url1x
+ else -> emote.url1x
+ },
+ diskCacheStrategy = DiskCacheStrategy.DATA
+ )
setOnClickListener { clickListener(emote) }
}
}
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/EmotesFragment.kt b/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/EmotesFragment.kt
index 4b49194ab..2457720ce 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/EmotesFragment.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/EmotesFragment.kt
@@ -182,6 +182,12 @@ class EmotesFragment : Fragment() {
companion object {
private const val KEY_POSITION = "position"
- fun newInstance(position: Int) = EmotesFragment().apply { arguments = bundleOf(KEY_POSITION to position) }
+ fun newInstance(position: Int): EmotesFragment {
+ return EmotesFragment().apply {
+ arguments = bundleOf(
+ KEY_POSITION to position
+ )
+ }
+ }
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ImageClickedDialog.kt b/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ImageClickedDialog.kt
index a26a3dad7..90b96e59b 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ImageClickedDialog.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ImageClickedDialog.kt
@@ -51,8 +51,17 @@ class ImageClickedDialog : BottomSheetDialogFragment(), IntegrityDialog.Callback
const val GLOBAL_BTTV = "global_bttv"
const val GLOBAL_FFZ = "global_ffz"
- fun newInstance(url: String?, name: String?, source: String?, format: String?, isAnimated: Boolean?, emoteId: String?) = ImageClickedDialog().apply {
- arguments = bundleOf(IMAGE_URL to url, IMAGE_NAME to name, IMAGE_SOURCE to source, IMAGE_FORMAT to format, IMAGE_ANIMATED to isAnimated, EMOTE_ID to emoteId)
+ fun newInstance(url: String?, name: String?, source: String?, format: String?, isAnimated: Boolean?, emoteId: String?): ImageClickedDialog {
+ return ImageClickedDialog().apply {
+ arguments = bundleOf(
+ IMAGE_URL to url,
+ IMAGE_NAME to name,
+ IMAGE_SOURCE to source,
+ IMAGE_FORMAT to format,
+ IMAGE_ANIMATED to isAnimated,
+ EMOTE_ID to emoteId
+ )
+ }
}
}
@@ -73,7 +82,11 @@ class ImageClickedDialog : BottomSheetDialogFragment(), IntegrityDialog.Callback
viewLifecycleOwner.lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.STARTED) {
viewModel.integrity.collectLatest {
- if (it != null && it != "done" && requireContext().prefs().getBoolean(C.ENABLE_INTEGRITY, false) && requireContext().prefs().getBoolean(C.USE_WEBVIEW_INTEGRITY, true)) {
+ if (it != null &&
+ it != "done" &&
+ requireContext().prefs().getBoolean(C.ENABLE_INTEGRITY, false) &&
+ requireContext().prefs().getBoolean(C.USE_WEBVIEW_INTEGRITY, true)
+ ) {
IntegrityDialog.show(childFragmentManager, it)
viewModel.integrity.value = "done"
}
@@ -85,16 +98,18 @@ class ImageClickedDialog : BottomSheetDialogFragment(), IntegrityDialog.Callback
val imageLibrary = requireContext().prefs().getString(C.CHAT_IMAGE_LIBRARY, "0")
if (imageLibrary == "0" || (imageLibrary == "1" && !args.getString(IMAGE_FORMAT).equals("webp", true))) {
requireContext().imageLoader.enqueue(
- ImageRequest.Builder(requireContext())
- .data(args.getString(IMAGE_URL))
- .target(onSuccess = {
- val result = it.asDrawable(resources)
- if (result is Animatable && args.getBoolean(IMAGE_ANIMATED) && requireContext().prefs().getBoolean(C.ANIMATED_EMOTES, true)) {
- (result as Animatable).start()
+ ImageRequest.Builder(requireContext()).apply {
+ data(args.getString(IMAGE_URL))
+ target(
+ onSuccess = {
+ val result = it.asDrawable(resources)
+ if (result is Animatable && args.getBoolean(IMAGE_ANIMATED) && requireContext().prefs().getBoolean(C.ANIMATED_EMOTES, true)) {
+ (result as Animatable).start()
+ }
+ image.setImageDrawable(result)
}
- image.setImageDrawable(result)
- })
- .build()
+ )
+ }.build()
)
} else {
Glide.with(this@ImageClickedDialog)
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ImageClickedViewModel.kt b/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ImageClickedViewModel.kt
index cdc9c25da..5e296711e 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ImageClickedViewModel.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/ImageClickedViewModel.kt
@@ -10,7 +10,9 @@ import kotlinx.coroutines.launch
import javax.inject.Inject
@HiltViewModel
-class ImageClickedViewModel @Inject constructor(private val graphQLRepository: GraphQLRepository) : ViewModel() {
+class ImageClickedViewModel @Inject constructor(
+ private val graphQLRepository: GraphQLRepository,
+) : ViewModel() {
val integrity = MutableStateFlow(null)
diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/MessageClickedChatAdapter.kt b/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/MessageClickedChatAdapter.kt
index 3522cb241..8c29b31b5 100644
--- a/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/MessageClickedChatAdapter.kt
+++ b/app/src/main/java/com/github/andreyasadchy/xtra/ui/chat/MessageClickedChatAdapter.kt
@@ -78,15 +78,19 @@ class MessageClickedChatAdapter(
var globalBadges: List?,
var channelBadges: List