Skip to content

Improved Notification Setting Controls #2377

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions static/js/map.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,14 @@ var StoreOptions = {
default: false,
type: StoreTypes.Boolean
},
'hideNotNotified': {
default: false,
type: StoreTypes.Boolean
},
'showPopups': {
default: true,
type: StoreTypes.Boolean
},
'playSound': {
default: false,
type: StoreTypes.Boolean
Expand Down
28 changes: 23 additions & 5 deletions static/js/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,9 @@ function initSidebar() {
$('#spawnpoints-switch').prop('checked', Store.get('showSpawnpoints'))
$('#ranges-switch').prop('checked', Store.get('showRanges'))
$('#notify-perfection-wrapper').toggle(Store.get('showPokemonStats'))
$('#hideunnotified-switch').prop('checked', Store.get('hideNotNotified'))
$('#popups-switch').prop('checked', Store.get('showPopups'))
$('#bounce-switch').prop('checked', Store.get('isBounceDisabled'))
$('#sound-switch').prop('checked', Store.get('playSound'))
$('#pokemoncries').toggle(Store.get('playSound'))
$('#cries-switch').prop('checked', Store.get('playCries'))
Expand Down Expand Up @@ -1677,17 +1680,17 @@ function processPokemon(item) {

if (!(item['encounter_id'] in mapData.pokemons) &&
!isPokeExcluded && !isRarityExcluded && isPokeAlive) {
// Add marker to map and item to dict.
if (!item.hidden) {
// Add marker to map and item to dict.
const isNotifyPkmn = isNotifyPoke(item)
if (!item.hidden && (!Store.get('hideNotNotified') || isNotifyPkmn)) {
const isBounceDisabled = Store.get('isBounceDisabled')
const scaleByRarity = Store.get('scaleByRarity')
const isNotifyPkmn = isNotifyPoke(item)

if (item.marker) {
updatePokemonMarker(item.marker, map, scaleByRarity, isNotifyPkmn)
} else {
newMarker = setupPokemonMarker(item, map, isBounceDisabled, scaleByRarity, isNotifyPkmn)
customizePokemonMarker(newMarker, item)
customizePokemonMarker(newMarker, item, !Store.get('showPopups'))
item.marker = newMarker
}

Expand Down Expand Up @@ -2529,11 +2532,11 @@ $(function () {
$switchActiveRaidGymsOnly.on('change', function () {
Store.set('showActiveRaidsOnly', this.checked)
lastgyms = false

updateMap()
})

$switchRaidMinLevel = $('#raid-min-level-only-switch')

$switchRaidMinLevel.select2({
placeholder: 'Minimum raid level',
minimumResultsForSearch: Infinity
Expand Down Expand Up @@ -3019,6 +3022,21 @@ $(function () {
}
})

$('#bounce-switch').change(function () {
Store.set('isBounceDisabled', this.checked)
location.reload()
Copy link
Contributor

Choose a reason for hiding this comment

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

Ok I thought I was doing something wrong but it makes some sense, you need to reload in this cases as it is easier than reprocessing everything but the UX is really weird, no one expects to get a reload just clickin in a switch.
The only solution I can think of is telling the user about the reload (alert) or finding a way to reload the map without reloading the page.

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably you can check how it is done with the pokemon hide and just apply it to everything that is not in the notify list.

})

$('#hideunnotified-switch').change(function () {
Store.set('hideNotNotified', this.checked)
location.reload()
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the more complex to solve but probably you can also iterate over all pokes and remove/add the bouncing.

})

$('#popups-switch').change(function () {
Store.set('showPopups', this.checked)
location.reload()
Copy link
Contributor

Choose a reason for hiding this comment

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

This reload is not needed, previous notifications will dissapear with time and no new ones will appear.

})

$('#cries-switch').change(function () {
Store.set('playCries', this.checked)
})
Expand Down
30 changes: 30 additions & 0 deletions templates/map.html
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,36 @@ <h3>Notify of Level</h3>
</label>
</div>
{% endif %}
<div class="form-control switch-container">
<h3>Hide unnotified pokemon</h3>
<div class="onoffswitch">
<input id="hideunnotified-switch" type="checkbox" name="hideunnotified-switch" class="onoffswitch-checkbox" checked>
<label class="onoffswitch-label" for="hideunnotified-switch">
<span class="switch-label" data-on="On" data-off="Off"></span>
<span class="switch-handle"></span>
</label>
</div>
</div>
<div class="form-control switch-container">
<h3>Show browser popups</h3>
<div class="onoffswitch">
<input id="popups-switch" type="checkbox" name="popups-switch" class="onoffswitch-checkbox" checked>
<label class="onoffswitch-label" for="popups-switch">
<span class="switch-label" data-on="On" data-off="Off"></span>
<span class="switch-handle"></span>
</label>
</div>
</div>
<div class="form-control switch-container">
<h3>Disable bouncing</h3>
<div class="onoffswitch">
<input id="bounce-switch" type="checkbox" name="bounce-switch" class="onoffswitch-checkbox" checked>
<label class="onoffswitch-label" for="bounce-switch">
<span class="switch-label" data-on="On" data-off="Off"></span>
<span class="switch-handle"></span>
</label>
</div>
</div>
<div class="form-control switch-container">
<h3>Notify with sound</h3>
<div class="onoffswitch">
Expand Down