Skip to content

Commit

Permalink
Adds ability to Set Buddy Profile
Browse files Browse the repository at this point in the history
Adds stubs for `Set Buddy Status`
Adds edit profile link in top nav bar
Adds ability to mute all audio on desktop
Adds sounds for login and new buddy requests
Ensure original value saves to settings for local storage 
#18
  • Loading branch information
Marak committed Feb 24, 2022
1 parent 31d1fba commit 76f8c63
Show file tree
Hide file tree
Showing 15 changed files with 234 additions and 31 deletions.
14 changes: 14 additions & 0 deletions TODO.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
- add sound fx when you get buddy request
- add friend requests to automatons that autoaccept
- add mute / desktop volume control to top nav
- have youtube and soundcloud players respect mute / volume levels
- not hard...i think...
- complete v1 camera app

YOUTUBE LIVE EMBED

- blocked on `App.VideoPlayer` since we can't inject anymore youtube API embeds
- need instaniatable youtube window with custom playlist / source

Camera
X - camera switching code
! - audio switching code
Expand All @@ -16,6 +27,9 @@ Camera
- swap online / offline emoji icons for images
- add back button to interdemon cable / mtv / all video players

- add sigils and signets
- sigils are for system powers like matrix agent spell casting
- signets are for feature role checks like Buddy Pond Gold or Membership is Guilds, etc

PUSHED to post launch

Expand Down
4 changes: 3 additions & 1 deletion data/interdimensionalcable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1905,5 +1905,7 @@ desktop.interdimensionalcable.playlist = [
'Q9XTqQbuavI',
'UuYV81r5SO0',
'MALyCfMP0a0',
'8QxIIz1yEsA'
'8QxIIz1yEsA',
'tyWwEm-rKUY',
'cZUfpcTrZcU'
];
3 changes: 2 additions & 1 deletion data/mtv.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ desktop.ytPlaylist = [
'JASvfdG8INI',
'856x2xIpoZM',
'TuAetZIG0mg',
'JBTUgYIQGFo'
'JBTUgYIQGFo',
'DkYPge6ZKSQ'
];

1 change: 1 addition & 0 deletions desktop/apps/EASTER-EGG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Ideas for community apps:
- pick js1k winners / entries?
- https://github.com/k4zmu2a/SpaceCadetPinball
- https://github.com/mtevans/SkiFree
- https://github.com/nmrugg/stockfish.js/

