Skip to content

Commit

Permalink
library update and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
n13 committed Nov 19, 2024
1 parent 2984dce commit b31358b
Show file tree
Hide file tree
Showing 14 changed files with 87 additions and 100 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ if (keystorePropertiesFile.exists()) {
}

android {
compileSdkVersion 33
compileSdkVersion 34
ndkVersion flutter.ndkVersion

compileOptions {
Expand Down
26 changes: 13 additions & 13 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1222,14 +1222,14 @@ PODS:
- GoogleUtilities/Network (~> 8.0)
- "GoogleUtilities/NSData+zlib (~> 8.0)"
- nanopb (~> 3.30910.0)
- FirebaseAppCheckInterop (11.4.0)
- FirebaseAppCheckInterop (11.5.0)
- FirebaseCore (11.4.0):
- FirebaseCoreInternal (~> 11.0)
- GoogleUtilities/Environment (~> 8.0)
- GoogleUtilities/Logger (~> 8.0)
- FirebaseCoreExtension (11.4.1):
- FirebaseCore (~> 11.0)
- FirebaseCoreInternal (11.4.2):
- FirebaseCoreInternal (11.5.0):
- "GoogleUtilities/NSData+zlib (~> 8.0)"
- FirebaseCrashlytics (11.4.0):
- FirebaseCore (~> 11.4)
Expand Down Expand Up @@ -1284,7 +1284,7 @@ PODS:
- FirebaseSharedSwift (~> 11.0)
- GoogleUtilities/Environment (~> 8.0)
- "GoogleUtilities/NSData+zlib (~> 8.0)"
- FirebaseRemoteConfigInterop (11.4.0)
- FirebaseRemoteConfigInterop (11.5.0)
- FirebaseSessions (11.4.0):
- FirebaseCore (~> 11.4)
- FirebaseCoreExtension (~> 11.4)
Expand All @@ -1294,7 +1294,7 @@ PODS:
- GoogleUtilities/UserDefaults (~> 8.0)
- nanopb (~> 3.30910.0)
- PromisesSwift (~> 2.1)
- FirebaseSharedSwift (11.4.0)
- FirebaseSharedSwift (11.5.0)
- Flutter (1.0.0)
- flutter_keyboard_visibility_temp_fork (0.0.1):
- Flutter
Expand Down Expand Up @@ -1453,7 +1453,7 @@ PODS:
- GTMSessionFetcher/Core (3.5.0)
- image_cropper (0.0.4):
- Flutter
- TOCropViewController (~> 2.6.1)
- TOCropViewController (~> 2.7.4)
- image_picker_ios (0.0.1):
- Flutter
- leveldb-library (1.22.6)
Expand Down Expand Up @@ -1502,7 +1502,7 @@ PODS:
- sqflite (0.0.3):
- Flutter
- FlutterMacOS
- TOCropViewController (2.6.1)
- TOCropViewController (2.7.4)
- url_launcher_ios (0.0.1):
- Flutter

Expand Down Expand Up @@ -1629,20 +1629,20 @@ SPEC CHECKSUMS:
firebase_remote_config: 1b2da0c0a4f781a970ccf84597b8092e3ec69142
FirebaseABTesting: aef1719704fade00b200827e7973f352efc4caee
FirebaseAnalytics: 3feef9ae8733c567866342a1000691baaa7cad49
FirebaseAppCheckInterop: 1b9643ae2f1ee214488caa2f8e32b7bc2f0f3735
FirebaseAppCheckInterop: d265d9f4484e7ec1c591086408840fdd383d1213
FirebaseCore: e0510f1523bc0eb21653cac00792e1e2bd6f1771
FirebaseCoreExtension: f1bc67a4702931a7caa097d8e4ac0a1b0d16720e
FirebaseCoreInternal: 35731192cab10797b88411be84940d2beb33a238
FirebaseCoreInternal: f47dd28ae7782e6a4738aad3106071a8fe0af604
FirebaseCrashlytics: 41bbdd2b514a8523cede0c217aee6ef7ecf38401
FirebaseDynamicLinks: 192110d77418357fe994f2823a7df7db3ccb15bf
FirebaseFirestore: 2ccdf893fd7e175aa8ec58faa06338b346d27db8
FirebaseFirestoreInternal: 004452c4669d5df8869c9f8f7a24ee0009852d5b
FirebaseInstallations: 6ef4a1c7eb2a61ee1f74727d7f6ce2e72acf1414
FirebaseMessaging: f8a160d99c2c2e5babbbcc90c4a3e15db036aee2
FirebaseRemoteConfig: 7655681d02417bc9b287338edb9d721ff79e1a4a
FirebaseRemoteConfigInterop: e76f46ffa4d6a65e273d4dfebb6a79e588cec136
FirebaseRemoteConfigInterop: 7a7aebb9342d53913a5c890efa88e289d9e5c1bc
FirebaseSessions: 3f56f177d9e53a85021d16b31f9a111849d1dd8b
FirebaseSharedSwift: 505dae2d05969dbf6d43749a642bb1bf230f0252
FirebaseSharedSwift: 302ac5967857ad7e7388b15382d705b8c8d892aa
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_keyboard_visibility_temp_fork: 442dadca3b81868a225cd6a2f605bffff1215844
flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be
Expand All @@ -1654,7 +1654,7 @@ SPEC CHECKSUMS:
"gRPC-C++": 2fa52b3141e7789a28a737f251e0c45b4cb20a87
gRPC-Core: a27c294d6149e1c39a7d173527119cfbc3375ce4
GTMSessionFetcher: 5aea5ba6bd522a239e236100971f10cb71b96ab6
image_cropper: a3291c624a953049bc6a02e1f8c8ceb162a24b25
image_cropper: 37d40f62177c101ff4c164906d259ea2c3aa70cf
image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1
leveldb-library: cc8b8f8e013647a295ad3f8cd2ddf49a6f19be19
MLImage: 0ad1c5f50edd027672d8b26b0fee78a8b4a0fc56
Expand All @@ -1663,7 +1663,7 @@ SPEC CHECKSUMS:
MLKitVision: 45e79d68845a2de77e2dd4d7f07947f0ed157b0e
mobile_scanner: fd0054c52ede661e80bf5a4dea477a2467356bee
nanopb: fad817b59e0457d11a5dfbde799381cd727c1275
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
package_info_plus: c0502532a26c7662a62a356cebe2692ec5fe4ec4
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
Expand All @@ -1672,7 +1672,7 @@ SPEC CHECKSUMS:
share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
TOCropViewController: edfd4f25713d56905ad1e0b9f5be3fbe0f59c863
TOCropViewController: 80b8985ad794298fb69d3341de183f33d1853654
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe

PODFILE CHECKSUM: 57f150c9552976e1ec713a7085b7490018aec9c6
Expand Down
4 changes: 2 additions & 2 deletions lib/core/crypto/eosdart/src/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import 'package:hypha_wallet/core/logging/log_helper.dart';
import 'package:hypha_wallet/core/network/networking_manager.dart';

class ContractCache {
Map<String, Contract> _contracts = {};
Map<String, DateTime> _timeStamps = {};
final Map<String, Contract> _contracts = {};
final Map<String, DateTime> _timeStamps = {};
final int expirySeconds = 30;

void put(String name, Contract contract) {
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/onboarding/create_account_success_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CreateAccountSuccessPage extends StatelessWidget {
Widget build(BuildContext context) {
return PopScope(
canPop: false,
onPopInvoked: (didPop) {
onPopInvokedWithResult: (didPop, result) {
if (didPop) return;
context.read<AuthenticationBloc>().add(
const AuthenticationEvent.authenticationStatusChanged(UnAuthenticated()),
Expand Down
3 changes: 1 addition & 2 deletions lib/ui/profile/components/dao_widget.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart';
import 'package:hypha_wallet/core/network/models/dao_data_model.dart';
import 'package:hypha_wallet/design/dao_image.dart';
import 'package:hypha_wallet/design/hypha_card.dart';
import 'package:hypha_wallet/design/hypha_colors.dart';
import 'package:hypha_wallet/design/ipfs_image.dart';
import 'package:hypha_wallet/design/themes/extensions/theme_extension_provider.dart';
import 'package:hypha_wallet/design/dao_image.dart';
import 'package:url_launcher/url_launcher.dart';

class DaoWidget extends StatelessWidget {
Expand Down
9 changes: 3 additions & 6 deletions lib/ui/profile/components/profile_edit_menu_bottom_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,11 @@ class ProfileEditMenuBottomSheet extends StatelessWidget {
maxWidth: 1500,
);

if(image == null) return;
if (image == null) return;

final CroppedFile? croppedFile = await ImageCropper().cropImage(
sourcePath: image.path,
aspectRatioPresets: [
CropAspectRatioPreset.square,
],
aspectRatio: const CropAspectRatio(ratioX: 1, ratioY: 1),
uiSettings: [
AndroidUiSettings(
toolbarTitle: 'Crop Image',
Expand All @@ -101,8 +99,7 @@ class ProfileEditMenuBottomSheet extends StatelessWidget {
);
},
),

if(profileBloc.state.profileData?.avatarUrl != null)...[
if (profileBloc.state.profileData?.avatarUrl != null) ...[
ListTile(
title: const Text('Remove Picture'),
trailing: const Icon(Icons.chevron_right),
Expand Down
11 changes: 4 additions & 7 deletions lib/ui/proposals/creation/components/outcome_selection_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ class _OutcomeSelectionViewState extends State<OutcomeSelectionView> {
OutcomeModel(
icon: CupertinoIcons.hand_thumbsup,
type: OutcomeType.agreement,
details:
'A Proposal where other DAO members are simply asked to vote Yes or No.',
details: 'A Proposal where other DAO members are simply asked to vote Yes or No.',
),
OutcomeModel(
icon: Icons.fiber_smart_record_outlined,
Expand All @@ -42,8 +41,7 @@ class _OutcomeSelectionViewState extends State<OutcomeSelectionView> {
@override
void initState() {
super.initState();
final ProposalCreationBloc proposalCreationBloc =
context.read<ProposalCreationBloc>();
final ProposalCreationBloc proposalCreationBloc = context.read<ProposalCreationBloc>();
if (proposalCreationBloc.state.proposal?.type == null) {
selectedTypeIndexNotifier = ValueNotifier<int>(0);
context.read<ProposalCreationBloc>().add(
Expand All @@ -52,9 +50,8 @@ class _OutcomeSelectionViewState extends State<OutcomeSelectionView> {
),
);
} else {
selectedTypeIndexNotifier = ValueNotifier<int>(outcomeTypes.indexWhere(
(outcome) =>
outcome.type.label == proposalCreationBloc.state.proposal?.type));
selectedTypeIndexNotifier = ValueNotifier<int>(
outcomeTypes.indexWhere((outcome) => outcome.type.label == proposalCreationBloc.state.proposal?.type.name));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_quill/flutter_quill.dart';
import 'package:flutter_quill/quill_delta.dart';
import 'package:get/get_utils/src/extensions/context_extensions.dart';
import 'package:hypha_wallet/core/network/models/dao_data_model.dart';
import 'package:hypha_wallet/design/buttons/hypha_app_button.dart';
import 'package:hypha_wallet/design/dividers/hypha_divider.dart';
import 'package:hypha_wallet/design/hypha_colors.dart';
Expand Down
2 changes: 2 additions & 0 deletions lib/ui/proposals/creation/proposal_creation_page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ignore_for_file: unused_import

import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:get/get.dart';
Expand Down
49 changes: 19 additions & 30 deletions lib/ui/proposals/list/components/hypha_proposals_action_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ class HyphaProposalsActionCard extends StatelessWidget {
return GestureDetector(
onTap: () {
Get.Get.to(
ProposalDetailsPage(proposalId: _proposalModel.id,),
ProposalDetailsPage(
proposalId: _proposalModel.id ?? '',
),
transition: Get.Transition.rightToLeft,
);
},
Expand All @@ -45,7 +47,6 @@ class HyphaProposalsActionCard extends StatelessWidget {
padding: EdgeInsets.symmetric(vertical: 18),
child: HyphaDivider(),
),

Container(
alignment: Alignment.centerLeft,
height: 55,
Expand All @@ -60,27 +61,20 @@ class HyphaProposalsActionCard extends StatelessWidget {
child: ProposalPercentageIndicator(
'Unity',
_proposalModel.unityToPercent(),
_proposalModel.isPassing()
? HyphaColors.success
: HyphaColors.error,
_proposalModel.isPassing() ? HyphaColors.success : HyphaColors.error,
),
),
ProposalPercentageIndicator(
'Quorum',
_proposalModel.quorumToPercent(),
_proposalModel.isPassing()
? HyphaColors.success
: HyphaColors.error),
ProposalPercentageIndicator('Quorum', _proposalModel.quorumToPercent(),
_proposalModel.isPassing() ? HyphaColors.success : HyphaColors.error),
const SizedBox(height: 20),
ProposalExpirationTimer(_proposalModel.formatExpiration(),),
ProposalExpirationTimer(
_proposalModel.formatExpiration(),
),
const Padding(
padding: EdgeInsets.symmetric(vertical: 16),
child: HyphaDivider(),
),
_buildProposalCardFooter(
context,
_proposalModel.creator
),
_buildProposalCardFooter(context, _proposalModel.creator),
],
),
),
Expand All @@ -93,8 +87,8 @@ class HyphaProposalsActionCard extends StatelessWidget {
Widget _buildVoteStatusOverlay(BuildContext context) {
return BlocBuilder<AuthenticationBloc, AuthenticationState>(
builder: (context, state) {
final myVoteIndex = _proposalModel.votes?.indexWhere((element) =>
element.voter == state.userProfileData?.accountName);
final myVoteIndex =
_proposalModel.votes?.indexWhere((element) => element.voter == state.userProfileData?.accountName);
if (myVoteIndex == null || myVoteIndex == -1) return const SizedBox();
final voteStatus = _proposalModel.votes![myVoteIndex].voteStatus;
final color = voteStatus == VoteStatus.pass
Expand All @@ -119,8 +113,7 @@ class HyphaProposalsActionCard extends StatelessWidget {
height: 435,
child: Text(
statusText,
style: context.hyphaTextTheme.smallTitles
.copyWith(color: HyphaColors.white),
style: context.hyphaTextTheme.smallTitles.copyWith(color: HyphaColors.white),
),
);
},
Expand All @@ -131,16 +124,12 @@ class HyphaProposalsActionCard extends StatelessWidget {
return Row(
children: [
Expanded(child: ProposalCreator(creator)),
ProposalButton(
'Vote',
Icons.arrow_forward_ios,
() {
Get.Get.to(
ProposalDetailsPage(proposalId: _proposalModel.id!),
transition: Get.Transition.rightToLeft,
);
}
),
ProposalButton('Vote', Icons.arrow_forward_ios, () {
Get.Get.to(
ProposalDetailsPage(proposalId: _proposalModel.id!),
transition: Get.Transition.rightToLeft,
);
}),
],
);
}
Expand Down
19 changes: 7 additions & 12 deletions lib/ui/proposals/list/interactor/proposals_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ class ProposalsBloc extends Bloc<ProposalsEvent, ProposalsState> {
final GetProposalsUseCase _getProposalsUseCase;
final FetchProfileUseCase _fetchProfileUseCase;
final ErrorHandlerManager _errorHandlerManager;
List<DaoData> daos=[];
ProposalsBloc(this._getProposalsUseCase, this._fetchProfileUseCase,
this._errorHandlerManager)
List<DaoData> daos = [];
ProposalsBloc(this._getProposalsUseCase, this._fetchProfileUseCase, this._errorHandlerManager)
: super(const ProposalsState()) {
on<_Initial>(_initial);
}
Expand All @@ -40,18 +39,15 @@ class ProposalsBloc extends Bloc<ProposalsEvent, ProposalsState> {
await _fetchAndEmitProposals(emit, filterStatus);
}

Future<void> _fetchAndEmitProposals(
Emitter<ProposalsState> emit, FilterStatus filterStatus) async {
Future<void> _fetchAndEmitProposals(Emitter<ProposalsState> emit, FilterStatus filterStatus) async {
// Fetch DAOs
final Result<ProfileData, HyphaError> profileResult =
await _fetchProfileUseCase.run();
final Result<ProfileData, HyphaError> profileResult = await _fetchProfileUseCase.run();

if (profileResult.isValue && profileResult.asValue!.value.daos.isNotEmpty) {
daos = profileResult.asValue!.value.daos;
// Fetch Proposals using the fetched DAOs
final Result<List<ProposalModel>, HyphaError> proposalsResult =
await _getProposalsUseCase
.run(GetProposalsUseCaseInput(daos, filterStatus));;
await _getProposalsUseCase.run(GetProposalsUseCaseInput(daos, filterStatus));

if (proposalsResult.isValue) {
// Emit both daos and proposals in one state
Expand All @@ -64,9 +60,8 @@ class ProposalsBloc extends Bloc<ProposalsEvent, ProposalsState> {
emit(state.copyWith(pageState: PageState.failure));
}
} else {
final HyphaError error = profileResult.isError
? profileResult.asError!.error
: HyphaError.api('Failed to retrieve DAOs');
final HyphaError error =
profileResult.isError ? profileResult.asError!.error : HyphaError.api('Failed to retrieve DAOs');
await _errorHandlerManager.handlerError(error);
emit(state.copyWith(pageState: PageState.failure));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ import 'package:get/get.dart';
import 'package:hypha_wallet/design/background/hypha_half_background.dart';
import 'package:hypha_wallet/design/background/hypha_page_background.dart';
import 'package:hypha_wallet/design/bottom_component/hypha_safe_bottom_navigation_bar.dart';
import 'package:hypha_wallet/design/buttons/button_type.dart';
import 'package:hypha_wallet/design/buttons/hypha_app_button.dart';
import 'package:hypha_wallet/design/hypha_colors.dart';
import 'package:hypha_wallet/design/themes/extensions/theme_extension_provider.dart';
import 'package:hypha_wallet/ui/bottom_navigation/hypha_bottom_navigation.dart';
import 'package:hypha_wallet/ui/proposals/details/proposal_details_page.dart';

enum SignSuccessTransactionType {
approved('Approved'),
Expand Down
Loading

0 comments on commit b31358b

Please sign in to comment.