Skip to content

Commit

Permalink
Merge pull request #13 from viniciusamelio/refactor/notificator
Browse files Browse the repository at this point in the history
Refactor/notificator
  • Loading branch information
viniciusamelio authored Oct 19, 2023
2 parents c644bfc + f8ef560 commit 2efdf5e
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 9 deletions.
9 changes: 9 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# 1.2.2
## Added
- notificator call through SDK instead of http call

## Fixed
- multiple "first-time" feed loading
- multiple new praise reaction
- project name on settings screen

# 1.2.1
## Added
- protection against rooted/jailbroken devices
Expand Down
1 change: 1 addition & 0 deletions lib/contexts/feed/presentation/screens/feed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ class _FeedScreenState extends State<FeedScreen> {
bool isTop = scrollController.position.pixels == 0;
if (!isTop &&
controller.state.value is SuccessState &&
(controller.state.value as SuccessState).data.length > 0 &&
(controller.state.value as SuccessState).data.length ==
controller.max) {
scrollController.saveCurrentPosition();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ProjectSupportSection extends StatelessWidget {
text: "Você pode contribuir diretamente com o desenvolvimento do",
children: [
TextSpan(
text: " Sur#praise",
text: " #surpraise",
style: theme.fontScheme.p2.copyWith(
color: theme.colorScheme.accentColor,
),
Expand Down
5 changes: 3 additions & 2 deletions lib/shared/presentation/controllers/praise.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import '../../../core/external_dependencies.dart' hide CommunityRepository;
import '../../dtos/user.dart';
import '../dtos/dtos.dart';

abstract class PraiseController extends BaseStateController<void> {
abstract class PraiseController extends BaseStateController<PraiseOutput> {
AtomNotifier<int> get activeStep;
AtomNotifier<DefaultState<Exception, UserDto>> get userState;
AtomNotifier<DefaultState<Exception, List<FindCommunityOutput>>>
Expand All @@ -18,7 +18,7 @@ abstract class PraiseController extends BaseStateController<void> {
}

class DefaultPraiseController
with BaseState<Exception, void>
with BaseState<Exception, PraiseOutput>
implements PraiseController {
DefaultPraiseController({
required PraiseUsecase praiseUsecase,
Expand Down Expand Up @@ -97,6 +97,7 @@ class DefaultPraiseController
userState.set(InitialState());
communitiesState.removeListeners();
userState.removeListeners();
state.removeListeners();
state.set(InitialState());
formData.praisedTag = null;
}
Expand Down
8 changes: 8 additions & 0 deletions lib/shared/presentation/organisms/new_praise_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ class _NewPraiseSheetState extends State<NewPraiseSheet> {
);
controller.state.listenState(
onSuccess: (right) {
if (right.praiseData != null) {
injected<SupabaseCloudClient>().supabase.functions.invoke(
"notificator",
body: {"praise": right.praiseData!},
responseType: ResponseType.text,
);
}

const SuccessSnack(message: "Praise enviado!").show(context: context);
Navigator.of(context).pop();
},
Expand Down
8 changes: 4 additions & 4 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -541,10 +541,10 @@ packages:
dependency: "direct main"
description:
name: font_awesome_flutter
sha256: "5fb789145cae1f4c3245c58b3f8fb287d055c26323879eab57a7bf0cfd1e45f3"
sha256: "52671aea66da73b58d42ec6d0912b727a42248dd9a7c76d6c20f275783c48c08"
url: "https://pub.dev"
source: hosted
version: "10.5.0"
version: "10.6.0"
freezed_annotation:
dependency: transitive
description:
Expand Down Expand Up @@ -1356,7 +1356,7 @@ packages:
description:
path: "."
ref: HEAD
resolved-ref: "85ed0ecc14a3c239692caab7bc74667bc25d31c3"
resolved-ref: "9abc8b3d026217761a82454594f9e2343a6fbedf"
url: "https://github.com/viniciusamelio/surpraise_core"
source: git
version: "1.0.0"
Expand All @@ -1365,7 +1365,7 @@ packages:
description:
path: "."
ref: "feat/supabase-migration"
resolved-ref: "810a3be35447cc91da925c65a3b7a680c077d2ab"
resolved-ref: "544aa00dfd531ae1e3c2be32f8c5a0ff2edf28cd"
url: "https://github.com/viniciusamelio/surpraise_infra"
source: git
version: "1.0.0"
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.2.1+6
version: 1.2.2+7

environment:
sdk: '>=3.0.0 <4.0.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void main() {

when(
() => praiseUsecase.call(any()),
).thenAnswer((invocation) async => Right(PraiseOutput()));
).thenAnswer((invocation) async => Right(const PraiseOutput()));

sut = const NewPraiseSheet();
});
Expand Down

0 comments on commit 2efdf5e

Please sign in to comment.