#12 ui_sprint_2

Merged
gegham merged 7 commits from ui_sprint_2 into dev 4 years ago
There is no content yet.
gegham was assigned by musheghsahakyan98 4 years ago
gegham requested changes 4 years ago
@@ -447,2 +460,4 @@
return liveData;
}

private void showNetworkNotAvailableMessage(Throwable throwable , Context context){
gegham commented 4 years ago

This UI operation should not be in the Repository. The repo should just return the No network message to UI. The UI should see if status error and the message is no network then call a base activity method that shows the toast: showNetworkNotAvailableMessage() ( method in base activity )

This UI operation should not be in the Repository. The repo should just return the No network message to UI. The UI should see if status error and the message is no network then call a base activity method that shows the toast: showNetworkNotAvailableMessage() ( method in base activity )
gegham requested changes 4 years ago
@@ -60,1 +72,4 @@
}

protected void showNetworkNotAvailableMessage(Context context) {
if (context instanceof LoginActivity) {
gegham commented 4 years ago

if (context instanceof LoginActivity) {
((LoginActivity) context).runOnUiThread(new Runnable() {
@Override public void run() {

We don’t need this codes anymore, and the method doesn’t need to take a context parameter, as it already has a context.

if (context instanceof LoginActivity) { ((LoginActivity) context).runOnUiThread(new Runnable() { @Override public void run() { We don't need this codes anymore, and the method doesn't need to take a context parameter, as it already has a context.
@@ -191,6 +195,9 @@ public class LoginActivity extends BaseActivityBubble {
break;
case ERROR:
closeLoadingDialog();
if("no network".equals(userStatusResource.message)){
gegham commented 4 years ago

Fix hardcode. Keep the param as static in repository class.
Swap the variables for readability. if(userStatusResource.message.equals(“no network”)){

Fix hardcode. Keep the param as static in repository class. Swap the variables for readability. if(userStatusResource.message.equals("no network")){
@@ -449,0 +471,4 @@

private void setErrorMessage(Throwable throwable , NetworkBoundStatusResource<User> liveData){
if( throwable instanceof UnknownHostException || throwable instanceof ConnectException){
liveData.postMutableLiveData(StatusResource.error("no network"));
gegham commented 4 years ago

Fix the hardcode, reuse the static property in LoginActivity too.

Fix the hardcode, reuse the static property in LoginActivity too.
gegham approved these changes 4 years ago
gegham closed this pull request 4 years ago
gegham deleted branch ui_sprint_2 4 years ago

Reviewers

gegham approved these changes 4 years ago
The pull request has been merged as 8d605ba5c1.
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This pull request currently doesn't have any dependencies.

Loading…
There is no content yet.