From fb31172a81996921f375f5dcffdce8649c482683 Mon Sep 17 00:00:00 2001 From: Alann Maulana Date: Sun, 29 Aug 2021 20:17:28 +0700 Subject: [PATCH] Storage abstraction (#15) * refactor local storage into standalone plugin * update storage interface * export interface libs * remove duplicate property getters, using RetryClient, fix log not show on result * fix logger on io compute * code reformat * Update pubspec.yaml * Delete credentials.sh * Update parse_test.dart * Update pub-publish-test.yaml * Update pub-publish.yaml * update .idea --- .github/workflows/pub-publish-test.yaml | 25 +- .github/workflows/pub-publish.yaml | 25 +- .idea/libraries/Dart_Packages.xml | 294 ++++++--------- .idea/workspace.xml | 476 ++---------------------- example/flutter_parse_example.dart | 5 +- lib/flutter_parse.dart | 34 +- lib/src/http/http.dart | 49 ++- lib/src/http/mobile.dart | 25 -- lib/src/http/unsupported.dart | 16 - lib/src/http/web.dart | 22 -- lib/src/livequery/browser.dart | 33 +- lib/src/livequery/io.dart | 33 +- lib/src/parse_config.dart | 8 +- lib/src/parse_http_client.dart | 80 ++-- lib/src/parse_live_query.dart | 15 +- lib/src/parse_local_storage.dart | 10 +- lib/src/storage/storage.dart | 30 -- lib/src/storage/storage_html.dart | 51 --- lib/src/storage/storage_io.dart | 52 --- lib/src/storage/storage_stub.dart | 28 -- pubspec.yaml | 7 +- scripts/credentials.sh | 8 - test/parse_local_storage_test.dart | 1 - test/parse_test.dart | 30 -- 24 files changed, 341 insertions(+), 1016 deletions(-) delete mode 100644 lib/src/http/mobile.dart delete mode 100644 lib/src/http/unsupported.dart delete mode 100644 lib/src/http/web.dart delete mode 100644 lib/src/storage/storage.dart delete mode 100644 lib/src/storage/storage_html.dart delete mode 100644 lib/src/storage/storage_io.dart delete mode 100644 lib/src/storage/storage_stub.dart delete mode 100755 scripts/credentials.sh diff --git a/.github/workflows/pub-publish-test.yaml b/.github/workflows/pub-publish-test.yaml index 14e8e1e..3d53f61 100644 --- a/.github/workflows/pub-publish-test.yaml +++ b/.github/workflows/pub-publish-test.yaml @@ -12,8 +12,6 @@ jobs: build: name: Publishing Test (Dry Run) runs-on: ubuntu-latest - env: - PUB_CREDENTIALS: ${{ secrets.PUB_CREDENTIALS }} steps: - uses: actions/checkout@v2 - uses: actions/setup-java@v1 @@ -23,15 +21,30 @@ jobs: with: flutter-version: '2.0.5' channel: 'stable' + - name: Setup credentials + run: | + mkdir -p ~/.pub-cache + cat < ~/.pub-cache/credentials.json + { + "accessToken":"${{ secrets.PUB_ACCESS_TOKEN }}", + "refreshToken":"${{ secrets.PUB_REFRESH_TOKEN }}", + "idToken":"${{ secrets.PUB_ID_TOKEN }}", + "tokenEndpoint":"https://accounts.google.com/o/oauth2/token", + "scopes": [ "openid", "https://www.googleapis.com/auth/userinfo.email" ], + "expiration": 1627651143489 + } + EOF - name: Documenting package run: | echo "FLUTTER_ROOT=$FLUTTER_HOME" >> $GITHUB_ENV - bash scripts/credentials.sh - rm -rf scripts/ make make deps pub global activate dartdoc make docs + - name: Pana analyzer + run: | pub global activate pana - make pana - pub publish -n -v + pana -s path . --no-warning + - name: Publish dry run + run: | + pub publish -n \ No newline at end of file diff --git a/.github/workflows/pub-publish.yaml b/.github/workflows/pub-publish.yaml index 8865d81..f850850 100644 --- a/.github/workflows/pub-publish.yaml +++ b/.github/workflows/pub-publish.yaml @@ -9,8 +9,6 @@ jobs: build: name: Publishing runs-on: ubuntu-latest - env: - PUB_CREDENTIALS: ${{ secrets.PUB_CREDENTIALS }} steps: - uses: actions/checkout@v2 - uses: actions/setup-java@v1 @@ -20,13 +18,20 @@ jobs: with: flutter-version: '2.0.5' channel: 'stable' - - name: Documenting package + - name: Setup credentials + run: | + mkdir -p ~/.pub-cache + cat < ~/.pub-cache/credentials.json + { + "accessToken":"${{ secrets.PUB_ACCESS_TOKEN }}", + "refreshToken":"${{ secrets.PUB_REFRESH_TOKEN }}", + "idToken":"${{ secrets.PUB_ID_TOKEN }}", + "tokenEndpoint":"https://accounts.google.com/o/oauth2/token", + "scopes": [ "openid", "https://www.googleapis.com/auth/userinfo.email" ], + "expiration": 1627651143489 + } + EOF + - name: Publishing package run: | echo "FLUTTER_ROOT=$FLUTTER_HOME" >> $GITHUB_ENV - bash scripts/credentials.sh - rm -rf scripts/ - make - make deps - pub global activate dartdoc - make docs - pub publish -f -v + pub publish -f diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml index 283a3de..b1f1fda 100644 --- a/.idea/libraries/Dart_Packages.xml +++ b/.idea/libraries/Dart_Packages.xml @@ -2,465 +2,409 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index f01999d..9274553 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,13 +1,18 @@ + + + + - + + -