- Wallpaper Manager
- user contributed wallpapers
Expand Down
6 changes: 3 additions & 3 deletions desktop/apps/desktop.audioplayer/desktop.audioplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ desktop.audioplayer.load = function loadAudioPlayer (params, next) {
desktop.audioplayer.playing = {};

desktop.audioplayer.play = function playAudio (soundPath) {
if (desktop.settings.audio_muted) {
// do not play any audio if desktop is muted
if (!desktop.settings.audio_enabled) {
// do not play any audio if desktop is not enabled
} else {
// play the audio
if (desktop.audioplayer.playing[soundPath]) {
Expand All @@ -22,9 +22,9 @@ desktop.audioplayer.play = function playAudio (soundPath) {
audio.addEventListener('ended', function() {
desktop.audioplayer.playing[soundPath] = false;
},false);
audio.play();
} catch (err) {
desktop.audioplayer.playing[soundPath] = false;
}
audio.play();
}
}
28 changes: 27 additions & 1 deletion desktop/apps/desktop.buddylist/desktop.buddylist.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,18 @@ desktop.updateBuddyList = function updateBuddyList () {
$('.buddy_email').val(desktop.buddyListData.email);
}

if (data.myProfile) {
// Remark: this cache is cleared each time the user clicks "Update Profile"
desktop.profileCache = desktop.profileCache || {};
if (!desktop.profileCache[data.myProfile]) {
$('.publicProfilePreview').text(data.myProfile);
$('.profileMarkdown').val(data.myProfile);
desktop.profileCache[data.myProfile] = true
} else {
// do nothing, do not re-render the same text twice
}
}

desktop.buddylistProfileState = { updates: {}};

//
Expand Down Expand Up @@ -355,7 +367,21 @@ desktop.updateBuddyList = function updateBuddyList () {

$('.apiResult').val(JSON.stringify(data, true, 2))

if ($('.pendingIncomingBuddyRequests li').length == 0) {
desktop.buddylist.pendingIncomingBuddyRequests = desktop.buddylist.pendingIncomingBuddyRequests || 0;

let totalIncomingBuddyRequests = $('.pendingIncomingBuddyRequests li').length;

if (totalIncomingBuddyRequests > desktop.buddylist.pendingIncomingBuddyRequests) {
desktop.buddylist.pendingIncomingBuddyRequests = totalIncomingBuddyRequests;
// Remark: short delay is used here to provide nice login experience if Buddy has requests
// allows WELCOME sound to play
// A better solution here is to here priority option for playing sound with queue
setTimeout(function(){
desktop.audioplayer.play('desktop/assets/audio/YOUVEGOTMAIL.wav');
}, 2222);
}

if (totalIncomingBuddyRequests === 0) {
$('.pendingIncomingBuddyRequestsHolder').hide();
} else {
$('.pendingIncomingBuddyRequestsHolder').show();
Expand Down
4 changes: 2 additions & 2 deletions desktop/apps/desktop.localstorage/desktop.localstorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ desktop.localstorage.label = "localstorage";
desktop.localstorage.prefix = '_buddypond_desktop_';

desktop.localstorage.set = function setLocalStorage (key, val) {
val = JSON.stringify(val);
localStorage.setItem(desktop.localstorage.prefix + key, val);
// in addition to updating the localstorage, update desktop.settings
// Remark: desktop.settings is booted from localstorage on load
desktop.settings[key] = val;
val = JSON.stringify(val);
localStorage.setItem(desktop.localstorage.prefix + key, val);
}

desktop.localstorage.get = function getLocalStorage (key) {
Expand Down
2 changes: 2 additions & 0 deletions desktop/apps/desktop.login/desktop.login.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ desktop.login.auth = function authDesktop (buddyname) {

desktop.login.success = function desktopLoginSuccess () {
$('#me_title').html('Welcome - ' + buddypond.me);
$('.me').html(buddypond.me);
desktop.audioplayer.play('desktop/assets/audio/WELCOME.wav')
$('.logoutLink').show();
$('.loginLink').hide();
// $('.qtokenid').val(data);
Expand Down
84 changes: 62 additions & 22 deletions desktop/apps/desktop.profile/desktop.profile.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
<style>
#window_profile .publicProfilePreviewHolder {
border: solid;
background-color: #CCC;
text-align: left;
width: 280px;
}

#window_profile .publicProfilePreviewHolder:hover * {
cursor: pointer;
}

</style>

<div id="window_profile" class="abs window">
<div class="abs window_inner">
<div class="window_top">
Expand All @@ -16,8 +30,8 @@
<div id="profileTabs">
<ul>
<li><a href="#tabs-1">User Profile Settings</a></li>
<li><a href="#tabs-2">Buddy Apps</a></li>
<li><a href="#tabs-3">Public Profile</a></li>
<li><a href="#tabs-2">Public Profile</a></li>
<li><a href="#tabs-3">Buddy Apps</a></li>
</ul>
<div id="tabs-1">
<span class="updateProfileResponse"></span>
Expand Down Expand Up @@ -66,12 +80,36 @@ <h2>User Profile Settings</h2>
<input type="checkbox" size="32" name="notifications_web_enabled" class="enableAudioNotifications" title="This will enable audio notifications in the browser window while the website tab is not visible."/>
</td>
</tr>
<tr>
<td>Enable Desktop Audio</td>
<td>
<input type="checkbox" size="32" name="audio_enabled" class="audioEnabled" title="This will mute all audio sounds the desktop itself produces."/>
</td>
</tr>
</table>
<br/>
<button type="submit" class="desktopButton updateProfileButton">Update Profile</button>
<button type="submit" class="desktopPanel updateProfileButton">Update Profile</button>
</form>
</div>
<div id="tabs-2" align="center">
<div id="tabs-2">
<h2>Your current Buddy Profile:</h2>
<br/>
<div class="publicProfilePreviewHolder desktopButton">
<div class="border">
<p class="me">Marak</p>
<p><em>Last Seen: <span class="lastSeen">2/22/2022 14:40pm</span></em></p>
</div>
<br/>
<div class="publicProfilePreview"></div>
</div>
<br/>
<br/>
<div class="profileEditor">
<textarea name="profileMarkdown" class="profileMarkdown" cols="60" rows="15"></textarea>
<button class="desktopButton updateProfileMarkdown">Update Profile</button>
</div>
</div>
<div id="tabs-3" align="center">
<p align="left">
<img title="Custom Desktop App Configurations coming soon!" height="32" width="32" src="desktop/assets/images/icons/icon_locked.png" />
Buddy Desktop Apps are *Locked* for Buddy Pond Alpha.
Expand All @@ -89,82 +127,92 @@ <h2>User Profile Settings</h2>
</tr>
<tr>
<td>
<img class="emojiIcon float-left" src="desktop/assets/images/icons/icon_console_64.png" />
<input type="checkbox" CHECKED="checked" DISABLED="disabled" title="Cannot disable App in Alpha"/>
</td>
<td>
Profile
Console
</td>
</tr>
<tr>
<td>
<img class="emojiIcon float-left" src="desktop/assets/images/icons/icon_profile_64.png" />
<input type="checkbox" CHECKED="checked" DISABLED="disabled" title="Cannot disable App in Alpha"/>
</td>
<td>
Buddy List
Profile
</td>
</tr>
<tr>
<td>
<img class="emojiIcon float-left" src="desktop/assets/images/icons/icon_buddylist_64.png" />
<input type="checkbox" CHECKED="checked" DISABLED="disabled" title="Cannot disable App in Alpha"/>
</td>
<td>
Buddy Pond
Buddy List
</td>
</tr>
<tr>
<td>
<img class="emojiIcon float-left" src="desktop/assets/images/icons/icon_pond_64.png" />
<input type="checkbox" CHECKED="checked" DISABLED="disabled" title="Cannot disable App in Alpha"/>
</td>
<td>
Console
Buddy Pond
</td>
</tr>
<tr>
<td>
<img class="emojiIcon float-left" src="desktop/assets/images/icons/icon_mirror_64.png" />
<input type="checkbox" CHECKED="checked" DISABLED="disabled" title="Cannot disable App in Alpha"/>
</td>
<td>
Background
Mirror
</td>
</tr>
<tr>
<td>
<img class="emojiIcon float-left" src="desktop/assets/images/icons/icon_videochat_64.png" />
<input type="checkbox" CHECKED="checked" DISABLED="disabled" title="Cannot disable App in Alpha"/>
</td>
<td>
Mirror
Video Chat
</td>
</tr>
<tr>
<td>
<img class="emojiIcon float-left" src="desktop/assets/images/icons/icon_mtv_64.png" />
<input type="checkbox" CHECKED="checked" DISABLED="disabled" title="Cannot disable App in Alpha"/>
</td>
<td>
Video Chat
Music Television
</td>
</tr>
<tr>
<td>
<img class="emojiIcon float-left" src="desktop/assets/images/icons/icon_interdimensionalcable_64.png" />
<input type="checkbox" CHECKED="checked" DISABLED="disabled" title="Cannot disable App in Alpha"/>
</td>
<td>
Music TeleVision
Interdimensional Cable
</td>
</tr>
<tr>
<td>
<img class="emojiIcon float-left" src="desktop/assets/images/icons/icon_folder_64.png" />
<input type="checkbox" CHECKED="checked" DISABLED="disabled" title="Cannot disable App in Alpha"/>
</td>
<td>
Interdimensional Cable
Games
</td>
</tr>
<tr>
<td>
<img class="emojiIcon float-left" src="desktop/assets/images/icons/icon_wallpaper_64.png" />
<input type="checkbox" CHECKED="checked" DISABLED="disabled" title="Cannot disable App in Alpha"/>
</td>
<td>
Games
Wallpaper
</td>
</tr>
</table>
Expand All @@ -175,14 +223,6 @@ <h2>User Profile Settings</h2>
</p>
-->
</div>
<div id="tabs-3">
<p>Simple preview of what your Buddy Profile will look like</p>
<br/>
<div class="border">
<p class="me">Marak</p>
<p>Last Seen: <span class="lastSeen">2/22/2022 14:40pm</span></p>
</div>
</div>
</div>
</div>
</div>
Expand Down
36 changes: 35 additions & 1 deletion desktop/apps/desktop.profile/desktop.profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,21 @@ desktop.profile.load = function loadDesktop (params, next) {
$('.lastSeen').html(new Date().toString());

$('.updateProfileForm').on('submit', function () {
// clear out local profile cache, this will trigger a re-render from next server update
desktop.profileCache = {};
return false;
});

$('.editProfileLink').on('click', function(){
$(this).closest('.menu').hide();
desktop.profile.openWindow();
return false;
});

$('.setStatus').on('click', function(){
let replaceThisWithBetterUXThankYou = prompt('( alert lol )\n\nType your custom status:');
});

// Remark: also being triggered by enter event on form, jquery.desktop.js?
$('.updateProfileButton').on('click', function(){
let updates = {};
Expand All @@ -29,6 +41,10 @@ desktop.profile.load = function loadDesktop (params, next) {
})
});

$('.updateProfileMarkdown').on('click', function(){
desktop.buddylistProfileState.updates.myProfile = $('.profileMarkdown').val();
});

$('.enableWebNotifications').on('change', function(){
let notificationsEnabled = $(this).prop("checked");
if (notificationsEnabled) {
Expand All @@ -53,6 +69,8 @@ desktop.profile.load = function loadDesktop (params, next) {
if (audioNotificationsEnabled) {
desktop.localstorage.set('notifications_audio_enabled', true);
desktop.log('Audio Notifications have been enabled.');
$('.audioEnabled').prop('checked', true);
$('.audioEnabled').trigger('change');
} else {
desktop.localstorage.set('notifications_audio_enabled', false);
desktop.log('Audio Notifications have been disabled.');
Expand All @@ -63,12 +81,28 @@ desktop.profile.load = function loadDesktop (params, next) {
$('.enableAudioNotifications').prop('checked', true);
}

$('.audioEnabled').on('change', function(){
let audioMuted = $(this).prop("checked");
if (audioMuted) {
desktop.localstorage.set('audio_enabled', true);
desktop.log('Desktop Audio has been muted.');
} else {
desktop.localstorage.set('audio_enabled', false);
desktop.log('Desktop Audio has is back on.');
}
});

if (desktop.settings.audio_enabled) {
$('.audioEnabled').prop('checked', true);
}

$("#profileTabs" ).tabs();
next();
});
};

desktop.profile.openWindow = function openWindow () {
$('#window_profile').css('height', 510);
$('#window_profile').addClass('window_stack').show();
$('#window_profile').css('height', 540);
$('#window_profile').css('width', 460);
}
Binary file added desktop/assets/audio/WELCOME.wav
Binary file not shown.
Binary file added desktop/assets/audio/YOUVEGOTMAIL.wav
Binary file not shown.
Loading

0 comments on commit 76f8c63

Please sign in to comment.