Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
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
db683550
Commit
db683550
authored
Apr 03, 2020
by
Vladislav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add biganto api:
parent
9030fa1c
Changes
23
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
449 additions
and
153 deletions
+449
-153
AlbumsRepository.kt
...to/visual/roompark/data/data_provider/AlbumsRepository.kt
+1
-1
AuthRepository.kt
...anto/visual/roompark/data/data_provider/AuthRepository.kt
+1
-1
EstateRepository.kt
...to/visual/roompark/data/data_provider/EstateRepository.kt
+1
-1
FeedsRepository.kt
...nto/visual/roompark/data/data_provider/FeedsRepository.kt
+1
-1
FilesRepository.kt
...nto/visual/roompark/data/data_provider/FilesRepository.kt
+1
-1
SubscriptionRepository.kt
...ual/roompark/data/data_provider/SubscriptionRepository.kt
+1
-1
BigantoRetrofitRepository.kt
.../data/repository/api/biganto/BigantoRetrofitRepository.kt
+115
-0
IBigantoApi.kt
...isual/roompark/data/repository/api/biganto/IBigantoApi.kt
+26
-0
IBigantoMobileApi.kt
...roompark/data/repository/api/biganto/IBigantoMobileApi.kt
+142
-0
RawData.kt
...isual/roompark/data/repository/api/biganto/raw/RawData.kt
+104
-0
RetrofitModule.kt
...oompark/data/repository/api/retrofit/di/RetrofitModule.kt
+20
-3
CustomExceptionDeserializer.kt
...pository/api/retrofit/util/CustomExceptionDeserializer.kt
+1
-1
ErrorsListDeserializer.kt
...ta/repository/api/retrofit/util/ErrorsListDeserializer.kt
+1
-1
IApi.kt
...nto/visual/roompark/data/repository/api/room_park/IApi.kt
+2
-6
IRoomParkMobileApi.kt
...mpark/data/repository/api/room_park/IRoomParkMobileApi.kt
+4
-4
RetrofitRepository.kt
...mpark/data/repository/api/room_park/RetrofitRepository.kt
+4
-4
response.kt
...al/roompark/data/repository/api/room_park/raw/response.kt
+1
-1
raw2entity.kt
...anto/visual/roompark/data/repository/mapper/raw2entity.kt
+1
-1
AppVersionManager.kt
...oompark/data/service/version_control/AppVersionManager.kt
+1
-1
AppComponent.kt
...ava/com/biganto/visual/roompark/di/dagger/AppComponent.kt
+5
-42
DataModule.kt
.../java/com/biganto/visual/roompark/di/dagger/DataModule.kt
+13
-80
CustomException.kt
...isual/roompark/domain/custom_exception/CustomException.kt
+1
-1
webCamList.kt
...va/com/biganto/visual/roompark/domain/model/webCamList.kt
+2
-2
No files found.
app/src/main/java/com/biganto/visual/roompark/data/data_provider/AlbumsRepository.kt
View file @
db683550
package
com.biganto.visual.roompark.data.data_provider
import
com.biganto.visual.roompark.data.repository.api.IRoomParkApi
import
com.biganto.visual.roompark.data.repository.api.
room_park.
IRoomParkApi
import
com.biganto.visual.roompark.data.repository.db.IDb
import
com.biganto.visual.roompark.data.repository.db.requrey.model.ImageAlbumJunctionEntity
import
com.biganto.visual.roompark.data.repository.mapper.fromRaw
...
...
app/src/main/java/com/biganto/visual/roompark/data/data_provider/AuthRepository.kt
View file @
db683550
...
...
@@ -2,7 +2,7 @@ package com.biganto.visual.roompark.data.data_provider
import
com.biganto.visual.androidplayer.data.repository.local.ILocalStore
import
com.biganto.visual.roompark.data.local.UserState
import
com.biganto.visual.roompark.data.repository.api.IRoomParkApi
import
com.biganto.visual.roompark.data.repository.api.
room_park.
IRoomParkApi
import
com.biganto.visual.roompark.data.repository.db.IDb
import
com.biganto.visual.roompark.data.repository.db.requrey.model.UserEntity
import
com.biganto.visual.roompark.data.repository.mapper.fromRaw
...
...
app/src/main/java/com/biganto/visual/roompark/data/data_provider/EstateRepository.kt
View file @
db683550
...
...
@@ -2,7 +2,7 @@ package com.biganto.visual.roompark.data.data_provider
import
com.biganto.visual.androidplayer.data.repository.local.ILocalStore
import
com.biganto.visual.roompark.data.local.UserState
import
com.biganto.visual.roompark.data.repository.api.IRoomParkApi
import
com.biganto.visual.roompark.data.repository.api.
room_park.
IRoomParkApi
import
com.biganto.visual.roompark.data.repository.db.IDb
import
com.biganto.visual.roompark.data.repository.db.requrey.model.DealEntity
import
com.biganto.visual.roompark.data.repository.db.requrey.model.EstateEntity
...
...
app/src/main/java/com/biganto/visual/roompark/data/data_provider/FeedsRepository.kt
View file @
db683550
package
com.biganto.visual.roompark.data.data_provider
import
com.biganto.visual.roompark.data.repository.api.IRoomParkApi
import
com.biganto.visual.roompark.data.repository.api.
room_park.
IRoomParkApi
import
com.biganto.visual.roompark.data.repository.db.IDb
import
com.biganto.visual.roompark.data.repository.db.requrey.model.ArticleEntity
import
com.biganto.visual.roompark.data.repository.mapper.fromRaw
...
...
app/src/main/java/com/biganto/visual/roompark/data/data_provider/FilesRepository.kt
View file @
db683550
package
com.biganto.visual.roompark.data.data_provider
import
android.app.Application
import
com.biganto.visual.roompark.data.repository.api.IRoomParkApi
import
com.biganto.visual.roompark.data.repository.api.
room_park.
IRoomParkApi
import
com.biganto.visual.roompark.data.repository.db.IDb
import
com.biganto.visual.roompark.data.repository.file.FileModule
import
com.biganto.visual.roompark.domain.contract.FilesContract
...
...
app/src/main/java/com/biganto/visual/roompark/data/data_provider/SubscriptionRepository.kt
View file @
db683550
package
com.biganto.visual.roompark.data.data_provider
import
com.biganto.visual.roompark.data.repository.api.IRoomParkApi
import
com.biganto.visual.roompark.data.repository.api.
room_park.
IRoomParkApi
import
com.biganto.visual.roompark.data.repository.db.IDb
import
com.biganto.visual.roompark.data.repository.db.requrey.model.SubscriptionEntity
import
com.biganto.visual.roompark.data.repository.db.requrey.model.UserEntity
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/api/biganto/BigantoRetrofitRepository.kt
0 → 100644
View file @
db683550
package
com.biganto.visual.roompark.data.repository.api.biganto
import
com.biganto.visual.roompark.data.repository.api.biganto.raw.TourFilesDataRaw
import
com.biganto.visual.roompark.data.repository.api.biganto.raw.TourPreviewRaw
import
io.reactivex.*
import
io.reactivex.schedulers.Schedulers
import
okhttp3.HttpUrl
import
okhttp3.ResponseBody
import
retrofit2.Response
import
retrofit2.Retrofit
import
timber.log.Timber
import
timber.log.Timber.e
import
javax.inject.Singleton
/**
* Created by Vladislav Bogdashkin on 13.06.2018.
*/
@Singleton
class
BigantoRetrofitRepository
(
retrofit
:
Retrofit
)
:
IBigantoApi
{
private
val
api
=
retrofit
.
create
(
IBigantoMobileApi
::
class
.
java
)
override
fun
provideHttpUrl
():
HttpUrl
{
return
HttpUrl
.
parse
(
IBigantoMobileApi
.
BASE_URL
)
!!
}
override
fun
getAppVersion
()
=
api
.
getAppVersion
()
.
compose
(
RetrofitResponseValidation
())
override
fun
getToursPreviewById
(
tourIds
:
List
<
String
>):
Observable
<
List
<
TourPreviewRaw
>>
{
return
api
.
getToursPreviewById
(
ids
=
tourIds
.
joinToString
(
","
))
.
compose
(
RetrofitResponseValidation
())
.
subscribeOn
(
Schedulers
.
io
())
}
override
fun
getTourMetaAsString
(
tour_id
:
String
):
Observable
<
String
>
=
api
.
getTourMetaAsString
(
ids
=
tour_id
)
.
map
{
it
.
toString
()
}
.
doOnError
{
Timber
.
e
(
it
)
}
.
subscribeOn
(
Schedulers
.
io
())
override
fun
getTourFiles
(
tour_id
:
String
,
resolution
:
String
):
Observable
<
List
<
TourFilesDataRaw
>>
=
api
.
getTourFiles
(
ids
=
tour_id
,
resolution
=
resolution
)
.
compose
(
RetrofitResponseValidation
())
.
doOnError
{
Timber
.
e
(
it
)
}
.
subscribeOn
(
Schedulers
.
io
())
override
fun
downloadFile
(
uri
:
String
,
headers
:
Map
<
String
,
String
>?):
Flowable
<
ResponseBody
>
=
api
.
requestFile
(
headers
?:
HashMap
<
String
,
String
>(),
uri
)
.
compose
(
FlowableRetrofitResponseValidation
())
.
doOnError
(
::
e
)
}
internal
class
RetrofitResponseValidation
<
T
>
:
ObservableTransformer
<
Response
<
T
>,
T
>
{
override
fun
apply
(
responseObservable
:
Observable
<
Response
<
T
>>):
ObservableSource
<
T
>
{
return
responseObservable
.
switchMap
{
resp
->
// Timber.d("reutrned code: %s",resp.code())
if
(
resp
.
code
()
==
200
||
resp
.
code
()
==
206
)
if
(
resp
.
body
()
==
null
)
return
@switchMap
Completable
.
complete
().
toObservable
<
T
>().
doOnNext
{
Timber
.
d
(
"Completed responseBody"
)}
else
return
@switchMap
Observable
.
just
(
resp
.
body
())
Timber
.
d
(
"Returning Exception!"
)
return
@switchMap
Observable
.
error
<
T
>(
retrofit2
.
HttpException
(
resp
))
}
}
}
internal
class
RetrofitResponseValidationString
<
String
>
:
ObservableTransformer
<
Response
<
String
>,
String
>
{
override
fun
apply
(
responseObservable
:
Observable
<
Response
<
String
>>):
ObservableSource
<
String
>
{
return
responseObservable
.
switchMap
<
String
>
{
resp
->
// Timber.d("reutrned code: %s",resp.code())
if
(
resp
.
code
()
==
200
)
if
(
resp
.
body
()
==
null
)
return
@switchMap
Completable
.
complete
().
toObservable
<
String
>().
doOnNext
{
Timber
.
d
(
"Completed responseBody"
)}
else
return
@switchMap
Observable
.
just
<
String
>(
resp
.
body
())
Timber
.
d
(
"Returning Exception!"
)
return
@switchMap
Observable
.
error
<
String
>(
retrofit2
.
HttpException
(
resp
))
}
}
}
internal
class
FlowableRetrofitResponseValidation
<
T
>
:
FlowableTransformer
<
Response
<
T
>,
T
>
{
override
fun
apply
(
responseObservable
:
Flowable
<
Response
<
T
>>):
Flowable
<
T
>
{
return
responseObservable
.
switchMap
{
resp
->
if
(
resp
.
code
()
==
200
||
resp
.
code
()
==
206
)
if
(
resp
.
body
()
==
null
)
return
@switchMap
Completable
.
complete
().
toFlowable
<
T
>().
doOnNext
{
Timber
.
d
(
"Completed responseBody"
)}
else
return
@switchMap
Flowable
.
just
(
resp
.
body
())
Timber
.
d
(
"Returning Exception!"
)
return
@switchMap
Flowable
.
error
<
T
>(
retrofit2
.
HttpException
(
resp
))
}
}
}
//Allow to override HttpException with custom exception output, example:
//sealed class CustomApiException(val code:Int,val biganto_message:String):RuntimeException()
//{
// class RedirectException():CustomApiException(code = 300,biganto_message = "Redirect page..")
// class WrongAuthDataException():CustomApiException(code = 401,biganto_message = "Login or password not allowed")
// class BlockedUserException():CustomApiException(code = 403,biganto_message = "User has been banned")
// class ServerException():CustomApiException(code = 500,biganto_message = "Error server: undefined")
//
//}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/repository/api/biganto/IBigantoApi.kt
0 → 100644
View file @
db683550
package
com.biganto.visual.roompark.data.repository.api.biganto
import
com.biganto.visual.roompark.data.repository.api.biganto.raw.AppVersionRaw
import
com.biganto.visual.roompark.data.repository.api.biganto.raw.TourFilesDataRaw
import
com.biganto.visual.roompark.data.repository.api.biganto.raw.TourPreviewRaw
import
io.reactivex.Flowable
import
io.reactivex.Observable
import
okhttp3.HttpUrl
import
okhttp3.ResponseBody
/**
* Created by Vladislav Bogdashkin on 13.06.2018.
*/
interface
IBigantoApi
{
fun
provideHttpUrl
():
HttpUrl
fun
downloadFile
(
uri
:
String
,
headers
:
Map
<
String
,
String
>?):
Flowable
<
ResponseBody
>
// fun getToursFiles(tour_ids: List<Int>, resolution: String): Flowable<Map<String, List<TourFileRaw>>>?
fun
getTourMetaAsString
(
tour_id
:
String
):
Observable
<
String
>?
fun
getTourFiles
(
tour_id
:
String
,
resolution
:
String
):
Observable
<
List
<
TourFilesDataRaw
>>
fun
getAppVersion
():
Observable
<
AppVersionRaw
>
fun
getToursPreviewById
(
tourIds
:
List
<
String
>):
Observable
<
List
<
TourPreviewRaw
>>
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/repository/api/biganto/IBigantoMobileApi.kt
0 → 100644
View file @
db683550
package
com.biganto.visual.roompark.data.repository.api.biganto
import
com.biganto.visual.roompark.data.repository.api.biganto.raw.AppVersionRaw
import
com.biganto.visual.roompark.data.repository.api.biganto.raw.TourFilesDataRaw
import
com.biganto.visual.roompark.data.repository.api.biganto.raw.TourPreviewRaw
import
com.google.gson.JsonArray
import
io.reactivex.Flowable
import
io.reactivex.Observable
import
okhttp3.ResponseBody
import
retrofit2.Response
import
retrofit2.http.*
import
java.util.*
/**
* Created by Vladislav Bogdashkin on 13.06.2018.
*/
interface
IBigantoMobileApi
{
companion
object
{
//const val BASE_URL="http://local.biganto.com"
const
val
BASE_URL
=
"https://biganto.com"
//const val API_URL="api-novus/"
const
val
API_URL
=
"api/"
const
val
DELIMITER
=
"?"
const
val
CLIENT_TYPE_PARAM
=
"client"
const
val
CLIENT_VERSION_PARAM
=
"client_version"
const
val
API_VERSION_PARAM
=
"v"
const
val
AUTH_TOKEN
=
"auth_token"
const
val
LANG_PARAM
=
"lang"
const
val
DEFAULT_LANG_VALUE
=
"en"
const
val
DEFAULT_CLIENT_TYPE
=
"androidplayer"
//const val DEFAULT_CLIENT_TYPE="iosplayer"
const
val
OLD_CLIENT_TYPE
=
"mobileplayer"
const
val
DEFAULT_CLIENT_VERSION
=
"3.0"
const
val
DEFAULT_API_VERSION
=
"2.0"
//region AppInfo
const
val
GET_APP_VERSION
=
"misc.appVersion"
//endregion
//region Authentication
const
val
AUTH_METHOD
=
"users/login/"
const
val
AUTH_METHOD_2_0
=
"users.authorize"
const
val
AUTH_LOGIN_PARAM
=
"email"
const
val
AUTH_PASSWORD_PARAM
=
"password"
//endregion
//region GetEstates
const
val
GET_ESTATES_METHOD
=
"estates.getList"
//endregion
//region Portfolio
const
val
GET_PORTFOLIO_ESTATES_METHOD
=
"portfolio.getEstates"
const
val
GET_PORTFOLIO_TOURS_METHOD
=
"portfolio.getTours"
//endregion
//region GetToursPreview
const
val
GET_TOURS_METHOD
=
"tours.getBadges"
//"tours.getList"
//const val PARENT_ESTATE_PARAM="id"
const
val
PARENT_ESTATE_PARAM
=
"estate_id"
const
val
TOURS_BY_ID_PARAM
=
"id"
const
val
TOURS_TYPES_PARAM
=
"types"
const
val
DEFAULT_SUPPORTED_TOURS_TYPES
=
"virtual,real"
//endregion
//region GetToursMeta
const
val
GET_TOURS_META_METHOD
=
"tours.getMeta"
const
val
GET_TOURS_META_ID
=
"id"
//endregion
//region GetFiles
const
val
GET_TOURS_FILES_METHOD
=
"tours.getFiles"
const
val
GET_TOURS_FILES_ID
=
"id"
const
val
GET_TOURS_FILES_RESOLUTION
=
"resolution"
//endregion
}
@GET
(
"$API_URL$GET_TOURS_METHOD$DELIMITER"
)
fun
getToursPreviewById
(
@Query
(
CLIENT_TYPE_PARAM
)
clientType
:
String
=
DEFAULT_CLIENT_TYPE
,
@Query
(
CLIENT_VERSION_PARAM
)
clientVersion
:
String
=
DEFAULT_CLIENT_VERSION
,
@Query
(
API_VERSION_PARAM
)
apiVersion
:
String
=
DEFAULT_API_VERSION
,
@Query
(
LANG_PARAM
)
languageCode
:
String
=
Locale
.
getDefault
().
language
,
@Query
(
TOURS_TYPES_PARAM
)
toursTypes
:
String
=
DEFAULT_SUPPORTED_TOURS_TYPES
,
@Query
(
TOURS_BY_ID_PARAM
)
ids
:
String
):
Observable
<
Response
<
List
<
TourPreviewRaw
>>>
@GET
(
"$API_URL$GET_TOURS_META_METHOD$DELIMITER"
)
fun
getTourMetaAsString
(
@Query
(
CLIENT_TYPE_PARAM
)
clientType
:
String
=
DEFAULT_CLIENT_TYPE
,
@Query
(
CLIENT_VERSION_PARAM
)
clientVersion
:
String
=
DEFAULT_CLIENT_VERSION
,
@Query
(
API_VERSION_PARAM
)
apiVersion
:
String
=
DEFAULT_API_VERSION
,
@Query
(
LANG_PARAM
)
languageCode
:
String
=
Locale
.
getDefault
().
language
,
@Query
(
GET_TOURS_META_ID
)
ids
:
String
):
Observable
<
JsonArray
>
@GET
(
"$API_URL$GET_TOURS_FILES_METHOD$DELIMITER"
)
fun
getTourFiles
(
@Query
(
CLIENT_TYPE_PARAM
)
clientType
:
String
=
DEFAULT_CLIENT_TYPE
,
@Query
(
CLIENT_VERSION_PARAM
)
clientVersion
:
String
=
DEFAULT_CLIENT_VERSION
,
@Query
(
API_VERSION_PARAM
)
apiVersion
:
String
=
DEFAULT_API_VERSION
,
@Query
(
LANG_PARAM
)
languageCode
:
String
=
Locale
.
getDefault
().
language
,
@Query
(
GET_TOURS_FILES_ID
)
ids
:
String
,
@Query
(
GET_TOURS_FILES_RESOLUTION
)
resolution
:
String
):
Observable
<
Response
<
List
<
TourFilesDataRaw
>>>
@GET
(
"$API_URL$GET_APP_VERSION$DELIMITER"
)
fun
getAppVersion
(
@Query
(
CLIENT_TYPE_PARAM
)
clientType
:
String
=
DEFAULT_CLIENT_TYPE
,
@Query
(
CLIENT_VERSION_PARAM
)
clientVersion
:
String
=
DEFAULT_CLIENT_VERSION
,
@Query
(
API_VERSION_PARAM
)
apiVersion
:
String
=
DEFAULT_API_VERSION
,
@Query
(
LANG_PARAM
)
languageCode
:
String
=
Locale
.
getDefault
().
language
):
Observable
<
Response
<
AppVersionRaw
>>
@Streaming
@GET
fun
requestFile
(
@HeaderMap
headers
:
Map
<
String
,
String
>?,
@Url
fileUrl
:
String
):
Flowable
<
Response
<
ResponseBody
>>
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/repository/api/biganto/raw/RawData.kt
0 → 100644
View file @
db683550
package
com.biganto.visual.roompark.data.repository.api.biganto.raw
import
java.util.*
/**
* Created by Vladislav Bogdashkin on 09.06.2018.
*/
data class
ErrorRaw
(
val
code
:
Int
,
val
message
:
String
)
data class
EstatesRaw
(
val
estates
:
List
<
EstateRaw
>,
val
errors
:
List
<
ErrorRaw
>?
)
data class
EstatesRoomParkRaw
(
val
estates
:
Map
<
String
,
EstateRoomParkRaw
>,
val
errors
:
List
<
ErrorRaw
>?
)
data class
EstateRoomParkRaw
(
val
avaliable
:
Boolean
,
val
long
:
String
,
//->long name
val
short
:
String
//->short name
)
data class
TourOverviewsRoomParkRaw
(
val
tours
:
List
<
TourOverviewRoomParkRaw
>,
val
errors
:
List
<
ErrorRaw
>?
)
data class
TourOverviewRoomParkRaw
(
val
hidden
:
Boolean
,
val
id
:
String
,
val
preview
:
String
,
val
title
:
String
,
val
url
:
String
)
data class
EstateRaw
(
val
id
:
Int
,
val
created
:
Date
,
val
title
:
String
,
val
preview
:
String
?,
val
cnt_tours
:
Int
,
val
errors
:
List
<
ErrorRaw
>?
)
data class
ToursPreviewRaw
(
val
list
:
List
<
TourPreviewRaw
>,
val
errors
:
List
<
ErrorRaw
>?
)
data class
TourPreviewRaw
(
val
id
:
Int
,
val
created
:
Date
,
val
updated
:
Date
,
val
type
:
String
,
val
title
:
String
,
val
preview
:
String
,
val
screen
:
String
,
val
hidden
:
Boolean
,
val
resolutions
:
List
<
Int
>?,
val
features
:
List
<
String
>?,
val
errors
:
List
<
ErrorRaw
>?
)
data class
TourFileRaw
(
val
size
:
Long
,
val
url
:
String
,
val
errors
:
List
<
ErrorRaw
>?
)
data class
TourFilesDataRaw
(
val
files
:
List
<
TourFileRaw
>,
val
id
:
Int
,
val
resolution
:
Int
,
val
total_size
:
Long
,
val
errors
:
List
<
ErrorRaw
>?
)
data class
TourGetFilesRaw
(
val
data
:
Map
<
String
,
List
<
TourFileRaw
>>,
val
errors
:
List
<
ErrorRaw
>?
)
data class
AppVersionRaw
(
val
current_version
:
String
,
val
download_url
:
String
?,
val
message
:
String
?,
val
critical
:
Boolean
,
val
errors
:
List
<
ErrorRaw
>?
)
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/repository/api/retrofit/di/RetrofitModule.kt
View file @
db683550
package
com.biganto.visual.roompark.data.repository.api.retrofit.di
import
android.app.Application
import
com.biganto.visual.roompark.data.repository.api.retrofit.IRoomParkMobileApi
import
com.biganto.visual.roompark.data.repository.api.
retrofit.raw.ErrorRaw
import
android.content.Context
import
com.biganto.visual.roompark.data.repository.api.
biganto.IBigantoMobileApi
import
com.biganto.visual.roompark.data.repository.api.retrofit.util.*
import
com.biganto.visual.roompark.data.repository.api.room_park.IRoomParkMobileApi
import
com.biganto.visual.roompark.data.repository.api.room_park.raw.ErrorRaw
import
com.biganto.visual.roompark.data.service.network.INetworkMonitor
import
com.biganto.visual.roompark.data.service.network.LiveNetworkMonitor
import
com.biganto.visual.roompark.data.service.network.NoNetworkException
...
...
@@ -22,6 +24,7 @@ import retrofit2.converter.scalars.ScalarsConverterFactory
import
timber.log.Timber
import
java.util.*
import
java.util.concurrent.TimeUnit
import
javax.inject.Named
import
javax.inject.Singleton
/**
...
...
@@ -102,7 +105,7 @@ class RetrofitModule{
@Provides
@Singleton
//
@Named("roomParkApi")
@Named
(
"roomParkApi"
)
fun
provideRetrofitRoomParkApi
(
context
:
Application
):
Retrofit
=
Retrofit
.
Builder
()
.
baseUrl
(
IRoomParkMobileApi
.
BASE_URL
)
...
...
@@ -113,4 +116,18 @@ class RetrofitModule{
.
addCallAdapterFactory
(
RxJava2CallAdapterFactory
.
create
())
.
build
()
@Provides
@Singleton
@Named
(
"bigantoApi"
)
fun
provideRetrofitBigantoApi
(
context
:
Context
):
Retrofit
=
Retrofit
.
Builder
()
.
baseUrl
(
IBigantoMobileApi
.
BASE_URL
)
.
client
(
client
(
AppVersionManager
(
context
),
LiveNetworkMonitor
(
context
)))
.
addConverterFactory
(
NullOnEmptyConverterFactory
.
create
())
.
addConverterFactory
(
ScalarsConverterFactory
.
create
())
.
addConverterFactory
(
gsonConverterFactory
())
.
addCallAdapterFactory
(
RxJava2CallAdapterFactory
.
create
())
.
build
()
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/repository/api/retrofit/util/CustomExceptionDeserializer.kt
View file @
db683550
package
com.biganto.visual.roompark.data.repository.api.retrofit.util
import
com.biganto.visual.roompark.data.repository.api.r
etrofit
.raw.ErrorRaw
import
com.biganto.visual.roompark.data.repository.api.r
oom_park
.raw.ErrorRaw
import
com.biganto.visual.roompark.domain.custom_exception.parseException
import
com.google.gson.*
import
timber.log.Timber
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/api/retrofit/util/ErrorsListDeserializer.kt
View file @
db683550
package
com.biganto.visual.roompark.data.repository.api.retrofit.util
import
com.biganto.visual.roompark.data.repository.api.r
etrofit
.raw.ErrorRaw
import
com.biganto.visual.roompark.data.repository.api.r
oom_park
.raw.ErrorRaw
import
com.biganto.visual.roompark.domain.custom_exception.parseException
import
com.google.gson.JsonDeserializationContext
import
com.google.gson.JsonDeserializer
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/api/IApi.kt
→
app/src/main/java/com/biganto/visual/roompark/data/repository/api/
room_park/
IApi.kt
View file @
db683550
package
com.biganto.visual.roompark.data.repository.api
package
com.biganto.visual.roompark.data.repository.api
.room_park
import
com.biganto.visual.roompark.data.repository.api.retrofit.DEFAULT_ARTICLE_PAGE_SIZE
import
com.biganto.visual.roompark.data.repository.api.retrofit.raw.*
import
com.biganto.visual.roompark.data.repository.api.room_park.raw.*
import
io.reactivex.Observable
/**
...
...
@@ -51,6 +50,3 @@ interface IRoomParkApi {
fun
getWebCamsList
():
Observable
<
List
<
WebCamRaw
>>
}
interface
IBigantoApi
{
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/repository/api/r
etrofit
/IRoomParkMobileApi.kt
→
app/src/main/java/com/biganto/visual/roompark/data/repository/api/r
oom_park
/IRoomParkMobileApi.kt
View file @
db683550
package
com.biganto.visual.roompark.data.repository.api.r
etrofit
package
com.biganto.visual.roompark.data.repository.api.r
oom_park
import
com.biganto.visual.roompark.data.repository.api.r
etrofit
.raw.*
import
com.biganto.visual.roompark.data.repository.api.r
oom_park
.raw.*
import
io.reactivex.Observable
import
retrofit2.Response
import
retrofit2.http.*
...
...
@@ -142,7 +142,7 @@ interface IRoomParkMobileApi{
@Field
(
PASSWORD_AUTH_PARAM
)
pwd
:
String
):
Observable
<
Response
<
AuthRaw
>>
@POST
(
"$API_URL$
{SUBSCRIBE_METHOD}
$DELIMITER"
)
@POST
(
"$API_URL$
SUBSCRIBE_METHOD
$DELIMITER"
)
@FormUrlEncoded
fun
subscribe
(
@Query
(
CLIENT_TYPE_PARAM
)
clientType
:
String
=
DEFAULT_CLIENT_TYPE
,
...
...
@@ -154,7 +154,7 @@ interface IRoomParkMobileApi{
@Field
(
TOPIC_SUBSCRIBTION_TOPIC_ID_PARAM
)
estateId
:
String
?
):
Observable
<
Response
<
StatusResponse
>>
@POST
(
"$API_URL$
{UNSUBSCRIBE_METHOD}
$DELIMITER"
)
@POST
(
"$API_URL$
UNSUBSCRIBE_METHOD
$DELIMITER"
)
@FormUrlEncoded
fun
unsubscribe
(
@Query
(
CLIENT_TYPE_PARAM
)
clientType
:
String
=
DEFAULT_CLIENT_TYPE
,
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/api/r
etrofit
/RetrofitRepository.kt
→
app/src/main/java/com/biganto/visual/roompark/data/repository/api/r
oom_park
/RetrofitRepository.kt
View file @
db683550
package
com.biganto.visual.roompark.data.repository.api.r
etrofit
package
com.biganto.visual.roompark.data.repository.api.r
oom_park
import
com.biganto.visual.roompark.data.repository.api.IRoomParkApi
import
com.biganto.visual.roompark.data.repository.api.retrofit.raw.*
import
com.biganto.visual.roompark.data.repository.api.room_park.raw.*
import
com.biganto.visual.roompark.util.extensions.asInt
import
io.reactivex.Completable
import
io.reactivex.Observable
...
...
@@ -19,7 +18,8 @@ import javax.inject.Inject
const
val
DEFAULT_ARTICLE_PAGE_SIZE
=
10
class
RetrofitRepository
@Inject
constructor
(
retrofit
:
Retrofit
)
:
IRoomParkApi
{
class
RetrofitRepository
@Inject
constructor
(
retrofit
:
Retrofit
)
:
IRoomParkApi
{
private
val
api
=
retrofit
.
create
(
IRoomParkMobileApi
::
class
.
java
)
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/api/r
etrofit
/raw/response.kt
→
app/src/main/java/com/biganto/visual/roompark/data/repository/api/r
oom_park
/raw/response.kt
View file @
db683550
package
com.biganto.visual.roompark.data.repository.api.r
etrofit
.raw
package
com.biganto.visual.roompark.data.repository.api.r
oom_park
.raw
import
java.util.*
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/mapper/raw2entity.kt
View file @
db683550
package
com.biganto.visual.roompark.data.repository.mapper
import
android.content.res.Resources
import
com.biganto.visual.roompark.data.repository.api.r
etrofit
.raw.*
import
com.biganto.visual.roompark.data.repository.api.r
oom_park
.raw.*
import
com.biganto.visual.roompark.data.repository.db.requrey.PhotoResolutions
import
com.biganto.visual.roompark.data.repository.db.requrey.TitledPhoto
import
com.biganto.visual.roompark.data.repository.db.requrey.model.*
...
...
app/src/main/java/com/biganto/visual/roompark/data/service/version_control/AppVersionManager.kt
View file @
db683550
...
...
@@ -4,7 +4,7 @@ import android.content.Context
import
android.os.Parcel
import
android.os.Parcelable
import
com.biganto.visual.roompark.BuildConfig
import
com.biganto.visual.roompark.data.repository.api.r
etrofit
.raw.AppVersionRaw
import
com.biganto.visual.roompark.data.repository.api.r
oom_park
.raw.AppVersionRaw
import
com.jakewharton.rxrelay2.BehaviorRelay
import
dagger.Module
import
dagger.Provides
...
...
app/src/main/java/com/biganto/visual/roompark/di/dagger/AppComponent.kt
View file @
db683550
...
...
@@ -4,8 +4,9 @@ import android.app.Application
import
com.biganto.visual.androidplayer.data.repository.local.ILocalStore
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.data.local.LocalStorage
import
com.biganto.visual.roompark.data.repository.api.
IRoomPark
Api
import
com.biganto.visual.roompark.data.repository.api.
biganto.IBiganto
Api
import
com.biganto.visual.roompark.data.repository.api.retrofit.di.RetrofitModule
import
com.biganto.visual.roompark.data.repository.api.room_park.IRoomParkApi
import
com.biganto.visual.roompark.data.repository.db.IDb
import
com.biganto.visual.roompark.data.repository.db.requrey.DbModule
import
com.biganto.visual.roompark.data.repository.file.FileModule
...
...
@@ -17,10 +18,6 @@ import dagger.android.AndroidInjector
import
dagger.android.support.AndroidSupportInjectionModule
import
javax.inject.Singleton
/**
* Created by Vladislav Bogdashkin on 13.06.2018.
*/
...
...
@@ -57,7 +54,9 @@ interface AppComponent : AndroidInjector<RoomParkApplication>{
fun
provideLocal
():
ILocalStore
fun
provideApi
():
IRoomParkApi
fun
provideApi
():
IRoomParkApi
fun
provideBigantoApi
():
IBigantoApi
fun
providedb
():
IDb
...
...
@@ -75,41 +74,5 @@ interface AppComponent : AndroidInjector<RoomParkApplication>{
@BindsInstance
app
:
RoomParkApplication
):
AppComponent
// @BindsInstance
// fun context(application: Application): Factory
// @BindsInstance
// fun retrofitModule(retrofit: RetrofitModule):Builder
// @BindsInstance
// @Named("roomParkApi")
// fun retrofit(
// retorfitModule: RetrofitModule
// ): DaggerDataComponent.Builder
//
// fun build(): AppComponent
}
// retorfitModule: RetrofitModule
// fun cache(): ICachedStore
// fun context(): Context
// fun db(): IDb
// fun api(): IApi
// fun roomApi(): IRoomParkApi
// fun fileModule(): FilesModule
//// fun appLifeCycle(): AppLifecycleListener
// fun networkMonitor(): INetworkMonitor
// fun versionMonitor(): IAppVersionControl
// fun versionNotifier(): IAppVersionNotifier
//
// fun estateRepo() : IEstateRepository
// fun tourRepo() : ITourRepository
// fun userRepo() : IUserRepository
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/di/dagger/DataModule.kt
View file @
db683550
...
...
@@ -2,9 +2,11 @@ package com.biganto.visual.roompark.di.dagger
import
com.biganto.visual.roompark.data.data_provider.*
import
com.biganto.visual.roompark.data.local.LocalStorage
import
com.biganto.visual.roompark.data.repository.api.
IRoomParkApi
import
com.biganto.visual.roompark.data.repository.api.
retrofit.RetrofitRepository
import
com.biganto.visual.roompark.data.repository.api.
biganto.BigantoRetrofitRepository
import
com.biganto.visual.roompark.data.repository.api.
biganto.IBigantoApi
import
com.biganto.visual.roompark.data.repository.api.retrofit.di.RetrofitModule
import
com.biganto.visual.roompark.data.repository.api.room_park.IRoomParkApi
import
com.biganto.visual.roompark.data.repository.api.room_park.RetrofitRepository
import
com.biganto.visual.roompark.data.repository.db.IDb
import
com.biganto.visual.roompark.data.repository.db.requrey.DbModule
import
com.biganto.visual.roompark.data.repository.db.requrey.RequeryRepository
...
...
@@ -12,6 +14,9 @@ import com.biganto.visual.roompark.domain.contract.*
import
dagger.Binds
import
dagger.Component
import
dagger.Module
import
dagger.Provides
import
retrofit2.Retrofit
import
javax.inject.Named
import
javax.inject.Singleton
@Component
...
...
@@ -56,93 +61,21 @@ abstract class ContractRepositoryModule {
@Module
abstract
class
DataModule
{
// @Singleton
// @Binds
// abstract fun provideAuthContract(contract: AuthContractModule) : AuthContract
// @Binds
// abstract fun provideModule(m:RetrofitModule) : RetrofitModule
// @Binds
// abstract fun provideRpRetrofit(retrofit:Retrofit) : Retrofit
//
@Singleton
@Binds
abstract
fun
provideRoomParkApi
(
api
:
RetrofitRepository
)
:
IRoomParkApi
// @Binds
// abstract fun provideStore(store: KotlinReactiveEntityStore<Persistable>) : KotlinReactiveEntityStore<Persistable>
@Singleton
@Binds
abstract
fun
provideDb
(
db
:
RequeryRepository
)
:
IDb
// @Singleton
// @Binds
// abstract fun provideLocalStorage(local: UserHolder) : ILocalStore
/*
@Provides
@Singleton
fun provieApi(@Named("bigantoApi") ret
orfit:Retrofit): I
Api {
return
RetrofitRepository(retor
fit)
fun
provieApi
(
@Named
(
"bigantoApi"
)
ret
rofit
:
Retrofit
):
IBiganto
Api
{
return
BigantoRetrofitRepository
(
retro
fit
)
}
@Provides
@Singleton
fun provieRoomParkApi(@Named("roomParkApi") ret
orfit:
Retrofit): IRoomParkApi {
return R
oomParkRetrofitRepository(retor
fit)
fun
provieRoomParkApi
(
@Named
(
"roomParkApi"
)
ret
rofit
:
Retrofit
):
IRoomParkApi
{
return
R
etrofitRepository
(
retro
fit
)
}
@Provides
@Singleton
fun provideDb(context:Application): IDb {
return RequeryRepository(getRequeryDataStore(context))
}
@Provides
@Singleton
fun provideFileModule(context:Application): FilesModule {
return FilesModule(context)
}
@Provides
@Singleton
fun providesNetworkListener(context:Application): INetworkMonitor {
return LiveNetworkMonitor(context)
}
@Provides
@Singleton
fun getRequeryDataStore(context:Application): KotlinReactiveEntityStore<Persistable> {
Timber.d("Kotlin store creating..")
val source = DatabaseSource(context, Models.DEFAULT, "BigantoPerfect", DATABASE_VERSION)
source.setLoggingEnabled(false)
// if ( BuildConfig.DEBUG) {
// // use this in development mode to drop and recreate the tables on every upgrade
// source.setTableCreationMode(TableCreationMode.DROP_CREATE)
// }
val store = KotlinEntityDataStore<Persistable>(source.configuration)
Timber.d("Kotlin store %s",source)
return KotlinReactiveEntityStore(store)
// // override onUpgrade to handle migrating to a new version
// val configuration = source.configuration
// return ReactiveSupport.toReactiveStore(
// EntityDataStore<Persistable>(configuration))
}
@Binds
abstract
fun
provideDb
(
db
:
RequeryRepository
)
:
IDb
*/
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/domain/custom_exception/CustomException.kt
View file @
db683550
...
...
@@ -2,7 +2,7 @@ package com.biganto.visual.roompark.domain.custom_exception
import
androidx.annotation.StringRes
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.data.repository.api.r
etrofit
.raw.ErrorRaw
import
com.biganto.visual.roompark.data.repository.api.r
oom_park
.raw.ErrorRaw
/**
...
...
app/src/main/java/com/biganto/visual/roompark/domain/model/webCamList.kt
View file @
db683550
package
com.biganto.visual.roompark.domain.model
import
com.biganto.visual.roompark.data.repository.api.r
etrofit
.raw.StreamRaw
import
com.biganto.visual.roompark.data.repository.api.r
etrofit
.raw.WebCamRaw
import
com.biganto.visual.roompark.data.repository.api.r
oom_park
.raw.StreamRaw
import
com.biganto.visual.roompark.data.repository.api.r
oom_park
.raw.WebCamRaw
/**
* Created by Vladislav Bogdashkin on 23.09.2019.
...
...
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