Use large user icons

This commit is contained in:
Samuel Elliott
2025-07-31 23:03:04 +01:00
parent b6490f9639
commit fd08c4ddde
13 changed files with 26 additions and 24 deletions

View File

@@ -171,7 +171,7 @@ function AddFriend(props: {
!props.setFriendCode ? styles.targetUserNoFriendCodeField : null,
theme.targetUser,
]}>
<Image source={{uri: props.lookupUser.imageUri, width: 100, height: 100}} style={styles.targetUserImage} />
<Image source={{uri: props.lookupUser.image2Uri, width: 100, height: 100}} style={styles.targetUserImage} />
<View style={styles.targetUserDetail}>
<Text style={[styles.targetUserName, theme.text]}>{props.lookupUser.name}</Text>

View File

@@ -12,7 +12,7 @@ export default function NintendoSwitchUser(props: {
const user = 'friend' in props ? props.friend : props.user;
return <>
<Image source={{uri: user.imageUri, width: 16, height: 16}}
<Image source={{uri: user.image2Uri, width: 16, height: 16}}
style={styles.userImage} />
{' '}
{user.name}

View File

@@ -87,7 +87,7 @@ function Friend(props: {
return <View style={styles.main}>
<View style={styles.friend}>
<Image source={{uri: friend.imageUri, width: 130, height: 130}} style={styles.friendImage} />
<Image source={{uri: friend.image2Uri, width: 130, height: 130}} style={styles.friendImage} />
<Text style={[styles.friendName, theme.text]}>{friend.name}</Text>
{friend.presence.updatedAt ?

View File

@@ -73,7 +73,7 @@ function Friend(props: {
const game = 'name' in props.friend.presence.game ? props.friend.presence.game : null;
const content = <View style={styles.friend}>
<Image source={{uri: props.friend.imageUri, width: 50, height: 50}} style={styles.friendImage as ImageStyle} />
<Image source={{uri: props.friend.image2Uri, width: 50, height: 50}} style={styles.friendImage as ImageStyle} />
{game ? <Image source={{uri: game.imageUri, width: 20, height: 20}} style={styles.presenceImage as ImageStyle} /> : null}
<Text style={theme.text}>{props.friend.name}</Text>

View File

@@ -92,7 +92,8 @@ function User(props: {
{props.user.nso ? <View style={styles.userNso}>
<View style={styles.userNsoImage}>
<Image source={{uri: props.user.nso.nsoAccount.user.imageUri, width: 16, height: 16}} />
<Image source={{uri: props.user.nso.nsoAccount.user.image2Uri ??
props.user.nso.nsoAccount.user.imageUri, width: 16, height: 16}} />
</View>
<Text style={[styles.userNsoName, theme.text]}>{props.user.nso.nsoAccount.user.name}</Text>

View File

@@ -575,7 +575,7 @@ export class ElectronNotificationManager extends NotificationManager {
title: friend.name,
body: this.t('playing', {name: currenttitle.name +
(currenttitle.sysDescription ? '\n' + currenttitle.sysDescription : '')})!,
icon: await tryGetNativeImageFromUrl(friend.imageUri),
icon: await tryGetNativeImageFromUrl(friend.image2Uri),
}).show();
}
@@ -583,7 +583,7 @@ export class ElectronNotificationManager extends NotificationManager {
new Notification({
title: friend.name,
body: this.t('offline')!,
icon: await tryGetNativeImageFromUrl(friend.imageUri),
icon: await tryGetNativeImageFromUrl(friend.image2Uri),
}).show();
}
@@ -594,7 +594,7 @@ export class ElectronNotificationManager extends NotificationManager {
title: friend.name,
body: this.t('playing', {name: currenttitle.name +
(currenttitle.sysDescription ? '\n' + currenttitle.sysDescription : '')})!,
icon: await tryGetNativeImageFromUrl(friend.imageUri),
icon: await tryGetNativeImageFromUrl(friend.image2Uri),
}).show();
}
@@ -605,7 +605,7 @@ export class ElectronNotificationManager extends NotificationManager {
title: friend.name,
body: this.t('playing', {name: currenttitle.name +
(currenttitle.sysDescription ? '\n' + currenttitle.sysDescription : '')})!,
icon: await tryGetNativeImageFromUrl(friend.imageUri),
icon: await tryGetNativeImageFromUrl(friend.image2Uri),
}).show();
}
}

View File

@@ -327,7 +327,8 @@ export async function addNsoAccount(app: App, use_in_app_browser = true) {
na_username: data.user.screenName,
}) ?? 'Already signed in as ' + data.nsoAccount.user.name + ' (Nintendo Account ' +
data.user.nickname + ' / ' + data.user.screenName + ')',
icon: await tryGetNativeImageFromUrl(data.nsoAccount.user.imageUri),
icon: await tryGetNativeImageFromUrl(data.nsoAccount.user.image2Uri ??
data.nsoAccount.user.imageUri),
}).show();
return {nso, data};

View File

@@ -144,7 +144,7 @@ export class TerminalNotificationManager extends NotificationManager {
message: 'Playing ' + currenttitle.name +
(currenttitle.sysDescription ? '\n' + currenttitle.sysDescription : ''),
// icon: currenttitle.imageUri,
icon: friend.imageUri,
icon: friend.image2Uri,
});
}
@@ -152,7 +152,7 @@ export class TerminalNotificationManager extends NotificationManager {
this.notifier.notify({
title: friend.name,
message: 'Offline',
icon: friend.imageUri,
icon: friend.image2Uri,
});
}
@@ -164,7 +164,7 @@ export class TerminalNotificationManager extends NotificationManager {
message: 'Playing ' + currenttitle.name +
(currenttitle.sysDescription ? '\n' + currenttitle.sysDescription : ''),
// icon: currenttitle.imageUri,
icon: friend.imageUri,
icon: friend.image2Uri,
});
}
@@ -176,7 +176,7 @@ export class TerminalNotificationManager extends NotificationManager {
message: 'Playing ' + currenttitle.name +
(currenttitle.sysDescription ? '\n' + currenttitle.sysDescription : ''),
// icon: currenttitle.imageUri,
icon: friend.imageUri,
icon: friend.image2Uri,
});
}

View File

@@ -1226,10 +1226,10 @@ class Server extends HttpServer {
const result = await this.handlePresenceRequest(req, null, presence_user_nsaid);
const url_map = await this.downloadImages({
url: result.friend.imageUri,
url: result.friend.image2Uri,
}, this.getResourceBaseUrls(req));
const image_url = url_map[result.friend.imageUri];
const image_url = url_map[result.friend.image2Uri];
res.statusCode = 303;
res.setHeader('Location', image_url);

View File

@@ -67,7 +67,7 @@ export async function handler(argv: ArgumentsCamelCase<Arguments>) {
const [presence, user, data] = await getPresenceFromUrl(argv.url);
const result = data as PresenceResponse;
const image_urls = [result.friend.imageUri];
const image_urls = [result.friend.image2Uri];
if ('imageUri' in result.friend.presence.game) image_urls.push(result.friend.presence.game.imageUri);
for (const stage of result.splatoon3_vs_setting?.vsStages ?? []) image_urls.push(stage.image.url);

View File

@@ -123,7 +123,7 @@ class Server extends HttpServer {
return;
}
const image_urls = [result.friend.imageUri];
const image_urls = [result.friend.image2Uri];
if ('imageUri' in result.friend.presence.game) image_urls.push(result.friend.presence.game.imageUri);
for (const stage of result.splatoon3_vs_setting?.vsStages ?? []) image_urls.push(stage.image.url);
@@ -168,7 +168,7 @@ class Server extends HttpServer {
const [presence, user, data] = await getPresenceFromUrl(this.base_url + '/' + presence_user_nsaid + qs_2);
const result = data as PresenceResponse;
const image_urls = [result.friend.imageUri];
const image_urls = [result.friend.image2Uri];
if ('imageUri' in result.friend.presence.game) image_urls.push(result.friend.presence.game.imageUri);
if (result.splatoon3_fest_team?.myVoteState === FestVoteState.VOTED) image_urls.push(result.splatoon3_fest_team.image.url);

View File

@@ -187,7 +187,7 @@ export function renderUserEmbedSvg(
`}}
<image x="30" y="30" width="120" height="120"
href="${image(result.friend.imageUri) ?? result.friend.imageUri}" />
href="${image(result.friend.image2Uri) ?? result.friend.image2Uri}" />
<text x="180" y="57" fill="${colours.text}" font-size="26" font-family="${font_family}" font-weight="500" mask="url(#mask-out-title)">${result.friend.name}</text>
<line x1="180" y1="73" x2="${width - 30}" y2="73" stroke="${colours.separator}" />

View File

@@ -51,8 +51,8 @@ export function getDiscordPresence(
if (title.smallImageKey) {
activity.setSmallImage(title.smallImageKey, title.smallImageText);
} else if (context?.friendcode && context.user?.imageUri) {
activity.setSmallImage(context.user.imageUri, 'SW-' + context.friendcode.id);
} else if (context?.friendcode && context.user?.image2Uri) {
activity.setSmallImage(context.user.image2Uri, 'SW-' + context.friendcode.id);
}
if (game.shopUri) {
@@ -179,8 +179,8 @@ export function getInactiveDiscordPresence(
state: 'Not playing',
largeImageKey: 'nintendoswitch',
largeImageText: product,
smallImageKey: context?.friendcode ? context?.user?.imageUri : undefined,
smallImageText: context?.friendcode && context?.user?.imageUri ? 'SW-' + context.friendcode.id : undefined,
smallImageKey: context?.friendcode ? context?.user?.image2Uri : undefined,
smallImageText: context?.friendcode && context?.user?.image2Uri ? 'SW-' + context.friendcode.id : undefined,
},
};
}