181186 - Criar PDV Android para rodar em maquinas P.O.S.
No files matched your search
@@ -0,0 +1,43 @@
|
||||
# Miscellaneous
|
||||
*.class
|
||||
*.log
|
||||
*.pyc
|
||||
*.swp
|
||||
.DS_Store
|
||||
.atom/
|
||||
.buildlog/
|
||||
.history
|
||||
.svn/
|
||||
migrate_working_dir/
|
||||
|
||||
# IntelliJ related
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea/
|
||||
|
||||
# The .vscode folder contains launch configuration and tasks you configure in
|
||||
# VS Code which you may wish to be included in version control, so this line
|
||||
# is commented out by default.
|
||||
#.vscode/
|
||||
|
||||
# Flutter/Dart/Pub related
|
||||
**/doc/api/
|
||||
**/ios/Flutter/.last_build_id
|
||||
.dart_tool/
|
||||
.flutter-plugins
|
||||
.flutter-plugins-dependencies
|
||||
.pub-cache/
|
||||
.pub/
|
||||
/build/
|
||||
|
||||
# Symbolication related
|
||||
app.*.symbols
|
||||
|
||||
# Obfuscation related
|
||||
app.*.map.json
|
||||
|
||||
# Android Studio will place build artifacts here
|
||||
/android/app/debug
|
||||
/android/app/profile
|
||||
/android/app/release
|
||||
@@ -0,0 +1,45 @@
|
||||
# This file tracks properties of this Flutter project.
|
||||
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
||||
#
|
||||
# This file should be version controlled and should not be manually edited.
|
||||
|
||||
version:
|
||||
revision: "78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9"
|
||||
channel: "stable"
|
||||
|
||||
project_type: app
|
||||
|
||||
# Tracks metadata for the flutter migrate command
|
||||
migration:
|
||||
platforms:
|
||||
- platform: root
|
||||
create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
|
||||
base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
|
||||
- platform: android
|
||||
create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
|
||||
base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
|
||||
- platform: ios
|
||||
create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
|
||||
base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
|
||||
- platform: linux
|
||||
create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
|
||||
base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
|
||||
- platform: macos
|
||||
create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
|
||||
base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
|
||||
- platform: web
|
||||
create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
|
||||
base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
|
||||
- platform: windows
|
||||
create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
|
||||
base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
|
||||
|
||||
# User provided section
|
||||
|
||||
# List of Local paths (relative to this file) that should be
|
||||
# ignored by the migrate tool.
|
||||
#
|
||||
# Files that are not part of the templates will be ignored by default.
|
||||
unmanaged_files:
|
||||
- 'lib/main.dart'
|
||||
- 'ios/Runner.xcodeproj/project.pbxproj'
|
||||
@@ -0,0 +1,39 @@
|
||||
# PDV
|
||||
|
||||
Aplicativo Android de ponto de venda em Flutter, com integração planejada
|
||||
para Odoo 7 e Odoo 19. A especificação funcional e técnica está no módulo
|
||||
`pdv_pos` do repositório SigErp.
|
||||
|
||||
## Desenvolvimento
|
||||
|
||||
Requisitos identificados no ambiente: Flutter 3.16.5 e Dart 3.2.3.
|
||||
|
||||
```sh
|
||||
flutter pub get
|
||||
flutter run
|
||||
flutter analyze
|
||||
flutter test
|
||||
```
|
||||
|
||||
### Executar a versão desktop no Linux para desenvolvimento
|
||||
|
||||
O plugin `flutter_secure_storage` compila o backend Linux mesmo que, em debug,
|
||||
o PDV use armazenamento de sessão em memória. Em Debian/Ubuntu, instale a
|
||||
dependência de desenvolvimento do libsecret antes de compilar:
|
||||
|
||||
```sh
|
||||
sudo apt install libsecret-1-dev
|
||||
flutter pub get
|
||||
flutter run -d linux
|
||||
```
|
||||
|
||||
Fase 0 está concluída e a Fase 1 está em homologação. A configuração é
|
||||
persistida localmente, o teste de conexão usa `GET /pdv_pos/health` e o login
|
||||
Odoo 7 valida a licença e autentica o usuário em `POST /pdv_pos/logar`. O login
|
||||
fora do Android pula a licença do dispositivo para permitir testes desktop,
|
||||
mas ainda exige usuário Odoo. O login precisa ser homologado no servidor e no
|
||||
serviço de licenças antes de uso real.
|
||||
|
||||
A Fase 2 começou com a tela de Venda e o catálogo por departamento. A primeira
|
||||
versão carrega todos os produtos do departamento selecionado sem paginação;
|
||||
essa decisão será reavaliada com o volume real do catálogo POS.
|
||||
@@ -0,0 +1,28 @@
|
||||
# This file configures the analyzer, which statically analyzes Dart code to
|
||||
# check for errors, warnings, and lints.
|
||||
#
|
||||
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
|
||||
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
|
||||
# invoked from the command line by running `flutter analyze`.
|
||||
|
||||
# The following line activates a set of recommended lints for Flutter apps,
|
||||
# packages, and plugins designed to encourage good coding practices.
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
linter:
|
||||
# The lint rules applied to this project can be customized in the
|
||||
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
||||
# included above or to enable additional rules. A list of all available lints
|
||||
# and their documentation is published at https://dart.dev/lints.
|
||||
#
|
||||
# Instead of disabling a lint rule for the entire project in the
|
||||
# section below, it can also be suppressed for a single line of code
|
||||
# or a specific dart file by using the `// ignore: name_of_lint` and
|
||||
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
|
||||
# producing the lint.
|
||||
rules:
|
||||
# avoid_print: false # Uncomment to disable the `avoid_print` rule
|
||||
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
|
||||
|
||||
# Additional information about this file can be found at
|
||||
# https://dart.dev/guides/language/analysis-options
|
||||
@@ -0,0 +1,13 @@
|
||||
gradle-wrapper.jar
|
||||
/.gradle
|
||||
/captures/
|
||||
/gradlew
|
||||
/gradlew.bat
|
||||
/local.properties
|
||||
GeneratedPluginRegistrant.java
|
||||
|
||||
# Remember to never publicly share your keystore.
|
||||
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
|
||||
key.properties
|
||||
**/*.keystore
|
||||
**/*.jks
|
||||
@@ -0,0 +1,67 @@
|
||||
plugins {
|
||||
id "com.android.application"
|
||||
id "kotlin-android"
|
||||
id "dev.flutter.flutter-gradle-plugin"
|
||||
}
|
||||
|
||||
def localProperties = new Properties()
|
||||
def localPropertiesFile = rootProject.file('local.properties')
|
||||
if (localPropertiesFile.exists()) {
|
||||
localPropertiesFile.withReader('UTF-8') { reader ->
|
||||
localProperties.load(reader)
|
||||
}
|
||||
}
|
||||
|
||||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
||||
if (flutterVersionCode == null) {
|
||||
flutterVersionCode = '1'
|
||||
}
|
||||
|
||||
def flutterVersionName = localProperties.getProperty('flutter.versionName')
|
||||
if (flutterVersionName == null) {
|
||||
flutterVersionName = '1.0'
|
||||
}
|
||||
|
||||
android {
|
||||
namespace "com.example.pdv"
|
||||
compileSdkVersion 34
|
||||
ndkVersion flutter.ndkVersion
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main.java.srcDirs += 'src/main/kotlin'
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId "com.example.pdv"
|
||||
// You can update the following values to match your application needs.
|
||||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
||||
minSdkVersion flutter.minSdkVersion
|
||||
targetSdkVersion flutter.targetSdkVersion
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
// TODO: Add your own signing config for the release build.
|
||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flutter {
|
||||
source '../..'
|
||||
}
|
||||
|
||||
dependencies {}
|
||||
@@ -0,0 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- The INTERNET permission is required for development. Specifically,
|
||||
the Flutter tool needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
</manifest>
|
||||
@@ -0,0 +1,38 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
|
||||
<application
|
||||
android:label="pdv"
|
||||
android:name="${applicationName}"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:icon="@mipmap/pdv_launcher">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/LaunchTheme"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
android:hardwareAccelerated="true"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<!-- Specifies an Android theme to apply to this Activity as soon as
|
||||
the Android process has started. This theme is visible to the user
|
||||
while the Flutter UI initializes. After that, this theme continues
|
||||
to determine the Window background behind the Flutter UI. -->
|
||||
<meta-data
|
||||
android:name="io.flutter.embedding.android.NormalTheme"
|
||||
android:resource="@style/NormalTheme"
|
||||
/>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
<meta-data
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.example.pdv
|
||||
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
|
||||
class MainActivity: FlutterActivity() {
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Modify this file to customize your launch splash screen -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="?android:colorBackground" />
|
||||
|
||||
<!-- You can insert your own image assets here -->
|
||||
<!-- <item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@mipmap/launch_image" />
|
||||
</item> -->
|
||||
</layer-list>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Modify this file to customize your launch splash screen -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@android:color/white" />
|
||||
|
||||
<!-- You can insert your own image assets here -->
|
||||
<!-- <item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@mipmap/launch_image" />
|
||||
</item> -->
|
||||
</layer-list>
|
||||
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 52 KiB |
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<!-- Show a splash screen on the activity. Automatically removed when
|
||||
the Flutter engine draws its first frame -->
|
||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||
</style>
|
||||
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||
This theme determines the color of the Android Window while your
|
||||
Flutter UI initializes, as well as behind your Flutter UI while its
|
||||
running.
|
||||
|
||||
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<item name="android:windowBackground">?android:colorBackground</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<!-- Show a splash screen on the activity. Automatically removed when
|
||||
the Flutter engine draws its first frame -->
|
||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||
</style>
|
||||
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||
This theme determines the color of the Android Window while your
|
||||
Flutter UI initializes, as well as behind your Flutter UI while its
|
||||
running.
|
||||
|
||||
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<item name="android:windowBackground">?android:colorBackground</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -0,0 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- The INTERNET permission is required for development. Specifically,
|
||||
the Flutter tool needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
</manifest>
|
||||
@@ -0,0 +1,30 @@
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.7.10'
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.buildDir = '../build'
|
||||
subprojects {
|
||||
project.buildDir = "${rootProject.buildDir}/${project.name}"
|
||||
}
|
||||
subprojects {
|
||||
project.evaluationDependsOn(':app')
|
||||
}
|
||||
|
||||
tasks.register("clean", Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
org.gradle.jvmargs=-Xmx4G
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
@@ -0,0 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
|
||||
@@ -0,0 +1,29 @@
|
||||
pluginManagement {
|
||||
def flutterSdkPath = {
|
||||
def properties = new Properties()
|
||||
file("local.properties").withInputStream { properties.load(it) }
|
||||
def flutterSdkPath = properties.getProperty("flutter.sdk")
|
||||
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
|
||||
return flutterSdkPath
|
||||
}
|
||||
settings.ext.flutterSdkPath = flutterSdkPath()
|
||||
|
||||
includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
|
||||
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
|
||||
id "com.android.application" version "7.3.0" apply false
|
||||
}
|
||||
|
||||
include ":app"
|
||||
|
After Width: | Height: | Size: 1.4 MiB |
@@ -0,0 +1,222 @@
|
||||
# Contratos de API
|
||||
|
||||
Ainda não há contrato de operações de negócio confirmado para o PDV. Os
|
||||
contratos de health check e login Odoo 7 estão definidos abaixo e aguardam
|
||||
homologação no servidor real.
|
||||
|
||||
O app oferece interfaces `AuthRepository` e `ConnectionTester`; ambas têm
|
||||
implementações para Odoo 7. Nenhum endpoint de catálogo ou venda foi presumido.
|
||||
|
||||
## API dedicada do PDV
|
||||
|
||||
Foi selecionada a implementação de endpoints próprios no módulo `pdv_pos`.
|
||||
O primeiro contrato é o health check público e sem dados sensíveis:
|
||||
|
||||
- `GET /pdv_pos/health`
|
||||
- Sucesso HTTP 200: `{"status":"ok","api_version":1}`
|
||||
- Não requer autenticação e não retorna dados da empresa, usuário ou banco.
|
||||
- O app envia essa chamada pelo botão **Testar conexão** e só considera
|
||||
sucesso quando o status HTTP e o contrato JSON forem válidos.
|
||||
|
||||
O código do controller foi adicionado ao módulo `pdv_pos` e o cliente não
|
||||
segue redirecionamentos. A rota ainda precisa ser instalada/homologada em um
|
||||
servidor Odoo 7 real. Esse contrato identifica a versão da API PDV, não a
|
||||
versão principal do Odoo.
|
||||
|
||||
### Login e sessão Odoo 7
|
||||
|
||||
O endpoint combinado replica apenas o fluxo pertinente do Coletor — validar a
|
||||
licença do dispositivo e autenticar o operador — em uma única chamada:
|
||||
|
||||
- `POST /pdv_pos/logar`
|
||||
- Formulário: `cnpj`, `username`, `password`, `serial`, `model`, `brand` e
|
||||
`version` do app, mais `platform` (`android`, `linux`, etc.).
|
||||
- `cnpj` seleciona o database via `app_pdv_pos.config`; `username/password`
|
||||
são credenciais de `res.users`.
|
||||
- No Android, o controller exige serial/model/brand, valida a licença do
|
||||
dispositivo com tipo `3` (PDV) e inicia a sessão web Odoo após a validação.
|
||||
- Fora do Android, o controller pula a validação de licença para permitir
|
||||
desenvolvimento desktop; ainda exige credenciais válidas do Odoo.
|
||||
- Sucesso JSON contém `status`, `user` (`id`, `name`) e `company_id`. O Odoo
|
||||
emite o cookie HTTP `sid` e retorna o `session_id` interno do Odoo; o app
|
||||
guarda ambos em armazenamento seguro e nunca persiste a senha.
|
||||
- Chamadas autenticadas seguintes enviam o cookie `sid` e o parâmetro
|
||||
`session_id` para restaurar a sessão Odoo 7.
|
||||
- Cada endpoint protegido verifica a presença de usuário e database na sessão,
|
||||
sem forçar um novo `common.login`; o RPC Odoo valida a credencial e
|
||||
`AccessDenied` invalida a sessão.
|
||||
- `POST /pdv_pos/logout` invalida a sessão; o app envia ambos os valores.
|
||||
|
||||
Os tipos de licença `3` foram adicionados aos modelos locais `valida.dispositivo`
|
||||
e centrais `contrecf.mobile`, mantendo Coletor (`1`) e Comanda (`2`) separados.
|
||||
O controller ainda precisa ser instalado e homologado, inclusive contra o
|
||||
serviço central de licenças.
|
||||
|
||||
O app Android usa `DeviceInfo.id`, `model` e `brand`, seguindo o Coletor. É
|
||||
necessário confirmar em POS reais se `DeviceInfo.id` é estável e exclusivo o
|
||||
suficiente para representar o dispositivo/licença.
|
||||
|
||||
`platform` é informado pelo cliente e pode ser falsificado. Portanto, o fluxo
|
||||
sem licença deve ser usado somente para desenvolvimento; não é prova confiável
|
||||
de que a requisição veio de um sistema operacional não Android.
|
||||
|
||||
## Inspeção do backend Odoo 7 (código encontrado, ainda não homologado)
|
||||
|
||||
### Clientes e opções de pagamento (Fase 4)
|
||||
|
||||
Foram criadas duas consultas autenticadas no controller PDV:
|
||||
|
||||
- `POST /pdv_pos/clientes` recebe `query` no corpo do formulário e pesquisa em
|
||||
`financeiro.cliente`, limitada a 50 resultados da empresa padrão do usuário.
|
||||
A resposta inclui nome e documento mascarado; o documento completo não sai
|
||||
do Odoo nem é colocado na URL.
|
||||
- `GET /pdv_pos/formas_pagamento` consulta combinações ativas de
|
||||
`adm.condicao.forma`, incluindo forma e condição de pagamento. A resposta é
|
||||
dinâmica; os IDs/tipos retornados não são fixados no app.
|
||||
|
||||
Na interface, os tipos Odoo são agrupados em quatro ações: Dinheiro (`01`),
|
||||
PIX (`17`, `20`, `23`), Cartão de Crédito (`03`) e Cartão de Débito (`04`). Se
|
||||
o servidor retornar mais de uma condição para um grupo, o app pede a escolha
|
||||
entre as condições disponíveis.
|
||||
|
||||
O app permite distribuir o valor entre várias parcelas/formas, sem exceder o
|
||||
total. Valores em dinheiro são registrados como recebidos na tela; PIX e cartões
|
||||
permanecem pendentes até confirmação pela API do POS, cujo contrato ainda não
|
||||
foi fornecido. A finalização de dinheiro usa o endpoint descrito abaixo. O app
|
||||
exibe número/série da nota e oferece retorno para iniciar nova venda; a
|
||||
impressão depende da API/SDK do POS.
|
||||
|
||||
### Finalização de venda NFC-e (implementada no addon; pendente de homologação)
|
||||
|
||||
- `POST /pdv_pos/finalizar_venda` recebe `checkout_key`, `items` e `payments`
|
||||
como JSON no corpo do formulário; também aceita cliente e CPF/CNPJ opcional.
|
||||
- O endpoint obtém empresa e local padrão da sessão, resolve em lote as
|
||||
locações/embalagens dos produtos, cria pedido com itens e condições, calcula
|
||||
parcelas, valida e chama `pedcap_button_faturar_pedido_nfce`, aguardando o
|
||||
retorno do Odoo/SEFAZ. O app bloqueia as ações durante a chamada e mostra um
|
||||
indicador de finalização.
|
||||
- Só aceita formas de pagamento dinheiro (`01`) até integrar a API do POS.
|
||||
Confere no servidor que as condições estão ativas e que a soma recebida é
|
||||
igual ao total.
|
||||
- A `checkout_key` é usada para localizar o mesmo pedido em uma repetição após
|
||||
timeout, evitando criar outro pedido na mesma sessão de pagamento.
|
||||
- Se o parâmetro do estoque exigir CPF/CNPJ e não houver cliente, o servidor
|
||||
retorna `customer_cpf_required` antes de criar o pedido. O app solicita o
|
||||
documento e repete a chamada.
|
||||
- Se houver uma NFC-e vinculada ao pedido, o checkout retorna sucesso qualquer
|
||||
que seja o estado da nota; a resposta traz número/série, estado, número do
|
||||
pedido e uma mensagem fiscal segura, sem traceback. Notas offline são
|
||||
identificadas como “Emitida em Contingência”. Sem nota vinculada, o app
|
||||
libera nova tentativa e mostra uma mensagem de erro, sem permanecer travado.
|
||||
- O DANFE/NFC-e ainda não é enviado para impressão. A integração escolhida é a
|
||||
API/SDK da impressora do POS, cujo contrato/modelo precisa ser fornecido.
|
||||
|
||||
### Histórico de vendas
|
||||
|
||||
- `GET /pdv_pos/historico_vendas` retorna os pedidos de venda (`tipo = V`) do
|
||||
vendedor associado ao usuário autenticado, nos estados validado (`V`) ou
|
||||
faturado (`F`). Se o pedido não tiver vendedor, só é incluído quando foi
|
||||
criado pelo usuário autenticado. O vendedor é determinado no servidor, não
|
||||
aceito como parâmetro do app.
|
||||
- Cada registro contém número do pedido, data de emissão, nome do cliente
|
||||
quando houver, total e estado. Pedidos faturados abrem uma confirmação de
|
||||
reimpressão; a execução da impressão continua pendente da API/SDK do POS.
|
||||
|
||||
### Leitura de código de barras
|
||||
|
||||
- O botão de câmera lê o código e consulta `GET
|
||||
/pdv_pos/produto_por_codigo_barra`. O endpoint resolve o código de barras
|
||||
cadastrado para uma grade e devolve o produto com os dados do catálogo de
|
||||
venda; quando não houver correspondência disponível no catálogo, retorna
|
||||
`product: null`.
|
||||
- Ao encontrar o item, o app adiciona uma unidade ao carrinho; caso contrário,
|
||||
informa o código lido que não foi encontrado.
|
||||
- As imagens do catálogo são redimensionadas no servidor para até 50 px no
|
||||
maior lado, preservando a proporção.
|
||||
|
||||
Foi encontrado o módulo `api_sigerp`, com controller em `/apsg` e métodos
|
||||
`api_logar`, `api_executar` e `api_revalidar_token`. O script de teste do
|
||||
módulo usa, como exemplo de chamadas, `GET /apsg/api_logar` com os parâmetros
|
||||
`usuario`, `senha` e `sg_code`; as operações seguintes usam
|
||||
`/apsg/api_executar` com token no header `Authorization`. O refresh usa
|
||||
`/apsg/api_revalidar_token` com o parâmetro `token`.
|
||||
|
||||
Esses detalhes são evidência do código legado, não um contrato aprovado para
|
||||
o PDV. O login legado depende de `sg_code`, que contém base, duração do token e uma
|
||||
frase secreta codificados. O campo CNPJ/identificador do app não aparece
|
||||
associado a esse valor. O fluxo genérico também não fornece um endpoint
|
||||
anônimo de saúde: a ação `tabela=teste` é executada depois da autenticação.
|
||||
|
||||
O módulo `vendas_externas` contém métodos de modelo, não controllers HTTP
|
||||
específicos do PDV:
|
||||
|
||||
- `vexdep_busca_departamentos(data_sinc_departamento)` devolve departamentos
|
||||
alterados com código, descrição e departamento pai.
|
||||
- `vexdep_busca_produtos(company_id, data_sic_prod, foto)` devolve grades de
|
||||
produtos alteradas com código, descrição, departamento, preço e saldo; a
|
||||
foto é opcional. O método depende do local configurado no estoque.
|
||||
|
||||
O login agora mantém em memória o `company_id` padrão retornado por `res.users`
|
||||
em um objeto de sessão, para os casos de uso do catálogo. Isso não define uma
|
||||
seleção de empresa quando o usuário tem múltiplas empresas.
|
||||
|
||||
Ainda é necessário confirmar como esses métodos devem ser expostos/chamados,
|
||||
quais permissões são necessárias, o formato de datas, paginação e o contrato
|
||||
da instalação real.
|
||||
|
||||
Os métodos atuais recebem timestamps de sincronização e não oferecem
|
||||
`offset`/`limit`. O de produtos procura alterações em todo o estoque local
|
||||
configurado, portanto não se deve chamá-lo como catálogo paginado sem adaptar
|
||||
o contrato ou definir cache incremental e carga inicial.
|
||||
|
||||
### Catálogo Odoo 7 (Fase 2)
|
||||
|
||||
Por decisão do responsável, a primeira versão retorna todo o catálogo, sem
|
||||
paginação:
|
||||
|
||||
- `GET /pdv_pos/departamentos` retorna `departments: [{id, name}]`, ordenados
|
||||
pelo nome em ordem alfabética. O app mostra somente o nome; `id` serve para
|
||||
solicitar os produtos do departamento.
|
||||
- `GET /pdv_pos/produtos_por_departamento?department_id=<id>` retorna
|
||||
`products` do departamento selecionado, incluindo campos fornecidos por
|
||||
`vexdep_busca_produtos` e imagens; cada produto agora inclui também `grade_id`
|
||||
para criar as linhas de pedido sem nova busca por produto.
|
||||
- O Odoo usa a empresa padrão do usuário autenticado e o local de venda
|
||||
configurado em Estoque/Vendas Externas.
|
||||
- A data de sincronização vazia significa carga inicial completa. Não há
|
||||
`offset`/`limit` nesta versão; rever após medir o tamanho e desempenho do
|
||||
catálogo real.
|
||||
|
||||
### Backend legado: autenticação e seleção de base
|
||||
|
||||
No backend Odoo 7, o helper `valida.controller.MySock` autentica via
|
||||
`xmlrpc/common.login(database, user, password)`. O helper também contém um modo
|
||||
opcional que consulta um arquivo `app.config` para mapear CNPJ para database,
|
||||
mas não foi encontrado um uso desse modo no fluxo de `api_sigerp` ou em
|
||||
`vendas_externas`. Portanto, esse código não confirma que o CNPJ do PDV deve
|
||||
ser usado para selecionar a base.
|
||||
|
||||
O endpoint PDV usa o mapeamento configurado em `app_pdv_pos.config`; a
|
||||
entrada ainda precisa ser configurada e confirmada no ambiente de homologação.
|
||||
|
||||
### Bloqueios de segurança encontrados
|
||||
|
||||
- O controller `api_sigerp` registra `req.params` e o corpo da requisição;
|
||||
isso pode incluir senha, `sg_code` ou token.
|
||||
- O JWT criado pelo código inclui a senha do usuário no payload, que não é
|
||||
criptografado pelo formato JWT.
|
||||
- Estado de autenticação e dados do usuário ficam em atributos mutáveis da
|
||||
instância do controller; o isolamento entre requisições precisa ser
|
||||
verificado.
|
||||
- Nenhum contrato ou implementação Odoo 19 foi encontrado nesta inspeção.
|
||||
- `coletor_android` também registra parâmetros com credenciais e monta uma
|
||||
consulta de autenticação por interpolação de strings. O PDV não reutiliza
|
||||
essas partes, não consulta `usuario.coletor` e não devolve hash de senha.
|
||||
|
||||
Por esses motivos, o app não foi conectado diretamente ao controller `api_sigerp`
|
||||
nem copiou o SQL de login do Coletor. O endpoint dedicado usa a sessão web Odoo.
|
||||
|
||||
Antes de conectar dados reais, documentar para cada operação a URL/rota,
|
||||
método, autenticação, headers, parâmetros, exemplos de request/response,
|
||||
erros, timeout, permissões, idempotência e paginação. Os adaptadores Odoo 7
|
||||
e Odoo 19 devem implementar o contrato comum definido após essa confirmação.
|
||||
@@ -0,0 +1,108 @@
|
||||
# Decisões e pendências
|
||||
|
||||
## Implementado
|
||||
|
||||
- O app mantém Flutter 3.16.5 e Dart 3.2.3; esses SDKs não foram atualizados.
|
||||
- O `compileSdkVersion` Android foi definido como 34, exigido pelo plugin
|
||||
`shared_preferences_android`; min/target SDK permanecem gerenciados pelo
|
||||
Flutter.
|
||||
- A navegação inicial usa rotas nomeadas do Flutter, sem biblioteca extra.
|
||||
- As rotas de venda, carrinho, pagamento e histórico são protegidas e
|
||||
exigem sessão. Nenhum login bem-sucedido é simulado.
|
||||
- A URL e o identificador da empresa são persistidos com
|
||||
`shared_preferences`; senhas não são persistidas e o cookie de sessão é
|
||||
guardado via `flutter_secure_storage`.
|
||||
- O formulário aceita até 14 caracteres alfanuméricos para o identificador.
|
||||
- HTTPS é obrigatório fora do modo debug. HTTP é aceito apenas em debug para
|
||||
permitir desenvolvimento em ambientes locais.
|
||||
- Ao alterar servidor/empresa, a sessão local é invalidada. Cache de dados
|
||||
ainda não existe.
|
||||
- Login e teste de conexão usam contratos internos e adaptadores Odoo 7; a
|
||||
homologação real ainda está pendente.
|
||||
- A sessão em memória mantém o usuário e o `company_id` padrão retornados no
|
||||
login, como contexto inicial para o catálogo.
|
||||
- Foi selecionada uma API de negócio dedicada no módulo `pdv_pos`. O primeiro
|
||||
endpoint definido é `GET /pdv_pos/health`, sem autenticação e sem dados
|
||||
sensíveis; login e catálogo serão definidos separadamente.
|
||||
- O botão Testar conexão usa o endpoint de health, exige HTTP 200 e o JSON
|
||||
esperado, aplica timeout e não segue redirecionamentos.
|
||||
- O login Odoo 7 combina seleção de database por CNPJ via `app_pdv_pos.config`,
|
||||
validação da licença do dispositivo e autenticação de `res.users` em
|
||||
`POST /pdv_pos/logar`.
|
||||
- A sessão Odoo 7 usa o cookie HTTP `sid` e o `session_id` interno, ambos
|
||||
armazenados com `flutter_secure_storage`; a senha não é persistida.
|
||||
- Em execução desktop de desenvolvimento (por exemplo, Linux), o cookie de
|
||||
sessão fica somente em memória para não depender do plugin nativo seguro.
|
||||
- O tipo de licença `3` foi reservado ao PDV, sem reutilizar os tipos de
|
||||
Coletor ou Comanda.
|
||||
- O app pula a leitura/licença do dispositivo fora do Android para permitir
|
||||
testes desktop; o login Odoo continua obrigatório. O valor de plataforma é
|
||||
declarativo e não deve ser tratado como controle de segurança em produção.
|
||||
- A permissão de câmera está declarada para uso futuro, mas não é solicitada
|
||||
em tempo de execução nesta fase.
|
||||
|
||||
## Fase 1 parcialmente concluída
|
||||
|
||||
- Tela de login com usuário, senha (ocultável), validação, carregamento e
|
||||
botão de saída, integrada à sessão web Odoo e checagem da licença do POS.
|
||||
- Tela de configuração com carregamento, validação, salvar/cancelar e teste
|
||||
de conexão com health check dedicado.
|
||||
- Persistência local das configurações não sensíveis.
|
||||
- A permissão de câmera está declarada para uso futuro, mas não é solicitada
|
||||
em tempo de execução nesta fase.
|
||||
|
||||
## Fase 2 iniciada
|
||||
|
||||
- Departamentos carregam todos os registros, ordenados alfabeticamente; a UI
|
||||
exibe apenas o nome e mantém o ID para consultar produtos.
|
||||
- Produtos são carregados por departamento pelo método existente de Vendas
|
||||
Externas, usando a empresa padrão do usuário e todas as páginas/registros.
|
||||
- Não há paginação por decisão inicial; medir o catálogo POS real e rever caso
|
||||
o carregamento seja pesado.
|
||||
- A visualização Kanban usa três produtos por linha. A preferência Lista/Kanban
|
||||
é persistida localmente por ID do usuário Odoo.
|
||||
|
||||
## Fase 3 parcialmente concluída
|
||||
|
||||
- Carrinho compartilhado entre Venda e Carrinho durante a sessão do app.
|
||||
- Quantidade pode ser aumentada; o botão Menos não reduz abaixo de 1. A lixeira
|
||||
remove explicitamente o item e Limpar carrinho exige confirmação.
|
||||
- Total é uma prévia calculada em unidades mínimas inteiras; se algum preço
|
||||
estiver indisponível, o total também é indicado como indisponível.
|
||||
|
||||
## Fase 4 parcialmente concluída
|
||||
|
||||
- Consulta de clientes por nome ou documento usa `financeiro.cliente`, filtra
|
||||
pela empresa padrão e só retorna documento mascarado.
|
||||
- Opções dinâmicas vêm de combinações ativas em `adm.condicao.forma`.
|
||||
- A tela agrupa as formas em Dinheiro, PIX, Cartão de Crédito e Cartão de
|
||||
Débito conforme os códigos Odoo; combinações múltiplas do mesmo grupo pedem
|
||||
escolha da condição.
|
||||
- É possível lançar várias parcelas e distribuir o valor da venda entre formas
|
||||
diferentes, sem exceder o total. Dinheiro fica registrado como recebido;
|
||||
PIX/cartões ficam pendentes de confirmação pela API do POS.
|
||||
- Finalização NFC-e aceita, por enquanto, somente pagamentos totalmente em
|
||||
dinheiro. O endpoint cria/valida o pedido e aguarda
|
||||
`pedcap_button_faturar_pedido_nfce`; se a nota estiver vinculada, retorna
|
||||
número/série/estado mesmo quando a autorização falhar. A tela bloqueia ações
|
||||
durante a espera e exibe o erro; sem nota, libera uma nova tentativa.
|
||||
- Cliente continua opcional. Se a configuração do Odoo exigir CPF/CNPJ para
|
||||
NFC-e, o app pergunta antes de repetir a finalização.
|
||||
- A tela final exibe número/série da nota e permite iniciar outra venda. O
|
||||
botão de impressão aguarda o contrato da API/SDK da impressora do POS.
|
||||
|
||||
## Pendências
|
||||
|
||||
- Homologar `GET /pdv_pos/health` no servidor Odoo 7 alvo.
|
||||
- Homologar login, cookie de sessão e tipo de licença `3` no serviço central.
|
||||
- Validar se `DeviceInfo.id` é uma identidade estável/exclusiva nos POS alvo.
|
||||
- Reavaliar paginação e cache persistente após medir o catálogo nos POS alvo.
|
||||
- Definir versão/descoberta do Odoo e o uso do identificador enviado pelo app.
|
||||
- Significado do identificador exibido como CNPJ.
|
||||
- Modelo POS, versão mínima do Android e orientação alvo.
|
||||
- Contrato da API oficial do POS para confirmar PIX/cartão e imprimir NFC-e,
|
||||
inclusive reimpressão a partir do histórico de vendas.
|
||||
- Exibir no histórico o número e a série da NFC-e vinculada a cada pedido.
|
||||
- Homologar leitura por câmera e os demais requisitos de documento fiscal/
|
||||
impressora no modelo de POS escolhido.
|
||||
- Regras para operação sem conexão.
|
||||
@@ -0,0 +1,34 @@
|
||||
**/dgph
|
||||
*.mode1v3
|
||||
*.mode2v3
|
||||
*.moved-aside
|
||||
*.pbxuser
|
||||
*.perspectivev3
|
||||
**/*sync/
|
||||
.sconsign.dblite
|
||||
.tags*
|
||||
**/.vagrant/
|
||||
**/DerivedData/
|
||||
Icon?
|
||||
**/Pods/
|
||||
**/.symlinks/
|
||||
profile
|
||||
xcuserdata
|
||||
**/.generated/
|
||||
Flutter/App.framework
|
||||
Flutter/Flutter.framework
|
||||
Flutter/Flutter.podspec
|
||||
Flutter/Generated.xcconfig
|
||||
Flutter/ephemeral/
|
||||
Flutter/app.flx
|
||||
Flutter/app.zip
|
||||
Flutter/flutter_assets/
|
||||
Flutter/flutter_export_environment.sh
|
||||
ServiceDefinitions.json
|
||||
Runner/GeneratedPluginRegistrant.*
|
||||
|
||||
# Exceptions to above rules.
|
||||
!default.mode1v3
|
||||
!default.mode2v3
|
||||
!default.pbxuser
|
||||
!default.perspectivev3
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>App</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>io.flutter.flutter.app</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>App</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>11.0</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1 @@
|
||||
#include "Generated.xcconfig"
|
||||
@@ -0,0 +1 @@
|
||||
#include "Generated.xcconfig"
|
||||
@@ -0,0 +1,614 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 54;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
|
||||
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 97C146ED1CF9000F007C117D;
|
||||
remoteInfo = Runner;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* 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>"; };
|
||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
|
||||
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
|
||||
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
|
||||
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
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>"; };
|
||||
331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
|
||||
331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
97C146EB1CF9000F007C117D /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
9740EEB11CF90186004384FC /* Flutter */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
|
||||
9740EEB21CF90195004384FC /* Debug.xcconfig */,
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
|
||||
9740EEB31CF90195004384FC /* Generated.xcconfig */,
|
||||
);
|
||||
name = Flutter;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
331C8082294A63A400263BE5 /* RunnerTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
331C807B294A618700263BE5 /* RunnerTests.swift */,
|
||||
);
|
||||
path = RunnerTests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146E51CF9000F007C117D = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9740EEB11CF90186004384FC /* Flutter */,
|
||||
97C146F01CF9000F007C117D /* Runner */,
|
||||
97C146EF1CF9000F007C117D /* Products */,
|
||||
331C8082294A63A400263BE5 /* RunnerTests */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146EF1CF9000F007C117D /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
97C146EE1CF9000F007C117D /* Runner.app */,
|
||||
331C8081294A63A400263BE5 /* RunnerTests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146F01CF9000F007C117D /* Runner */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
97C146FA1CF9000F007C117D /* Main.storyboard */,
|
||||
97C146FD1CF9000F007C117D /* Assets.xcassets */,
|
||||
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
|
||||
97C147021CF9000F007C117D /* Info.plist */,
|
||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
|
||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
|
||||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
|
||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
|
||||
);
|
||||
path = Runner;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
331C8080294A63A400263BE5 /* RunnerTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */;
|
||||
buildPhases = (
|
||||
331C807D294A63A400263BE5 /* Sources */,
|
||||
331C807E294A63A400263BE5 /* Frameworks */,
|
||||
331C807F294A63A400263BE5 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
331C8086294A63A400263BE5 /* PBXTargetDependency */,
|
||||
);
|
||||
name = RunnerTests;
|
||||
productName = RunnerTests;
|
||||
productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
97C146ED1CF9000F007C117D /* Runner */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
||||
buildPhases = (
|
||||
9740EEB61CF901F6004384FC /* Run Script */,
|
||||
97C146EA1CF9000F007C117D /* Sources */,
|
||||
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||
97C146EC1CF9000F007C117D /* Resources */,
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = Runner;
|
||||
productName = Runner;
|
||||
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
97C146E61CF9000F007C117D /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
BuildIndependentTargetsInParallel = YES;
|
||||
LastUpgradeCheck = 1430;
|
||||
ORGANIZATIONNAME = "";
|
||||
TargetAttributes = {
|
||||
331C8080294A63A400263BE5 = {
|
||||
CreatedOnToolsVersion = 14.0;
|
||||
TestTargetID = 97C146ED1CF9000F007C117D;
|
||||
};
|
||||
97C146ED1CF9000F007C117D = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
LastSwiftMigration = 1100;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
|
||||
compatibilityVersion = "Xcode 9.3";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 97C146E51CF9000F007C117D;
|
||||
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
97C146ED1CF9000F007C117D /* Runner */,
|
||||
331C8080294A63A400263BE5 /* RunnerTests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
331C807F294A63A400263BE5 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
97C146EC1CF9000F007C117D /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
|
||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
|
||||
);
|
||||
name = "Thin Binary";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
|
||||
};
|
||||
9740EEB61CF901F6004384FC /* Run Script */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Run Script";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
331C807D294A63A400263BE5 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
97C146EA1CF9000F007C117D /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
|
||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
331C8086294A63A400263BE5 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 97C146ED1CF9000F007C117D /* Runner */;
|
||||
targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
97C146FB1CF9000F007C117D /* Base */,
|
||||
);
|
||||
name = Main.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
97C147001CF9000F007C117D /* Base */,
|
||||
);
|
||||
name = LaunchScreen.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
249021D3217E4FDB00AE95B9 /* Profile */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SUPPORTED_PLATFORMS = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Profile;
|
||||
};
|
||||
249021D4217E4FDB00AE95B9 /* Profile */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.pdv;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
};
|
||||
name = Profile;
|
||||
};
|
||||
331C8088294A63A400263BE5 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = AE0B7B92F70575B8D7E0D07E /* Pods-RunnerTests.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.pdv.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
331C8089294A63A400263BE5 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 89B67EB44CE7B6631473024E /* Pods-RunnerTests.release.xcconfig */;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.pdv.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
331C808A294A63A400263BE5 /* Profile */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 640959BDD8F10B91D80A66BE /* Pods-RunnerTests.profile.xcconfig */;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.pdv.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
|
||||
};
|
||||
name = Profile;
|
||||
};
|
||||
97C147031CF9000F007C117D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
97C147041CF9000F007C117D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SUPPORTED_PLATFORMS = iphoneos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
97C147061CF9000F007C117D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.pdv;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
97C147071CF9000F007C117D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.pdv;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
331C8088294A63A400263BE5 /* Debug */,
|
||||
331C8089294A63A400263BE5 /* Release */,
|
||||
331C808A294A63A400263BE5 /* Profile */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
97C147031CF9000F007C117D /* Debug */,
|
||||
97C147041CF9000F007C117D /* Release */,
|
||||
249021D3217E4FDB00AE95B9 /* Profile */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
97C147061CF9000F007C117D /* Debug */,
|
||||
97C147071CF9000F007C117D /* Release */,
|
||||
249021D4217E4FDB00AE95B9 /* Profile */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 97C146E61CF9000F007C117D /* Project object */;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>PreviewsEnabled</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1430"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO"
|
||||
parallelizable = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "331C8080294A63A400263BE5"
|
||||
BuildableName = "RunnerTests.xctest"
|
||||
BlueprintName = "RunnerTests"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Profile"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||
BuildableName = "Runner.app"
|
||||
BlueprintName = "Runner"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:Runner.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>PreviewsEnabled</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,13 @@
|
||||
import UIKit
|
||||
import Flutter
|
||||
|
||||
@UIApplicationMain
|
||||
@objc class AppDelegate: FlutterAppDelegate {
|
||||
override func application(
|
||||
_ application: UIApplication,
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||
) -> Bool {
|
||||
GeneratedPluginRegistrant.register(with: self)
|
||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-20x20@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-20x20@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-40x40@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-40x40@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-60x60@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-60x60@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-20x20@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-20x20@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-29x29@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-29x29@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-40x40@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-40x40@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-76x76@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-76x76@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "83.5x83.5",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-83.5x83.5@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "1024x1024",
|
||||
"idiom" : "ios-marketing",
|
||||
"filename" : "Icon-App-1024x1024@1x.png",
|
||||
"scale" : "1x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 881 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 7.7 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 7.2 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 41 KiB |
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage@3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 68 B |
|
After Width: | Height: | Size: 68 B |
|
After Width: | Height: | Size: 68 B |
@@ -0,0 +1,5 @@
|
||||
# Launch Screen Assets
|
||||
|
||||
You can customize the launch screen with your own desired assets by replacing the image files in this directory.
|
||||
|
||||
You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
|
||||
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
|
||||
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="LaunchImage" width="168" height="185"/>
|
||||
</resources>
|
||||
</document>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Flutter View Controller-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>Pdv</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>pdv</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>$(FLUTTER_BUILD_NAME)</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>A câmera é usada para ler códigos de barras dos produtos.</string>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||
<true/>
|
||||
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1 @@
|
||||
#import "GeneratedPluginRegistrant.h"
|
||||
@@ -0,0 +1,12 @@
|
||||
import Flutter
|
||||
import UIKit
|
||||
import XCTest
|
||||
|
||||
class RunnerTests: XCTestCase {
|
||||
|
||||
func testExample() {
|
||||
// If you add code to the Runner application, consider adding tests here.
|
||||
// See https://developer.apple.com/documentation/xctest for more information about using XCTest.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'app_services.dart';
|
||||
import 'router/app_router.dart';
|
||||
import 'theme/app_theme.dart';
|
||||
|
||||
class PdvApp extends StatelessWidget {
|
||||
const PdvApp({this.services, super.key});
|
||||
|
||||
static final GlobalKey<NavigatorState> navigatorKey =
|
||||
GlobalKey<NavigatorState>();
|
||||
|
||||
final AppServices? services;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final appServices = services ?? AppServices.defaults;
|
||||
return MaterialApp(
|
||||
title: 'PDV',
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: AppTheme.light,
|
||||
navigatorKey: navigatorKey,
|
||||
initialRoute: AppRoutes.login,
|
||||
onGenerateRoute: AppRouter(services: appServices).onGenerateRoute,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
import '../core/config/app_version_provider.dart';
|
||||
import '../core/config/pos_device_provider.dart';
|
||||
import '../core/storage/session_storage_factory.dart';
|
||||
import '../data/datasources/remote/odoo_connection_tester.dart';
|
||||
import '../data/datasources/remote/odoo_session_api_client.dart';
|
||||
import '../data/repositories/odoo_customer_repository.dart';
|
||||
import '../data/repositories/odoo_payment_methods_repository.dart';
|
||||
import '../data/repositories/odoo_sale_checkout_repository.dart';
|
||||
import '../data/repositories/odoo_sales_history_repository.dart';
|
||||
import '../data/repositories/odoo_catalog_repository.dart';
|
||||
import '../data/repositories/odoo_auth_repository.dart';
|
||||
import '../data/repositories/shared_preferences_sale_view_preference_repository.dart';
|
||||
import '../data/repositories/shared_preferences_settings_repository.dart';
|
||||
import '../domain/repositories/auth_repository.dart';
|
||||
import '../domain/repositories/cart_repository.dart';
|
||||
import '../domain/repositories/catalog_repository.dart';
|
||||
import '../domain/repositories/customer_repository.dart';
|
||||
import '../domain/repositories/connection_tester.dart';
|
||||
import '../domain/repositories/payment_methods_repository.dart';
|
||||
import '../domain/repositories/sale_checkout_repository.dart';
|
||||
import '../domain/repositories/sales_history_repository.dart';
|
||||
import '../domain/repositories/settings_repository.dart';
|
||||
import '../domain/repositories/sale_view_preference_repository.dart';
|
||||
|
||||
class AppServices {
|
||||
const AppServices({
|
||||
required this.settingsRepository,
|
||||
required this.connectionTester,
|
||||
required this.authRepository,
|
||||
required this.appVersionProvider,
|
||||
required this.posDeviceProvider,
|
||||
required this.catalogRepository,
|
||||
required this.cartRepository,
|
||||
required this.saleViewPreferenceRepository,
|
||||
required this.customerRepository,
|
||||
required this.paymentMethodsRepository,
|
||||
required this.saleCheckoutRepository,
|
||||
required this.salesHistoryRepository,
|
||||
});
|
||||
|
||||
static final defaults = _createDefaults();
|
||||
|
||||
static AppServices _createDefaults() {
|
||||
const settingsRepository = SharedPreferencesSettingsRepository();
|
||||
final sessionStorage = createSessionStorage();
|
||||
final authRepository = OdooAuthRepository(sessionStorage: sessionStorage);
|
||||
final apiClient = OdooSessionApiClient(
|
||||
authRepository: authRepository,
|
||||
settingsRepository: settingsRepository,
|
||||
sessionStorage: sessionStorage,
|
||||
);
|
||||
return AppServices(
|
||||
settingsRepository: settingsRepository,
|
||||
connectionTester: OdooConnectionTester(),
|
||||
authRepository: authRepository,
|
||||
appVersionProvider: const PackageInfoAppVersionProvider(),
|
||||
posDeviceProvider: PlatformPosDeviceProvider(),
|
||||
catalogRepository: OdooCatalogRepository(apiClient: apiClient),
|
||||
customerRepository: OdooCustomerRepository(apiClient: apiClient),
|
||||
paymentMethodsRepository:
|
||||
OdooPaymentMethodsRepository(apiClient: apiClient),
|
||||
saleCheckoutRepository: OdooSaleCheckoutRepository(apiClient: apiClient),
|
||||
salesHistoryRepository: OdooSalesHistoryRepository(apiClient: apiClient),
|
||||
cartRepository: InMemoryCartRepository(),
|
||||
saleViewPreferenceRepository:
|
||||
const SharedPreferencesSaleViewPreferenceRepository(),
|
||||
);
|
||||
}
|
||||
|
||||
final SettingsRepository settingsRepository;
|
||||
final ConnectionTester connectionTester;
|
||||
final AuthRepository authRepository;
|
||||
final AppVersionProvider appVersionProvider;
|
||||
final PosDeviceProvider posDeviceProvider;
|
||||
final CatalogRepository catalogRepository;
|
||||
final CartRepository cartRepository;
|
||||
final SaleViewPreferenceRepository saleViewPreferenceRepository;
|
||||
final CustomerRepository customerRepository;
|
||||
final PaymentMethodsRepository paymentMethodsRepository;
|
||||
final SaleCheckoutRepository saleCheckoutRepository;
|
||||
final SalesHistoryRepository salesHistoryRepository;
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../app_services.dart';
|
||||
import '../../domain/entities/customer.dart';
|
||||
import '../../domain/entities/sale_completion.dart';
|
||||
import '../../features/cart/presentation/cart_screen.dart';
|
||||
import '../../features/customer_search/presentation/customer_search_screen.dart';
|
||||
import '../../features/login/presentation/login_screen.dart';
|
||||
import '../../features/menu/presentation/menu_screen.dart';
|
||||
import '../../features/payment/presentation/payment_screen.dart';
|
||||
import '../../features/payment/presentation/sale_complete_screen.dart';
|
||||
import '../../features/sale/presentation/sale_screen.dart';
|
||||
import '../../features/sales_history/presentation/sales_history_screen.dart';
|
||||
import '../../features/settings/presentation/settings_screen.dart';
|
||||
import '../../features/shared/presentation/placeholder_screen.dart';
|
||||
|
||||
class AppRoutes {
|
||||
AppRoutes._();
|
||||
|
||||
static const login = '/login';
|
||||
static const menu = '/menu';
|
||||
static const settings = '/settings';
|
||||
static const sale = '/sale';
|
||||
static const cart = '/cart';
|
||||
static const payment = '/payment';
|
||||
static const customerSearch = '/customer-search';
|
||||
static const saleComplete = '/sale-complete';
|
||||
static const salesHistory = '/sales-history';
|
||||
static const saleDetail = '/sale-detail';
|
||||
}
|
||||
|
||||
class AppRouter {
|
||||
AppRouter({required this.services});
|
||||
|
||||
final AppServices services;
|
||||
|
||||
static const _protectedRoutes = <String>{
|
||||
AppRoutes.sale,
|
||||
AppRoutes.menu,
|
||||
AppRoutes.cart,
|
||||
AppRoutes.payment,
|
||||
AppRoutes.customerSearch,
|
||||
AppRoutes.saleComplete,
|
||||
AppRoutes.salesHistory,
|
||||
AppRoutes.saleDetail,
|
||||
};
|
||||
|
||||
Route<dynamic> onGenerateRoute(RouteSettings settings) {
|
||||
final routeName = settings.name ?? AppRoutes.login;
|
||||
if (_protectedRoutes.contains(routeName) &&
|
||||
!services.authRepository.isAuthenticated) {
|
||||
if (routeName == AppRoutes.customerSearch) {
|
||||
return MaterialPageRoute<Customer?>(
|
||||
settings: const RouteSettings(name: AppRoutes.login),
|
||||
builder: (_) => LoginScreen(services: services),
|
||||
);
|
||||
}
|
||||
return MaterialPageRoute<void>(
|
||||
settings: const RouteSettings(name: AppRoutes.login),
|
||||
builder: (_) => LoginScreen(services: services),
|
||||
);
|
||||
}
|
||||
|
||||
if (routeName == AppRoutes.customerSearch) {
|
||||
return MaterialPageRoute<Customer?>(
|
||||
settings: settings,
|
||||
builder: (_) => CustomerSearchScreen(services: services),
|
||||
);
|
||||
}
|
||||
|
||||
if (routeName == AppRoutes.saleComplete) {
|
||||
final completion = settings.arguments;
|
||||
if (completion is SaleCompletion) {
|
||||
return MaterialPageRoute<void>(
|
||||
settings: settings,
|
||||
builder: (_) => SaleCompleteScreen(
|
||||
services: services,
|
||||
completion: completion,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
final page = switch (routeName) {
|
||||
AppRoutes.login => LoginScreen(services: services),
|
||||
AppRoutes.menu => MenuScreen(services: services),
|
||||
AppRoutes.settings => SettingsScreen(services: services),
|
||||
AppRoutes.sale => SaleScreen(services: services),
|
||||
AppRoutes.cart => CartScreen(services: services),
|
||||
AppRoutes.payment => PaymentScreen(services: services),
|
||||
AppRoutes.saleComplete => const PlaceholderScreen(
|
||||
title: 'Encerramento da venda',
|
||||
message: 'Dados da NFC-e não recebidos.',
|
||||
),
|
||||
AppRoutes.salesHistory => SalesHistoryScreen(services: services),
|
||||
AppRoutes.saleDetail => const PlaceholderScreen(
|
||||
title: 'Detalhes da venda',
|
||||
message: 'Os detalhes serão carregados do servidor.',
|
||||
),
|
||||
_ => const PlaceholderScreen(
|
||||
title: 'Página não encontrada',
|
||||
message: 'O endereço solicitado não existe.',
|
||||
),
|
||||
};
|
||||
|
||||
return MaterialPageRoute<void>(
|
||||
settings: settings,
|
||||
builder: (_) => page,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppTheme {
|
||||
AppTheme._();
|
||||
|
||||
static const _brandColor = Color(0xFF087F76);
|
||||
|
||||
static ThemeData get light {
|
||||
final colorScheme = ColorScheme.fromSeed(
|
||||
seedColor: _brandColor,
|
||||
brightness: Brightness.light,
|
||||
);
|
||||
|
||||
return ThemeData(
|
||||
useMaterial3: true,
|
||||
colorScheme: colorScheme,
|
||||
scaffoldBackgroundColor: const Color(0xFFF6F8F9),
|
||||
appBarTheme: const AppBarTheme(
|
||||
centerTitle: false,
|
||||
backgroundColor: Color(0xFFF6F8F9),
|
||||
surfaceTintColor: Colors.transparent,
|
||||
),
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: const BorderSide(color: Color(0xFFD7DEDF)),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: const BorderSide(color: Color(0xFFD7DEDF)),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: const BorderSide(color: _brandColor, width: 2),
|
||||
),
|
||||
),
|
||||
filledButtonTheme: FilledButtonThemeData(
|
||||
style: FilledButton.styleFrom(
|
||||
minimumSize: const Size.fromHeight(52),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
textStyle: const TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
|
||||
abstract interface class AppVersionProvider {
|
||||
Future<String> getVersion();
|
||||
}
|
||||
|
||||
class PackageInfoAppVersionProvider implements AppVersionProvider {
|
||||
const PackageInfoAppVersionProvider();
|
||||
|
||||
@override
|
||||
Future<String> getVersion() async {
|
||||
final packageInfo = await PackageInfo.fromPlatform();
|
||||
return packageInfo.version;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
|
||||
import '../../domain/entities/pos_device.dart';
|
||||
|
||||
abstract interface class PosDeviceProvider {
|
||||
Future<PosDevice> getDevice();
|
||||
}
|
||||
|
||||
class PlatformPosDeviceProvider implements PosDeviceProvider {
|
||||
PlatformPosDeviceProvider({DeviceInfoPlugin? plugin})
|
||||
: _plugin = plugin ?? DeviceInfoPlugin();
|
||||
|
||||
final DeviceInfoPlugin _plugin;
|
||||
|
||||
@override
|
||||
Future<PosDevice> getDevice() async {
|
||||
if (!Platform.isAndroid) {
|
||||
return PosDevice(platform: Platform.operatingSystem);
|
||||
}
|
||||
final info = await _plugin.androidInfo;
|
||||
return PosDevice(
|
||||
platform: 'android',
|
||||
serial: info.id,
|
||||
model: info.model,
|
||||
brand: info.brand,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
class ServerUrlValidator {
|
||||
ServerUrlValidator._();
|
||||
|
||||
static String? validate(String value, {bool requireHttps = false}) {
|
||||
final trimmed = value.trim();
|
||||
if (trimmed.isEmpty) {
|
||||
return 'Informe a URL do servidor.';
|
||||
}
|
||||
|
||||
final uri = Uri.tryParse(trimmed);
|
||||
if (uri == null || !uri.hasAuthority || uri.host.isEmpty) {
|
||||
return 'Informe uma URL válida, incluindo o host.';
|
||||
}
|
||||
if (uri.scheme != 'https' && uri.scheme != 'http') {
|
||||
return 'A URL deve usar HTTP ou HTTPS.';
|
||||
}
|
||||
if (requireHttps && uri.scheme != 'https') {
|
||||
return 'Use uma URL HTTPS para proteger a conexão.';
|
||||
}
|
||||
if (uri.userInfo.isNotEmpty || uri.hasFragment) {
|
||||
return 'A URL não pode conter credenciais ou fragmentos.';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
|
||||
abstract interface class SecureSessionStorage {
|
||||
Future<String?> readCookie();
|
||||
|
||||
Future<String?> readServerUrl();
|
||||
|
||||
Future<String?> readSessionId();
|
||||
|
||||
Future<void> writeSession(
|
||||
{required String cookie,
|
||||
required String serverUrl,
|
||||
required String sessionId});
|
||||
|
||||
Future<void> clearCookie();
|
||||
}
|
||||
|
||||
class FlutterSecureSessionStorage implements SecureSessionStorage {
|
||||
FlutterSecureSessionStorage({FlutterSecureStorage? storage})
|
||||
: _storage = storage ?? const FlutterSecureStorage();
|
||||
|
||||
static const _cookieKey = 'pdv.odoo_session_cookie';
|
||||
static const _serverUrlKey = 'pdv.odoo_session_server_url';
|
||||
static const _sessionIdKey = 'pdv.odoo_session_id';
|
||||
final FlutterSecureStorage _storage;
|
||||
|
||||
@override
|
||||
Future<String?> readCookie() => _storage.read(key: _cookieKey);
|
||||
|
||||
@override
|
||||
Future<String?> readServerUrl() => _storage.read(key: _serverUrlKey);
|
||||
|
||||
@override
|
||||
Future<String?> readSessionId() => _storage.read(key: _sessionIdKey);
|
||||
|
||||
@override
|
||||
Future<void> writeSession(
|
||||
{required String cookie,
|
||||
required String serverUrl,
|
||||
required String sessionId}) async {
|
||||
await _storage.write(key: _cookieKey, value: cookie);
|
||||
await _storage.write(key: _serverUrlKey, value: serverUrl);
|
||||
await _storage.write(key: _sessionIdKey, value: sessionId);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> clearCookie() async {
|
||||
await _storage.delete(key: _cookieKey);
|
||||
await _storage.delete(key: _serverUrlKey);
|
||||
await _storage.delete(key: _sessionIdKey);
|
||||
}
|
||||
}
|
||||
|
||||
class InMemorySessionStorage implements SecureSessionStorage {
|
||||
String? _cookie;
|
||||
String? _serverUrl;
|
||||
String? _sessionId;
|
||||
|
||||
@override
|
||||
Future<String?> readCookie() async => _cookie;
|
||||
|
||||
@override
|
||||
Future<String?> readServerUrl() async => _serverUrl;
|
||||
|
||||
@override
|
||||
Future<String?> readSessionId() async => _sessionId;
|
||||
|
||||
@override
|
||||
Future<void> writeSession({
|
||||
required String cookie,
|
||||
required String serverUrl,
|
||||
required String sessionId,
|
||||
}) async {
|
||||
_cookie = cookie;
|
||||
_serverUrl = serverUrl;
|
||||
_sessionId = sessionId;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> clearCookie() async {
|
||||
_cookie = null;
|
||||
_serverUrl = null;
|
||||
_sessionId = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import 'secure_session_storage.dart';
|
||||
|
||||
SecureSessionStorage createSessionStorage() {
|
||||
if (Platform.isAndroid || Platform.isIOS) {
|
||||
return FlutterSecureSessionStorage();
|
||||
}
|
||||
if (kDebugMode) {
|
||||
return InMemorySessionStorage();
|
||||
}
|
||||
throw UnsupportedError(
|
||||
'O armazenamento seguro de sessão só está disponível em Android/iOS.',
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
class CurrencyFormatter {
|
||||
CurrencyFormatter._();
|
||||
|
||||
static String formatBrl(int? minorUnits) {
|
||||
if (minorUnits == null) return 'Preço indisponível';
|
||||
|
||||
final negative = minorUnits < 0;
|
||||
final value = minorUnits.abs();
|
||||
final whole = value ~/ 100;
|
||||
final cents = (value % 100).toString().padLeft(2, '0');
|
||||
final groupedWhole = _groupThousands(whole.toString());
|
||||
final sign = negative ? '-' : '';
|
||||
return '${sign}R\$ $groupedWhole,$cents';
|
||||
}
|
||||
|
||||
static String _groupThousands(String digits) {
|
||||
final groups = <String>[];
|
||||
for (var end = digits.length; end > 0; end -= 3) {
|
||||
final start = end - 3 < 0 ? 0 : end - 3;
|
||||
groups.insert(0, digits.substring(start, end));
|
||||
}
|
||||
return groups.join('.');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppButton extends StatelessWidget {
|
||||
const AppButton({
|
||||
required this.label,
|
||||
required this.onPressed,
|
||||
this.icon,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final String label;
|
||||
final VoidCallback? onPressed;
|
||||
final IconData? icon;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FilledButton.icon(
|
||||
onPressed: onPressed,
|
||||
icon: Icon(icon ?? Icons.arrow_forward),
|
||||
label: Text(label),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppTextField extends StatelessWidget {
|
||||
const AppTextField({
|
||||
required this.label,
|
||||
this.controller,
|
||||
this.obscureText = false,
|
||||
this.keyboardType,
|
||||
this.textInputAction,
|
||||
this.prefixIcon,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final String label;
|
||||
final TextEditingController? controller;
|
||||
final bool obscureText;
|
||||
final TextInputType? keyboardType;
|
||||
final TextInputAction? textInputAction;
|
||||
final IconData? prefixIcon;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextField(
|
||||
controller: controller,
|
||||
obscureText: obscureText,
|
||||
keyboardType: keyboardType,
|
||||
textInputAction: textInputAction,
|
||||
decoration: InputDecoration(
|
||||
labelText: label,
|
||||
prefixIcon: prefixIcon == null ? null : Icon(prefixIcon),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class EmptyView extends StatelessWidget {
|
||||
const EmptyView({
|
||||
required this.title,
|
||||
required this.message,
|
||||
this.icon = Icons.inbox_outlined,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final String title;
|
||||
final String message;
|
||||
final IconData icon;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(icon, size: 48, color: Theme.of(context).colorScheme.outline),
|
||||
const SizedBox(height: 12),
|
||||
Text(title, style: Theme.of(context).textTheme.titleMedium),
|
||||
const SizedBox(height: 4),
|
||||
Text(message, textAlign: TextAlign.center),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ErrorView extends StatelessWidget {
|
||||
const ErrorView({
|
||||
required this.message,
|
||||
this.onRetry,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final String message;
|
||||
final VoidCallback? onRetry;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.cloud_off_outlined,
|
||||
size: 40,
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(message, textAlign: TextAlign.center),
|
||||
if (onRetry != null) ...[
|
||||
const SizedBox(height: 16),
|
||||
TextButton.icon(
|
||||
onPressed: onRetry,
|
||||
icon: const Icon(Icons.refresh),
|
||||
label: const Text('Tentar novamente'),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class LoadingView extends StatelessWidget {
|
||||
const LoadingView({this.message = 'Carregando...', super.key});
|
||||
|
||||
final String message;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const CircularProgressIndicator(),
|
||||
const SizedBox(height: 16),
|
||||
Text(message),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
class OdooApiUriBuilder {
|
||||
OdooApiUriBuilder._();
|
||||
|
||||
static Uri endpoint(Uri serverUri, String endpointPath) {
|
||||
final basePath = serverUri.path.replaceFirst(RegExp(r'/+$'), '');
|
||||
final normalizedEndpoint =
|
||||
endpointPath.startsWith('/') ? endpointPath : '/$endpointPath';
|
||||
return Uri(
|
||||
scheme: serverUri.scheme,
|
||||
host: serverUri.host,
|
||||
port: serverUri.hasPort ? serverUri.port : null,
|
||||
path: '$basePath$normalizedEndpoint',
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../../../domain/repositories/connection_tester.dart';
|
||||
import 'odoo_api_uri_builder.dart';
|
||||
|
||||
class OdooConnectionTester implements ConnectionTester {
|
||||
OdooConnectionTester({http.Client? client})
|
||||
: _client = client ?? http.Client();
|
||||
|
||||
static const _timeout = Duration(seconds: 10);
|
||||
final http.Client _client;
|
||||
|
||||
@override
|
||||
Future<ConnectionTestResult> test(Uri serverUri) async {
|
||||
final healthUri = OdooApiUriBuilder.endpoint(serverUri, '/pdv_pos/health');
|
||||
try {
|
||||
final request = http.Request('GET', healthUri)
|
||||
..followRedirects = false
|
||||
..headers['Accept'] = 'application/json';
|
||||
final response = await _client
|
||||
.send(request)
|
||||
.then(http.Response.fromStream)
|
||||
.timeout(_timeout);
|
||||
if (response.statusCode != HttpStatus.ok) {
|
||||
return ConnectionTestResult(
|
||||
isAvailable: false,
|
||||
message: 'O servidor respondeu com erro HTTP ${response.statusCode}.',
|
||||
);
|
||||
}
|
||||
|
||||
final body = jsonDecode(response.body);
|
||||
if (body is Map<String, dynamic> &&
|
||||
body['status'] == 'ok' &&
|
||||
body['api_version'] == 1) {
|
||||
return const ConnectionTestResult(
|
||||
isAvailable: true,
|
||||
message: 'Conexão com o servidor estabelecida.',
|
||||
);
|
||||
}
|
||||
|
||||
return const ConnectionTestResult(
|
||||
isAvailable: false,
|
||||
message: 'O servidor não confirmou a disponibilidade da API PDV.',
|
||||
);
|
||||
} on TimeoutException {
|
||||
return const ConnectionTestResult(
|
||||
isAvailable: false,
|
||||
message: 'Tempo esgotado ao conectar ao servidor.',
|
||||
);
|
||||
} on SocketException {
|
||||
return const ConnectionTestResult(
|
||||
isAvailable: false,
|
||||
message: 'Não foi possível alcançar o servidor.',
|
||||
);
|
||||
} on FormatException {
|
||||
return const ConnectionTestResult(
|
||||
isAvailable: false,
|
||||
message: 'O servidor retornou uma resposta inválida.',
|
||||
);
|
||||
} catch (_) {
|
||||
return const ConnectionTestResult(
|
||||
isAvailable: false,
|
||||
message: 'Não foi possível testar a conexão com o servidor.',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../../../core/storage/secure_session_storage.dart';
|
||||
import '../../../domain/repositories/auth_repository.dart';
|
||||
import '../../../domain/repositories/settings_repository.dart';
|
||||
import 'odoo_api_uri_builder.dart';
|
||||
|
||||
class OdooSessionApiClient {
|
||||
OdooSessionApiClient({
|
||||
required AuthRepository authRepository,
|
||||
required SettingsRepository settingsRepository,
|
||||
required SecureSessionStorage sessionStorage,
|
||||
http.Client? client,
|
||||
}) : _authRepository = authRepository,
|
||||
_settingsRepository = settingsRepository,
|
||||
_sessionStorage = sessionStorage,
|
||||
_client = client ?? http.Client();
|
||||
|
||||
static const _timeout = Duration(seconds: 60);
|
||||
final AuthRepository _authRepository;
|
||||
final SettingsRepository _settingsRepository;
|
||||
final SecureSessionStorage _sessionStorage;
|
||||
final http.Client _client;
|
||||
|
||||
Future<Map<String, dynamic>> getJson(
|
||||
String endpoint, {
|
||||
Map<String, String> query = const {},
|
||||
}) =>
|
||||
_request('GET', endpoint, query: query);
|
||||
|
||||
Future<Map<String, dynamic>> postForm(
|
||||
String endpoint, {
|
||||
required Map<String, String> body,
|
||||
Duration? timeout,
|
||||
}) =>
|
||||
_request('POST', endpoint, body: body, requestTimeout: timeout);
|
||||
|
||||
Future<Map<String, dynamic>> _request(
|
||||
String method,
|
||||
String endpoint, {
|
||||
Map<String, String> query = const {},
|
||||
Map<String, String> body = const {},
|
||||
Duration? requestTimeout,
|
||||
}) async {
|
||||
if (!_authRepository.isAuthenticated ||
|
||||
_authRepository.currentSession == null) {
|
||||
throw const OdooApiException(
|
||||
'session_required',
|
||||
'A sessão expirou. Entre novamente.',
|
||||
);
|
||||
}
|
||||
|
||||
final settings = await _settingsRepository.load();
|
||||
if (settings?.isConfigured != true) {
|
||||
throw const OdooApiException(
|
||||
'configuration_required',
|
||||
'Configure o servidor antes de continuar.',
|
||||
);
|
||||
}
|
||||
|
||||
final cookie = await _sessionStorage.readCookie();
|
||||
final sessionId = await _sessionStorage.readSessionId();
|
||||
if (cookie == null || sessionId == null) {
|
||||
throw const OdooApiException(
|
||||
'session_required',
|
||||
'A sessão do servidor não está disponível. Entre novamente.',
|
||||
);
|
||||
}
|
||||
|
||||
final endpointUri = OdooApiUriBuilder.endpoint(
|
||||
Uri.parse(settings!.serverUrl),
|
||||
endpoint,
|
||||
);
|
||||
final uri = method == 'GET'
|
||||
? endpointUri.replace(
|
||||
queryParameters: {'session_id': sessionId, ...query},
|
||||
)
|
||||
: endpointUri;
|
||||
final request = http.Request(method, uri)
|
||||
..followRedirects = false
|
||||
..headers['Accept'] = 'application/json'
|
||||
..headers['Cookie'] = cookie;
|
||||
if (method == 'POST') {
|
||||
request
|
||||
..headers['Content-Type'] =
|
||||
'application/x-www-form-urlencoded; charset=utf-8'
|
||||
..body = Uri(queryParameters: {'session_id': sessionId, ...body}).query;
|
||||
}
|
||||
|
||||
try {
|
||||
final response = await _client
|
||||
.send(request)
|
||||
.then(http.Response.fromStream)
|
||||
.timeout(requestTimeout ?? _timeout);
|
||||
if (response.statusCode != HttpStatus.ok) {
|
||||
throw OdooApiException(
|
||||
'http_error',
|
||||
'O servidor respondeu com erro HTTP ${response.statusCode}.',
|
||||
);
|
||||
}
|
||||
|
||||
final decoded = jsonDecode(response.body);
|
||||
if (decoded is! Map<String, dynamic>) {
|
||||
throw const OdooApiException(
|
||||
'invalid_response',
|
||||
'O servidor retornou uma resposta inválida.',
|
||||
);
|
||||
}
|
||||
if (decoded['status'] != 'ok') {
|
||||
final code = decoded['code'];
|
||||
final message = decoded['message'];
|
||||
throw OdooApiException(
|
||||
code is String ? code : 'api_error',
|
||||
message is String ? message : 'O servidor não concluiu a operação.',
|
||||
);
|
||||
}
|
||||
return decoded;
|
||||
} on TimeoutException {
|
||||
throw const OdooApiException(
|
||||
'timeout',
|
||||
'Tempo esgotado ao consultar o servidor.',
|
||||
);
|
||||
} on SocketException {
|
||||
throw const OdooApiException(
|
||||
'network_error',
|
||||
'Não foi possível alcançar o servidor.',
|
||||
);
|
||||
} on OdooApiException {
|
||||
rethrow;
|
||||
} on FormatException {
|
||||
throw const OdooApiException(
|
||||
'invalid_response',
|
||||
'O servidor retornou dados inválidos.',
|
||||
);
|
||||
} catch (_) {
|
||||
throw const OdooApiException(
|
||||
'network_error',
|
||||
'Falha de comunicação com o servidor.',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class OdooApiException implements Exception {
|
||||
const OdooApiException(this.code, this.message);
|
||||
|
||||
final String code;
|
||||
final String message;
|
||||
|
||||
@override
|
||||
String toString() => message;
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:developer' as developer;
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../../core/storage/secure_session_storage.dart';
|
||||
import '../../domain/entities/app_settings.dart';
|
||||
import '../../domain/entities/app_session.dart';
|
||||
import '../../domain/entities/pos_device.dart';
|
||||
import '../../domain/repositories/auth_repository.dart';
|
||||
import '../datasources/remote/odoo_api_uri_builder.dart';
|
||||
|
||||
class OdooAuthRepository implements AuthRepository {
|
||||
OdooAuthRepository({
|
||||
required SecureSessionStorage sessionStorage,
|
||||
http.Client? client,
|
||||
}) : _sessionStorage = sessionStorage,
|
||||
_client = client ?? http.Client();
|
||||
|
||||
static const _requestTimeout = Duration(seconds: 60);
|
||||
final SecureSessionStorage _sessionStorage;
|
||||
final http.Client _client;
|
||||
Uri? _activeServerUri;
|
||||
bool _isAuthenticated = false;
|
||||
AppSession? _currentSession;
|
||||
|
||||
@override
|
||||
bool get isAuthenticated => _isAuthenticated;
|
||||
|
||||
@override
|
||||
AppSession? get currentSession => _currentSession;
|
||||
|
||||
@override
|
||||
Future<AppSession> authenticate({
|
||||
required String username,
|
||||
required String password,
|
||||
required AppSettings settings,
|
||||
required PosDevice device,
|
||||
required String appVersion,
|
||||
}) async {
|
||||
if (await _sessionStorage.readCookie() != null) {
|
||||
await logout();
|
||||
}
|
||||
_isAuthenticated = false;
|
||||
_currentSession = null;
|
||||
final serverUri = Uri.parse(settings.serverUrl);
|
||||
final endpoint = OdooApiUriBuilder.endpoint(serverUri, '/pdv_pos/logar');
|
||||
final response = await _sendPost(
|
||||
endpoint,
|
||||
body: {
|
||||
'cnpj': settings.companyIdentifier,
|
||||
'username': username,
|
||||
'password': password,
|
||||
'platform': device.platform,
|
||||
if (device.serial != null) 'serial': device.serial!,
|
||||
if (device.model != null) 'model': device.model!,
|
||||
if (device.brand != null) 'brand': device.brand!,
|
||||
'version': appVersion,
|
||||
},
|
||||
);
|
||||
|
||||
final payload = _decodeResponse(response);
|
||||
if (payload['status'] != 'ok') {
|
||||
final message = payload['message'];
|
||||
throw AuthUnavailableException(
|
||||
message is String
|
||||
? message
|
||||
: 'Não foi possível autenticar no servidor.',
|
||||
);
|
||||
}
|
||||
|
||||
final cookie = _sessionCookie(response.headers['set-cookie']);
|
||||
final sessionId = payload['session_id'];
|
||||
if (cookie == null || sessionId is! String || sessionId.isEmpty) {
|
||||
throw const AuthUnavailableException(
|
||||
'O servidor não iniciou uma sessão segura para o PDV.',
|
||||
);
|
||||
}
|
||||
|
||||
await _sessionStorage.writeSession(
|
||||
cookie: cookie,
|
||||
serverUrl: settings.serverUrl,
|
||||
sessionId: sessionId,
|
||||
);
|
||||
final user = payload['user'];
|
||||
final userId = user is Map ? user['id'] : null;
|
||||
if (userId is! num) {
|
||||
await _sessionStorage.clearCookie();
|
||||
throw const AuthUnavailableException(
|
||||
'O servidor não retornou os dados do operador.',
|
||||
);
|
||||
}
|
||||
final companyIdValue = payload['company_id'];
|
||||
final companyNameValue = payload['company_name'];
|
||||
_currentSession = AppSession(
|
||||
userId: userId.toInt(),
|
||||
userName: user['name'] is String ? user['name'] as String : username,
|
||||
companyId: companyIdValue is num ? companyIdValue.toInt() : null,
|
||||
companyName: companyNameValue is String ? companyNameValue : null,
|
||||
);
|
||||
_activeServerUri = serverUri;
|
||||
_isAuthenticated = true;
|
||||
return _currentSession!;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> logout() async {
|
||||
var serverUri = _activeServerUri;
|
||||
final cookie = await _sessionStorage.readCookie();
|
||||
final sessionId = await _sessionStorage.readSessionId();
|
||||
if (serverUri == null) {
|
||||
final storedServerUrl = await _sessionStorage.readServerUrl();
|
||||
if (storedServerUrl != null) serverUri = Uri.tryParse(storedServerUrl);
|
||||
}
|
||||
try {
|
||||
if (serverUri != null && cookie != null && sessionId != null) {
|
||||
await _sendPost(
|
||||
OdooApiUriBuilder.endpoint(serverUri, '/pdv_pos/logout'),
|
||||
body: {'session_id': sessionId},
|
||||
cookie: cookie,
|
||||
);
|
||||
}
|
||||
} catch (_) {
|
||||
// Local credentials are cleared even if the server cannot be reached.
|
||||
} finally {
|
||||
await _sessionStorage.clearCookie();
|
||||
_activeServerUri = null;
|
||||
_isAuthenticated = false;
|
||||
_currentSession = null;
|
||||
}
|
||||
}
|
||||
|
||||
Future<http.Response> _sendPost(
|
||||
Uri uri, {
|
||||
required Map<String, String> body,
|
||||
String? cookie,
|
||||
}) async {
|
||||
final request = http.Request('POST', uri)
|
||||
..followRedirects = false
|
||||
..headers['Accept'] = 'application/json'
|
||||
..headers['Content-Type'] =
|
||||
'application/x-www-form-urlencoded; charset=utf-8'
|
||||
..body = Uri(queryParameters: body).query;
|
||||
if (cookie != null) request.headers['Cookie'] = cookie;
|
||||
developer.log('Enviando chamada HTTP ${request.method} ${uri.path}.',
|
||||
name: 'pdv.auth');
|
||||
|
||||
try {
|
||||
final response = await _client
|
||||
.send(request)
|
||||
.then(http.Response.fromStream)
|
||||
.timeout(_requestTimeout);
|
||||
if (response.statusCode != HttpStatus.ok) {
|
||||
developer.log(
|
||||
'Resposta HTTP ${response.statusCode} em ${uri.path}.',
|
||||
name: 'pdv.auth',
|
||||
);
|
||||
throw const AuthUnavailableException(
|
||||
'O servidor não conseguiu processar a solicitação do PDV.',
|
||||
);
|
||||
}
|
||||
return response;
|
||||
} on TimeoutException {
|
||||
developer.log('Timeout na chamada HTTP ${uri.path}.', name: 'pdv.auth');
|
||||
throw const AuthUnavailableException(
|
||||
'Tempo esgotado ao comunicar com o servidor.',
|
||||
);
|
||||
} on SocketException {
|
||||
developer.log('Falha de socket na chamada HTTP ${uri.path}.',
|
||||
name: 'pdv.auth');
|
||||
throw const AuthUnavailableException(
|
||||
'Não foi possível alcançar o servidor.',
|
||||
);
|
||||
} on AuthUnavailableException {
|
||||
rethrow;
|
||||
} catch (error, stackTrace) {
|
||||
developer.log(
|
||||
'Falha HTTP ${uri.path}: ${error.runtimeType}.',
|
||||
name: 'pdv.auth',
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
throw const AuthUnavailableException(
|
||||
'Falha de comunicação com o servidor.',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> _decodeResponse(http.Response response) {
|
||||
try {
|
||||
final decoded = jsonDecode(response.body);
|
||||
if (decoded is Map<String, dynamic>) return decoded;
|
||||
} on FormatException {
|
||||
// Mapped below to a safe protocol error.
|
||||
}
|
||||
throw const AuthUnavailableException(
|
||||
'O servidor retornou uma resposta inválida.',
|
||||
);
|
||||
}
|
||||
|
||||
String? _sessionCookie(String? setCookieHeader) {
|
||||
if (setCookieHeader == null) return null;
|
||||
final cookie = setCookieHeader.split(';').first.trim();
|
||||
return cookie.startsWith('sid=') && cookie.length > 4 ? cookie : null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import '../../domain/entities/department.dart';
|
||||
import '../../domain/entities/product.dart';
|
||||
import '../../domain/repositories/catalog_repository.dart';
|
||||
import '../datasources/remote/odoo_session_api_client.dart';
|
||||
|
||||
class OdooCatalogRepository implements CatalogRepository {
|
||||
const OdooCatalogRepository({required this.apiClient});
|
||||
|
||||
final OdooSessionApiClient apiClient;
|
||||
|
||||
@override
|
||||
Future<List<Department>> fetchDepartments() async {
|
||||
try {
|
||||
final payload = await apiClient.getJson('/pdv_pos/departamentos');
|
||||
final records = payload['departments'];
|
||||
if (records is! List) {
|
||||
throw const CatalogException('Resposta de departamentos inválida.');
|
||||
}
|
||||
return records
|
||||
.whereType<Map<String, dynamic>>()
|
||||
.map(Department.fromJson)
|
||||
.toList(growable: false);
|
||||
} on OdooApiException catch (error) {
|
||||
throw CatalogException(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<Product>> fetchProductsByDepartment(int departmentId) async {
|
||||
try {
|
||||
final payload = await apiClient.getJson(
|
||||
'/pdv_pos/produtos_por_departamento',
|
||||
query: {'department_id': departmentId.toString()},
|
||||
);
|
||||
final records = payload['products'];
|
||||
if (records is! List) {
|
||||
throw const CatalogException('Resposta de produtos inválida.');
|
||||
}
|
||||
return records
|
||||
.whereType<Map<String, dynamic>>()
|
||||
.map(Product.fromJson)
|
||||
.toList(growable: false);
|
||||
} on OdooApiException catch (error) {
|
||||
throw CatalogException(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Product?> fetchProductByBarcode(String barcode) async {
|
||||
try {
|
||||
final payload = await apiClient.getJson(
|
||||
'/pdv_pos/produto_por_codigo_barra',
|
||||
query: {'barcode': barcode},
|
||||
);
|
||||
final record = payload['product'];
|
||||
if (record == null) return null;
|
||||
if (record is! Map<String, dynamic>) {
|
||||
throw const CatalogException('Resposta de produto inválida.');
|
||||
}
|
||||
return Product.fromJson(record);
|
||||
} on OdooApiException catch (error) {
|
||||
throw CatalogException(error.message);
|
||||
} on FormatException {
|
||||
throw const CatalogException('O servidor retornou um produto inválido.');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import '../../domain/entities/customer.dart';
|
||||
import '../../domain/repositories/customer_repository.dart';
|
||||
import '../datasources/remote/odoo_session_api_client.dart';
|
||||
|
||||
class OdooCustomerRepository implements CustomerRepository {
|
||||
const OdooCustomerRepository({required this.apiClient});
|
||||
|
||||
final OdooSessionApiClient apiClient;
|
||||
|
||||
@override
|
||||
Future<List<Customer>> search(String query) async {
|
||||
try {
|
||||
final payload = await apiClient.postForm(
|
||||
'/pdv_pos/clientes',
|
||||
body: {'query': query.trim()},
|
||||
);
|
||||
final records = payload['customers'];
|
||||
if (records is! List) {
|
||||
throw const CustomerSearchException('Resposta de clientes inválida.');
|
||||
}
|
||||
return records
|
||||
.whereType<Map<String, dynamic>>()
|
||||
.map(Customer.fromJson)
|
||||
.toList(growable: false);
|
||||
} on OdooApiException catch (error) {
|
||||
throw CustomerSearchException(error.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import '../../domain/entities/payment_method.dart';
|
||||
import '../../domain/repositories/payment_methods_repository.dart';
|
||||
import '../datasources/remote/odoo_session_api_client.dart';
|
||||
|
||||
class OdooPaymentMethodsRepository implements PaymentMethodsRepository {
|
||||
const OdooPaymentMethodsRepository({required this.apiClient});
|
||||
|
||||
final OdooSessionApiClient apiClient;
|
||||
|
||||
@override
|
||||
Future<List<PaymentMethod>> loadAvailable() async {
|
||||
try {
|
||||
final payload = await apiClient.getJson('/pdv_pos/formas_pagamento');
|
||||
final records = payload['payment_methods'];
|
||||
if (records is! List) {
|
||||
throw const PaymentMethodsException(
|
||||
'Resposta de formas de pagamento inválida.',
|
||||
);
|
||||
}
|
||||
return records
|
||||
.whereType<Map<String, dynamic>>()
|
||||
.map(PaymentMethod.fromJson)
|
||||
.toList(growable: false);
|
||||
} on OdooApiException catch (error) {
|
||||
throw PaymentMethodsException(error.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import '../../domain/entities/cart_item.dart';
|
||||
import '../../domain/entities/customer.dart';
|
||||
import '../../domain/entities/sale_completion.dart';
|
||||
import '../../domain/entities/sale_payment.dart';
|
||||
import '../../domain/repositories/sale_checkout_repository.dart';
|
||||
import '../datasources/remote/odoo_session_api_client.dart';
|
||||
|
||||
class OdooSaleCheckoutRepository implements SaleCheckoutRepository {
|
||||
const OdooSaleCheckoutRepository({required this.apiClient});
|
||||
|
||||
final OdooSessionApiClient apiClient;
|
||||
|
||||
@override
|
||||
Future<SaleCompletion> finalizeCashSale({
|
||||
required List<CartItem> items,
|
||||
required List<SalePayment> payments,
|
||||
Customer? customer,
|
||||
String? customerCpf,
|
||||
required String checkoutKey,
|
||||
}) async {
|
||||
try {
|
||||
final itemPayload = items.map((item) {
|
||||
final price = item.product.priceMinorUnits;
|
||||
if (price == null || item.product.gradeId <= 0) {
|
||||
throw const SaleCheckoutException(
|
||||
'invalid_item',
|
||||
'Um produto não possui preço ou grade válida.',
|
||||
);
|
||||
}
|
||||
return {
|
||||
'product_id': item.product.id,
|
||||
'grade_id': item.product.gradeId,
|
||||
'quantity': item.quantity,
|
||||
'unit_price_minor_units': price,
|
||||
};
|
||||
}).toList(growable: false);
|
||||
|
||||
final payload = await apiClient.postForm(
|
||||
'/pdv_pos/finalizar_venda',
|
||||
body: {
|
||||
'checkout_key': checkoutKey,
|
||||
'customer_id': customer?.id.toString() ?? '',
|
||||
'customer_cpf': customerCpf ?? '',
|
||||
'amount_minor_units': payments
|
||||
.fold<int>(0, (sum, payment) => sum + payment.amountMinorUnits)
|
||||
.toString(),
|
||||
'items': jsonEncode(itemPayload),
|
||||
'payments': jsonEncode(payments
|
||||
.map((payment) => {
|
||||
'condition_form_id': payment.conditionFormId,
|
||||
'amount_minor_units': payment.amountMinorUnits,
|
||||
'payment_type': payment.paymentType,
|
||||
})
|
||||
.toList(growable: false)),
|
||||
},
|
||||
timeout: const Duration(minutes: 3),
|
||||
);
|
||||
final sale = payload['sale'];
|
||||
if (sale is! Map<String, dynamic>) {
|
||||
throw const SaleCheckoutException(
|
||||
'invalid_response',
|
||||
'O servidor não retornou os dados da NFC-e.',
|
||||
);
|
||||
}
|
||||
return SaleCompletion.fromJson(sale);
|
||||
} on SaleCheckoutException {
|
||||
rethrow;
|
||||
} on OdooApiException catch (error) {
|
||||
throw SaleCheckoutException(error.code, error.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import '../../domain/entities/historical_sale.dart';
|
||||
import '../../domain/repositories/sales_history_repository.dart';
|
||||
import '../datasources/remote/odoo_session_api_client.dart';
|
||||
|
||||
class OdooSalesHistoryRepository implements SalesHistoryRepository {
|
||||
const OdooSalesHistoryRepository({required this.apiClient});
|
||||
|
||||
final OdooSessionApiClient apiClient;
|
||||
|
||||
@override
|
||||
Future<List<HistoricalSale>> fetchSales() async {
|
||||
try {
|
||||
final payload = await apiClient.getJson('/pdv_pos/historico_vendas');
|
||||
final records = payload['sales'];
|
||||
if (records is! List) {
|
||||
throw const SalesHistoryException(
|
||||
'O servidor retornou um histórico inválido.',
|
||||
);
|
||||
}
|
||||
return records
|
||||
.whereType<Map<String, dynamic>>()
|
||||
.map(HistoricalSale.fromJson)
|
||||
.toList(growable: false);
|
||||
} on OdooApiException catch (error) {
|
||||
throw SalesHistoryException(error.message);
|
||||
} on FormatException {
|
||||
throw const SalesHistoryException(
|
||||
'O servidor retornou dados inválidos no histórico.',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../../domain/entities/sale_view_mode.dart';
|
||||
import '../../domain/repositories/sale_view_preference_repository.dart';
|
||||
|
||||
class SharedPreferencesSaleViewPreferenceRepository
|
||||
implements SaleViewPreferenceRepository {
|
||||
const SharedPreferencesSaleViewPreferenceRepository();
|
||||
|
||||
static const _keyPrefix = 'pdv.sale_view.user.';
|
||||
|
||||
@override
|
||||
Future<SaleViewMode> loadForUser(int userId) async {
|
||||
final preferences = await SharedPreferences.getInstance();
|
||||
final value = preferences.getString('$_keyPrefix$userId');
|
||||
return value == SaleViewMode.list.name
|
||||
? SaleViewMode.list
|
||||
: SaleViewMode.kanban;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> saveForUser(int userId, SaleViewMode mode) async {
|
||||
final preferences = await SharedPreferences.getInstance();
|
||||
await preferences.setString('$_keyPrefix$userId', mode.name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../../domain/entities/app_settings.dart';
|
||||
import '../../domain/repositories/settings_repository.dart';
|
||||
|
||||
class SharedPreferencesSettingsRepository implements SettingsRepository {
|
||||
const SharedPreferencesSettingsRepository();
|
||||
|
||||
static const _serverUrlKey = 'pdv.server_url';
|
||||
static const _companyIdentifierKey = 'pdv.company_identifier';
|
||||
|
||||
@override
|
||||
Future<AppSettings?> load() async {
|
||||
final preferences = await SharedPreferences.getInstance();
|
||||
final serverUrl = preferences.getString(_serverUrlKey);
|
||||
final companyIdentifier = preferences.getString(_companyIdentifierKey);
|
||||
if (serverUrl == null || companyIdentifier == null) return null;
|
||||
|
||||
return AppSettings(
|
||||
serverUrl: serverUrl,
|
||||
companyIdentifier: companyIdentifier,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> save(AppSettings settings) async {
|
||||
final preferences = await SharedPreferences.getInstance();
|
||||
await preferences.setString(_serverUrlKey, settings.serverUrl);
|
||||
await preferences.setString(
|
||||
_companyIdentifierKey,
|
||||
settings.companyIdentifier,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
class AppSession {
|
||||
const AppSession({
|
||||
required this.userId,
|
||||
required this.userName,
|
||||
this.companyId,
|
||||
this.companyName,
|
||||
});
|
||||
|
||||
final int userId;
|
||||
final String userName;
|
||||
final int? companyId;
|
||||
final String? companyName;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
class AppSettings {
|
||||
const AppSettings({
|
||||
required this.serverUrl,
|
||||
required this.companyIdentifier,
|
||||
});
|
||||
|
||||
final String serverUrl;
|
||||
final String companyIdentifier;
|
||||
|
||||
bool get isConfigured => serverUrl.isNotEmpty && companyIdentifier.isNotEmpty;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
other is AppSettings &&
|
||||
other.serverUrl == serverUrl &&
|
||||
other.companyIdentifier == companyIdentifier;
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(serverUrl, companyIdentifier);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import 'product.dart';
|
||||
|
||||
class CartItem {
|
||||
const CartItem({required this.product, required this.quantity});
|
||||
|
||||
final Product product;
|
||||
final int quantity;
|
||||
|
||||
int? get subtotalMinorUnits {
|
||||
final unitPrice = product.priceMinorUnits;
|
||||
return unitPrice == null ? null : unitPrice * quantity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
class Customer {
|
||||
const Customer({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.documentMasked,
|
||||
});
|
||||
|
||||
final int id;
|
||||
final String name;
|
||||
final String documentMasked;
|
||||
|
||||
factory Customer.fromJson(Map<String, dynamic> json) {
|
||||
final id = json['id'];
|
||||
final name = json['name'];
|
||||
if (id is! num || name is! String) {
|
||||
throw const FormatException('Resposta de cliente inválida.');
|
||||
}
|
||||
return Customer(
|
||||
id: id.toInt(),
|
||||
name: name,
|
||||
documentMasked: json['document_masked']?.toString() ?? '',
|
||||
);
|
||||
}
|
||||
}
|
||||