android: a name of your own for anyone on the network
The desktop's local contact metadata on the phone: a peer's sheet ends in Name and notes — a petname, a group, a private note and the Favorite and Trusted marks, kept in the app's own config and published nowhere. The petname stands in for the username on the buddy list, in the chat list, on a thread's bar, in the peer sheet, in a room's roster and on a room line, and the real username stays with it — on the line beneath, or beside the name in a room — so a stranger is never quietly turned into someone you know. Favourites sit at the top of the buddy list, and clearing a person's details drops the entry rather than storing an empty one — the backend's own rule.
This commit is contained in:
1 parent
f792d7955d
commit
7eae0ee945
10 files changed
+211
-16
No files matched your search
+41
-2
@@ -160,6 +160,11 @@ const PROBE = `(function () {
|
||||
hwant: (function () { try { var n = __ss.nav; return (n.sheet ? 1 : 0) + (n.half ? 1 : 0) + (n.stacks[n.tab].length - 1) + (n.tab !== 'home' ? 1 : 0); } catch (e) { return -1; } })(),
|
||||
cardImgs: document.querySelectorAll('.rail .acard img').length,
|
||||
cardPhs: document.querySelectorAll('.rail .acard svg').length,
|
||||
budNames: [].map.call(document.querySelectorAll('.screen .row.bud .t'), function (t) { return t.textContent.trim(); }).join('|'),
|
||||
budSubs: [].map.call(document.querySelectorAll('.screen .row.bud .m'), function (t) { return t.textContent.trim(); }).join('|'),
|
||||
halfSub: ((document.querySelector('.halfsheet .sheet-head .m') || {}).textContent || '').trim(),
|
||||
halfSw: [].filter.call(document.querySelectorAll('.halfsheet .row'), function (r) { return !!r.querySelector('.sw.on'); }).map(function (r) { return ((r.querySelector('.t') || {}).textContent || '').trim(); }).join('|'),
|
||||
contactsLoaded: (function () { try { return __ss.contacts.loaded ? 'yes' : (__ss.contacts.error ? 'err' : 'no'); } catch (e) { return ''; } })(),
|
||||
};
|
||||
})()`;
|
||||
|
||||
@@ -216,6 +221,18 @@ const MOCK_STEPS = [
|
||||
/* a buddy's sheet: browse, message, remove */
|
||||
{ do: `__click('.segtabs button', 'Buddies')`, name: "buddies", wait: 600 },
|
||||
{ do: `document.querySelectorAll('.screen button.row')[1].dispatchEvent(new MouseEvent('contextmenu', { bubbles: true, cancelable: true }))`, name: "buddy-sheet", wait: 600 },
|
||||
/* the contact editor behind the peer sheet: a petname, a note, the
|
||||
favourite mark — then the buddy list wearing all three, ada's own
|
||||
name still under it and favourites first */
|
||||
{ do: `__click('.halfsheet .row', 'Name and notes')`, name: "contact-sheet", wait: 600 },
|
||||
{ do: `__click('.halfsheet .row', 'Petname')`, wait: 500 },
|
||||
{ do: `(function () { var i = document.querySelector('.halfsheet .prompt .field'); i.value = 'Zola from Vinyl Rips'; i.dispatchEvent(new Event('input', { bubbles: true })); })()`, wait: 300 },
|
||||
{ do: `__click('.halfsheet .prompt-acts .btn-fill', 'Save')`, name: "contact-petname", wait: 800 },
|
||||
{ do: `__click('.halfsheet .row', 'Note')`, wait: 500 },
|
||||
{ do: `(function () { var i = document.querySelector('.halfsheet .prompt .field'); i.value = 'trades vinyl rips, always has the gaps'; i.dispatchEvent(new Event('input', { bubbles: true })); })()`, wait: 300 },
|
||||
{ do: `__click('.halfsheet .prompt-acts .btn-fill', 'Save')`, name: "contact-note", wait: 800 },
|
||||
{ do: `__click('.halfsheet .row', 'Favorite')`, name: "contact-fav", wait: 800 },
|
||||
{ do: `document.querySelector('.scrim').click()`, name: "buddy-petname", wait: 700 },
|
||||
{ do: `document.querySelector('.scrim').click()`, wait: 500 },
|
||||
/* a user looked up by name: the peer sheet */
|
||||
{ do: `__click('.screen .row', 'Look up a user')`, wait: 600 },
|
||||
@@ -229,7 +246,16 @@ const MOCK_STEPS = [
|
||||
{ do: `__click('.screen .btn', 'more rooms')`, name: "rooms-more", wait: 500 },
|
||||
/* the fake network: a room with a few lines in it */
|
||||
{ do: `__click('.screen button.row', 'Lounge')`, name: "room", wait: 2400 },
|
||||
/* the room's roster wears the petname too, the real name beneath it */
|
||||
{ do: `__click('.room-head .btn', null)`, name: "room-users", wait: 700 },
|
||||
{ do: `document.querySelector('.scrim').click()`, wait: 500 },
|
||||
{ do: `history.back()`, wait: 700 },
|
||||
/* nothing set is nothing stored: cleared, the entry leaves the list and
|
||||
a name goes back to being a name */
|
||||
{ do: `__click('.segtabs button', 'Buddies')`, wait: 600 },
|
||||
{ do: `document.querySelector('.screen .row.bud').dispatchEvent(new MouseEvent('contextmenu', { bubbles: true, cancelable: true }))`, wait: 500 },
|
||||
{ do: `__click('.halfsheet .row', 'Name and notes')`, wait: 500 },
|
||||
{ do: `__click('.halfsheet .row', 'Clear these details')`, name: "contact-cleared", wait: 900 },
|
||||
/* a search answered by five peers; the best one's first file streams,
|
||||
the lane rising as the bytes arrive */
|
||||
{ do: `document.querySelectorAll('.nav button')[1].click()`, wait: 600 },
|
||||
@@ -425,8 +451,18 @@ const MOCK_EXPECT = {
|
||||
tracks: (i) => i.title.startsWith("Your library"),
|
||||
community: (i) => i.title.startsWith("Community"),
|
||||
buddies: (i) => i.title.startsWith("Community"),
|
||||
"buddy-sheet": (i) => i.half.includes("up") && /Browse their files/.test(i.halfText) && /Remove buddy/.test(i.halfText),
|
||||
"user-lookup": (i) => i.half.includes("up") && /dusty_crates/.test(i.halfText) && /Browse their files/.test(i.halfText) && /Add buddy/.test(i.halfText),
|
||||
"buddy-sheet": (i) => i.half.includes("up") && /Browse their files/.test(i.halfText) && /Remove buddy/.test(i.halfText) && /Name and notes/.test(i.halfText),
|
||||
"user-lookup": (i) => i.half.includes("up") && /Dusty the digger/.test(i.halfText) && i.halfSub.startsWith("dusty_crates") && /Browse their files/.test(i.halfText) && /Add buddy/.test(i.halfText),
|
||||
/* the local contact metadata: the editor, the petname reaching the
|
||||
backend, the mark sticking, the buddy list rearranged — and the
|
||||
cleared entry dropped rather than stored empty */
|
||||
"contact-sheet": (i) => i.half.includes("up") && /Petname/.test(i.halfText) && /Group/.test(i.halfText) && /Note/.test(i.halfText) && /Favorite/.test(i.halfText) && /Trusted/.test(i.halfText) && i.halfSub === "kept on this phone, published nowhere",
|
||||
"contact-petname": (i) => i.half.includes("up") && /Zola from Vinyl Rips/.test(i.halfText) && i.halfSub.startsWith("ada · "),
|
||||
"contact-note": (i) => i.half.includes("up") && /trades vinyl rips/.test(i.halfText),
|
||||
"contact-fav": (i) => i.half.includes("up") && i.halfSw === "Favorite",
|
||||
"buddy-petname": (i) => i.budNames === "Zola from Vinyl Rips|cy" && /ada/.test(i.budSubs) && !i.toast,
|
||||
"room-users": (i) => i.half.includes("up") && /Zola from Vinyl Rips/.test(i.halfText) && /ada/.test(i.halfText) && /bo/.test(i.halfText),
|
||||
"contact-cleared": (i) => !i.half.includes("up") && i.budNames === "ada|cy" && !i.toast,
|
||||
"home-more": (i) => i.half.includes("up"),
|
||||
you: (i) => i.title.startsWith("You") && i.norm === "on" && i.folderRow && i.srcMax === "No limit",
|
||||
"you-norm-off": (i) => i.norm === "off",
|
||||
@@ -653,6 +689,8 @@ const PHONE_STEPS = [
|
||||
{ do: `__click('.prefs[data-mode="albumart"] .chip', '1500 px')`, name: "you-artedge-back", wait: 900 },
|
||||
{ do: `document.querySelectorAll('.nav button')[2].click()`, wait: 700 },
|
||||
{ do: `document.querySelectorAll('.nav button')[3].click()`, name: "community", wait: 900 },
|
||||
/* the real config's contact list, read back over the real IPC */
|
||||
{ do: `__ss.loadContacts()`, name: "contacts-read", wait: 800 },
|
||||
{ do: `document.querySelectorAll('.nav button')[2].click()`, wait: 600 },
|
||||
{ do: `document.querySelectorAll('.segtabs button')[1].click()`, wait: 600 },
|
||||
{ do: `__click('.screen button.row', null)`, name: "artist-cold", wait: 400 },
|
||||
@@ -678,6 +716,7 @@ const PHONE_EXPECT = {
|
||||
search: (i) => i.title.startsWith("Search"),
|
||||
"hold-sheet": (i) => i.half.includes("up"),
|
||||
tracks: (i) => i.title.startsWith("Your library"),
|
||||
"contacts-read": (i) => i.contactsLoaded === "yes" && !i.toast,
|
||||
"artist-cold": (i) => i.screen.includes("has-hero"),
|
||||
you: (i) => i.title.startsWith("You") && !!i.norm && !!i.srcMax,
|
||||
"you-norm-off": (i) => i.norm === "off" && !i.toast,
|
||||
|
||||
Reference in new issue
Block a user