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
38bb34f9
Commit
38bb34f9
authored
Jan 30, 2017
by
Tiago Cunha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Assert should only assert something
Not change state
parent
78a53a1f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
12 deletions
+5
-12
AbstractAuthedActivity.java
.../chat/rocket/android/activity/AbstractAuthedActivity.java
+5
-12
No files found.
app/src/main/java/chat/rocket/android/activity/AbstractAuthedActivity.java
View file @
38bb34f9
...
@@ -66,25 +66,18 @@ abstract class AbstractAuthedActivity extends AbstractFragmentActivity {
...
@@ -66,25 +66,18 @@ abstract class AbstractAuthedActivity extends AbstractFragmentActivity {
private
void
updateHostnameIfNeeded
(
SharedPreferences
prefs
)
{
private
void
updateHostnameIfNeeded
(
SharedPreferences
prefs
)
{
String
newHostname
=
prefs
.
getString
(
RocketChatCache
.
KEY_SELECTED_SERVER_HOSTNAME
,
null
);
String
newHostname
=
prefs
.
getString
(
RocketChatCache
.
KEY_SELECTED_SERVER_HOSTNAME
,
null
);
if
(
hostname
==
null
)
{
if
(
hostname
==
null
)
{
if
(
newHostname
!=
null
&&
assertServerRealmStoreExists
(
newHostname
,
prefs
))
{
if
(
newHostname
!=
null
&&
assertServerRealmStoreExists
(
newHostname
))
{
updateHostname
(
newHostname
);
updateHostname
(
newHostname
);
}
}
}
else
{
}
else
{
if
(!
hostname
.
equals
(
newHostname
)
&&
assertServerRealmStoreExists
(
newHostname
,
prefs
))
{
if
(!
hostname
.
equals
(
newHostname
)
&&
assertServerRealmStoreExists
(
newHostname
))
{
updateHostname
(
newHostname
);
updateHostname
(
newHostname
);
}
}
}
}
}
}
private
boolean
assertServerRealmStoreExists
(
String
hostname
,
SharedPreferences
prefs
)
{
private
boolean
assertServerRealmStoreExists
(
String
hostname
)
{
if
(
RealmStore
.
get
(
hostname
)
==
null
)
{
return
RealmStore
.
get
(
hostname
)
!=
null
;
prefs
.
edit
()
.
remove
(
RocketChatCache
.
KEY_SELECTED_SERVER_HOSTNAME
)
.
remove
(
RocketChatCache
.
KEY_SELECTED_ROOM_ID
)
.
apply
();
return
false
;
}
return
true
;
}
}
private
void
updateHostname
(
String
hostname
)
{
private
void
updateHostname
(
String
hostname
)
{
...
@@ -106,7 +99,7 @@ abstract class AbstractAuthedActivity extends AbstractFragmentActivity {
...
@@ -106,7 +99,7 @@ abstract class AbstractAuthedActivity extends AbstractFragmentActivity {
}
}
private
boolean
assertRoomSubscriptionExists
(
String
roomId
,
SharedPreferences
prefs
)
{
private
boolean
assertRoomSubscriptionExists
(
String
roomId
,
SharedPreferences
prefs
)
{
if
(!
assertServerRealmStoreExists
(
hostname
,
prefs
))
{
if
(!
assertServerRealmStoreExists
(
hostname
))
{
return
false
;
return
false
;
}
}
...
...
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