-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1929 from ardriveapp/dev
PE-7226: Release ArDrive v2.59.0
- Loading branch information
Showing
29 changed files
with
83,709 additions
and
91,362 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- Added support for displaying Primary Names in the ArDrive app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import 'package:ardrive/arns/domain/arns_repository.dart'; | ||
import 'package:ardrive/authentication/ardrive_auth.dart'; | ||
import 'package:ardrive/utils/logger.dart'; | ||
import 'package:ario_sdk/ario_sdk.dart'; | ||
import 'package:equatable/equatable.dart'; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
|
||
part 'profile_name_event.dart'; | ||
part 'profile_name_state.dart'; | ||
|
||
class ProfileNameBloc extends Bloc<ProfileNameEvent, ProfileNameState> { | ||
final ARNSRepository _arnsRepository; | ||
final ArDriveAuth _auth; | ||
|
||
ProfileNameBloc(this._arnsRepository, this._auth) | ||
: super(ProfileNameInitial(_auth.currentUser.walletAddress)) { | ||
on<LoadProfileName>((event, emit) async { | ||
await _loadProfileName( | ||
walletAddress: _auth.currentUser.walletAddress, | ||
refresh: false, | ||
emit: emit, | ||
); | ||
}); | ||
on<RefreshProfileName>((event, emit) async { | ||
await _loadProfileName( | ||
walletAddress: _auth.currentUser.walletAddress, | ||
refresh: true, | ||
emit: emit, | ||
); | ||
}); | ||
} | ||
|
||
Future<void> _loadProfileName({ | ||
required String walletAddress, | ||
required bool refresh, | ||
required Emitter<ProfileNameState> emit, | ||
}) async { | ||
try { | ||
/// if we are not refreshing, we emit a loading state | ||
if (!refresh) { | ||
emit(ProfileNameLoading(walletAddress)); | ||
} | ||
|
||
final primaryName = | ||
await _arnsRepository.getPrimaryName(walletAddress, update: refresh); | ||
|
||
emit(ProfileNameLoaded(primaryName, walletAddress)); | ||
} catch (e) { | ||
if (e is PrimaryNameNotFoundException) { | ||
logger.d('Primary name not found for address: $walletAddress'); | ||
} else { | ||
logger.e('Error getting primary name.', e); | ||
} | ||
|
||
emit( | ||
ProfileNameLoadedWithWalletAddress( | ||
walletAddress, | ||
), | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
part of 'profile_name_bloc.dart'; | ||
|
||
sealed class ProfileNameEvent extends Equatable { | ||
const ProfileNameEvent(); | ||
|
||
@override | ||
List<Object> get props => []; | ||
} | ||
|
||
final class RefreshProfileName extends ProfileNameEvent {} | ||
|
||
final class LoadProfileName extends ProfileNameEvent {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
part of 'profile_name_bloc.dart'; | ||
|
||
sealed class ProfileNameState extends Equatable { | ||
const ProfileNameState(); | ||
|
||
abstract final String walletAddress; | ||
|
||
@override | ||
List<Object> get props => []; | ||
} | ||
|
||
final class ProfileNameInitial extends ProfileNameState { | ||
const ProfileNameInitial(this.walletAddress); | ||
|
||
@override | ||
final String walletAddress; | ||
} | ||
|
||
final class ProfileNameLoading extends ProfileNameState { | ||
@override | ||
final String walletAddress; | ||
|
||
const ProfileNameLoading(this.walletAddress); | ||
} | ||
|
||
final class ProfileNameLoaded extends ProfileNameState { | ||
final String primaryName; | ||
|
||
const ProfileNameLoaded(this.primaryName, this.walletAddress); | ||
|
||
@override | ||
final String walletAddress; | ||
|
||
@override | ||
List<Object> get props => [primaryName, walletAddress]; | ||
} | ||
|
||
// if fails to load primary name, show current wallet address | ||
final class ProfileNameLoadedWithWalletAddress extends ProfileNameState { | ||
@override | ||
final String walletAddress; | ||
|
||
const ProfileNameLoadedWithWalletAddress(this.walletAddress); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.