Skip to content

Conversation

@filipeotero
Copy link
Contributor

Purpose

This PR is to count the number of notifications by requesting the backend at the dynamo side, counting and sending it to the webApp.
The implementation depends on this PR: DynamoDS/NotificationCenter#24

Declarations

Check these if you believe they are true

  • The codebase is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated

Reviewers

@QilongTang @zeusongit @reddyashish

FYIs

@jesusalvino @RobertGlobant20

using (StreamReader reader = new StreamReader(stream))
{
jsonStringFile = reader.ReadToEnd();
notificationsModel = JsonConvert.DeserializeObject<NotificationsModel>(jsonStringFile);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Setting the notifications to a defined model

jsonStringFile = reader.ReadToEnd();
notificationsModel = JsonConvert.DeserializeObject<NotificationsModel>(jsonStringFile);

var notificationsNumber = notificationsModel.Notifications.Count();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is counting all the notifications, but we may add a comparison between the read notification and the new ones.


private void WebView_NavigationCompleted(object sender, Microsoft.Web.WebView2.Core.CoreWebView2NavigationCompletedEventArgs e)
{
AddNotifications(notificationsModel.Notifications);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We make sure navigation is completed before calling the js function

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this because otherwise the js function may not exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the navigation completed subscription makes sure the page content is loaded.

@QilongTang QilongTang added this to the 2.16.0 milestone Aug 24, 2022
Copy link
Contributor

@QilongTang QilongTang left a comment

Choose a reason for hiding this comment

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

These looks fine to me, what do you think @zeusongit @reddyashish ?

@QilongTang QilongTang merged commit 5ef411d into DynamoDS:master Aug 25, 2022
@QilongTang
Copy link
Contributor

@filipeotero Would you cherry-pick this PR to RC branch?

QilongTang pushed a commit that referenced this pull request Aug 25, 2022
* DYN-5189 update notifications number (#13232)

* fetching the notifications and counting the number

* setting shortcut viewmodel to internal

* setting shortcut viewmodel to internal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants