feat(configureNativeFetcher): optional JWT pool for background native fetch

Add jwtTokens / jwtTokenPoolJson to the TypeScript API, parse and validate
(max 128) on Android and iOS, persist jwtTokenPool with native_fetcher_config
when persistToken is true (Android), and extend NativeNotificationContentFetcher
with a four-argument configure overload delegating to the existing three-arg
default. iOS stores the pool in UserDefaults JSON and uses primary jwt or first
pool entry in the plugin background fetch path. Bump version to 2.2.0. Update
TestNativeFetcher to exercise the new configure overload.
This commit is contained in:
Jose Olarte III
2026-03-27 16:30:31 +08:00
parent 469167a55f
commit 9121b1e0f7
8 changed files with 159 additions and 26 deletions

View File

@@ -27,6 +27,7 @@ import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import androidx.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -92,9 +93,17 @@ public class TestNativeFetcher implements NativeNotificationContentFetcher {
*/
@Override
public void configure(String apiBaseUrl, String activeDid, String jwtToken) {
configure(apiBaseUrl, activeDid, jwtToken, null);
}
@Override
public void configure(String apiBaseUrl, String activeDid, String jwtToken, @Nullable List<String> jwtTokenPool) {
this.apiBaseUrl = apiBaseUrl;
this.activeDid = activeDid;
this.jwtToken = jwtToken;
if (jwtTokenPool != null && !jwtTokenPool.isEmpty()) {
Log.i(TAG, "TestNativeFetcher: jwtTokenPool size=" + jwtTokenPool.size());
}
// Enhanced logging for JWT diagnostic purposes
Log.i(TAG, "TestNativeFetcher: Configured with API: " + apiBaseUrl);