-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/other_dependencies' into 'develop'
Feature/other dependencies See merge request milind.mevada/flutter_scaffold_project!13
- Loading branch information
Showing
4 changed files
with
189 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
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 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
class NoNetworkException implements Exception {} |
This file contains 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
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); | ||
} | ||
} |
This file contains 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