Commit 8dc3027d authored by Tiago Cunha's avatar Tiago Cunha

Merge branch 'develop' into fix/validate-server-with-insecure-connection

parents 97d8fa39 57e4826a
...@@ -35,7 +35,7 @@ android { ...@@ -35,7 +35,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.compileSdkVersion targetSdkVersion rootProject.ext.compileSdkVersion
versionCode 5 versionCode 5
versionName "1.0" versionName "1.0-beta5"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
......
...@@ -4,6 +4,7 @@ import android.support.design.widget.Snackbar; ...@@ -4,6 +4,7 @@ import android.support.design.widget.Snackbar;
import android.widget.TextView; import android.widget.TextView;
import org.json.JSONObject; import org.json.JSONObject;
import chat.rocket.android.BuildConfig;
import chat.rocket.android.R; import chat.rocket.android.R;
import chat.rocket.android.RocketChatCache; import chat.rocket.android.RocketChatCache;
import chat.rocket.android.api.rest.DefaultServerPolicyApi; import chat.rocket.android.api.rest.DefaultServerPolicyApi;
...@@ -35,11 +36,18 @@ public class InputHostnameFragment extends AbstractServerConfigFragment { ...@@ -35,11 +36,18 @@ public class InputHostnameFragment extends AbstractServerConfigFragment {
@Override @Override
protected void onSetupView() { protected void onSetupView() {
setupVersionInfo();
rootView.findViewById(R.id.btn_connect).setOnClickListener(view -> handleConnect()); rootView.findViewById(R.id.btn_connect).setOnClickListener(view -> handleConnect());
serverConfigObserver.sub(); serverConfigObserver.sub();
} }
private void setupVersionInfo() {
TextView versionInfoView = (TextView) rootView.findViewById(R.id.version_info);
versionInfoView.setText(getString(R.string.version_info_text, BuildConfig.VERSION_NAME));
}
private void handleConnect() { private void handleConnect() {
final String hostname = ServerPolicyHelper.enforceHostname(getHostname()); final String hostname = ServerPolicyHelper.enforceHostname(getHostname());
......
...@@ -8,6 +8,7 @@ import android.widget.ImageView; ...@@ -8,6 +8,7 @@ import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import chat.rocket.android.BuildConfig;
import chat.rocket.android.R; import chat.rocket.android.R;
import chat.rocket.android.RocketChatCache; import chat.rocket.android.RocketChatCache;
import chat.rocket.android.api.MethodCallHelper; import chat.rocket.android.api.MethodCallHelper;
...@@ -71,7 +72,8 @@ public class SidebarMainFragment extends AbstractFragment { ...@@ -71,7 +72,8 @@ public class SidebarMainFragment extends AbstractFragment {
if (realmHelper != null) { if (realmHelper != null) {
roomsObserver = realmHelper roomsObserver = realmHelper
.createListObserver( .createListObserver(
realm -> realm.where(RoomSubscription.class).equalTo(RoomSubscription.OPEN, true).findAll()) realm -> realm.where(RoomSubscription.class).equalTo(RoomSubscription.OPEN, true)
.findAll())
.setOnUpdateListener(list -> roomListManager.setRooms(list)); .setOnUpdateListener(list -> roomListManager.setRooms(list));
currentUserObserver = realmHelper currentUserObserver = realmHelper
...@@ -102,6 +104,7 @@ public class SidebarMainFragment extends AbstractFragment { ...@@ -102,6 +104,7 @@ public class SidebarMainFragment extends AbstractFragment {
setupUserStatusButtons(); setupUserStatusButtons();
setupLogoutButton(); setupLogoutButton();
setupAddChannelButton(); setupAddChannelButton();
setupVersionInfo();
roomListManager = new RoomListManager( roomListManager = new RoomListManager(
rootView.findViewById(R.id.unread_title), rootView.findViewById(R.id.unread_title),
...@@ -193,6 +196,11 @@ public class SidebarMainFragment extends AbstractFragment { ...@@ -193,6 +196,11 @@ public class SidebarMainFragment extends AbstractFragment {
}); });
} }
private void setupVersionInfo() {
TextView versionInfoView = (TextView) rootView.findViewById(R.id.version_info);
versionInfoView.setText(getString(R.string.version_info_text, BuildConfig.VERSION_NAME));
}
private void showAddRoomDialog(DialogFragment dialog) { private void showAddRoomDialog(DialogFragment dialog) {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putString("serverConfigId", serverConfigId); args.putString("serverConfigId", serverConfigId);
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/colorPrimaryDark"> android:background="?attr/colorPrimaryDark">
...@@ -49,4 +50,14 @@ ...@@ -49,4 +50,14 @@
app:fabSize="mini" app:fabSize="mini"
app:srcCompat="@drawable/ic_arrow_forward_white_24dp" /> app:srcCompat="@drawable/ic_arrow_forward_white_24dp" />
</LinearLayout> </LinearLayout>
<TextView
android:id="@+id/version_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:layout_margin="@dimen/margin_8"
android:textColor="@android:color/white"
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
tools:text="Version: 1.0" />
</FrameLayout> </FrameLayout>
\ No newline at end of file
...@@ -165,7 +165,7 @@ ...@@ -165,7 +165,7 @@
android:background="?attr/colorPrimaryDark" android:background="?attr/colorPrimaryDark"
android:elevation="2dp" android:elevation="2dp"
android:visibility="gone" android:visibility="gone"
tools:visibility="gone"> tools:visibility="visible">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -236,6 +236,19 @@ ...@@ -236,6 +236,19 @@
android:text="@string/fragment_sidebar_main_logout_title" android:text="@string/fragment_sidebar_main_logout_title"
android:textAppearance="?attr/textAppearanceListItemSmall" /> android:textAppearance="?attr/textAppearanceListItemSmall" />
</LinearLayout> </LinearLayout>
<chat.rocket.android.widget.DividerView
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/version_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="@dimen/margin_8"
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
tools:text="Version: 1.0" />
</LinearLayout> </LinearLayout>
</android.support.v4.widget.NestedScrollView> </android.support.v4.widget.NestedScrollView>
</RelativeLayout> </RelativeLayout>
...@@ -45,4 +45,6 @@ ...@@ -45,4 +45,6 @@
<string name="input_hostname_invalid_server_message">Invalid server version</string> <string name="input_hostname_invalid_server_message">Invalid server version</string>
<string name="connection_error_try_later">There\'s a connection error. Please try later.</string> <string name="connection_error_try_later">There\'s a connection error. Please try later.</string>
<string name="version_info_text">Version: %s</string>
</resources> </resources>
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