Skip to content

Wrong size of Large widget background cut for iPhone 12 #16

@April-June-August

Description

@April-June-August

Image

I’m using iOS 18.5. Relevant code is as follows:

// Determine widget size
let widgetSize = config.widgetFamily || "large";
let isSmall = widgetSize === "small";
let isMedium = widgetSize === "medium";
let isLarge = widgetSize === "large";

// Get the script's directory and check for background images
const fm = FileManager.local();
const scriptPath = module.filename;
const scriptDir = scriptPath.substring(0, scriptPath.lastIndexOf('/'));
const imagesDir = fm.joinPath(scriptDir, 'images');

// Check for size-specific background image
const bgImageName = `days-left-background-image-${widgetSize}.jpg`;
const bgImagePath = fm.joinPath(imagesDir, bgImageName);

// Set background image if it exists, otherwise set background color
if (fm.fileExists(bgImagePath)) {
  const image = Image.fromFile(bgImagePath);
  widget.backgroundImage = image;
} else {
  widget.backgroundColor = backgroundColor;
}

Did I miss something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions