Skip to content

Commit

Permalink
Merge pull request #2 from tanweer919/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
tanweer919 authored Jul 24, 2020
2 parents 9cbba1e + a6506ee commit bca54aa
Show file tree
Hide file tree
Showing 52 changed files with 2,188 additions and 451 deletions.
3 changes: 3 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ android {
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}

buildTypes {
Expand All @@ -61,3 +62,5 @@ flutter {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

apply plugin: 'com.google.gms.google-services'
48 changes: 48 additions & 0 deletions android/app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"project_info": {
"project_number": "941839892238",
"firebase_url": "https://football-mojo.firebaseio.com",
"project_id": "football-mojo",
"storage_bucket": "football-mojo.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:941839892238:android:cf75eb4875370f0cac215f",
"android_client_info": {
"package_name": "com.example.sportsmojo"
}
},
"oauth_client": [
{
"client_id": "941839892238-5brsr913u4pbe9cppcq6ch0s507msjjt.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.example.sportsmojo",
"certificate_hash": "6ab1580b9c5164660d0fed14658959d0002689c2"
}
},
{
"client_id": "941839892238-156mnil47ubu5nmgvgpj64c5g7flg6vp.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAvqa03yfFA8iiMuUdfvYUAiqPeLG4O_ek"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "941839892238-156mnil47ubu5nmgvgpj64c5g7flg6vp.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
1 change: 1 addition & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.3'
}
}

Expand Down
Binary file added assets/images/google_logo.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 assets/images/user-placeholder.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions ios/Flutter/Generated 19.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This is a generated file; do not edit or check into version control.
FLUTTER_ROOT=/Users/tanweeranwar/Downloads/flutter/flutter
FLUTTER_APPLICATION_PATH=/Users/tanweeranwar/Documents/flutter/sportsmojo
FLUTTER_TARGET=lib/main.dart
FLUTTER_BUILD_DIR=build
SYMROOT=${SOURCE_ROOT}/../build/ios
OTHER_LDFLAGS=$(inherited) -framework Flutter
FLUTTER_FRAMEWORK_DIR=/Users/tanweeranwar/Downloads/flutter/flutter/bin/cache/artifacts/engine/ios
FLUTTER_BUILD_NAME=1.0.0
FLUTTER_BUILD_NUMBER=1
10 changes: 10 additions & 0 deletions ios/Flutter/Generated 20.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This is a generated file; do not edit or check into version control.
FLUTTER_ROOT=/Users/tanweeranwar/Downloads/flutter/flutter
FLUTTER_APPLICATION_PATH=/Users/tanweeranwar/Documents/flutter/sportsmojo
FLUTTER_TARGET=lib/main.dart
FLUTTER_BUILD_DIR=build
SYMROOT=${SOURCE_ROOT}/../build/ios
OTHER_LDFLAGS=$(inherited) -framework Flutter
FLUTTER_FRAMEWORK_DIR=/Users/tanweeranwar/Downloads/flutter/flutter/bin/cache/artifacts/engine/ios
FLUTTER_BUILD_NAME=1.0.0
FLUTTER_BUILD_NUMBER=1
10 changes: 10 additions & 0 deletions ios/Flutter/Generated 21.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This is a generated file; do not edit or check into version control.
FLUTTER_ROOT=/Users/tanweeranwar/Downloads/flutter/flutter
FLUTTER_APPLICATION_PATH=/Users/tanweeranwar/Documents/flutter/sportsmojo
FLUTTER_TARGET=lib/main.dart
FLUTTER_BUILD_DIR=build
SYMROOT=${SOURCE_ROOT}/../build/ios
OTHER_LDFLAGS=$(inherited) -framework Flutter
FLUTTER_FRAMEWORK_DIR=/Users/tanweeranwar/Downloads/flutter/flutter/bin/cache/artifacts/engine/ios
FLUTTER_BUILD_NAME=1.0.0
FLUTTER_BUILD_NUMBER=1
10 changes: 10 additions & 0 deletions ios/Flutter/Generated 22.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This is a generated file; do not edit or check into version control.
FLUTTER_ROOT=/Users/tanweeranwar/Downloads/flutter/flutter
FLUTTER_APPLICATION_PATH=/Users/tanweeranwar/Documents/flutter/sportsmojo
FLUTTER_TARGET=lib/main.dart
FLUTTER_BUILD_DIR=build
SYMROOT=${SOURCE_ROOT}/../build/ios
OTHER_LDFLAGS=$(inherited) -framework Flutter
FLUTTER_FRAMEWORK_DIR=/Users/tanweeranwar/Downloads/flutter/flutter/bin/cache/artifacts/engine/ios
FLUTTER_BUILD_NAME=1.0.0
FLUTTER_BUILD_NUMBER=1
10 changes: 10 additions & 0 deletions ios/Flutter/Generated 23.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This is a generated file; do not edit or check into version control.
FLUTTER_ROOT=/Users/tanweeranwar/Downloads/flutter/flutter
FLUTTER_APPLICATION_PATH=/Users/tanweeranwar/Documents/flutter/sportsmojo
FLUTTER_TARGET=lib/main.dart
FLUTTER_BUILD_DIR=build
SYMROOT=${SOURCE_ROOT}/../build/ios
OTHER_LDFLAGS=$(inherited) -framework Flutter
FLUTTER_FRAMEWORK_DIR=/Users/tanweeranwar/Downloads/flutter/flutter/bin/cache/artifacts/engine/ios
FLUTTER_BUILD_NAME=1.0.0
FLUTTER_BUILD_NUMBER=1
10 changes: 10 additions & 0 deletions ios/Flutter/Generated 24.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This is a generated file; do not edit or check into version control.
FLUTTER_ROOT=/Users/tanweeranwar/Downloads/flutter/flutter
FLUTTER_APPLICATION_PATH=/Users/tanweeranwar/Documents/flutter/sportsmojo
FLUTTER_TARGET=lib/main.dart
FLUTTER_BUILD_DIR=build
SYMROOT=${SOURCE_ROOT}/../build/ios
OTHER_LDFLAGS=$(inherited) -framework Flutter
FLUTTER_FRAMEWORK_DIR=/Users/tanweeranwar/Downloads/flutter/flutter/bin/cache/artifacts/engine/ios
FLUTTER_BUILD_NAME=1.0.0
FLUTTER_BUILD_NUMBER=1
11 changes: 11 additions & 0 deletions ios/Flutter/flutter_export_environment 20.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Users/tanweeranwar/Downloads/flutter/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/tanweeranwar/Documents/flutter/sportsmojo"
export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "OTHER_LDFLAGS=$(inherited) -framework Flutter"
export "FLUTTER_FRAMEWORK_DIR=/Users/tanweeranwar/Downloads/flutter/flutter/bin/cache/artifacts/engine/ios"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
11 changes: 11 additions & 0 deletions ios/Flutter/flutter_export_environment 21.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Users/tanweeranwar/Downloads/flutter/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/tanweeranwar/Documents/flutter/sportsmojo"
export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "OTHER_LDFLAGS=$(inherited) -framework Flutter"
export "FLUTTER_FRAMEWORK_DIR=/Users/tanweeranwar/Downloads/flutter/flutter/bin/cache/artifacts/engine/ios"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
11 changes: 11 additions & 0 deletions ios/Flutter/flutter_export_environment 22.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Users/tanweeranwar/Downloads/flutter/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/tanweeranwar/Documents/flutter/sportsmojo"
export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "OTHER_LDFLAGS=$(inherited) -framework Flutter"
export "FLUTTER_FRAMEWORK_DIR=/Users/tanweeranwar/Downloads/flutter/flutter/bin/cache/artifacts/engine/ios"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
11 changes: 11 additions & 0 deletions ios/Flutter/flutter_export_environment 23.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Users/tanweeranwar/Downloads/flutter/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/tanweeranwar/Documents/flutter/sportsmojo"
export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "OTHER_LDFLAGS=$(inherited) -framework Flutter"
export "FLUTTER_FRAMEWORK_DIR=/Users/tanweeranwar/Downloads/flutter/flutter/bin/cache/artifacts/engine/ios"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
11 changes: 11 additions & 0 deletions ios/Flutter/flutter_export_environment 24.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Users/tanweeranwar/Downloads/flutter/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/tanweeranwar/Documents/flutter/sportsmojo"
export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "OTHER_LDFLAGS=$(inherited) -framework Flutter"
export "FLUTTER_FRAMEWORK_DIR=/Users/tanweeranwar/Downloads/flutter/flutter/bin/cache/artifacts/engine/ios"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
11 changes: 0 additions & 11 deletions lib/Provider/AllScoresViewModel.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
import 'package:flutter/material.dart';
import '../models/Score.dart';
class AllScoresViewModel extends ChangeNotifier {
String _selectedLeague;

AllScoresViewModel(this._selectedLeague);


String get selectedLeague => _selectedLeague;

void set selectedLeague(String league) {
_selectedLeague = league;
notifyListeners();
}

}
142 changes: 117 additions & 25 deletions lib/Provider/AppProvider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,108 @@ import '../services/NewsService.dart';
import '../services/LocalStorage.dart';
import '../services/GetItLocator.dart';
import '../models/News.dart';
import '../constants.dart';
import '../models/LeagueTable.dart';
import '../services/LeagueTableService.dart';
import '../services/TopScorerService.dart';
import '../models/Player.dart';
import '../models/User.dart';
import '../services/FirebaseService.dart';
class AppProvider extends ChangeNotifier {
AppProvider(this._navbarIndex, this._selectedLeague, this._startDate, this._endDate, this._currentUser);
int _navbarIndex;
List<News> _newsList;
List<News> _favouriteNewsList;
List<Score> _leagueWiseScores;

List<LeagueTableEntry> _leagueTableEntries;
DateTime _startDate;
DateTime _endDate;
List<Score> _favouriteTeamScores;
AppProvider(this._navbarIndex);
String _selectedLeague;
List<Player> _topScorers;
User _currentUser;

NewsService _newsService = locator<NewsService>();
ScoreService _scoreService = locator<ScoreService>();
LeagueTableService _leagueTableService = locator<LeagueTableService>();
TopScorerService _topScorerService = locator<TopScorerService>();

int get navbarIndex => _navbarIndex;

String get selectedLeague => _selectedLeague;

List<News> get newsList => _newsList;
List<News> get favouriteNewsList => _favouriteNewsList;
List<Score> get favouriteTeamScores => _favouriteTeamScores;
List<Score> get leagueWiseScores => _leagueWiseScores;

DateTime get startDate => _startDate;
DateTime get endDate => _endDate;

List<LeagueTableEntry> get leagueTableEntries => _leagueTableEntries;
List<Player> get topScorers => _topScorers;
User get currentUser => _currentUser;

void set selectedLeague(String league) {
_selectedLeague = league;
notifyListeners();
}

void set navbarIndex(int index) {
_navbarIndex = index;
notifyListeners();
}
NewsService _newsService = locator<NewsService>();
ScoreService _scoreService = locator<ScoreService>();


void set newsList(List<News> news) {
_newsList = news;
notifyListeners();
}

void set favouriteNewsList(List<News> news) {
if(news != null) {
_favouriteNewsList = news.sublist(0, 4);
}
else {
_favouriteNewsList = news;
}
notifyListeners();
}

void set favouriteTeamScores(List<Score> scores) {
_favouriteTeamScores = scores;
notifyListeners();
}

void set leagueWiseScores(List<Score> scores) {
_leagueWiseScores = scores;
notifyListeners();
}

void set startDate(DateTime date) {
_startDate = date;
notifyListeners();
}

void set endDate(DateTime date) {
_endDate = date;
notifyListeners();
}

void set currentUser(User user) {
_currentUser = user;
notifyListeners();
}

void set leagueTableEntries(List<LeagueTableEntry> newLeagueTable) {
_leagueTableEntries = newLeagueTable;
notifyListeners();
}

void set topScorers(List<Player> scorers) {
_topScorers = scorers;
notifyListeners();
}

Future<void> loadAllNews() async{
_newsList = await _newsService.fetchNews('football');
notifyListeners();
Expand All @@ -33,9 +118,15 @@ class AppProvider extends ChangeNotifier {
notifyListeners();
}

Future<void> loadLeagueWiseScores() async {
String leagueId = await LocalStorage.getString('leagueId');
_leagueWiseScores = await _scoreService.fetchScoresByLeague(id: leagueId);
Future<void> loadLeagueWiseScores({String leagueName}) async {
if(leagueName == null) {
String storedLeagueId = await LocalStorage.getString('leagueId');
_leagueWiseScores = await _scoreService.fetchScoresByLeague(id: storedLeagueId);
}
else {
String leagueId = '${leagues[leagueName]['id']}';
_leagueWiseScores = await _scoreService.fetchScoresByLeague(id: leagueId);
}
notifyListeners();
}

Expand All @@ -45,28 +136,29 @@ class AppProvider extends ChangeNotifier {
notifyListeners();
}

List<News> get newsList => _newsList;
List<News> get favouriteNewsList => _favouriteNewsList;
List<Score> get favouriteTeamScores => _favouriteTeamScores;
List<Score> get leagueWiseScores => _leagueWiseScores;

void set newsList(List<News> news) {
_newsList = news;
Future<void> loadLeagueTable({String leagueName}) async {
if(leagueName == null) {
String storedLeagueId = await LocalStorage.getString('leagueId');
_leagueTableEntries = await _leagueTableService.fetchLeagueTable(id: storedLeagueId);
}
else {
String leagueId = '${leagues[leagueName]['id']}';
_leagueTableEntries = await _leagueTableService.fetchLeagueTable(id: leagueId);
}
notifyListeners();
}

void set favouriteNewsList(List<News> news) {
_favouriteNewsList = news.sublist(0, 4);
Future<void> loadTopScorers({String leagueName}) async {
if(leagueName == null) {
String storedLeagueId = await LocalStorage.getString('leagueId');
_topScorers = await _topScorerService.fetchTopScorer(leagueId: storedLeagueId);
}
else {
String leagueId = '${leagues[leagueName]['id']}';
_topScorers = await _topScorerService.fetchTopScorer(leagueId: leagueId);
}
notifyListeners();
}

void set favouriteTeamScores(List<Score> scores) {
_favouriteTeamScores = scores;
notifyListeners();
}

void set leagueWiseScores(List<Score> scores) {
_leagueWiseScores = scores;
notifyListeners();
}
}
Loading

0 comments on commit bca54aa

Please sign in to comment.