Commit d9aff05a authored by Vincenzo's avatar Vincenzo Committed by GitHub

Merge branch 'develop' into fix_247_change-hostname

parents 4bf98ee3 449d6243
[![CircleCI](https://circleci.com/gh/RocketChat/Rocket.Chat.Android/tree/develop.svg?style=shield)](https://circleci.com/gh/RocketChat/Rocket.Chat.Android/tree/develop) [![Build Status](https://travis-ci.org/RocketChat/Rocket.Chat.Android.svg?branch=develop)](https://travis-ci.org/RocketChat/Rocket.Chat.Android) [![CircleCI](https://circleci.com/gh/RocketChat/Rocket.Chat.Android/tree/develop.svg?style=shield)](https://circleci.com/gh/RocketChat/Rocket.Chat.Android/tree/develop) [![Build Status](https://travis-ci.org/RocketChat/Rocket.Chat.Android.svg?branch=develop)](https://travis-ci.org/RocketChat/Rocket.Chat.Android) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/a81156a8682e4649994270d3670c3c83)](https://www.codacy.com/app/matheusjardimb/Rocket.Chat.Android)
# Rocket.Chat.Android # Rocket.Chat.Android
Rocket.Chat Native Android Application. Rocket.Chat Native Android Application.
......
...@@ -33,8 +33,8 @@ android { ...@@ -33,8 +33,8 @@ android {
applicationId "chat.rocket.android" applicationId "chat.rocket.android"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 25 targetSdkVersion 25
versionCode 23 versionCode 24
versionName "1.0.13" versionName "1.0.14"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
......
...@@ -4,21 +4,21 @@ import android.content.Intent; ...@@ -4,21 +4,21 @@ import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers;
import java.util.List; import java.util.List;
import chat.rocket.android.LaunchUtil; import chat.rocket.android.LaunchUtil;
import chat.rocket.android.RocketChatCache; import chat.rocket.android.RocketChatCache;
import chat.rocket.android.helper.Logger; import chat.rocket.android.helper.Logger;
import chat.rocket.persistence.realm.models.ddp.RealmRoom;
import chat.rocket.android.push.PushConstants; import chat.rocket.android.push.PushConstants;
import chat.rocket.android.push.PushNotificationHandler; import chat.rocket.android.push.PushNotificationHandler;
import chat.rocket.persistence.realm.RealmStore;
import chat.rocket.android.service.ConnectivityManager; import chat.rocket.android.service.ConnectivityManager;
import chat.rocket.core.models.ServerInfo; import chat.rocket.core.models.ServerInfo;
import chat.rocket.persistence.realm.RealmStore;
import chat.rocket.persistence.realm.models.ddp.RealmRoom;
import icepick.State; import icepick.State;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers;
abstract class AbstractAuthedActivity extends AbstractFragmentActivity { abstract class AbstractAuthedActivity extends AbstractFragmentActivity {
@State protected String hostname; @State protected String hostname;
...@@ -26,6 +26,7 @@ abstract class AbstractAuthedActivity extends AbstractFragmentActivity { ...@@ -26,6 +26,7 @@ abstract class AbstractAuthedActivity extends AbstractFragmentActivity {
private RocketChatCache rocketChatCache; private RocketChatCache rocketChatCache;
private CompositeDisposable compositeDisposable = new CompositeDisposable(); private CompositeDisposable compositeDisposable = new CompositeDisposable();
private boolean isNotification;
@Override @Override
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
...@@ -61,6 +62,7 @@ abstract class AbstractAuthedActivity extends AbstractFragmentActivity { ...@@ -61,6 +62,7 @@ abstract class AbstractAuthedActivity extends AbstractFragmentActivity {
} }
if (intent.hasExtra(PushConstants.NOT_ID)) { if (intent.hasExtra(PushConstants.NOT_ID)) {
isNotification = true;
PushNotificationHandler PushNotificationHandler
.cleanUpNotificationStack(intent.getIntExtra(PushConstants.NOT_ID, 0)); .cleanUpNotificationStack(intent.getIntExtra(PushConstants.NOT_ID, 0));
} }
...@@ -155,6 +157,11 @@ abstract class AbstractAuthedActivity extends AbstractFragmentActivity { ...@@ -155,6 +157,11 @@ abstract class AbstractAuthedActivity extends AbstractFragmentActivity {
subscribeToConfigChanges(); subscribeToConfigChanges();
ConnectivityManager.getInstance(getApplicationContext()).keepAliveServer(); ConnectivityManager.getInstance(getApplicationContext()).keepAliveServer();
if (isNotification) {
updateHostnameIfNeeded(rocketChatCache.getSelectedServerHostname());
updateRoomIdIfNeeded(rocketChatCache.getSelectedRoomId());
isNotification = false;
}
} }
@Override @Override
......
...@@ -52,8 +52,8 @@ public class MainActivity extends AbstractAuthedActivity implements MainContract ...@@ -52,8 +52,8 @@ public class MainActivity extends AbstractAuthedActivity implements MainContract
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
if (presenter != null && presenter instanceof MainPresenter) { if (presenter != null) {
((MainPresenter)presenter).bindViewOnly(this); presenter.bindViewOnly(this);
} }
} }
......
...@@ -28,5 +28,7 @@ public interface MainContract { ...@@ -28,5 +28,7 @@ public interface MainContract {
void onOpenRoom(String hostname, String roomId); void onOpenRoom(String hostname, String roomId);
void onRetryLogin(); void onRetryLogin();
void bindViewOnly(View view);
} }
} }
...@@ -44,6 +44,7 @@ public class MainPresenter extends BasePresenter<MainContract.View> ...@@ -44,6 +44,7 @@ public class MainPresenter extends BasePresenter<MainContract.View>
this.rocketChatCache = rocketChatCache; this.rocketChatCache = rocketChatCache;
} }
@Override
public void bindViewOnly(@NonNull MainContract.View view) { public void bindViewOnly(@NonNull MainContract.View view) {
super.bindView(view); super.bindView(view);
subscribeToUnreadCount(); subscribeToUnreadCount();
......
...@@ -4,4 +4,5 @@ ...@@ -4,4 +4,5 @@
android:id="@+id/drawee_avatar" android:id="@+id/drawee_avatar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
fresco:actualImageScaleType="fitCenter" /> fresco:actualImageScaleType="fitCenter"
\ No newline at end of file fresco:roundedCornerRadius="5dp" />
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment