Web
This commit is contained in:
parent
86819fe01d
commit
fef64bef8e
2422
lib/constants.dart
2422
lib/constants.dart
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,15 @@
|
||||||
|
const dynamic kAPIResponseClients = '''
|
||||||
|
{
|
||||||
|
"data": [],
|
||||||
|
"meta": {
|
||||||
|
"pagination": {
|
||||||
|
"total": 0,
|
||||||
|
"count": 0,
|
||||||
|
"per_page": 5000,
|
||||||
|
"current_page": 1,
|
||||||
|
"total_pages": 1,
|
||||||
|
"links": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
''';
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
const dynamic kAPIResponseDashboard = '''
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"activities": []
|
||||||
|
},
|
||||||
|
"meta": {
|
||||||
|
"pagination": {
|
||||||
|
"total": 0,
|
||||||
|
"count": 0,
|
||||||
|
"per_page": 5000,
|
||||||
|
"current_page": 1,
|
||||||
|
"total_pages": 1,
|
||||||
|
"links": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
''';
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
const dynamic kAPIResponseInvoices = '''
|
||||||
|
{
|
||||||
|
"data": [],
|
||||||
|
"meta": {
|
||||||
|
"pagination": {
|
||||||
|
"total": 0,
|
||||||
|
"count": 0,
|
||||||
|
"per_page": 5000,
|
||||||
|
"current_page": 1,
|
||||||
|
"total_pages": 1,
|
||||||
|
"links": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
''';
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,15 @@
|
||||||
|
const dynamic kAPIResponsePayments = '''
|
||||||
|
{
|
||||||
|
"data": [],
|
||||||
|
"meta": {
|
||||||
|
"pagination": {
|
||||||
|
"total": 0,
|
||||||
|
"count": 0,
|
||||||
|
"per_page": 5000,
|
||||||
|
"current_page": 1,
|
||||||
|
"total_pages": 1,
|
||||||
|
"links": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
''';
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
const dynamic kAPIResponseProducts = '''
|
||||||
|
{
|
||||||
|
"data": [],
|
||||||
|
"meta": {
|
||||||
|
"pagination": {
|
||||||
|
"total": 0,
|
||||||
|
"count": 0,
|
||||||
|
"per_page": 5000,
|
||||||
|
"current_page": 1,
|
||||||
|
"total_pages": 1,
|
||||||
|
"links": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
''';
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
const dynamic kAPIResponseQuotes = '''
|
||||||
|
{
|
||||||
|
"data": [],
|
||||||
|
"meta": {
|
||||||
|
"pagination": {
|
||||||
|
"total": 0,
|
||||||
|
"count": 0,
|
||||||
|
"per_page": 5000,
|
||||||
|
"current_page": 1,
|
||||||
|
"total_pages": 1,
|
||||||
|
"links": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
''';
|
||||||
|
|
@ -3,6 +3,7 @@ import 'dart:convert';
|
||||||
import 'dart:core';
|
import 'dart:core';
|
||||||
import 'package:invoiceninja_flutter/.env.dart';
|
import 'package:invoiceninja_flutter/.env.dart';
|
||||||
import 'package:invoiceninja_flutter/constants.dart';
|
import 'package:invoiceninja_flutter/constants.dart';
|
||||||
|
import 'package:invoiceninja_flutter/data/mock/mock_login.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/serializers.dart';
|
import 'package:invoiceninja_flutter/data/models/serializers.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
||||||
import 'package:invoiceninja_flutter/data/web_client.dart';
|
import 'package:invoiceninja_flutter/data/web_client.dart';
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:core';
|
import 'dart:core';
|
||||||
|
import 'package:invoiceninja_flutter/.env.dart';
|
||||||
import 'package:built_collection/built_collection.dart';
|
import 'package:built_collection/built_collection.dart';
|
||||||
import 'package:invoiceninja_flutter/constants.dart';
|
import 'package:invoiceninja_flutter/constants.dart';
|
||||||
|
import 'package:invoiceninja_flutter/data/mock/mock_clients.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/serializers.dart';
|
import 'package:invoiceninja_flutter/data/models/serializers.dart';
|
||||||
import 'package:invoiceninja_flutter/data/web_client.dart';
|
import 'package:invoiceninja_flutter/data/web_client.dart';
|
||||||
|
|
@ -40,7 +41,14 @@ class ClientRepository {
|
||||||
url += '&updated_at=${updatedAt - kUpdatedAtBufferSeconds}';
|
url += '&updated_at=${updatedAt - kUpdatedAtBufferSeconds}';
|
||||||
}
|
}
|
||||||
|
|
||||||
final dynamic response = await webClient.get(url, credentials.token);
|
dynamic response;
|
||||||
|
|
||||||
|
if (Config.DEMO_MODE) {
|
||||||
|
response = json.decode(kAPIResponseClients);
|
||||||
|
} else {
|
||||||
|
response =
|
||||||
|
await webClient.get(url, credentials.token);
|
||||||
|
}
|
||||||
|
|
||||||
final ClientListResponse clientResponse =
|
final ClientListResponse clientResponse =
|
||||||
serializers.deserializeWith(ClientListResponse.serializer, response);
|
serializers.deserializeWith(ClientListResponse.serializer, response);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:convert';
|
||||||
import 'dart:core';
|
import 'dart:core';
|
||||||
|
import 'package:invoiceninja_flutter/.env.dart';
|
||||||
|
import 'package:invoiceninja_flutter/data/mock/mock_dashboard.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/serializers.dart';
|
import 'package:invoiceninja_flutter/data/models/serializers.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
||||||
|
|
@ -13,9 +16,14 @@ class DashboardRepository {
|
||||||
final WebClient webClient;
|
final WebClient webClient;
|
||||||
|
|
||||||
Future<DashboardEntity> loadItem(Credentials connectionInfo) async {
|
Future<DashboardEntity> loadItem(Credentials connectionInfo) async {
|
||||||
final dynamic response = await webClient.get(
|
dynamic response;
|
||||||
|
if (Config.DEMO_MODE) {
|
||||||
|
response = json.decode(kAPIResponseDashboard);
|
||||||
|
} else {
|
||||||
|
response = await webClient.get(
|
||||||
connectionInfo.url + '/dashboard?only_activity=true',
|
connectionInfo.url + '/dashboard?only_activity=true',
|
||||||
connectionInfo.token);
|
connectionInfo.token);
|
||||||
|
}
|
||||||
|
|
||||||
final DashboardResponse dashboardResponse =
|
final DashboardResponse dashboardResponse =
|
||||||
serializers.deserializeWith(DashboardResponse.serializer, response);
|
serializers.deserializeWith(DashboardResponse.serializer, response);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:core';
|
import 'dart:core';
|
||||||
|
import 'package:invoiceninja_flutter/.env.dart';
|
||||||
import 'package:invoiceninja_flutter/constants.dart';
|
import 'package:invoiceninja_flutter/constants.dart';
|
||||||
|
import 'package:invoiceninja_flutter/data/mock/mock_invoices.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/serializers.dart';
|
import 'package:invoiceninja_flutter/data/models/serializers.dart';
|
||||||
import 'package:built_collection/built_collection.dart';
|
import 'package:built_collection/built_collection.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||||
|
|
@ -36,7 +38,14 @@ class InvoiceRepository {
|
||||||
url += '&updated_at=${updatedAt - kUpdatedAtBufferSeconds}';
|
url += '&updated_at=${updatedAt - kUpdatedAtBufferSeconds}';
|
||||||
}
|
}
|
||||||
|
|
||||||
final dynamic response = await webClient.get(url, credentials.token);
|
dynamic response;
|
||||||
|
|
||||||
|
if (Config.DEMO_MODE) {
|
||||||
|
response = json.decode(kAPIResponseInvoices);
|
||||||
|
} else {
|
||||||
|
response =
|
||||||
|
await webClient.get(url, credentials.token);
|
||||||
|
}
|
||||||
|
|
||||||
final InvoiceListResponse invoiceResponse =
|
final InvoiceListResponse invoiceResponse =
|
||||||
serializers.deserializeWith(InvoiceListResponse.serializer, response);
|
serializers.deserializeWith(InvoiceListResponse.serializer, response);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:core';
|
import 'dart:core';
|
||||||
|
import 'package:invoiceninja_flutter/.env.dart';
|
||||||
import 'package:invoiceninja_flutter/constants.dart';
|
import 'package:invoiceninja_flutter/constants.dart';
|
||||||
|
import 'package:invoiceninja_flutter/data/mock/mock_payments.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/serializers.dart';
|
import 'package:invoiceninja_flutter/data/models/serializers.dart';
|
||||||
import 'package:built_collection/built_collection.dart';
|
import 'package:built_collection/built_collection.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||||
|
|
@ -23,7 +25,14 @@ class PaymentRepository {
|
||||||
url += '&updated_at=${updatedAt - kUpdatedAtBufferSeconds}';
|
url += '&updated_at=${updatedAt - kUpdatedAtBufferSeconds}';
|
||||||
}
|
}
|
||||||
|
|
||||||
final dynamic response = await webClient.get(url, credentials.token);
|
dynamic response;
|
||||||
|
|
||||||
|
if (Config.DEMO_MODE) {
|
||||||
|
response = json.decode(kAPIResponsePayments);
|
||||||
|
} else {
|
||||||
|
response =
|
||||||
|
await webClient.get(url, credentials.token);
|
||||||
|
}
|
||||||
|
|
||||||
final PaymentListResponse paymentResponse =
|
final PaymentListResponse paymentResponse =
|
||||||
serializers.deserializeWith(PaymentListResponse.serializer, response);
|
serializers.deserializeWith(PaymentListResponse.serializer, response);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:core';
|
import 'dart:core';
|
||||||
|
import 'package:invoiceninja_flutter/.env.dart';
|
||||||
import 'package:invoiceninja_flutter/constants.dart';
|
import 'package:invoiceninja_flutter/constants.dart';
|
||||||
|
import 'package:invoiceninja_flutter/data/mock/mock_products.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/serializers.dart';
|
import 'package:invoiceninja_flutter/data/models/serializers.dart';
|
||||||
import 'package:built_collection/built_collection.dart';
|
import 'package:built_collection/built_collection.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||||
|
|
@ -23,7 +25,13 @@ class ProductRepository {
|
||||||
url += '&updated_at=${updatedAt - kUpdatedAtBufferSeconds}';
|
url += '&updated_at=${updatedAt - kUpdatedAtBufferSeconds}';
|
||||||
}
|
}
|
||||||
|
|
||||||
final dynamic response = await webClient.get(url, credentials.token);
|
dynamic response;
|
||||||
|
|
||||||
|
if (Config.DEMO_MODE) {
|
||||||
|
response = json.decode(kAPIResponseProducts);
|
||||||
|
} else {
|
||||||
|
response = await webClient.get(url, credentials.token);
|
||||||
|
}
|
||||||
|
|
||||||
final ProductListResponse productResponse =
|
final ProductListResponse productResponse =
|
||||||
serializers.deserializeWith(ProductListResponse.serializer, response);
|
serializers.deserializeWith(ProductListResponse.serializer, response);
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:core';
|
import 'dart:core';
|
||||||
|
import 'package:invoiceninja_flutter/.env.dart';
|
||||||
import 'package:built_collection/built_collection.dart';
|
import 'package:built_collection/built_collection.dart';
|
||||||
import 'package:invoiceninja_flutter/constants.dart';
|
import 'package:invoiceninja_flutter/constants.dart';
|
||||||
|
import 'package:invoiceninja_flutter/data/mock/mock_quotes.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/serializers.dart';
|
import 'package:invoiceninja_flutter/data/models/serializers.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||||
|
|
@ -36,7 +38,13 @@ class QuoteRepository {
|
||||||
url += '&updated_at=${updatedAt - kUpdatedAtBufferSeconds}';
|
url += '&updated_at=${updatedAt - kUpdatedAtBufferSeconds}';
|
||||||
}
|
}
|
||||||
|
|
||||||
final dynamic response = await webClient.get(url, credentials.token);
|
dynamic response;
|
||||||
|
|
||||||
|
if (Config.DEMO_MODE) {
|
||||||
|
response = json.decode(kAPIResponseQuotes);
|
||||||
|
} else {
|
||||||
|
response = await webClient.get(url, credentials.token);
|
||||||
|
}
|
||||||
|
|
||||||
final InvoiceListResponse quoteResponse =
|
final InvoiceListResponse quoteResponse =
|
||||||
serializers.deserializeWith(InvoiceListResponse.serializer, response);
|
serializers.deserializeWith(InvoiceListResponse.serializer, response);
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ if [ ${action} = "init" ]; then
|
||||||
'./lib/data/models/serializers.dart'
|
'./lib/data/models/serializers.dart'
|
||||||
'./test/login_test.dart'
|
'./test/login_test.dart'
|
||||||
'./lib/redux/ui/ui_state.dart'
|
'./lib/redux/ui/ui_state.dart'
|
||||||
'./lib/ui/auth/login.dart'
|
'./lib/ui/auth/mock_login.dart'
|
||||||
'./lib/ui/auth/login_vm.dart'
|
'./lib/ui/auth/login_vm.dart'
|
||||||
'./lib/ui/app/menu_drawer.dart'
|
'./lib/ui/app/menu_drawer.dart'
|
||||||
'./lib/ui/app/init.dart'
|
'./lib/ui/app/init.dart'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue