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 {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.compileSdkVersion
versionCode 5
versionName "1.0"
versionName "1.0-beta5"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
......
......@@ -4,6 +4,7 @@ import android.support.design.widget.Snackbar;
import android.widget.TextView;
import org.json.JSONObject;
import chat.rocket.android.BuildConfig;
import chat.rocket.android.R;
import chat.rocket.android.RocketChatCache;
import chat.rocket.android.api.rest.DefaultServerPolicyApi;
......@@ -35,11 +36,18 @@ public class InputHostnameFragment extends AbstractServerConfigFragment {
@Override
protected void onSetupView() {
setupVersionInfo();
rootView.findViewById(R.id.btn_connect).setOnClickListener(view -> handleConnect());
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() {
final String hostname = ServerPolicyHelper.enforceHostname(getHostname());
......
......@@ -8,6 +8,7 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import chat.rocket.android.BuildConfig;
import chat.rocket.android.R;
import chat.rocket.android.RocketChatCache;
import chat.rocket.android.api.MethodCallHelper;
......@@ -71,7 +72,8 @@ public class SidebarMainFragment extends AbstractFragment {
if (realmHelper != null) {
roomsObserver = realmHelper
.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));
currentUserObserver = realmHelper
......@@ -102,6 +104,7 @@ public class SidebarMainFragment extends AbstractFragment {
setupUserStatusButtons();
setupLogoutButton();
setupAddChannelButton();
setupVersionInfo();
roomListManager = new RoomListManager(
rootView.findViewById(R.id.unread_title),
......@@ -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) {
Bundle args = new Bundle();
args.putString("serverConfigId", serverConfigId);
......
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorPrimaryDark">
......@@ -49,4 +50,14 @@
app:fabSize="mini"
app:srcCompat="@drawable/ic_arrow_forward_white_24dp" />
</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>
\ No newline at end of file
......@@ -165,7 +165,7 @@
android:background="?attr/colorPrimaryDark"
android:elevation="2dp"
android:visibility="gone"
tools:visibility="gone">
tools:visibility="visible">
<LinearLayout
android:layout_width="match_parent"
......@@ -236,6 +236,19 @@
android:text="@string/fragment_sidebar_main_logout_title"
android:textAppearance="?attr/textAppearanceListItemSmall" />
</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>
</android.support.v4.widget.NestedScrollView>
</RelativeLayout>
......@@ -45,4 +45,6 @@
<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="version_info_text">Version: %s</string>
</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