diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index ade679e..47d8712 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -1,6 +1,9 @@ name: Deploy Android & Web on: - # Enable manual run + push: + branches: + - 125-use-flutter-distributor-instead-of-fastlane-for-deployment + workflow_dispatch: inputs: bump_version: @@ -10,7 +13,7 @@ on: type: string create_tag_and_push: - description: 'Create new tag & Push bump version' + description: "Create new tag & Push bump version" required: true default: true type: boolean @@ -28,24 +31,24 @@ on: permissions: read-all jobs: - build_web: - name: Build Flutter (Web) - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - - run: flutter pub get - - run: flutter config --enable-web - - run: flutter build web - - name: Deploy to Firebase - uses: w9jds/firebase-action@master - with: - args: deploy --only hosting --public web-build - env: - GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }} - PROJECT_ID: default + # build_web: + # name: Build Flutter (Web) + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v3 + # - uses: subosito/flutter-action@v2 + # with: + # channel: 'stable' + # - run: flutter pub get + # - run: flutter config --enable-web + # - run: flutter build web + # - name: Deploy to Firebase + # uses: w9jds/firebase-action@master + # with: + # args: deploy --only hosting --public web-build + # env: + # GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }} + # PROJECT_ID: default deploy-android: name: Build & Deploy Android Release to ${{ github.event.inputs.track }} track @@ -56,16 +59,10 @@ jobs: with: channel: stable - run: flutter doctor -v - # Checkout Repo code - name: Checkout Repo uses: actions/checkout@v3 - # Setup Ruby, Bundler, Gemfile & flutter dependencies & Build Android - - name: Setup Fastlane - uses: ruby/setup-ruby@72d59482210349c1114eca714b6c5df19fbbec34 - with: - ruby-version: "2.6" - bundler-cache: true - working-directory: android + - name: install flutter distributor + run: dart pub global activate -sgit https://github.com/bixat/flutter_distributor.git --git-path packages/flutter_distributor - name: Configure Keystore run: | @@ -74,16 +71,15 @@ jobs: echo "keyAlias=$KEYSTORE_KEY_ALIAS" >> key.properties echo "storePassword=$KEYSTORE_STORE_PASSWORD" >> key.properties echo "keyPassword=$KEYSTORE_KEY_PASSWORD" >> key.properties + echo "$PLAY_STORE_CONFIG_JSON" >> app/playstore_cer.json env: PLAY_STORE_UPLOAD_KEY: ${{ secrets.PLAY_STORE_UPLOAD_KEY }} KEYSTORE_KEY_ALIAS: ${{ secrets.KEYSTORE_KEY_ALIAS }} KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }} KEYSTORE_STORE_PASSWORD: ${{ secrets.KEYSTORE_STORE_PASSWORD }} + PLAY_STORE_CONFIG_JSON: ${{ secrets.PLAY_STORE_CONFIG_JSON }} working-directory: android - - run: bundle exec fastlane bump_version bump:${{ github.event.inputs.bump_version }} push:${{ github.event.inputs.create_tag_and_push }} branch:${{ github.ref_name }} - working-directory: android - - run: bundle exec fastlane android deploy track:${{ github.event.inputs.track }} - working-directory: android + - run: flutter_distributor release --name dev env: - PLAY_STORE_CONFIG_JSON: ${{ secrets.PLAY_STORE_CONFIG_JSON }} \ No newline at end of file + PLAYSTORE_CREDENTIALS: "android/app/playstore_cer.json" \ No newline at end of file diff --git a/distribute_options.yaml b/distribute_options.yaml new file mode 100644 index 0000000..d143f15 --- /dev/null +++ b/distribute_options.yaml @@ -0,0 +1,16 @@ +output: dist/ +releases: + - name: dev + jobs: + - name: build-aab + package: + platform: android + target: aab + build_args: + target-platform: android-arm + # Publish to playstore + publish: + target: playstore + args: + package-name: com.flutter.cicd + track: alpha \ No newline at end of file diff --git a/lib/models/photo_model.dart b/lib/models/photo_model.dart index cabef27..1df9d0b 100755 --- a/lib/models/photo_model.dart +++ b/lib/models/photo_model.dart @@ -22,7 +22,8 @@ class Photo extends RocketModel { }); @override - void fromJson(Map json, {bool isSub = false}) { + void fromJson(Map? json, {bool isSub = false}) { + if (json == null) return; albumId = json[photoAlbumIdField]; id = json[photoIdField]; title = json[photoTitleField]; diff --git a/lib/models/post_model.dart b/lib/models/post_model.dart index c70c1be..483c94e 100755 --- a/lib/models/post_model.dart +++ b/lib/models/post_model.dart @@ -21,7 +21,8 @@ class Post extends RocketModel { }); @override - void fromJson(Map json, {bool isSub = false}) { + void fromJson(Map? json, {bool isSub = false}) { + if (json == null) return; userId = json[postUserIdField]; id = json[postIdField]; title = json[postTitleField]; diff --git a/lib/models/todo.dart b/lib/models/todo.dart index 8b20b8f..ff1a86c 100644 --- a/lib/models/todo.dart +++ b/lib/models/todo.dart @@ -19,7 +19,8 @@ class Todos extends RocketModel { }); @override - void fromJson(Map json, {bool isSub = false}) { + void fromJson(Map? json, {bool isSub = false}) { + if (json == null) return; userId = json[todoUserIdField]; id = json[todoIdField]; title = json[todoTitleField]; diff --git a/lib/models/todos.dart b/lib/models/todos.dart index b0b12f5..f2ba69d 100644 --- a/lib/models/todos.dart +++ b/lib/models/todos.dart @@ -19,7 +19,8 @@ class Todos extends RocketModel { }); @override - void fromJson(Map json, {bool isSub = false}) { + void fromJson(Map? json, {bool isSub = false}) { + if (json == null) return; userId = json[todosUserIdField]; id = json[todosIdField]; title = json[todosTitleField]; diff --git a/lib/models/user_model.dart b/lib/models/user_model.dart index 6e9c614..d15650e 100755 --- a/lib/models/user_model.dart +++ b/lib/models/user_model.dart @@ -39,7 +39,8 @@ class User extends RocketModel { } @override - void fromJson(Map json, {bool isSub = false}) { + void fromJson(Map? json, {bool isSub = false}) { + if (json == null) return; id = json[userIdField]; name = json[userNameField]; username = json[userUsernameField]; diff --git a/lib/models/user_submodel/address_submodel.dart b/lib/models/user_submodel/address_submodel.dart index d8c241e..79f9101 100644 --- a/lib/models/user_submodel/address_submodel.dart +++ b/lib/models/user_submodel/address_submodel.dart @@ -25,7 +25,8 @@ class Address extends RocketModel
{ } @override - void fromJson(Map json, {bool isSub = false}) { + void fromJson(Map? json, {bool isSub = false}) { + if (json == null) return; street = json[addressStreetField]; suite = json[addressSuiteField]; city = json[addressCityField]; diff --git a/lib/models/user_submodel/company_submodel.dart b/lib/models/user_submodel/company_submodel.dart index f16ca07..3d9d88c 100644 --- a/lib/models/user_submodel/company_submodel.dart +++ b/lib/models/user_submodel/company_submodel.dart @@ -16,7 +16,8 @@ class Company extends RocketModel { }); @override - void fromJson(Map json, {bool isSub = false}) { + void fromJson(Map? json, {bool isSub = false}) { + if (json == null) return; name = json[companyNameField]; catchPhrase = json[companyCatchPhraseField]; bs = json[companyBsField]; diff --git a/lib/models/user_submodel/geo_submodel.dart b/lib/models/user_submodel/geo_submodel.dart index d447c54..a4bd84f 100644 --- a/lib/models/user_submodel/geo_submodel.dart +++ b/lib/models/user_submodel/geo_submodel.dart @@ -12,7 +12,8 @@ class Geo extends RocketModel { this.lng, }); @override - void fromJson(Map json, {bool isSub = false}) { + void fromJson(Map? json, {bool isSub = false}) { + if (json == null) return; lat = json[geoLatField]; lng = json[geoLngField]; super.fromJson(json, isSub: isSub); diff --git a/lib/views/photo_view.dart b/lib/views/photo_view.dart index 5e78f2a..2956bde 100755 --- a/lib/views/photo_view.dart +++ b/lib/views/photo_view.dart @@ -18,7 +18,7 @@ class PhotoExample extends StatelessWidget { width: MediaQuery.of(context).size.width, child: RocketView( model: photo, - loader: const CircularProgressIndicator(), + onLoading: () => const CircularProgressIndicator(), // get 5000 items call: () => GetPhotos.getPhotos(photo), builder: (context, modelState) { diff --git a/lib/views/post_view.dart b/lib/views/post_view.dart index 0fa6764..1d56455 100755 --- a/lib/views/post_view.dart +++ b/lib/views/post_view.dart @@ -47,7 +47,7 @@ class PostExample extends StatelessWidget { // callType: CallType.callAsStream, // secondsOfStream: 1, // customized your loading (default widget is CircularProgressIndicator) - loader: const CircularProgressIndicator(), + onLoading: () => const CircularProgressIndicator(), // handle errors onError: (RocketException exception, Function() reload) { diff --git a/lib/views/todos_view.dart b/lib/views/todos_view.dart index 700aec6..a214813 100644 --- a/lib/views/todos_view.dart +++ b/lib/views/todos_view.dart @@ -23,7 +23,7 @@ class TodosExample extends StatelessWidget { body: RocketView( model: todoModel, call: () => GetTodos.getTodos(todoModel), - loader: const CircularProgressIndicator(), + onLoading: () => const CircularProgressIndicator(), callType: CallType.callIfModelEmpty, builder: (context, state) { return ListView.builder( diff --git a/lib/views/user_view.dart b/lib/views/user_view.dart index 3288c05..f99281c 100755 --- a/lib/views/user_view.dart +++ b/lib/views/user_view.dart @@ -38,7 +38,7 @@ class UserExample extends StatelessWidget { // your model model: users, // your widget for show data from model - loader: const CircularProgressIndicator(), + onLoading: () => const CircularProgressIndicator(), builder: (context, modelState) { return ListView.builder( itemCount: users.all!.length, diff --git a/pubspec.yaml b/pubspec.yaml index 022c6c2..c8bebb8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 2.8.0+25 +version: 2.8.0+28 environment: sdk: ">=2.17.6 <3.0.0" @@ -30,7 +30,7 @@ environment: dependencies: flutter: sdk: flutter - flutter_rocket: ^0.0.1 + flutter_rocket: ^0.0.7 # The following adds the Cupertino Icons font to your application. diff --git a/test/fake_rocket_client.dart b/test/fake_rocket_client.dart index 3ee76a5..23a3d40 100644 --- a/test/fake_rocket_client.dart +++ b/test/fake_rocket_client.dart @@ -6,13 +6,16 @@ class RocketClientTest extends RocketClient { this.dummyData, ) : super(url: ''); @override - Future request(String endpoint, + @override + Future request(String endpoint, {RocketModel? model, HttpMethods method = HttpMethods.get, - Function(dynamic data)? inspect, - List? targetData, + RocketDataCallback? inspect, + List? target, + RocketOnError? onError, Map? data, - Map? params}) async { + Map? params, + RetryOptions retryOptions = const RetryOptions()}) async { model!.state = RocketState.loading; await Future.delayed(const Duration(seconds: 1)); try {