diff --git a/lib/authentication/login/views/modals/enter_your_password_modal.dart b/lib/authentication/login/views/modals/enter_your_password_modal.dart index e898dff1c..ef4b73513 100644 --- a/lib/authentication/login/views/modals/enter_your_password_modal.dart +++ b/lib/authentication/login/views/modals/enter_your_password_modal.dart @@ -80,7 +80,7 @@ class _EnterYourPasswordWidgetState extends State { context .read() - .add(LoadProfileNameAnonymous(walletAddress ?? '')); + .add(LoadProfileNameBeforeLogin(walletAddress ?? '')); }); } diff --git a/lib/authentication/login/views/modals/secure_your_wallet_modal.dart b/lib/authentication/login/views/modals/secure_your_wallet_modal.dart index f000911f7..80f752a13 100644 --- a/lib/authentication/login/views/modals/secure_your_wallet_modal.dart +++ b/lib/authentication/login/views/modals/secure_your_wallet_modal.dart @@ -57,7 +57,7 @@ class _SecureYourWalletWidgetState extends State { context .read() - .add(LoadProfileNameAnonymous(walletAddress)); + .add(LoadProfileNameBeforeLogin(walletAddress)); }); } diff --git a/lib/blocs/upload/upload_cubit.dart b/lib/blocs/upload/upload_cubit.dart index b9a8039a6..c34399ac9 100644 --- a/lib/blocs/upload/upload_cubit.dart +++ b/lib/blocs/upload/upload_cubit.dart @@ -230,7 +230,7 @@ class UploadCubit extends Cubit { ); emit(UploadingManifests( - manifestFiles: manifestModels, + manifestFiles: manifestModels, completedCount: completedCount, )); @@ -266,7 +266,7 @@ class UploadCubit extends Cubit { name: manifestModels[i].undername!.name, domain: manifestModels[i].antRecord!.domain, record: ARNSRecord( - transactionId: manifestFile.dataTxId, + transactionId: manifestFile.dataTxId, ttlSeconds: 3600, ), ); diff --git a/lib/user/name/presentation/bloc/profile_name_bloc.dart b/lib/user/name/presentation/bloc/profile_name_bloc.dart index 1dda1ae75..b264a7f74 100644 --- a/lib/user/name/presentation/bloc/profile_name_bloc.dart +++ b/lib/user/name/presentation/bloc/profile_name_bloc.dart @@ -22,26 +22,26 @@ class ProfileNameBloc extends Bloc { on((event, emit) async { await _loadProfileName( walletAddress: _auth.currentUser.walletAddress, - refresh: false, + refreshName: false, + refreshLogo: false, emit: emit, ); }); on((event, emit) async { await _loadProfileName( walletAddress: _auth.currentUser.walletAddress, - refresh: true, + refreshName: true, + refreshLogo: true, emit: emit, ); }); - on((event, emit) async { + on((event, emit) async { emit(ProfileNameLoading(event.walletAddress)); - logger - .d('Loading profile name for anonymous user ${event.walletAddress}'); - await _loadProfileName( walletAddress: event.walletAddress, - refresh: true, + refreshName: true, + refreshLogo: false, emit: emit, isUserLoggedIn: false, ); @@ -53,7 +53,8 @@ class ProfileNameBloc extends Bloc { Future _loadProfileName({ required String walletAddress, - required bool refresh, + required bool refreshName, + required bool refreshLogo, required Emitter emit, bool isUserLoggedIn = true, }) async { @@ -61,24 +62,28 @@ class ProfileNameBloc extends Bloc { String? profileLogoTxId; /// if we are not refreshing, we emit a loading state - if (!refresh) { + if (!refreshName) { emit(ProfileNameLoading(walletAddress)); } - if (refresh && !isUserLoggedIn) { + if (!refreshLogo) { + logger.d('Getting profile logo tx id from cache'); + profileLogoTxId = await _profileLogoRepository.getProfileLogoTxId(walletAddress); + + logger.d('Profile logo tx id: $profileLogoTxId'); } var primaryNameDetails = await _arnsRepository.getPrimaryName( walletAddress, - update: refresh, - getLogo: profileLogoTxId == null, + update: refreshName, + getLogo: refreshLogo, ); - primaryNameDetails = primaryNameDetails.copyWith( - logo: profileLogoTxId == null ? primaryNameDetails.logo : null, - ); + if (refreshLogo && profileLogoTxId != null) { + primaryNameDetails = primaryNameDetails.copyWith(logo: profileLogoTxId); + } if (isUserLoggedIn && _auth.currentUser.walletAddress != walletAddress) { // A user can load profile name and log out while fetching this request. Then log in again. We should not emit a profile name loaded state in this case. diff --git a/lib/user/name/presentation/bloc/profile_name_event.dart b/lib/user/name/presentation/bloc/profile_name_event.dart index 23e2135ab..1b7f8b321 100644 --- a/lib/user/name/presentation/bloc/profile_name_event.dart +++ b/lib/user/name/presentation/bloc/profile_name_event.dart @@ -11,10 +11,10 @@ final class RefreshProfileName extends ProfileNameEvent {} final class LoadProfileName extends ProfileNameEvent {} -final class LoadProfileNameAnonymous extends ProfileNameEvent { +final class LoadProfileNameBeforeLogin extends ProfileNameEvent { final String walletAddress; - const LoadProfileNameAnonymous(this.walletAddress); + const LoadProfileNameBeforeLogin(this.walletAddress); } final class CleanProfileName extends ProfileNameEvent { diff --git a/packages/ario_sdk/lib/src/implementations/ario_sdk_web.dart b/packages/ario_sdk/lib/src/implementations/ario_sdk_web.dart index ac73479a5..2a87f8a9b 100644 --- a/packages/ario_sdk/lib/src/implementations/ario_sdk_web.dart +++ b/packages/ario_sdk/lib/src/implementations/ario_sdk_web.dart @@ -213,7 +213,7 @@ Future _getPrimaryNameImpl( return PrimaryNameDetails( primaryName: json['primaryName']['name'], - logo: json['antInfo']['Logo'], + logo: json['antInfo']?['Logo'], recordId: json['arnsRecord']?['processId'], ); }