Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added all the layouts for authentification on shop-mobile-flutter #1479

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,6 @@
"typeorm",
"Whitespaces"
],
"deepscan.enable": true
"deepscan.enable": true,
"angular.enable-strict-mode-prompt": false
}
2,484 changes: 1,242 additions & 1,242 deletions packages/core/res/templates/terms_of_use/ru-RU.hbs

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions packages/core/src/@pyro/db-server/db-service.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import mongoose from 'mongoose';
import * as _ from 'lodash';
import Logger from 'bunyan';
import { Observable, Subject } from 'rxjs';
import { Observable, Subject, from, of } from 'rxjs';
import { injectable } from 'inversify';
import { ExistenceEvent, ExistenceEventType } from './existence';
import { from, of } from 'rxjs';
import { concat, exhaustMap, filter, map, share, tap } from 'rxjs/operators';
import { v1 as uuid } from 'uuid';
import { IDbService } from '@pyro/db-server/i-db-service';
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const connectionSettings: TypeOrmModuleOptions = {
// poolSize: poolSize,
connectTimeoutMS: connectTimeoutMS,
logging: true,
logger: 'file', //Removes console logging, instead logs all queries in a file ormlogs.log
logger: 'file', // Removes console logging, instead logs all queries in a file ormlogs.log
useUnifiedTopology: true,
};

