@@ -22,6 +22,7 @@ import org.xmtp.android.example.conversation.ConversationDetailActivity
22
22
import org.xmtp.android.example.conversation.ConversationsAdapter
23
23
import org.xmtp.android.example.conversation.ConversationsClickListener
24
24
import org.xmtp.android.example.conversation.NewConversationBottomSheet
25
+ import org.xmtp.android.example.conversation.NewGroupBottomSheet
25
26
import org.xmtp.android.example.databinding.ActivityMainBinding
26
27
import org.xmtp.android.example.pushnotifications.PushNotificationTokenManager
27
28
import org.xmtp.android.example.utils.KeyUtil
@@ -35,6 +36,7 @@ class MainActivity : AppCompatActivity(),
35
36
private lateinit var accountManager: AccountManager
36
37
private lateinit var adapter: ConversationsAdapter
37
38
private var bottomSheet: NewConversationBottomSheet ? = null
39
+ private var groupBottomSheet: NewGroupBottomSheet ? = null
38
40
39
41
override fun onCreate (savedInstanceState : Bundle ? ) {
40
42
super .onCreate(savedInstanceState)
@@ -48,7 +50,7 @@ class MainActivity : AppCompatActivity(),
48
50
return
49
51
}
50
52
51
- ClientManager .createClient(keys)
53
+ ClientManager .createClient(keys, this )
52
54
53
55
binding = ActivityMainBinding .inflate(layoutInflater)
54
56
setContentView(binding.root)
@@ -67,6 +69,10 @@ class MainActivity : AppCompatActivity(),
67
69
openConversationDetail()
68
70
}
69
71
72
+ binding.groupFab.setOnClickListener {
73
+ openGroupDetail()
74
+ }
75
+
70
76
lifecycleScope.launch {
71
77
repeatOnLifecycle(Lifecycle .State .STARTED ) {
72
78
ClientManager .clientState.collect(::ensureClientState)
@@ -86,6 +92,7 @@ class MainActivity : AppCompatActivity(),
86
92
87
93
override fun onDestroy () {
88
94
bottomSheet?.dismiss()
95
+ groupBottomSheet?.dismiss()
89
96
super .onDestroy()
90
97
}
91
98
@@ -127,6 +134,7 @@ class MainActivity : AppCompatActivity(),
127
134
is ClientManager .ClientState .Ready -> {
128
135
viewModel.fetchConversations()
129
136
binding.fab.visibility = View .VISIBLE
137
+ binding.groupFab.visibility = View .VISIBLE
130
138
}
131
139
is ClientManager .ClientState .Error -> showError(clientState.message)
132
140
is ClientManager .ClientState .Unknown -> Unit
@@ -193,4 +201,11 @@ class MainActivity : AppCompatActivity(),
193
201
NewConversationBottomSheet .TAG
194
202
)
195
203
}
204
+ private fun openGroupDetail () {
205
+ groupBottomSheet = NewGroupBottomSheet .newInstance()
206
+ groupBottomSheet?.show(
207
+ supportFragmentManager,
208
+ NewGroupBottomSheet .TAG
209
+ )
210
+ }
196
211
}
0 commit comments