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
a436dc0e
Unverified
Commit
a436dc0e
authored
Apr 03, 2018
by
Filipe de Lima Brito
Committed by
GitHub
Apr 03, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop-2.x' into new/insert-username
parents
2e8a0993
30b3b8b0
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
14 deletions
+21
-14
build.gradle
app/build.gradle
+2
-2
MainPresenter.kt
...va/chat/rocket/android/main/presentation/MainPresenter.kt
+2
-1
MainActivity.kt
...src/main/java/chat/rocket/android/main/ui/MainActivity.kt
+7
-3
FirebaseTokenService.kt
...ain/java/chat/rocket/android/push/FirebaseTokenService.kt
+10
-8
No files found.
app/build.gradle
View file @
a436dc0e
...
@@ -13,8 +13,8 @@ android {
...
@@ -13,8 +13,8 @@ android {
applicationId
"chat.rocket.android"
applicationId
"chat.rocket.android"
minSdkVersion
21
minSdkVersion
21
targetSdkVersion
versions
.
targetSdk
targetSdkVersion
versions
.
targetSdk
versionCode
200
1
versionCode
200
2
versionName
"2.0.0-beta
1
"
versionName
"2.0.0-beta
2
"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled
true
multiDexEnabled
true
}
}
...
...
app/src/main/java/chat/rocket/android/main/presentation/MainPresenter.kt
View file @
a436dc0e
...
@@ -144,7 +144,8 @@ class MainPresenter @Inject constructor(
...
@@ -144,7 +144,8 @@ class MainPresenter @Inject constructor(
suspend
fun
refreshToken
(
token
:
String
?)
{
suspend
fun
refreshToken
(
token
:
String
?)
{
token
?.
let
{
token
?.
let
{
client
.
registerPushToken
(
it
,
getAccountsInteractor
.
get
(),
factory
)
localRepository
.
save
(
LocalRepository
.
KEY_PUSH_TOKEN
,
token
)
client
.
registerPushToken
(
token
,
getAccountsInteractor
.
get
(),
factory
)
}
}
}
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/main/ui/MainActivity.kt
View file @
a436dc0e
...
@@ -49,9 +49,13 @@ class MainActivity : AppCompatActivity(), MainView, HasActivityInjector, HasSupp
...
@@ -49,9 +49,13 @@ class MainActivity : AppCompatActivity(), MainView, HasActivityInjector, HasSupp
setContentView
(
R
.
layout
.
activity_main
)
setContentView
(
R
.
layout
.
activity_main
)
launch
(
CommonPool
)
{
launch
(
CommonPool
)
{
try
{
val
token
=
InstanceID
.
getInstance
(
this
@MainActivity
).
getToken
(
getString
(
R
.
string
.
gcm_sender_id
),
GoogleCloudMessaging
.
INSTANCE_ID_SCOPE
,
null
)
val
token
=
InstanceID
.
getInstance
(
this
@MainActivity
).
getToken
(
getString
(
R
.
string
.
gcm_sender_id
),
GoogleCloudMessaging
.
INSTANCE_ID_SCOPE
,
null
)
Timber
.
d
(
"GCM token: $token"
)
Timber
.
d
(
"GCM token: $token"
)
presenter
.
refreshToken
(
token
)
presenter
.
refreshToken
(
token
)
}
catch
(
ex
:
Exception
)
{
Timber
.
d
(
ex
,
"Missing play services..."
)
}
}
}
presenter
.
connect
()
presenter
.
connect
()
...
...
app/src/main/java/chat/rocket/android/push/FirebaseTokenService.kt
View file @
a436dc0e
...
@@ -35,11 +35,12 @@ class FirebaseTokenService : FirebaseInstanceIdService() {
...
@@ -35,11 +35,12 @@ class FirebaseTokenService : FirebaseInstanceIdService() {
// default push gateway. We should register this project's own project sender id into it.
// default push gateway. We should register this project's own project sender id into it.
val
gcmToken
=
InstanceID
.
getInstance
(
this
)
val
gcmToken
=
InstanceID
.
getInstance
(
this
)
.
getToken
(
getString
(
R
.
string
.
gcm_sender_id
),
GoogleCloudMessaging
.
INSTANCE_ID_SCOPE
,
null
)
.
getToken
(
getString
(
R
.
string
.
gcm_sender_id
),
GoogleCloudMessaging
.
INSTANCE_ID_SCOPE
,
null
)
val
currentServer
=
getCurrentServerInteractor
.
get
()
!!
val
currentServer
=
getCurrentServerInteractor
.
get
()
val
client
=
factory
.
create
(
currentServer
)
val
client
=
currentServer
?.
let
{
factory
.
create
(
currentServer
)
}
gcmToken
?.
let
{
gcmToken
?.
let
{
localRepository
.
save
(
LocalRepository
.
KEY_PUSH_TOKEN
,
gcmToken
)
localRepository
.
save
(
LocalRepository
.
KEY_PUSH_TOKEN
,
gcmToken
)
client
?.
let
{
launch
{
launch
{
try
{
try
{
Timber
.
d
(
"Registering push token: $gcmToken for ${client.url}"
)
Timber
.
d
(
"Registering push token: $gcmToken for ${client.url}"
)
...
@@ -50,4 +51,5 @@ class FirebaseTokenService : FirebaseInstanceIdService() {
...
@@ -50,4 +51,5 @@ class FirebaseTokenService : FirebaseInstanceIdService() {
}
}
}
}
}
}
}
}
}
\ 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