Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if (localPropertiesFile.exists()) {

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
throw GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
Expand Down Expand Up @@ -58,4 +58,7 @@ dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-messaging:20.3.0'
}

apply plugin: 'com.google.gms.google-services'
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
FlutterApplication and put your custom class here. -->
<application
android:label="SpendTracker"
android:name=".Application"
android:icon="@mipmap/ic_launcher">

<meta-data
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package uk.co.localspend.localspend;

import io.flutter.app.FlutterApplication;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback;
import io.flutter.plugins.GeneratedPluginRegistrant;
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService;
import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin;

public class Application extends FlutterApplication implements PluginRegistrantCallback {
@Override
public void onCreate() {
super.onCreate();
FlutterFirebaseMessagingService.setPluginRegistrant(this);
}

@Override
public void registerWith(PluginRegistry registry) {
FirebaseMessagingPlugin.registerWith(registry.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"));
}
}
3 changes: 2 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.google.gms:google-services:4.3.4'
}
}

Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
4 changes: 2 additions & 2 deletions lib/env/dev.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"env": "DEV",
"production": false,
"apiUrl": "https://dev.localspend.co.uk/api"
}
"apiUrl": "https://localhost:/api"
}
37 changes: 28 additions & 9 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ import 'package:local_spend/pages/spash_screen.dart';
import 'package:local_spend/pages/more_page.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:local_spend/common/apifunctions/get_graph_data.dart';
import 'package:firebase_messaging/firebase_messaging.dart';

void main() {
runApp(MyApp());
runApp(
MyApp()
);
}

void loadGraphs() {}
Expand All @@ -22,27 +25,43 @@ class GraphWithTitle {
}

class MyApp extends StatelessWidget {
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
@override
Widget build(BuildContext context) {
// TODO: load graphs on app login and send to graph widgets

return new MaterialApp(
_firebaseMessaging.configure(
onMessage: (Map<String, dynamic> message) async {
print('onMessage: $message');
},
onLaunch: (Map<String, dynamic> message) async {
print('onLaunch: $message');
},
onResume: (Map<String, dynamic> message) async {
print('onResume: $message');
},
);

// Required on iOS; non-op on Android.
_firebaseMessaging.requestNotificationPermissions();

return MaterialApp(
debugShowCheckedModeBanner: false,
localizationsDelegates: [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: [Locale("en")],
title: "Local Spend Tracker",
theme: new ThemeData(
supportedLocales: [Locale('en')],
title: 'Local Spend Tracker',
theme: ThemeData(
primarySwatch: Colors.blueGrey,
),
routes: <String, WidgetBuilder>{
"/HomePage": (BuildContext context) => HomePage(),
"/LoginPage": (BuildContext context) => LoginPage(),
'/HomePage': (BuildContext context) => HomePage(),
'/LoginPage': (BuildContext context) => LoginPage(),
'/MapPage': (BuildContext context) => MapPage(),
"/ReceiptPage": (BuildContext context) => ReceiptPage2(),
"/MorePage": (BuildContext context) => MorePage(),
'/ReceiptPage': (BuildContext context) => ReceiptPage2(),
'/MorePage': (BuildContext context) => MorePage(),
},
home: SplashScreen(),
);
Expand Down
Loading