Skip to content

Commit

Permalink
Persist friendbar hide states, hide nicknames option
Browse files Browse the repository at this point in the history
  • Loading branch information
Natsumi-sama committed Mar 4, 2024
1 parent 5734079 commit 078e5b8
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Dotnet/ImageCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public static string GetImage(string url, string fileId, string version)
cookieString += $"{cookie.Name}={cookie.Value};";
}

webClient.Headers.Add(HttpRequestHeader.Cookie, cookieString);
webClient.Headers.Add("user-agent", Program.Version);
webClient.Headers[HttpRequestHeader.Cookie] = cookieString;
webClient.Headers[HttpRequestHeader.UserAgent] = Program.Version;
webClient.DownloadFile(url, fileLocation);

int cacheSize = Directory.GetDirectories(cacheLocation).Length;
Expand Down
58 changes: 58 additions & 0 deletions html/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8097,6 +8097,56 @@ speechSynthesis.getVoices();
$app.data.sortFriendsGroup2 = false;
$app.data.sortFriendsGroup3 = false;

$app.methods.saveFriendsGroupStates = async function () {
await configRepository.setBool(
'VRCX_isFriendsGroupMe',
this.isFriendsGroupMe
);
await configRepository.setBool(
'VRCX_isFriendsGroupFavorites',
this.isFriendsGroup0
);
await configRepository.setBool(
'VRCX_isFriendsGroupOnline',
this.isFriendsGroup1
);
await configRepository.setBool(
'VRCX_isFriendsGroupActive',
this.isFriendsGroup2
);
await configRepository.setBool(
'VRCX_isFriendsGroupOffline',
this.isFriendsGroup3
);
};

$app.methods.loadFriendsGroupStates = async function () {
this.isFriendsGroupMe = await configRepository.getBool(
'VRCX_isFriendsGroupMe',
true
);
this.isFriendsGroup0 = await configRepository.getBool(
'VRCX_isFriendsGroupFavorites',
true
);
this.isFriendsGroup1 = await configRepository.getBool(
'VRCX_isFriendsGroupOnline',
true
);
this.isFriendsGroup2 = await configRepository.getBool(
'VRCX_isFriendsGroupActive',
true
);
this.isFriendsGroup3 = await configRepository.getBool(
'VRCX_isFriendsGroupOffline',
false
);
};

API.$on('LOGIN', function () {
$app.loadFriendsGroupStates();
});

