Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
AloqaIM-Android
Commits
a85ec59d
Commit
a85ec59d
authored
Jun 11, 2018
by
Lucio Maciel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Actually we don't need a whole object, just use a top-level fun
parent
0816dd5f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
49 deletions
+48
-49
RocketChatApplication.kt
...ain/java/chat/rocket/android/app/RocketChatApplication.kt
+2
-1
CrashlyticsWrapper.kt
.../chat/rocket/android/infrastructure/CrashlyticsWrapper.kt
+46
-48
No files found.
app/src/main/java/chat/rocket/android/app/RocketChatApplication.kt
View file @
a85ec59d
...
@@ -21,6 +21,7 @@ import chat.rocket.android.dagger.qualifier.ForMessages
...
@@ -21,6 +21,7 @@ import chat.rocket.android.dagger.qualifier.ForMessages
import
chat.rocket.android.helper.CrashlyticsTree
import
chat.rocket.android.helper.CrashlyticsTree
import
chat.rocket.android.infrastructure.CrashlyticsWrapper
import
chat.rocket.android.infrastructure.CrashlyticsWrapper
import
chat.rocket.android.infrastructure.LocalRepository
import
chat.rocket.android.infrastructure.LocalRepository
import
chat.rocket.android.infrastructure.installCrashlyticsWrapper
import
chat.rocket.android.server.domain.AccountsRepository
import
chat.rocket.android.server.domain.AccountsRepository
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.domain.GetSettingsInteractor
import
chat.rocket.android.server.domain.GetSettingsInteractor
...
@@ -268,7 +269,7 @@ class RocketChatApplication : Application(), HasActivityInjector, HasServiceInje
...
@@ -268,7 +269,7 @@ class RocketChatApplication : Application(), HasActivityInjector, HasServiceInje
val
core
=
CrashlyticsCore
.
Builder
().
disabled
(
BuildConfig
.
DEBUG
).
build
()
val
core
=
CrashlyticsCore
.
Builder
().
disabled
(
BuildConfig
.
DEBUG
).
build
()
Fabric
.
with
(
this
,
Crashlytics
.
Builder
().
core
(
core
).
build
())
Fabric
.
with
(
this
,
Crashlytics
.
Builder
().
core
(
core
).
build
())
CrashlyticsWrapper
.
install
(
this
@RocketChatApplication
,
installCrashlyticsWrapper
(
this
@RocketChatApplication
,
getCurrentServerInteractor
,
settingsInteractor
,
getCurrentServerInteractor
,
settingsInteractor
,
accountRepository
,
localRepository
)
accountRepository
,
localRepository
)
}
}
...
...
app/src/main/java/chat/rocket/android/infrastructure/CrashlyticsWrapper.kt
View file @
a85ec59d
...
@@ -9,31 +9,23 @@ import chat.rocket.android.server.domain.SITE_URL
...
@@ -9,31 +9,23 @@ import chat.rocket.android.server.domain.SITE_URL
import
com.crashlytics.android.Crashlytics
import
com.crashlytics.android.Crashlytics
import
kotlinx.coroutines.experimental.runBlocking
import
kotlinx.coroutines.experimental.runBlocking
object
CrashlyticsWrapper
{
fun
installCrashlyticsWrapper
(
context
:
Application
,
private
const
val
KEY_CURRENT_SERVER
=
"CURRENT_SERVER"
private
const
val
KEY_CURRENT_USER
=
"CURRENT_USER"
private
const
val
KEY_CURRENT_USERNAME
=
"CURRENT_USERNAME"
private
const
val
KEY_ACCOUNTS
=
"ACCOUNTS"
private
const
val
KEY_SETTINGS_SIZE
=
"SETTINGS_SIZE"
private
const
val
KEY_SETTINGS_BASE_URL
=
"SETTINGS_BASE_URL"
fun
install
(
context
:
Application
,
currentServerInteractor
:
GetCurrentServerInteractor
,
currentServerInteractor
:
GetCurrentServerInteractor
,
settingsInteractor
:
GetSettingsInteractor
,
settingsInteractor
:
GetSettingsInteractor
,
accountRepository
:
AccountsRepository
,
accountRepository
:
AccountsRepository
,
localRepository
:
LocalRepository
)
{
localRepository
:
LocalRepository
)
{
if
(
i
sEnabled
())
{
if
(
isCrashlytic
sEnabled
())
{
Thread
.
setDefaultUncaughtExceptionHandler
(
RocketChatUncaughtExceptionHandler
(
currentServerInteractor
,
Thread
.
setDefaultUncaughtExceptionHandler
(
RocketChatUncaughtExceptionHandler
(
currentServerInteractor
,
settingsInteractor
,
accountRepository
,
localRepository
))
settingsInteractor
,
accountRepository
,
localRepository
))
}
}
}
}
private
fun
i
sEnabled
():
Boolean
{
private
fun
isCrashlytic
sEnabled
():
Boolean
{
return
!
BuildConfig
.
DEBUG
return
!
BuildConfig
.
DEBUG
}
}
private
class
RocketChatUncaughtExceptionHandler
(
private
class
RocketChatUncaughtExceptionHandler
(
val
currentServerInteractor
:
GetCurrentServerInteractor
,
val
currentServerInteractor
:
GetCurrentServerInteractor
,
val
settingsInteractor
:
GetSettingsInteractor
,
val
settingsInteractor
:
GetSettingsInteractor
,
val
accountRepository
:
AccountsRepository
,
val
accountRepository
:
AccountsRepository
,
...
@@ -65,5 +57,11 @@ object CrashlyticsWrapper {
...
@@ -65,5 +57,11 @@ object CrashlyticsWrapper {
throw
RuntimeException
(
"Missing default exception handler"
)
throw
RuntimeException
(
"Missing default exception handler"
)
}
}
}
}
}
}
}
private
const
val
KEY_CURRENT_SERVER
=
"CURRENT_SERVER"
private
const
val
KEY_CURRENT_USER
=
"CURRENT_USER"
private
const
val
KEY_CURRENT_USERNAME
=
"CURRENT_USERNAME"
private
const
val
KEY_ACCOUNTS
=
"ACCOUNTS"
private
const
val
KEY_SETTINGS_SIZE
=
"SETTINGS_SIZE"
private
const
val
KEY_SETTINGS_BASE_URL
=
"SETTINGS_BASE_URL"
\ No newline at end of file
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