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

Monitoring XP drop #3679

Merged
merged 17 commits into from
Dec 7, 2023
Merged

Monitoring XP drop #3679

merged 17 commits into from
Dec 7, 2023

Conversation

ioay
Copy link
Contributor

@ioay ioay commented Nov 23, 2023

What

Showing notifications at the time of XP drop.

Prerequisite

The user allows the notification to be displayed.

Testing

  • if he has not yet consented to notification: click the link in the Subscape bubble / or switch Show Notification in the Settings.
  • Drop XP in contracts on your local machine

Result

Screenshot 2023-11-28 at 09 48 24

Important!

Do not merge! I'll do that, before merge we need to change notifiaction time threshold from 30sec(for testing purposes) to 24h:
NOTIFICATIONS_XP_DROP_THRESHOLD_MS_FOR_TESTING_PURPOSE to NOTIFICATIONS_XP_DROP_THRESHOLD_MS

Latest build: extension-builds-3679 (as of Wed, 06 Dec 2023 22:39:43 GMT).

Copy link
Contributor

@jagodarybacka jagodarybacka left a comment

Choose a reason for hiding this comment

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

Looks good, just small adjustments 😄

background/services/notifications/index.ts Outdated Show resolved Hide resolved
background/services/island/index.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@Shadowfiend Shadowfiend left a comment

Choose a reason for hiding this comment

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

Left a few small notes. Will revisit tomorrow to decide what if anything is blocking before merging + cutting a release.

background/main.ts Outdated Show resolved Hide resolved
background/services/island/index.ts Outdated Show resolved Hide resolved
const options = {
title: "Weekly XP distributed",
message: "Visit Subscape to see if you are eligible",
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Does clicking on this notification have any impact? This was the goal of the callback part of the notification method, which would allow for a callback that opens Subscape (via browser.tabs.create, same as the Subscape logo link I believe).

background/services/notifications/index.ts Show resolved Hide resolved
background/services/notifications/index.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@Shadowfiend Shadowfiend left a comment

Choose a reason for hiding this comment

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

Broad note: across the board, if we're using promises we should use async/await, not mix it in with .then.

I didn't get a chance to give this a full test drive with the switch back to browser WebExtension APIs. I think if we can confirm that permissions are prompted for properly (remember you have to uninstall/reinstall the extension for Chrome to reprompt for permission, possibly even change the extension id by installing it from a different location), the rest of the notes are non-blocking and we should land + cut the release.

background/services/notifications/index.ts Outdated Show resolved Hide resolved
background/services/notifications/index.ts Outdated Show resolved Hide resolved
background/services/preferences/index.ts Outdated Show resolved Hide resolved
background/services/preferences/index.ts Outdated Show resolved Hide resolved
Shadowfiend
Shadowfiend previously approved these changes Dec 6, 2023
Copy link
Contributor

@jagodarybacka jagodarybacka left a comment

Choose a reason for hiding this comment

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

On a most recent build (fresh install) I can't turn on the notifications at all because it is failing with:

Screenshot 2023-12-06 at 08 26 35

@jagodarybacka
Copy link
Contributor

import browser from "webextension-polyfill" may be the solution 🧐

@ioay ioay requested a review from Shadowfiend December 6, 2023 22:16
Copy link
Contributor

@Shadowfiend Shadowfiend left a comment

Choose a reason for hiding this comment

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

Code-wise we're looking solid here. Will test drive shortly.

import { HOUR } from "../../constants"

const TAHO_ICON_URL =
"https://taho.xyz/icons/icon-144x144.png?v=41306c4d4e6795cdeaecc31bd794f68e"
Copy link
Contributor

Choose a reason for hiding this comment

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

Not blocking, but we should have an extension-local URL available for this I believe.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, we can do it, also for the wallet-connection-handler (the same approach).

@Shadowfiend Shadowfiend dismissed jagodarybacka’s stale review December 7, 2023 03:10

This issue was resolved!

@Shadowfiend
Copy link
Contributor

Confirmed the notification permission is requested correctly, notification goes out, and toggle works as expected.

@Shadowfiend Shadowfiend merged commit c2f21bf into main Dec 7, 2023
6 checks passed
@Shadowfiend Shadowfiend deleted the monitoring_xp_drop branch December 7, 2023 03:10
@Shadowfiend
Copy link
Contributor

Notably: I did not test attachment to the event, as that's not really doable without a lot of extra legwork. Code seems like it should do the thing, we'll find out in the wild 🤷

@Shadowfiend Shadowfiend mentioned this pull request Dec 7, 2023
jagodarybacka added a commit that referenced this pull request Dec 14, 2023
## What's Changed
* v0.52.0 by @jagodarybacka in
#3678
* Update release test list by @michalinacienciala in
#3682
* Monitoring XP drop by @ioay in
#3679

## New Contributors
* @ioay made their first contribution in
#3679

**Full Changelog**:
v0.52.0...v0.53.0

Latest build:
[extension-builds-3690](https://github.com/tahowallet/extension/suites/18828582723/artifacts/1098086930)
(as of Thu, 07 Dec 2023 03:26:04 GMT).
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.

None yet

3 participants