Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ import com.linecorp.linesdk.databinding.ActivityCreateOpenChatBinding
import com.linecorp.linesdk.openchat.OpenChatRoomInfo

class CreateOpenChatActivity : AppCompatActivity() {
private enum class CreateOpenChatStep { ChatroomInfo, UserProfile }
private val channelId: String by lazy { intent.getStringExtra(ARG_CHANNEL_ID).orEmpty() }

private enum class CreateOpenChatStep { ChatroomInfo, UserProfile }

private lateinit var binding: ActivityCreateOpenChatBinding

private val lineApiClient: LineApiClient by lazy {
val channelId = intent.getStringExtra(ARG_CHANNEL_ID).orEmpty()
LineApiClientBuilder(this, channelId)
.build()
}
Expand All @@ -38,6 +39,20 @@ class CreateOpenChatActivity : AppCompatActivity() {
private var currentStep = CreateOpenChatStep.ChatroomInfo

override fun onCreate(savedInstanceState: Bundle?) {
if (channelId.isBlank()) {
super.onCreate(null)

setResult(
RESULT_CANCELED,
Intent().putExtra(
ARG_ERROR_RESULT,
LineApiError("Missing channelId. Start CreateOpenChatActivity via createIntent(context, channelId).")
)
)
finish()
return
}

super.onCreate(savedInstanceState)
binding = ActivityCreateOpenChatBinding.inflate(layoutInflater)
setContentView(binding.root)
Expand Down