Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/gh 357/account information screen #374

Open
wants to merge 16 commits into
base: development
Choose a base branch
from
142 changes: 68 additions & 74 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,80 +1,74 @@
PODS:
- country_codes (0.0.1):
- Flutter
- Firebase/Auth (9.6.0):
- Firebase/Auth (10.3.0):
- Firebase/CoreOnly
- FirebaseAuth (~> 9.6.0)
- Firebase/CoreOnly (9.6.0):
- FirebaseCore (= 9.6.0)
- Firebase/Crashlytics (9.6.0):
- FirebaseAuth (~> 10.3.0)
- Firebase/CoreOnly (10.3.0):
- FirebaseCore (= 10.3.0)
- Firebase/Crashlytics (10.3.0):
- Firebase/CoreOnly
- FirebaseCrashlytics (~> 9.6.0)
- firebase_auth (3.11.2):
- Firebase/Auth (= 9.6.0)
- FirebaseCrashlytics (~> 10.3.0)
- firebase_auth (4.2.5):
- Firebase/Auth (= 10.3.0)
- firebase_core
- Flutter
- firebase_core (1.24.0):
- Firebase/CoreOnly (= 9.6.0)
- firebase_core (2.4.1):
- Firebase/CoreOnly (= 10.3.0)
- Flutter
- firebase_crashlytics (2.9.0):
- Firebase/Crashlytics (= 9.6.0)
- firebase_crashlytics (3.0.11):
- Firebase/Crashlytics (= 10.3.0)
- firebase_core
- Flutter
- FirebaseAuth (9.6.0):
- FirebaseCore (~> 9.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.7)
- GoogleUtilities/Environment (~> 7.7)
- GTMSessionFetcher/Core (< 3.0, >= 1.7)
- FirebaseCore (9.6.0):
- FirebaseCoreDiagnostics (~> 9.0)
- FirebaseCoreInternal (~> 9.0)
- GoogleUtilities/Environment (~> 7.7)
- GoogleUtilities/Logger (~> 7.7)
- FirebaseCoreDiagnostics (9.6.0):
- GoogleDataTransport (< 10.0.0, >= 9.1.4)
- GoogleUtilities/Environment (~> 7.7)
- GoogleUtilities/Logger (~> 7.7)
- nanopb (< 2.30910.0, >= 2.30908.0)
- FirebaseCoreInternal (9.6.0):
- "GoogleUtilities/NSData+zlib (~> 7.7)"
- FirebaseCrashlytics (9.6.0):
- FirebaseCore (~> 9.0)
- FirebaseInstallations (~> 9.0)
- GoogleDataTransport (< 10.0.0, >= 9.1.4)
- GoogleUtilities/Environment (~> 7.7)
- FirebaseAuth (10.3.0):
- FirebaseCore (~> 10.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.8)
- GoogleUtilities/Environment (~> 7.8)
- GTMSessionFetcher/Core (< 4.0, >= 2.1)
- FirebaseCore (10.3.0):
- FirebaseCoreInternal (~> 10.0)
- GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/Logger (~> 7.8)
- FirebaseCoreInternal (10.6.0):
- "GoogleUtilities/NSData+zlib (~> 7.8)"
- FirebaseCrashlytics (10.3.0):
- FirebaseCore (~> 10.0)
- FirebaseInstallations (~> 10.0)
- GoogleDataTransport (~> 9.2)
- GoogleUtilities/Environment (~> 7.8)
- nanopb (< 2.30910.0, >= 2.30908.0)
- PromisesObjC (~> 2.1)
- FirebaseInstallations (9.6.0):
- FirebaseCore (~> 9.0)
- GoogleUtilities/Environment (~> 7.7)
- GoogleUtilities/UserDefaults (~> 7.7)
- FirebaseInstallations (10.6.0):
- FirebaseCore (~> 10.0)
- GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/UserDefaults (~> 7.8)
- PromisesObjC (~> 2.1)
- Flutter (1.0.0)
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5)
- GoogleDataTransport (9.2.0):
- GoogleDataTransport (9.2.1):
- GoogleUtilities/Environment (~> 7.7)
- nanopb (< 2.30910.0, >= 2.30908.0)
- PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/AppDelegateSwizzler (7.10.0):
- GoogleUtilities/AppDelegateSwizzler (7.11.0):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
- GoogleUtilities/Network
- GoogleUtilities/Environment (7.10.0):
- GoogleUtilities/Environment (7.11.0):
- PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/Logger (7.10.0):
- GoogleUtilities/Logger (7.11.0):
- GoogleUtilities/Environment
- GoogleUtilities/Network (7.10.0):
- GoogleUtilities/Network (7.11.0):
- GoogleUtilities/Logger
- "GoogleUtilities/NSData+zlib"
- GoogleUtilities/Reachability
- "GoogleUtilities/NSData+zlib (7.10.0)"
- GoogleUtilities/Reachability (7.10.0):
- "GoogleUtilities/NSData+zlib (7.11.0)"
- GoogleUtilities/Reachability (7.11.0):
- GoogleUtilities/Logger
- GoogleUtilities/UserDefaults (7.10.0):
- GoogleUtilities/UserDefaults (7.11.0):
- GoogleUtilities/Logger
- GTMSessionFetcher/Core (2.3.0)
- GTMSessionFetcher/Core (3.1.0)
- image_cropper (0.0.4):
- Flutter
- TOCropViewController (~> 2.6.1)
Expand All @@ -87,17 +81,19 @@ PODS:
- nanopb/encode (2.30909.0)
- package_info_plus (0.4.5):
- Flutter
- path_provider_ios (0.0.1):
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- phone_number (1.0.0):
- Flutter
- PhoneNumberKit/PhoneNumberKitCore (= 3.3.4)
- PhoneNumberKit/PhoneNumberKitCore (3.3.4)
- PromisesObjC (2.1.1)
- PromisesObjC (2.2.0)
- share_plus (0.0.1):
- Flutter
- shared_preferences_ios (0.0.1):
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- sqflite (0.0.2):
- Flutter
- FMDB (>= 2.7.5)
Expand All @@ -116,10 +112,10 @@ DEPENDENCIES:
- image_cropper (from `.symlinks/plugins/image_cropper/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`)
- phone_number (from `.symlinks/plugins/phone_number/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`)
Expand All @@ -129,7 +125,6 @@ SPEC REPOS:
- Firebase
- FirebaseAuth
- FirebaseCore
- FirebaseCoreDiagnostics
- FirebaseCoreInternal
- FirebaseCrashlytics
- FirebaseInstallations
Expand Down Expand Up @@ -159,14 +154,14 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/image_picker_ios/ios"
package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios"
path_provider_ios:
:path: ".symlinks/plugins/path_provider_ios/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/ios"
phone_number:
:path: ".symlinks/plugins/phone_number/ios"
share_plus:
:path: ".symlinks/plugins/share_plus/ios"
shared_preferences_ios:
:path: ".symlinks/plugins/shared_preferences_ios/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/ios"
sqflite:
:path: ".symlinks/plugins/sqflite/ios"
url_launcher_ios:
Expand All @@ -176,34 +171,33 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
country_codes: b0900f46ad686281d5dab438e354e44ad10f5941
Firebase: 5ae8b7cf8efce559a653aef0ad95bab3f427c351
firebase_auth: 07a4db69cfa447ac42cb7faa560fc100708b707c
firebase_core: 7c28ecc1e5dd74e03829ac3e9ff5ba3314e737a9
firebase_crashlytics: 520a59314eaaadb34f9be4c2a285d99cfa88ebdb
FirebaseAuth: e4a5d3c36e778e41141b91cc861103a441d80bcc
FirebaseCore: 2082fffcd855f95f883c0a1641133eb9bbe76d40
FirebaseCoreDiagnostics: 99a495094b10a57eeb3ae8efa1665700ad0bdaa6
FirebaseCoreInternal: bca76517fe1ed381e989f5e7d8abb0da8d85bed3
FirebaseCrashlytics: 3210572ddb77801e5a0bd9d7bc890769f2066a0c
FirebaseInstallations: 0a115432c4e223c5ab20b0dbbe4cbefa793a0e8e
Firebase: f92fc551ead69c94168d36c2b26188263860acd9
firebase_auth: 3bab991fe1df91c2f948156e9dee976e01a19ab9
firebase_core: bf59c32d2e53814f558efa20840c1902fa2fe461
firebase_crashlytics: b19405931669c882e0d08542e69ae9e86633c636
FirebaseAuth: 0e415d29d846c1dce2fb641e46f35e9888d9bec6
FirebaseCore: 988754646ab3bd4bdcb740f1bfe26b9f6c0d5f2a
FirebaseCoreInternal: c7cd505e2136811096b225ac388d6254a2622362
FirebaseCrashlytics: f20d956f8229010b645e534693c39e0b7843c268
FirebaseInstallations: 13dde135fa0524e15bddb133ccc8465c53a1b3f3
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
GoogleDataTransport: 1c8145da7117bd68bbbed00cf304edb6a24de00f
GoogleUtilities: bad72cb363809015b1f7f19beb1f1cd23c589f95
GTMSessionFetcher: 3a63d75eecd6aa32c2fc79f578064e1214dfdec2
GoogleDataTransport: ea169759df570f4e37bdee1623ec32a7e64e67c4
GoogleUtilities: c2bdc4cf2ce786c4d2e6b3bcfd599a25ca78f06f
GTMSessionFetcher: c9e714f7eec91a55641e2bab9f45fd83a219b882
image_cropper: 60c2789d1f1a78c873235d4319ca0c34a69f2d98
image_picker_ios: b786a5dcf033a8336a657191401bfdf12017dabb
nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852
phone_number: ad6f917e4fd2e507a198b93dca5eadcb463ec8c2
PhoneNumberKit: 441e8b26ec88d598e3591de9061eff18f5dd12e8
PromisesObjC: ab77feca74fa2823e7af4249b8326368e61014cb
PromisesObjC: 09985d6d70fbe7878040aa746d78236e6946d2ef
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
shared_preferences_ios: 548a61f8053b9b8a49ac19c1ffbc8b92c50d68ad
shared_preferences_foundation: 297b3ebca31b34ec92be11acd7fb0ba932c822ca
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
TOCropViewController: edfd4f25713d56905ad1e0b9f5be3fbe0f59c863
url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de
url_launcher_ios: ae1517e5e344f5544fb090b079e11f399dfbe4d2
webview_flutter_wkwebview: b7e70ef1ddded7e69c796c7390ee74180182971f