$app.methods.fetchActiveFriend = function (userId) {
this.pendingActiveFriends.add(userId);
// FIXME: handle error
Expand Down Expand Up @@ -14368,6 +14418,10 @@ speechSynthesis.getVoices();
'VRCX_hideTooltips',
false
);
$app.data.hideNicknames = await configRepository.getBool(
'VRCX_hideNicknames',
false
);
$app.data.notificationTTS = await configRepository.getString(
'VRCX_notificationTTS',
'Never'
Expand Down Expand Up @@ -14550,6 +14604,10 @@ speechSynthesis.getVoices();
this.displayVRCPlusIconsAsAvatar
);
await configRepository.setBool('VRCX_hideTooltips', this.hideTooltips);
await configRepository.setBool(
'VRCX_hideNicknames',
this.hideNicknames
);
await configRepository.setBool(
'VRCX_autoSweepVRChatCache',
this.autoSweepVRChatCache
Expand Down
18 changes: 9 additions & 9 deletions html/src/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ html
template(#label)
span {{ $t('side_panel.friends') }} ({{ onlineFriendCount }}/{{ friends.size }})
.x-friend-list(style="padding:10px 5px")
.x-friend-group.x-link(@click="isFriendsGroupMe = !isFriendsGroupMe" style="padding:0px 0px 5px")
.x-friend-group.x-link(@click="isFriendsGroupMe = !isFriendsGroupMe; saveFriendsGroupStates()" style="padding:0px 0px 5px")
i.el-icon-arrow-right(:class="{ rotate: isFriendsGroupMe }")
span(style="margin-left:5px") {{ $t('side_panel.me') }}
div(v-show="isFriendsGroupMe")
Expand All @@ -125,7 +125,7 @@ html
location.extra(v-if="isGameRunning && !gameLogDisabled" :location="lastLocation.location" :traveling="lastLocationDestination" :link="false")
location.extra(v-else-if="isRealInstance(API.currentUser.$locationTag) || isRealInstance(API.currentUser.$travelingToLocation)" :location="API.currentUser.$locationTag" :traveling="API.currentUser.$travelingToLocation" :link="false")
span.extra(v-else v-text="API.currentUser.statusDescription")
.x-friend-group.x-link(@click="isFriendsGroup0 = !isFriendsGroup0" v-show="friendsGroup0.length")
.x-friend-group.x-link(@click="isFriendsGroup0 = !isFriendsGroup0; saveFriendsGroupStates()" v-show="friendsGroup0.length")
i.el-icon-arrow-right(:class="{ rotate: isFriendsGroup0 }")
span(style="margin-left:5px") {{ $t('side_panel.favorite') }} ― {{ friendsGroup0.length }}
div(v-show="isFriendsGroup0")
Expand All @@ -134,14 +134,14 @@ html
.avatar(:class="userStatusClass(friend.ref, friend.pendingOffline)")
img(v-lazy="userImage(friend.ref)")
.detail
span.name(v-if="!hideUserMemos && friend.$nickName" :style="{'color':friend.ref.$userColour}") {{ friend.ref.displayName }} ({{ friend.$nickName }})
span.name(v-if="!hideNicknames && friend.$nickName" :style="{'color':friend.ref.$userColour}") {{ friend.ref.displayName }} ({{ friend.$nickName }})
span.name(v-else v-text="friend.ref.displayName" :style="{'color':friend.ref.$userColour}")
span.extra(v-if="friend.pendingOffline") #[i.el-icon-warning-outline] {{ $t('side_panel.pending_offline') }}
location.extra(v-else :location="friend.ref.location" :traveling="friend.ref.travelingToLocation" :link="false")
template(v-else)
span(v-text="friend.name || friend.id")
el-button(type="text" icon="el-icon-close" size="mini" @click.stop="confirmDeleteFriend(friend.id)" style="margin-left:5px")
.x-friend-group.x-link(@click="isFriendsGroup1 = !isFriendsGroup1" v-show="friendsGroup1.length")
.x-friend-group.x-link(@click="isFriendsGroup1 = !isFriendsGroup1; saveFriendsGroupStates()" v-show="friendsGroup1.length")
i.el-icon-arrow-right(:class="{ rotate: isFriendsGroup1 }")
span(style="margin-left:5px") {{ $t('side_panel.online') }} ― {{ friendsGroup1.length }}
div(v-show="isFriendsGroup1")
Expand All @@ -150,14 +150,14 @@ html
.avatar(:class="userStatusClass(friend.ref, friend.pendingOffline)")
img(v-lazy="userImage(friend.ref)")
.detail
span.name(v-if="!hideUserMemos && friend.$nickName" :style="{'color':friend.ref.$userColour}") {{ friend.ref.displayName }} ({{ friend.$nickName }})
span.name(v-if="!hideNicknames && friend.$nickName" :style="{'color':friend.ref.$userColour}") {{ friend.ref.displayName }} ({{ friend.$nickName }})
span.name(v-else v-text="friend.ref.displayName" :style="{'color':friend.ref.$userColour}")
span.extra(v-if="friend.pendingOffline") #[i.el-icon-warning-outline] {{ $t('side_panel.pending_offline') }}
location.extra(v-else :location="friend.ref.location" :traveling="friend.ref.travelingToLocation" :link="false")
template(v-else)
span(v-text="friend.name || friend.id")
el-button(type="text" icon="el-icon-close" size="mini" @click.stop="confirmDeleteFriend(friend.id)" style="margin-left:5px")
.x-friend-group.x-link(@click="isFriendsGroup2 = !isFriendsGroup2" v-show="friendsGroup2.length")
.x-friend-group.x-link(@click="isFriendsGroup2 = !isFriendsGroup2; saveFriendsGroupStates()" v-show="friendsGroup2.length")
i.el-icon-arrow-right(:class="{ rotate: isFriendsGroup2 }")
span(style="margin-left:5px") {{ $t('side_panel.active') }} ― {{ friendsGroup2.length }}
div(v-show="isFriendsGroup2")
Expand All @@ -166,13 +166,13 @@ html
.avatar
img(v-lazy="userImage(friend.ref)")
.detail
span.name(v-if="!hideUserMemos && friend.$nickName" :style="{'color':friend.ref.$userColour}") {{ friend.ref.displayName }} ({{ friend.$nickName }})
span.name(v-if="!hideNicknames && friend.$nickName" :style="{'color':friend.ref.$userColour}") {{ friend.ref.displayName }} ({{ friend.$nickName }})
span.name(v-else v-text="friend.ref.displayName" :style="{'color':friend.ref.$userColour}")
span.extra(v-text="friend.ref.statusDescription" :link="false")
template(v-else)
span(v-text="friend.name || friend.id")
el-button(type="text" icon="el-icon-close" size="mini" @click.stop="confirmDeleteFriend(friend.id)" style="margin-left:5px")
.x-friend-group.x-link(@click="isFriendsGroup3 = !isFriendsGroup3" v-show="friendsGroup3.length")
.x-friend-group.x-link(@click="isFriendsGroup3 = !isFriendsGroup3; saveFriendsGroupStates()" v-show="friendsGroup3.length")
i.el-icon-arrow-right(:class="{ rotate: isFriendsGroup3 }")
span(style="margin-left:5px") {{ $t('side_panel.offline') }} ― {{ friendsGroup3.length }}
div(v-show="isFriendsGroup3")
Expand All @@ -181,7 +181,7 @@ html
.avatar
img(v-lazy="userImage(friend.ref)")
.detail
span.name(v-if="!hideUserMemos && friend.$nickName" :style="{'color':friend.ref.$userColour}") {{ friend.ref.displayName }} ({{ friend.$nickName }})
span.name(v-if="!hideNicknames && friend.$nickName" :style="{'color':friend.ref.$userColour}") {{ friend.ref.displayName }} ({{ friend.$nickName }})
span.name(v-else v-text="friend.ref.displayName" :style="{'color':friend.ref.$userColour}")
span.extra(v-text="friend.ref.statusDescription")
template(v-else)
Expand Down
1 change: 1 addition & 0 deletions html/src/localization/en/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@
"theme_mode_material3": "Material 3",
"vrcplus_profile_icons": "VRCPlus Profile Icons",
"disable_tooltips": "Disable Tooltips",
"disable_nicknames": "Disable Memo Nicknames",
"sort_favorite_by": "Sort Favorites by",
"sort_favorite_by_name": "name",
"sort_favorite_by_date": "date",
Expand Down
3 changes: 3 additions & 0 deletions html/src/mixins/tabs/settings.pug
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ mixin settingsTab()
div.options-container-item
span.name {{ $t('view.settings.appearance.appearance.vrcplus_profile_icons') }}
el-switch(v-model="displayVRCPlusIconsAsAvatar" @change="saveOpenVROption")
div.options-container-item
span.name {{ $t('view.settings.appearance.appearance.disable_nicknames') }}
el-switch(v-model="hideNicknames" @change="saveOpenVROption")
div.options-container-item
span.name {{ $t('view.settings.appearance.appearance.disable_tooltips') }}
el-switch(v-model="hideTooltips" @change="saveOpenVROption")
Expand Down

0 comments on commit 078e5b8

Please sign in to comment.