Class NewsManager

  • All Implemented Interfaces:
    ClientApp

    public class NewsManager
    extends Object
    implements ClientApp
    Manage current news. Keeps current entries in memory, and provide methods to add new entries and store them to disk.
    Since:
    0.9.23
    • Method Detail

      • getEntries

        public List<NewsEntry> getEntries()
        Returns:
        non-null, sorted by updated date, newest first
      • storeEntries

        public boolean storeEntries​(List<Node> entries)
        Store each entry. Old entries are always overwritten, as they may change even without the updated date changing. Does NOT update the NewsEntry list.
        Parameters:
        entries - each one should be "entry" at the root
        Returns:
        success
      • addEntries

        public void addEntries​(List<NewsEntry> entries)
        Add or replace each entry in the list. Does NOT store them to disk.
      • startup

        public void startup()
        ClientApp interface
        Specified by:
        startup in interface ClientApp
      • shutdown

        public void shutdown​(String[] args)
        ClientApp interface
        Specified by:
        shutdown in interface ClientApp
        Parameters:
        args - ignored
      • getName

        public String getName()
        Description copied from interface: ClientApp
        The generic name of the ClientApp, used for registration, e.g. "console". Do not translate.
        Specified by:
        getName in interface ClientApp
        Returns:
        non-null
      • getDisplayName

        public String getDisplayName()
        Description copied from interface: ClientApp
        The display name of the ClientApp, used in user interfaces. The app must translate.
        Specified by:
        getDisplayName in interface ClientApp
        Returns:
        non-null
      • getInitialNews

        public NewsEntry getInitialNews()
        The initial (welcome to i2p) news
        Returns:
        entry with first-installed date stamp, or null
        Since:
        0.9.28