public class NewsManager extends Object implements ClientApp
Maintains current news entries in memory while providing methods to add new entries and persist them to disk storage. Handles both initial welcome news and dynamic news feed updates with proper sorting and deduplication logic.
Implements ClientApp interface for lifecycle management with state tracking and notification capabilities. Supports legacy news.xml format for backward compatibility alongside newer structured formats.
| Constructor and Description |
|---|
NewsManager(I2PAppContext ctx,
ClientAppManager listener,
String[] args) |
| Modifier and Type | Method and Description |
|---|---|
void |
addEntries(List<NewsEntry> entries)
Add or replace each entry in the list.
|
String |
getDisplayName()
The display name of the ClientApp, used in user interfaces.
|
List<NewsEntry> |
getEntries() |
NewsEntry |
getInitialNews()
The initial (Welcome to I2P) news
|
String |
getName()
The generic name of the ClientApp, used for registration,
e.g.
|
ClientAppState |
getState()
The current state of the ClientApp.
|
void |
shutdown(String[] args)
ClientApp interface
|
void |
startup()
ClientApp interface
|
boolean |
storeEntries(List<Node> entries)
Store each entry.
|
public static final String APP_NAME
public NewsManager(I2PAppContext ctx, ClientAppManager listener, String[] args)
args - ignoredpublic void addEntries(List<NewsEntry> entries)
public String getDisplayName()
ClientAppgetDisplayName in interface ClientApppublic List<NewsEntry> getEntries()
public NewsEntry getInitialNews()
public String getName()
ClientApppublic ClientAppState getState()
ClientApppublic void shutdown(String[] args)
public boolean storeEntries(List<Node> entries)
entries - each one should be "entry" at the root