PODFILE CHECKSUM: f10c0438b63bc24e6bbc207956dc27d16c4408f2
Expand Down
4 changes: 3 additions & 1 deletion ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -208,6 +208,7 @@
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand All @@ -222,6 +223,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down
6 changes: 4 additions & 2 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,7 @@
<false />
<key>com.apple.developer.associated-domains</key>
<array />
</dict>
</plist>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
31 changes: 31 additions & 0 deletions lib/application/country/country_bloc.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import 'package:bloc/bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';

import '../../domain/core/location.dart';
import '../../domain/user/i_profile_repository.dart';

part 'country_event.dart';
part 'country_state.dart';
part 'country_bloc.freezed.dart';

class CountryBloc extends Bloc<CountryEvent, CountryState> {
final IProfileRepository profileRepository;
CountryBloc(this.profileRepository) : super(_Initial()) {
on<CountryEvent>((event, emit) async {
await event.when(
updateCountry: (countryName, countryCode) async {
emit(const CountryState.updateInProgress());
final unitOrFailure = await profileRepository.updateCountry(
location: Location(code: countryCode, name: countryName),
);
emit(
await unitOrFailure.fold(
(failure) => const CountryState.updateFailure(),
(_) => CountryState.updateSuccess(),
),
);
},
);
});
}
}
9 changes: 9 additions & 0 deletions lib/application/country/country_event.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
part of 'country_bloc.dart';

