Skip to content

Commit

Permalink
revert key search change
Browse files Browse the repository at this point in the history
  • Loading branch information
n13 committed Apr 26, 2024
1 parent 8a8a42e commit 6f8cfa2
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 32 deletions.
10 changes: 7 additions & 3 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = "The Chromium Authors";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -237,10 +237,12 @@
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh",
"${PODS_ROOT}/GoogleMaps/Maps/Frameworks/GoogleMaps.xcframework/ios-arm64/GoogleMaps.framework/Resources/GoogleMaps.bundle",
"${PODS_ROOT}/GoogleMaps/Maps/Frameworks/GoogleMaps.xcframework/ios-arm64_x86_64-simulator/GoogleMaps.framework/Resources/GoogleMaps.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/google_maps_flutter_ios/google_maps_flutter_ios_privacy.bundle",
);
name = "[CP] Copy Pods Resources";
outputPaths = (
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleMaps.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/google_maps_flutter_ios_privacy.bundle",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down Expand Up @@ -271,7 +273,6 @@
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/BoringSSL-GRPC/openssl_grpc.framework",
"${BUILT_PRODUCTS_DIR}/FMDB/FMDB.framework",
"${BUILT_PRODUCTS_DIR}/FirebaseABTesting/FirebaseABTesting.framework",
"${BUILT_PRODUCTS_DIR}/FirebaseAppCheckInterop/FirebaseAppCheckInterop.framework",
"${BUILT_PRODUCTS_DIR}/FirebaseAuthInterop/FirebaseAuthInterop.framework",
Expand All @@ -280,9 +281,11 @@
"${BUILT_PRODUCTS_DIR}/FirebaseCoreInternal/FirebaseCoreInternal.framework",
"${BUILT_PRODUCTS_DIR}/FirebaseDynamicLinks/FirebaseDynamicLinks.framework",
"${BUILT_PRODUCTS_DIR}/FirebaseFirestore/FirebaseFirestore.framework",
"${BUILT_PRODUCTS_DIR}/FirebaseFirestoreInternal/FirebaseFirestoreInternal.framework",
"${BUILT_PRODUCTS_DIR}/FirebaseInstallations/FirebaseInstallations.framework",
"${BUILT_PRODUCTS_DIR}/FirebaseMessaging/FirebaseMessaging.framework",
"${BUILT_PRODUCTS_DIR}/FirebaseRemoteConfig/FirebaseRemoteConfig.framework",
"${BUILT_PRODUCTS_DIR}/FirebaseSharedSwift/FirebaseSharedSwift.framework",
"${BUILT_PRODUCTS_DIR}/FirebaseStorage/FirebaseStorage.framework",
"${BUILT_PRODUCTS_DIR}/GTMSessionFetcher/GTMSessionFetcher.framework",
"${BUILT_PRODUCTS_DIR}/GoogleDataTransport/GoogleDataTransport.framework",
Expand Down Expand Up @@ -315,7 +318,6 @@
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/openssl_grpc.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FMDB.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseABTesting.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseAppCheckInterop.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseAuthInterop.framework",
Expand All @@ -324,9 +326,11 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseCoreInternal.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseDynamicLinks.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseFirestore.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseFirestoreInternal.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseInstallations.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseMessaging.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseRemoteConfig.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseSharedSwift.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseStorage.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GTMSessionFetcher.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleDataTransport.framework",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
52 changes: 26 additions & 26 deletions lib/datasource/remote/api/key_accounts_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,44 @@ import 'package:http/http.dart' as http;
import 'package:seeds/datasource/remote/api/http_repo/http_repository.dart';

class KeyAccountsRepository extends HttpRepository {
// Future<Result<dynamic>> getKeyAccounts(String publicKey) {
// print('[http] getKeyAccounts');
Future<Result<dynamic>> getKeyAccounts(String publicKey) {
print('[http] getKeyAccounts');

This comment has been minimized.

Copy link
@chuck-h

chuck-h Apr 29, 2024

Collaborator

@n13 Is this reversion related to this goof? #1944 (comment)

After making that fix it worked properly for me on Android (I don't/can't do iOS testing).

// final url = Uri.parse('$baseURL/v1/history/get_key_accounts');
// final body = '{ "public_key": "$publicKey" }';

// return http
// .post(url, headers: headers, body: body)
// .then((http.Response response) => mapHttpResponse(response, (dynamic body) {
// print('result: $body');

// final result = List<String>.from(body['account_names']);

// result.sort();

// return result;
// }))
// .catchError((dynamic error) => mapHttpError(error));
// }

Future<Result<dynamic>> getAccountsByKey(String publicKey) {
print('[http] getAccountsByKey');

final url = Uri.parse('$baseURL/v1/chain/get_accounts_by_authorizers');
final body = '{ "accounts": [], "keys": []"$publicKey"] }';
final url = Uri.parse('$baseURL/v1/history/get_key_accounts');
final body = '{ "public_key": "$publicKey" }';

return http
.post(url, headers: headers, body: body)
.then((http.Response response) => mapHttpResponse(response, (dynamic body) {
print('result: $body');

final result =
List<dynamic>.from(body['accounts']).map((e) => e['account_name']).toList().toSet().toList();
final result = List<String>.from(body['account_names']);

result.sort();

return result;
}))
.catchError((dynamic error) => mapHttpError(error));
}

// Future<Result<dynamic>> getAccountsByKey(String publicKey) {
// print('[http] getAccountsByKey');

// final url = Uri.parse('$baseURL/v1/chain/get_accounts_by_authorizers');
// final body = '{ "accounts": [], "keys": []"$publicKey"] }';

// return http
// .post(url, headers: headers, body: body)
// .then((http.Response response) => mapHttpResponse(response, (dynamic body) {
// print('result: $body');

// final result =
// List<dynamic>.from(body['accounts']).map((e) => e['account_name']).toList().toSet().toList();

// result.sort();

// return result;
// }))
// .catchError((dynamic error) => mapHttpError(error));
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class ImportKeyUseCase {
final ProfileRepository _profileRepository = ProfileRepository();

Future<List<Result>> run(String publicKey) async {
final accountsResponse = await _keyAccountsRepository.getAccountsByKey(publicKey);
final accountsResponse = await _keyAccountsRepository.getKeyAccounts(publicKey);
if (accountsResponse.isError) {
final List<Result> items = [accountsResponse];
return items;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ImportAccountsUseCase {

Future<List<Result>> run(List<String> publicKeys) async {
final List<Future<Result>> getKeyAccountsFutures =
publicKeys.map((i) => _keyAccountsRepository.getAccountsByKey(i)).toList();
publicKeys.map((i) => _keyAccountsRepository.getKeyAccounts(i)).toList();

final List<Result> keyAccountsResponse = await Future.wait(getKeyAccountsFutures);
if (keyAccountsResponse.singleWhereOrNull((i) => i.isError) != null) {
Expand Down

0 comments on commit 6f8cfa2

Please sign in to comment.