Skip to content

Wallpapers

roux g. buciu edited this page Feb 8, 2022 · 10 revisions

Overview

The wallpaper feature allows users to set a FireFox provided wallpaper as their background on the FireFox Homepage of the application. Once selected, the wallpaper will remain as the background even if that particular wallpaper was part of a limited time collection and is no longer available.

Main Interface

Most of the work that

Adding new wallpapers

Wallpapers belong to collections, whether they are default firefox wallpapers or belong to special collections. To create a new collection, it must be defined in the appropriate place in the WallpaperDataManager. If adding a default firefox wallpaper, this can be added

Here is what the code looks like for adding an example special limited collection:

let exampleShipDate = Calendar.current.date(from: DateComponents(year: 2022, month: 5, day:1))
let exampleExpiryDate = Calendar.current.date(from: DateComponents(year: 2022, month: 5, day:1))
let exampleCollection = WallpaperCollection(wallpaperFileNames: ["trRed",
                                                                 "trGroup"],
                                            ofType: .themed(type: .projectHouse),
                                            shippingOn: exampleShipDate,
                                            expiringOn: exampleHouseDate,
                                            limitedToLocales: ["en_US", "es_US"])
        
specialCollections.append(projectHouse)

Components

  • Wallpaper - Base wallpaper class that has information such as wallpaper name, type, locale availability, and ship/expiration dates. Does not include images as the requirement was to be able to store images separately.
  • WallpaperCollections - A collection of wallpapers defining the wallpaper names, type, locale availability, and ship/expration dates. When creating wallpapers, collections are the main interface used, rather than individual wallpapers.
  • WallpaperManager - The main interface for dealing with wallpaper data. Responsible for delegating storage, maintenance of selected wallpapers, and verification of resources.
  • WallpaperDataManager - Responsible for managing the available wallpapers objects, given locale/date/resource availability, for collections.
  • WallpaperResourceManager - Pesponsible for managing resources for various wallpapers
  • WallpaperFilePathProtocol - Allows you to get a file path to a specified key under the wallpapers folder of the application's documents directory. Path is: .../wallpapers/key-as-folder/key-as-file
  • WallpaperStorageUtility - Responsible for storing, retrieving, and deleting images to the documents directory.
  • WallpaperNetworkUtility - Responsible for fetching images over the network, if the application doesn't already have those resources, given a specified url
Clone this wiki locally