Class PWAProps

All Implemented Interfaces:
EventListener, IGProp<GProp<?>[]>, IPropCnr, Cloneable
Direct Known Subclasses:
EditorPWAProps

public class PWAProps extends PropCnr
The Progressive Web App (PWA) properties: the .iiziPWA of an application. Its presence makes the application installable (PWA-DESIGN.md section 3); what the application is called and says of itself comes from the App (ModuleApp: $name, $descr, ruling AU-9), never from here - the former name, $descr and Firebase scriptTag members were removed by CC-PUSH-PWA-PAGES (rulings PW-1, PW-2): nothing read the first two, and the Firebase web configuration belongs to the App's Analytics (PWA-DESIGN.md section 8). The former localized member went with ruling PW-D-1: the languages of /app/<id>/ are the App's (AppLanguages). A file still carrying any of them loads and keeps them as plain members; nothing reads them.

The icons are this container's own (Set I, ruling PX-1, which reverses AU-9 for icons only: the App's iconBitmap is no longer used for the PWA): the required master icon, a square PNG of at least 512 x 512, and the optional maskable, monochrome and Apple touch icons, each an AssetReference to a file in the module's assets - normally in the PWA folder assets/PWA/ (PD-1), where the Designer also writes every variant the folder lacks when the page is applied (PD-2). The server builds what it serves from the folder's files, these references, the application's iiziRun icon set and the master, in that order (com.iizix.pwa.PWAIcons).

The manifest members of this container: CATEGORY_PROPNAME (the iiziRun page's category list, written to the manifest's categories as W3C names, ruling PM-4) and ORIENTATION_PROPNAME (the manifest's orientation; the default, 0, writes none).

Author:
Christopher Mindus
  • Field Details

    • FILE_NAME

      public static final String FILE_NAME
      The file name of the PWA properties container: ".iiziPWA".
      See Also:
    • ATOM

      public static final Atom ATOM
      The atom for the PWA properties container: "$pwa".
    • ICON_PROPNAME

      public static final String ICON_PROPNAME
      The property name of the master icon asset reference: "icon". Required: a square PNG of at least PWAIcons.MASTER_MIN_SIZE px.
      See Also:
    • ICON_MASKABLE_PROPNAME

      public static final String ICON_MASKABLE_PROPNAME
      The property name of the optional maskable icon asset reference: "iconMaskable". An opaque image; transparency is a WARNING (Android fills its mask with the icon).
      See Also:
    • ICON_MONOCHROME_PROPNAME

      public static final String ICON_MONOCHROME_PROPNAME
      The property name of the optional monochrome icon asset reference: "iconMonochrome". Its alpha is the shape.
      See Also:
    • ICON_APPLE_PROPNAME

      public static final String ICON_APPLE_PROPNAME
      The property name of the optional Apple touch icon asset reference: "iconApple". An opaque image; transparency is a WARNING (iOS shows it black).
      See Also:
    • CATEGORY_PROPNAME

      public static final String CATEGORY_PROPNAME
      The property name of the category: "category", an index into the iiziRun page's list (1 = Business .. 21 = Weather, as com.iizigo.run lists them); 0 or absent for none.
      See Also:
    • ORIENTATION_PROPNAME

      public static final String ORIENTATION_PROPNAME
      The property name of the orientation: "orientation", an index into PWAManifest.ORIENTATIONS; 0 or absent for none.
      See Also:
  • Constructor Details

    • PWAProps

      public PWAProps()
      Creates a PWAProps container without name and with a null value.
    • PWAProps

      public PWAProps(Atom propertyAtom)
      Creates a PWAProps container with the specified name with a null value.
      Parameters:
      propertyAtom - the property atom.
  • Method Details

    • clone

      public PWAProps clone()
      Creates a clone out of this property.
      Overrides:
      clone in class PropCnr
      Returns:
      The clone of the PWAProps.
    • getIconReference

      public AssetReference getIconReference()
      Gets the master icon reference.
      Returns:
      The asset reference, or null if not defined.
    • getIconMaskableReference

      public AssetReference getIconMaskableReference()
      Gets the maskable icon reference.
      Returns:
      The asset reference, or null if not defined.
    • getIconMonochromeReference

      public AssetReference getIconMonochromeReference()
      Gets the monochrome icon reference.
      Returns:
      The asset reference, or null if not defined.
    • getIconAppleReference

      public AssetReference getIconAppleReference()
      Gets the Apple touch icon reference.
      Returns:
      The asset reference, or null if not defined.
    • getCategory

      public int getCategory()
      Gets the category index of the iiziRun page's list.
      Returns:
      The index, 1 = Business .. 21 = Weather, or 0 for none.
    • getOrientation

      public int getOrientation()
      Gets the orientation index.
      Returns:
      The index into PWAManifest.ORIENTATIONS, or 0 for none.
    • resolveIcon

      public static FileURIPropCnr resolveIcon(AssetReference ref)
      Resolves a referenced icon file: the reference's resolved target, else a lookup through the tree the reference sits in.
      Parameters:
      ref - The reference, or null.
      Returns:
      The file, or null when the reference is absent or not found.
    • readIcon

      public static byte[] readIcon(AssetReference ref)
      Reads the bytes of a referenced icon file, as the Designer and a development server can: through the URL of the resolved asset.
      Parameters:
      ref - The reference, or null.
      Returns:
      The bytes, or null when the reference is absent, unresolved or the file cannot be read.
    • verify

      public boolean verify(PropVerification verification)
      Verifies this property container (ruling PX-1, strict since the container's presence makes the application installable): the master icon must be set, resolved, a PNG, square and at least 512 x 512 (each an ERROR); a maskable or Apple touch icon with transparency is a WARNING naming the platform rule; an optional icon that is set must resolve to a PNG (ERROR). The category and the orientation need no check: the page offers the lists.
      Specified by:
      verify in interface IGProp<GProp<?>[]>
      Overrides:
      verify in class PropCnr
      Parameters:
      verification - The property verification class.
      Returns:
      true if verification should proceed, false if disposed of and verification should not take place.