Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fairchat.ReactNative
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hosting
chat
fairchat.ReactNative
Commits
dca2181b
Unverified
Commit
dca2181b
authored
6 years ago
by
Diego Mello
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[FIX] Load messages on notification tap (#564)
parent
bdc564c2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/sagas/deepLinking.js
+17
-13
17 additions, 13 deletions
app/sagas/deepLinking.js
app/sagas/rooms.js
+5
-4
5 additions, 4 deletions
app/sagas/rooms.js
app/sagas/selectServer.js
+1
-1
1 addition, 1 deletion
app/sagas/selectServer.js
with
23 additions
and
18 deletions
app/sagas/deepLinking.js
+
17
−
13
View file @
dca2181b
import
{
AsyncStorage
}
from
'
react-native
'
;
import
{
delay
}
from
'
redux-saga
'
;
import
{
takeLatest
,
take
,
select
,
put
takeLatest
,
take
,
select
,
put
,
all
}
from
'
redux-saga/effects
'
;
import
{
Navigation
}
from
'
react-native-navigation
'
;
...
...
@@ -51,7 +51,6 @@ const navigate = function* navigate({ params, sameServer = true }) {
const
handleOpen
=
function
*
handleOpen
({
params
})
{
const
isReady
=
yield
select
(
state
=>
state
.
app
.
ready
);
const
server
=
yield
select
(
state
=>
state
.
server
.
server
);
if
(
!
isReady
)
{
yield
take
(
types
.
APP
.
READY
);
...
...
@@ -70,26 +69,31 @@ const handleOpen = function* handleOpen({ params }) {
host
=
host
.
slice
(
0
,
host
.
length
-
1
);
}
try
{
yield
RocketChat
.
testServer
(
host
);
}
catch
(
error
)
{
return
;
}
const
token
=
yield
AsyncStorage
.
getItem
(
`
${
RocketChat
.
TOKEN_KEY
}
-
${
host
}
`
);
const
[
server
,
user
]
=
yield
all
([
AsyncStorage
.
getItem
(
'
currentServer
'
),
AsyncStorage
.
getItem
(
`
${
RocketChat
.
TOKEN_KEY
}
-
${
host
}
`
)
]);
// TODO: needs better test
// if deep link is from same server
if
(
server
===
host
)
{
if
(
token
)
{
if
(
user
)
{
yield
take
(
types
.
SERVER
.
SELECT_SUCCESS
);
yield
navigate
({
params
});
}
}
else
{
// if deep link is from a different server
}
else
{
// if deep link is from a different server
try
{
// Verify if server is real
yield
RocketChat
.
testServer
(
host
);
}
catch
(
error
)
{
return
;
}
// search if deep link's server already exists
const
servers
=
yield
database
.
databases
.
serversDB
.
objects
(
'
servers
'
).
filtered
(
'
id = $0
'
,
host
);
// TODO: need better test
if
(
servers
.
length
&&
token
)
{
if
(
servers
.
length
&&
user
)
{
yield
put
(
selectServerRequest
(
host
));
yield
take
(
types
.
METEOR
.
REQUEST
);
yield
navigate
({
params
,
sameServer
:
false
});
}
else
{
yield
put
(
appStart
(
'
outside
'
));
...
...
This diff is collapsed.
Click to expand it.
app/sagas/rooms.js
+
5
−
4
View file @
dca2181b
...
...
@@ -68,16 +68,17 @@ const watchRoomOpen = function* watchRoomOpen({ room }) {
}
opened
=
true
;
const
auth
=
yield
select
(
state
=>
state
.
login
.
isAuthenticated
);
if
(
!
auth
)
{
yield
take
(
types
.
LOGIN
.
SUCCESS
);
}
yield
put
(
messagesRequest
({
...
room
}));
if
(
room
.
_id
)
{
RocketChat
.
readMessages
(
room
.
rid
);
}
const
auth
=
yield
select
(
state
=>
state
.
login
.
isAuthenticated
);
if
(
!
auth
)
{
yield
take
(
types
.
LOGIN
.
SUCCESS
);
}
sub
=
yield
RocketChat
.
subscribeRoom
(
room
);
thread
=
yield
fork
(
usersTyping
,
{
rid
:
room
.
rid
});
...
...
This diff is collapsed.
Click to expand it.
app/sagas/selectServer.js
+
1
−
1
View file @
dca2181b
...
...
@@ -24,9 +24,9 @@ const handleSelectServer = function* handleSelectServer({ server }) {
if
(
userStringified
)
{
const
user
=
JSON
.
parse
(
userStringified
);
RocketChat
.
connect
({
server
,
user
});
yield
put
(
setUser
(
user
));
yield
put
(
actions
.
appStart
(
'
inside
'
));
RocketChat
.
connect
({
server
,
user
});
}
else
{
RocketChat
.
connect
({
server
});
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment