Fix when the Fly Avatar is present at closure

If we quit or crash or reload, if the fly avatar was used, the system keep it in its setting.
So when we start, it bring the fly avatar when it was supposed to be the original.
This fix addresses that.
This commit is contained in:
Alezia Kurdis 2024-02-24 22:22:41 -05:00 committed by GitHub
parent 63a894f996
commit 98248d9876
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -26,6 +26,7 @@
var INTERCALL_DELAY = 200; //0.3 sec
var FLY_AVATAR_SETTING_KEY = "overte.application.more.flyAvatar.avatarUrl";
var FLY_AVATAR_SWITCH_SETTING_KEY = "overte.application.more.flyAvatar.switch";
var FLY_AVATAR_ORIGINAL_AVATAR_SETTING_KEY = "overte.application.more.flyAvatar.originalAvatarUrl";
var flyAvatarSwitch = true;
var flyAvatarUrl = "";
var originalAvatarUrl = "";
@ -115,6 +116,7 @@
MyAvatar.skeletonModelURLChanged.connect(function () {
if (!MyAvatar.isFlying() && MyAvatar.skeletonModelURL !== flyAvatarUrl) {
originalAvatarUrl = MyAvatar.skeletonModelURL;
Settings.setValue( FLY_AVATAR_ORIGINAL_AVATAR_SETTING_KEY, originalAvatarUrl);
}
});
@ -173,6 +175,12 @@
originalAvatarUrl = MyAvatar.skeletonModelURL;
flyAvatarUrl = Settings.getValue( FLY_AVATAR_SETTING_KEY, "" );
flyAvatarSwitch = Settings.getValue( FLY_AVATAR_SWITCH_SETTING_KEY, true );
if (originalAvatarUrl === flyAvatarUrl) {
var lastRecordedOriginalAvatar = Settings.getValue( FLY_AVATAR_ORIGINAL_AVATAR_SETTING_KEY, "" );
if (lastRecordedOriginalAvatar !== "") {
originalAvatarUrl = lastRecordedOriginalAvatar;
}
}
if (flyAvatarSwitch) {
inactiveIcon = APP_ICON_INACTIVE_ON;
} else {