This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Injectable } from '@angular/core'; | |
| import {HttpHandler, HttpRequest, HttpInterceptor} from '@angular/common/http'; | |
| import {environment} from '../../environments/environment'; | |
| @Injectable({ | |
| providedIn: 'root' | |
| }) | |
| export class BaseURLInterceptor implements HttpInterceptor { | |
| intercept(req: HttpRequest<any>, next: HttpHandler) { | |
| if (!req.url.match(/^http(s)?:\/\/(.*)$/)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {Injectable} from '@angular/core'; | |
| import {HttpHandler, HttpRequest, HttpInterceptor} from '@angular/common/http'; | |
| import {throwError} from 'rxjs'; | |
| import {catchError} from 'rxjs/internal/operators'; | |
| import {ErrorService} from '../my-services/error.service'; | |
| @Injectable({ | |
| providedIn: 'root' | |
| }) | |
| export class HttpErrorInterceptor implements HttpInterceptor { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {NgModule} from '@angular/core'; | |
| import {BrowserModule} from '@angular/platform-browser'; | |
| import {HTTP_INTERCEPTORS, HttpClientModule} from '@angular/common/http'; | |
| import {AppComponent} from './app.component'; | |
| import {BaseURLInterceptor} from './services/base-url.interceptor'; | |
| import {HttpErrorInterceptor} from './services/http-error.interceptor'; | |
| @NgModule({ | |
| declarations: [ AppComponent ], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| import 'package:meta/meta.dart'; | |
| class AppConfig extends InheritedWidget { | |
| AppConfig({ | |
| @required this.flavorName, | |
| @required this.apiBaseUrl, | |
| @required Widget child, | |
| }) : super(child: child); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| import 'app_config.dart'; | |
| import 'my_app.dart'; | |
| void main() { | |
| runApp(AppConfig( | |
| apiBaseUrl: 'https://development-api-base-url.com/', | |
| flavorName: 'dev', | |
| child: MyApp(flavor: 'dev'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| import 'app_config.dart'; | |
| import 'my_app.dart'; | |
| void main() { | |
| runApp(AppConfig( | |
| apiBaseUrl: 'https://integration-api-base-url.com', | |
| flavorName: 'int', | |
| child: MyApp(flavor: 'int'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| class ${StringUtils.removeAndHump(${NAME})} extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return null; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #set ( $CAMEL_NAME = ${StringUtils.removeAndHump(${NAME})} ) | |
| import 'package:flutter/material.dart'; | |
| class ${CAMEL_NAME} extends StatefulWidget { | |
| @override | |
| _${CAMEL_NAME}State createState() => _${CAMEL_NAME}State(); | |
| } | |
| class _${CAMEL_NAME}State extends State<${CAMEL_NAME}> { | |
| @override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| android { | |
| ... | |
| flavorDimensions 'my-app' | |
| productFlavors { | |
| development { | |
| dimension 'my-app' | |
| applicationId 'com.my-app.development' | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- android/app/src/development/res/values/strings.xml --> | |
| <?xml version="1.0" encoding="utf-8"?> | |
| <resources> | |
| <string name="app_name">My App - DEV</string> | |
| </resources> |