Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Room Park Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladislav Bogdashkin
Room Park Android
Commits
09ccdde3
Commit
09ccdde3
authored
Nov 20, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get feeds worklflow
parent
2ca86258
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
16 additions
and
14 deletions
+16
-14
FeedsRepository.kt
...nto/visual/roompark/data/data_provider/FeedsRepository.kt
+2
-0
RequeryRepository.kt
.../roompark/data/repository/db/requrey/RequeryRepository.kt
+1
-1
Article.kt
...sual/roompark/data/repository/db/requrey/model/Article.kt
+2
-2
Feed.kt
.../visual/roompark/data/repository/db/requrey/model/Feed.kt
+3
-3
UserSession.kt
.../visual/roompark/data/service/user_session/UserSession.kt
+3
-4
CustomException.kt
...isual/roompark/domain/custom_exception/CustomException.kt
+2
-2
feeds.kt
...va/com/biganto/visual/roompark/domain/interactor/feeds.kt
+3
-2
No files found.
app/src/main/java/com/biganto/visual/roompark/data/data_provider/FeedsRepository.kt
View file @
09ccdde3
...
...
@@ -13,6 +13,7 @@ import io.reactivex.Observable
import
io.reactivex.Single
import
io.reactivex.schedulers.Schedulers
import
timber.log.Timber
import
timber.log.Timber.e
import
javax.inject.Inject
/**
...
...
@@ -31,6 +32,7 @@ class FeedsContractModule @Inject constructor(
override
fun
fetchFeeds
():
Observable
<
List
<
FeedModel
>>
=
fetchAllFeeds
(
session
.
token
)
.
doOnError
(
::
e
)
override
fun
fetchFeedObservable
(
id
:
Int
):
Observable
<
ArticlesPreviewModel
>
{
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/RequeryRepository.kt
View file @
09ccdde3
...
...
@@ -30,7 +30,7 @@ class DbModule{
Timber
.
d
(
"Kotlin store creating.."
)
val
source
=
DatabaseSource
(
context
,
Models
.
DEFAULT
,
"BigantoPerfect"
,
DATABASE_VERSION
)
source
.
setLoggingEnabled
(
fals
e
)
source
.
setLoggingEnabled
(
tru
e
)
val
store
=
KotlinEntityDataStore
<
Persistable
>(
source
.
configuration
)
Timber
.
d
(
"Kotlin store %s"
,
source
)
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/model/Article.kt
View file @
09ccdde3
...
...
@@ -22,9 +22,9 @@ interface Article : Persistable {
val
preview
:
String
?
@get
:
Nullable
val
body
:
String
?
@get
:
ForeignKey
(
references
=
Feed
::
class
,
referencedColumn
=
"alias"
)
//
@get:ForeignKey(references = Feed::class, referencedColumn = "alias")
@get
:
ManyToOne
val
feed
:
Feed
val
feed
:
Feed
?
@get
:
Convert
(
TitledPhotoListConverter
::
class
)
val
photo
:
List
<
TitledPhoto
>?
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/model/Feed.kt
View file @
09ccdde3
...
...
@@ -13,9 +13,9 @@ interface Feed : Persistable {
@get
:
Key
val
id
:
Int
val
title
:
String
@get
:
Key
//
@get:Key
val
alias
:
String
@get
:
OneToMany
(
mappedBy
=
"id
"
)
@get
:
Nullable
@get
:
JunctionTable
(
name
=
"FeedArticlesRule
"
)
@get
:
OneToMany
(
cascade
=
arrayOf
(
CascadeAction
.
DELETE
))
val
articles
:
Set
<
Article
>?
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/service/user_session/UserSession.kt
View file @
09ccdde3
...
...
@@ -21,8 +21,7 @@ class UserSessionService @Inject constructor(
private
var
_token
:
String
?
=
null
override
val
token
=
_token
?:
throw
CustomApiException
.
UnknownCustomApiException
(-
1
,
R
.
string
.
unauthorized_user_request
)
override
val
token
=
_token
?:
""
val
disposable
=
...
...
@@ -51,9 +50,9 @@ class UserSessionService @Inject constructor(
is
UserState
.
Authenticated
->
it
.
uuid
is
UserState
.
NotAuthenticated
->
CustomApiException
.
UnknownCustomApiException
(-
1
,
R
.
string
.
unauthorized_user_request
)
.
UnknownCustomApiException
(-
1
,
R
.
string
.
unauthorized_user_request
,
null
)
else
->
CustomApiException
.
UnknownCustomApiException
(-
1
,
R
.
string
.
unauthorized_user_request
)
.
UnknownCustomApiException
(-
1
,
R
.
string
.
unauthorized_user_request
,
null
)
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/domain/custom_exception/CustomException.kt
View file @
09ccdde3
...
...
@@ -128,14 +128,14 @@ sealed class CustomApiException(val code:Int,@StringRes val messageStringId: In
class
TourByIdNotFoundException
()
:
CustomApiException
(
CUSTOM_API_ERROR_RESPONSE_CODE_TOUR_NOT_FOUND
,
messageStringId
=
CUSTOM_API_ERROR_RESPONSE_CODE_TOUR_NOT_FOUND_MESSAGE_ID
)
class
UnknownCustomApiException
(
code
:
Int
,
@StringRes
messageStringId
:
Int
?)
class
UnknownCustomApiException
(
code
:
Int
,
@StringRes
messageStringId
:
Int
?
,
apiMessage
:
String
?
)
:
CustomApiException
(
code
,
messageStringId
,
apiMessage
)
}
//as an agreement error message should be correct for user (and localized, if needed) on server-side
fun
parseException
(
err
:
ErrorRaw
)
=
CustomApiException
.
UnknownCustomApiException
(
err
.
code
,
null
)
CustomApiException
.
UnknownCustomApiException
(
err
.
code
,
null
,
err
.
message
)
app/src/main/java/com/biganto/visual/roompark/domain/interactor/feeds.kt
View file @
09ccdde3
...
...
@@ -2,6 +2,7 @@ package com.biganto.visual.roompark.domain.interactor
import
com.biganto.visual.roompark.domain.model.*
import
com.biganto.visual.roompark.domain.use_case.FeedUseCase
import
io.reactivex.Observable
import
io.reactivex.Single
import
java.util.*
import
javax.inject.Inject
...
...
@@ -14,10 +15,10 @@ class FeedsInteractor @Inject constructor(
private
val
feedsUseCase
:
FeedUseCase
)
{
fun
fetchTopFeeds
():
Sing
le
<
FeedsHeaderModel
>
=
fun
fetchTopFeeds
():
Observab
le
<
FeedsHeaderModel
>
=
feedsUseCase
.
getFeeds
().
map
{
FeedsHeaderModel
(
it
)
}
.
single
(
FeedsHeaderModel
(
arrayListOf
()))
}
//Single.just(testFeeds)
fun
fetchArticles
(
feedId
:
Int
):
Single
<
ArticlesPreviewModel
>
=
Single
.
just
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment