Skip to content

Commit

Permalink
Merge pull request #97 from praveenkrishna0512/bugs
Browse files Browse the repository at this point in the history
fixed some bugs
  • Loading branch information
summerthia02 authored Jul 25, 2022
2 parents c4d9e80 + 69727a5 commit b3cfeb7
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
platform :ios, '12.0'
platform :ios, '14.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
2 changes: 1 addition & 1 deletion lib/firebase/firestore_keys.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class FirestoreUserKeys {
static const String shareCredits = "share_credits";
static const String listings = "listings";
static const String reviews = "reviews";
static const String chattingWith = "chatting_with";
static const String chats = "chats";
}

class FirestoreGeneralKeys {
Expand Down
9 changes: 9 additions & 0 deletions lib/firebase/firestore_methods.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,21 @@ class FireStoreMethods {
await listingsCollection.doc(listingId).update({
'usersLiked': FieldValue.arrayRemove([uid])
});

listingsCollection
.doc(listingId)
.update({'likeCount': FieldValue.increment(-1)});
} else {
// else we need to add uid to the likes array
await listingsCollection.doc(listingId).update({
'usersLiked': FieldValue.arrayUnion([uid])
});

listingsCollection
.doc(listingId)
.update({'likeCount': FieldValue.increment(1)});
}

res = 'success';
} catch (err) {
res = err.toString();
Expand Down
2 changes: 1 addition & 1 deletion lib/firebase/user_data_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class UserDataService {
'listings': [],
'reviews': [],
'share_credits': "500",
'chatting_with': []
'chats': []
});
}

Expand Down
3 changes: 2 additions & 1 deletion lib/models/reviews_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ class _ReviewCardState extends State<ReviewCard> {
),
],
),
Container(
SizedBox(
width: 150,
child: Text(widget.snap["description"]),
),
SizedBox(
Expand Down
8 changes: 2 additions & 6 deletions lib/pages/addListing.dart
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ class _AddListingPageState extends State<AddListingPage> {
return Container(
padding: const EdgeInsets.only(top: 20, right: 20),
child: SizedBox(
width: 230,
width: 225,
height: height,
child: TextField(
minLines: numLines,
Expand Down Expand Up @@ -505,13 +505,9 @@ class _AddListingPageState extends State<AddListingPage> {
const SizedBox(height: 10.0),
Row(children: <Widget>[
buildFormTitle("ShareCredits"),
const Expanded(
child: SizedBox(
width: 5,
)),
Container(
child: buildFormField(
"ShareCredits (lending) ", _shareCreditsController),
"ShareCreds(lending) ", _shareCreditsController),
),
]),
const SizedBox(height: 10.0),
Expand Down
4 changes: 1 addition & 3 deletions lib/pages/login_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ class _LoginPageState extends State<LoginPage> {
key: Key("Email"),
keyboardType: TextInputType.emailAddress,
validator: (value) => EmailFieldValidation.validate(value!),

textAlign: TextAlign.center,
controller: _emailController,
decoration: kTextFormFieldDecoration.copyWith(
Expand All @@ -118,7 +117,6 @@ class _LoginPageState extends State<LoginPage> {
key: Key("Password"),
obscureText: true,
validator: (value) => PasswordFieldValidation.validate(value!),

textAlign: TextAlign.center,
controller: _passwordController,
decoration: kTextFormFieldDecoration.copyWith(
Expand All @@ -135,8 +133,8 @@ class _LoginPageState extends State<LoginPage> {
onPressed: _isLoading
? null
: () async {

_signIn();
Navigator.pushReplacementNamed(context, "/feed");
},
child: _isLoading
? const Center(
Expand Down

0 comments on commit b3cfeb7

Please sign in to comment.