@freezed
class CountryEvent with _$CountryEvent {
const factory CountryEvent.updateCountry({
required String countryName,
required String countrycode,
}) = _UpdateCountry;
}
9 changes: 9 additions & 0 deletions lib/application/country/country_state.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
part of 'country_bloc.dart';

@freezed
class CountryState with _$CountryState {
const factory CountryState.initial() = _Initial;
const factory CountryState.updateInProgress() = _UpdateInProgress;
const factory CountryState.updateSuccess() = _UpdateSuccess;
const factory CountryState.updateFailure() = _UpdateFailure;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// ignore_for_file: invalid_use_of_visible_for_testing_member

import 'package:bloc/bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:injectable/injectable.dart';

import '../../domain/profile/user_profile.dart';
import '../../domain/user/i_profile_repository.dart';

part 'personal_information_event.dart';
part 'personal_information_state.dart';
part 'personal_information_bloc.freezed.dart';

@injectable
class PersonalInformationBloc
extends Bloc<PersonalInformationEvent, PersonalInformationState> {
Xazin marked this conversation as resolved.
Show resolved Hide resolved
final IProfileRepository _profileRepository;
PersonalInformationBloc(this._profileRepository) : super(_Fetching()) {
_profileRepository.getUserProfile().then((profileOrFailure) {
profileOrFailure.fold((l) {}, (profile) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should handle the error state as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how we should deal with this error, since you shouldn't be able to reach the Account Information screen without being logged in, and thus having a profile.

What do you think is best @wizlif ?

I see these few options:

  • Create an anonymous version of the Widget that uses the profile (We'll use that as an error widget)
  • Show loading state (We'll implement a shimmer version), and a snackbar with an error

emit(PersonalInformationState.fetched(profile));
});
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
part of 'personal_information_bloc.dart';

class PersonalInformationEvent {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
part of 'personal_information_bloc.dart';

@freezed
class PersonalInformationState with _$PersonalInformationState {
const factory PersonalInformationState.fetching() = _Fetching;
const factory PersonalInformationState.fetched(UserProfile profile) =
_Fetched;
}
4 changes: 1 addition & 3 deletions lib/application/username/username_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ class UsernameBloc extends Bloc<UsernameEvent, UsernameState> {
await event.when(
updateUsername: (firstName, lastName) async {
emit(const UsernameState.updateInProgress());

final unitOrFailure = await profileRepository.updateUsername(
firstName: firstName,
lastName: lastName,
);

emit(
unitOrFailure.fold(
await unitOrFailure.fold(
Xazin marked this conversation as resolved.
Show resolved Hide resolved
(failure) => const UsernameState.updateFailure(),
(_) => UsernameState.updateSuccess("$firstName $lastName"),
),
Expand Down
11 changes: 11 additions & 0 deletions lib/domain/core/location.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'package:freezed_annotation/freezed_annotation.dart';

part 'location.freezed.dart';

@freezed
CaglarKullu marked this conversation as resolved.
Show resolved Hide resolved
class Location with _$Location {
const factory Location({
required String code,
required String name,
}) = _Location;
}
Loading