mirror of
https://github.com/zapstore/zapstore.git
synced 2026-10-06 13:08:24 +00:00
Query for platforms in adapter, remove hardcoding
This commit is contained in:
+3
-16
@@ -182,10 +182,7 @@ mixin AppAdapter on Adapter<App> {
|
||||
final appIdentifiers =
|
||||
releases.map((r) => r.linkedReplaceableEvents.first.$3).nonNulls;
|
||||
apps = await super.findAll(
|
||||
params: {
|
||||
'#d': appIdentifiers,
|
||||
'#f': ['android-arm64-v8a'],
|
||||
},
|
||||
params: {'#d': appIdentifiers},
|
||||
);
|
||||
} else {
|
||||
// If looking up multiple apps via `#d`, use `_queriedAtMap`
|
||||
@@ -215,7 +212,6 @@ mixin AppAdapter on Adapter<App> {
|
||||
params: {
|
||||
'#d': cachedIdentifiers,
|
||||
'since': earliestQueryAt,
|
||||
'#f': ['android-arm64-v8a'],
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -223,22 +219,14 @@ mixin AppAdapter on Adapter<App> {
|
||||
// For apps not in cache, query without a since
|
||||
if (newIdentifiers.isNotEmpty) {
|
||||
newApps = await super.findAll(
|
||||
params: {
|
||||
'#d': newIdentifiers,
|
||||
'#f': ['android-arm64-v8a'],
|
||||
},
|
||||
params: {'#d': newIdentifiers},
|
||||
);
|
||||
}
|
||||
|
||||
apps = [...cachedApps, ...newApps];
|
||||
} else {
|
||||
// Search (which uses no #d)
|
||||
apps = await super.findAll(
|
||||
params: {
|
||||
...params,
|
||||
'#f': ['android-arm64-v8a'], // TODO
|
||||
},
|
||||
);
|
||||
apps = await super.findAll(params: params);
|
||||
}
|
||||
|
||||
// Done with apps, proceed to release loading
|
||||
@@ -307,7 +295,6 @@ mixin AppAdapter on Adapter<App> {
|
||||
params: {
|
||||
'ids': metadataIds,
|
||||
'#m': [kAndroidMimeType],
|
||||
'#f': ['android-arm64-v8a'],
|
||||
},
|
||||
),
|
||||
if (userIds.isNotEmpty) ref.users.findAll(params: {'authors': userIds}),
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter_data/flutter_data.dart';
|
||||
import 'package:purplebase/purplebase.dart';
|
||||
import 'package:zapstore/utils/system_info.dart';
|
||||
|
||||
// NOTE: Very important to use const in relay args to preserve equality in Riverpod families
|
||||
// const kAppRelays = ['ws://10.0.2.2:3000'];
|
||||
@@ -77,6 +80,14 @@ mixin NostrAdapter<T extends DataModelMixin<T>> on Adapter<T> {
|
||||
final additionalKinds = params?.remove('kinds');
|
||||
final limit = params?.remove('limit');
|
||||
final since = params?.remove('since');
|
||||
|
||||
if (['apps', 'fileMetadatas'].contains(internalType)) {
|
||||
if (Platform.isAndroid) {
|
||||
final info = await ref.read(systemInfoProvider.future);
|
||||
params?['#f'] = info.androidInfo.supportedAbis.map((a) => 'android-$a');
|
||||
}
|
||||
}
|
||||
|
||||
final req = RelayRequest(
|
||||
kinds: {kind, ...?additionalKinds},
|
||||
tags: params ?? {},
|
||||
|
||||
Reference in New Issue
Block a user