Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Commit

Permalink
autoclose attempting to connect message after a threshold
Browse files Browse the repository at this point in the history
Summary:
We receive a large number of support requests (examples [1](https://fb.workplace.com/groups/flippersupport/posts/1875975442883105/), [2](https://fb.workplace.com/groups/flippersupport/posts/1875240279623288/), [3](https://fb.workplace.com/groups/flippersupport/posts/1734087643738553/), [4](https://fb.workplace.com/groups/flippersupport/posts/1814898918990758/), [5](https://fb.workplace.com/groups/flippersupport/posts/1854060158407967/), [6](https://fb.workplace.com/groups/flippersupport/posts/1793369631143687/)) about hanging "attempting to connect" notification where to fix it usually takes on of two ways.

* Restart laptop
* Multistep
    1. close app on device
    2. run kill adb/idb
    3. restart app on the device

Instead of hanging UI lets autoclose the message and prompt user with an actionable modal

Reviewed By: LukeDefeo

Differential Revision: D59865309

fbshipit-source-id: e5b36fb7706be8d1f108d1f39edbb55a1f917e8c
  • Loading branch information
antonk52 authored and facebook-github-bot committed Jul 18, 2024
1 parent cae2895 commit 85a0256
Showing 1 changed file with 38 additions and 4 deletions.
42 changes: 38 additions & 4 deletions desktop/flipper-ui/src/app-connection-updates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,48 @@ export const connectionUpdate = (
if (update.detail) {
content += `\n ${update.detail}`;
}
let duration = 0;
if (update.type === 'success' || update.type === 'success-info') {
duration = 3;
} else if (update.type === 'loading') {
// seconds until show how to debug hanging connection
duration = 10;
}
message.open({
key: update.app,
key: update.key,
type: update.type === 'success-info' ? 'info' : update.type,
content,
className,
duration:
update.type === 'success' || update.type === 'success-info' ? 3 : 0,
onClick: () => message.destroy(update.key),
duration,
onClick:
update.type !== 'loading'
? () => {
message.destroy(update.key);
}
: undefined,
onClose: () => {
// only called if closed by timeout
console.log('on close called for ', update.key);
if (update.type === 'loading') {
// TODO show conect timeout modal NEXT DIFF
console.log('show a modal with step');

notification.error({
key: update.key,
message: 'App failed to connect',
description: (
<div>
<div>To fix try the following</div>
<div>uno</div>
<div>dos</div>
<div>tres</div>
</div>
),
duration: 0,
onClose: () => notification.close(update.key),
});
}
},
});
}
};

0 comments on commit 85a0256

Please sign in to comment.