Skip to content

Commit

Permalink
Work on jpa-like ORM
Browse files Browse the repository at this point in the history
  • Loading branch information
henryco committed Nov 2, 2018
1 parent 42c6ec7 commit f15e35c
Show file tree
Hide file tree
Showing 12 changed files with 182 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
build/

.flutter-plugins

*.g.dart
1 change: 1 addition & 0 deletions .idea/dictionaries/henryco.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/di/dependencies.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:blinck_app/service/api/login/facebook_login_service.dart';
import 'package:blinck_app/service/api/login/i_login_service.dart';
import 'package:blinck_app/service/api/login/facebook/facebook_login_service.dart';
import 'package:blinck_app/service/api/login/facebook/i_login_service.dart';
import 'package:blinck_app/service/storage/token/i_token_storage_service.dart';
import 'package:blinck_app/service/storage/token/token_shared_storage_service.dart';

Expand Down
2 changes: 1 addition & 1 deletion lib/screen/login_screen.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:blinck_app/service/storage/token/i_token_storage_service.dart';
import 'package:blinck_app/service/api/login/i_login_service.dart';
import 'package:blinck_app/service/api/login/facebook/i_login_service.dart';
import 'package:blinck_app/screen/router.dart';
import 'package:blinck_app/util/model.dart';
import 'package:flutter/material.dart';
Expand Down
11 changes: 11 additions & 0 deletions lib/service/api/api.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
abstract class ApiEndpoints {

static const String SERVER_URL = "http://174.138.0.194:8080";

}

abstract class ApiHeaders {

static const String AUTHORIZATION_HTTP = "Authorization";

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import './i_login_service.dart';
import 'package:blinck_app/service/api/login/facebook/i_login_service.dart';
import 'package:flutter_facebook_login/flutter_facebook_login.dart';


class FacebookLoginService implements ILoginService {

static const List<String> _permissions = const [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import 'package:meta/meta.dart';
import '../login.dart';
export '../login.dart';

abstract class ILoginService {

Expand All @@ -8,10 +10,3 @@ abstract class ILoginService {
const ILoginService();
}

class AccessToken {
final DateTime expires;
final String userId;
final String token;

AccessToken({this.token, this.userId, this.expires});
}
31 changes: 31 additions & 0 deletions lib/service/api/login/login.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:meta/meta.dart';

part 'login.g.dart';

class AccessToken {
final DateTime expires;
final String userId;
final String token;

AccessToken({this.token, this.userId, this.expires});
}


@JsonSerializable()
class UserForm {

@JsonKey(name: 'facebook_id')
final String fbId;

@JsonKey(name: 'facebook_token')
final String fbToken;

const UserForm({
@required this.fbId,
@required this.fbToken
});

factory UserForm.fromJson(Map<String, dynamic> json) => _$UserFormFromJson(json);
Map<String, dynamic> toJson() => _$UserFormToJson(this);
}
2 changes: 1 addition & 1 deletion lib/util/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ abstract class ViewLogic<WIDGET extends StatefulWidget, U extends ViewModel> {

/// Overridable
@protected
void initialize() {
void initialize() /*async*/ {
/* void */
}

Expand Down
126 changes: 126 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,69 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
build:
dependency: transitive
description:
name: build
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
build_config:
dependency: transitive
description:
name: build_config
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.1+4"
build_resolvers:
dependency: transitive
description:
name: build_resolvers
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.2+6"
build_runner:
dependency: "direct dev"
description:
name: build_runner
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
build_runner_core:
dependency: transitive
description:
name: build_runner_core
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
built_collection:
dependency: transitive
description:
name: built_collection
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
built_value:
dependency: transitive
description:
name: built_value
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.5"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
code_builder:
dependency: transitive
description:
name: code_builder
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.3"
collection:
dependency: transitive
description:
Expand Down Expand Up @@ -71,6 +127,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
dart_style:
dependency: transitive
description:
name: dart_style
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.3"
fixnum:
dependency: transitive
description:
name: fixnum
url: "https://pub.dartlang.org"
source: hosted
version: "0.10.8"
flutter:
dependency: "direct main"
description: flutter
Expand Down Expand Up @@ -102,6 +172,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.7"
graphs:
dependency: transitive
description:
name: graphs
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2+1"
html:
dependency: transitive
description:
Expand Down Expand Up @@ -144,13 +221,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.1+1"
json_annotation:
dependency: "direct main"
description:
name: json_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
json_rpc_2:
dependency: transitive
description:
name: json_rpc_2
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.9"
json_serializable:
dependency: "direct dev"
description:
name: json_serializable
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
kernel:
dependency: transitive
description:
Expand Down Expand Up @@ -235,6 +326,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.1"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
plugin:
dependency: transitive
description:
Expand All @@ -256,6 +354,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.2"
pubspec_parse:
dependency: transitive
description:
name: pubspec_parse
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2+3"
quiver:
dependency: transitive
description:
Expand Down Expand Up @@ -303,6 +408,13 @@ packages:
description: flutter
source: sdk
version: "0.0.99"
source_gen:
dependency: transitive
description:
name: source_gen
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.1+3"
source_map_stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -345,6 +457,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.8"
stream_transform:
dependency: transitive
description:
name: stream_transform
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.14+1"
string_scanner:
dependency: transitive
description:
Expand Down Expand Up @@ -373,6 +492,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
timing:
dependency: transitive
description:
name: timing
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.1+1"
typed_data:
dependency: transitive
description:
Expand Down
4 changes: 3 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ dependencies:
sqflite: any
optional: ^3.0.0+2
shared_preferences: ^0.4.3
json_annotation: ^2.0.0

dev_dependencies:
flutter_test:
sdk: flutter

build_runner: ^1.0.0
json_serializable: ^2.0.0

# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
Expand Down
Empty file removed test/void
Empty file.

0 comments on commit f15e35c

Please sign in to comment.