Skip to content

Commit

Permalink
Merge pull request #407 from CollActionteam/development
Browse files Browse the repository at this point in the history
Development to Production
  • Loading branch information
Xazin committed Jun 29, 2023
2 parents f5ca8c1 + 55de4cb commit b012f1a
Show file tree
Hide file tree
Showing 92 changed files with 504 additions and 616 deletions.
47 changes: 0 additions & 47 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -287,53 +287,6 @@ jobs:
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db
rm ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.mobileprovision
deploy_widgetbook:
needs: [analyze, test]
runs-on: ubuntu-latest
env:
WIDGETBOOK_API_KEY: ${{ secrets.WIDGETBOOK_API_KEY }}
steps:
- name: Fetch code from cache
id: code-cache
uses: actions/cache@v3
with:
path: .
key: code-cache-${{ github.sha }}
restore-keys: |
code-cache-${{ github.sha }}
code-cache-
code-cache
- name: Cache Flutter install
uses: actions/cache@v3
with:
# Linux (deprecate):
# path: /opt/hostedtoolcache/flutter
# MacOS:
path: /Users/runner/hostedtoolcache/flutter
key: cache-flutter-${{ env.flutter_channel }}-${{ env.flutter_version }}-${{ runner.os }}

- name: Setup the Flutter environment
uses: subosito/flutter-action@v2
with:
channel: ${{ env.flutter_channel }}
flutter-version: ${{ env.flutter_version }}

- name: Install Widgetbook CLI
run: dart pub global activate widgetbook_cli 3.0.0-beta.13

- name: Get Flutter dependencies
run: flutter pub get .

- name: Build web
run: |
echo ${{ secrets.ENV }} | base64 -d > .env
flutter build web -t lib/widgetbook/app.widgetbook.dart
- name: Publish to Widgetbook
if: github.event_name != 'pull_request'
run: widgetbook publish --api-key $WIDGETBOOK_API_KEY

distribute_android:
environment: ${{ github.ref == 'refs/heads/master' && 'production' || 'development' }}
needs: [build_android]
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/icons/app_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
1 change: 1 addition & 0 deletions lib/application/auth/auth_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
);
}

// TODO: Move to ProfileBloc
FutureOr<void> _mapUpdateProfilePhotoToState(
Emitter<AuthState> emit,
_UpdateProfilePhoto event,
Expand Down
8 changes: 5 additions & 3 deletions lib/application/user/profile/profile_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
});

on<EditProfilePic>((event, emit) {
emit(state.copyWith(isPicEditing: true));
emit(state.copyWith(isPicEditing: true, didPicSaveFail: false));
});

