Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #4294: After deleting a profile deleted successfully message should be displayed #4887

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
c8b91a4
added snackbar
Akshatkamboj14 Mar 2, 2023
8257029
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
Akshatkamboj14 Mar 2, 2023
7e57949
merged into develop
Akshatkamboj14 Mar 2, 2023
38f0f6e
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
Akshatkamboj14 Mar 10, 2023
748d8a1
changed the timing to short
Akshatkamboj14 Mar 11, 2023
f631b95
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
Akshatkamboj14 Mar 11, 2023
6ea61fb
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
Akshatkamboj14 Apr 4, 2023
a5a9a56
added comments
Akshatkamboj14 Apr 4, 2023
44e9e3b
added comments
Akshatkamboj14 Apr 4, 2023
80fbab2
added comments
Akshatkamboj14 Apr 4, 2023
84ca7c6
added comments
Akshatkamboj14 Apr 4, 2023
9c687fa
Merge branch 'develop' into After-deleting-a-profile-Deleted-successf…
adhiamboperes Apr 19, 2023
824fc2d
added snackbar
Akshatkamboj14 Apr 25, 2023
0eabafe
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
Akshatkamboj14 Apr 25, 2023
85f8dbc
added snackbar
Akshatkamboj14 Apr 25, 2023
257e961
added snackbar
Akshatkamboj14 Apr 25, 2023
8960942
added snackbar
Akshatkamboj14 Apr 25, 2023
958b911
Merge branch 'After-deleting-a-profile-Deleted-successfully-message-s…
Akshatkamboj14 Apr 26, 2023
31faaef
added snackbar-request-provider-id
Akshatkamboj14 May 3, 2023
a3a3c19
rearranged-imports
Akshatkamboj14 May 3, 2023
46b1418
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
Akshatkamboj14 May 3, 2023
e5f39e9
rearranged-imports
Akshatkamboj14 May 3, 2023
39740b8
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
Akshatkamboj14 May 14, 2023
84da79d
added test for the snackbar controller
Akshatkamboj14 May 29, 2023
2db6631
corrected import statements
Akshatkamboj14 May 29, 2023
aa06e79
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
Akshatkamboj14 Jul 4, 2023
dbe3cc4
merged-into-develop
Akshatkamboj14 Jul 10, 2023
455edf4
added two tests
Akshatkamboj14 Jul 11, 2023
b7f1542
added the main functionality tests and some few changes
Akshatkamboj14 Jul 12, 2023
2f1c932
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
Akshatkamboj14 Jul 12, 2023
4d8d714
removed unused import
Akshatkamboj14 Jul 12, 2023
c92ddfd
added Kdoc for the sealed class
Akshatkamboj14 Jul 13, 2023
f2f51be
corrected tests and kdocs
Akshatkamboj14 Jul 14, 2023
e02a1e1
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
Akshatkamboj14 Jul 18, 2023
a40b2f8
corrected issues
Akshatkamboj14 Jul 18, 2023
1501043
added last
Akshatkamboj14 Jul 30, 2023
47baaae
added snackbarManagerTest
Akshatkamboj14 Aug 3, 2023
6f89a7d
added new line at the end
Akshatkamboj14 Aug 3, 2023
9aaff1e
merged into develop
Akshatkamboj14 Aug 3, 2023
f26d0e4
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
Akshatkamboj14 Aug 3, 2023
319dd8a
test-commit
Akshatkamboj14 Aug 3, 2023
4176ab7
corrected k-doc
Akshatkamboj14 Aug 3, 2023
821c760
removed coroutine disp
Akshatkamboj14 Aug 3, 2023
a226cc1
restored
Akshatkamboj14 Aug 3, 2023
7abb519
corrected tests
Akshatkamboj14 Aug 8, 2023
5e2d339
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
Akshatkamboj14 Aug 8, 2023
8252511
started changes
Akshatkamboj14 Oct 31, 2023
3cc76fb
merged-with-develop
Akshatkamboj14 Oct 31, 2023
34f45b1
few changes
Akshatkamboj14 Nov 10, 2023
64f48ba
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
Akshatkamboj14 Nov 28, 2023
8430f81
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
Akshatkamboj14 Nov 29, 2023
fc47617
done some changes acc to gist-1
Akshatkamboj14 Nov 29, 2023
3e7d3ce
done some changes acc to gist-1
Akshatkamboj14 Nov 29, 2023
599af85
done some changes acc to gist-1
Akshatkamboj14 Nov 29, 2023
f2f1f69
done some changes acc to gist-1
Akshatkamboj14 Nov 29, 2023
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
Prev Previous commit
Next Next commit
done some changes acc to gist-1
  • Loading branch information
