-
Notifications
You must be signed in to change notification settings - Fork 17
feat: send wearable links from the client to the shop #9672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -25,7 +25,9 @@ public class AvatarController : ISection, IDisposable | |||||||||||
| private readonly BackpackGridController backpackGridController; | ||||||||||||
| private readonly AvatarTabsManager tabsManager; | ||||||||||||
| private readonly URLBuilder urlBuilder = new (); | ||||||||||||
| private readonly URLParameter marketplaceSourceParam = new ("utm_source", "backpack"); | ||||||||||||
| // Still "backpack" even though the destination is now the Shop: this names where the click came FROM, | ||||||||||||
| // and keeping it is what lets the web side see this traffic move from the marketplace over to the Shop. | ||||||||||||
| private readonly URLParameter shopSourceParam = new ("utm_source", "backpack"); | ||||||||||||
|
|
||||||||||||
| public AvatarController(AvatarView view, | ||||||||||||
| UnityAppWebBrowser webBrowser, | ||||||||||||
|
|
@@ -51,7 +53,7 @@ public AvatarController(AvatarView view, | |||||||||||
|
|
||||||||||||
| rectTransform = view.GetComponent<RectTransform>(); | ||||||||||||
|
|
||||||||||||
| view.marketplaceButton.onClick.AddListener(OnOpenMarketplace); | ||||||||||||
| view.marketplaceButton.onClick.AddListener(OnOpenShop); | ||||||||||||
|
|
||||||||||||
| slotsController = new BackpackSlotsController(slotViews, | ||||||||||||
| backpackCommandBus, | ||||||||||||
|
|
@@ -72,11 +74,14 @@ public AvatarController(AvatarView view, | |||||||||||
| tabsManager.InitializeAndEnable(); | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| private void OnOpenMarketplace() | ||||||||||||
| // The Shop and not the marketplace: this button lives in the avatar section, so what it is asked for is | ||||||||||||
| // always wearables or emotes, and those are what the Shop sells. LAND keeps pointing at the marketplace | ||||||||||||
| // elsewhere — the Shop carries no parcels or estates. | ||||||||||||
|
Comment on lines
+77
to
+79
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P2] The second and third lines narrate behavior of other code paths ("LAND keeps pointing at the marketplace elsewhere") — this is external behavior per CLAUDE.md §11. The first clause, that the button's context is always wearables/emotes, is a valid guarantee of the annotated method.
Suggested change
|
||||||||||||
| private void OnOpenShop() | ||||||||||||
|
Comment on lines
+77
to
+80
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P2] Over-explanatory comment (CLAUDE.md §11 — comments must explain what the annotated code does, not narrate caller/external behavior).
Suggested change
|
||||||||||||
| { | ||||||||||||
| urlBuilder.Clear(); | ||||||||||||
| urlBuilder.AppendDomain(URLDomain.FromString(decentralandUrlsSource.Url(DecentralandUrl.Market))); | ||||||||||||
| urlBuilder.AppendParameter(marketplaceSourceParam); | ||||||||||||
| urlBuilder.AppendDomain(URLDomain.FromString(decentralandUrlsSource.Url(DecentralandUrl.ShopLink))); | ||||||||||||
| urlBuilder.AppendParameter(shopSourceParam); | ||||||||||||
| webBrowser.OpenUrlMainThreadOnly(urlBuilder.Build()); | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -8,12 +8,20 @@ namespace DCL.InWorldCamera.PhotoDetail | |||||||||||||||||||||||||||
| public static class PhotoDetailUtility | ||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||||||||
| /// Extracts the marketplace link from a wearable. | ||||||||||||||||||||||||||||
| /// Taken from the old renderer. | ||||||||||||||||||||||||||||
| /// Builds the Shop link for a wearable worn in a photo. | ||||||||||||||||||||||||||||
| /// <para> | ||||||||||||||||||||||||||||
| /// The Shop and not the marketplace: the subject here is always a wearable, which is what the Shop | ||||||||||||||||||||||||||||
| /// sells and prices in USD. LAND still belongs to the marketplace — the Shop carries no parcels. | ||||||||||||||||||||||||||||
| /// </para> | ||||||||||||||||||||||||||||
| /// <para> | ||||||||||||||||||||||||||||
| /// Note the route differs, so this is not a host swap: the marketplace addresses an item as | ||||||||||||||||||||||||||||
|
Comment on lines
+13
to
+17
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P2] The first
Suggested change
|
||||||||||||||||||||||||||||
| /// <c>/contracts/{contract}/items/{id}</c> and the Shop as <c>/item/{contract}/{id}</c>. Keeping the | ||||||||||||||||||||||||||||
| /// old shape against the new host is a 404, not a redirect. | ||||||||||||||||||||||||||||
| /// </para> | ||||||||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||||||||
| public static string GetMarketplaceLink(this IWearable wearable, IDecentralandUrlsSource decentralandUrlsSource) | ||||||||||||||||||||||||||||
| public static string GetShopLink(this IWearable wearable, IDecentralandUrlsSource decentralandUrlsSource) | ||||||||||||||||||||||||||||
|
Comment on lines
+13
to
+22
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P2] Verbose XML doc (CLAUDE.md §11). The first
Suggested change
|
||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
| var marketplace = $"{decentralandUrlsSource.Url(DecentralandUrl.Market)}/contracts/{{0}}/items/{{1}}"; | ||||||||||||||||||||||||||||
| var shop = $"{decentralandUrlsSource.Url(DecentralandUrl.ShopLink)}/item/{{0}}/{{1}}"; | ||||||||||||||||||||||||||||
| ReadOnlySpan<char> idSpan = wearable.GetUrn().ToString().AsSpan(); | ||||||||||||||||||||||||||||
| int lastColonIndex = idSpan.LastIndexOf(':'); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
|
@@ -29,7 +37,7 @@ public static string GetMarketplaceLink(this IWearable wearable, IDecentralandUr | |||||||||||||||||||||||||||
| if (!contract.StartsWith("0x") || !int.TryParse(item, out int _)) | ||||||||||||||||||||||||||||
| return ""; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| return string.Format(marketplace, contract, item); | ||||||||||||||||||||||||||||
| return string.Format(shop, contract, item); | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P2] Comment narrates external behavior (CLAUDE.md §11: "A comment must state only what the annotated code itself does or guarantees, never what callers or upper layers will do"). The second line describes what "the web side" does with the UTM parameter — that behavior is external and could change independently, making the comment stale.