Refactor conversation.start
parent
634ec8f86c
commit
db0eae80eb
@ -0,0 +1,35 @@
|
||||
package org.thoughtcrime.securesms.conversation.start.home
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.fragment.app.Fragment
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import org.session.libsession.utilities.TextSecurePreferences
|
||||
import org.thoughtcrime.securesms.conversation.start.NewConversationDelegate
|
||||
import org.thoughtcrime.securesms.conversation.start.NullNewConversationDelegate
|
||||
import org.thoughtcrime.securesms.ui.createThemedComposeView
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class NewConversationHomeFragment : Fragment() {
|
||||
|
||||
@Inject
|
||||
lateinit var textSecurePreferences: TextSecurePreferences
|
||||
|
||||
var delegate = MutableStateFlow<NewConversationDelegate>(NullNewConversationDelegate)
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View = createThemedComposeView {
|
||||
NewConversationScreen(
|
||||
accountId = TextSecurePreferences.getLocalNumber(requireContext())!!,
|
||||
delegate = delegate.collectAsState().value
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package org.thoughtcrime.securesms.conversation.start.invitefriend
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.fragment.app.Fragment
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import org.session.libsession.utilities.TextSecurePreferences
|
||||
import org.thoughtcrime.securesms.conversation.start.NewConversationDelegate
|
||||
import org.thoughtcrime.securesms.preferences.copyPublicKey
|
||||
import org.thoughtcrime.securesms.preferences.sendInvitationToUseSession
|
||||
import org.thoughtcrime.securesms.ui.createThemedComposeView
|
||||
|
||||
@AndroidEntryPoint
|
||||
class InviteFriendFragment : Fragment() {
|
||||
lateinit var delegate: NewConversationDelegate
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View = createThemedComposeView {
|
||||
InviteFriend(
|
||||
TextSecurePreferences.getLocalNumber(LocalContext.current)!!,
|
||||
onBack = { delegate.onDialogBackPressed() },
|
||||
onClose = { delegate.onDialogClosePressed() },
|
||||
copyPublicKey = requireContext()::copyPublicKey,
|
||||
sendInvitation = requireContext()::sendInvitationToUseSession,
|
||||
)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue