Fix the small mechanical rules. [skip build]
Checks / checks (push) Successful in 2m12s
Trigger cinny-mobile / dispatch (push) Successful in 1s

This commit is contained in:
2026-11-01 10:28:59 +11:00
parent bb85cd9778
commit 73554ecf7f
45 changed files with 331 additions and 347 deletions
+3 -3
View File
@@ -316,7 +316,7 @@ class AndroidUnifiedPushManager {
}
this.distributorSetupAttempted = true;
void this.tryRequestDistributorSetup();
this.tryRequestDistributorSetup();
}
/** Re-opens distributor selection once after ACTION_REQUIRED and logs actionable status. */
@@ -385,12 +385,12 @@ class AndroidUnifiedPushManager {
this.listenerHandles = [
await MatrixBackgroundSync.addListener('unifiedPushNewEndpoint', (event) => {
void this.handleNewEndpoint(event).catch((err) => {
this.handleNewEndpoint(event).catch((err) => {
console.error('[BackgroundSync] handleNewEndpoint failed:', err);
});
}),
await MatrixBackgroundSync.addListener('unifiedPushUnregistered', (event) => {
void this.handleUnregistered(event);
this.handleUnregistered(event);
}),
await MatrixBackgroundSync.addListener('unifiedPushRegistrationFailed', (event) => {
this.handleRegistrationFailed(event);
+1 -1
View File
@@ -139,7 +139,7 @@ export const randomStr = (len = 12): string => {
export const suffixRename = (name: string, validator: (newName: string) => boolean): string => {
let suffix = 1;
let newName = name;
let newName;
do {
newName = name + suffix;
suffix += 1;
+2 -4
View File
@@ -68,9 +68,6 @@ export const setupCopyHandler = (
// Format the time
const timeStr = timeHourMinute(data.ts, hour24Clock);
// Extract the selected text from within this message's content
let selectedText = '';
// Create a range for this message's content
const contentRange = document.createRange();
contentRange.selectNodeContents(contentEl);
@@ -88,7 +85,8 @@ export const setupCopyHandler = (
extractRange.setEnd(contentRange.endContainer, contentRange.endOffset);
}
selectedText = extractRange.toString().trim();
// Extract the selected text from within this message's content
const selectedText = extractRange.toString().trim();
if (selectedText) {
messages.push({
+4 -4
View File
@@ -289,14 +289,14 @@ export function groupCollectibleItems(items: DiscordCollectibleItem[]): Collecti
return [...map.entries()]
.map(([id, groupItems]) => {
const items = dedupeVariantItems(groupItems).sort((a, b) =>
const sortedItems = dedupeVariantItems(groupItems).sort((a, b) =>
variantItemLabel(a).localeCompare(variantItemLabel(b)),
);
return {
id,
name: variantGroupDisplayName(items[0]),
category: items[0].category,
items,
name: variantGroupDisplayName(sortedItems[0]),
category: sortedItems[0].category,
items: sortedItems,
};
})
.sort((a, b) => a.name.localeCompare(b.name));
+9 -7
View File
@@ -83,13 +83,14 @@ export function parseColorPreference(value: unknown): ColorPreference | undefine
if (!value || typeof value !== 'object') return undefined;
const obj = value as Record<string, unknown>;
const on_dark =
const onDark =
typeof obj.on_dark === 'string' && isValidHexColor(obj.on_dark) ? obj.on_dark : undefined;
const on_light =
const onLight =
typeof obj.on_light === 'string' && isValidHexColor(obj.on_light) ? obj.on_light : undefined;
if (!on_dark && !on_light) return undefined;
return { on_dark, on_light };
if (!onDark && !onLight) return undefined;
// on_dark/on_light are the MSC4522 wire keys, so the property names stay
return { on_dark: onDark, on_light: onLight };
}
export function extractColorPreferenceFromProfile(
@@ -128,10 +129,10 @@ export function extractBannerUrlFromProfile(profile: Record<string, unknown>): s
function parseStoredCollectible(value: unknown): StoredCollectible | undefined {
if (!value || typeof value !== 'object') return undefined;
const obj = value as Record<string, unknown>;
const sku_id = typeof obj.sku_id === 'string' ? obj.sku_id : undefined;
const skuId = typeof obj.sku_id === 'string' ? obj.sku_id : undefined;
const name = typeof obj.name === 'string' ? obj.name : undefined;
const { assets } = obj;
if (!sku_id || !name || !assets || typeof assets !== 'object') return undefined;
if (!skuId || !name || !assets || typeof assets !== 'object') return undefined;
const parsedAssets: Record<string, string> = {};
Object.entries(assets as Record<string, unknown>).forEach(([key, mxc]) => {
@@ -142,7 +143,8 @@ function parseStoredCollectible(value: unknown): StoredCollectible | undefined {
if (Object.keys(parsedAssets).length === 0) return undefined;
return {
sku_id,
// sku_id is the Discord collectible wire key
sku_id: skuId,
name,
assets: parsedAssets,
effect: obj.effect,
@@ -44,6 +44,5 @@ export function registerDesktopMediaSaver(): void {
registerMediaSaver(async (blob, filename) => {
await saveWithElectron(blob, filename);
});
return;
}
}
+6 -7
View File
@@ -134,7 +134,6 @@ export const focusWindow = async (): Promise<void> => {
if (electron?.window?.focus) {
await electron.window.focus();
}
return;
} catch (err) {
console.warn('Failed to focus Electron window:', err);
}
@@ -426,12 +425,12 @@ export const readClipboardImage = async (): Promise<File | null> => {
if (electron?.clipboard?.readImage) {
const result = await electron.clipboard.readImage();
// IPC may return a data URL string or { success, data } depending on path.
const dataUrl =
typeof result === 'string'
? result
: result && typeof result === 'object' && typeof result.data === 'string'
? result.data
: null;
let dataUrl = null;
if (typeof result === 'string') {
dataUrl = result;
} else if (result && typeof result === 'object' && typeof result.data === 'string') {
dataUrl = result.data;
}
if (!dataUrl) return null;
// Convert data URL to File