on<SaveBio>((event, emit) async {
Expand All @@ -69,12 +69,14 @@ class ProfileBloc extends Bloc<ProfileEvent, ProfileState> {
await _avatarRepository.uploadAvatar(event.image!);
}

// TODO handle could not upload profile picture!
final userOrFailure = await _profileRepository.getUserProfile();

emit(
userOrFailure.fold(
(failure) => state.copyWith(isPicEditing: false),
(failure) => state.copyWith(
isPicEditing: false,
didPicSaveFail: true,
),
(userProfile) => state.copyWith(
userProfile: userProfile,
isPicEditing: false,
Expand Down
14 changes: 12 additions & 2 deletions lib/application/user/profile/profile_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,46 @@ class ProfileState extends Equatable {
this.isPicEditing,
this.isBioEditing,
this.wasProfilePictureUpdated,
this.didPicSaveFail,
});

final UserProfile? userProfile;
final bool? isPicEditing;
final bool? isBioEditing;
final bool? wasProfilePictureUpdated;
final bool? didPicSaveFail;

factory ProfileState.initial() => const ProfileState(
userProfile: null,
isPicEditing: false,
isBioEditing: false,
wasProfilePictureUpdated: false,
didPicSaveFail: false,
);

ProfileState copyWith({
UserProfile? userProfile,
bool? isPicEditing,
bool? isBioEditing,
bool? wasProfilePictureUpdated,
bool? didPicSaveFail,
}) {
return ProfileState(
userProfile: userProfile ?? this.userProfile,
isPicEditing: isPicEditing ?? this.isPicEditing,
isBioEditing: isBioEditing ?? this.isBioEditing,
wasProfilePictureUpdated:
wasProfilePictureUpdated ?? false, // Reset state implicitly
didPicSaveFail: didPicSaveFail ?? this.didPicSaveFail,
);
}

@override
List<Object?> get props =>
[userProfile, isPicEditing, isBioEditing, wasProfilePictureUpdated];
List<Object?> get props => [
userProfile,
isPicEditing,
isBioEditing,
wasProfilePictureUpdated,
didPicSaveFail
];
}
7 changes: 3 additions & 4 deletions lib/presentation/auth/auth_screen.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import 'package:auto_route/auto_route.dart';
import 'package:dots_indicator/dots_indicator.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';

import '../../application/auth/auth_bloc.dart';
import '../../application/user/profile/profile_bloc.dart';
import '../routes/app_routes.gr.dart';
import '../routes/app_routes.dart';
import '../shared_widgets/custom_app_bars/custom_appbar.dart';
import '../themes/constants.dart';
import '../utils/context.ext.dart';
Expand Down Expand Up @@ -115,8 +115,7 @@ class AuthPageState extends State<AuthPage> {
);
}

void _authDone(BuildContext context) =>
context.router.replaceAll([const VerifiedRoute()]);
void _authDone(BuildContext context) => context.go(AppPage.verified.path);

void _toPage(int page) => _pageController.animateToPage(
page,
Expand Down
12 changes: 6 additions & 6 deletions lib/presentation/auth/unauthenticated_screen.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

import '../routes/app_routes.gr.dart';
import '../shared_widgets/pill_button.dart';
import '../themes/constants.dart';
import '../../domain/core/i_settings_repository.dart';
import '../../infrastructure/core/injection.dart';
import '../routes/app_routes.dart';
import '../shared_widgets/pill_button.dart';
import '../themes/constants.dart';

class UnauthenticatedPage extends StatelessWidget {
@override
Expand Down Expand Up @@ -51,7 +51,7 @@ class UnauthenticatedPage extends StatelessWidget {
text: 'Log In',
isEnabled: true,
isLoading: false,
onTap: () => context.router.push(const AuthRoute()),
onTap: () => context.push(AppPage.auth.path),
lightBackground: true,
),
const SizedBox(height: 80),
Expand All @@ -66,7 +66,7 @@ class UnauthenticatedPage extends StatelessWidget {
// Push onboarding screen if first time launching application
final settingsRepository = getIt<ISettingsRepository>();
if (!(await settingsRepository.getWasUserOnboarded())) {
context.router.push(const OnboardingRoute());
context.push(AppPage.onBoarding.path);
}
}
}
6 changes: 2 additions & 4 deletions lib/presentation/auth/widgets/profile_photo.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'dart:io';

import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';

import '../../../application/auth/auth_bloc.dart';
import '../../../application/user/avatar/avatar_bloc.dart';
Expand Down Expand Up @@ -42,9 +42,7 @@ class SelectProfilePhotoState extends State<SelectProfilePhoto> {
uploading: () {
/// TODO: Loading indication
},
uploadSuccess: () {
context.router.pop();
},
uploadSuccess: context.pop,
uploadFailed: () {
/// TODO: Show error snackbar | Implement failures
},
Expand Down
10 changes: 4 additions & 6 deletions lib/presentation/auth/widgets/verified.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:rive/rive.dart';
import 'package:shimmer/shimmer.dart';

import '../../../application/user/profile/profile_bloc.dart';
import '../../../infrastructure/core/injection.dart';
import '../../routes/app_routes.gr.dart';
import '../../routes/app_routes.dart';
import '../../shared_widgets/pill_button.dart';
import '../../shared_widgets/shimmers/title_shimmer_line.dart';
import '../../themes/constants.dart';
Expand Down Expand Up @@ -80,13 +80,11 @@ class VerifiedPage extends StatelessWidget {
),
const SizedBox(height: 40),
PillButton(
onTap: () =>
context.router.replaceAll([const HomeRoute()]),
onTap: () => context.go(AppPage.home.path),
text: 'Go to CrowdActions',
),
TextButton(
onPressed: () =>
context.router.replaceAll([const HomeRoute()]),
onPressed: () => context.go(AppPage.home.path),
child: const Text(
'Show me all CrowdActions',
style: TextStyle(
Expand Down
34 changes: 19 additions & 15 deletions lib/presentation/core/app_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import '../../application/auth/auth_bloc.dart';
import '../../application/user/profile/profile_bloc.dart';
import '../../application/user/profile_tab/profile_tab_bloc.dart';
import '../../infrastructure/core/injection.dart';
import '../routes/app_routes.gr.dart';

import '../routes/app_routes.dart';
import '../themes/themes.dart';

class AppWidget extends StatelessWidget {
Expand All @@ -16,32 +17,35 @@ class AppWidget extends StatelessWidget {
return MultiBlocProvider(
providers: [
BlocProvider<AuthBloc>(
create: (_) => getIt<AuthBloc>()..add(AuthEvent.initial()),
),
BlocProvider<ProfileBloc>(
create: (_) => getIt<ProfileBloc>()..add(GetUserProfile()),
create: (_) => getIt<AuthBloc>()..add(AuthEvent.authCheckRequested()),
),
BlocProvider<ProfileTabBloc>(
create: (_) => getIt<ProfileTabBloc>()..add(FetchProfileTabInfo()),
)
BlocProvider<ProfileBloc>(create: (_) => getIt<ProfileBloc>()),
BlocProvider<ProfileTabBloc>(create: (_) => getIt<ProfileTabBloc>())
],
child: BlocListener<AuthBloc, AuthState>(
listener: (context, state) {
BlocProvider.of<ProfileBloc>(context).add(GetUserProfile());
BlocProvider.of<ProfileTabBloc>(context).add(FetchProfileTabInfo());

state.whenOrNull(
state.maybeWhen(
authenticated: (_) {
BlocProvider.of<ProfileBloc>(context).add(GetUserProfile());
BlocProvider.of<ProfileTabBloc>(context)
.add(FetchProfileTabInfo());
},
loggedIn: (_) {
BlocProvider.of<ProfileBloc>(context).add(GetUserProfile());
BlocProvider.of<ProfileTabBloc>(context)
.add(FetchProfileTabInfo());
},
unauthenticated: () {
_appRouter.replaceAll([const UnauthenticatedRoute()]);
_appRouter.router.go(AppPage.unauthenticated.path);
},
orElse: () {},
);
},
child: MaterialApp.router(
color: Colors.white,
title: 'CollAction',
theme: lightTheme(),
routerDelegate: _appRouter.delegate(),
routeInformationParser: _appRouter.defaultRouteParser(),
routerConfig: _appRouter.router,
),
),
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

import '../../../core/core.dart';
import '../../../domain/crowdaction/crowdaction_comment.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class CommentAppBarDelegate extends SliverPersistentHeaderDelegate {
child: IconButton(
icon: const Icon(CollactionIcons.left),
iconSize: 24,
onPressed: () => context.router.pop(),
onPressed: context.pop,
color: Colors.white,
),
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

import '../../../shared_widgets/pill_button.dart';
import '../../../shared_widgets/selectable_chip.dart';
Expand Down Expand Up @@ -145,7 +145,7 @@ class FlagDialogState extends State<FlagDialog> {
width: double.infinity,
height: 52,
child: TextButton(
onPressed: () => context.router.pop(),
onPressed: context.pop,
child: const Text("Cancel"),
),
),
Expand Down Expand Up @@ -217,9 +217,7 @@ class FlagSuccess extends StatelessWidget {
),
PillButton(
text: "Got it",
onTap: () {
context.router.pop();
},
onTap: context.pop,
margin: EdgeInsets.zero,
),
const SizedBox(height: 20),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';

import '../../../../domain/crowdaction/crowdaction.dart';
import '../../../../infrastructure/core/injection.dart';
import '../../../application/auth/auth_bloc.dart';
import '../../../application/crowdaction/crowdaction_details/crowdaction_details_bloc.dart';
import '../../../application/participation/participation_bloc.dart';
import '../../../application/user/profile_tab/profile_tab_bloc.dart';
import '../../routes/app_routes.gr.dart';

import '../../routes/app_routes.dart';
import '../../shared_widgets/commitments/commitment_card_list.dart';
import '../../shared_widgets/pill_button.dart';
import '../../themes/constants.dart';
Expand Down Expand Up @@ -348,7 +349,6 @@ class CrowdActionDetailsPageState extends State<CrowdActionDetailsPage> {
}

void _createAccount(BuildContext context) {
context.router.pop();
context.router.push(const AuthRoute());
context.go(AppPage.auth.path);
}
}
Loading

0 comments on commit b012f1a

Please sign in to comment.