Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Unified Diff: pkg/immi_samples/lib/login_presenter.dart

Issue 2035023003: Remove service-compiler related code. (Closed) Base URL: git@github.com:dartino/sdk.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/immi_samples/lib/ios/ImmiSamples/ViewPresenter.h ('k') | pkg/immi_samples/lib/login_presenter.immi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/immi_samples/lib/login_presenter.dart
diff --git a/pkg/immi_samples/lib/login_presenter.dart b/pkg/immi_samples/lib/login_presenter.dart
deleted file mode 100644
index c3ad1db73cb604f795913950da3a299be7abe23e..0000000000000000000000000000000000000000
--- a/pkg/immi_samples/lib/login_presenter.dart
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:convert';
-
-import 'package:crypto/crypto.dart';
-import 'package:immi/dart/immi.dart';
-
- // Export generated code for nodes in login_presenter.immi
-import 'package:immi/dart/login_presenter.dart';
-export 'package:immi/dart/login_presenter.dart';
-
-class LoginPresenter {
- static const String _emptyNameOrPassword =
- 'Login failed. Empty name or password.';
-
- Node state;
- String url;
- String user;
-
- LoginPresenter(this.url) {
- state = new LoggedOutStateNode(login: login, message: '');
- }
-
- LoginNode present(Node prev) {
- return new LoginNode(state: state);
- }
-
- void login(String name, String password) {
- user = name;
- if (name == '' || password == '') {
- state = new LoggedOutStateNode(login: login,
- message: _emptyNameOrPassword);
- } else {
- HttpsRequestNode request =
- new HttpsRequestNode(url: url,
- authorization: _createAuthToken(name, password),
- handleResponse: _handleResponse);
- state = new LoginRequestStateNode(request: request);
- }
- }
-
- String _createAuthToken(String name, String password) {
- List<int> bytes = UTF8.encode('$name:$password');
- String base64 = CryptoUtils.bytesToBase64(bytes);
- return 'Basic $base64';
- }
-
- void _handleResponse(String data) {
- // TODO(zarah): implement this and return depending on data.
- state = new LoggedInStateNode(logout: logout, user: user);
- }
-
- void logout() {
- state = new LoggedOutStateNode(login: login, message: '');
- }
-}
« no previous file with comments | « pkg/immi_samples/lib/ios/ImmiSamples/ViewPresenter.h ('k') | pkg/immi_samples/lib/login_presenter.immi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698