Commit 7e283a8e authored by Leon Tappe's avatar Leon Tappe 🔥
Browse files

upgrade example app as well

parent db8df793
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Users/ltappe/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/ltappe/projects/blocs_copyclient/example"
export "FLUTTER_TARGET=/Users/ltappe/projects/blocs_copyclient/example/lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "FLUTTER_FRAMEWORK_DIR=/Users/ltappe/flutter/bin/cache/artifacts/engine/ios"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
......@@ -39,6 +39,7 @@
/* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
16C4FFD3F2BC0B5F97DA49C8 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
......@@ -53,6 +54,8 @@
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
999A8854C076710315365D49 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BDAC6FB0CAA58BA8248792EB /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
EDE7A19F394B0CB557CD1E10 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -72,6 +75,9 @@
8DAC93A2E6BECBBFEAFA1E4C /* Pods */ = {
isa = PBXGroup;
children = (
EDE7A19F394B0CB557CD1E10 /* Pods-Runner.debug.xcconfig */,
16C4FFD3F2BC0B5F97DA49C8 /* Pods-Runner.release.xcconfig */,
BDAC6FB0CAA58BA8248792EB /* Pods-Runner.profile.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
......@@ -233,7 +239,7 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
"${BUILT_PRODUCTS_DIR}/MTBBarcodeScanner/MTBBarcodeScanner.framework",
"${BUILT_PRODUCTS_DIR}/barcode_scan/barcode_scan.framework",
......@@ -246,7 +252,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
8D472C435D0AC25A89DCF245 /* [CP] Check Pods Manifest.lock */ = {
......
import 'dart:async';
import 'package:blocs_copyclient/backend.dart';
import 'package:http/http.dart';
import 'package:logging/logging.dart';
import 'package:blocs_copyclient/src/models/backend.dart';
//import 'backend.dart';
class BackendSunrise implements Backend {
final String host = 'sunrise.upb.de';
final String basePath = '/astaprint';
export 'package:blocs_copyclient/src/models/backend.dart';
class BackendShiva implements Backend {
final String host = 'astaprint.upb.de';
final String basePath = '/api/v1';
final Client _innerClient;
Logger _log = Logger('BackendSunrise');
Logger _log = Logger('BackendShiva');
BackendSunrise(this._innerClient) {
BackendShiva(this._innerClient) {
_log.fine('Creating Backend with ${_innerClient.toString()} as innerClient');
}
......
......@@ -9,9 +9,22 @@ class JobsPage extends StatefulWidget {
}
class _JobsPageState extends State<JobsPage> {
JoblistBloc jobsBloc;
@override
void dispose() {
jobsBloc.close();
super.dispose();
}
@override
void initState() {
jobsBloc = BlocProvider.of<JoblistBloc>(context);
super.initState();
}
@override
Widget build(BuildContext context) {
JoblistBloc jobsBloc = BlocProvider.of<JoblistBloc>(context);
return Scaffold(
appBar: AppBar(
title: Text('My Jobs'),
......@@ -35,8 +48,8 @@ class _JobsPageState extends State<JobsPage> {
jobsBloc.onPrintById(target, state.value[index].id);
} catch (e) {
print('Jobs: $e');
Scaffold.of(context)
.showSnackBar(SnackBar(content: Text('No printer was selected')));
Scaffold.of(context).showSnackBar(
SnackBar(content: Text('No printer was selected')));
}
},
);
......
......@@ -32,8 +32,9 @@ class LoginFormState extends State<LoginForm> {
obscureText: true,
),
RaisedButton(
child: Text('Login'),
onPressed: () => BlocProvider.of<AuthBloc>(context)
.login(usernameController.text, passwordController.text),
.onLogin(usernameController.text, passwordController.text),
),
],
),
......
import 'package:blocs_copyclient/blocs.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
......@@ -19,8 +18,6 @@ class _LoginPageState extends State<LoginPage> {
TextEditingController usernameController = TextEditingController();
TextEditingController passwordController = TextEditingController();
JoblistBloc jobsBloc;
@override
Widget build(BuildContext context) {
return Scaffold(
......
......@@ -4,17 +4,24 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:http/http.dart' as http;
import 'package:logging/logging.dart';
import 'backend_sunrise.dart';
import 'login_page.dart';
import 'backend_shiva.dart';
import 'jobs_page.dart';
import 'login_page.dart';
void main() => runApp(CopyclientDemo());
final routes = {
'/login': (BuildContext context) => LoginPage(),
'/': (BuildContext context) => HomePage(),
'/jobs': (BuildContext context) => JobsPage(),
};
class CopyclientDemo extends StatelessWidget {
CopyclientDemo() {
Logger.root.level = Level.ALL;
Logger.root.onRecord.listen((record) {
print('[${record.loggerName}] (${record.level.name}) ${record.time}: ${record.message}');
print(
'[${record.loggerName}] (${record.level.name}) ${record.time}: ${record.message}');
});
Logger('Copyclient').info('Copyclient Example started');
}
......@@ -31,12 +38,6 @@ class CopyclientDemo extends StatelessWidget {
}
}
final routes = {
'/login': (BuildContext context) => LoginPage(),
'/': (BuildContext context) => HomePage(),
'/jobs': (BuildContext context) => JobsPage(),
};
class HomePage extends StatefulWidget {
@override
State<StatefulWidget> createState() => _HomePageState();
......@@ -44,10 +45,11 @@ class HomePage extends StatefulWidget {
class _HomePageState extends State<HomePage> {
static final http.Client client = http.Client();
static final Backend backend = BackendSunrise(client);
static final Backend backend = BackendShiva(client);
AuthBloc authBloc = AuthBloc(backend: backend);
JoblistBloc jobsBloc;
PrintQueueBloc printQueueBloc = PrintQueueBloc(backend);
JoblistBloc jobsBloc = JoblistBloc(backend);
@override
Widget build(BuildContext context) {
return BlocProvider(
......@@ -65,7 +67,6 @@ class _HomePageState extends State<HomePage> {
//return Center(child: CircularProgressIndicator());
} else if (state.isAuthorized) {
// AUTHORIZED AND READY TO HUSTLE
jobsBloc = JoblistBloc(BackendSunrise(http.Client()));
jobsBloc.onStart(state.token);
return BlocProvider<JoblistBloc>(
builder: (_) => jobsBloc,
......@@ -77,4 +78,11 @@ class _HomePageState extends State<HomePage> {
),
);
}
@override
void dispose() {
authBloc.close();
jobsBloc.close();
super.dispose();
}
}
......@@ -7,7 +7,7 @@ packages:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.10"
version: "2.0.11"
args:
dependency: transitive
description:
......@@ -21,7 +21,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
version: "2.3.0"
barcode_scan:
dependency: "direct main"
description:
......@@ -35,21 +35,21 @@ packages:
name: bloc
url: "https://pub.dartlang.org"
source: hosted
version: "0.14.4"
version: "2.0.0"
blocs_copyclient:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
version: "0.1.0"
version: "1.0.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
version: "1.0.5"
charcode:
dependency: transitive
description:
......@@ -84,7 +84,7 @@ packages:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
version: "2.1.3"
csv:
dependency: transitive
description:
......@@ -103,7 +103,7 @@ packages:
name: flutter_bloc
url: "https://pub.dartlang.org"
source: hosted
version: "0.20.1"
version: "2.0.0"
flutter_test:
dependency: "direct dev"
description: flutter
......@@ -129,7 +129,7 @@ packages:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
version: "2.1.8"
js:
dependency: transitive
description:
......@@ -157,28 +157,28 @@ packages:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
version: "1.1.7"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.2"
version: "1.6.4"
pdf:
dependency: transitive
description:
name: pdf
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.18"
version: "1.3.24"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0+1"
petitparser:
dependency: transitive
description:
......@@ -192,21 +192,21 @@ packages:
name: provider
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
version: "3.1.0+1"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
version: "2.0.5"
rxdart:
dependency: transitive
description:
name: rxdart
url: "https://pub.dartlang.org"
source: hosted
version: "0.22.2"
version: "0.22.6"
sky_engine:
dependency: transitive
description: flutter
......@@ -239,7 +239,7 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
version: "1.0.5"
term_glyph:
dependency: transitive
description:
......
......@@ -11,7 +11,7 @@ dependencies:
blocs_copyclient:
path: ../
barcode_scan: ^1.0.0
flutter_bloc: ^0.20.0
flutter_bloc: ^2.0.0
dev_dependencies:
flutter_test:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment