11: Implement Linux RSS/Atom feed parser

This commit is contained in:
2026-03-30 09:38:06 -04:00
parent d84b8ff4e8
commit bbc1363bcc
1646 changed files with 46543 additions and 669 deletions

View File

@@ -0,0 +1,286 @@
package com.rssuper.database;
import androidx.annotation.NonNull;
import androidx.room.DatabaseConfiguration;
import androidx.room.InvalidationTracker;
import androidx.room.RoomDatabase;
import androidx.room.RoomOpenHelper;
import androidx.room.migration.AutoMigrationSpec;
import androidx.room.migration.Migration;
import androidx.room.util.DBUtil;
import androidx.room.util.TableInfo;
import androidx.sqlite.db.SupportSQLiteDatabase;
import androidx.sqlite.db.SupportSQLiteOpenHelper;
import com.rssuper.database.daos.FeedItemDao;
import com.rssuper.database.daos.FeedItemDao_Impl;
import com.rssuper.database.daos.SearchHistoryDao;
import com.rssuper.database.daos.SearchHistoryDao_Impl;
import com.rssuper.database.daos.SubscriptionDao;
import com.rssuper.database.daos.SubscriptionDao_Impl;
import java.lang.Class;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.processing.Generated;
@Generated("androidx.room.RoomProcessor")
@SuppressWarnings({"unchecked", "deprecation"})
public final class RssDatabase_Impl extends RssDatabase {
private volatile SubscriptionDao _subscriptionDao;
private volatile FeedItemDao _feedItemDao;
private volatile SearchHistoryDao _searchHistoryDao;
@Override
@NonNull
protected SupportSQLiteOpenHelper createOpenHelper(@NonNull final DatabaseConfiguration config) {
final SupportSQLiteOpenHelper.Callback _openCallback = new RoomOpenHelper(config, new RoomOpenHelper.Delegate(1) {
@Override
public void createAllTables(@NonNull final SupportSQLiteDatabase db) {
db.execSQL("CREATE TABLE IF NOT EXISTS `subscriptions` (`id` TEXT NOT NULL, `url` TEXT NOT NULL, `title` TEXT NOT NULL, `category` TEXT, `enabled` INTEGER NOT NULL, `fetchInterval` INTEGER NOT NULL, `createdAt` INTEGER NOT NULL, `updatedAt` INTEGER NOT NULL, `lastFetchedAt` INTEGER, `nextFetchAt` INTEGER, `error` TEXT, `httpAuthUsername` TEXT, `httpAuthPassword` TEXT, PRIMARY KEY(`id`))");
db.execSQL("CREATE UNIQUE INDEX IF NOT EXISTS `index_subscriptions_url` ON `subscriptions` (`url`)");
db.execSQL("CREATE TABLE IF NOT EXISTS `feed_items` (`id` TEXT NOT NULL, `subscriptionId` TEXT NOT NULL, `title` TEXT NOT NULL, `link` TEXT, `description` TEXT, `content` TEXT, `author` TEXT, `published` INTEGER, `updated` INTEGER, `categories` TEXT, `enclosureUrl` TEXT, `enclosureType` TEXT, `enclosureLength` INTEGER, `guid` TEXT, `isRead` INTEGER NOT NULL, `isStarred` INTEGER NOT NULL, PRIMARY KEY(`id`), FOREIGN KEY(`subscriptionId`) REFERENCES `subscriptions`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )");
db.execSQL("CREATE INDEX IF NOT EXISTS `index_feed_items_subscriptionId` ON `feed_items` (`subscriptionId`)");
db.execSQL("CREATE INDEX IF NOT EXISTS `index_feed_items_published` ON `feed_items` (`published`)");
db.execSQL("CREATE TABLE IF NOT EXISTS `search_history` (`id` TEXT NOT NULL, `query` TEXT NOT NULL, `timestamp` INTEGER NOT NULL, PRIMARY KEY(`id`))");
db.execSQL("CREATE INDEX IF NOT EXISTS `index_search_history_timestamp` ON `search_history` (`timestamp`)");
db.execSQL("CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)");
db.execSQL("INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'e2ba84ee978402814323b7e5668eb758')");
}
@Override
public void dropAllTables(@NonNull final SupportSQLiteDatabase db) {
db.execSQL("DROP TABLE IF EXISTS `subscriptions`");
db.execSQL("DROP TABLE IF EXISTS `feed_items`");
db.execSQL("DROP TABLE IF EXISTS `search_history`");
final List<? extends RoomDatabase.Callback> _callbacks = mCallbacks;
if (_callbacks != null) {
for (RoomDatabase.Callback _callback : _callbacks) {
_callback.onDestructiveMigration(db);
}
}
}
@Override
public void onCreate(@NonNull final SupportSQLiteDatabase db) {
final List<? extends RoomDatabase.Callback> _callbacks = mCallbacks;
if (_callbacks != null) {
for (RoomDatabase.Callback _callback : _callbacks) {
_callback.onCreate(db);
}
}
}
@Override
public void onOpen(@NonNull final SupportSQLiteDatabase db) {
mDatabase = db;
db.execSQL("PRAGMA foreign_keys = ON");
internalInitInvalidationTracker(db);
final List<? extends RoomDatabase.Callback> _callbacks = mCallbacks;
if (_callbacks != null) {
for (RoomDatabase.Callback _callback : _callbacks) {
_callback.onOpen(db);
}
}
}
@Override
public void onPreMigrate(@NonNull final SupportSQLiteDatabase db) {
DBUtil.dropFtsSyncTriggers(db);
}
@Override
public void onPostMigrate(@NonNull final SupportSQLiteDatabase db) {
}
@Override
@NonNull
public RoomOpenHelper.ValidationResult onValidateSchema(
@NonNull final SupportSQLiteDatabase db) {
final HashMap<String, TableInfo.Column> _columnsSubscriptions = new HashMap<String, TableInfo.Column>(13);
_columnsSubscriptions.put("id", new TableInfo.Column("id", "TEXT", true, 1, null, TableInfo.CREATED_FROM_ENTITY));
_columnsSubscriptions.put("url", new TableInfo.Column("url", "TEXT", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
_columnsSubscriptions.put("title", new TableInfo.Column("title", "TEXT", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
_columnsSubscriptions.put("category", new TableInfo.Column("category", "TEXT", false, 0, null, TableInfo.CREATED_FROM_ENTITY));
_columnsSubscriptions.put("enabled", new TableInfo.Column("enabled", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
_columnsSubscriptions.put("fetchInterval", new TableInfo.Column("fetchInterval", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
_columnsSubscriptions.put("createdAt", new TableInfo.Column("createdAt", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
_columnsSubscriptions.put("updatedAt", new TableInfo.Column("updatedAt", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
_columnsSubscriptions.put("lastFetchedAt", new TableInfo.Column("lastFetchedAt", "INTEGER", false, 0, null, TableInfo.CREATED_FROM_ENTITY));
_columnsSubscriptions.put("nextFetchAt", new TableInfo.Column("nextFetchAt", "INTEGER", false, 0, null, TableInfo.CREATED_FROM_ENTITY));
_columnsSubscriptions.put("error", new TableInfo.Column("error", "TEXT", false, 0, null, TableInfo.CREATED_FROM_ENTITY));
_columnsSubscriptions.put("httpAuthUsername", new TableInfo.Column("httpAuthUsername", "TEXT", false, 0, null, TableInfo.CREATED_FROM_ENTITY));
_columnsSubscriptions.put("httpAuthPassword", new TableInfo.Column("httpAuthPassword", "TEXT", false, 0, null, TableInfo.CREATED_FROM_ENTITY));
final HashSet<TableInfo.ForeignKey> _foreignKeysSubscriptions = new HashSet<TableInfo.ForeignKey>(0);
final HashSet<TableInfo.Index> _indicesSubscriptions = new HashSet<TableInfo.Index>(1);
_indicesSubscriptions.add(new TableInfo.Index("index_subscriptions_url", true, Arrays.asList("url"), Arrays.asList("ASC")));
final TableInfo _infoSubscriptions = new TableInfo("subscriptions", _columnsSubscriptions, _foreignKeysSubscriptions, _indicesSubscriptions);
final TableInfo _existingSubscriptions = TableInfo.read(db, "subscriptions");
if (!_infoSubscriptions.equals(_existingSubscriptions)) {
return new RoomOpenHelper.ValidationResult(false, "subscriptions(com.rssuper.database.entities.SubscriptionEntity).\n"
+ " Expected:\n" + _infoSubscriptions + "\n"
+ " Found:\n" + _existingSubscriptions);
}
final HashMap<String, TableInfo.Column> _columnsFeedItems = new HashMap<String, TableInfo.Column>(16);
_columnsFeedItems.put("id", new TableInfo.Column("id", "TEXT", true, 1, null, TableInfo.CREATED_FROM_ENTITY));
_columnsFeedItems.put("subscriptionId", new TableInfo.Column("subscriptionId", "TEXT", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
_columnsFeedItems.put("title", new TableInfo.Column("title", "TEXT", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
_columnsFeedItems.put("link", new TableInfo.Column("link", "TEXT", false, 0, null, TableInfo.CREATED_FROM_ENTITY));
_columnsFeedItems.put("description", new TableInfo.Column("description", "TEXT", false, 0, null, TableInfo.CREATED_FROM_ENTITY));
_columnsFeedItems.put("content", new TableInfo.Column("content", "TEXT", false, 0, null, TableInfo.CREATED_FROM_ENTITY));
_columnsFeedItems.put("author", new TableInfo.Column("author", "TEXT", false, 0, null, TableInfo.CREATED_FROM_ENTITY));
_columnsFeedItems.put("published", new TableInfo.Column("published", "INTEGER", false, 0, null, TableInfo.CREATED_FROM_ENTITY));
_columnsFeedItems.put("updated", new TableInfo.Column("updated", "INTEGER", false, 0, null, TableInfo.CREATED_FROM_ENTITY));
_columnsFeedItems.put("categories", new TableInfo.Column("categories", "TEXT", false, 0, null, TableInfo.CREATED_FROM_ENTITY));
_columnsFeedItems.put("enclosureUrl", new TableInfo.Column("enclosureUrl", "TEXT", false, 0, null, TableInfo.CREATED_FROM_ENTITY));
_columnsFeedItems.put("enclosureType", new TableInfo.Column("enclosureType", "TEXT", false, 0, null, TableInfo.CREATED_FROM_ENTITY));
_columnsFeedItems.put("enclosureLength", new TableInfo.Column("enclosureLength", "INTEGER", false, 0, null, TableInfo.CREATED_FROM_ENTITY));
_columnsFeedItems.put("guid", new TableInfo.Column("guid", "TEXT", false, 0, null, TableInfo.CREATED_FROM_ENTITY));
_columnsFeedItems.put("isRead", new TableInfo.Column("isRead", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
_columnsFeedItems.put("isStarred", new TableInfo.Column("isStarred", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
final HashSet<TableInfo.ForeignKey> _foreignKeysFeedItems = new HashSet<TableInfo.ForeignKey>(1);
_foreignKeysFeedItems.add(new TableInfo.ForeignKey("subscriptions", "CASCADE", "NO ACTION", Arrays.asList("subscriptionId"), Arrays.asList("id")));
final HashSet<TableInfo.Index> _indicesFeedItems = new HashSet<TableInfo.Index>(2);
_indicesFeedItems.add(new TableInfo.Index("index_feed_items_subscriptionId", false, Arrays.asList("subscriptionId"), Arrays.asList("ASC")));
_indicesFeedItems.add(new TableInfo.Index("index_feed_items_published", false, Arrays.asList("published"), Arrays.asList("ASC")));
final TableInfo _infoFeedItems = new TableInfo("feed_items", _columnsFeedItems, _foreignKeysFeedItems, _indicesFeedItems);
final TableInfo _existingFeedItems = TableInfo.read(db, "feed_items");
if (!_infoFeedItems.equals(_existingFeedItems)) {
return new RoomOpenHelper.ValidationResult(false, "feed_items(com.rssuper.database.entities.FeedItemEntity).\n"
+ " Expected:\n" + _infoFeedItems + "\n"
+ " Found:\n" + _existingFeedItems);
}
final HashMap<String, TableInfo.Column> _columnsSearchHistory = new HashMap<String, TableInfo.Column>(3);
_columnsSearchHistory.put("id", new TableInfo.Column("id", "TEXT", true, 1, null, TableInfo.CREATED_FROM_ENTITY));
_columnsSearchHistory.put("query", new TableInfo.Column("query", "TEXT", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
_columnsSearchHistory.put("timestamp", new TableInfo.Column("timestamp", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
final HashSet<TableInfo.ForeignKey> _foreignKeysSearchHistory = new HashSet<TableInfo.ForeignKey>(0);
final HashSet<TableInfo.Index> _indicesSearchHistory = new HashSet<TableInfo.Index>(1);
_indicesSearchHistory.add(new TableInfo.Index("index_search_history_timestamp", false, Arrays.asList("timestamp"), Arrays.asList("ASC")));
final TableInfo _infoSearchHistory = new TableInfo("search_history", _columnsSearchHistory, _foreignKeysSearchHistory, _indicesSearchHistory);
final TableInfo _existingSearchHistory = TableInfo.read(db, "search_history");
if (!_infoSearchHistory.equals(_existingSearchHistory)) {
return new RoomOpenHelper.ValidationResult(false, "search_history(com.rssuper.database.entities.SearchHistoryEntity).\n"
+ " Expected:\n" + _infoSearchHistory + "\n"
+ " Found:\n" + _existingSearchHistory);
}
return new RoomOpenHelper.ValidationResult(true, null);
}
}, "e2ba84ee978402814323b7e5668eb758", "1667cc13cabf4316be6ddd78782dad22");
final SupportSQLiteOpenHelper.Configuration _sqliteConfig = SupportSQLiteOpenHelper.Configuration.builder(config.context).name(config.name).callback(_openCallback).build();
final SupportSQLiteOpenHelper _helper = config.sqliteOpenHelperFactory.create(_sqliteConfig);
return _helper;
}
@Override
@NonNull
protected InvalidationTracker createInvalidationTracker() {
final HashMap<String, String> _shadowTablesMap = new HashMap<String, String>(0);
final HashMap<String, Set<String>> _viewTables = new HashMap<String, Set<String>>(0);
return new InvalidationTracker(this, _shadowTablesMap, _viewTables, "subscriptions","feed_items","search_history");
}
@Override
public void clearAllTables() {
super.assertNotMainThread();
final SupportSQLiteDatabase _db = super.getOpenHelper().getWritableDatabase();
final boolean _supportsDeferForeignKeys = android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP;
try {
if (!_supportsDeferForeignKeys) {
_db.execSQL("PRAGMA foreign_keys = FALSE");
}
super.beginTransaction();
if (_supportsDeferForeignKeys) {
_db.execSQL("PRAGMA defer_foreign_keys = TRUE");
}
_db.execSQL("DELETE FROM `subscriptions`");
_db.execSQL("DELETE FROM `feed_items`");
_db.execSQL("DELETE FROM `search_history`");
super.setTransactionSuccessful();
} finally {
super.endTransaction();
if (!_supportsDeferForeignKeys) {
_db.execSQL("PRAGMA foreign_keys = TRUE");
}
_db.query("PRAGMA wal_checkpoint(FULL)").close();
if (!_db.inTransaction()) {
_db.execSQL("VACUUM");
}
}
}
@Override
@NonNull
protected Map<Class<?>, List<Class<?>>> getRequiredTypeConverters() {
final HashMap<Class<?>, List<Class<?>>> _typeConvertersMap = new HashMap<Class<?>, List<Class<?>>>();
_typeConvertersMap.put(SubscriptionDao.class, SubscriptionDao_Impl.getRequiredConverters());
_typeConvertersMap.put(FeedItemDao.class, FeedItemDao_Impl.getRequiredConverters());
_typeConvertersMap.put(SearchHistoryDao.class, SearchHistoryDao_Impl.getRequiredConverters());
return _typeConvertersMap;
}
@Override
@NonNull
public Set<Class<? extends AutoMigrationSpec>> getRequiredAutoMigrationSpecs() {
final HashSet<Class<? extends AutoMigrationSpec>> _autoMigrationSpecsSet = new HashSet<Class<? extends AutoMigrationSpec>>();
return _autoMigrationSpecsSet;
}
@Override
@NonNull
public List<Migration> getAutoMigrations(
@NonNull final Map<Class<? extends AutoMigrationSpec>, AutoMigrationSpec> autoMigrationSpecs) {
final List<Migration> _autoMigrations = new ArrayList<Migration>();
return _autoMigrations;
}
@Override
public SubscriptionDao subscriptionDao() {
if (_subscriptionDao != null) {
return _subscriptionDao;
} else {
synchronized(this) {
if(_subscriptionDao == null) {
_subscriptionDao = new SubscriptionDao_Impl(this);
}
return _subscriptionDao;
}
}
}
@Override
public FeedItemDao feedItemDao() {
if (_feedItemDao != null) {
return _feedItemDao;
} else {
synchronized(this) {
if(_feedItemDao == null) {
_feedItemDao = new FeedItemDao_Impl(this);
}
return _feedItemDao;
}
}
}
@Override
public SearchHistoryDao searchHistoryDao() {
if (_searchHistoryDao != null) {
return _searchHistoryDao;
} else {
synchronized(this) {
if(_searchHistoryDao == null) {
_searchHistoryDao = new SearchHistoryDao_Impl(this);
}
return _searchHistoryDao;
}
}
}
}

View File

@@ -0,0 +1,576 @@
package com.rssuper.database.daos;
import android.database.Cursor;
import android.os.CancellationSignal;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.room.CoroutinesRoom;
import androidx.room.EntityDeletionOrUpdateAdapter;
import androidx.room.EntityInsertionAdapter;
import androidx.room.RoomDatabase;
import androidx.room.RoomSQLiteQuery;
import androidx.room.SharedSQLiteStatement;
import androidx.room.util.CursorUtil;
import androidx.room.util.DBUtil;
import androidx.sqlite.db.SupportSQLiteStatement;
import com.rssuper.converters.DateConverter;
import com.rssuper.database.entities.SearchHistoryEntity;
import java.lang.Class;
import java.lang.Exception;
import java.lang.Integer;
import java.lang.Long;
import java.lang.Object;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.concurrent.Callable;
import javax.annotation.processing.Generated;
import kotlin.coroutines.Continuation;
import kotlinx.coroutines.flow.Flow;
@Generated("androidx.room.RoomProcessor")
@SuppressWarnings({"unchecked", "deprecation"})
public final class SearchHistoryDao_Impl implements SearchHistoryDao {
private final RoomDatabase __db;
private final EntityInsertionAdapter<SearchHistoryEntity> __insertionAdapterOfSearchHistoryEntity;
private final DateConverter __dateConverter = new DateConverter();
private final EntityDeletionOrUpdateAdapter<SearchHistoryEntity> __deletionAdapterOfSearchHistoryEntity;
private final EntityDeletionOrUpdateAdapter<SearchHistoryEntity> __updateAdapterOfSearchHistoryEntity;
private final SharedSQLiteStatement __preparedStmtOfDeleteSearchHistoryById;
private final SharedSQLiteStatement __preparedStmtOfDeleteAllSearchHistory;
private final SharedSQLiteStatement __preparedStmtOfDeleteSearchHistoryOlderThan;
public SearchHistoryDao_Impl(@NonNull final RoomDatabase __db) {
this.__db = __db;
this.__insertionAdapterOfSearchHistoryEntity = new EntityInsertionAdapter<SearchHistoryEntity>(__db) {
@Override
@NonNull
protected String createQuery() {
return "INSERT OR IGNORE INTO `search_history` (`id`,`query`,`timestamp`) VALUES (?,?,?)";
}
@Override
protected void bind(@NonNull final SupportSQLiteStatement statement,
@NonNull final SearchHistoryEntity entity) {
if (entity.getId() == null) {
statement.bindNull(1);
} else {
statement.bindString(1, entity.getId());
}
if (entity.getQuery() == null) {
statement.bindNull(2);
} else {
statement.bindString(2, entity.getQuery());
}
final Long _tmp = __dateConverter.dateToTimestamp(entity.getTimestamp());
if (_tmp == null) {
statement.bindNull(3);
} else {
statement.bindLong(3, _tmp);
}
}
};
this.__deletionAdapterOfSearchHistoryEntity = new EntityDeletionOrUpdateAdapter<SearchHistoryEntity>(__db) {
@Override
@NonNull
protected String createQuery() {
return "DELETE FROM `search_history` WHERE `id` = ?";
}
@Override
protected void bind(@NonNull final SupportSQLiteStatement statement,
@NonNull final SearchHistoryEntity entity) {
if (entity.getId() == null) {
statement.bindNull(1);
} else {
statement.bindString(1, entity.getId());
}
}
};
this.__updateAdapterOfSearchHistoryEntity = new EntityDeletionOrUpdateAdapter<SearchHistoryEntity>(__db) {
@Override
@NonNull
protected String createQuery() {
return "UPDATE OR ABORT `search_history` SET `id` = ?,`query` = ?,`timestamp` = ? WHERE `id` = ?";
}
@Override
protected void bind(@NonNull final SupportSQLiteStatement statement,
@NonNull final SearchHistoryEntity entity) {
if (entity.getId() == null) {
statement.bindNull(1);
} else {
statement.bindString(1, entity.getId());
}
if (entity.getQuery() == null) {
statement.bindNull(2);
} else {
statement.bindString(2, entity.getQuery());
}
final Long _tmp = __dateConverter.dateToTimestamp(entity.getTimestamp());
if (_tmp == null) {
statement.bindNull(3);
} else {
statement.bindLong(3, _tmp);
}
if (entity.getId() == null) {
statement.bindNull(4);
} else {
statement.bindString(4, entity.getId());
}
}
};
this.__preparedStmtOfDeleteSearchHistoryById = new SharedSQLiteStatement(__db) {
@Override
@NonNull
public String createQuery() {
final String _query = "DELETE FROM search_history WHERE id = ?";
return _query;
}
};
this.__preparedStmtOfDeleteAllSearchHistory = new SharedSQLiteStatement(__db) {
@Override
@NonNull
public String createQuery() {
final String _query = "DELETE FROM search_history";
return _query;
}
};
this.__preparedStmtOfDeleteSearchHistoryOlderThan = new SharedSQLiteStatement(__db) {
@Override
@NonNull
public String createQuery() {
final String _query = "DELETE FROM search_history WHERE timestamp < ?";
return _query;
}
};
}
@Override
public Object insertSearchHistory(final SearchHistoryEntity search,
final Continuation<? super Long> $completion) {
return CoroutinesRoom.execute(__db, true, new Callable<Long>() {
@Override
@NonNull
public Long call() throws Exception {
__db.beginTransaction();
try {
final Long _result = __insertionAdapterOfSearchHistoryEntity.insertAndReturnId(search);
__db.setTransactionSuccessful();
return _result;
} finally {
__db.endTransaction();
}
}
}, $completion);
}
@Override
public Object insertSearchHistories(final List<SearchHistoryEntity> searches,
final Continuation<? super List<Long>> $completion) {
return CoroutinesRoom.execute(__db, true, new Callable<List<Long>>() {
@Override
@NonNull
public List<Long> call() throws Exception {
__db.beginTransaction();
try {
final List<Long> _result = __insertionAdapterOfSearchHistoryEntity.insertAndReturnIdsList(searches);
__db.setTransactionSuccessful();
return _result;
} finally {
__db.endTransaction();
}
}
}, $completion);
}
@Override
public Object deleteSearchHistory(final SearchHistoryEntity search,
final Continuation<? super Integer> $completion) {
return CoroutinesRoom.execute(__db, true, new Callable<Integer>() {
@Override
@NonNull
public Integer call() throws Exception {
int _total = 0;
__db.beginTransaction();
try {
_total += __deletionAdapterOfSearchHistoryEntity.handle(search);
__db.setTransactionSuccessful();
return _total;
} finally {
__db.endTransaction();
}
}
}, $completion);
}
@Override
public Object updateSearchHistory(final SearchHistoryEntity search,
final Continuation<? super Integer> $completion) {
return CoroutinesRoom.execute(__db, true, new Callable<Integer>() {
@Override
@NonNull
public Integer call() throws Exception {
int _total = 0;
__db.beginTransaction();
try {
_total += __updateAdapterOfSearchHistoryEntity.handle(search);
__db.setTransactionSuccessful();
return _total;
} finally {
__db.endTransaction();
}
}
}, $completion);
}
@Override
public Object deleteSearchHistoryById(final String id,
final Continuation<? super Integer> $completion) {
return CoroutinesRoom.execute(__db, true, new Callable<Integer>() {
@Override
@NonNull
public Integer call() throws Exception {
final SupportSQLiteStatement _stmt = __preparedStmtOfDeleteSearchHistoryById.acquire();
int _argIndex = 1;
if (id == null) {
_stmt.bindNull(_argIndex);
} else {
_stmt.bindString(_argIndex, id);
}
try {
__db.beginTransaction();
try {
final Integer _result = _stmt.executeUpdateDelete();
__db.setTransactionSuccessful();
return _result;
} finally {
__db.endTransaction();
}
} finally {
__preparedStmtOfDeleteSearchHistoryById.release(_stmt);
}
}
}, $completion);
}
@Override
public Object deleteAllSearchHistory(final Continuation<? super Integer> $completion) {
return CoroutinesRoom.execute(__db, true, new Callable<Integer>() {
@Override
@NonNull
public Integer call() throws Exception {
final SupportSQLiteStatement _stmt = __preparedStmtOfDeleteAllSearchHistory.acquire();
try {
__db.beginTransaction();
try {
final Integer _result = _stmt.executeUpdateDelete();
__db.setTransactionSuccessful();
return _result;
} finally {
__db.endTransaction();
}
} finally {
__preparedStmtOfDeleteAllSearchHistory.release(_stmt);
}
}
}, $completion);
}
@Override
public Object deleteSearchHistoryOlderThan(final long timestamp,
final Continuation<? super Integer> $completion) {
return CoroutinesRoom.execute(__db, true, new Callable<Integer>() {
@Override
@NonNull
public Integer call() throws Exception {
final SupportSQLiteStatement _stmt = __preparedStmtOfDeleteSearchHistoryOlderThan.acquire();
int _argIndex = 1;
_stmt.bindLong(_argIndex, timestamp);
try {
__db.beginTransaction();
try {
final Integer _result = _stmt.executeUpdateDelete();
__db.setTransactionSuccessful();
return _result;
} finally {
__db.endTransaction();
}
} finally {
__preparedStmtOfDeleteSearchHistoryOlderThan.release(_stmt);
}
}
}, $completion);
}
@Override
public Flow<List<SearchHistoryEntity>> getAllSearchHistory() {
final String _sql = "SELECT * FROM search_history ORDER BY timestamp DESC";
final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 0);
return CoroutinesRoom.createFlow(__db, false, new String[] {"search_history"}, new Callable<List<SearchHistoryEntity>>() {
@Override
@NonNull
public List<SearchHistoryEntity> call() throws Exception {
final Cursor _cursor = DBUtil.query(__db, _statement, false, null);
try {
final int _cursorIndexOfId = CursorUtil.getColumnIndexOrThrow(_cursor, "id");
final int _cursorIndexOfQuery = CursorUtil.getColumnIndexOrThrow(_cursor, "query");
final int _cursorIndexOfTimestamp = CursorUtil.getColumnIndexOrThrow(_cursor, "timestamp");
final List<SearchHistoryEntity> _result = new ArrayList<SearchHistoryEntity>(_cursor.getCount());
while (_cursor.moveToNext()) {
final SearchHistoryEntity _item;
final String _tmpId;
if (_cursor.isNull(_cursorIndexOfId)) {
_tmpId = null;
} else {
_tmpId = _cursor.getString(_cursorIndexOfId);
}
final String _tmpQuery;
if (_cursor.isNull(_cursorIndexOfQuery)) {
_tmpQuery = null;
} else {
_tmpQuery = _cursor.getString(_cursorIndexOfQuery);
}
final Date _tmpTimestamp;
final Long _tmp;
if (_cursor.isNull(_cursorIndexOfTimestamp)) {
_tmp = null;
} else {
_tmp = _cursor.getLong(_cursorIndexOfTimestamp);
}
_tmpTimestamp = __dateConverter.fromTimestamp(_tmp);
_item = new SearchHistoryEntity(_tmpId,_tmpQuery,_tmpTimestamp);
_result.add(_item);
}
return _result;
} finally {
_cursor.close();
}
}
@Override
protected void finalize() {
_statement.release();
}
});
}
@Override
public Object getSearchHistoryById(final String id,
final Continuation<? super SearchHistoryEntity> $completion) {
final String _sql = "SELECT * FROM search_history WHERE id = ?";
final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 1);
int _argIndex = 1;
if (id == null) {
_statement.bindNull(_argIndex);
} else {
_statement.bindString(_argIndex, id);
}
final CancellationSignal _cancellationSignal = DBUtil.createCancellationSignal();
return CoroutinesRoom.execute(__db, false, _cancellationSignal, new Callable<SearchHistoryEntity>() {
@Override
@Nullable
public SearchHistoryEntity call() throws Exception {
final Cursor _cursor = DBUtil.query(__db, _statement, false, null);
try {
final int _cursorIndexOfId = CursorUtil.getColumnIndexOrThrow(_cursor, "id");
final int _cursorIndexOfQuery = CursorUtil.getColumnIndexOrThrow(_cursor, "query");
final int _cursorIndexOfTimestamp = CursorUtil.getColumnIndexOrThrow(_cursor, "timestamp");
final SearchHistoryEntity _result;
if (_cursor.moveToFirst()) {
final String _tmpId;
if (_cursor.isNull(_cursorIndexOfId)) {
_tmpId = null;
} else {
_tmpId = _cursor.getString(_cursorIndexOfId);
}
final String _tmpQuery;
if (_cursor.isNull(_cursorIndexOfQuery)) {
_tmpQuery = null;
} else {
_tmpQuery = _cursor.getString(_cursorIndexOfQuery);
}
final Date _tmpTimestamp;
final Long _tmp;
if (_cursor.isNull(_cursorIndexOfTimestamp)) {
_tmp = null;
} else {
_tmp = _cursor.getLong(_cursorIndexOfTimestamp);
}
_tmpTimestamp = __dateConverter.fromTimestamp(_tmp);
_result = new SearchHistoryEntity(_tmpId,_tmpQuery,_tmpTimestamp);
} else {
_result = null;
}
return _result;
} finally {
_cursor.close();
_statement.release();
}
}
}, $completion);
}
@Override
public Flow<List<SearchHistoryEntity>> searchHistory(final String query) {
final String _sql = "SELECT * FROM search_history WHERE query LIKE '%' || ? || '%' ORDER BY timestamp DESC";
final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 1);
int _argIndex = 1;
if (query == null) {
_statement.bindNull(_argIndex);
} else {
_statement.bindString(_argIndex, query);
}
return CoroutinesRoom.createFlow(__db, false, new String[] {"search_history"}, new Callable<List<SearchHistoryEntity>>() {
@Override
@NonNull
public List<SearchHistoryEntity> call() throws Exception {
final Cursor _cursor = DBUtil.query(__db, _statement, false, null);
try {
final int _cursorIndexOfId = CursorUtil.getColumnIndexOrThrow(_cursor, "id");
final int _cursorIndexOfQuery = CursorUtil.getColumnIndexOrThrow(_cursor, "query");
final int _cursorIndexOfTimestamp = CursorUtil.getColumnIndexOrThrow(_cursor, "timestamp");
final List<SearchHistoryEntity> _result = new ArrayList<SearchHistoryEntity>(_cursor.getCount());
while (_cursor.moveToNext()) {
final SearchHistoryEntity _item;
final String _tmpId;
if (_cursor.isNull(_cursorIndexOfId)) {
_tmpId = null;
} else {
_tmpId = _cursor.getString(_cursorIndexOfId);
}
final String _tmpQuery;
if (_cursor.isNull(_cursorIndexOfQuery)) {
_tmpQuery = null;
} else {
_tmpQuery = _cursor.getString(_cursorIndexOfQuery);
}
final Date _tmpTimestamp;
final Long _tmp;
if (_cursor.isNull(_cursorIndexOfTimestamp)) {
_tmp = null;
} else {
_tmp = _cursor.getLong(_cursorIndexOfTimestamp);
}
_tmpTimestamp = __dateConverter.fromTimestamp(_tmp);
_item = new SearchHistoryEntity(_tmpId,_tmpQuery,_tmpTimestamp);
_result.add(_item);
}
return _result;
} finally {
_cursor.close();
}
}
@Override
protected void finalize() {
_statement.release();
}
});
}
@Override
public Flow<List<SearchHistoryEntity>> getRecentSearches(final int limit) {
final String _sql = "SELECT * FROM search_history ORDER BY timestamp DESC LIMIT ?";
final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 1);
int _argIndex = 1;
_statement.bindLong(_argIndex, limit);
return CoroutinesRoom.createFlow(__db, false, new String[] {"search_history"}, new Callable<List<SearchHistoryEntity>>() {
@Override
@NonNull
public List<SearchHistoryEntity> call() throws Exception {
final Cursor _cursor = DBUtil.query(__db, _statement, false, null);
try {
final int _cursorIndexOfId = CursorUtil.getColumnIndexOrThrow(_cursor, "id");
final int _cursorIndexOfQuery = CursorUtil.getColumnIndexOrThrow(_cursor, "query");
final int _cursorIndexOfTimestamp = CursorUtil.getColumnIndexOrThrow(_cursor, "timestamp");
final List<SearchHistoryEntity> _result = new ArrayList<SearchHistoryEntity>(_cursor.getCount());
while (_cursor.moveToNext()) {
final SearchHistoryEntity _item;
final String _tmpId;
if (_cursor.isNull(_cursorIndexOfId)) {
_tmpId = null;
} else {
_tmpId = _cursor.getString(_cursorIndexOfId);
}
final String _tmpQuery;
if (_cursor.isNull(_cursorIndexOfQuery)) {
_tmpQuery = null;
} else {
_tmpQuery = _cursor.getString(_cursorIndexOfQuery);
}
final Date _tmpTimestamp;
final Long _tmp;
if (_cursor.isNull(_cursorIndexOfTimestamp)) {
_tmp = null;
} else {
_tmp = _cursor.getLong(_cursorIndexOfTimestamp);
}
_tmpTimestamp = __dateConverter.fromTimestamp(_tmp);
_item = new SearchHistoryEntity(_tmpId,_tmpQuery,_tmpTimestamp);
_result.add(_item);
}
return _result;
} finally {
_cursor.close();
}
}
@Override
protected void finalize() {
_statement.release();
}
});
}
@Override
public Flow<Integer> getSearchHistoryCount() {
final String _sql = "SELECT COUNT(*) FROM search_history";
final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 0);
return CoroutinesRoom.createFlow(__db, false, new String[] {"search_history"}, new Callable<Integer>() {
@Override
@NonNull
public Integer call() throws Exception {
final Cursor _cursor = DBUtil.query(__db, _statement, false, null);
try {
final Integer _result;
if (_cursor.moveToFirst()) {
final Integer _tmp;
if (_cursor.isNull(0)) {
_tmp = null;
} else {
_tmp = _cursor.getInt(0);
}
_result = _tmp;
} else {
_result = null;
}
return _result;
} finally {
_cursor.close();
}
}
@Override
protected void finalize() {
_statement.release();
}
});
}
@NonNull
public static List<Class<?>> getRequiredConverters() {
return Collections.emptyList();
}
}

View File

@@ -0,0 +1,101 @@
// Code generated by moshi-kotlin-codegen. Do not edit.
@file:Suppress("DEPRECATION", "unused", "UNUSED_PARAMETER", "ClassName", "REDUNDANT_PROJECTION",
"RedundantExplicitType", "LocalVariableName", "RedundantVisibilityModifier",
"PLATFORM_CLASS_MAPPED_TO_KOTLIN", "IMPLICIT_NOTHING_TYPE_ARGUMENT_IN_RETURN_POSITION")
package com.rssuper.models
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
import com.squareup.moshi.Moshi
import com.squareup.moshi.`internal`.Util
import java.lang.NullPointerException
import java.lang.reflect.Constructor
import kotlin.Int
import kotlin.Long
import kotlin.String
import kotlin.Suppress
import kotlin.collections.emptySet
import kotlin.jvm.Volatile
import kotlin.text.buildString
public class EnclosureJsonAdapter(
moshi: Moshi,
) : JsonAdapter<Enclosure>() {
private val options: JsonReader.Options = JsonReader.Options.of("url", "type", "length")
private val stringAdapter: JsonAdapter<String> = moshi.adapter(String::class.java, emptySet(),
"url")
private val nullableLongAdapter: JsonAdapter<Long?> = moshi.adapter(Long::class.javaObjectType,
emptySet(), "length")
@Volatile
private var constructorRef: Constructor<Enclosure>? = null
override fun toString(): String = buildString(31) {
append("GeneratedJsonAdapter(").append("Enclosure").append(')') }
override fun fromJson(reader: JsonReader): Enclosure {
var url: String? = null
var type: String? = null
var length: Long? = null
var mask0 = -1
reader.beginObject()
while (reader.hasNext()) {
when (reader.selectName(options)) {
0 -> url = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("url", "url", reader)
1 -> type = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("type", "type",
reader)
2 -> {
length = nullableLongAdapter.fromJson(reader)
// $mask = $mask and (1 shl 2).inv()
mask0 = mask0 and 0xfffffffb.toInt()
}
-1 -> {
// Unknown name, skip it.
reader.skipName()
reader.skipValue()
}
}
}
reader.endObject()
if (mask0 == 0xfffffffb.toInt()) {
// All parameters with defaults are set, invoke the constructor directly
return Enclosure(
url = url ?: throw Util.missingProperty("url", "url", reader),
type = type ?: throw Util.missingProperty("type", "type", reader),
length = length
)
} else {
// Reflectively invoke the synthetic defaults constructor
@Suppress("UNCHECKED_CAST")
val localConstructor: Constructor<Enclosure> = this.constructorRef ?:
Enclosure::class.java.getDeclaredConstructor(String::class.java, String::class.java,
Long::class.javaObjectType, Int::class.javaPrimitiveType,
Util.DEFAULT_CONSTRUCTOR_MARKER).also { this.constructorRef = it }
return localConstructor.newInstance(
url ?: throw Util.missingProperty("url", "url", reader),
type ?: throw Util.missingProperty("type", "type", reader),
length,
mask0,
/* DefaultConstructorMarker */ null
)
}
}
override fun toJson(writer: JsonWriter, value_: Enclosure?) {
if (value_ == null) {
throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
}
writer.beginObject()
writer.name("url")
stringAdapter.toJson(writer, value_.url)
writer.name("type")
stringAdapter.toJson(writer, value_.type)
writer.name("length")
nullableLongAdapter.toJson(writer, value_.length)
writer.endObject()
}
}

View File

@@ -0,0 +1,207 @@
// Code generated by moshi-kotlin-codegen. Do not edit.
@file:Suppress("DEPRECATION", "unused", "UNUSED_PARAMETER", "ClassName", "REDUNDANT_PROJECTION",
"RedundantExplicitType", "LocalVariableName", "RedundantVisibilityModifier",
"PLATFORM_CLASS_MAPPED_TO_KOTLIN", "IMPLICIT_NOTHING_TYPE_ARGUMENT_IN_RETURN_POSITION")
package com.rssuper.models
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
import com.squareup.moshi.Moshi
import com.squareup.moshi.Types
import com.squareup.moshi.`internal`.Util
import java.lang.NullPointerException
import java.lang.reflect.Constructor
import java.util.Date
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.collections.emptySet
import kotlin.jvm.Volatile
import kotlin.text.buildString
public class FeedItemJsonAdapter(
moshi: Moshi,
) : JsonAdapter<FeedItem>() {
private val options: JsonReader.Options = JsonReader.Options.of("id", "title", "link",
"description", "content", "author", "published", "updated", "categories", "enclosure", "guid",
"subscriptionTitle")
private val stringAdapter: JsonAdapter<String> = moshi.adapter(String::class.java, emptySet(),
"id")
private val nullableStringAdapter: JsonAdapter<String?> = moshi.adapter(String::class.java,
emptySet(), "link")
private val nullableDateAdapter: JsonAdapter<Date?> = moshi.adapter(Date::class.java, emptySet(),
"published")
private val nullableListOfStringAdapter: JsonAdapter<List<String>?> =
moshi.adapter(Types.newParameterizedType(List::class.java, String::class.java), emptySet(),
"categories")
private val nullableEnclosureAdapter: JsonAdapter<Enclosure?> =
moshi.adapter(Enclosure::class.java, emptySet(), "enclosure")
@Volatile
private var constructorRef: Constructor<FeedItem>? = null
override fun toString(): String = buildString(30) {
append("GeneratedJsonAdapter(").append("FeedItem").append(')') }
override fun fromJson(reader: JsonReader): FeedItem {
var id: String? = null
var title: String? = null
var link: String? = null
var description: String? = null
var content: String? = null
var author: String? = null
var published: Date? = null
var updated: Date? = null
var categories: List<String>? = null
var enclosure: Enclosure? = null
var guid: String? = null
var subscriptionTitle: String? = null
var mask0 = -1
reader.beginObject()
while (reader.hasNext()) {
when (reader.selectName(options)) {
0 -> id = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("id", "id", reader)
1 -> title = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("title", "title",
reader)
2 -> {
link = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 2).inv()
mask0 = mask0 and 0xfffffffb.toInt()
}
3 -> {
description = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 3).inv()
mask0 = mask0 and 0xfffffff7.toInt()
}
4 -> {
content = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 4).inv()
mask0 = mask0 and 0xffffffef.toInt()
}
5 -> {
author = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 5).inv()
mask0 = mask0 and 0xffffffdf.toInt()
}
6 -> {
published = nullableDateAdapter.fromJson(reader)
// $mask = $mask and (1 shl 6).inv()
mask0 = mask0 and 0xffffffbf.toInt()
}
7 -> {
updated = nullableDateAdapter.fromJson(reader)
// $mask = $mask and (1 shl 7).inv()
mask0 = mask0 and 0xffffff7f.toInt()
}
8 -> {
categories = nullableListOfStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 8).inv()
mask0 = mask0 and 0xfffffeff.toInt()
}
9 -> {
enclosure = nullableEnclosureAdapter.fromJson(reader)
// $mask = $mask and (1 shl 9).inv()
mask0 = mask0 and 0xfffffdff.toInt()
}
10 -> {
guid = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 10).inv()
mask0 = mask0 and 0xfffffbff.toInt()
}
11 -> {
subscriptionTitle = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 11).inv()
mask0 = mask0 and 0xfffff7ff.toInt()
}
-1 -> {
// Unknown name, skip it.
reader.skipName()
reader.skipValue()
}
}
}
reader.endObject()
if (mask0 == 0xfffff003.toInt()) {
// All parameters with defaults are set, invoke the constructor directly
return FeedItem(
id = id ?: throw Util.missingProperty("id", "id", reader),
title = title ?: throw Util.missingProperty("title", "title", reader),
link = link,
description = description,
content = content,
author = author,
published = published,
updated = updated,
categories = categories,
enclosure = enclosure,
guid = guid,
subscriptionTitle = subscriptionTitle
)
} else {
// Reflectively invoke the synthetic defaults constructor
@Suppress("UNCHECKED_CAST")
val localConstructor: Constructor<FeedItem> = this.constructorRef ?:
FeedItem::class.java.getDeclaredConstructor(String::class.java, String::class.java,
String::class.java, String::class.java, String::class.java, String::class.java,
Date::class.java, Date::class.java, List::class.java, Enclosure::class.java,
String::class.java, String::class.java, Int::class.javaPrimitiveType,
Util.DEFAULT_CONSTRUCTOR_MARKER).also { this.constructorRef = it }
return localConstructor.newInstance(
id ?: throw Util.missingProperty("id", "id", reader),
title ?: throw Util.missingProperty("title", "title", reader),
link,
description,
content,
author,
published,
updated,
categories,
enclosure,
guid,
subscriptionTitle,
mask0,
/* DefaultConstructorMarker */ null
)
}
}
override fun toJson(writer: JsonWriter, value_: FeedItem?) {
if (value_ == null) {
throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
}
writer.beginObject()
writer.name("id")
stringAdapter.toJson(writer, value_.id)
writer.name("title")
stringAdapter.toJson(writer, value_.title)
writer.name("link")
nullableStringAdapter.toJson(writer, value_.link)
writer.name("description")
nullableStringAdapter.toJson(writer, value_.description)
writer.name("content")
nullableStringAdapter.toJson(writer, value_.content)
writer.name("author")
nullableStringAdapter.toJson(writer, value_.author)
writer.name("published")
nullableDateAdapter.toJson(writer, value_.published)
writer.name("updated")
nullableDateAdapter.toJson(writer, value_.updated)
writer.name("categories")
nullableListOfStringAdapter.toJson(writer, value_.categories)
writer.name("enclosure")
nullableEnclosureAdapter.toJson(writer, value_.enclosure)
writer.name("guid")
nullableStringAdapter.toJson(writer, value_.guid)
writer.name("subscriptionTitle")
nullableStringAdapter.toJson(writer, value_.subscriptionTitle)
writer.endObject()
}
}

View File

@@ -0,0 +1,226 @@
// Code generated by moshi-kotlin-codegen. Do not edit.
@file:Suppress("DEPRECATION", "unused", "UNUSED_PARAMETER", "ClassName", "REDUNDANT_PROJECTION",
"RedundantExplicitType", "LocalVariableName", "RedundantVisibilityModifier",
"PLATFORM_CLASS_MAPPED_TO_KOTLIN", "IMPLICIT_NOTHING_TYPE_ARGUMENT_IN_RETURN_POSITION")
package com.rssuper.models
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
import com.squareup.moshi.Moshi
import com.squareup.moshi.Types
import com.squareup.moshi.`internal`.Util
import java.lang.NullPointerException
import java.lang.reflect.Constructor
import java.util.Date
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.collections.emptySet
import kotlin.jvm.Volatile
import kotlin.text.buildString
public class FeedJsonAdapter(
moshi: Moshi,
) : JsonAdapter<Feed>() {
private val options: JsonReader.Options = JsonReader.Options.of("id", "title", "link",
"description", "subtitle", "language", "lastBuildDate", "updated", "generator", "ttl",
"items", "rawUrl", "lastFetchedAt", "nextFetchAt")
private val stringAdapter: JsonAdapter<String> = moshi.adapter(String::class.java, emptySet(),
"id")
private val nullableStringAdapter: JsonAdapter<String?> = moshi.adapter(String::class.java,
emptySet(), "link")
private val nullableDateAdapter: JsonAdapter<Date?> = moshi.adapter(Date::class.java, emptySet(),
"lastBuildDate")
private val nullableIntAdapter: JsonAdapter<Int?> = moshi.adapter(Int::class.javaObjectType,
emptySet(), "ttl")
private val listOfFeedItemAdapter: JsonAdapter<List<FeedItem>> =
moshi.adapter(Types.newParameterizedType(List::class.java, FeedItem::class.java), emptySet(),
"items")
@Volatile
private var constructorRef: Constructor<Feed>? = null
override fun toString(): String = buildString(26) {
append("GeneratedJsonAdapter(").append("Feed").append(')') }
override fun fromJson(reader: JsonReader): Feed {
var id: String? = null
var title: String? = null
var link: String? = null
var description: String? = null
var subtitle: String? = null
var language: String? = null
var lastBuildDate: Date? = null
var updated: Date? = null
var generator: String? = null
var ttl: Int? = null
var items: List<FeedItem>? = null
var rawUrl: String? = null
var lastFetchedAt: Date? = null
var nextFetchAt: Date? = null
var mask0 = -1
reader.beginObject()
while (reader.hasNext()) {
when (reader.selectName(options)) {
0 -> id = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("id", "id", reader)
1 -> title = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("title", "title",
reader)
2 -> {
link = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 2).inv()
mask0 = mask0 and 0xfffffffb.toInt()
}
3 -> {
description = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 3).inv()
mask0 = mask0 and 0xfffffff7.toInt()
}
4 -> {
subtitle = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 4).inv()
mask0 = mask0 and 0xffffffef.toInt()
}
5 -> {
language = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 5).inv()
mask0 = mask0 and 0xffffffdf.toInt()
}
6 -> {
lastBuildDate = nullableDateAdapter.fromJson(reader)
// $mask = $mask and (1 shl 6).inv()
mask0 = mask0 and 0xffffffbf.toInt()
}
7 -> {
updated = nullableDateAdapter.fromJson(reader)
// $mask = $mask and (1 shl 7).inv()
mask0 = mask0 and 0xffffff7f.toInt()
}
8 -> {
generator = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 8).inv()
mask0 = mask0 and 0xfffffeff.toInt()
}
9 -> {
ttl = nullableIntAdapter.fromJson(reader)
// $mask = $mask and (1 shl 9).inv()
mask0 = mask0 and 0xfffffdff.toInt()
}
10 -> {
items = listOfFeedItemAdapter.fromJson(reader) ?: throw Util.unexpectedNull("items",
"items", reader)
// $mask = $mask and (1 shl 10).inv()
mask0 = mask0 and 0xfffffbff.toInt()
}
11 -> rawUrl = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("rawUrl",
"rawUrl", reader)
12 -> {
lastFetchedAt = nullableDateAdapter.fromJson(reader)
// $mask = $mask and (1 shl 12).inv()
mask0 = mask0 and 0xffffefff.toInt()
}
13 -> {
nextFetchAt = nullableDateAdapter.fromJson(reader)
// $mask = $mask and (1 shl 13).inv()
mask0 = mask0 and 0xffffdfff.toInt()
}
-1 -> {
// Unknown name, skip it.
reader.skipName()
reader.skipValue()
}
}
}
reader.endObject()
if (mask0 == 0xffffc803.toInt()) {
// All parameters with defaults are set, invoke the constructor directly
return Feed(
id = id ?: throw Util.missingProperty("id", "id", reader),
title = title ?: throw Util.missingProperty("title", "title", reader),
link = link,
description = description,
subtitle = subtitle,
language = language,
lastBuildDate = lastBuildDate,
updated = updated,
generator = generator,
ttl = ttl,
items = items as List<FeedItem>,
rawUrl = rawUrl ?: throw Util.missingProperty("rawUrl", "rawUrl", reader),
lastFetchedAt = lastFetchedAt,
nextFetchAt = nextFetchAt
)
} else {
// Reflectively invoke the synthetic defaults constructor
@Suppress("UNCHECKED_CAST")
val localConstructor: Constructor<Feed> = this.constructorRef ?:
Feed::class.java.getDeclaredConstructor(String::class.java, String::class.java,
String::class.java, String::class.java, String::class.java, String::class.java,
Date::class.java, Date::class.java, String::class.java, Int::class.javaObjectType,
List::class.java, String::class.java, Date::class.java, Date::class.java,
Int::class.javaPrimitiveType, Util.DEFAULT_CONSTRUCTOR_MARKER).also {
this.constructorRef = it }
return localConstructor.newInstance(
id ?: throw Util.missingProperty("id", "id", reader),
title ?: throw Util.missingProperty("title", "title", reader),
link,
description,
subtitle,
language,
lastBuildDate,
updated,
generator,
ttl,
items,
rawUrl ?: throw Util.missingProperty("rawUrl", "rawUrl", reader),
lastFetchedAt,
nextFetchAt,
mask0,
/* DefaultConstructorMarker */ null
)
}
}
override fun toJson(writer: JsonWriter, value_: Feed?) {
if (value_ == null) {
throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
}
writer.beginObject()
writer.name("id")
stringAdapter.toJson(writer, value_.id)
writer.name("title")
stringAdapter.toJson(writer, value_.title)
writer.name("link")
nullableStringAdapter.toJson(writer, value_.link)
writer.name("description")
nullableStringAdapter.toJson(writer, value_.description)
writer.name("subtitle")
nullableStringAdapter.toJson(writer, value_.subtitle)
writer.name("language")
nullableStringAdapter.toJson(writer, value_.language)
writer.name("lastBuildDate")
nullableDateAdapter.toJson(writer, value_.lastBuildDate)
writer.name("updated")
nullableDateAdapter.toJson(writer, value_.updated)
writer.name("generator")
nullableStringAdapter.toJson(writer, value_.generator)
writer.name("ttl")
nullableIntAdapter.toJson(writer, value_.ttl)
writer.name("items")
listOfFeedItemAdapter.toJson(writer, value_.items)
writer.name("rawUrl")
stringAdapter.toJson(writer, value_.rawUrl)
writer.name("lastFetchedAt")
nullableDateAdapter.toJson(writer, value_.lastFetchedAt)
writer.name("nextFetchAt")
nullableDateAdapter.toJson(writer, value_.nextFetchAt)
writer.endObject()
}
}

View File

@@ -0,0 +1,202 @@
// Code generated by moshi-kotlin-codegen. Do not edit.
@file:Suppress("DEPRECATION", "unused", "UNUSED_PARAMETER", "ClassName", "REDUNDANT_PROJECTION",
"RedundantExplicitType", "LocalVariableName", "RedundantVisibilityModifier",
"PLATFORM_CLASS_MAPPED_TO_KOTLIN", "IMPLICIT_NOTHING_TYPE_ARGUMENT_IN_RETURN_POSITION")
package com.rssuper.models
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
import com.squareup.moshi.Moshi
import com.squareup.moshi.`internal`.Util
import java.lang.NullPointerException
import java.lang.reflect.Constructor
import java.util.Date
import kotlin.Boolean
import kotlin.Int
import kotlin.Long
import kotlin.String
import kotlin.Suppress
import kotlin.collections.emptySet
import kotlin.jvm.Volatile
import kotlin.text.buildString
public class FeedSubscriptionJsonAdapter(
moshi: Moshi,
) : JsonAdapter<FeedSubscription>() {
private val options: JsonReader.Options = JsonReader.Options.of("id", "url", "title", "category",
"enabled", "fetchInterval", "createdAt", "updatedAt", "lastFetchedAt", "nextFetchAt", "error",
"httpAuth")
private val stringAdapter: JsonAdapter<String> = moshi.adapter(String::class.java, emptySet(),
"id")
private val nullableStringAdapter: JsonAdapter<String?> = moshi.adapter(String::class.java,
emptySet(), "category")
private val booleanAdapter: JsonAdapter<Boolean> = moshi.adapter(Boolean::class.java, emptySet(),
"enabled")
private val longAdapter: JsonAdapter<Long> = moshi.adapter(Long::class.java, emptySet(),
"fetchInterval")
private val dateAdapter: JsonAdapter<Date> = moshi.adapter(Date::class.java, emptySet(),
"createdAt")
private val nullableDateAdapter: JsonAdapter<Date?> = moshi.adapter(Date::class.java, emptySet(),
"lastFetchedAt")
private val nullableHttpAuthAdapter: JsonAdapter<HttpAuth?> = moshi.adapter(HttpAuth::class.java,
emptySet(), "httpAuth")
@Volatile
private var constructorRef: Constructor<FeedSubscription>? = null
override fun toString(): String = buildString(38) {
append("GeneratedJsonAdapter(").append("FeedSubscription").append(')') }
override fun fromJson(reader: JsonReader): FeedSubscription {
var id: String? = null
var url: String? = null
var title: String? = null
var category: String? = null
var enabled: Boolean? = false
var fetchInterval: Long? = null
var createdAt: Date? = null
var updatedAt: Date? = null
var lastFetchedAt: Date? = null
var nextFetchAt: Date? = null
var error: String? = null
var httpAuth: HttpAuth? = null
var mask0 = -1
reader.beginObject()
while (reader.hasNext()) {
when (reader.selectName(options)) {
0 -> id = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("id", "id", reader)
1 -> url = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("url", "url", reader)
2 -> title = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("title", "title",
reader)
3 -> {
category = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 3).inv()
mask0 = mask0 and 0xfffffff7.toInt()
}
4 -> {
enabled = booleanAdapter.fromJson(reader) ?: throw Util.unexpectedNull("enabled",
"enabled", reader)
// $mask = $mask and (1 shl 4).inv()
mask0 = mask0 and 0xffffffef.toInt()
}
5 -> fetchInterval = longAdapter.fromJson(reader) ?:
throw Util.unexpectedNull("fetchInterval", "fetchInterval", reader)
6 -> createdAt = dateAdapter.fromJson(reader) ?: throw Util.unexpectedNull("createdAt",
"createdAt", reader)
7 -> updatedAt = dateAdapter.fromJson(reader) ?: throw Util.unexpectedNull("updatedAt",
"updatedAt", reader)
8 -> {
lastFetchedAt = nullableDateAdapter.fromJson(reader)
// $mask = $mask and (1 shl 8).inv()
mask0 = mask0 and 0xfffffeff.toInt()
}
9 -> {
nextFetchAt = nullableDateAdapter.fromJson(reader)
// $mask = $mask and (1 shl 9).inv()
mask0 = mask0 and 0xfffffdff.toInt()
}
10 -> {
error = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 10).inv()
mask0 = mask0 and 0xfffffbff.toInt()
}
11 -> {
httpAuth = nullableHttpAuthAdapter.fromJson(reader)
// $mask = $mask and (1 shl 11).inv()
mask0 = mask0 and 0xfffff7ff.toInt()
}
-1 -> {
// Unknown name, skip it.
reader.skipName()
reader.skipValue()
}
}
}
reader.endObject()
if (mask0 == 0xfffff0e7.toInt()) {
// All parameters with defaults are set, invoke the constructor directly
return FeedSubscription(
id = id ?: throw Util.missingProperty("id", "id", reader),
url = url ?: throw Util.missingProperty("url", "url", reader),
title = title ?: throw Util.missingProperty("title", "title", reader),
category = category,
enabled = enabled as Boolean,
fetchInterval = fetchInterval ?: throw Util.missingProperty("fetchInterval",
"fetchInterval", reader),
createdAt = createdAt ?: throw Util.missingProperty("createdAt", "createdAt", reader),
updatedAt = updatedAt ?: throw Util.missingProperty("updatedAt", "updatedAt", reader),
lastFetchedAt = lastFetchedAt,
nextFetchAt = nextFetchAt,
error = error,
httpAuth = httpAuth
)
} else {
// Reflectively invoke the synthetic defaults constructor
@Suppress("UNCHECKED_CAST")
val localConstructor: Constructor<FeedSubscription> = this.constructorRef ?:
FeedSubscription::class.java.getDeclaredConstructor(String::class.java,
String::class.java, String::class.java, String::class.java,
Boolean::class.javaPrimitiveType, Long::class.javaPrimitiveType, Date::class.java,
Date::class.java, Date::class.java, Date::class.java, String::class.java,
HttpAuth::class.java, Int::class.javaPrimitiveType,
Util.DEFAULT_CONSTRUCTOR_MARKER).also { this.constructorRef = it }
return localConstructor.newInstance(
id ?: throw Util.missingProperty("id", "id", reader),
url ?: throw Util.missingProperty("url", "url", reader),
title ?: throw Util.missingProperty("title", "title", reader),
category,
enabled,
fetchInterval ?: throw Util.missingProperty("fetchInterval", "fetchInterval", reader),
createdAt ?: throw Util.missingProperty("createdAt", "createdAt", reader),
updatedAt ?: throw Util.missingProperty("updatedAt", "updatedAt", reader),
lastFetchedAt,
nextFetchAt,
error,
httpAuth,
mask0,
/* DefaultConstructorMarker */ null
)
}
}
override fun toJson(writer: JsonWriter, value_: FeedSubscription?) {
if (value_ == null) {
throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
}
writer.beginObject()
writer.name("id")
stringAdapter.toJson(writer, value_.id)
writer.name("url")
stringAdapter.toJson(writer, value_.url)
writer.name("title")
stringAdapter.toJson(writer, value_.title)
writer.name("category")
nullableStringAdapter.toJson(writer, value_.category)
writer.name("enabled")
booleanAdapter.toJson(writer, value_.enabled)
writer.name("fetchInterval")
longAdapter.toJson(writer, value_.fetchInterval)
writer.name("createdAt")
dateAdapter.toJson(writer, value_.createdAt)
writer.name("updatedAt")
dateAdapter.toJson(writer, value_.updatedAt)
writer.name("lastFetchedAt")
nullableDateAdapter.toJson(writer, value_.lastFetchedAt)
writer.name("nextFetchAt")
nullableDateAdapter.toJson(writer, value_.nextFetchAt)
writer.name("error")
nullableStringAdapter.toJson(writer, value_.error)
writer.name("httpAuth")
nullableHttpAuthAdapter.toJson(writer, value_.httpAuth)
writer.endObject()
}
}

View File

@@ -0,0 +1,65 @@
// Code generated by moshi-kotlin-codegen. Do not edit.
@file:Suppress("DEPRECATION", "unused", "UNUSED_PARAMETER", "ClassName", "REDUNDANT_PROJECTION",
"RedundantExplicitType", "LocalVariableName", "RedundantVisibilityModifier",
"PLATFORM_CLASS_MAPPED_TO_KOTLIN", "IMPLICIT_NOTHING_TYPE_ARGUMENT_IN_RETURN_POSITION")
package com.rssuper.models
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
import com.squareup.moshi.Moshi
import com.squareup.moshi.`internal`.Util
import java.lang.NullPointerException
import kotlin.String
import kotlin.Suppress
import kotlin.collections.emptySet
import kotlin.text.buildString
public class HttpAuthJsonAdapter(
moshi: Moshi,
) : JsonAdapter<HttpAuth>() {
private val options: JsonReader.Options = JsonReader.Options.of("username", "password")
private val stringAdapter: JsonAdapter<String> = moshi.adapter(String::class.java, emptySet(),
"username")
override fun toString(): String = buildString(30) {
append("GeneratedJsonAdapter(").append("HttpAuth").append(')') }
override fun fromJson(reader: JsonReader): HttpAuth {
var username: String? = null
var password: String? = null
reader.beginObject()
while (reader.hasNext()) {
when (reader.selectName(options)) {
0 -> username = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("username",
"username", reader)
1 -> password = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("password",
"password", reader)
-1 -> {
// Unknown name, skip it.
reader.skipName()
reader.skipValue()
}
}
}
reader.endObject()
return HttpAuth(
username = username ?: throw Util.missingProperty("username", "username", reader),
password = password ?: throw Util.missingProperty("password", "password", reader)
)
}
override fun toJson(writer: JsonWriter, value_: HttpAuth?) {
if (value_ == null) {
throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
}
writer.beginObject()
writer.name("username")
stringAdapter.toJson(writer, value_.username)
writer.name("password")
stringAdapter.toJson(writer, value_.password)
writer.endObject()
}
}

View File

@@ -0,0 +1,158 @@
// Code generated by moshi-kotlin-codegen. Do not edit.
@file:Suppress("DEPRECATION", "unused", "UNUSED_PARAMETER", "ClassName", "REDUNDANT_PROJECTION",
"RedundantExplicitType", "LocalVariableName", "RedundantVisibilityModifier",
"PLATFORM_CLASS_MAPPED_TO_KOTLIN", "IMPLICIT_NOTHING_TYPE_ARGUMENT_IN_RETURN_POSITION")
package com.rssuper.models
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
import com.squareup.moshi.Moshi
import com.squareup.moshi.`internal`.Util
import java.lang.NullPointerException
import java.lang.reflect.Constructor
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.collections.emptySet
import kotlin.jvm.Volatile
import kotlin.text.buildString
public class NotificationPreferencesJsonAdapter(
moshi: Moshi,
) : JsonAdapter<NotificationPreferences>() {
private val options: JsonReader.Options = JsonReader.Options.of("id", "newArticles",
"episodeReleases", "customAlerts", "badgeCount", "sound", "vibration")
private val stringAdapter: JsonAdapter<String> = moshi.adapter(String::class.java, emptySet(),
"id")
private val booleanAdapter: JsonAdapter<Boolean> = moshi.adapter(Boolean::class.java, emptySet(),
"newArticles")
@Volatile
private var constructorRef: Constructor<NotificationPreferences>? = null
override fun toString(): String = buildString(45) {
append("GeneratedJsonAdapter(").append("NotificationPreferences").append(')') }
override fun fromJson(reader: JsonReader): NotificationPreferences {
var id: String? = null
var newArticles: Boolean? = false
var episodeReleases: Boolean? = false
var customAlerts: Boolean? = false
var badgeCount: Boolean? = false
var sound: Boolean? = false
var vibration: Boolean? = false
var mask0 = -1
reader.beginObject()
while (reader.hasNext()) {
when (reader.selectName(options)) {
0 -> {
id = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("id", "id", reader)
// $mask = $mask and (1 shl 0).inv()
mask0 = mask0 and 0xfffffffe.toInt()
}
1 -> {
newArticles = booleanAdapter.fromJson(reader) ?: throw Util.unexpectedNull("newArticles",
"newArticles", reader)
// $mask = $mask and (1 shl 1).inv()
mask0 = mask0 and 0xfffffffd.toInt()
}
2 -> {
episodeReleases = booleanAdapter.fromJson(reader) ?:
throw Util.unexpectedNull("episodeReleases", "episodeReleases", reader)
// $mask = $mask and (1 shl 2).inv()
mask0 = mask0 and 0xfffffffb.toInt()
}
3 -> {
customAlerts = booleanAdapter.fromJson(reader) ?:
throw Util.unexpectedNull("customAlerts", "customAlerts", reader)
// $mask = $mask and (1 shl 3).inv()
mask0 = mask0 and 0xfffffff7.toInt()
}
4 -> {
badgeCount = booleanAdapter.fromJson(reader) ?: throw Util.unexpectedNull("badgeCount",
"badgeCount", reader)
// $mask = $mask and (1 shl 4).inv()
mask0 = mask0 and 0xffffffef.toInt()
}
5 -> {
sound = booleanAdapter.fromJson(reader) ?: throw Util.unexpectedNull("sound", "sound",
reader)
// $mask = $mask and (1 shl 5).inv()
mask0 = mask0 and 0xffffffdf.toInt()
}
6 -> {
vibration = booleanAdapter.fromJson(reader) ?: throw Util.unexpectedNull("vibration",
"vibration", reader)
// $mask = $mask and (1 shl 6).inv()
mask0 = mask0 and 0xffffffbf.toInt()
}
-1 -> {
// Unknown name, skip it.
reader.skipName()
reader.skipValue()
}
}
}
reader.endObject()
if (mask0 == 0xffffff80.toInt()) {
// All parameters with defaults are set, invoke the constructor directly
return NotificationPreferences(
id = id as String,
newArticles = newArticles as Boolean,
episodeReleases = episodeReleases as Boolean,
customAlerts = customAlerts as Boolean,
badgeCount = badgeCount as Boolean,
sound = sound as Boolean,
vibration = vibration as Boolean
)
} else {
// Reflectively invoke the synthetic defaults constructor
@Suppress("UNCHECKED_CAST")
val localConstructor: Constructor<NotificationPreferences> = this.constructorRef ?:
NotificationPreferences::class.java.getDeclaredConstructor(String::class.java,
Boolean::class.javaPrimitiveType, Boolean::class.javaPrimitiveType,
Boolean::class.javaPrimitiveType, Boolean::class.javaPrimitiveType,
Boolean::class.javaPrimitiveType, Boolean::class.javaPrimitiveType,
Int::class.javaPrimitiveType, Util.DEFAULT_CONSTRUCTOR_MARKER).also {
this.constructorRef = it }
return localConstructor.newInstance(
id,
newArticles,
episodeReleases,
customAlerts,
badgeCount,
sound,
vibration,
mask0,
/* DefaultConstructorMarker */ null
)
}
}
override fun toJson(writer: JsonWriter, value_: NotificationPreferences?) {
if (value_ == null) {
throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
}
writer.beginObject()
writer.name("id")
stringAdapter.toJson(writer, value_.id)
writer.name("newArticles")
booleanAdapter.toJson(writer, value_.newArticles)
writer.name("episodeReleases")
booleanAdapter.toJson(writer, value_.episodeReleases)
writer.name("customAlerts")
booleanAdapter.toJson(writer, value_.customAlerts)
writer.name("badgeCount")
booleanAdapter.toJson(writer, value_.badgeCount)
writer.name("sound")
booleanAdapter.toJson(writer, value_.sound)
writer.name("vibration")
booleanAdapter.toJson(writer, value_.vibration)
writer.endObject()
}
}

View File

@@ -0,0 +1,164 @@
// Code generated by moshi-kotlin-codegen. Do not edit.
@file:Suppress("DEPRECATION", "unused", "UNUSED_PARAMETER", "ClassName", "REDUNDANT_PROJECTION",
"RedundantExplicitType", "LocalVariableName", "RedundantVisibilityModifier",
"PLATFORM_CLASS_MAPPED_TO_KOTLIN", "IMPLICIT_NOTHING_TYPE_ARGUMENT_IN_RETURN_POSITION")
package com.rssuper.models
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
import com.squareup.moshi.Moshi
import com.squareup.moshi.`internal`.Util
import java.lang.NullPointerException
import java.lang.reflect.Constructor
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.collections.emptySet
import kotlin.jvm.Volatile
import kotlin.text.buildString
import kotlinx.parcelize.RawValue
public class ReadingPreferencesJsonAdapter(
moshi: Moshi,
) : JsonAdapter<ReadingPreferences>() {
private val options: JsonReader.Options = JsonReader.Options.of("id", "fontSize", "lineHeight",
"showTableOfContents", "showReadingTime", "showAuthor", "showDate")
private val stringAdapter: JsonAdapter<String> = moshi.adapter(String::class.java, emptySet(),
"id")
private val fontSizeAdapter: JsonAdapter<@RawValue FontSize> = moshi.adapter(FontSize::class.java,
emptySet(), "fontSize")
private val lineHeightAdapter: JsonAdapter<@RawValue LineHeight> =
moshi.adapter(LineHeight::class.java, emptySet(), "lineHeight")
private val booleanAdapter: JsonAdapter<Boolean> = moshi.adapter(Boolean::class.java, emptySet(),
"showTableOfContents")
@Volatile
private var constructorRef: Constructor<ReadingPreferences>? = null
override fun toString(): String = buildString(40) {
append("GeneratedJsonAdapter(").append("ReadingPreferences").append(')') }
override fun fromJson(reader: JsonReader): ReadingPreferences {
var id: String? = null
var fontSize: @RawValue FontSize? = null
var lineHeight: @RawValue LineHeight? = null
var showTableOfContents: Boolean? = false
var showReadingTime: Boolean? = false
var showAuthor: Boolean? = false
var showDate: Boolean? = false
var mask0 = -1
reader.beginObject()
while (reader.hasNext()) {
when (reader.selectName(options)) {
0 -> {
id = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("id", "id", reader)
// $mask = $mask and (1 shl 0).inv()
mask0 = mask0 and 0xfffffffe.toInt()
}
1 -> {
fontSize = fontSizeAdapter.fromJson(reader) ?: throw Util.unexpectedNull("fontSize",
"fontSize", reader)
// $mask = $mask and (1 shl 1).inv()
mask0 = mask0 and 0xfffffffd.toInt()
}
2 -> {
lineHeight = lineHeightAdapter.fromJson(reader) ?: throw Util.unexpectedNull("lineHeight",
"lineHeight", reader)
// $mask = $mask and (1 shl 2).inv()
mask0 = mask0 and 0xfffffffb.toInt()
}
3 -> {
showTableOfContents = booleanAdapter.fromJson(reader) ?:
throw Util.unexpectedNull("showTableOfContents", "showTableOfContents", reader)
// $mask = $mask and (1 shl 3).inv()
mask0 = mask0 and 0xfffffff7.toInt()
}
4 -> {
showReadingTime = booleanAdapter.fromJson(reader) ?:
throw Util.unexpectedNull("showReadingTime", "showReadingTime", reader)
// $mask = $mask and (1 shl 4).inv()
mask0 = mask0 and 0xffffffef.toInt()
}
5 -> {
showAuthor = booleanAdapter.fromJson(reader) ?: throw Util.unexpectedNull("showAuthor",
"showAuthor", reader)
// $mask = $mask and (1 shl 5).inv()
mask0 = mask0 and 0xffffffdf.toInt()
}
6 -> {
showDate = booleanAdapter.fromJson(reader) ?: throw Util.unexpectedNull("showDate",
"showDate", reader)
// $mask = $mask and (1 shl 6).inv()
mask0 = mask0 and 0xffffffbf.toInt()
}
-1 -> {
// Unknown name, skip it.
reader.skipName()
reader.skipValue()
}
}
}
reader.endObject()
if (mask0 == 0xffffff80.toInt()) {
// All parameters with defaults are set, invoke the constructor directly
return ReadingPreferences(
id = id as String,
fontSize = fontSize as @RawValue FontSize,
lineHeight = lineHeight as @RawValue LineHeight,
showTableOfContents = showTableOfContents as Boolean,
showReadingTime = showReadingTime as Boolean,
showAuthor = showAuthor as Boolean,
showDate = showDate as Boolean
)
} else {
// Reflectively invoke the synthetic defaults constructor
@Suppress("UNCHECKED_CAST")
val localConstructor: Constructor<ReadingPreferences> = this.constructorRef ?:
ReadingPreferences::class.java.getDeclaredConstructor(String::class.java,
FontSize::class.java, LineHeight::class.java, Boolean::class.javaPrimitiveType,
Boolean::class.javaPrimitiveType, Boolean::class.javaPrimitiveType,
Boolean::class.javaPrimitiveType, Int::class.javaPrimitiveType,
Util.DEFAULT_CONSTRUCTOR_MARKER).also { this.constructorRef = it }
return localConstructor.newInstance(
id,
fontSize,
lineHeight,
showTableOfContents,
showReadingTime,
showAuthor,
showDate,
mask0,
/* DefaultConstructorMarker */ null
)
}
}
override fun toJson(writer: JsonWriter, value_: ReadingPreferences?) {
if (value_ == null) {
throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
}
writer.beginObject()
writer.name("id")
stringAdapter.toJson(writer, value_.id)
writer.name("fontSize")
fontSizeAdapter.toJson(writer, value_.fontSize)
writer.name("lineHeight")
lineHeightAdapter.toJson(writer, value_.lineHeight)
writer.name("showTableOfContents")
booleanAdapter.toJson(writer, value_.showTableOfContents)
writer.name("showReadingTime")
booleanAdapter.toJson(writer, value_.showReadingTime)
writer.name("showAuthor")
booleanAdapter.toJson(writer, value_.showAuthor)
writer.name("showDate")
booleanAdapter.toJson(writer, value_.showDate)
writer.endObject()
}
}

View File

@@ -0,0 +1,164 @@
// Code generated by moshi-kotlin-codegen. Do not edit.
@file:Suppress("DEPRECATION", "unused", "UNUSED_PARAMETER", "ClassName", "REDUNDANT_PROJECTION",
"RedundantExplicitType", "LocalVariableName", "RedundantVisibilityModifier",
"PLATFORM_CLASS_MAPPED_TO_KOTLIN", "IMPLICIT_NOTHING_TYPE_ARGUMENT_IN_RETURN_POSITION")
package com.rssuper.models
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
import com.squareup.moshi.Moshi
import com.squareup.moshi.Types
import com.squareup.moshi.`internal`.Util
import java.lang.NullPointerException
import java.lang.reflect.Constructor
import java.util.Date
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.collections.emptySet
import kotlin.jvm.Volatile
import kotlin.text.buildString
import kotlinx.parcelize.RawValue
public class SearchFiltersJsonAdapter(
moshi: Moshi,
) : JsonAdapter<SearchFilters>() {
private val options: JsonReader.Options = JsonReader.Options.of("id", "dateFrom", "dateTo",
"feedIds", "authors", "contentType", "sortOption")
private val stringAdapter: JsonAdapter<String> = moshi.adapter(String::class.java, emptySet(),
"id")
private val nullableDateAdapter: JsonAdapter<Date?> = moshi.adapter(Date::class.java, emptySet(),
"dateFrom")
private val nullableListOfStringAdapter: JsonAdapter<List<String>?> =
moshi.adapter(Types.newParameterizedType(List::class.java, String::class.java), emptySet(),
"feedIds")
private val nullableContentTypeAdapter: JsonAdapter<@RawValue ContentType?> =
moshi.adapter(ContentType::class.java, emptySet(), "contentType")
private val searchSortOptionAdapter: JsonAdapter<@RawValue SearchSortOption> =
moshi.adapter(SearchSortOption::class.java, emptySet(), "sortOption")
@Volatile
private var constructorRef: Constructor<SearchFilters>? = null
override fun toString(): String = buildString(35) {
append("GeneratedJsonAdapter(").append("SearchFilters").append(')') }
override fun fromJson(reader: JsonReader): SearchFilters {
var id: String? = null
var dateFrom: Date? = null
var dateTo: Date? = null
var feedIds: List<String>? = null
var authors: List<String>? = null
var contentType: @RawValue ContentType? = null
var sortOption: @RawValue SearchSortOption? = null
var mask0 = -1
reader.beginObject()
while (reader.hasNext()) {
when (reader.selectName(options)) {
0 -> {
id = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("id", "id", reader)
// $mask = $mask and (1 shl 0).inv()
mask0 = mask0 and 0xfffffffe.toInt()
}
1 -> {
dateFrom = nullableDateAdapter.fromJson(reader)
// $mask = $mask and (1 shl 1).inv()
mask0 = mask0 and 0xfffffffd.toInt()
}
2 -> {
dateTo = nullableDateAdapter.fromJson(reader)
// $mask = $mask and (1 shl 2).inv()
mask0 = mask0 and 0xfffffffb.toInt()
}
3 -> {
feedIds = nullableListOfStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 3).inv()
mask0 = mask0 and 0xfffffff7.toInt()
}
4 -> {
authors = nullableListOfStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 4).inv()
mask0 = mask0 and 0xffffffef.toInt()
}
5 -> {
contentType = nullableContentTypeAdapter.fromJson(reader)
// $mask = $mask and (1 shl 5).inv()
mask0 = mask0 and 0xffffffdf.toInt()
}
6 -> {
sortOption = searchSortOptionAdapter.fromJson(reader) ?:
throw Util.unexpectedNull("sortOption", "sortOption", reader)
// $mask = $mask and (1 shl 6).inv()
mask0 = mask0 and 0xffffffbf.toInt()
}
-1 -> {
// Unknown name, skip it.
reader.skipName()
reader.skipValue()
}
}
}
reader.endObject()
if (mask0 == 0xffffff80.toInt()) {
// All parameters with defaults are set, invoke the constructor directly
return SearchFilters(
id = id as String,
dateFrom = dateFrom,
dateTo = dateTo,
feedIds = feedIds,
authors = authors,
contentType = contentType,
sortOption = sortOption as @RawValue SearchSortOption
)
} else {
// Reflectively invoke the synthetic defaults constructor
@Suppress("UNCHECKED_CAST")
val localConstructor: Constructor<SearchFilters> = this.constructorRef ?:
SearchFilters::class.java.getDeclaredConstructor(String::class.java, Date::class.java,
Date::class.java, List::class.java, List::class.java, ContentType::class.java,
SearchSortOption::class.java, Int::class.javaPrimitiveType,
Util.DEFAULT_CONSTRUCTOR_MARKER).also { this.constructorRef = it }
return localConstructor.newInstance(
id,
dateFrom,
dateTo,
feedIds,
authors,
contentType,
sortOption,
mask0,
/* DefaultConstructorMarker */ null
)
}
}
override fun toJson(writer: JsonWriter, value_: SearchFilters?) {
if (value_ == null) {
throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
}
writer.beginObject()
writer.name("id")
stringAdapter.toJson(writer, value_.id)
writer.name("dateFrom")
nullableDateAdapter.toJson(writer, value_.dateFrom)
writer.name("dateTo")
nullableDateAdapter.toJson(writer, value_.dateTo)
writer.name("feedIds")
nullableListOfStringAdapter.toJson(writer, value_.feedIds)
writer.name("authors")
nullableListOfStringAdapter.toJson(writer, value_.authors)
writer.name("contentType")
nullableContentTypeAdapter.toJson(writer, value_.contentType)
writer.name("sortOption")
searchSortOptionAdapter.toJson(writer, value_.sortOption)
writer.endObject()
}
}

View File

@@ -0,0 +1,161 @@
// Code generated by moshi-kotlin-codegen. Do not edit.
@file:Suppress("DEPRECATION", "unused", "UNUSED_PARAMETER", "ClassName", "REDUNDANT_PROJECTION",
"RedundantExplicitType", "LocalVariableName", "RedundantVisibilityModifier",
"PLATFORM_CLASS_MAPPED_TO_KOTLIN", "IMPLICIT_NOTHING_TYPE_ARGUMENT_IN_RETURN_POSITION")
package com.rssuper.models
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
import com.squareup.moshi.Moshi
import com.squareup.moshi.`internal`.Util
import java.lang.NullPointerException
import java.lang.reflect.Constructor
import java.util.Date
import kotlin.Double
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.collections.emptySet
import kotlin.jvm.Volatile
import kotlin.text.buildString
public class SearchResultJsonAdapter(
moshi: Moshi,
) : JsonAdapter<SearchResult>() {
private val options: JsonReader.Options = JsonReader.Options.of("id", "type", "title", "snippet",
"link", "feedTitle", "published", "score")
private val stringAdapter: JsonAdapter<String> = moshi.adapter(String::class.java, emptySet(),
"id")
private val searchResultTypeAdapter: JsonAdapter<SearchResultType> =
moshi.adapter(SearchResultType::class.java, emptySet(), "type")
private val nullableStringAdapter: JsonAdapter<String?> = moshi.adapter(String::class.java,
emptySet(), "snippet")
private val nullableDateAdapter: JsonAdapter<Date?> = moshi.adapter(Date::class.java, emptySet(),
"published")
private val nullableDoubleAdapter: JsonAdapter<Double?> =
moshi.adapter(Double::class.javaObjectType, emptySet(), "score")
@Volatile
private var constructorRef: Constructor<SearchResult>? = null
override fun toString(): String = buildString(34) {
append("GeneratedJsonAdapter(").append("SearchResult").append(')') }
override fun fromJson(reader: JsonReader): SearchResult {
var id: String? = null
var type: SearchResultType? = null
var title: String? = null
var snippet: String? = null
var link: String? = null
var feedTitle: String? = null
var published: Date? = null
var score: Double? = null
var mask0 = -1
reader.beginObject()
while (reader.hasNext()) {
when (reader.selectName(options)) {
0 -> id = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("id", "id", reader)
1 -> type = searchResultTypeAdapter.fromJson(reader) ?: throw Util.unexpectedNull("type",
"type", reader)
2 -> title = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("title", "title",
reader)
3 -> {
snippet = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 3).inv()
mask0 = mask0 and 0xfffffff7.toInt()
}
4 -> {
link = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 4).inv()
mask0 = mask0 and 0xffffffef.toInt()
}
5 -> {
feedTitle = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 5).inv()
mask0 = mask0 and 0xffffffdf.toInt()
}
6 -> {
published = nullableDateAdapter.fromJson(reader)
// $mask = $mask and (1 shl 6).inv()
mask0 = mask0 and 0xffffffbf.toInt()
}
7 -> {
score = nullableDoubleAdapter.fromJson(reader)
// $mask = $mask and (1 shl 7).inv()
mask0 = mask0 and 0xffffff7f.toInt()
}
-1 -> {
// Unknown name, skip it.
reader.skipName()
reader.skipValue()
}
}
}
reader.endObject()
if (mask0 == 0xffffff07.toInt()) {
// All parameters with defaults are set, invoke the constructor directly
return SearchResult(
id = id ?: throw Util.missingProperty("id", "id", reader),
type = type ?: throw Util.missingProperty("type", "type", reader),
title = title ?: throw Util.missingProperty("title", "title", reader),
snippet = snippet,
link = link,
feedTitle = feedTitle,
published = published,
score = score
)
} else {
// Reflectively invoke the synthetic defaults constructor
@Suppress("UNCHECKED_CAST")
val localConstructor: Constructor<SearchResult> = this.constructorRef ?:
SearchResult::class.java.getDeclaredConstructor(String::class.java,
SearchResultType::class.java, String::class.java, String::class.java, String::class.java,
String::class.java, Date::class.java, Double::class.javaObjectType,
Int::class.javaPrimitiveType, Util.DEFAULT_CONSTRUCTOR_MARKER).also {
this.constructorRef = it }
return localConstructor.newInstance(
id ?: throw Util.missingProperty("id", "id", reader),
type ?: throw Util.missingProperty("type", "type", reader),
title ?: throw Util.missingProperty("title", "title", reader),
snippet,
link,
feedTitle,
published,
score,
mask0,
/* DefaultConstructorMarker */ null
)
}
}
override fun toJson(writer: JsonWriter, value_: SearchResult?) {
if (value_ == null) {
throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
}
writer.beginObject()
writer.name("id")
stringAdapter.toJson(writer, value_.id)
writer.name("type")
searchResultTypeAdapter.toJson(writer, value_.type)
writer.name("title")
stringAdapter.toJson(writer, value_.title)
writer.name("snippet")
nullableStringAdapter.toJson(writer, value_.snippet)
writer.name("link")
nullableStringAdapter.toJson(writer, value_.link)
writer.name("feedTitle")
nullableStringAdapter.toJson(writer, value_.feedTitle)
writer.name("published")
nullableDateAdapter.toJson(writer, value_.published)
writer.name("score")
nullableDoubleAdapter.toJson(writer, value_.score)
writer.endObject()
}
}