Skip to content
Merged
Show file tree
Hide file tree
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
@@ -0,0 +1,3 @@
package one.mixin.android.event

object PerpsTradeCompletedEvent
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class ForwardAdapter(private val disableCheck: Boolean = false) :
if (conversations != null && conversations!!.isNotEmpty() && position < conversations!!.size) {
R.string.recent_chats
} else if (friends != null && friends!!.isNotEmpty() && position < conversations!!.size + friends!!.size) {
R.string.CONTACTS
R.string.Contacts
} else {
R.string.bots_title
},
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/one/mixin/android/ui/home/MorePage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ internal fun MorePage(
UserAvatarImage(it, 42.dp)
Spacer(Modifier.width(9.dp))
Column(Modifier.weight(1f)) {
AndroidView(factory = { context -> NameTextView(context) }, update = { view -> view.setName(it); view.setTextColor(profileNameColor) })
AndroidView(factory = { context -> NameTextView(context).apply { textView.textSize = 16f } }, update = { view -> view.setName(it); view.setTextColor(profileNameColor) })
Spacer(Modifier.height(4.dp))
Text(stringResource(R.string.contact_mixin_id, it.identityNumber), color = MixinAppTheme.colors.textAssist, fontSize = 12.sp, lineHeight = 14.sp, letterSpacing = 0.sp)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import one.mixin.android.Constants
import one.mixin.android.RxBus
import one.mixin.android.event.PerpsTradeCompletedEvent
import one.mixin.android.MixinApplication
import one.mixin.android.R
import one.mixin.android.api.DataErrorException
Expand Down Expand Up @@ -725,6 +727,7 @@ class PerpetualViewModel @Inject constructor(
withContext(Dispatchers.IO) {
perpsPositionDao.upsertSuspend(data)
}
RxBus.publish(PerpsTradeCompletedEvent)
onSuccess(data)
} else {
onError(response.errorCode, response.errorDescription)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ import androidx.lifecycle.lifecycleScope
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch
import one.mixin.android.R
import one.mixin.android.RxBus
import one.mixin.android.event.PerpsTradeCompletedEvent
import one.mixin.android.api.response.perps.PerpsPosition
import one.mixin.android.compose.CoilImage
import one.mixin.android.compose.theme.MixinAppTheme
Expand Down Expand Up @@ -585,6 +587,7 @@ class PerpsCloseBottomSheetDialogFragment : MixinComposeBottomSheetDialogFragmen
onSuccess = {
step = Step.Done
AnalyticsTracker.trackPerpsCloseEnd()
RxBus.publish(PerpsTradeCompletedEvent)
},
onError = { error ->
errorInfo = error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import one.mixin.android.Constants
import one.mixin.android.RxBus
import one.mixin.android.event.PerpsTradeCompletedEvent
import one.mixin.android.R
import one.mixin.android.api.DataErrorException
import one.mixin.android.api.response.perps.PerpsMarket
Expand Down Expand Up @@ -624,6 +626,7 @@ class PerpsConfirmBottomSheetDialogFragment : MixinComposeBottomSheetDialogFragm
context?.updatePinCheck()
step = Step.Done
trackPositionSuccess()
RxBus.publish(PerpsTradeCompletedEvent)
}
} catch (e: Exception) {
handleException(e)
Expand Down Expand Up @@ -692,6 +695,7 @@ class PerpsConfirmBottomSheetDialogFragment : MixinComposeBottomSheetDialogFragm
context?.updatePinCheck()
step = Step.Done
trackPositionSuccess()
RxBus.publish(PerpsTradeCompletedEvent)
} else {
errorInfo = paymentResponse.errorDescription
step = Step.Error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import one.mixin.android.R
import one.mixin.android.RxBus
import one.mixin.android.event.PerpsTradeCompletedEvent
import one.mixin.android.api.request.perps.AdjustMarginRequest
import one.mixin.android.api.response.perps.PerpsMarket
import one.mixin.android.api.response.perps.PerpsPosition
Expand Down Expand Up @@ -305,6 +307,7 @@ class PerpsMarginBottomSheetDialogFragment : MixinComposeBottomSheetDialogFragme
).show(parentFragmentManager, PerpsConfirmBottomSheetDialogFragment.TAG)
} else {
AnalyticsTracker.trackPerpsReduceMarginEnd()
RxBus.publish(PerpsTradeCompletedEvent)
toast(R.string.perps_margin_submitted)
viewModel.refreshSinglePosition(currentPosition.positionId, currentPosition.walletId)
viewModel.refreshOrders(currentPosition.walletId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.fragment.app.viewModels
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.Lifecycle.Event
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import dagger.hilt.android.AndroidEntryPoint
import com.uber.autodispose.android.lifecycle.scope
import com.uber.autodispose.autoDispose
import io.reactivex.android.schedulers.AndroidSchedulers
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
Expand All @@ -20,6 +24,8 @@ import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import one.mixin.android.Constants
import one.mixin.android.RxBus
import one.mixin.android.event.PerpsTradeCompletedEvent
import one.mixin.android.R
import one.mixin.android.api.response.perps.PerpsMarket
import one.mixin.android.compose.theme.MixinAppTheme
Expand Down Expand Up @@ -105,6 +111,10 @@ class PerpsMarketListBottomSheetDialogFragment : MixinComposeBottomSheetDialogFr
) {
super.onViewCreated(view, savedInstanceState)
observeMarkets()
RxBus.listen(PerpsTradeCompletedEvent::class.java)
.observeOn(AndroidSchedulers.mainThread())
.autoDispose(scope(Event.ON_DESTROY))
.subscribe { dismiss() }
}

@Composable
Expand Down Expand Up @@ -257,7 +267,6 @@ class PerpsMarketListBottomSheetDialogFragment : MixinComposeBottomSheetDialogFr
source = AnalyticsTracker.PerpsSource.MORE_EXPLORE,
)
}
dismiss()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ import one.mixin.android.repository.ShareCoverRepository
import one.mixin.android.repository.ReferralRepository
import one.mixin.android.session.Session
import one.mixin.android.ui.common.MixinComposeBottomSheetDialogFragment
import one.mixin.android.ui.common.drawShareCover
import one.mixin.android.ui.common.drawShareBitmap
import one.mixin.android.ui.common.applyReferralTitleTypeface
import one.mixin.android.ui.common.isZeroPercent
Expand Down Expand Up @@ -449,7 +448,7 @@ class PerpsPositionShareBottomFragment : MixinComposeBottomSheetDialogFragment()
viewLifecycleOwner.lifecycleScope.launch {
val poster = currentPosterView() ?: return@launch
if (poster.width == 0 || poster.height == 0) return@launch
val bitmap = poster.drawShareCover()
val bitmap = poster.drawShareBitmap()
showLoading(true)
try {
val coverUrl = shareCoverRepository.upload(bitmap)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class SearchAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>(), StickyRec
when (getItemViewType(position)) {
TypeMaoUser.index -> holder.bind(context.getText(R.string.MAO).toString(), false)
TypeAsset.index -> holder.bind(context.getText(R.string.ASSETS).toString(), data.assetShowMore())
TypeUser.index -> holder.bind(context.getText(R.string.CONTACTS).toString(), data.userShowMore())
TypeUser.index -> holder.bind(context.getText(R.string.Contacts).toString(), data.userShowMore())
TypeChat.index -> holder.bind(context.getText(R.string.CHATS).toString(), data.chatShowMore())
TypeMessage.index -> holder.bind(context.getText(R.string.Messages).toString().uppercase(), data.messageShowMore())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class SearchSingleFragment : BaseFragment(R.layout.fragment_search_single) {
val text =
when (type) {
TypeAsset -> requireContext().getString(R.string.ASSETS)
TypeUser -> requireContext().getText(R.string.CONTACTS)
TypeUser -> requireContext().getText(R.string.Contacts)
TypeChat -> requireContext().getText(R.string.CHATS)
TypeMessage -> requireContext().getText(R.string.SEARCH_MESSAGES)
TypeMarket -> requireContext().getString(R.string.ASSETS)
Expand Down
9 changes: 5 additions & 4 deletions app/src/main/res/layout/item_perps_position_share_poster.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<one.mixin.android.widget.gallery.internal.ui.widget.SquareFrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/poster_root"
Expand All @@ -9,15 +9,16 @@
<LinearLayout
android:id="@+id/top_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/bg_perps_position_share_card_loss"
android:clipToOutline="true"
android:orientation="vertical">

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/card_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:paddingStart="20dp"
android:paddingTop="16dp">

Expand Down Expand Up @@ -253,4 +254,4 @@
</FrameLayout>
</RelativeLayout>
</LinearLayout>
</FrameLayout>
</one.mixin.android.widget.gallery.internal.ui.widget.SquareFrameLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
<string name="contact_mobile">Móvil: %1$s</string>
<string name="contact_mute_title">Silenciar notificaciones para…</string>
<string name="contact_favorite_bots_title">Bots compartidos de %1$s</string>
<string name="CONTACTS">CONTACTOS</string>
<string name="Contacts">Contactos</string>
<string name="content_audio">[Audio]</string>
<string name="content_contact">[Contacto]</string>
<string name="content_file">[Archivo]</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-in/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
<string name="contact_mobile">Seluler: %1$s</string>
<string name="contact_mute_title">Matikan notifikasi selama…</string>
<string name="contact_favorite_bots_title">Bot bersama %1$s</string>
<string name="CONTACTS">KONTAK</string>
<string name="Contacts">Kontak</string>
<string name="content_audio">[Audio]</string>
<string name="content_contact">[Kontak]</string>
<string name="content_file">[File]</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
<string name="contact_mobile">モバイル: %1$s</string>
<string name="contact_mute_title">通知をミュート</string>
<string name="contact_favorite_bots_title">%1$s\のシェアしたミニアプリ</string>
<string name="CONTACTS">連絡先</string>
<string name="Contacts">連絡先</string>
<string name="content_audio">[音声メッセージ]</string>
<string name="content_contact">[連絡先]</string>
<string name="content_file">[ファイル]</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-ko/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@
<string name="contact_mute_title">알림 음소거…</string>
<string name="contact_new_group_chat_desc">그룹 채팅 만들기</string>
<string name="contact_favorite_bots_title">%1$s님이 가장 좋아하는 봇</string>
<string name="CONTACTS">연락처</string>
<string name="Contacts">연락처</string>
<string name="content_audio">[오디오]</string>
<string name="content_contact">[연락처]</string>
<string name="content_file">[파일]</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-ms/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
<string name="contact_mobile">Mudah alih: %1$s</string>
<string name="contact_mute_title">Senyapkan pemberitahuan untuk…</string>
<string name="contact_favorite_bots_title">Aplikasi Dikongsi %1$s</string>
<string name="CONTACTS">KENALAN</string>
<string name="Contacts">Kenalan</string>
<string name="content_audio">[Audio]</string>
<string name="content_contact">[Hubungi]</string>
<string name="content_file">[Fail]</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@
<string name="contact_mobile">Мобильный: %1$s</string>
<string name="contact_mute_title">Отключить уведомления для…</string>
<string name="contact_favorite_bots_title">Общие боты пользователя %1$s</string>
<string name="CONTACTS">КОНТАКТЫ</string>
<string name="Contacts">Контакты</string>
<string name="content_audio">[Аудио]</string>
<string name="content_contact">[Контакт]</string>
<string name="content_file">[Файл]</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
<string name="contact_mute_title">静音通知</string>
<string name="contact_new_group_chat_desc">创建一个群聊</string>
<string name="contact_favorite_bots_title">%1$s收藏的机器人</string>
<string name="CONTACTS">联系人</string>
<string name="Contacts">联系人</string>
<string name="content_audio">[语音]</string>
<string name="content_contact">[联系人]</string>
<string name="content_file">[文件]</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
<string name="contact_mobile">手機:%1$s</string>
<string name="contact_mute_title">靜音通知</string>
<string name="contact_favorite_bots_title">%1$s分享的機器人</string>
<string name="CONTACTS">聯絡人</string>
<string name="Contacts">聯絡人</string>
<string name="content_audio">[語音]</string>
<string name="content_contact">[聯絡人]</string>
<string name="content_file">[檔案]</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@
<string name="contact_mute_title">Mute notifications for…</string>
<string name="contact_new_group_chat_desc">Create a group chat</string>
<string name="contact_favorite_bots_title">%1$s\'s Favorite Bots</string>
<string name="CONTACTS">CONTACTS</string>
<string name="Contacts">Contacts</string>
<string name="content_audio">[Audio]</string>
<string name="content_contact">[Contact]</string>
<string name="content_file">[File]</string>
Expand Down
Loading