-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from Thesmader/development
v0.1.0+1
- Loading branch information
Showing
87 changed files
with
1,868 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,7 @@ doc/api/ | |
*.js_ | ||
*.js.deps | ||
*.js.map | ||
|
||
#keystore | ||
gogrocy.jks | ||
gogrocy.jks.old |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
.pub/ | ||
/build/ | ||
/android/app/google-services.json | ||
/android/key.properties | ||
|
||
|
||
# Web related | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ gradle-wrapper.jar | |
/gradlew | ||
/gradlew.bat | ||
/local.properties | ||
/key.properties | ||
GeneratedPluginRegistrant.java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions
8
gogrocy/android/app/src/main/res/drawable/launch_background.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Modify this file to customize your launch splash screen --> | ||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:drawable="@android:color/white" /> | ||
<!--<item android:drawable="@android:color/white" />--> | ||
|
||
<!-- You can insert your own image assets here --> | ||
<!-- <item> | ||
<item> | ||
<bitmap | ||
android:gravity="center" | ||
android:src="@mipmap/launch_image" /> | ||
</item> --> | ||
android:src="@mipmap/gogrocy" /> | ||
</item> | ||
</layer-list> |
5 changes: 5 additions & 0 deletions
5
gogrocy/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<background android:drawable="@color/ic_launcher_background"/> | ||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/> | ||
</adaptive-icon> |
5 changes: 5 additions & 0 deletions
5
gogrocy/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<background android:drawable="@color/ic_launcher_background"/> | ||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/> | ||
</adaptive-icon> |
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
BIN
+1.72 KB
(420%)
gogrocy/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 added
BIN
+5.07 KB
gogrocy/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.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.
Binary file modified
BIN
+942 Bytes
(310%)
gogrocy/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 added
BIN
+2.69 KB
gogrocy/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.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.
Binary file modified
BIN
+2.74 KB
(490%)
gogrocy/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 added
BIN
+8.04 KB
gogrocy/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.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.
Binary file modified
BIN
+5.03 KB
(600%)
gogrocy/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 added
BIN
+16 KB
gogrocy/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.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.
Binary file modified
BIN
+8.14 KB
(680%)
gogrocy/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 added
BIN
+26.3 KB
gogrocy/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.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 added
BIN
+16.8 KB
gogrocy/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions
4
gogrocy/android/app/src/main/res/values/ic_launcher_background.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<color name="ic_launcher_background">#005E20</color> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
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.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
enum ViewState { Idle, Busy } |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
class Product { | ||
String id; | ||
String name; | ||
String price; | ||
String quantity; | ||
String unit; | ||
String description; | ||
String timesSold; | ||
String image; | ||
String category; | ||
|
||
Product( | ||
{this.id, | ||
this.name, | ||
this.price, | ||
this.quantity, | ||
this.unit, | ||
this.description, | ||
this.timesSold, | ||
this.image, | ||
this.category}); | ||
|
||
Product.fromJson(Map<String, dynamic> json) { | ||
id = json['id']; | ||
name = json['name']; | ||
price = json['price']; | ||
quantity = json['quantity']; | ||
unit = json['unit']; | ||
description = json['description']; | ||
timesSold = json['times_sold']; | ||
image = json['image']; | ||
category = json['category']; | ||
} | ||
|
||
Map<String, dynamic> toJson() { | ||
final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
data['id'] = this.id; | ||
data['name'] = this.name; | ||
data['price'] = this.price; | ||
data['quantity'] = this.quantity; | ||
data['unit'] = this.unit; | ||
data['description'] = this.description; | ||
data['times_sold'] = this.timesSold; | ||
data['image'] = this.image; | ||
data['category'] = this.category; | ||
return data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
class User {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import 'dart:convert'; | ||
import 'dart:io'; | ||
import 'package:gogrocy/core/models/product.dart'; | ||
import 'package:http/http.dart' as http; | ||
|
||
const String baseUrl = "https://gogrocy.in/api/"; | ||
|
||
class Apis { | ||
static String allProducts = baseUrl + "getProducts"; | ||
static String singleProduct = baseUrl + "getProduct"; | ||
|
||
Future<List<Product>> getAllProducts() async { | ||
var client = new http.Client(); | ||
bool connectionState = await checkStatus(); | ||
if (connectionState) //TODO: Add a proper else return | ||
{ | ||
var products = List<Product>(); | ||
var response = await client.post(allProducts); | ||
var parsed = json.decode(response.body) as List<dynamic>; | ||
for (var product in parsed) { | ||
products.add(Product.fromJson(product)); | ||
} | ||
return products; | ||
} else | ||
(print("Network failure")); | ||
} | ||
|
||
Future<bool> checkStatus() async { | ||
try { | ||
final result = await InternetAddress.lookup('google.com'); | ||
if (result.isNotEmpty && result[0].rawAddress.isNotEmpty) { | ||
print('connected'); | ||
return true; | ||
} | ||
} on SocketException catch (_) { | ||
print('not connected'); | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import 'package:firebase_auth/firebase_auth.dart'; | ||
import 'package:flutter/cupertino.dart'; | ||
|
||
class AuthenticationService { | ||
final firebaseInstance = FirebaseAuth.instance; | ||
String verificationId; | ||
|
||
Future verifyPhoneNumber(BuildContext context, String phoneNumber) async { | ||
final PhoneVerificationCompleted verificationCompleted = | ||
(AuthCredential credential) { | ||
print('Verification Complete'); | ||
signInWithNumber(context, credential); | ||
}; | ||
|
||
final PhoneVerificationFailed verificationFailed = | ||
(AuthException exception) { | ||
print(exception.message); | ||
}; | ||
|
||
final PhoneCodeSent phoneCodeSent = | ||
(String verificationId, [int forceResendingToken]) async { | ||
this.verificationId = verificationId; | ||
print('Code sent: $verificationId'); | ||
}; | ||
|
||
final PhoneCodeAutoRetrievalTimeout retrievalTimeout = | ||
(String verificationId) { | ||
print('Retrieval Timeout: $verificationId'); | ||
}; | ||
|
||
try { | ||
await firebaseInstance.verifyPhoneNumber( | ||
phoneNumber: phoneNumber, | ||
timeout: Duration(seconds: 60), | ||
verificationCompleted: verificationCompleted, | ||
verificationFailed: verificationFailed, | ||
codeSent: phoneCodeSent, | ||
codeAutoRetrievalTimeout: retrievalTimeout); | ||
FirebaseUser currentUser = await firebaseInstance.currentUser(); | ||
return currentUser != null; | ||
} catch (e) { | ||
return e.message; | ||
} | ||
} | ||
|
||
signInWithNumber(BuildContext context, AuthCredential credential) async { | ||
FirebaseUser user = | ||
(await firebaseInstance.signInWithCredential(credential)).user; | ||
FirebaseUser currentUser = await firebaseInstance.currentUser(); | ||
assert(user.uid == currentUser.uid); | ||
} | ||
|
||
Future signInWithOtp(String verificationId, String otp) async { | ||
try { | ||
AuthCredential credential = PhoneAuthProvider.getCredential( | ||
verificationId: verificationId, smsCode: otp); | ||
FirebaseUser currentUser = | ||
(await firebaseInstance.signInWithCredential(credential)).user; | ||
return currentUser != null; | ||
} catch (e) { | ||
return e.message; | ||
} | ||
} | ||
|
||
Future<bool> isUserLoggedIn() async { | ||
var user = await firebaseInstance.currentUser(); | ||
return user != null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class BottomNavBarProvider with ChangeNotifier{ | ||
int _currentIndex=0; | ||
|
||
get currentIndex=> _currentIndex; | ||
|
||
set currentIndex(int index){ | ||
print("Changed index to $index"); | ||
_currentIndex=index; | ||
notifyListeners(); | ||
} | ||
|
||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class NavigationService { | ||
static final GlobalKey<NavigatorState> navigatorKey = | ||
GlobalKey<NavigatorState>(); | ||
|
||
Future<dynamic> navigateTo(String routeName, {dynamic arguments}) async { | ||
return navigatorKey.currentState.pushNamed(routeName, arguments: arguments); | ||
} | ||
|
||
bool goBack() { | ||
return navigatorKey.currentState.pop(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import 'package:shared_preferences/shared_preferences.dart'; | ||
|
||
class SharedPrefs { | ||
SharedPreferences _sharedPrefs; | ||
|
||
SharedPrefs() { | ||
initSharedPrefs(); | ||
} | ||
|
||
initSharedPrefs() async{ | ||
_sharedPrefs=await SharedPreferences.getInstance(); | ||
} | ||
|
||
setJWT(String s) async{ | ||
_sharedPrefs.setString("jwt",s); | ||
} | ||
|
||
Future<String> getJWT() async{ | ||
String jwt = _sharedPrefs.getString("jwt"); | ||
return jwt; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import 'package:gogrocy/core/enums/viewstate.dart'; | ||
import 'package:gogrocy/core/models/product.dart'; | ||
import 'package:gogrocy/core/services/api.dart'; | ||
import 'package:gogrocy/core/viewModels/base_model.dart'; | ||
import 'package:gogrocy/service_locator.dart'; | ||
|
||
class AllProductsModel extends BaseModel{ | ||
Apis _apis=locator<Apis>(); | ||
|
||
List<Product> allProducts; | ||
|
||
Future getAllProducts() async{ | ||
setState(ViewState.Busy); | ||
allProducts=await _apis.getAllProducts(); | ||
setState(ViewState.Idle); | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.