fixed problem with profile inactivation after adding via deeplink on windows
This commit is contained in:
@@ -565,7 +565,7 @@ pub async fn resolve_scheme(param: String) -> Result<()> {
|
||||
Some(url) => {
|
||||
log::info!(target:"app", "decoded subscription url: {url}");
|
||||
|
||||
create_window(false);
|
||||
create_window(true);
|
||||
match PrfItem::from_url(url.as_ref(), name, None, None).await {
|
||||
Ok(item) => {
|
||||
let uid = item.uid.clone().unwrap();
|
||||
|
||||
@@ -44,9 +44,9 @@ const handleNoticeMessage = (
|
||||
switch (status) {
|
||||
case "import_sub_url::ok":
|
||||
mutate("getProfiles");
|
||||
navigate("/", { state: { activateProfile: msg } });
|
||||
navigate("/");
|
||||
showNotice("success", t("Import Subscription Successful"));
|
||||
window.dispatchEvent(new CustomEvent('activate-profile', { detail: msg }));
|
||||
sessionStorage.setItem('activateProfile', msg);
|
||||
break;
|
||||
case "import_sub_url::error":
|
||||
showNotice("error", msg);
|
||||
|
||||
@@ -78,26 +78,13 @@ const MinimalHomePage: React.FC = () => {
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const handleActivationEvent = (event: Event) => {
|
||||
const customEvent = event as CustomEvent<string>;
|
||||
const profileId = customEvent.detail;
|
||||
if (profileId) {
|
||||
setUidToActivate(profileId);
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('activate-profile', handleActivationEvent);
|
||||
return () => {
|
||||
window.removeEventListener('activate-profile', handleActivationEvent);
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const uidToActivate = sessionStorage.getItem('activateProfile');
|
||||
if (uidToActivate && profileItems.some(p => p.uid === uidToActivate)) {
|
||||
activateProfile(uidToActivate, false);
|
||||
setUidToActivate(null);
|
||||
sessionStorage.removeItem('activateProfile');
|
||||
}
|
||||
}, [uidToActivate, profileItems, activateProfile]);
|
||||
}, [profileItems, activateProfile]);
|
||||
|
||||
|
||||
const handleProfileChange = useLockFn(async (uid: string) => {
|
||||
if (profiles?.current === uid) return;
|
||||
|
||||
Reference in New Issue
Block a user