Skip to content

Commit

Permalink
Merge branch 'feature/other_dependencies' into 'develop'
Browse files Browse the repository at this point in the history
Feature/other dependencies

See merge request milind.mevada/flutter_scaffold_project!13
  • Loading branch information
Milind Mevada committed Jan 7, 2020
2 parents f11032f + f88096a commit 3e84cc7
Show file tree
Hide file tree
Showing 4 changed files with 189 additions and 0 deletions.
139 changes: 139 additions & 0 deletions codemagic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
workflows:
development:
name: Development
environment:
flutter: stable
cache:
cache_paths:
- $FCI_BUILD_DIR/build
scripts:
- |
# fetch codemagic helper scripts
rm -rf ~/codemagic-build-scripts
git clone https://github.com/NevercodeHQ/codemagic-build-scripts.git ~/codemagic-build-scripts/ --depth 1
- |
# set up debug keystore
rm -f ~/.android/debug.keystore
keytool -genkeypair \
-alias androiddebugkey \
-keypass android \
-keystore ~/.android/debug.keystore \
-storepass android \
-dname 'CN=Android Debug,O=Android,C=US' \
-keyalg 'RSA' \
-keysize 2048 \
-validity 10000
- |
# set up local properties
echo "flutter.sdk=$HOME/programs/flutter" > "$FCI_BUILD_DIR/android/local.properties"
- flutter packages pub get
- flutter build appbundle --release -flavor development -t main_dev.dart
- |
# generate universal apk signed with debug key
'~/codemagic-build-scripts/android/generate-universal-apks' \
--ks ~/.android/debug.keystore \
--ks-pass android \
--ks-key-alias androiddebugkey \
--key-pass android \
--pattern 'build/**/outputs/**/*.aab'
artifacts:
- build/**/outputs/**/*.apk
- build/**/outputs/**/*.aab
- build/**/outputs/**/mapping.txt
- flutter_drive.log
publishing:
email:
recipients:
- milind.mevada@solutelabs.com
staging:
name: Staging
environment:
flutter: stable
cache:
cache_paths:
- $FCI_BUILD_DIR/build
scripts:
- |
# fetch codemagic helper scripts
rm -rf ~/codemagic-build-scripts
git clone https://github.com/NevercodeHQ/codemagic-build-scripts.git ~/codemagic-build-scripts/ --depth 1
- |
# set up debug keystore
rm -f ~/.android/debug.keystore
keytool -genkeypair \
-alias androiddebugkey \
-keypass android \
-keystore ~/.android/debug.keystore \
-storepass android \
-dname 'CN=Android Debug,O=Android,C=US' \
-keyalg 'RSA' \
-keysize 2048 \
-validity 10000
- |
# set up local properties
echo "flutter.sdk=$HOME/programs/flutter" > "$FCI_BUILD_DIR/android/local.properties"
- flutter packages pub get
- flutter build appbundle --release -flavor staging -t main_staging.dart
- |
# generate universal apk signed with debug key
'~/codemagic-build-scripts/android/generate-universal-apks' \
--ks ~/.android/debug.keystore \
--ks-pass android \
--ks-key-alias androiddebugkey \
--key-pass android \
--pattern 'build/**/outputs/**/*.aab'
artifacts:
- build/**/outputs/**/*.apk
- build/**/outputs/**/*.aab
- build/**/outputs/**/mapping.txt
- flutter_drive.log
publishing:
email:
recipients:
- milind.mevada@solutelabs.com
production:
name: Production
environment:
flutter: stable
cache:
cache_paths:
- $FCI_BUILD_DIR/build
scripts:
- |
# fetch codemagic helper scripts
rm -rf ~/codemagic-build-scripts
git clone https://github.com/NevercodeHQ/codemagic-build-scripts.git ~/codemagic-build-scripts/ --depth 1
- |
# set up debug keystore
rm -f ~/.android/debug.keystore
keytool -genkeypair \
-alias androiddebugkey \
-keypass android \
-keystore ~/.android/debug.keystore \
-storepass android \
-dname 'CN=Android Debug,O=Android,C=US' \
-keyalg 'RSA' \
-keysize 2048 \
-validity 10000
- |
# set up local properties
echo "flutter.sdk=$HOME/programs/flutter" > "$FCI_BUILD_DIR/android/local.properties"
- flutter packages pub get
- flutter build appbundle --release -flavor production -t main_prod.dart
- |
# generate universal apk signed with debug key
'~/codemagic-build-scripts/android/generate-universal-apks' \
--ks ~/.android/debug.keystore \
--ks-pass android \
--ks-key-alias androiddebugkey \
--key-pass android \
--pattern 'build/**/outputs/**/*.aab'
artifacts:
- build/**/outputs/**/*.apk
- build/**/outputs/**/*.aab
- build/**/outputs/**/mapping.txt
- flutter_drive.log
publishing:
email:
recipients:
- milind.mevada@solutelabs.com
1 change: 1 addition & 0 deletions lib/src/utils/custom_exceptions.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
class NoNetworkException implements Exception {}
42 changes: 42 additions & 0 deletions lib/src/utils/network_connectivity.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import 'package:connectivity/connectivity.dart';
import 'package:flutter_base_project/src/utils/custom_exceptions.dart';

abstract class NetworkConnectivityChecker {
Future<bool> isNetworkAvailable();

Future<void> validateNetworkConnectivity();
}

final NetworkConnectivityChecker _instance =
NetworkConnectivity(Connectivity());

NetworkConnectivityChecker networkConnectivityChecker() {
return _instance;
}

class NetworkConnectivity implements NetworkConnectivityChecker {
Connectivity connectivity;

NetworkConnectivity(this.connectivity);

@override
Future<bool> isNetworkAvailable() async {
final result = await connectivity.checkConnectivity();
return _isNetworkAvailable(result);
}

@override
Future<void> validateNetworkConnectivity() async {
final result = await connectivity.checkConnectivity();
if (!_isNetworkAvailable(result)) {
throw NoNetworkException();
}
}

bool _isNetworkAvailable(ConnectivityResult result) {
return [
ConnectivityResult.mobile,
ConnectivityResult.wifi,
].contains(result);
}
}
7 changes: 7 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ dependencies:
git:
url: git@gitlab.com:milind.mevada/firebase_performance_interceptor.git

connectivity: ^0.4.6+1
shared_preferences: ^0.5.6
permission_handler: ^4.0.0
cached_network_image: ^2.0.0
path_provider: ^1.5.1
provider: ^4.0.1

dev_dependencies:
flutter_test:
sdk: flutter
Expand Down

0 comments on commit 3e84cc7

Please sign in to comment.