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
1cb41b2f
Commit
1cb41b2f
authored
Jul 29, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Plain Diff
merge proguard-rules
parents
fcafd46a
7db1a09f
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
377 additions
and
63 deletions
+377
-63
build.gradle
app/build.gradle
+6
-10
proguard-rules.pro
app/proguard-rules.pro
+170
-4
RoomParkApplication.kt
...a/com/biganto/visual/roompark/base/RoomParkApplication.kt
+0
-3
utils.kt
...o/visual/roompark/conductor/dialogs/tour_chooser/utils.kt
+2
-1
RawData.kt
...isual/roompark/data/repository/api/biganto/raw/RawData.kt
+5
-0
RequeryRepository.kt
.../roompark/data/repository/db/requrey/RequeryRepository.kt
+2
-2
File.kt
.../visual/roompark/data/repository/db/requrey/model/File.kt
+44
-7
TourPreview.kt
.../roompark/data/repository/db/requrey/model/TourPreview.kt
+12
-2
FileModule.kt
...iganto/visual/roompark/data/repository/file/FileModule.kt
+8
-3
TourDownloadData.kt
...visual/roompark/data/service/download/TourDownloadData.kt
+4
-1
TourDownloadService.kt
...ual/roompark/data/service/download/TourDownloadService.kt
+48
-6
TourModel.kt
...ava/com/biganto/visual/roompark/domain/model/TourModel.kt
+7
-3
DownloadUseCase.kt
...iganto/visual/roompark/domain/use_case/DownloadUseCase.kt
+48
-10
build.gradle
build.gradle
+1
-1
dependencies.gradle
dependencies.gradle
+2
-2
gradle.properties
gradle.properties
+12
-7
readme.md
readme.md
+6
-1
No files found.
app/build.gradle
View file @
1cb41b2f
...
...
@@ -60,27 +60,24 @@ android {
buildTypes
{
debug
{
minifyEnabled
true
proguardFiles
getDefaultProguardFile
(
'proguard-android.txt'
),
'proguard-rules.pro'
aaptOptions
.
cruncherEnabled
=
false
ext
.
alwaysUpdateBuildId
=
false
}
release
{
signingConfig
signingConfigs
.
release
minifyEnabled
fals
e
minifyEnabled
tru
e
proguardFiles
getDefaultProguardFile
(
'proguard-android.txt'
),
'proguard-rules.pro'
debuggable
false
}
}
applicationVariants
.
all
{
variant
->
if
(
variant
.
name
.
contains
(
"release"
))
{
variant
.
outputs
.
each
{
output
->
output
.
outputFileName
=
new
File
(
"Expeditor_v"
)
}
}
aaptOptions
{
noCompress
'.unity3d'
,
'.ress'
,
'.resource'
,
'.obb'
}
task
renameBundle
(
type:
Copy
)
{
from
"$buildDir/outputs/bundle/release"
into
"../../"
...
...
@@ -226,7 +223,6 @@ dependencies {
//RxKotlin
implementation
(
"io.reactivex.rxjava2:rxkotlin:$rxKotlinVersion"
)
//Arch Lifecycle
implementation
'androidx.lifecycle:lifecycle-extensions:2.2.0'
...
...
app/proguard-rules.pro
View file @
1cb41b2f
...
...
@@ -20,7 +20,6 @@
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-
assumenosideeffects
class
android
.
util
.
Log
{
public
static
boolean
isLoggable
(
java
.
lang
.
String
,
int
);
public
static
int
v
(...);
...
...
@@ -32,7 +31,6 @@
-
dontwarn
com
.
franmontiel
.
persistentcookiejar
.
**
-
keep
class
com
.
franmontiel
.
persistentcookiejar
.
**
-
keepclassmembers
class
*
implements
java
.
io
.
Serializable
{
static
final
long
serialVersionUID
;
...
...
@@ -49,5 +47,173 @@
-
keepattributes
*
Annotation
*
-
keepattributes
SourceFile
,
LineNumberTable
# prevent Crashlytics obfuscation
-
keep
class
com
.
crashlytics
.
**
{
*
;
}
-
dontwarn
com
.
crashlytics
.
**
-
dontwarn
org
.
kobjects
.
**
-
dontwarn
org
.
ksoap2
.
**
-
dontwarn
org
.
kxml2
.
**
-
dontwarn
org
.
xmlpull
.
v1
.
**
-
keep
class
com
.
biganto
.
visual
.
roompark
.
data
.
repository
.
db
.
requrey
.
model
**
{
*
;
}
-
keep
class
com
.
biganto
.
visual
.
roompark
.
player
.
unity_utils
**
{
*
;
}
-
keepclassmembers
class
com
.
biganto
.
visual
.
roompark
.
player
.
unity_utils
**
{
*
;
}
-
keep
class
com
.
biganto
.
visual
.
roompark
.
player
.
BigantoPlayerActivity
{
*
;
}
-
keepclassmembers
class
com
.
biganto
.
visual
.
roompark
.
player
.
BigantoPlayerActivity
**
{
*
;
}
-
keep
public
class
*
implements
android
.
os
.
Parcelable
# keep CREATOR for referenced parcelables since it is accessed via reflection
-
keepclassmembers
class
*
implements
android
.
os
.
Parcelable
{
static
**
CREATOR
;
}
-
dontobfuscate
-
optimizations
!
code
/
simplification
/
arithmetic
,!
field
/*
,!class/merging
/*
,!code/allocation/variable
# could be refined, but if it works you got the idea
-keepnames class
* implements android.os.Parcelable { *; }
-keepclassmembers class * implements android.os.Parcelable { *; }
-keepnames class * implements com.bluelinelabs.conductor
*
* { *; }
-keepclassmembers class * implements com.bluelinelabs.conductor
*
* { *; }
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer
-keep class com.biganto.visual.roompark.data.repository.api.biganto.raw
*
* { *; }
-keepclassmembers class com.biganto.visual.roompark.data.repository.api.biganto.raw
*
* { *; }
-keep class com.biganto.visual.roompark.data.repository.api.room_park.raw
*
* { *; }
-keepclassmembers class com.biganto.visual.roompark.data.repository.api.room_park.raw
*
* { *; }
# prevent Requery obfuscation
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontoptimize
-dontpreverify
-dontwarn java.lang.FunctionalInterface
-dontwarn java.util.
*
*
-dontwarn java.time.
*
*
-dontwarn javax.annotation.
*
*
-dontwarn javax.cache.
*
*
-dontwarn javax.naming.
*
*
-dontwarn javax.transaction.
*
*
-dontwarn java.sql.
*
*
-dontwarn javax.sql.
*
*
-dontwarn androidx.
*
*
-dontwarn io.requery.cache.
*
*
-dontwarn io.requery.rx.
*
*
-dontwarn io.requery.reactivex.
*
*
-dontwarn io.requery.reactor.
*
*
-dontwarn io.requery.query.
*
*
-dontwarn io.requery.android.sqlcipher.
*
*
-dontwarn io.requery.android.sqlitex.
*
*
-keepclassmembers enum io.requery
*
* {
public static
*
*[] values();
public static
*
* valueOf(java.lang.String);
}
# google vr sdk
# Don't obfuscate any NDK
/SDK code. This makes the debugging of stack traces
# in release builds easier.
-keepnames class com.google.vr.ndk*
* { *; }
-keepnames class com.google.vr.sdk
*
* { *; }
# These are part of the Java <-> native interfaces for GVR.
-keepclasseswithmembernames,includedescriptorclasses class com.google.vr
*
* {
native <methods>;
}
# The SDK configuration protos use reflection.
-keep class com.google.vr.sdk.proto
*
* {
*;
}
-keep class com.google.common.logging.Vr$VREvent$SdkConfigurationParams
*
* {
*;
}
-keep class com.google.common.logging.nano.Vr$VREvent$SdkConfigurationParams
*
* {
*;
}
-keep class com.google.vr.cardboard.UsedByNative
-keep @com.google.vr.cardboard.UsedByNative class *
-keepclassmembers class * {
@com.google.vr.cardboard.UsedByNative *;
}
-keep class com.google.vr.cardboard.annotations.UsedByNative
-keep @com.google.vr.cardboard.annotations.UsedByNative class *
-keepclassmembers class * {
@com.google.vr.cardboard.annotations.UsedByNative *;
}
-keep class com.google.vr.cardboard.annotations.UsedByReflection
-keep @com.google.vr.cardboard.annotations.UsedByReflection class *
-keepclassmembers class * {
@com.google.vr.cardboard.annotations.UsedByReflection *;
}
-dontwarn sun.misc.Unsafe
-dontwarn libcore.io.Memory
# end googlevr sdk
-dontusemixedcaseclassnames
-dontwarn android.support.
*
*
-verbose
-dontoptimize
-dontpreverify
-keep class com.unity3d
*
* { *; }
-keep class org.fmod
*
* { *; }
-keep class bitter.jnibridge
*
* { *; }
-keepclassmembers class com.tms.rarus.videoserver.* { *; }
-keepclassmembers class com.unity3d.player
*
* { *; }
-keepclassmembers class org.fmod
*
* { *; }
-keepclasseswithmembernames class * {
native <methods>;
}
-keep class com.google.firebase.crashlytics
*
* { *; }
-dontwarn com.google.firebase.crashlytics.
*
*
-keep class com.google.android.gms
*
* { *; }
-dontwarn com.google.android.gms.
*
*
-keep class com.biganto.androidplayer
*
* { *; }
-keepclassmembers class com.biganto.androidplayer.* { *; }
-libraryjars .
/libs/unity-classes.jar
#-libraryjars ./libs/libprotobuf-java-nano.jar
-keep interface kotlin.reflect.jvm.internal.impl.builtins.BuiltInsLoader
-keep class kotlin.reflect.jvm.internal.impl.serialization.deserialization.builtins.BuiltInsLoaderImpl
-keep class com.biganto.visual.roompark.presentation.screen.settings.util*
* { *; }
-keepclassmembers class com.biganto.visual.roompark.presentation.screen.settings.util
*
* { *; }
-dontwarn kotlin.reflect.jvm.internal.
*
*
-keep class kotlin
*
* {
public protected *;
}
-keepclassmembers class * { public <init>(...); }
app/src/main/java/com/biganto/visual/roompark/base/RoomParkApplication.kt
View file @
1cb41b2f
...
...
@@ -78,8 +78,5 @@ class RoomParkApplication : DaggerApplication() {
private
class
CrashlyticsTree
:
Timber
.
Tree
()
{
override
fun
log
(
priority
:
Int
,
tag
:
String
?,
message
:
String
,
throwable
:
Throwable
?)
{
if
(
priority
==
Log
.
VERBOSE
||
priority
==
Log
.
DEBUG
)
return
// Crashlytics.log(priority, tag, message)
// throwable?.let { Crashlytics.logException(it) }
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/conductor/dialogs/tour_chooser/utils.kt
View file @
1cb41b2f
...
...
@@ -7,6 +7,7 @@ import com.biganto.visual.roompark.data.repository.file.FileModule
import
com.biganto.visual.roompark.domain.model.TourModel
import
com.biganto.visual.roompark.player.BigantoPlayerActivity
import
com.biganto.visual.roompark.player.unity_utils.LoadTourConfig
import
java.io.File
/**
* Created by Vladislav Bogdashkin on 07.04.2020.
...
...
@@ -22,7 +23,7 @@ fun startPlayer(context:Context,tour: TourModel)
val
tourConfig
=
LoadTourConfig
(
tour
.
tour_id
.
toInt
(),
tour
.
targetResolution
,
FileModule
.
assetsDirectory
(
context
),
FileModule
.
assetsDirectory
(
context
)
.
plus
(
File
.
separator
).
plus
(
tour
.
footageUri
)
,
tour
.
metaPredict
,
tour
.
previewUrl
,
context
.
resources
?.
getBoolean
(
R
.
bool
.
isTablet
)
?.
not
()
?:
true
,
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/api/biganto/raw/RawData.kt
View file @
1cb41b2f
...
...
@@ -8,6 +8,11 @@ import java.util.*
*/
data class
LiteTourMetaRaw
(
val
baseurl
:
String
,
val
tour_baseurl
:
String
)
data class
ErrorRaw
(
val
code
:
Int
,
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/RequeryRepository.kt
View file @
1cb41b2f
...
...
@@ -30,7 +30,7 @@ import javax.inject.Inject
*/
private
const
val
DATABASE_VERSION
=
1
5
private
const
val
DATABASE_VERSION
=
1
6
@Module
class
DbModule
{
...
...
@@ -59,7 +59,7 @@ class RequeryRepository @Inject constructor(
override
fun
refreshEstatesWithTours
():
Completable
=
store
.
select
(
EstateEntity
::
class
)
.
where
(
EstateEntity
::
multitourId
.
notNull
())
.
where
(
EstateEntity
.
MULTITOUR_ID
.
notNull
())
.
get
()
.
observable
()
.
toList
()
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/model/File.kt
View file @
1cb41b2f
package
com.biganto.visual.roompark.data.repository.db.requrey.model
import
com.biganto.visual.roompark.data.repository.api.biganto.IBigantoMobileApi.Companion.BASE_URL
import
com.biganto.visual.roompark.data.repository.api.biganto.raw.LiteTourMetaRaw
import
com.biganto.visual.roompark.data.repository.api.biganto.raw.TourFileRaw
import
com.biganto.visual.roompark.data.repository.db.requrey.RevisionString
import
com.biganto.visual.roompark.data.repository.db.requrey.utils.RevisionStringConverter
import
com.biganto.visual.roompark.data.repository.file.FileModule
import
io.requery.*
import
java.io.File
import
java.math.BigInteger
import
java.security.MessageDigest
/**
* Created by Vladislav Bogdashkin on 15.06.2018.
*/
val
domainPredicthMatcher
=
"^(http|https)://"
.
toRegex
()
fun
toInitialName
(
fullPath
:
String
)
=
String
.
format
(
"%032x"
,
BigInteger
(
1
,
MessageDigest
.
getInstance
(
"MD5"
).
digest
(
fullPath
.
toByteArray
(
Charsets
.
UTF_8
))
)
)
@Entity
interface
File
:
Persistable
{
// @get:Key
...
...
@@ -21,21 +36,43 @@ interface File :Persistable {
val
downloadedSize
:
Long
@get
:
Nullable
val
isDownloaded
:
Boolean
// @get:ForeignKey(references = Skybox::class)
// @get:ManyToOne(cascade = arrayOf(CascadeAction.NONE))
// var skyboxId:Skybox?
@get
:
Nullable
val
destination
:
String
}
fun
fromRaw
(
raw
:
TourFileRaw
):
FileEntity
{
fun
fromRaw
(
raw
:
TourFileRaw
,
meta
:
LiteTourMetaRaw
):
FileEntity
{
val
entity
=
FileEntity
()
entity
.
setDownloaded
(
false
)
entity
.
setDownloadedSize
(
0L
)
entity
.
setTotalSize
(
raw
.
size
)
entity
.
setUri
(
RevisionString
(
raw
.
url
.
substring
(
raw
.
url
.
indexOf
(
"asset"
))))
var
fileUri
=
raw
.
url
domainPredicthMatcher
.
containsMatchIn
(
raw
.
url
)
val
bui
=
raw
.
url
.
indexOf
(
meta
.
baseurl
)
if
(
bui
>=
0
)
fileUri
=
toInitialName
(
meta
.
baseurl
)
.
plus
(
File
.
separator
)
.
plus
(
raw
.
url
.
removeRange
(
0
,
bui
+
meta
.
baseurl
.
length
))
val
tui
=
raw
.
url
.
indexOf
(
meta
.
tour_baseurl
)
if
(
tui
>=
0
)
fileUri
=
toInitialName
(
meta
.
tour_baseurl
)
.
plus
(
File
.
separator
)
.
plus
(
raw
.
url
.
removeRange
(
0
,
tui
+
meta
.
tour_baseurl
.
length
))
entity
.
setUri
(
RevisionString
(
FileModule
.
assetsLocalPath
(
fileUri
)))
entity
.
setDestination
(
if
(
domainPredicthMatcher
.
containsMatchIn
(
raw
.
url
))
raw
.
url
else
BASE_URL
.
plus
(
raw
.
url
)
)
return
entity
}
fun
fromRaw
(
raw
:
List
<
TourFileRaw
>):
List
<
FileEntity
>
=
List
(
raw
.
size
)
{
index
->
fromRaw
(
raw
[
index
])
}
\ No newline at end of file
fun
fromRaw
(
raw
:
List
<
TourFileRaw
>,
meta
:
LiteTourMetaRaw
):
List
<
FileEntity
>
=
List
(
raw
.
size
)
{
index
->
fromRaw
(
raw
[
index
],
meta
)
}
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/model/TourPreview.kt
View file @
1cb41b2f
...
...
@@ -4,6 +4,7 @@ import com.biganto.visual.roompark.data.repository.api.biganto.raw.TourPreviewRa
import
com.biganto.visual.roompark.data.repository.db.requrey.RevisionString
import
com.biganto.visual.roompark.data.repository.db.requrey.model.Estate
import
com.biganto.visual.roompark.data.repository.db.requrey.model.EstateEntity
import
com.biganto.visual.roompark.data.repository.db.requrey.model.domainPredicthMatcher
import
com.biganto.visual.roompark.data.repository.db.requrey.utils.IntListConverter
import
com.biganto.visual.roompark.data.repository.db.requrey.utils.IsoDateConverter
import
com.biganto.visual.roompark.data.repository.db.requrey.utils.RevisionStringConverter
...
...
@@ -60,6 +61,8 @@ interface TourPreview :Persistable {
@get
:
Convert
(
RevisionStringConverter
::
class
)
val
metaFileEntityId
:
RevisionString
?
val
tourBaseUrl
:
String
?
val
footageBaseUrl
:
String
?
}
...
...
@@ -70,8 +73,15 @@ fun fromRaw(raw: TourPreviewRaw, parentId:Int, baseUrl:String, userResolution:In
tour
.
setUpdated
(
raw
.
updated
)
tour
.
setType
(
raw
.
type
)
tour
.
setTitle
(
raw
.
title
)
tour
.
setPreview
(
"$baseUrl${raw.preview}"
)
tour
.
setScreen
(
"$baseUrl${raw.screen}"
)
tour
.
setPreview
(
if
(
domainPredicthMatcher
.
containsMatchIn
(
raw
.
preview
))
raw
.
preview
else
"$baseUrl${raw.preview}"
)
tour
.
setScreen
(
if
(
domainPredicthMatcher
.
containsMatchIn
(
raw
.
screen
))
raw
.
screen
else
"$baseUrl${raw.screen}"
)
tour
.
setHidden
(
raw
.
hidden
)
tour
.
resolutions
=
if
(
raw
.
resolutions
!=
null
&&
!
raw
.
resolutions
.
isNullOrEmpty
())
ArrayList
(
raw
.
resolutions
)
else
ArrayList
(
1024
)
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/file/FileModule.kt
View file @
1cb41b2f
...
...
@@ -41,7 +41,7 @@ class FileModule @Inject constructor(val context: Application) {
if
(
fileUri
.
contains
(
"/"
))
fileUri
.
substring
(
0
,
fileUri
.
lastIndexOf
(
"/"
))
else
""
val
directory
=
File
(
assetsFile
(
context
)
,
fileDir
)
val
directory
=
File
(
rootFolder
,
fileDir
)
directory
.
mkdirs
()
val
file
=
File
(
directory
,
fileName
)
...
...
@@ -127,10 +127,15 @@ class FileModule @Inject constructor(val context: Application) {
File
(
context
.
filesDir
.
absolutePath
.
plus
(
dirType
.
dir
))
fun
assetsDirectory
(
context
:
Context
):
String
=
getDirectory
(
context
,
FileDirectory
.
ToursDir
(
"biganto"
)).
absolutePath
getDirectory
(
context
,
FileDirectory
.
ToursDir
(
BIGANTO_TOURS_FOLDER
)).
absolutePath
fun
assetsFile
(
context
:
Context
):
File
=
getDirectory
(
context
,
FileDirectory
.
ToursDir
(
"biganto"
))
getDirectory
(
context
,
FileDirectory
.
ToursDir
(
BIGANTO_TOURS_FOLDER
))
fun
assetsLocalPath
(
uri
:
String
):
String
=
FileDirectory
.
ToursDir
(
BIGANTO_TOURS_FOLDER
).
dir
.
plus
(
File
.
separator
).
plus
(
uri
)
private
const
val
BIGANTO_TOURS_FOLDER
=
"biganto"
}
...
...
app/src/main/java/com/biganto/visual/roompark/data/service/download/TourDownloadData.kt
View file @
1cb41b2f
...
...
@@ -18,7 +18,9 @@ data class TourFileData(
var
fileDownloadedSize
:
Long
=
0L
,
var
tempTourTotalDiff
:
Long
=
0L
,
var
isDownloaded
:
Boolean
=
false
,
val
fatalState
:
DownloadState
?
=
null
val
fatalState
:
DownloadState
?
=
null
,
var
destination
:
String
)
{
constructor
(
entity
:
FileEntity
,
junction
:
TourFileJunctionEntity
)
:
this
(
fileUrl
=
junction
.
file
...
...
@@ -28,5 +30,6 @@ data class TourFileData(
,
fileDownloadedSize
=
entity
.
downloadedSize
,
tempTourTotalDiff
=
0L
,
isDownloaded
=
entity
.
isDownloaded
,
destination
=
entity
.
destination
)
}
app/src/main/java/com/biganto/visual/roompark/data/service/download/TourDownloadService.kt
View file @
1cb41b2f
...
...
@@ -9,17 +9,21 @@ import androidx.core.math.MathUtils.clamp
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.data.repository.api.biganto.IBigantoApi
import
com.biganto.visual.roompark.data.repository.api.biganto.raw.LiteTourMetaRaw
import
com.biganto.visual.roompark.data.repository.db.IDb
import
com.biganto.visual.roompark.data.repository.db.requrey.RevisionString
import
com.biganto.visual.roompark.data.repository.db.requrey.model.FileEntity
import
com.biganto.visual.roompark.data.repository.db.requrey.model.TourFileJunctionEntity
import
com.biganto.visual.roompark.data.repository.db.requrey.model.fromRaw
import
com.biganto.visual.roompark.data.repository.db.requrey.model.toInitialName
import
com.biganto.visual.roompark.data.repository.file.FileModule
import
com.biganto.visual.roompark.data.service.lifecycle.ForegroundLifecycleObserver
import
com.biganto.visual.roompark.data.service.notification.INotificationCenter
import
com.biganto.visual.roompark.domain.use_case.TOUR_IDS_TO_DOWNLOAD_KEY
import
com.biganto.visual.roomparkvr.data.repository.db.requery.model.DownloadState
import
com.biganto.visual.roomparkvr.data.repository.db.requery.model.TourPreviewEntity
import
com.google.gson.Gson
import
com.google.gson.JsonParser
import
com.jakewharton.rxrelay2.PublishRelay
import
io.reactivex.BackpressureStrategy
import
io.reactivex.Flowable
...
...
@@ -282,7 +286,9 @@ class DownloadManagerService @Inject constructor(
.
flatMap
{
raw
->
var
downloadedSize
=
0L
var
totalSize
=
0L
val
fileEntities
=
raw
.
files
.
map
(
::
fromRaw
)
val
meta
=
getLocalMeta
(
tour
)
val
fileEntities
=
fromRaw
(
raw
.
files
,
meta
)
mergeFiles
(
fileEntities
)
val
jlist
=
db
.
getTourFilesJunction
(
tour
.
id
).
toList
()
...
...
@@ -327,7 +333,7 @@ class DownloadManagerService @Inject constructor(
if
(
model
.
fileDownloadedSize
>
0
)
header
=
hashMapOf
(
Pair
(
"Range"
,
"bytes=${model.fileDownloadedSize}-"
))
api
.
downloadFile
(
model
.
fileUrl
.
revisionUri
()
,
header
)
api
.
downloadFile
(
model
.
destination
,
header
)
.
doOnError
{
Timber
.
e
(
it
)
setTourStatus
(
model
.
tourId
,
DownloadState
.
Crushed
)
...
...
@@ -561,11 +567,33 @@ class DownloadManagerService @Inject constructor(
api
.
getTourMetaAsString
(
tour
.
id
)
.
map
{
meta
->
tour
.
apply
{
try
{
val
jMeta
=
JsonParser
().
parse
(
meta
).
asJsonArray
.
first
()
val
metaLite
=
Gson
().
fromJson
(
jMeta
,
LiteTourMetaRaw
::
class
.
java
)
val
metaUri
=
RevisionString
(
"$META_PREDICTION${tour.id}$META_FILE_TYPE"
)
setMetaFileEntityId
(
metaUri
)
fileModule
.
saveFileToDisk
(
fileModule
.
getFile
(
metaUri
.
uri
()),
meta
)
setFootageBaseUrl
(
toInitialName
(
metaLite
.
baseurl
))
setTourBaseUrl
(
toInitialName
(
metaLite
.
tour_baseurl
))
fileModule
.
saveFileToDisk
(
fileModule
.
getAssetFile
(
File
.
separator
.
plus
(
tour
.
footageBaseUrl
)
.
plus
(
metaUri
.
uri
())
)
,
meta
)
}
catch
(
e
:
Exception
)
{
Timber
.
e
(
e
)
}
}
tour
}
.
flatMap
{
db
.
upsertTourPreview
(
it
)
}
.
map
{
tour
.
id
}
.
onErrorReturn
{
...
...
@@ -576,6 +604,20 @@ class DownloadManagerService @Inject constructor(
//#endregion oldMethod
private
fun
getLocalMeta
(
tour
:
TourPreviewEntity
):
LiteTourMetaRaw
{
return
Gson
().
fromJson
(
JsonParser
().
parse
(
fileModule
.
getAssetFile
(
"/${tour.footageBaseUrl}"
.
plus
(
"/${tour.metaFileEntityId?.uri()}"
)
).
readText
()
).
asJsonArray
.
first
()
,
LiteTourMetaRaw
::
class
.
java
)
}
private
fun
refreshGallery
(
file
:
File
)
{
MediaScannerConnection
.
scanFile
(
context
,
arrayOf
(
file
.
path
),
null
)
...
...
app/src/main/java/com/biganto/visual/roompark/domain/model/TourModel.kt
View file @
1cb41b2f
...
...
@@ -27,7 +27,8 @@ data class TourModel (
var
downloadState
:
DownloadState
=
DownloadState
.
MetaPreparation
,
val
downloadedSize
:
Long
=-
1L
,
val
totalTourSize
:
Long
=-
1L
,
val
targetResolution
:
Int
val
targetResolution
:
Int
,
val
footageUri
:
String
?
)
:
Parcelable
{
constructor
(
parcel
:
Parcel
)
:
this
(
...
...
@@ -44,7 +45,8 @@ data class TourModel (
DownloadState
.
valueOf
(
parcel
.
readString
()),
parcel
.
readLong
(),
parcel
.
readLong
(),
parcel
.
readInt
())
parcel
.
readInt
(),
parcel
.
readString
())
val
metaPredict
:
String
get
()
=
metaUri
?.
removeSuffix
(
"$tour_id.json"
)
?:
""
...
...
@@ -64,6 +66,7 @@ data class TourModel (
parcel
.
writeLong
(
downloadedSize
)
parcel
.
writeLong
(
totalTourSize
)
parcel
.
writeInt
(
targetResolution
)
parcel
.
writeString
(
footageUri
)
}
override
fun
describeContents
():
Int
{
...
...
@@ -140,7 +143,8 @@ fun fromEntity(entity: TourPreviewEntity) = TourModel(
downloadState
=
entity
.
isDownloaded
,
//calcDownloadState(entity.tour as TourEntity?)
downloadedSize
=
entity
.
downloadedSize
?:
-
1L
,
totalTourSize
=
max
(
entity
.
overallSize
?:
0L
,
entity
.
tempSize
?:
0L
),
targetResolution
=
entity
.
targetResolution
targetResolution
=
entity
.
targetResolution
,
footageUri
=
entity
.
footageBaseUrl
)
fun
fromEntity
(
raw
:
List
<
TourPreviewEntity
>):
List
<
TourModel
>
=
List
(
raw
.
size
)
{
index
->
fromEntity
(
raw
[
index
])}
...
...
app/src/main/java/com/biganto/visual/roompark/domain/use_case/DownloadUseCase.kt
View file @
1cb41b2f
...
...
@@ -4,16 +4,20 @@ package com.biganto.visual.roompark.domain.use_case
import
android.app.Application
import
android.media.MediaScannerConnection
import
com.biganto.visual.roompark.data.repository.api.biganto.IBigantoApi
import
com.biganto.visual.roompark.data.repository.api.biganto.raw.LiteTourMetaRaw
import
com.biganto.visual.roompark.data.repository.db.IDb
import
com.biganto.visual.roompark.data.repository.db.requrey.RevisionString
import
com.biganto.visual.roompark.data.repository.db.requrey.model.FileEntity
import
com.biganto.visual.roompark.data.repository.db.requrey.model.TourFileJunctionEntity
import
com.biganto.visual.roompark.data.repository.db.requrey.model.fromRaw
import
com.biganto.visual.roompark.data.repository.db.requrey.model.toInitialName
import
com.biganto.visual.roompark.data.repository.file.FileModule
import
com.biganto.visual.roompark.data.service.download.TourFileData
import
com.biganto.visual.roompark.domain.contract.AuthContract
import
com.biganto.visual.roomparkvr.data.repository.db.requery.model.DownloadState
import
com.biganto.visual.roomparkvr.data.repository.db.requery.model.TourPreviewEntity
import
com.google.gson.Gson
import
com.google.gson.JsonParser
import
io.reactivex.BackpressureStrategy
import
io.reactivex.Flowable
import
io.reactivex.Observable
...
...
@@ -155,7 +159,9 @@ class DownloadUseCase @Inject constructor(
.
map
{
raw
->
var
downloadedSize
=
0L
var
totalSize
=
0L
val
fileEntities
=
raw
.
files
.
map
(
::
fromRaw
)
val
meta
=
getLocalMeta
(
tour
)
val
fileEntities
=
fromRaw
(
raw
.
files
,
meta
)
mergeFiles
(
fileEntities
)
val
jlist
=
db
.
getTourFilesJunction
(
tour
.
id
).
toList
()
...
...
@@ -205,7 +211,7 @@ class DownloadUseCase @Inject constructor(
hashMapOf
(
Pair
(
"Range"
,
"bytes=${model.fileDownloadedSize}-"
))
else
null
api
.
downloadFile
(
model
.
fileUrl
.
revisionUri
()
,
header
)
api
.
downloadFile
(
model
.
destination
,
header
)
.
flatMap
<
TourFileData
>
{
writeFile
(
it
,
model
,
token
)
.
toFlowable
(
BackpressureStrategy
.
BUFFER
)
...
...
@@ -255,26 +261,58 @@ class DownloadUseCase @Inject constructor(
.
doOnError
(
Timber
::
e
)
.
flatMap
{
observableTourDownloading
(
it
,
cancellataionToken
)
}
private
fun
getMeta
(
tour
:
TourPreviewEntity
)
=
api
.
getTourMetaAsString
(
tour
.
id
)
.
map
{
meta
->
tour
.
apply
{
val
metaUri
=
RevisionString
(
"$META_PREDICTION${tour.id}$META_FILE_TYPE"
)
try
{
val
jMeta
=
JsonParser
().
parse
(
meta
).
asJsonArray
.
first
()
val
metaLite
=
Gson
().
fromJson
(
jMeta
,
LiteTourMetaRaw
::
class
.
java
)
val
metaUri
=
RevisionString
(
"${META_PREDICTION}${tour.id}${META_FILE_TYPE}"
)
setMetaFileEntityId
(
metaUri
)
setFootageBaseUrl
(
toInitialName
(
metaLite
.
baseurl
))
setTourBaseUrl
(
toInitialName
(
metaLite
.
tour_baseurl
))
fileModule
.
saveFileToDisk
(
File
(
FileModule
.
assetsDirectory
(
context
).
plus
(
metaUri
.
uri
()))
fileModule
.
getAssetFile
(
File
.
separator
.
plus
(
tour
.
footageBaseUrl
)
.
plus
(
metaUri
.
uri
())
)
,
meta
)
}
catch
(
e
:
Exception
)
{
Timber
.
e
(
e
)
}
}
tour
}
.
flatMap
{
db
.
upsertTourPreview
(
it
)
}
.
onErrorReturn
{
tour
.
isDownloaded
=
DownloadState
.
Crushed
db
.
upsertTourPreview
(
tour
).
blockingSubscribe
()
tour
}
private
fun
getLocalMeta
(
tour
:
TourPreviewEntity
):
LiteTourMetaRaw
{
return
Gson
().
fromJson
(
JsonParser
().
parse
(
fileModule
.
getAssetFile
(
File
.
separator
.
plus
(
tour
.
footageBaseUrl
)
.
plus
(
File
.
separator
)
.
plus
(
tour
.
metaFileEntityId
?.
uri
())
).
readText
()
).
asJsonArray
.
first
()
,
LiteTourMetaRaw
::
class
.
java
)
}
//#endregion oldMethod
private
fun
refreshGallery
(
file
:
File
)
{
...
...
build.gradle
View file @
1cb41b2f
...
...
@@ -15,7 +15,7 @@ buildscript {
classpath
"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath
"org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
classpath
'com.google.gms:google-services:4.3.3'
classpath
'com.google.firebase:firebase-crashlytics-gradle:2.
0.0-beta03
'
classpath
'com.google.firebase:firebase-crashlytics-gradle:2.
1.0
'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
...
...
dependencies.gradle
View file @
1cb41b2f
...
...
@@ -5,8 +5,8 @@ ext {
minSdkVersion_RoomPark
=
23
compileSdkVersion_RoomPark
=
28
VERSION_CODE
=
8
VERSION_NAME
=
"0.9.
2
"
VERSION_CODE
=
9
VERSION_NAME
=
"0.9.
4
"
// supportLibraryVersion = '1.1.0-alpha05'
constrainLayoutVersion
=
'1.1.3'
...
...
gradle.properties
View file @
1cb41b2f
...
...
@@ -6,16 +6,21 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs
=
-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
kotlin.code.style
=
official
android.enableD8
=
true
# org.gradle.jvmargs=-Xmx1536m
org.gradle.jvmargs
=
-Xmx4096m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.daemon
=
true
org.gradle.parallel
=
true
org.gradle.configureondemand
=
true
org.gradle.caching
=
true
android.enableBuildScriptClasspathCheck
=
false
android.useAndroidX
=
true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier
=
true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style
=
official
readme.md
View file @
1cb41b2f
Room Park official Android application
-
- v.0.9.2 - -
-
- v.0.9.4 - -
# 0.9.4 --> 0.9.2
*
global urls support
*
update to untiy-mobile master (1.1.3)
*
proguard config
# 0.9.2 --> 0.9.1
*
universal untiy-mobile building support
...
...
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