Skip to content

Commit

Permalink
communities:the stream is now emptied on each call
Browse files Browse the repository at this point in the history
  • Loading branch information
VIBR0X committed Dec 15, 2023
1 parent d3d9eb2 commit ac76c0c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion lib/src/api/apiclient.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ part 'apiclient.g.dart';

//@rt.RestApi(baseUrl: "http://192.168.1.103:8000/api")
// @rt.RestApi(baseUrl: "http://10.105.177.150/api")
@rt.RestApi(baseUrl: "https://0d01-2405-201-5004-3e45-7431-160c-1fa7-d48.ngrok-free.app/api")
@rt.RestApi(baseUrl: "https://gymkhana.iitb.ac.in/instiapp/api")
// @rt.RestApi(baseUrl: "https://272c-2405-201-5004-3c2f-d836-b028-6ac-ad9.ngrok-free.app/api")
abstract class InstiAppApi {
factory InstiAppApi(Dio dio, {String baseUrl}) = _InstiAppApi;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/api/apiclient.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions lib/src/blocs/community_post_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ class CommunityPostBloc {
// _communityPosts = defCommunities;
// _communitySubject.add(defCommunities);
// print("refresh");

_communitySubject.add([]);
if (id == null) {
_communitySubject.add([]);
return;
}

Expand All @@ -66,8 +67,8 @@ class CommunityPostBloc {
break;
}
_communityPosts = (await bloc.client.getCommunityPosts(
bloc.getSessionIdHeader(), status, query, id))
.data ??
bloc.getSessionIdHeader(), status, query, id))
.data ??
[];

// print("community" + _communityPosts.toString());
Expand Down
18 changes: 5 additions & 13 deletions lib/src/routes/communitydetails.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import 'dart:async';

import 'package:InstiApp/src/api/model/community.dart';
import 'package:InstiApp/src/api/model/communityPost.dart';
import 'package:InstiApp/src/api/model/user.dart';
import 'package:InstiApp/src/blocs/community_bloc.dart';
import 'package:InstiApp/src/blocs/community_post_bloc.dart';
import 'package:InstiApp/src/api/model/communityPost.dart';
import 'package:InstiApp/src/routes/createpost_form.dart';
import 'package:InstiApp/src/utils/customappbar.dart';
import 'package:InstiApp/src/drawer.dart';
import 'package:InstiApp/src/routes/createpost_form.dart';
import 'package:InstiApp/src/utils/common_widgets.dart';
import 'package:InstiApp/src/utils/customappbar.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';

import '../bloc_provider.dart';

Expand Down Expand Up @@ -494,15 +494,7 @@ class _CommunityPostSectionState extends State<CommunityPostSection> {
var theme = Theme.of(context);
var bloc = BlocProvider.of(context)!.bloc;
var communityPostBloc = bloc.communityPostBloc;
() async {
setState(() {
loading = true;
cpType = CPType.All;
});
await communityPostBloc.refresh(
type: CPType.All,
id: widget.community?.id);
};

loading=false;
if (firstBuild) {
communityPostBloc.query = "";
Expand Down

0 comments on commit ac76c0c

Please sign in to comment.