Show a profile picture chosen in another app in Breeze's own profile

Breeze reads the account's picture from its node through Entity's shared
reader, on connecting and every ten minutes, and takes it with Entity's
rule: a picture chosen here that the node has not accepted yet stays. The
taken picture is saved as already published, so it is not sent back.
Entity is pinned at the reader; the lock also follows Kryon master.
This commit is contained in:
waozi committed 2026-10-30 00:55:35 -03:00
1 parent 0c86daacf3
commit 9fdbdbdd52
5 files changed
+80 -30

No files matched your search

+1
View File
@@ -7,6 +7,7 @@
- Catalog games can award their own achievements, with the usual top-right notification.
- Friends, Lists and requests show the profile picture each friend chose in any app, abstract pictures included.
- Your profile picture reaches friends the same way as from every other app, and only once you choose one.
- A profile picture chosen in another app now shows in your own profile too.
- Pictures in a practice no longer flicker while its narration downloads.
- Sun Salutation narration speaks every pose and names the leg in each lunge.
+41 -9
View File
@@ -64,6 +64,10 @@ entity_picture: Publish.EntityPicturePublisher;
entity_picture_chosen: s32;
entity_picture_published: s32;
entity_picture_checked: s64;
// A picture chosen in another app comes back from the node; a choice made
// here meanwhile counts up the sequence and wins.
entity_picture_reader: Publish.EntityPictureReader;
entity_picture_sequence: s32;
// The picture a new account starts with, before anyone chooses one.
InbeStartingPicture :: (owner: string) -> s32 {
@@ -76,6 +80,18 @@ InbeStartingPicture :: (owner: string) -> s32 {
InbeProfilePictureChosen :: (icon: s32) {
storage_set_setting_int("profile_picture_chosen", icon)
entity_picture_checked = 0
entity_picture_sequence += 1
}
// The node's picture becomes this profile's, already published.
InbeProfilePictureAdopt :: (app: *InnerBreeze, icon: s32) {
app.profile_picture_icon = icon
storage_set_setting_int("profile_picture_icon", icon)
storage_set_setting_int("profile_picture_chosen", icon)
storage_set_setting_int("profile_icon_published", icon)
storage_set_setting_text("profile_icon_published_owner", TextUntilNul(entity_picture_reader.owner[:]))
entity_picture_chosen = icon
entity_picture_published = icon
}
InbeChosenPicture :: () -> s32 {
@@ -91,16 +107,32 @@ InbeChosenPicture :: () -> s32 {
return chosen
}
InbePicturePump :: () {
InbePictureRefresh :: (now: s64) {
entity_picture_checked = now + 5
entity_picture_chosen = InbeChosenPicture()
owner: [65]u8
unused CopyCString(storage_get_setting_text("sync_public_id"), owner[:])
entity_picture_published = 0
if storage_get_setting_text("profile_icon_published_owner") == TextUntilNul(owner[:]) {
entity_picture_published = storage_get_setting_int("profile_icon_published", 0)
}
}
InbePicturePump :: (app: *InnerBreeze) {
now := UnixNow()
if !entity_picture.active && now >= entity_picture_checked {
entity_picture_checked = now + 5
entity_picture_chosen = InbeChosenPicture()
owner: [65]u8
unused CopyCString(storage_get_setting_text("sync_public_id"), owner[:])
entity_picture_published = 0
if storage_get_setting_text("profile_icon_published_owner") == TextUntilNul(owner[:]) {
entity_picture_published = storage_get_setting_int("profile_icon_published", 0)
InbePictureRefresh(now)
}
node := Publish.EntityPictureReadPump(*entity_picture_reader, *entity_management, entity_picture_sequence, now)
if node != 0 {
if !entity_picture.active {
InbePictureRefresh(now)
}
pending := entity_picture.active ||
Publish.EntityPictureShouldPublish(entity_picture_chosen, entity_picture_published)
icon := ProfilePictureFromNode(node, app.profile_picture_icon, pending)
if icon != 0 {
InbeProfilePictureAdopt(app, icon)
}
}
accepted := Publish.EntityPicturePublishPump(*entity_picture, *entity_management,
@@ -462,7 +494,7 @@ InbeManagementPump :: (app: *InnerBreeze) {
entity_management.delegated = false
}
Provider.ProviderPump(*entity_management)
InbePicturePump()
InbePicturePump(app)
InbeManagementDiscardPicker()
if !entity_management.queue.pending && entity_management_selected[0] != cast(u8)0 {
unused RemoveFile(TextUntilNul(entity_management_selected[:]))
+10
View File
@@ -42,3 +42,13 @@ ProfilePictureEarlierChoice :: (saved: s32, starting: s32) -> s32 {
}
return saved
}
// A picture chosen in another app, as the node holds it; 0 keeps the
// current one, as does a choice here still on its way to the node.
ProfilePictureFromNode :: (node: s32, current: s32, choice_pending: bool) -> s32 {
icon := PolicyEntity.EntityPictureAdopt(node, current, choice_pending)
if icon == 0 || !ProfilePictureValid(icon) {
return 0
}
return icon
}
+7
View File
@@ -17,5 +17,12 @@ Answer :: () -> s32 {
if ProfilePictureEarlierChoice(55, 47) != 55 || ProfilePictureEarlierChoice(128, 47) != 128 ||
ProfilePictureEarlierChoice(47, 47) != 0 || ProfilePictureEarlierChoice(41, 47) != 0 ||
ProfilePictureEarlierChoice(999, 47) != 0 || ProfilePictureEarlierChoice(-1, 47) != 0 { return 8 }
// A picture chosen in another app shows in Breeze's own profile.
if ProfilePictureFromNode(128, 47, false) != 128 || ProfilePictureFromNode(55, 47, false) != 55 { return 9 }
// A choice here still on its way to the node is kept.
if ProfilePictureFromNode(128, 55, true) != 0 { return 10 }
// The same picture, no picture, or one Breeze does not offer changes nothing.
if ProfilePictureFromNode(55, 55, false) != 0 || ProfilePictureFromNode(0, 55, false) != 0 ||
ProfilePictureFromNode(62, 55, false) != 0 { return 11 }
return 42
}
+21 -21
View File
@@ -29,7 +29,7 @@
},
{
"commit": "1cb9df183089a77c8a16448a556186f30b261a98",
"dependencies": {"kryon": "p43481d12b77897ce"},
"dependencies": {"kryon": "p9606a2a69b380df3"},
"id": "p1b13dda539ed2a39",
"name": "Kss",
"ref": "master",
@@ -37,28 +37,12 @@
},
{
"commit": "bad2caaa84ef3eae61e40c99bf572d2b060d0ca2",
"dependencies": {"kryon": "p43481d12b77897ce"},
"dependencies": {"kryon": "p9606a2a69b380df3"},
"id": "p20eb23d3e6db3711",
"name": "Game2D",
"ref": "master",
"url": "https://github.com/kryonlabs/game2d.git"
},
{
"commit": "e1c1135dbd731560964ce26dc4529014eefcec5c",
"dependencies": {"raylib": "p5a77c9c35110e925"},
"id": "p43481d12b77897ce",
"name": "kryon",
"ref": "master",
"url": "https://github.com/kryonlabs/kryon.git"
},
{
"commit": "49645f51d4be4546ffd61c715d94d78cedd79325",
"dependencies": {"daochi_client": "p7de54c8ad98fe034", "kryon": "p43481d12b77897ce", "monocypher": "p809b4d31a48625a3", "qrcode": "p0dfa70137405b096"},
"id": "p485b3680dbdbbc93",
"name": "Entity",
"ref": "master",
"url": "https://github.com/waozixyz/entity.git"
},
{
"commit": "fafa2cea97d0cb379d832086ba45a989fa6f9c8e",
"dependencies": {},
@@ -93,9 +77,17 @@
"source": true,
"url": "https://github.com/LoupVaillant/Monocypher.git"
},
{
"commit": "39074d35643e055e36b1ffdd90586d65736222d0",
"dependencies": {"raylib": "p5a77c9c35110e925"},
"id": "p9606a2a69b380df3",
"name": "kryon",
"ref": "master",
"url": "https://github.com/kryonlabs/kryon.git"
},
{
"commit": "5b67236a8e355e67ce4f8cc0389b9ce3805b874b",
"dependencies": {"crypto": "pc23fbf455e97614d", "kryon": "p43481d12b77897ce"},
"dependencies": {"crypto": "pc23fbf455e97614d", "kryon": "p9606a2a69b380df3"},
"id": "p9928fc15e7b93288",
"name": "Apps",
"ref": "5b67236a8e355e67ce4f8cc0389b9ce3805b874b",
@@ -103,12 +95,20 @@
},
{
"commit": "3f888653b6b97010163d824c4cc72476be3214f3",
"dependencies": {"kryon": "p43481d12b77897ce"},
"dependencies": {"kryon": "p9606a2a69b380df3"},
"id": "pab5377a2950368a2",
"name": "plot",
"ref": "master",
"url": "https://github.com/kryonlabs/plot.git"
},
{
"commit": "33e54462886507cfb355f86e6d2d93cef7b2331c",
"dependencies": {"daochi_client": "p7de54c8ad98fe034", "kryon": "p9606a2a69b380df3", "monocypher": "p809b4d31a48625a3", "qrcode": "p0dfa70137405b096"},
"id": "pb6d17ac2aeb5844f",
"name": "Entity",
"ref": "master",
"url": "https://github.com/waozixyz/entity.git"
},
{
"commit": "944826f70779a6b6cd53f6b06a75b36f4d8a2558",
"dependencies": {},
@@ -154,7 +154,7 @@
}
],
"root": {
"dependencies": {"apps": "p9928fc15e7b93288", "crypto": "pc23fbf455e97614d", "curl": "pd4bcd11b7d623073", "daochi_client": "p7de54c8ad98fe034", "entity": "p485b3680dbdbbc93", "game2d": "p20eb23d3e6db3711", "kryon": "p43481d12b77897ce", "kss": "p1b13dda539ed2a39", "liboqs": "p1aaef6f156781e69", "mingcute": "pe1027b9d16704793", "monocypher": "p809b4d31a48625a3", "oqs": "p7098ac9cd92f7e5f", "plot": "pab5377a2950368a2", "practices": "pf4bd8f55c0c2ab4b", "qrcode": "p0dfa70137405b096", "rini": "p09fa77e94b0dfc6c", "sqlite": "peaa43c4b7ef72edf"},
"dependencies": {"apps": "p9928fc15e7b93288", "crypto": "pc23fbf455e97614d", "curl": "pd4bcd11b7d623073", "daochi_client": "p7de54c8ad98fe034", "entity": "pb6d17ac2aeb5844f", "game2d": "p20eb23d3e6db3711", "kryon": "p9606a2a69b380df3", "kss": "p1b13dda539ed2a39", "liboqs": "p1aaef6f156781e69", "mingcute": "pe1027b9d16704793", "monocypher": "p809b4d31a48625a3", "oqs": "p7098ac9cd92f7e5f", "plot": "pab5377a2950368a2", "practices": "pf4bd8f55c0c2ab4b", "qrcode": "p0dfa70137405b096", "rini": "p09fa77e94b0dfc6c", "sqlite": "peaa43c4b7ef72edf"},
"name": "Inbe"
},
"toolchain": {