Expand Down Expand Up @@ -159,6 +159,7 @@ const connectionSettings: TypeOrmModuleOptions = {
context: ({ req, res }) => ({
req,
}),

}),
InvitesModule,
DevicesModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class GeoLocationOrdersResolver {
options: GeoLocationOrdersOptions;
searchObj?: {
isCancelled?: boolean;
byRegex?: Array<{ key: string; value: string }>;
byRegex?: { key: string; value: string }[];
};
}
) {
Expand All @@ -48,7 +48,7 @@ export class GeoLocationOrdersResolver {
geoLocation: IGeoLocation;
skippedOrderIds: string[];
options: GeoLocationOrdersOptions;
searchObj?: { byRegex: Array<{ key: string; value: string }> };
searchObj?: { byRegex: { key: string; value: string }[] };
}
) {
const orders = await this.geoLocationsOrdersService.getOrdersForWork(
Expand All @@ -71,7 +71,7 @@ export class GeoLocationOrdersResolver {
}: {
geoLocation: IGeoLocation;
skippedOrderIds: string[];
searchObj?: { byRegex: Array<{ key: string; value: string }> };
searchObj?: { byRegex: { key: string; value: string }[] };
}
) {
return this.geoLocationsOrdersService.getCountOfOrdersForWork(
Expand Down
5 changes: 1 addition & 4 deletions packages/core/src/services/auth/AuthService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import { WrongPasswordError } from '@modules/server.common/errors/WrongPasswordE
import bcrypt from 'bcrypt';
import { injectable, interfaces } from 'inversify';
import { RawObject } from '@pyro/db/db-raw-object';

// have to combine the two imports
import jwt from 'jsonwebtoken';
import { JsonWebTokenError } from 'jsonwebtoken';
import jwt, { JsonWebTokenError } from 'jsonwebtoken';

interface IAuthableCreateObject extends DBCreateObject {
hash?: string;
Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/services/services.app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ export class ServicesApp {
}

// This is special connection we create during "bootstrap" of the system that is needed for our Repositories to use
// We also using another "default" connection defined in app.module.ts using `TypeOrmModule.forRoot(connectionSettings)` which will be used in other places.
// We also using another "default" connection defined in app.module.ts
// using `TypeOrmModule.forRoot(connectionSettings)` which will be used in other places.
const connectionSettings: ConnectionOptions =
{
// Note: do not change this connection name
Expand All @@ -161,7 +162,7 @@ export class ServicesApp {
// poolSize: ServicesApp._poolSize,
connectTimeoutMS: ServicesApp._connectTimeoutMS,
logging: true,
logger: 'file', //Removes console logging, instead logs all queries in a file ormlogs.log
logger: 'file', // Removes console logging, instead logs all queries in a file ormlogs.log
useUnifiedTopology: true,
};

Expand Down
7 changes: 3 additions & 4 deletions packages/core/src/services/warehouses/WarehousesService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import { createEverLogger } from '../../helpers/Log';
import Warehouse from '@modules/server.common/entities/Warehouse';
import { default as IWarehouse } from '@modules/server.common/interfaces/IWarehouse';
import { IGeoLocationCreateObject } from '@modules/server.common/interfaces/IGeoLocation';
import { Observable } from 'rxjs';
import { Observable, of } from 'rxjs';
import IWarehouseRouter, {
IWarehouseRegistrationInput,
IWarehouseLoginResponse,
} from '@modules/server.common/routers/IWarehouseRouter';
import {
asyncListener,
Expand All @@ -18,9 +19,7 @@ import {
} from '@pyro/io';
import IService from '../IService';
import { concat, exhaustMap, tap, first, map, switchMap } from 'rxjs/operators';
import { of } from 'rxjs';
import { DBService } from '@pyro/db-server';
import { IWarehouseLoginResponse } from '@modules/server.common/routers/IWarehouseRouter';
import { env } from '../../env';
import { AuthService, AuthServiceFactory } from '../auth';
import { v1 as uuid } from 'uuid';
Expand Down Expand Up @@ -172,7 +171,7 @@ export class WarehousesService extends DBService<Warehouse>
hash: await this.authService.getPasswordHash(
input.password
),
}
}
: {}),
});
return warehouse;
Expand Down
46 changes: 46 additions & 0 deletions packages/shop-mobile-flutter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/

# 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
.packages
.pub-cache/
.pub/
/build/

# Web related
lib/generated_plugin_registrant.dart

# 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
10 changes: 10 additions & 0 deletions packages/shop-mobile-flutter/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# 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: 4cc385b4b84ac2f816d939a49ea1f328c4e0b48e
channel: stable

project_type: app
63 changes: 62 additions & 1 deletion packages/shop-mobile-flutter/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,62 @@
# Ever Shop Mobile App (Flutter version)
# shop_flutter_mobile

A new Flutter project.

## Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)

For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.

Setting up Your Development Environment

Find instructions for setting up your development machine with the Flutter framework on Flutter’s Get started page. The specific steps vary by platform, but they follow this basic format:

1.Download the installation bundle for your development machine’s operating system to get the latest stable release of the Flutter SDK.
2. Extract the installation bundle in the desired location.
3. Add the flutter tool to your path.
4. Run the flutter doctor command, which alerts you to any problems with the Flutter installation.
5. Install missing dependencies.
6. Set up your IDE with a Flutter plugin/extension.
7. Test drive an app.

The instructions provided on the Flutter website are very well done and allow you to easily set up a development environment on your platform of choice. The remainder of this tutorial assumes you’ve set up VS Code for Flutter development and that you’ve addressed any issues flutter doctor found. You can also use Android Studio to follow along.

To run your project as a mobile app, you’ll need to use one of the following options:

- Run either iOS Simulator or an Android emulator.
- Have an iOS or Android device set up for development.
- Run your code as a web app.
- Finally, you can run your code as a desktop app.

Even if your final target is mobile, using a web or desktop app during development gives you the advantage of being able to resize the app and observe how it would look with various screen sizes. If you have an older computer, the web or desktop version will also load faster than the Android emulator or iOS Simulator.

NOTE: TO BUILD AND TEST ON IOS SIMULATOR OR AN IOS DEVICE, YOU’LL NEED TO USE MACOS WITH XCODE. ALSO, EVEN IF YOU’RE PLANNING TO USE VS CODE AS YOUR MAIN IDE, THE EASIEST WAY TO GET THE ANDROID SDK AND ANDROID EMULATOR IS TO INSTALL ANDROID STUDIO AS WELL.

clone or download the latest version of the project on https://github.com/ever-co/ever-demand

then
You can open the project in either VS Code or Android Studio.

Open it in VS Code by opening the root folder. You’ll need to fetch packages before running the project. Do so by pressing Command-Shift-P on MacOS or Control-Shift-P on Windows or Linux to open the command palette and running the Flutter: Get Packages command.

To open the project in Android Studio, choose Open an existing project from the Welcome to Android Studio screen and navigate to choose the root folder of the final project. Then choose Get dependencies on the 'Pub get' has not been run line in Android Studio.

Ever Flutter Structure

Ever Demand
https://github.com/ever-co/ever-demand/tree/develop/packages/shop-mobile-flutter
shop_mobile-flutter
-> assets : here we have fonts, i18n, colors and images
-> lib : here are all the codes
-> models
-> screens
-> middlewares,...
-> test: will contain all our tests
29 changes: 29 additions & 0 deletions packages/shop-mobile-flutter/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 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-lang.github.io/linter/lints/index.html.
#
# 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
13 changes: 13 additions & 0 deletions packages/shop-mobile-flutter/android/.gitignore
Original file line number Diff line number Diff line change
@@ -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
68 changes: 68 additions & 0 deletions packages/shop-mobile-flutter/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 30

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.shop_flutter_mobile"
minSdkVersion 16
targetSdkVersion 30
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 {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.shop_flutter_mobile">
<!-- Flutter 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>
Loading