Akshatkamboj14 committed Nov 29, 2023
commit fc4761784c7d52c490dcf69c8e6359bca2d2b8b8
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,6 @@ private const val GET_CURRENT_SNACKBAR_STATUS_PROVIDER_ID =
class SnackbarManager @Inject constructor(private val activity: AppCompatActivity, private val snackbarController: SnackbarController) {
private var currentShowingSnackbarId: String? = null


fun showSnackbar(@StringRes messageStringId: Int, duration: SnackbarController.SnackbarDuration){
currentShowingSnackbarId = UUID.randomUUID().toString()

showSnackbar(contentView, showRequest)


}

// Must be called by activities wishing to show snackbars.
fun enableShowingSnackbars(contentView: View) {
snackbarController.getCurrentSnackbarState().toLiveData().observe(activity) { result ->
Expand All @@ -57,15 +48,13 @@ class SnackbarManager @Inject constructor(private val activity: AppCompatActivit
}

is SnackbarController.CurrentSnackbarState.WaitingToShow -> {

snackbarController.notifySnackbarShowing(

val showSnackbar = showSnackbar(contentView, request.nextRequest)
snackbarController.notifySnackbarShowing(request.snackbarId, showSnackbar.first, showSnackbar.second)
}

}
else -> {


}
}

Expand All @@ -86,19 +75,18 @@ class SnackbarManager @Inject constructor(private val activity: AppCompatActivit

val showFuture = SettableFuture.create<Unit>()
val dismissFuture = SettableFuture.create<Unit>()

Snackbar.make(activityView, showRequest.messageStringId, duration)
.addCallback(object : Snackbar.Callback() {
override fun onShown(snackbar: Snackbar) {
// snackbarController.notifySnackbarShowing()
showFuture.set(Unit)
}

override fun onDismissed(transientBottomBar: Snackbar?, event: Int) {
dismissFuture.set(Unit)

}
})
.show()
}).show()

// See: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-guava/kotlinx.coroutines.guava/as-deferred.html.
return showFuture as Deferred<Unit> to dismissFuture as Deferred<Unit>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to call asDeffered() here, not cast it, e.g. showFuture.asDeferred().

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BenHenning I am trying on this suggestion, but this is not working can you clarify more on this?
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need to import it, e.g. import kotlinx.coroutines.asDeferred.

Copy link
Member Author

@Akshatkamboj14 Akshatkamboj14 Jan 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BenHenning Already tried, not working
image

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class SnackbarController @Inject constructor(
private val asyncDataSubscriptionManager: AsyncDataSubscriptionManager,
) {

private var showFuture: Deferred<Unit>? = null
val dismissFuture = SettableFuture.create<Unit>()
private val _snackbarRequestQueue: Queue<ShowSnackbarRequest> = LinkedList()

Expand Down Expand Up @@ -54,8 +53,9 @@ class SnackbarController @Inject constructor(

fun notifySnackbarShowing(snackbarId: Int, onShow: Deferred<Unit>, onDismiss: Deferred<Unit>) {
// onDismiss is resolved when the snackbar by unique ID snackbarId is no longer showing.
CurrentSnackbarState.NotShowing

showFuture = onShow
// val showFuture = onShow.await()

}

Expand Down