-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from sendbird/release/3.17.0
3.17.0
- Loading branch information
Showing
75 changed files
with
1,589 additions
and
388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
uikit-samples/src/main/java/com/sendbird/uikit/samples/aichatbot/AiChatBotLoginActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.sendbird.uikit.samples.aichatbot | ||
|
||
import android.os.Bundle | ||
import android.view.View | ||
import com.sendbird.android.exception.SendbirdException | ||
import com.sendbird.android.push.SendbirdPushHelper | ||
import com.sendbird.android.user.User | ||
import com.sendbird.uikit.log.Logger | ||
import com.sendbird.uikit.samples.common.LoginActivity | ||
import com.sendbird.uikit.samples.common.extensions.authenticate | ||
import com.sendbird.uikit.samples.common.extensions.startingIntent | ||
import com.sendbird.uikit.samples.common.fcm.MyFirebaseMessagingService | ||
import com.sendbird.uikit.samples.common.preferences.PreferenceUtils | ||
import com.sendbird.uikit.samples.common.widgets.WaitingDialog | ||
import com.sendbird.uikit.utils.ContextUtils | ||
|
||
class AiChatBotLoginActivity : LoginActivity() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding.apply { | ||
title.visibility = View.GONE | ||
botIdLayout.visibility = View.VISIBLE | ||
notificationTitle.visibility = View.VISIBLE | ||
botId.setText(PreferenceUtils.botId.ifEmpty { "client_bot" }) | ||
} | ||
} | ||
|
||
override fun onSignUp(userId: String, nickname: String) { | ||
Logger.i(">> AiChatBotLoginActivity::onSignUp(), userId=$userId, nickname=$nickname") | ||
val botId = binding.botId.text.toString() | ||
if (botId.isEmpty()) return | ||
Logger.i("++ onSignUp botId=$botId") | ||
|
||
WaitingDialog.show(this) | ||
PreferenceUtils.botId = botId | ||
authenticate { _: User?, e: SendbirdException? -> | ||
WaitingDialog.dismiss() | ||
if (e != null) { | ||
Logger.e(e) | ||
ContextUtils.toastError(this@AiChatBotLoginActivity, "${e.message}") | ||
return@authenticate | ||
} | ||
PreferenceUtils.userId = userId | ||
PreferenceUtils.nickname = nickname | ||
SendbirdPushHelper.registerPushHandler(MyFirebaseMessagingService()) | ||
val intent = PreferenceUtils.selectedSampleType.startingIntent(this) | ||
startActivity(intent) | ||
finish() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...-samples/src/main/java/com/sendbird/uikit/samples/notification/FeedChannelListFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package com.sendbird.uikit.samples.notification | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.Fragment | ||
import com.sendbird.android.SendbirdChat | ||
import com.sendbird.uikit.SendbirdUIKit | ||
import com.sendbird.uikit.activities.FeedNotificationChannelActivity | ||
import com.sendbird.uikit.modules.components.HeaderComponent | ||
import com.sendbird.uikit.samples.R | ||
import com.sendbird.uikit.samples.common.extensions.setAppearance | ||
import com.sendbird.uikit.samples.databinding.LayoutFeedChannelListBinding | ||
import com.sendbird.uikit.samples.databinding.ViewFeedChannelItemBinding | ||
|
||
class FeedChannelListFragment : Fragment() { | ||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { | ||
return getContentView(inflater, savedInstanceState) | ||
} | ||
|
||
private fun getContentView(inflater: LayoutInflater, savedInstanceState: Bundle?): View { | ||
val binding = LayoutFeedChannelListBinding.inflate(inflater) | ||
val themeMode = SendbirdUIKit.getDefaultThemeMode() | ||
binding.feedChannelList.setBackgroundResource( | ||
if (themeMode == SendbirdUIKit.ThemeMode.Light) R.color.background_50 else R.color.background_600 | ||
) | ||
|
||
HeaderComponent().apply { | ||
this.params.title = getString(R.string.text_tab_channels) | ||
this.params.setUseLeftButton(false) | ||
this.params.setUseRightButton(false) | ||
val header = this.onCreateView(requireContext(), inflater, binding.headerComponent, savedInstanceState) | ||
binding.headerComponent.addView(header) | ||
} | ||
|
||
SendbirdChat.appInfo?.notificationInfo?.feedChannels?.let { feedChannels -> | ||
val background = if (themeMode == SendbirdUIKit.ThemeMode.Light) R.drawable.selector_rectangle_light else R.drawable.selector_rectangle_dark600 | ||
val dividerColor = if (themeMode == SendbirdUIKit.ThemeMode.Light) R.color.onlight_04 else R.color.ondark_04 | ||
val channelKeyStyle = if (themeMode == SendbirdUIKit.ThemeMode.Light) R.style.SendbirdSubtitle1OnLight01 else R.style.SendbirdSubtitle1OnDark01 | ||
val channelUrlStyle = if (themeMode == SendbirdUIKit.ThemeMode.Light) R.style.SendbirdBody3OnLight03 else R.style.SendbirdBody3OnDark03 | ||
feedChannels.entries.forEach { entry -> | ||
val itemBinding = ViewFeedChannelItemBinding.inflate(inflater) | ||
itemBinding.root.setBackgroundResource(background) | ||
itemBinding.divider.setBackgroundResource(dividerColor) | ||
itemBinding.tvChannelKey.text = entry.key | ||
itemBinding.tvChannelUrl.text = entry.value | ||
itemBinding.tvChannelKey.setAppearance(requireContext(), channelKeyStyle) | ||
itemBinding.tvChannelUrl.setAppearance(requireContext(), channelUrlStyle) | ||
itemBinding.root.setOnClickListener { | ||
startActivity( | ||
FeedNotificationChannelActivity.newIntent( | ||
requireContext(), | ||
entry.value | ||
) | ||
) | ||
} | ||
binding.feedChannelContainer.addView(itemBinding.root) | ||
} | ||
} | ||
return binding.root | ||
} | ||
} |
Oops, something went wrong.