Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
InstiApp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
RAHUL SHARMA
InstiApp
Commits
f2c027bc
Commit
f2c027bc
authored
Sep 30, 2018
by
Varun Patil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PATCH FCM ID in place of deprecated GET API
parent
6334fb91
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
4 deletions
+20
-4
app/src/main/java/app/insti/activity/MainActivity.java
app/src/main/java/app/insti/activity/MainActivity.java
+4
-2
app/src/main/java/app/insti/api/RetrofitInterface.java
app/src/main/java/app/insti/api/RetrofitInterface.java
+4
-2
app/src/main/java/app/insti/api/model/UserFCMPatchRequest.java
...rc/main/java/app/insti/api/model/UserFCMPatchRequest.java
+12
-0
No files found.
app/src/main/java/app/insti/activity/MainActivity.java
View file @
f2c027bc
...
...
@@ -46,6 +46,7 @@ import app.insti.SessionManager;
import
app.insti.api.EmptyCallback
;
import
app.insti.api.RetrofitInterface
;
import
app.insti.api.ServiceGenerator
;
import
app.insti.api.model.UserFCMPatchRequest
;
import
app.insti.data.Body
;
import
app.insti.data.Event
;
import
app.insti.data.Notification
;
...
...
@@ -401,9 +402,10 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
FirebaseInstanceId
.
getInstance
().
getInstanceId
().
addOnSuccessListener
(
new
OnSuccessListener
<
InstanceIdResult
>()
{
@Override
public
void
onSuccess
(
InstanceIdResult
instanceIdResult
)
{
String
fcmId
=
instanceIdResult
.
getToken
();
final
String
fcmId
=
instanceIdResult
.
getToken
();
RetrofitInterface
retrofitInterface
=
getRetrofitInterface
();
retrofitInterface
.
getUserMe
(
getSessionIDHeader
(),
fcmId
).
enqueue
(
new
Callback
<
User
>()
{
retrofitInterface
.
patchUserMe
(
getSessionIDHeader
(),
new
UserFCMPatchRequest
(
fcmId
)).
enqueue
(
new
Callback
<
User
>()
{
@Override
public
void
onResponse
(
Call
<
User
>
call
,
Response
<
User
>
response
)
{
if
(
response
.
isSuccessful
())
{
...
...
app/src/main/java/app/insti/api/RetrofitInterface.java
View file @
f2c027bc
...
...
@@ -13,6 +13,7 @@ import app.insti.api.model.ImageUploadRequest;
import
app.insti.api.model.ImageUploadResponse
;
import
app.insti.api.model.LoginResponse
;
import
app.insti.api.model.NewsFeedResponse
;
import
app.insti.api.model.UserFCMPatchRequest
;
import
app.insti.data.Event
;
import
app.insti.data.HostelMessMenu
;
import
app.insti.data.NewsArticle
;
...
...
@@ -25,6 +26,7 @@ import retrofit2.Call;
import
retrofit2.http.Body
;
import
retrofit2.http.GET
;
import
retrofit2.http.Header
;
import
retrofit2.http.PATCH
;
import
retrofit2.http.POST
;
import
retrofit2.http.Path
;
import
retrofit2.http.Query
;
...
...
@@ -78,8 +80,8 @@ public interface RetrofitInterface {
@GET
(
"user-me"
)
Call
<
User
>
getUserMe
(
@Header
(
"Cookie"
)
String
sessionID
);
@
GET
(
"user-me"
)
Call
<
User
>
getUserMe
(
@Header
(
"Cookie"
)
String
sessionID
,
@Query
(
"fcm_id"
)
String
fcmId
);
@
PATCH
(
"user-me"
)
Call
<
User
>
patchUserMe
(
@Header
(
"Cookie"
)
String
sessionID
,
@Body
UserFCMPatchRequest
userFCMPatchRequest
);
@GET
(
"user-me/ues/{eventID}"
)
Call
<
Void
>
updateUserEventStatus
(
@Header
(
"Cookie"
)
String
sessionID
,
@Path
(
"eventID"
)
String
eventID
,
@Query
(
"status"
)
int
status
);
...
...
app/src/main/java/app/insti/api/model/UserFCMPatchRequest.java
0 → 100644
View file @
f2c027bc
package
app.insti.api.model
;
import
com.google.gson.annotations.SerializedName
;
public
class
UserFCMPatchRequest
{
@SerializedName
(
"fcm_id"
)
private
String
userFCMId
;
public
UserFCMPatchRequest
(
String
userFCMId
)
{
this
.
userFCMId
=
userFCMId
;
}
}
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