feat(fetcher): add configureNativeFetcher cross-platform API

Add configureNativeFetcher() plugin method to enable TypeScript configuration
of native fetchers with API credentials. This provides a cross-platform
mechanism for passing configuration from JavaScript to native code without
relying on platform-specific storage.

- Add configure() method to NativeNotificationContentFetcher interface
  (optional, defaults to no-op for fetchers that don't need config)
- Add configureNativeFetcher plugin method in DailyNotificationPlugin
- Add TypeScript definitions and comprehensive JSDoc
- Create NATIVE_FETCHER_CONFIGURATION.md documentation
- Update TestNativeFetcher to use real API endpoint (10.0.2.2:3000)
- Update DemoNativeFetcher Javadoc explaining configure() is optional
- Add configureNativeFetcher() call to demo app's configurePlugin()

Enables host apps to configure native fetchers from TypeScript, keeping
the interface consistent across Android, iOS, and web platforms.
This commit is contained in:
Matthew Raymer
2025-10-30 10:03:47 +00:00
parent 59cd975c24
commit c1cc8802f6
5 changed files with 954 additions and 30 deletions

View File

@@ -25,11 +25,23 @@ import java.util.concurrent.CompletableFuture;
*
* Returns mock notification content for demonstration. In production host apps,
* this would fetch from TimeSafari API or other data sources.
*
* <p><b>Configuration:</b></p>
* <p>This fetcher does NOT override {@code configure()} because it uses hardcoded
* mock data and doesn't need API credentials. The default no-op implementation
* from the interface is sufficient.</p>
*
* <p>For an example that accepts configuration from TypeScript, see
* {@code TestNativeFetcher} in the test app.</p>
*/
public class DemoNativeFetcher implements NativeNotificationContentFetcher {
private static final String TAG = "DemoNativeFetcher";
// Note: We intentionally do NOT override configure() because this fetcher
// uses hardcoded mock data. The default no-op implementation from the
// interface is sufficient. This demonstrates that configure() is optional.
@Override
@NonNull
public CompletableFuture<List<NotificationContent>> fetchContent(