mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-12 11:14:20 +00:00
Clean up join open group screen
This commit is contained in:
parent
23100962e3
commit
d8ba01cf5d
@ -40,6 +40,7 @@ import org.thoughtcrime.securesms.loki.fragments.ScanQRCodeWrapperFragmentDelega
|
|||||||
import org.thoughtcrime.securesms.loki.protocol.MultiDeviceProtocol
|
import org.thoughtcrime.securesms.loki.protocol.MultiDeviceProtocol
|
||||||
import org.thoughtcrime.securesms.loki.viewmodel.DefaultGroupsViewModel
|
import org.thoughtcrime.securesms.loki.viewmodel.DefaultGroupsViewModel
|
||||||
import org.thoughtcrime.securesms.loki.viewmodel.State
|
import org.thoughtcrime.securesms.loki.viewmodel.State
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
class JoinPublicChatActivity : PassphraseRequiredActionBarActivity(), ScanQRCodeWrapperFragmentDelegate {
|
class JoinPublicChatActivity : PassphraseRequiredActionBarActivity(), ScanQRCodeWrapperFragmentDelegate {
|
||||||
private val adapter = JoinPublicChatActivityAdapter(this)
|
private val adapter = JoinPublicChatActivityAdapter(this)
|
||||||
@ -179,6 +180,7 @@ class EnterChatURLFragment : Fragment() {
|
|||||||
joinPublicChatButton.setOnClickListener { joinPublicChatIfPossible() }
|
joinPublicChatButton.setOnClickListener { joinPublicChatIfPossible() }
|
||||||
viewModel.defaultRooms.observe(viewLifecycleOwner) { state ->
|
viewModel.defaultRooms.observe(viewLifecycleOwner) { state ->
|
||||||
defaultRoomsContainer.isVisible = state is State.Success
|
defaultRoomsContainer.isVisible = state is State.Success
|
||||||
|
defaultRoomsLoaderContainer.isVisible = state is State.Loading
|
||||||
defaultRoomsLoader.isVisible = state is State.Loading
|
defaultRoomsLoader.isVisible = state is State.Loading
|
||||||
when (state) {
|
when (state) {
|
||||||
State.Loading -> {
|
State.Loading -> {
|
||||||
@ -210,7 +212,6 @@ class EnterChatURLFragment : Fragment() {
|
|||||||
chip.setOnClickListener {
|
chip.setOnClickListener {
|
||||||
(requireActivity() as JoinPublicChatActivity).joinPublicChatIfPossible(defaultGroup.joinURL)
|
(requireActivity() as JoinPublicChatActivity).joinPublicChatIfPossible(defaultGroup.joinURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultRoomsGridLayout.addView(chip)
|
defaultRoomsGridLayout.addView(chip)
|
||||||
}
|
}
|
||||||
if ((groups.size and 1) != 0) { // This checks that the number of rooms is even
|
if ((groups.size and 1) != 0) { // This checks that the number of rooms is even
|
||||||
@ -222,7 +223,7 @@ class EnterChatURLFragment : Fragment() {
|
|||||||
private fun joinPublicChatIfPossible() {
|
private fun joinPublicChatIfPossible() {
|
||||||
val inputMethodManager = requireContext().getSystemService(BaseActionBarActivity.INPUT_METHOD_SERVICE) as InputMethodManager
|
val inputMethodManager = requireContext().getSystemService(BaseActionBarActivity.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||||
inputMethodManager.hideSoftInputFromWindow(chatURLEditText.windowToken, 0)
|
inputMethodManager.hideSoftInputFromWindow(chatURLEditText.windowToken, 0)
|
||||||
val chatURL = chatURLEditText.text.trim().toString().toLowerCase()
|
val chatURL = chatURLEditText.text.trim().toString().toLowerCase(Locale.US)
|
||||||
(requireActivity() as JoinPublicChatActivity).joinPublicChatIfPossible(chatURL)
|
(requireActivity() as JoinPublicChatActivity).joinPublicChatIfPossible(chatURL)
|
||||||
}
|
}
|
||||||
// endregion
|
// endregion
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/contentView"
|
android:id="@+id/contentView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
@ -13,23 +15,37 @@
|
|||||||
android:elevation="1dp" />
|
android:elevation="1dp" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
style="@style/SessionEditText"
|
style="@style/SmallSessionEditText"
|
||||||
android:id="@+id/chatURLEditText"
|
android:id="@+id/chatURLEditText"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="64dp"
|
||||||
android:layout_marginLeft="@dimen/large_spacing"
|
android:layout_marginLeft="@dimen/large_spacing"
|
||||||
android:layout_marginTop="@dimen/large_spacing"
|
android:layout_marginTop="@dimen/large_spacing"
|
||||||
android:layout_marginRight="@dimen/large_spacing"
|
android:layout_marginRight="@dimen/large_spacing"
|
||||||
android:inputType="textWebEmailAddress"
|
android:inputType="textWebEmailAddress|textMultiLine"
|
||||||
|
android:paddingTop="0dp"
|
||||||
|
android:paddingBottom="0dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:maxLines="3"
|
||||||
android:hint="@string/fragment_enter_chat_url_edit_text_hint" />
|
android:hint="@string/fragment_enter_chat_url_edit_text_hint" />
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/defaultRoomsLoaderContainer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:layout_marginTop="56dp"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
<com.github.ybq.android.spinkit.SpinKitView
|
<com.github.ybq.android.spinkit.SpinKitView
|
||||||
android:visibility="gone"
|
|
||||||
android:id="@+id/defaultRoomsLoader"
|
android:id="@+id/defaultRoomsLoader"
|
||||||
style="@style/SpinKitView.Small.WanderingCubes"
|
style="@style/SpinKitView.Large.ThreeBounce"
|
||||||
android:layout_marginVertical="16dp"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"
|
||||||
|
app:SpinKit_Color="@color/text"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_centerInParent="true" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/contentView"
|
android:id="@+id/contentView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
@ -16,20 +18,34 @@
|
|||||||
style="@style/SmallSessionEditText"
|
style="@style/SmallSessionEditText"
|
||||||
android:id="@+id/chatURLEditText"
|
android:id="@+id/chatURLEditText"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="64dp"
|
||||||
android:layout_marginLeft="@dimen/large_spacing"
|
android:layout_marginLeft="@dimen/large_spacing"
|
||||||
android:layout_marginTop="@dimen/large_spacing"
|
android:layout_marginTop="@dimen/large_spacing"
|
||||||
android:layout_marginRight="@dimen/large_spacing"
|
android:layout_marginRight="@dimen/large_spacing"
|
||||||
android:inputType="textWebEmailAddress"
|
android:inputType="textWebEmailAddress|textMultiLine"
|
||||||
|
android:paddingTop="0dp"
|
||||||
|
android:paddingBottom="0dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:maxLines="3"
|
||||||
android:hint="@string/fragment_enter_chat_url_edit_text_hint" />
|
android:hint="@string/fragment_enter_chat_url_edit_text_hint" />
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/defaultRoomsLoaderContainer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:layout_marginTop="56dp"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
<com.github.ybq.android.spinkit.SpinKitView
|
<com.github.ybq.android.spinkit.SpinKitView
|
||||||
android:visibility="gone"
|
|
||||||
android:id="@+id/defaultRoomsLoader"
|
android:id="@+id/defaultRoomsLoader"
|
||||||
style="@style/SpinKitView.Small.WanderingCubes"
|
style="@style/SpinKitView.Large.ThreeBounce"
|
||||||
android:layout_marginVertical="16dp"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"
|
||||||
|
app:SpinKit_Color="@color/text"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_centerInParent="true" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
@ -168,7 +168,7 @@ object SnodeAPI {
|
|||||||
val validationCount = 3
|
val validationCount = 3
|
||||||
val sessionIDByteCount = 33
|
val sessionIDByteCount = 33
|
||||||
// Hash the ONS name using BLAKE2b
|
// Hash the ONS name using BLAKE2b
|
||||||
val onsName = onsName.toLowerCase(Locale.ENGLISH)
|
val onsName = onsName.toLowerCase(Locale.US)
|
||||||
val nameAsData = onsName.toByteArray()
|
val nameAsData = onsName.toByteArray()
|
||||||
val nameHash = ByteArray(GenericHash.BYTES)
|
val nameHash = ByteArray(GenericHash.BYTES)
|
||||||
if (!sodium.cryptoGenericHash(nameHash, nameHash.size, nameAsData, nameAsData.size.toLong())) {
|
if (!sodium.cryptoGenericHash(nameHash, nameHash.size, nameAsData, nameAsData.size.toLong())) {
|
||||||
|
Loading…
Reference in New Issue
Block a user