Commit f626e6e4 authored by Corentin Mors's avatar Corentin Mors
Browse files

Add production server and room setting

parent 4e45ce09
......@@ -11,7 +11,7 @@ public class ChatApplication extends Application {
private Socket mSocket;
{
try {
mSocket = IO.socket("http://192.168.43.158:3000");
mSocket = IO.socket("https://onmap.pixelswap.fr/");
} catch(Exception e){
e.printStackTrace();
}
......
......@@ -56,6 +56,7 @@ public class ChatFragment extends Fragment {
private String mUsername;
private Socket mSocket;
private String mRoom;
private String mPassword;
public SharedPreferences settings;
......@@ -258,7 +259,8 @@ public class ChatFragment extends Fragment {
private void startSignIn() {
mUsername = settings.getString("mUsername", "Guest");
mPassword = settings.getString("mPassword", "azerty");
mSocket.emit("add user", mUsername, "one");
mRoom = settings.getString("mRoom", "default");
mSocket.emit("add user", mUsername, mRoom);
//Intent intent = new Intent(getActivity(), LoginActivity.class);
//startActivityForResult(intent, REQUEST_LOGIN);
}
......
......@@ -25,11 +25,11 @@ public class SettingsActivity extends AppCompatActivity {
public void onClick(View view) {
SharedPreferences.Editor edit = settings.edit();
EditText serverInput = findViewById(R.id.editServer);
EditText roomInput = findViewById(R.id.editRoom);
EditText usernameInput = findViewById(R.id.editUsername);
EditText passwordInput = findViewById(R.id.editPassword);
edit.putString("serverAddress", serverInput.getText().toString());
edit.putString("mRoom", roomInput.getText().toString());
edit.putString("mUsername", usernameInput.getText().toString());
edit.putString("mPassword", passwordInput.getText().toString());
edit.apply();
......
......@@ -7,18 +7,18 @@
tools:context=".SettingsActivity">
<TextView
android:id="@+id/textServer"
android:id="@+id/textRoom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="8dp"
android:text="onMap Server URL"
android:text="Room"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/editServer"
android:id="@+id/editRoom"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
......@@ -28,10 +28,10 @@
android:layout_marginRight="16dp"
android:ems="10"
android:inputType="textUri"
android:text="http://192.168.43.158:3000"
android:text="myroom"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textServer" />
app:layout_constraintTop_toBottomOf="@+id/textRoom" />
<TextView
android:id="@+id/textUsername"
......@@ -42,7 +42,7 @@
android:layout_marginTop="16dp"
android:text="Username"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/editServer" />
app:layout_constraintTop_toBottomOf="@+id/editRoom" />
<EditText
android:id="@+id/editUsername"
......
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