Skip to content

Commit ef1110f

Browse files
author
Jeff Yanta
committed
Merge branch 'develop'
2 parents 4e29f25 + d1be813 commit ef1110f

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

app/src/main/java/com/getcode/manager/AuthManager.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,8 @@ class AuthManager @Inject constructor(
218218
.doOnSuccess {
219219
savePrefs(phone!!, user!!)
220220
launch { updateFcmToken(owner, user!!.dataContainerId.toByteArray()) }
221-
launch {
222-
exchange.fetchRatesIfNeeded()
223-
historyController.fetchChats()
224-
}
221+
launch { exchange.fetchRatesIfNeeded() }
222+
launch { historyController.fetchChats() }
225223
if (!BuildConfig.DEBUG) Bugsnag.setUser(null, phone?.phoneNumber, null)
226224
}
227225
}

app/src/main/java/com/getcode/view/main/chat/ChatScreen.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ fun ChatScreen(
167167
CodeButton(
168168
modifier = Modifier.weight(1f),
169169
onClick = {
170+
if (!state.isSubscribed) {
171+
dispatch(ChatViewModel.Event.OnSubscribeToggled)
172+
return@CodeButton
173+
}
174+
170175
BottomBarManager.showMessage(
171176
BottomBarManager.BottomBarMessage(
172177
title = context.getString(R.string.prompt_title_unsubscribe, title),
@@ -179,7 +184,7 @@ fun ChatScreen(
179184
},
180185
shape = RectangleShape,
181186
buttonState = ButtonState.Subtle,
182-
text = stringResource(R.string.action_unsubscribe)
187+
text = if (state.isSubscribed) stringResource(R.string.action_unsubscribe) else stringResource(id = R.string.action_subscribe)
183188
)
184189
}
185190
}

app/src/main/java/com/getcode/view/main/chat/ChatViewModel.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ class ChatViewModel @Inject constructor(
175175
title = event.chat.title,
176176
canMute = event.chat.canMute,
177177
isMuted = event.chat.isMuted,
178+
isSubscribed = event.chat.isSubscribed,
178179
canUnsubscribe = event.chat.canUnsubscribe,
179180
)
180181
}

0 commit comments

Comments
 (0)