Committed by
GitHub
Set up federated plugin (#42)
* Federated setup * Add .github * Revert "Merge branch 'master' into federated-plugin" This reverts commit d78b1423272b1c9bc0549fdd87efb4c3fef0019a. * Init platform interface * Setup wakelock_web * Setup wakelock * Cleanup * Add pigeons * Implement Android * Implement platform interface * Test platform interface * wakelock_platform_interface initial release * Main README * wakelock README * wakelock tests * Integration testing * iOS implementation * Finish wakelock * Implement web * Web tests * comment * Web dependency * Add checks * Fix checks * Relative here * reorder * Skip pub get * Desperation * l * Fix checks * Add pana * Pana relative path * Add tests * Version * disable web checks * Complete actions
Showing
100 changed files
with
2010 additions
and
564 deletions
Too many changes to show.
To preserve performance only 100 of 100+ files are displayed.
.github/CONTRIBUTING.md
0 → 100644
| 1 | +# Contributing guide | ||
| 2 | + | ||
| 3 | +## Steps | ||
| 4 | + | ||
| 5 | +The following steps are based on a version of [flutter/plugin's contributing guide](https://github.com/flutter/plugins/blob/2ea66626c245a4373a6e07706ab2e7d471e25bd6/CONTRIBUTING.md). | ||
| 6 | + | ||
| 7 | +### Creating a fork | ||
| 8 | + | ||
| 9 | +- If you have not yet configured your machine with an SSH key that is known to GitHub, then follow [GitHub's directions](https://help.github.com/articles/generating-ssh-keys/) to generate an SSH key. | ||
| 10 | +- Fork [this repository](https://github.com/creativecreatorormaybenot/wakelock) using the "Fork" button in the upper right corner of the repository's GitHub page. | ||
| 11 | +- `git clone git@github.com:<github_user_name>/wakelock.git` | ||
| 12 | +- `cd wakelock` | ||
| 13 | +- `git remote add upstream git@github.com:creativecreatorormaybenot/wakelock.git` | ||
| 14 | + This ensures that `git fetch upstream` is possible to fetch from this remote repository instead of from your own fork to get the latest changes. | ||
| 15 | + | ||
| 16 | +### Create pull requests | ||
| 17 | + | ||
| 18 | +- Fetch the latest repo state: `git fetch upstream` | ||
| 19 | +- Create a feature branch: `git checkout upstream/master -b <name_of_your_branch>` | ||
| 20 | +- Now, you can change the code necessary for your patch. | ||
| 21 | + | ||
| 22 | + Make sure that you bump the version in [`pubspec.yaml`][pubspec]. You **must** bump the Pubspec | ||
| 23 | + version when a new package version should be released and edit the `CHANGELOG.md` of the package | ||
| 24 | + accordingly. | ||
| 25 | + The version format needs to follow [Dart's semantic versioning][dart semver]. You need to take | ||
| 26 | + [caret syntax][] into consideration when landing breaking changes. | ||
| 27 | + | ||
| 28 | +- Commit your changes: `git commit -am "<commit_message>"` | ||
| 29 | +- Push your changes: `git push origin <name_of_your_branch>` | ||
| 30 | + | ||
| 31 | +After having followed these steps, you are ready to [create a pull request](https://help.github.com/en/articles/creating-a-pull-request-from-a-fork). | ||
| 32 | +The GitHub interface makes this very easy by providing a button on your fork page that creates a pull request with changes from a recently pushed to branch. | ||
| 33 | +Alternatively, you can also use `git pull-request` via [GitHub hub](https://hub.github.com/). | ||
| 34 | + | ||
| 35 | +### Notes | ||
| 36 | + | ||
| 37 | +- You should remember to exclude all files and directories your IDE might generate using the `.gitignore` files (if they do not already contain them for your IDE). | ||
| 38 | + If you feel like you can make useful additions to any of the `.gitignore` files, you can include them in your pull request, potentially with an explanation. | ||
| 39 | + | ||
| 40 | +- It is probably easier for you to run the integration tests for the plugin locally using `flutter drive --target=test_driver/app.dart` in the `example` directory | ||
| 41 | + before opening a pull request (CI also runs the integration tests). | ||
| 42 | + This way you can ensure that any changes you have made work properly. Furthermore, you might also want to add some tests if you implement new functionality. | ||
| 43 | + | ||
| 44 | +- You should also run `dart format .` in the root directory and make sure that `flutter analyze` does not report any errors. | ||
| 45 | + | ||
| 46 | +[dart semver]: https://dart.dev/tools/pub/versioning#semantic-versions | ||
| 47 | +[caret syntax]: https://dart.dev/tools/pub/dependencies#caret-syntax |
.github/PULL_REQUEST_TEMPLATE.md
0 → 100644
| @@ -11,11 +11,14 @@ on: | @@ -11,11 +11,14 @@ on: | ||
| 11 | - '**/pubspec.yaml' | 11 | - '**/pubspec.yaml' |
| 12 | - '**/test/**' | 12 | - '**/test/**' |
| 13 | - '**/test_driver/**' | 13 | - '**/test_driver/**' |
| 14 | + - '**/assets/**' | ||
| 15 | + - '**/integration_test/**' | ||
| 14 | 16 | ||
| 15 | jobs: | 17 | jobs: |
| 16 | analyze: | 18 | analyze: |
| 19 | + timeout-minutes: 7 | ||
| 17 | runs-on: ${{ matrix.os }} | 20 | runs-on: ${{ matrix.os }} |
| 18 | - name: Format check & analysis (${{ matrix.channel }} on ${{ matrix.os }}) | 21 | + name: Analysis of ${{ matrix.package }} (${{ matrix.channel }}; ${{ matrix.os }}) |
| 19 | strategy: | 22 | strategy: |
| 20 | matrix: | 23 | matrix: |
| 21 | os: | 24 | os: |
| @@ -24,6 +27,10 @@ jobs: | @@ -24,6 +27,10 @@ jobs: | ||
| 24 | - 'stable' | 27 | - 'stable' |
| 25 | - 'beta' | 28 | - 'beta' |
| 26 | - 'dev' | 29 | - 'dev' |
| 30 | + package: | ||
| 31 | + - 'wakelock' | ||
| 32 | + - 'wakelock_platform_interface' | ||
| 33 | + - 'wakelock_web' | ||
| 27 | fail-fast: false | 34 | fail-fast: false |
| 28 | 35 | ||
| 29 | steps: | 36 | steps: |
| @@ -31,37 +38,36 @@ jobs: | @@ -31,37 +38,36 @@ jobs: | ||
| 31 | - uses: subosito/flutter-action@v1.3.2 | 38 | - uses: subosito/flutter-action@v1.3.2 |
| 32 | with: | 39 | with: |
| 33 | channel: ${{ matrix.channel }} | 40 | channel: ${{ matrix.channel }} |
| 34 | - - name: Setup projects (root & example) | ||
| 35 | - run: | | ||
| 36 | - flutter pub get | ||
| 37 | - cd example | ||
| 38 | - flutter create . | ||
| 39 | - rm -rf test | ||
| 40 | - flutter pub get | ||
| 41 | - cd .. | 41 | + - run: flutter pub get |
| 42 | + working-directory: ${{ matrix.package }} | ||
| 42 | - name: Check format | 43 | - name: Check format |
| 43 | - run: flutter format . --set-exit-if-changed --fix | 44 | + working-directory: ${{ matrix.package }} |
| 45 | + run: dart format . --set-exit-if-changed | ||
| 44 | - run: flutter analyze | 46 | - run: flutter analyze |
| 47 | + working-directory: ${{ matrix.package }} | ||
| 45 | 48 | ||
| 46 | test: | 49 | test: |
| 47 | - # Not using the conditional as jobs are not re-run when the draft status changes. | ||
| 48 | - #if: github.event.pull_request.draft == false | 50 | + timeout-minutes: 14 |
| 49 | runs-on: macos-latest | 51 | runs-on: macos-latest |
| 50 | - name: Unit & integration tests (${{ matrix.channel }} on ${{ matrix.device }}) | 52 | + name: Testing of ${{ matrix.package }} (${{ matrix.channel }}; ${{ matrix.device }}) |
| 51 | strategy: | 53 | strategy: |
| 52 | matrix: | 54 | matrix: |
| 53 | device: | 55 | device: |
| 54 | - 'iPhone 11 Pro Max (13.7)' | 56 | - 'iPhone 11 Pro Max (13.7)' |
| 55 | - - 'Android' | ||
| 56 | channel: | 57 | channel: |
| 57 | - 'stable' | 58 | - 'stable' |
| 58 | - 'beta' | 59 | - 'beta' |
| 59 | - 'dev' | 60 | - 'dev' |
| 61 | + package: | ||
| 62 | + - 'wakelock' | ||
| 63 | + - 'wakelock_platform_interface' | ||
| 64 | + # Web tests do not work for now. | ||
| 65 | + # - 'wakelock_web' | ||
| 60 | fail-fast: false | 66 | fail-fast: false |
| 61 | 67 | ||
| 62 | steps: | 68 | steps: |
| 63 | - name: Start iOS simulator | 69 | - name: Start iOS simulator |
| 64 | - if: contains(matrix.device, 'iPhone') | 70 | + if: matrix.package == 'wakelock' |
| 65 | run: | | 71 | run: | |
| 66 | xcrun instruments -s | 72 | xcrun instruments -s |
| 67 | UDID=$( | 73 | UDID=$( |
| @@ -76,25 +82,18 @@ jobs: | @@ -76,25 +82,18 @@ jobs: | ||
| 76 | - uses: subosito/flutter-action@v1.3.2 | 82 | - uses: subosito/flutter-action@v1.3.2 |
| 77 | with: | 83 | with: |
| 78 | channel: ${{ matrix.channel }} | 84 | channel: ${{ matrix.channel }} |
| 79 | - - name: Setup projects (root & example) | ||
| 80 | - run: | | ||
| 81 | - flutter pub get | ||
| 82 | - cd example | ||
| 83 | - flutter create . | ||
| 84 | - rm -rf test | ||
| 85 | - flutter pub get | ||
| 86 | - cd .. | ||
| 87 | - - name: Run unit tests | 85 | + - run: flutter pub get |
| 86 | + working-directory: ${{ matrix.package }} | ||
| 87 | + - name: Run unit tests (tester) | ||
| 88 | + if: matrix.package != 'wakelock_web' | ||
| 88 | run: flutter test | 89 | run: flutter test |
| 89 | - - name: Run integration tests on iOS | ||
| 90 | - if: contains(matrix.device, 'iPhone') | 90 | + working-directory: ${{ matrix.package }} |
| 91 | + - name: Run unit tests (chrome) | ||
| 92 | + if: matrix.package == 'wakelock_web' | ||
| 93 | + run: flutter test --platform chrome | ||
| 94 | + working-directory: ${{ matrix.package }} | ||
| 95 | + - name: Integration tests on iOS | ||
| 96 | + if: matrix.package == 'wakelock' | ||
| 91 | run: | | 97 | run: | |
| 92 | - cd example | ||
| 93 | - flutter drive --target=test_driver/app.dart | ||
| 94 | - - name: Run integration tests on Android | ||
| 95 | - if: contains(matrix.device, 'Android') && false # Need to run locally for now. | ||
| 96 | - uses: reactivecircus/android-emulator-runner@v2.5.0 | ||
| 97 | - with: | ||
| 98 | - api-level: 29 | ||
| 99 | - disable-animations: false | ||
| 100 | - script: cd example && flutter drive --target=test_driver/app.dart | 98 | + cd wakelock/example |
| 99 | + flutter drive --driver=test_driver/integration_test.dart --target=integration_test/wakelock_test.dart |
| @@ -11,15 +11,25 @@ on: | @@ -11,15 +11,25 @@ on: | ||
| 11 | - '**/pubspec.yaml' | 11 | - '**/pubspec.yaml' |
| 12 | - '**/test/**' | 12 | - '**/test/**' |
| 13 | - '**/test_driver/**' | 13 | - '**/test_driver/**' |
| 14 | + - '**/assets/**' | ||
| 15 | + - '**/integration_test/**' | ||
| 14 | 16 | ||
| 15 | jobs: | 17 | jobs: |
| 16 | configure: | 18 | configure: |
| 17 | - # Not using the conditional as jobs are not re-run when the draft status changes. | ||
| 18 | - #if: github.event.pull_request.draft == false | 19 | + timeout-minutes: 9 |
| 19 | runs-on: ubuntu-latest | 20 | runs-on: ubuntu-latest |
| 21 | + name: Configuration of ${{ matrix.package }} | ||
| 22 | + strategy: | ||
| 23 | + matrix: | ||
| 24 | + package: | ||
| 25 | + - 'wakelock' | ||
| 26 | + - 'wakelock_platform_interface' | ||
| 27 | + - 'wakelock_web' | ||
| 28 | + fail-fast: false | ||
| 20 | 29 | ||
| 21 | steps: | 30 | steps: |
| 22 | - uses: actions/checkout@v2.3.3 | 31 | - uses: actions/checkout@v2.3.3 |
| 23 | - uses: axel-op/dart-package-analyzer@v3 | 32 | - uses: axel-op/dart-package-analyzer@v3 |
| 24 | with: | 33 | with: |
| 34 | + relativePath: ${{ matrix.package }} | ||
| 25 | githubToken: ${{ secrets.GITHUB_TOKEN }} | 35 | githubToken: ${{ secrets.GITHUB_TOKEN }} |
| 1 | -name: Publish | 1 | +name: Publish packages and releases |
| 2 | 2 | ||
| 3 | on: | 3 | on: |
| 4 | push: | 4 | push: |
| 5 | branches: | 5 | branches: |
| 6 | - master | 6 | - master |
| 7 | + paths: | ||
| 8 | + # Can only publish the package when the Pubspec changed, i.e. specifically the package | ||
| 9 | + # version, however, we can ensure that this is the case in code review. | ||
| 10 | + - '*/pubspec.yaml' | ||
| 7 | 11 | ||
| 8 | jobs: | 12 | jobs: |
| 9 | - checks: | ||
| 10 | - runs-on: macos-latest | ||
| 11 | - name: Check format, analyze, and test | 13 | + pana: |
| 14 | + timeout-minutes: 9 | ||
| 15 | + runs-on: ubuntu-latest | ||
| 16 | + name: Configuration of ${{ matrix.package }} | ||
| 17 | + strategy: | ||
| 18 | + matrix: | ||
| 19 | + package: | ||
| 20 | + - 'wakelock' | ||
| 21 | + - 'wakelock_platform_interface' | ||
| 22 | + - 'wakelock_web' | ||
| 23 | + fail-fast: false | ||
| 12 | 24 | ||
| 13 | steps: | 25 | steps: |
| 14 | - uses: actions/checkout@v2.3.3 | 26 | - uses: actions/checkout@v2.3.3 |
| 15 | - - uses: subosito/flutter-action@v1.3.2 | ||
| 16 | - with: | ||
| 17 | - channel: stable | ||
| 18 | - - name: Setup projects (root & example) | ||
| 19 | - run: | | ||
| 20 | - flutter pub get | ||
| 21 | - cd example | ||
| 22 | - flutter create . | ||
| 23 | - rm -rf test | ||
| 24 | - flutter pub get | ||
| 25 | - cd .. | ||
| 26 | - - name: Check format | ||
| 27 | - run: flutter format . --set-exit-if-changed --fix | ||
| 28 | - - run: flutter analyze | ||
| 29 | - - name: Run unit tests | ||
| 30 | - run: flutter test | ||
| 31 | - - name: Run integration tests on Android | ||
| 32 | - if: false # Need to run locally for now. | ||
| 33 | - uses: reactivecircus/android-emulator-runner@v2.5.0 | 27 | + - uses: axel-op/dart-package-analyzer@v3 |
| 34 | with: | 28 | with: |
| 35 | - api-level: 29 | ||
| 36 | - disable-animations: false | ||
| 37 | - script: cd example && flutter drive --target=test_driver/app.dart | 29 | + relativePath: ${{ matrix.package }} |
| 30 | + githubToken: ${{ secrets.GITHUB_TOKEN }} | ||
| 31 | + | ||
| 38 | publish: | 32 | publish: |
| 39 | - needs: checks | 33 | + needs: pana |
| 34 | + timeout-minutes: 2 | ||
| 40 | runs-on: ubuntu-latest | 35 | runs-on: ubuntu-latest |
| 41 | - name: Publish plugin | 36 | + name: Publishing of ${{ matrix.package }} |
| 37 | + strategy: | ||
| 38 | + matrix: | ||
| 39 | + package: | ||
| 40 | + - 'wakelock' | ||
| 41 | + - 'wakelock_platform_interface' | ||
| 42 | + - 'wakelock_web' | ||
| 43 | + fail-fast: false | ||
| 42 | 44 | ||
| 43 | steps: | 45 | steps: |
| 44 | - uses: actions/checkout@v2.3.3 | 46 | - uses: actions/checkout@v2.3.3 |
| 45 | - uses: sakebook/actions-flutter-pub-publisher@v1.3.1 | 47 | - uses: sakebook/actions-flutter-pub-publisher@v1.3.1 |
| 46 | with: | 48 | with: |
| 49 | + relativePath: ${{ matrix.package }} | ||
| 47 | credential: ${{ secrets.PUB_CREDENTIALS }} | 50 | credential: ${{ secrets.PUB_CREDENTIALS }} |
| 48 | flutter_package: true | 51 | flutter_package: true |
| 49 | skip_test: true | 52 | skip_test: true |
| 53 | + | ||
| 54 | + tag-release: | ||
| 55 | + needs: publish | ||
| 56 | + timeout-minutes: 1 | ||
| 57 | + runs-on: ubuntu-latest | ||
| 58 | + name: Tagging of ${{ matrix.package }} | ||
| 59 | + strategy: | ||
| 60 | + matrix: | ||
| 61 | + package: | ||
| 62 | + - wakelock | ||
| 63 | + - wakelock_web | ||
| 64 | + - wakelock_platform_interface | ||
| 65 | + | ||
| 66 | + steps: | ||
| 67 | + - uses: actions/checkout@v2 | ||
| 68 | + with: | ||
| 69 | + fetch-depth: 2 | ||
| 70 | + | ||
| 71 | + - name: Check package Pubspec | ||
| 72 | + id: pubspec | ||
| 73 | + run: | | ||
| 74 | + set +e | ||
| 75 | + git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | grep '${{ matrix.package }}/pubspec.yaml' &> /dev/null | ||
| 76 | + echo ::set-output name=changed::$? | ||
| 77 | + set -e | ||
| 78 | + - name: Extract package version | ||
| 79 | + if: steps.pubspec.outputs.changed == 0 | ||
| 80 | + run: | | ||
| 81 | + cd ${{ matrix.package }} | ||
| 82 | + echo ::set-env name=VERSION::"$(awk '{if ($1 ~ /^version:/) print $2}' pubspec.yaml)" | ||
| 83 | + - name: Create Release | ||
| 84 | + if: steps.pubspec.outputs.changed == 0 | ||
| 85 | + id: create_release | ||
| 86 | + uses: actions/create-release@v1.1.4 | ||
| 87 | + env: | ||
| 88 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| 89 | + with: | ||
| 90 | + tag_name: ${{ matrix.package }}-v${{ env.VERSION }} | ||
| 91 | + release_name: ${{ matrix.package }} v${{ env.VERSION }} | ||
| 92 | + draft: false | ||
| 93 | + prerelease: false |
.gitignore
deleted
100644 → 0
CODEOWNERS
deleted
100644 → 0
| 1 | -* @creativecreatorormaybenot |
CONTRIBUTING.md
deleted
100644 → 0
| 1 | -# Steps | ||
| 2 | - | ||
| 3 | -The following steps are based on a version of [flutter/plugin's contributing guide](https://github.com/flutter/plugins/blob/2ea66626c245a4373a6e07706ab2e7d471e25bd6/CONTRIBUTING.md). | ||
| 4 | - | ||
| 5 | -## Creating a fork | ||
| 6 | - | ||
| 7 | - * If you have not yet configured your machine with an SSH key that is known to GitHub, then follow [GitHub's directions](https://help.github.com/articles/generating-ssh-keys/) to generate an SSH key. | ||
| 8 | - * Fork [this repository](https://github.com/creativecreatorormaybenot/wakelock) using the "Fork" button in the upper right corner of the repository's GitHub page. | ||
| 9 | - * `git clone git@github.com:<github_user_name>/wakelock.git` | ||
| 10 | - * `cd wakelock` | ||
| 11 | - * `git remote add upstream git@github.com:creativecreatorormaybenot/wakelock.git` | ||
| 12 | - This ensures that `git fetch upstream` is possible to fetch from this remote repository instead of from your own fork to get the latest changes. | ||
| 13 | - | ||
| 14 | -## Creating a patch | ||
| 15 | - | ||
| 16 | - * `git fetch upstream` | ||
| 17 | - * `git checkout upstream/master -b <name_of_your_branch>` | ||
| 18 | - * Now, you can change the code necessary for your patch. | ||
| 19 | - | ||
| 20 | - Make sure that you bump the version in [`pubspec.yaml`](https://github.com/creativecreatorormaybenot/wakelock/blob/master/pubspec.yaml) | ||
| 21 | - and add an entry to [`CHANGELOG.md`](https://github.com/creativecreatorormaybenot/wakelock/blob/master/CHANGELOG.md). | ||
| 22 | - The version format is `r.M.m+p`. You will want to increment one of these values and which one you increment depends on the impact of your patch: | ||
| 23 | - `p` for simple patches, `m` for minor versions, `M` for major versions, and `r` for released. Do not forget to reset the values to the right of the value you incremented to 0. You should omit `+0`. | ||
| 24 | - * `git commit -am "<commit_message>"` | ||
| 25 | - * `git push origin <name_of_your_branch>` | ||
| 26 | - | ||
| 27 | -After having followed these steps, you are ready to [create a pull request](https://help.github.com/en/articles/creating-a-pull-request-from-a-fork). | ||
| 28 | -The GitHub interface makes this very easy by providing a button on your fork page that creates a pull request with changes from a recently pushed to branch. | ||
| 29 | -Alternatively, you can also use `git pull-request` via [GitHub hub](https://hub.github.com/). | ||
| 30 | - | ||
| 31 | -# Notes | ||
| 32 | - | ||
| 33 | - * You should remember to exclude all files and directories your IDE might generate using the `.gitignore` files (if they do not already contain them for your IDE). | ||
| 34 | - If you feel like you can make useful additions to any of the `.gitignore` files, you can include them in your pull request, potentially with an explanation. | ||
| 35 | - | ||
| 36 | - * It is probably easier for you to run the integration tests for the plugin locally using `flutter drive --target=test_driver/app.dart` in the `example` directory | ||
| 37 | - before opening a pull request (CI also runs the integration tests). | ||
| 38 | - This way you can ensure that any changes you have made work properly. Furthermore, you might also want to add some tests if you implement new functionality. | ||
| 39 | - | ||
| 40 | - * You should also run `flutter format lib example --fix` in the root directory and make sure that `flutter analyze` does not report any errors. |
| 1 | -# Wakelock [](https://github.com/creativecreatorormaybenot/wakelock/actions) [](https://github.com/creativecreatorormaybenot/wakelock) [](https://pub.dev/packages/wakelock) | 1 | +# Wakelock [](https://github.com/creativecreatorormaybenot/wakelock/actions) [](https://github.com/creativecreatorormaybenot/wakelock) [](https://pub.dev/packages/wakelock) |
| 2 | 2 | ||
| 3 | -This Flutter plugin allows you to enable and toggle the screen wakelock on Android and iOS, which prevents the screen from turning off automatically. | ||
| 4 | -Essentially, this allows you to keep the device awake, i.e. prevent the device from sleeping. | 3 | +Wakelock is Flutter plugin that allows you to keep the device screen awake, i.e. prevent the screen from sleeping on Android, iOS, and web. |
| 5 | 4 | ||
| 6 | -## Usage | 5 | +## Getting started |
| 7 | 6 | ||
| 8 | -To use this plugin, follow the [installing guide](https://pub.dev/packages/wakelock#-installing-tab-). | 7 | +To learn more about the plugin and getting started, you can view [the main package (`wakelock`) README](https://github.com/creativecreatorormaybenot/wakelock/blob/master/wakelock/README.md). |
| 9 | 8 | ||
| 10 | -### Implementation | 9 | +### Plugin structure |
| 11 | 10 | ||
| 12 | -Everything in this plugin is controlled via the [`Wakelock` class](https://pub.dev/documentation/wakelock/latest/wakelock/Wakelock-class.html). | ||
| 13 | -If you want to enable the wakelock, i.e. keep the device awake, you can simply call [`Wakelock.enable`](https://pub.dev/documentation/wakelock/latest/wakelock/Wakelock/enable.html) | ||
| 14 | -and to disable it again, you can use [`Wakelock.disable`](https://pub.dev/documentation/wakelock/latest/wakelock/Wakelock/disable.html): | 11 | +The `wakelock` plugin uses the [federated plugins approach](https://flutter.dev/docs/development/packages-and-plugins/developing-packages#federated-plugins). |
| 12 | +For this plugin, it means that the basic API is defined using [`pigeon`](https://pub.dev/packages/pigeon). The pigeon files can be found in the [`pigeons` directory](https://github.com/creativecreatorormaybenot/wakelock/tree/master/wakelock/pigeons) | ||
| 13 | +in the main package. The API is defined in Dart in the [`wakelock_platform_interface` package](https://github.com/creativecreatorormaybenot/wakelock/tree/master/wakelock_platform_interface). | ||
| 14 | +Furthermore, the Android and iOS implementations can be found in the main package, while the web implementation is in the [`wakelock_web` package](https://github.com/creativecreatorormaybenot/wakelock/tree/master/wakelock_platform_interface). | ||
| 15 | 15 | ||
| 16 | -```dart | ||
| 17 | -import 'package:wakelock/wakelock.dart'; | ||
| 18 | -// ... | 16 | +The packages in this repo are the following: |
| 19 | 17 | ||
| 20 | -// The following line will enable the Android and iOS wakelock. | ||
| 21 | -Wakelock.enable(); | 18 | +| Package | Implementations | |
| 19 | +| ------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------- | | ||
| 20 | +| [`wakelock`](https://github.com/creativecreatorormaybenot/wakelock/tree/master/wakelock) | Main plugin package + Android & iOS implementations | | ||
| 21 | +| [`wakelock_platform_interface`](https://github.com/creativecreatorormaybenot/wakelock/tree/master/wakelock_platform_interface) | Basic API definition & message handling | | ||
| 22 | +| [`wakelock_web`](https://github.com/creativecreatorormaybenot/wakelock/tree/master/wakelock_web) | Web implementation | | ||
| 22 | 23 | ||
| 23 | -// The next line disables the wakelock again. | ||
| 24 | -Wakelock.disable(); | ||
| 25 | -``` | 24 | +## Contributing |
| 26 | 25 | ||
| 27 | -For more advanced usage, you can pass a `bool` to [`Wakelock.toggle`](https://pub.dev/documentation/wakelock/latest/wakelock/Wakelock/toggle.html) to enable or disable the wakelock | ||
| 28 | -and also retrieve the current wakelock status using [`Wakelock.isEnabled`](https://pub.dev/documentation/wakelock/latest/wakelock/Wakelock/isEnabled.html): | 26 | +If you want to contribute to this plugin, follow the [contributing guide](https://github.com/creativecreatorormaybenot/wakelock/blob/master/.github/CONTRIBUTING.md). |
| 29 | 27 | ||
| 30 | -```dart | ||
| 31 | -import 'package:wakelock/wakelock.dart'; | ||
| 32 | -// ... | 28 | +## Origin |
| 33 | 29 | ||
| 34 | -// The following lines of code toggle the wakelock based on a bool value. | ||
| 35 | -bool on = true; | ||
| 36 | -// The following statement enables the wakelock. | ||
| 37 | -Wakelock.toggle(on: on); | ||
| 38 | - | ||
| 39 | -on = false; | ||
| 40 | -// The following statement disables the wakelock. | ||
| 41 | -Wakelock.toggle(on: on); | ||
| 42 | - | ||
| 43 | -// If you want to retrieve the current wakelock status, | ||
| 44 | -// you will have to be in an async scope | ||
| 45 | -// to await the Future returned by isEnabled. | ||
| 46 | -bool isEnabled = await Wakelock.isEnabled; | ||
| 47 | -``` | ||
| 48 | - | ||
| 49 | -If you want to wait for the wakelock toggle on Android or iOS to complete (which takes an insignificant amount of time), | ||
| 50 | -you can also `await` any of `Wakelock.enable`, `Wakelock.disable`, and `Wakelock.toggle`. | ||
| 51 | - | ||
| 52 | -## Notes | ||
| 53 | - | ||
| 54 | -This plugin is originally based on [`screen`](https://pub.dev/packages/screen). | 30 | +Originally, this plugin was based on [`screen`](https://pub.dev/packages/screen). |
| 55 | Specifically, the wakelock functionality was extracted into this plugin due to lack of maintenance by the author of the `screen` plugin. | 31 | Specifically, the wakelock functionality was extracted into this plugin due to lack of maintenance by the author of the `screen` plugin. |
| 56 | 32 | ||
| 57 | -If you want to contribute to this plugin, follow the [contributing guide](https://github.com/creativecreatorormaybenot/wakelock/blob/master/CONTRIBUTING.md). | 33 | +Today, the `wakelock` plugin has been completely refreshed (using latest Flutter standards and platform integration) with added web support. |
analysis_options.yaml
0 → 100644
android/.gitignore
deleted
100644 → 0
| 1 | -package creativecreatorormaybenot.wakelock | ||
| 2 | - | ||
| 3 | -import androidx.annotation.NonNull | ||
| 4 | -import io.flutter.embedding.engine.plugins.FlutterPlugin | ||
| 5 | -import io.flutter.embedding.engine.plugins.activity.ActivityAware | ||
| 6 | -import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding | ||
| 7 | -import io.flutter.plugin.common.MethodCall | ||
| 8 | -import io.flutter.plugin.common.MethodChannel | ||
| 9 | -import io.flutter.plugin.common.MethodChannel.MethodCallHandler | ||
| 10 | -import io.flutter.plugin.common.MethodChannel.Result | ||
| 11 | -import io.flutter.plugin.common.PluginRegistry.Registrar | ||
| 12 | - | ||
| 13 | -public class WakelockPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { | ||
| 14 | - private lateinit var channel: MethodChannel | ||
| 15 | - | ||
| 16 | - override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { | ||
| 17 | - channel = MethodChannel(flutterPluginBinding.binaryMessenger, "wakelock") | ||
| 18 | - channel.setMethodCallHandler(this) | ||
| 19 | - wakelock = Wakelock() | ||
| 20 | - } | ||
| 21 | - | ||
| 22 | - private var registrar: Registrar? = null | ||
| 23 | - | ||
| 24 | - // This static function is optional and equivalent to onAttachedToEngine. It supports the old | ||
| 25 | - // pre-Flutter-1.12 Android projects. You are encouraged to continue supporting | ||
| 26 | - // plugin registration via this function while apps migrate to use the new Android APIs | ||
| 27 | - // post-flutter-1.12 via https://flutter.dev/go/android-project-migration. | ||
| 28 | - // | ||
| 29 | - // It is encouraged to share logic between onAttachedToEngine and registerWith to keep | ||
| 30 | - // them functionally equivalent. Only one of onAttachedToEngine or registerWith will be called | ||
| 31 | - // depending on the user's project. onAttachedToEngine or registerWith must both be defined | ||
| 32 | - // in the same class. | ||
| 33 | - companion object { | ||
| 34 | - @JvmStatic | ||
| 35 | - fun registerWith(registrar: Registrar) { | ||
| 36 | - val channel = MethodChannel(registrar.messenger(), "wakelock") | ||
| 37 | - val plugin = WakelockPlugin() | ||
| 38 | - plugin.registrar = registrar | ||
| 39 | - plugin.wakelock = Wakelock() | ||
| 40 | - channel.setMethodCallHandler(plugin) | ||
| 41 | - } | ||
| 42 | - } | ||
| 43 | - | ||
| 44 | - private var wakelock: Wakelock? = null | ||
| 45 | - | ||
| 46 | - override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) { | ||
| 47 | - if (registrar != null) wakelock!!.activity = registrar!!.activity() | ||
| 48 | - when (call.method) { | ||
| 49 | - "toggle" -> { | ||
| 50 | - wakelock!!.toggle(call.argument<Boolean>("enable")!!, result) | ||
| 51 | - } | ||
| 52 | - "isEnabled" -> { | ||
| 53 | - wakelock!!.isEnabled(result) | ||
| 54 | - } | ||
| 55 | - else -> { | ||
| 56 | - result.notImplemented() | ||
| 57 | - } | ||
| 58 | - } | ||
| 59 | - if (registrar != null) wakelock!!.activity = null | ||
| 60 | - } | ||
| 61 | - | ||
| 62 | - override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) { | ||
| 63 | - channel.setMethodCallHandler(null) | ||
| 64 | - wakelock = null | ||
| 65 | - registrar = null | ||
| 66 | - } | ||
| 67 | - | ||
| 68 | - override fun onAttachedToActivity(binding: ActivityPluginBinding) { | ||
| 69 | - wakelock?.activity = binding.activity | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - override fun onDetachedFromActivity() { | ||
| 73 | - wakelock?.activity = null | ||
| 74 | - } | ||
| 75 | - | ||
| 76 | - override fun onReattachedToActivityForConfigChanges(binding: ActivityPluginBinding) { | ||
| 77 | - onAttachedToActivity(binding) | ||
| 78 | - } | ||
| 79 | - | ||
| 80 | - override fun onDetachedFromActivityForConfigChanges() { | ||
| 81 | - onDetachedFromActivity() | ||
| 82 | - } | ||
| 83 | -} |
example/README.md
deleted
100644 → 0
| 1 | -# Example | ||
| 2 | - | ||
| 3 | -This is a basic example demonstrating the functionality of the wakelock plugin, including enabling & disabling the wakelock and also retrieving the current wakelock status using a `FutureBuilder`. | ||
| 4 | - | ||
| 5 | -If you want to run this example app, you need to run `flutter create .` in the `example` directory (`cd example` from the plugin directory) first. This is also necessary when running the Flutter Driver tests. | ||
| 6 | - | ||
| 7 | -See [`example/lib/main.dart`](https://github.com/creativecreatorormaybenot/wakelock/blob/master/example/lib/main.dart). | ||
| 8 | - | ||
| 9 | -## Integration testing | ||
| 10 | - | ||
| 11 | -For integration testing, this plugin uses [`example/test_driver`](https://github.com/creativecreatorormaybenot/wakelock/tree/master/example/test_driver). The project has a setup for continuous integration, which will run the integration tests to confirm that the plugin is working correctly. | ||
| 12 | -The status for the latest commit is [](https://travis-ci.com/creativecreatorormaybenot/wakelock). | ||
| 13 | - | ||
| 14 | -If you want to run the integration tests yourself, you can run `flutter drive --target=test_driver/app.dart` from the `example` directory. |
example/test_driver/app.dart
deleted
100644 → 0
| 1 | -import 'dart:async'; | ||
| 2 | - | ||
| 3 | -import 'package:flutter_driver/driver_extension.dart'; | ||
| 4 | -import 'package:test/test.dart'; | ||
| 5 | -import 'package:wakelock/wakelock.dart'; | ||
| 6 | -import 'package:wakelock_example/main.dart' as example; | ||
| 7 | - | ||
| 8 | -void main() { | ||
| 9 | - final completer = Completer<String>(); | ||
| 10 | - enableFlutterDriverExtension(handler: (message) => completer.future); | ||
| 11 | - // The example app tests need this. | ||
| 12 | - example.main(); | ||
| 13 | - | ||
| 14 | - var result = 'success'; | ||
| 15 | - | ||
| 16 | - final _expect = (dynamic value, Matcher matcher) { | ||
| 17 | - if (!matcher.matches(value, null)) { | ||
| 18 | - result = 'failure'; | ||
| 19 | - } | ||
| 20 | - expect(value, matcher); | ||
| 21 | - }; | ||
| 22 | - | ||
| 23 | - group('wakelock bare platform testing', () { | ||
| 24 | - tearDownAll(() => completer.complete(result)); | ||
| 25 | - | ||
| 26 | - test('toggle on', () async { | ||
| 27 | - await Wakelock.toggle(on: true); | ||
| 28 | - | ||
| 29 | - _expect(await Wakelock.isEnabled, isTrue); | ||
| 30 | - }); | ||
| 31 | - | ||
| 32 | - test('toggle off', () async { | ||
| 33 | - await Wakelock.toggle(on: false); | ||
| 34 | - | ||
| 35 | - _expect(await Wakelock.isEnabled, isFalse); | ||
| 36 | - }); | ||
| 37 | - }); | ||
| 38 | -} |
example/test_driver/app_test.dart
deleted
100644 → 0
| 1 | -import 'package:flutter_driver/flutter_driver.dart'; | ||
| 2 | -import 'package:test/test.dart'; | ||
| 3 | - | ||
| 4 | -void main() async { | ||
| 5 | - FlutterDriver driver; | ||
| 6 | - String bareTestingResult; | ||
| 7 | - | ||
| 8 | - setUpAll(() async { | ||
| 9 | - driver = await FlutterDriver.connect(); | ||
| 10 | - bareTestingResult = | ||
| 11 | - await driver.requestData('', timeout: const Duration(minutes: 1)); | ||
| 12 | - }); | ||
| 13 | - | ||
| 14 | - tearDownAll(() => driver?.close()); | ||
| 15 | - | ||
| 16 | - group('example app', () { | ||
| 17 | - test('wakelock is disabled at start', () async { | ||
| 18 | - await driver._expectEnabled(isFalse); | ||
| 19 | - }); | ||
| 20 | - | ||
| 21 | - test('enable wakelock', () async { | ||
| 22 | - // Use the button in the example app instead of a direct plugin call. | ||
| 23 | - await driver.tap(find.text('enable wakelock')); | ||
| 24 | - | ||
| 25 | - await driver._expectEnabled(isTrue); | ||
| 26 | - }); | ||
| 27 | - | ||
| 28 | - test('disable wakelock', () async { | ||
| 29 | - // Use the button in the example app instead of a direct plugin call. | ||
| 30 | - await driver.tap(find.text('disable wakelock')); | ||
| 31 | - | ||
| 32 | - await driver._expectEnabled(isFalse); | ||
| 33 | - }); | ||
| 34 | - }); | ||
| 35 | - | ||
| 36 | - test('wakelock bare platform testing', () async { | ||
| 37 | - expect(bareTestingResult, equals('success')); | ||
| 38 | - }); | ||
| 39 | -} | ||
| 40 | - | ||
| 41 | -extension on FlutterDriver { | ||
| 42 | - Future<bool> _finds(SerializableFinder finder) async { | ||
| 43 | - try { | ||
| 44 | - await waitFor(finder, timeout: const Duration(milliseconds: 420)); | ||
| 45 | - return true; | ||
| 46 | - } catch (_) { | ||
| 47 | - return false; | ||
| 48 | - } | ||
| 49 | - } | ||
| 50 | - | ||
| 51 | - Future<void> _expectEnabled(Matcher matcher) async { | ||
| 52 | - // Check the widget in the example app. | ||
| 53 | - final result = await _finds(find.text( | ||
| 54 | - 'wakelock is currently ${matcher == isTrue ? 'enabled' : 'disabled'}')); | ||
| 55 | - | ||
| 56 | - expect(result, isTrue); | ||
| 57 | - } | ||
| 58 | -} |
ios/Classes/WakelockPlugin.m
deleted
100644 → 0
| 1 | -#import "WakelockPlugin.h" | ||
| 2 | - | ||
| 3 | -@implementation WakelockPlugin | ||
| 4 | -+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar { | ||
| 5 | - FlutterMethodChannel* channel = [FlutterMethodChannel | ||
| 6 | - methodChannelWithName:@"wakelock" | ||
| 7 | - binaryMessenger:[registrar messenger]]; | ||
| 8 | - WakelockPlugin* instance = [[WakelockPlugin alloc] init]; | ||
| 9 | - [registrar addMethodCallDelegate:instance channel:channel]; | ||
| 10 | -} | ||
| 11 | - | ||
| 12 | -- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { | ||
| 13 | - if ([@"toggle" isEqualToString:call.method]) { | ||
| 14 | - NSNumber *enable = call.arguments[@"enable"]; | ||
| 15 | - NSNumber *enabled = [NSNumber numberWithBool:[[UIApplication sharedApplication] isIdleTimerDisabled]]; | ||
| 16 | - | ||
| 17 | - if([enable isEqualToNumber:enabled]) { | ||
| 18 | - result(nil); | ||
| 19 | - } else { | ||
| 20 | - [[UIApplication sharedApplication] setIdleTimerDisabled:enable.boolValue]; | ||
| 21 | - result(nil); | ||
| 22 | - } | ||
| 23 | - } else if ([@"isEnabled" isEqualToString:call.method]) { | ||
| 24 | - result([NSNumber numberWithBool:[[UIApplication sharedApplication] isIdleTimerDisabled]]); | ||
| 25 | - } else { | ||
| 26 | - result(FlutterMethodNotImplemented); | ||
| 27 | - } | ||
| 28 | -} | ||
| 29 | - | ||
| 30 | -@end |
lib/wakelock.dart
deleted
100644 → 0
| 1 | -import 'dart:async'; | ||
| 2 | - | ||
| 3 | -import 'package:flutter/foundation.dart'; | ||
| 4 | -import 'package:flutter/services.dart'; | ||
| 5 | - | ||
| 6 | -/// To enable the wakelock, you can use [Wakelock.enable] and to disable it, | ||
| 7 | -/// you can call [Wakelock.disable]. | ||
| 8 | -/// You do not need to worry about making redundant calls, e.g. calling [Wakelock.enable] | ||
| 9 | -/// when the wakelock is already enabled as the plugin handles this for you, i.e. it checks | ||
| 10 | -/// the status to determine if the wakelock is already enabled or disabled. | ||
| 11 | -/// If you want the flexibility to pass a [bool] to control whether the wakelock should be | ||
| 12 | -/// enabled or disabled, you can use [Wakelock.toggle]. | ||
| 13 | -/// | ||
| 14 | -/// The [Wakelock.isEnabled] property allows you to retrieve the current wakelock | ||
| 15 | -/// status from Android or iOS. | ||
| 16 | -class Wakelock { | ||
| 17 | - static const MethodChannel _channel = MethodChannel('wakelock'); | ||
| 18 | - | ||
| 19 | - /// This can simply be called using `Wakelock.enable()` and does not return anything. | ||
| 20 | - /// You can await the [Future] to wait for the operation to complete. | ||
| 21 | - static Future<void> enable() => | ||
| 22 | - _channel.invokeMethod('toggle', {'enable': true}); | ||
| 23 | - | ||
| 24 | - /// This can simply be called using `Wakelock.disable()` and does not return anything. | ||
| 25 | - /// You can await the [Future] to wait for the operation to complete. | ||
| 26 | - static Future<void> disable() => | ||
| 27 | - _channel.invokeMethod('toggle', {'enable': false}); | ||
| 28 | - | ||
| 29 | - /// You can simply use this function to toggle the wakelock using a [bool] value. | ||
| 30 | - /// | ||
| 31 | - /// ```dart | ||
| 32 | - /// // This line keeps the screen on. | ||
| 33 | - /// Wakelock.toggle(on: true); | ||
| 34 | - /// | ||
| 35 | - /// bool turnOnWakelock = false; | ||
| 36 | - /// // The following line disables the wakelock. | ||
| 37 | - /// Wakelock.toggle(on: turnOnWakelock); | ||
| 38 | - /// ``` | ||
| 39 | - /// | ||
| 40 | - /// You can await the [Future] to wait for the operation to complete. | ||
| 41 | - static Future<void> toggle({@required bool on}) { | ||
| 42 | - assert(on != null, | ||
| 43 | - 'The [on] parameter cannot be null when toggling the wakelock.'); | ||
| 44 | - return _channel.invokeMethod('toggle', {'enable': on}); | ||
| 45 | - } | ||
| 46 | - | ||
| 47 | - /// If you want to retrieve the current wakelock status, you will have to call [Wakelock.isEnabled] | ||
| 48 | - /// and await its result: `bool isEnabled = await Wakelock.isEnabled()` | ||
| 49 | - static Future<bool> get isEnabled => _channel.invokeMethod('isEnabled'); | ||
| 50 | -} |
test/wakelock_test.dart
deleted
100644 → 0
| 1 | -import 'package:flutter/services.dart'; | ||
| 2 | -import 'package:flutter_test/flutter_test.dart'; | ||
| 3 | -import 'package:wakelock/wakelock.dart'; | ||
| 4 | - | ||
| 5 | -void main() { | ||
| 6 | - const MethodChannel channel = MethodChannel('wakelock'); | ||
| 7 | - | ||
| 8 | - TestWidgetsFlutterBinding.ensureInitialized(); | ||
| 9 | - | ||
| 10 | - setUp(() { | ||
| 11 | - var enabled = false; | ||
| 12 | - | ||
| 13 | - channel.setMockMethodCallHandler((MethodCall methodCall) async { | ||
| 14 | - switch (methodCall.method) { | ||
| 15 | - case 'toggle': | ||
| 16 | - enabled = methodCall.arguments['enable']; | ||
| 17 | - break; | ||
| 18 | - case 'enable': | ||
| 19 | - enabled = true; | ||
| 20 | - break; | ||
| 21 | - case 'disable': | ||
| 22 | - enabled = false; | ||
| 23 | - break; | ||
| 24 | - case 'isEnabled': | ||
| 25 | - return enabled; | ||
| 26 | - default: | ||
| 27 | - throw ArgumentError.value(methodCall.method); | ||
| 28 | - } | ||
| 29 | - | ||
| 30 | - return null; | ||
| 31 | - }); | ||
| 32 | - }); | ||
| 33 | - | ||
| 34 | - tearDown(() { | ||
| 35 | - channel.setMockMethodCallHandler(null); | ||
| 36 | - }); | ||
| 37 | - | ||
| 38 | - test('isEnabled', () async { | ||
| 39 | - expect(await Wakelock.isEnabled, isFalse); | ||
| 40 | - }); | ||
| 41 | - | ||
| 42 | - group('toggle', () { | ||
| 43 | - test('on', () async { | ||
| 44 | - await Wakelock.toggle(on: true); | ||
| 45 | - expect(await Wakelock.isEnabled, isTrue); | ||
| 46 | - }); | ||
| 47 | - | ||
| 48 | - test('off', () async { | ||
| 49 | - await Wakelock.toggle(on: false); | ||
| 50 | - expect(await Wakelock.isEnabled, isFalse); | ||
| 51 | - }); | ||
| 52 | - | ||
| 53 | - test('non-null assertion', () async { | ||
| 54 | - expect(() async => await Wakelock.toggle(on: null), throwsAssertionError); | ||
| 55 | - }); | ||
| 56 | - }); | ||
| 57 | - | ||
| 58 | - test('enable', () async { | ||
| 59 | - await Wakelock.enable(); | ||
| 60 | - expect(await Wakelock.isEnabled, isTrue); | ||
| 61 | - }); | ||
| 62 | - | ||
| 63 | - test('disable', () async { | ||
| 64 | - await Wakelock.disable(); | ||
| 65 | - expect(await Wakelock.isEnabled, isFalse); | ||
| 66 | - }); | ||
| 67 | -} |
wakelock/.gitignore
0 → 100644
| 1 | +# Miscellaneous | ||
| 2 | +*.class | ||
| 3 | +*.log | ||
| 4 | +*.pyc | ||
| 5 | +*.swp | ||
| 6 | +.DS_Store | ||
| 7 | +.atom/ | ||
| 8 | +.buildlog/ | ||
| 9 | +.history | ||
| 10 | +.svn/ | ||
| 11 | +.metadata | ||
| 12 | + | ||
| 13 | +# IntelliJ related | ||
| 14 | +*.iml | ||
| 15 | +*.ipr | ||
| 16 | +*.iws | ||
| 17 | +.idea/ | ||
| 18 | + | ||
| 19 | +# The .vscode folder contains launch configuration and tasks you configure in | ||
| 20 | +# VS Code which you may wish to be included in version control, so this line | ||
| 21 | +# is commented out by default. | ||
| 22 | +#.vscode/ | ||
| 23 | + | ||
| 24 | +# Flutter/Dart/Pub related | ||
| 25 | +**/doc/api/ | ||
| 26 | +.dart_tool/ | ||
| 27 | +.flutter-plugins | ||
| 28 | +.flutter-plugins-dependencies | ||
| 29 | +.packages | ||
| 30 | +.pub-cache/ | ||
| 31 | +.pub/ | ||
| 32 | +build/ | ||
| 33 | +pubspec.lock | ||
| 34 | + | ||
| 35 | +# Android related | ||
| 36 | +**/android/**/gradle-wrapper.jar | ||
| 37 | +**/android/.gradle | ||
| 38 | +**/android/captures/ | ||
| 39 | +**/android/gradlew | ||
| 40 | +**/android/gradlew.bat | ||
| 41 | +**/android/local.properties | ||
| 42 | +**/android/**/GeneratedPluginRegistrant.java | ||
| 43 | + | ||
| 44 | +# iOS/XCode related | ||
| 45 | +**/ios/**/*.mode1v3 | ||
| 46 | +**/ios/**/*.mode2v3 | ||
| 47 | +**/ios/**/*.moved-aside | ||
| 48 | +**/ios/**/*.pbxuser | ||
| 49 | +**/ios/**/*.perspectivev3 | ||
| 50 | +**/ios/**/*sync/ | ||
| 51 | +**/ios/**/.sconsign.dblite | ||
| 52 | +**/ios/**/.tags* | ||
| 53 | +**/ios/**/.vagrant/ | ||
| 54 | +**/ios/**/DerivedData/ | ||
| 55 | +**/ios/**/Icon? | ||
| 56 | +**/ios/**/Pods/ | ||
| 57 | +**/ios/**/.symlinks/ | ||
| 58 | +**/ios/**/profile | ||
| 59 | +**/ios/**/xcuserdata | ||
| 60 | +**/ios/.generated/ | ||
| 61 | +**/ios/Flutter/App.framework | ||
| 62 | +**/ios/Flutter/Flutter.framework | ||
| 63 | +**/ios/Flutter/Flutter.podspec | ||
| 64 | +**/ios/Flutter/Generated.xcconfig | ||
| 65 | +**/ios/Flutter/app.flx | ||
| 66 | +**/ios/Flutter/app.zip | ||
| 67 | +**/ios/Flutter/flutter_assets/ | ||
| 68 | +**/ios/Flutter/flutter_export_environment.sh | ||
| 69 | +**/ios/ServiceDefinitions.json | ||
| 70 | +**/ios/Runner/GeneratedPluginRegistrant.* | ||
| 71 | + | ||
| 72 | +# Exceptions to above rules. | ||
| 73 | +!**/ios/**/default.mode1v3 | ||
| 74 | +!**/ios/**/default.mode2v3 | ||
| 75 | +!**/ios/**/default.pbxuser | ||
| 76 | +!**/ios/**/default.perspectivev3 |
| 1 | +## 0.2.0 | ||
| 2 | + | ||
| 3 | +* Added web support. | ||
| 4 | +* Overhauled the plugin with the latest Flutter standards. | ||
| 5 | +* Implemented federated plugin approach, adding `wakelock_platform_interface` and `wakelock_web` | ||
| 6 | + dependencies. | ||
| 7 | +* Removed support for the Android v1 APIs. | ||
| 8 | +* *Deprecated* `Wakelock.isEnabled` in favor of `Wakelock.enabled`. The fact that it is a getter | ||
| 9 | + should be enough and remove the need for the "is" context. | ||
| 10 | +* *Deprecated* the `on` parameter in `Wakelock.toggle` in favor of the `enable` parameter, which | ||
| 11 | + should be a more descriptive name. | ||
| 12 | + | ||
| 1 | ## 0.1.4+2 | 13 | ## 0.1.4+2 |
| 2 | 14 | ||
| 3 | * Fixed Gradle builds missing NonNull annotation. | 15 | * Fixed Gradle builds missing NonNull annotation. |
wakelock/README.md
0 → 100644
| 1 | +# wakelock [](https://pub.dev/packages/wakelock) [](https://github.com/creativecreatorormaybenot/wakelock) | ||
| 2 | + | ||
| 3 | +Plugin that allows you to keep the device screen awake, i.e. prevent the screen from sleeping on | ||
| 4 | +Android, iOS, and web. | ||
| 5 | + | ||
| 6 | +--- | ||
| 7 | + | ||
| 8 | +The plugin allows you to enable and toggle the screen wakelock on Android, iOS, and web, which | ||
| 9 | +prevents the screen from turning off automatically. | ||
| 10 | +Essentially, this allows you to keep the device awake, i.e. prevent the device from sleeping. | ||
| 11 | + | ||
| 12 | +## Usage | ||
| 13 | + | ||
| 14 | +To use this plugin, follow the [installing guide](https://pub.dev/packages/wakelock/install). | ||
| 15 | + | ||
| 16 | +### Implementation | ||
| 17 | + | ||
| 18 | +Everything in this plugin is controlled via the [`Wakelock` class](https://pub.dev/documentation/wakelock/latest/wakelock/Wakelock-class.html). | ||
| 19 | +If you want to enable the wakelock, i.e. keep the device awake, you can simply call [`Wakelock.enable`](https://pub.dev/documentation/wakelock/latest/wakelock/Wakelock/enable.html) | ||
| 20 | +and to disable it again, you can use [`Wakelock.disable`](https://pub.dev/documentation/wakelock/latest/wakelock/Wakelock/disable.html): | ||
| 21 | + | ||
| 22 | +```dart | ||
| 23 | +import 'package:wakelock/wakelock.dart'; | ||
| 24 | +// ... | ||
| 25 | + | ||
| 26 | +// The following line will enable the Android and iOS wakelock. | ||
| 27 | +Wakelock.enable(); | ||
| 28 | + | ||
| 29 | +// The next line disables the wakelock again. | ||
| 30 | +Wakelock.disable(); | ||
| 31 | +``` | ||
| 32 | + | ||
| 33 | +For more advanced usage, you can pass a `bool` to [`Wakelock.toggle`](https://pub.dev/documentation/wakelock/latest/wakelock/Wakelock/toggle.html) | ||
| 34 | +to enable or disable the wakelock and also retrieve the current wakelock status using | ||
| 35 | +[`Wakelock.isEnabled`](https://pub.dev/documentation/wakelock/latest/wakelock/Wakelock/isEnabled.html): | ||
| 36 | + | ||
| 37 | +```dart | ||
| 38 | +import 'package:wakelock/wakelock.dart'; | ||
| 39 | +// ... | ||
| 40 | + | ||
| 41 | +// The following lines of code toggle the wakelock based on a bool value. | ||
| 42 | +bool enable = true; | ||
| 43 | +// The following statement enables the wakelock. | ||
| 44 | +Wakelock.toggle(enable: enable); | ||
| 45 | + | ||
| 46 | +enable = false; | ||
| 47 | +// The following statement disables the wakelock. | ||
| 48 | +Wakelock.toggle(enable: enable); | ||
| 49 | + | ||
| 50 | +// If you want to retrieve the current wakelock status, | ||
| 51 | +// you will have to be in an async scope | ||
| 52 | +// to await the Future returned by `enabled`. | ||
| 53 | +bool wakelockEnabled = await Wakelock.enabled; | ||
| 54 | +``` | ||
| 55 | + | ||
| 56 | +If you want to wait for the wakelock toggle to complete (which takes an insignificant amount of | ||
| 57 | +time), you can also `await` any of `Wakelock.enable`, `Wakelock.disable`, and `Wakelock.toggle`. | ||
| 58 | + | ||
| 59 | +## Learn more | ||
| 60 | + | ||
| 61 | +If you want to learn more about how this plugin works, how to contribute, etc., you can read through | ||
| 62 | +the [main README on GitHub](https://github.com/creativecreatorormaybenot/wakelock). |
wakelock/android/.gitignore
0 → 100644
| 1 | -group 'creativecreatorormaybenot.wakelock' | 1 | +group 'creativemaybeno.wakelock' |
| 2 | version '1.0-SNAPSHOT' | 2 | version '1.0-SNAPSHOT' |
| 3 | 3 | ||
| 4 | buildscript { | 4 | buildscript { |
| @@ -25,7 +25,7 @@ apply plugin: 'com.android.library' | @@ -25,7 +25,7 @@ apply plugin: 'com.android.library' | ||
| 25 | apply plugin: 'kotlin-android' | 25 | apply plugin: 'kotlin-android' |
| 26 | 26 | ||
| 27 | android { | 27 | android { |
| 28 | - compileSdkVersion 28 | 28 | + compileSdkVersion 29 |
| 29 | 29 | ||
| 30 | sourceSets { | 30 | sourceSets { |
| 31 | main.java.srcDirs += 'src/main/kotlin' | 31 | main.java.srcDirs += 'src/main/kotlin' |
| @@ -40,5 +40,4 @@ android { | @@ -40,5 +40,4 @@ android { | ||
| 40 | 40 | ||
| 41 | dependencies { | 41 | dependencies { |
| 42 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" | 42 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" |
| 43 | - implementation "androidx.annotation:annotation:1.1.0" | ||
| 44 | } | 43 | } |
wakelock/android/gradle.properties
0 → 100644
| 1 | +// Autogenerated from Pigeon (v0.1.7), do not edit directly. | ||
| 2 | +// See also: https://pub.dev/packages/pigeon | ||
| 3 | +package creativemaybeno.wakelock | ||
| 4 | + | ||
| 5 | +import io.flutter.plugin.common.BasicMessageChannel | ||
| 6 | +import io.flutter.plugin.common.BinaryMessenger | ||
| 7 | +import io.flutter.plugin.common.StandardMessageCodec | ||
| 8 | +import java.util.* | ||
| 9 | + | ||
| 10 | +/** Generated class from Pigeon. */ | ||
| 11 | +object Messages { | ||
| 12 | + private fun wrapError(exception: Exception): HashMap<*, *> { | ||
| 13 | + val errorMap = HashMap<String, Any?>() | ||
| 14 | + errorMap["message"] = exception.toString() | ||
| 15 | + errorMap["code"] = null | ||
| 16 | + errorMap["details"] = null | ||
| 17 | + return errorMap | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + /** Generated class from Pigeon that represents data sent in messages. */ | ||
| 21 | + class ToggleMessage { | ||
| 22 | + private var enable: Boolean? = null | ||
| 23 | + fun getEnable(): Boolean? { | ||
| 24 | + return enable | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + fun setEnable(setterArg: Boolean?) { | ||
| 28 | + enable = setterArg | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + fun toMap(): HashMap<*, *> { | ||
| 32 | + val toMapResult = HashMap<String, Any?>() | ||
| 33 | + toMapResult["enable"] = enable | ||
| 34 | + return toMapResult | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + companion object { | ||
| 38 | + fun fromMap(map: HashMap<*, *>?): ToggleMessage { | ||
| 39 | + val fromMapResult = ToggleMessage() | ||
| 40 | + val enable = map!!["enable"] | ||
| 41 | + fromMapResult.enable = enable as Boolean? | ||
| 42 | + return fromMapResult | ||
| 43 | + } | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + /** Generated class from Pigeon that represents data sent in messages. */ | ||
| 48 | + class IsEnabledMessage { | ||
| 49 | + private var enabled: Boolean? = null | ||
| 50 | + fun getEnabled(): Boolean? { | ||
| 51 | + return enabled | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + fun setEnabled(setterArg: Boolean?) { | ||
| 55 | + enabled = setterArg | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + fun toMap(): HashMap<*, *> { | ||
| 59 | + val toMapResult = HashMap<String, Any?>() | ||
| 60 | + toMapResult["enabled"] = enabled | ||
| 61 | + return toMapResult | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + companion object { | ||
| 65 | + fun fromMap(map: HashMap<*, *>): IsEnabledMessage { | ||
| 66 | + val fromMapResult = IsEnabledMessage() | ||
| 67 | + val enabled = map["enabled"] | ||
| 68 | + fromMapResult.enabled = enabled as Boolean? | ||
| 69 | + return fromMapResult | ||
| 70 | + } | ||
| 71 | + } | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ | ||
| 75 | + interface WakelockApi { | ||
| 76 | + fun toggle(arg: ToggleMessage?) | ||
| 77 | + val isEnabled: IsEnabledMessage | ||
| 78 | + | ||
| 79 | + companion object { | ||
| 80 | + /** Sets up an instance of `WakelockApi` to handle messages through the `binaryMessenger` */ | ||
| 81 | + fun setup(binaryMessenger: BinaryMessenger?, api: WakelockApi?) { | ||
| 82 | + run { | ||
| 83 | + val channel = BasicMessageChannel(binaryMessenger!!, "dev.flutter.pigeon.WakelockApi.toggle", StandardMessageCodec()) | ||
| 84 | + if (api != null) { | ||
| 85 | + channel.setMessageHandler { message: Any?, reply: BasicMessageChannel.Reply<Any> -> | ||
| 86 | + val wrapped = HashMap<String, HashMap<*, *>?>() | ||
| 87 | + try { | ||
| 88 | + val input = ToggleMessage.fromMap(message as HashMap<*, *>?) | ||
| 89 | + api.toggle(input) | ||
| 90 | + wrapped["result"] = null | ||
| 91 | + } catch (exception: Exception) { | ||
| 92 | + wrapped["error"] = wrapError(exception) | ||
| 93 | + } | ||
| 94 | + reply.reply(wrapped) | ||
| 95 | + } | ||
| 96 | + } else { | ||
| 97 | + channel.setMessageHandler(null) | ||
| 98 | + } | ||
| 99 | + } | ||
| 100 | + run { | ||
| 101 | + val channel = BasicMessageChannel(binaryMessenger!!, "dev.flutter.pigeon.WakelockApi.isEnabled", StandardMessageCodec()) | ||
| 102 | + if (api != null) { | ||
| 103 | + channel.setMessageHandler { message: Any?, reply: BasicMessageChannel.Reply<Any> -> | ||
| 104 | + val wrapped = HashMap<String, HashMap<*, *>>() | ||
| 105 | + try { | ||
| 106 | + val output = api.isEnabled | ||
| 107 | + wrapped["result"] = output.toMap() | ||
| 108 | + } catch (exception: Exception) { | ||
| 109 | + wrapped["error"] = wrapError(exception) | ||
| 110 | + } | ||
| 111 | + reply.reply(wrapped) | ||
| 112 | + } | ||
| 113 | + } else { | ||
| 114 | + channel.setMessageHandler(null) | ||
| 115 | + } | ||
| 116 | + } | ||
| 117 | + } | ||
| 118 | + } | ||
| 119 | + } | ||
| 120 | +} |
| 1 | -package creativecreatorormaybenot.wakelock | 1 | +package creativemaybeno.wakelock |
| 2 | 2 | ||
| 3 | import android.app.Activity | 3 | import android.app.Activity |
| 4 | import android.view.WindowManager | 4 | import android.view.WindowManager |
| 5 | -import io.flutter.plugin.common.MethodChannel | 5 | +import creativemaybeno.wakelock.Messages.IsEnabledMessage |
| 6 | +import creativemaybeno.wakelock.Messages.ToggleMessage | ||
| 6 | 7 | ||
| 7 | internal class Wakelock { | 8 | internal class Wakelock { |
| 8 | var activity: Activity? = null | 9 | var activity: Activity? = null |
| @@ -11,32 +12,30 @@ internal class Wakelock { | @@ -11,32 +12,30 @@ internal class Wakelock { | ||
| 11 | get() = activity!!.window.attributes.flags and | 12 | get() = activity!!.window.attributes.flags and |
| 12 | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON != 0 | 13 | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON != 0 |
| 13 | 14 | ||
| 14 | - fun toggle(enable: Boolean, result: MethodChannel.Result) { | 15 | + fun toggle(message: ToggleMessage) { |
| 15 | if (activity == null) { | 16 | if (activity == null) { |
| 16 | - result.noActivity() | ||
| 17 | - return | 17 | + throw NoActivityException() |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | val activity = this.activity!! | 20 | val activity = this.activity!! |
| 21 | val enabled = this.enabled | 21 | val enabled = this.enabled |
| 22 | 22 | ||
| 23 | - if (enable) { | 23 | + if (message.getEnable()!!) { |
| 24 | if (!enabled) activity.window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) | 24 | if (!enabled) activity.window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) |
| 25 | } else if (enabled) { | 25 | } else if (enabled) { |
| 26 | activity.window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) | 26 | activity.window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) |
| 27 | } | 27 | } |
| 28 | - | ||
| 29 | - result.success(null) | ||
| 30 | } | 28 | } |
| 31 | 29 | ||
| 32 | - fun isEnabled(result: MethodChannel.Result) { | 30 | + fun isEnabled(): IsEnabledMessage { |
| 33 | if (activity == null) { | 31 | if (activity == null) { |
| 34 | - result.noActivity() | ||
| 35 | - return | 32 | + throw NoActivityException() |
| 36 | } | 33 | } |
| 37 | 34 | ||
| 38 | - result.success(enabled) | 35 | + val msg = IsEnabledMessage() |
| 36 | + msg.setEnabled(enabled) | ||
| 37 | + return msg | ||
| 39 | } | 38 | } |
| 40 | } | 39 | } |
| 41 | 40 | ||
| 42 | -fun MethodChannel.Result.noActivity() = error("no_activity", "wakelock requires a foreground activity", null) | 41 | +class NoActivityException() : Exception("wakelock requires a foreground activity") |
| 1 | +package creativemaybeno.wakelock | ||
| 2 | + | ||
| 3 | +import androidx.annotation.NonNull | ||
| 4 | +import creativemaybeno.wakelock.Messages.IsEnabledMessage | ||
| 5 | +import creativemaybeno.wakelock.Messages.ToggleMessage | ||
| 6 | +import creativemaybeno.wakelock.Messages.WakelockApi | ||
| 7 | +import io.flutter.embedding.engine.plugins.FlutterPlugin | ||
| 8 | +import io.flutter.embedding.engine.plugins.activity.ActivityAware | ||
| 9 | +import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding | ||
| 10 | + | ||
| 11 | +/** WakelockPlugin */ | ||
| 12 | +class WakelockPlugin : FlutterPlugin, WakelockApi, ActivityAware { | ||
| 13 | + private var wakelock: Wakelock? = null | ||
| 14 | + | ||
| 15 | + override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { | ||
| 16 | + WakelockApi.setup(flutterPluginBinding.binaryMessenger, this) | ||
| 17 | + wakelock = Wakelock() | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) { | ||
| 21 | + WakelockApi.setup(binding.binaryMessenger, null) | ||
| 22 | + wakelock = null | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + override fun onAttachedToActivity(binding: ActivityPluginBinding) { | ||
| 26 | + wakelock?.activity = binding.activity | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + override fun onDetachedFromActivity() { | ||
| 30 | + wakelock?.activity = null | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + override fun onReattachedToActivityForConfigChanges(binding: ActivityPluginBinding) { | ||
| 34 | + onAttachedToActivity(binding) | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + override fun onDetachedFromActivityForConfigChanges() { | ||
| 38 | + onDetachedFromActivity() | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + override fun toggle(arg: ToggleMessage?) { | ||
| 42 | + wakelock!!.toggle(arg!!) | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + override val isEnabled: IsEnabledMessage | ||
| 46 | + get() { | ||
| 47 | + return wakelock!!.isEnabled() | ||
| 48 | + } | ||
| 49 | +} |
| @@ -22,6 +22,7 @@ | @@ -22,6 +22,7 @@ | ||
| 22 | 22 | ||
| 23 | # Flutter/Dart/Pub related | 23 | # Flutter/Dart/Pub related |
| 24 | **/doc/api/ | 24 | **/doc/api/ |
| 25 | +**/ios/Flutter/.last_build_id | ||
| 25 | .dart_tool/ | 26 | .dart_tool/ |
| 26 | .flutter-plugins | 27 | .flutter-plugins |
| 27 | .flutter-plugins-dependencies | 28 | .flutter-plugins-dependencies |
| @@ -38,14 +39,3 @@ app.*.symbols | @@ -38,14 +39,3 @@ app.*.symbols | ||
| 38 | 39 | ||
| 39 | # Obfuscation related | 40 | # Obfuscation related |
| 40 | app.*.map.json | 41 | app.*.map.json |
| 41 | - | ||
| 42 | -# Exceptions to above rules. | ||
| 43 | -!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages | ||
| 44 | - | ||
| 45 | -# Cleanliness | ||
| 46 | -pubspec.lock | ||
| 47 | -.metadata | ||
| 48 | -test | ||
| 49 | -ios | ||
| 50 | -android | ||
| 51 | -web |
wakelock/example/README.md
0 → 100644
| 1 | +# wakelock_example | ||
| 2 | + | ||
| 3 | +Example app demonstrating how to use the wakelock plugin. It also includes integration tests for | ||
| 4 | +testing the plugin in an integrated example. | ||
| 5 | + | ||
| 6 | +## Integration tests | ||
| 7 | + | ||
| 8 | +You can run the integration tests using the following command: | ||
| 9 | + | ||
| 10 | +``` | ||
| 11 | +flutter drive --driver=test_driver/integration_test.dart --target=integration_test/wakelock_test.dart | ||
| 12 | +``` |
wakelock/example/android/.gitignore
0 → 100644
wakelock/example/android/app/build.gradle
0 → 100644
| 1 | +def localProperties = new Properties() | ||
| 2 | +def localPropertiesFile = rootProject.file('local.properties') | ||
| 3 | +if (localPropertiesFile.exists()) { | ||
| 4 | + localPropertiesFile.withReader('UTF-8') { reader -> | ||
| 5 | + localProperties.load(reader) | ||
| 6 | + } | ||
| 7 | +} | ||
| 8 | + | ||
| 9 | +def flutterRoot = localProperties.getProperty('flutter.sdk') | ||
| 10 | +if (flutterRoot == null) { | ||
| 11 | + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") | ||
| 12 | +} | ||
| 13 | + | ||
| 14 | +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') | ||
| 15 | +if (flutterVersionCode == null) { | ||
| 16 | + flutterVersionCode = '1' | ||
| 17 | +} | ||
| 18 | + | ||
| 19 | +def flutterVersionName = localProperties.getProperty('flutter.versionName') | ||
| 20 | +if (flutterVersionName == null) { | ||
| 21 | + flutterVersionName = '1.0' | ||
| 22 | +} | ||
| 23 | + | ||
| 24 | +apply plugin: 'com.android.application' | ||
| 25 | +apply plugin: 'kotlin-android' | ||
| 26 | +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" | ||
| 27 | + | ||
| 28 | +android { | ||
| 29 | + compileSdkVersion 29 | ||
| 30 | + | ||
| 31 | + sourceSets { | ||
| 32 | + main.java.srcDirs += 'src/main/kotlin' | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + lintOptions { | ||
| 36 | + disable 'InvalidPackage' | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + defaultConfig { | ||
| 40 | + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). | ||
| 41 | + applicationId "creativemaybeno.wakelock_example" | ||
| 42 | + minSdkVersion 16 | ||
| 43 | + targetSdkVersion 29 | ||
| 44 | + versionCode flutterVersionCode.toInteger() | ||
| 45 | + versionName flutterVersionName | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + buildTypes { | ||
| 49 | + release { | ||
| 50 | + // TODO: Add your own signing config for the release build. | ||
| 51 | + // Signing with the debug keys for now, so `flutter run --release` works. | ||
| 52 | + signingConfig signingConfigs.debug | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | +} | ||
| 56 | + | ||
| 57 | +flutter { | ||
| 58 | + source '../..' | ||
| 59 | +} | ||
| 60 | + | ||
| 61 | +dependencies { | ||
| 62 | + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" | ||
| 63 | +} |
| 1 | +<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 2 | + package="creativemaybeno.wakelock_example"> | ||
| 3 | + <!-- Flutter needs it to communicate with the running application | ||
| 4 | + to allow setting breakpoints, to provide hot reload, etc. | ||
| 5 | + --> | ||
| 6 | + <uses-permission android:name="android.permission.INTERNET"/> | ||
| 7 | +</manifest> |
| 1 | +<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 2 | + package="creativemaybeno.wakelock_example"> | ||
| 3 | + <!-- io.flutter.app.FlutterApplication is an android.app.Application that | ||
| 4 | + calls FlutterMain.startInitialization(this); in its onCreate method. | ||
| 5 | + In most cases you can leave this as-is, but you if you want to provide | ||
| 6 | + additional functionality it is fine to subclass or reimplement | ||
| 7 | + FlutterApplication and put your custom class here. --> | ||
| 8 | + <application | ||
| 9 | + android:name="io.flutter.app.FlutterApplication" | ||
| 10 | + android:label="wakelock_example" | ||
| 11 | + android:icon="@mipmap/ic_launcher"> | ||
| 12 | + <activity | ||
| 13 | + android:name=".MainActivity" | ||
| 14 | + android:launchMode="singleTop" | ||
| 15 | + android:theme="@style/LaunchTheme" | ||
| 16 | + android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" | ||
| 17 | + android:hardwareAccelerated="true" | ||
| 18 | + android:windowSoftInputMode="adjustResize"> | ||
| 19 | + <!-- Specifies an Android theme to apply to this Activity as soon as | ||
| 20 | + the Android process has started. This theme is visible to the user | ||
| 21 | + while the Flutter UI initializes. After that, this theme continues | ||
| 22 | + to determine the Window background behind the Flutter UI. --> | ||
| 23 | + <meta-data | ||
| 24 | + android:name="io.flutter.embedding.android.NormalTheme" | ||
| 25 | + android:resource="@style/NormalTheme" | ||
| 26 | + /> | ||
| 27 | + <!-- Displays an Android View that continues showing the launch screen | ||
| 28 | + Drawable until Flutter paints its first frame, then this splash | ||
| 29 | + screen fades out. A splash screen is useful to avoid any visual | ||
| 30 | + gap between the end of Android's launch screen and the painting of | ||
| 31 | + Flutter's first frame. --> | ||
| 32 | + <meta-data | ||
| 33 | + android:name="io.flutter.embedding.android.SplashScreenDrawable" | ||
| 34 | + android:resource="@drawable/launch_background" | ||
| 35 | + /> | ||
| 36 | + <intent-filter> | ||
| 37 | + <action android:name="android.intent.action.MAIN"/> | ||
| 38 | + <category android:name="android.intent.category.LAUNCHER"/> | ||
| 39 | + </intent-filter> | ||
| 40 | + </activity> | ||
| 41 | + <!-- Don't delete the meta-data below. | ||
| 42 | + This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --> | ||
| 43 | + <meta-data | ||
| 44 | + android:name="flutterEmbedding" | ||
| 45 | + android:value="2" /> | ||
| 46 | + </application> | ||
| 47 | +</manifest> |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<!-- Modify this file to customize your launch splash screen --> | ||
| 3 | +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 4 | + <item android:drawable="@android:color/white" /> | ||
| 5 | + | ||
| 6 | + <!-- You can insert your own image assets here --> | ||
| 7 | + <!-- <item> | ||
| 8 | + <bitmap | ||
| 9 | + android:gravity="center" | ||
| 10 | + android:src="@mipmap/launch_image" /> | ||
| 11 | + </item> --> | ||
| 12 | +</layer-list> |
544 Bytes
442 Bytes
721 Bytes
1.01 KB
1.41 KB
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<resources> | ||
| 3 | + <!-- Theme applied to the Android Window while the process is starting --> | ||
| 4 | + <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar"> | ||
| 5 | + <!-- Show a splash screen on the activity. Automatically removed when | ||
| 6 | + Flutter draws its first frame --> | ||
| 7 | + <item name="android:windowBackground">@drawable/launch_background</item> | ||
| 8 | + </style> | ||
| 9 | + <!-- Theme applied to the Android Window as soon as the process has started. | ||
| 10 | + This theme determines the color of the Android Window while your | ||
| 11 | + Flutter UI initializes, as well as behind your Flutter UI while its | ||
| 12 | + running. | ||
| 13 | + | ||
| 14 | + This Theme is only used starting with V2 of Flutter's Android embedding. --> | ||
| 15 | + <style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar"> | ||
| 16 | + <item name="android:windowBackground">@android:color/white</item> | ||
| 17 | + </style> | ||
| 18 | +</resources> |
| 1 | +<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 2 | + package="creativemaybeno.wakelock_example"> | ||
| 3 | + <!-- Flutter needs it to communicate with the running application | ||
| 4 | + to allow setting breakpoints, to provide hot reload, etc. | ||
| 5 | + --> | ||
| 6 | + <uses-permission android:name="android.permission.INTERNET"/> | ||
| 7 | +</manifest> |
wakelock/example/android/build.gradle
0 → 100644
| 1 | +buildscript { | ||
| 2 | + ext.kotlin_version = '1.3.50' | ||
| 3 | + repositories { | ||
| 4 | + google() | ||
| 5 | + jcenter() | ||
| 6 | + } | ||
| 7 | + | ||
| 8 | + dependencies { | ||
| 9 | + classpath 'com.android.tools.build:gradle:3.5.0' | ||
| 10 | + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | ||
| 11 | + } | ||
| 12 | +} | ||
| 13 | + | ||
| 14 | +allprojects { | ||
| 15 | + repositories { | ||
| 16 | + google() | ||
| 17 | + jcenter() | ||
| 18 | + } | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +rootProject.buildDir = '../build' | ||
| 22 | +subprojects { | ||
| 23 | + project.buildDir = "${rootProject.buildDir}/${project.name}" | ||
| 24 | +} | ||
| 25 | +subprojects { | ||
| 26 | + project.evaluationDependsOn(':app') | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +task clean(type: Delete) { | ||
| 30 | + delete rootProject.buildDir | ||
| 31 | +} |
wakelock/example/android/settings.gradle
0 → 100644
| 1 | +include ':app' | ||
| 2 | + | ||
| 3 | +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") | ||
| 4 | +def properties = new Properties() | ||
| 5 | + | ||
| 6 | +assert localPropertiesFile.exists() | ||
| 7 | +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } | ||
| 8 | + | ||
| 9 | +def flutterSdkPath = properties.getProperty("flutter.sdk") | ||
| 10 | +assert flutterSdkPath != null, "flutter.sdk not set in local.properties" | ||
| 11 | +apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" |
| 1 | +import 'package:flutter_test/flutter_test.dart'; | ||
| 2 | +import 'package:integration_test/integration_test.dart'; | ||
| 3 | +import 'package:wakelock/wakelock.dart'; | ||
| 4 | + | ||
| 5 | +void main() { | ||
| 6 | + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); | ||
| 7 | + | ||
| 8 | + testWidgets('enabling and disabling wakelock', (WidgetTester tester) async { | ||
| 9 | + final wakelockEnabled = await Wakelock.enabled; | ||
| 10 | + | ||
| 11 | + // The wakelock should initially be disabled. | ||
| 12 | + expect(wakelockEnabled, isFalse); | ||
| 13 | + | ||
| 14 | + await Wakelock.enable(); | ||
| 15 | + expect(await Wakelock.enabled, isTrue); | ||
| 16 | + await Wakelock.disable(); | ||
| 17 | + expect(await Wakelock.enabled, isFalse); | ||
| 18 | + }); | ||
| 19 | + | ||
| 20 | + testWidgets('toggling wakelock', (WidgetTester tester) async { | ||
| 21 | + await Wakelock.toggle(enable: true); | ||
| 22 | + expect(await Wakelock.enabled, isTrue); | ||
| 23 | + await Wakelock.toggle(enable: false); | ||
| 24 | + expect(await Wakelock.enabled, isFalse); | ||
| 25 | + }); | ||
| 26 | +} |
wakelock/example/ios/.gitignore
0 → 100644
| 1 | +*.mode1v3 | ||
| 2 | +*.mode2v3 | ||
| 3 | +*.moved-aside | ||
| 4 | +*.pbxuser | ||
| 5 | +*.perspectivev3 | ||
| 6 | +**/*sync/ | ||
| 7 | +.sconsign.dblite | ||
| 8 | +.tags* | ||
| 9 | +**/.vagrant/ | ||
| 10 | +**/DerivedData/ | ||
| 11 | +Icon? | ||
| 12 | +**/Pods/ | ||
| 13 | +**/.symlinks/ | ||
| 14 | +profile | ||
| 15 | +xcuserdata | ||
| 16 | +**/.generated/ | ||
| 17 | +Flutter/App.framework | ||
| 18 | +Flutter/Flutter.framework | ||
| 19 | +Flutter/Flutter.podspec | ||
| 20 | +Flutter/Generated.xcconfig | ||
| 21 | +Flutter/app.flx | ||
| 22 | +Flutter/app.zip | ||
| 23 | +Flutter/flutter_assets/ | ||
| 24 | +Flutter/flutter_export_environment.sh | ||
| 25 | +ServiceDefinitions.json | ||
| 26 | +Runner/GeneratedPluginRegistrant.* | ||
| 27 | + | ||
| 28 | +# Exceptions to above rules. | ||
| 29 | +!default.mode1v3 | ||
| 30 | +!default.mode2v3 | ||
| 31 | +!default.pbxuser | ||
| 32 | +!default.perspectivev3 |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| 3 | +<plist version="1.0"> | ||
| 4 | +<dict> | ||
| 5 | + <key>CFBundleDevelopmentRegion</key> | ||
| 6 | + <string>$(DEVELOPMENT_LANGUAGE)</string> | ||
| 7 | + <key>CFBundleExecutable</key> | ||
| 8 | + <string>App</string> | ||
| 9 | + <key>CFBundleIdentifier</key> | ||
| 10 | + <string>io.flutter.flutter.app</string> | ||
| 11 | + <key>CFBundleInfoDictionaryVersion</key> | ||
| 12 | + <string>6.0</string> | ||
| 13 | + <key>CFBundleName</key> | ||
| 14 | + <string>App</string> | ||
| 15 | + <key>CFBundlePackageType</key> | ||
| 16 | + <string>FMWK</string> | ||
| 17 | + <key>CFBundleShortVersionString</key> | ||
| 18 | + <string>1.0</string> | ||
| 19 | + <key>CFBundleSignature</key> | ||
| 20 | + <string>????</string> | ||
| 21 | + <key>CFBundleVersion</key> | ||
| 22 | + <string>1.0</string> | ||
| 23 | + <key>MinimumOSVersion</key> | ||
| 24 | + <string>9.0</string> | ||
| 25 | +</dict> | ||
| 26 | +</plist> |
wakelock/example/ios/Flutter/Debug.xcconfig
0 → 100644
wakelock/example/ios/Podfile
0 → 100644
| 1 | +# Uncomment this line to define a global platform for your project | ||
| 2 | +# platform :ios, '9.0' | ||
| 3 | + | ||
| 4 | +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. | ||
| 5 | +ENV['COCOAPODS_DISABLE_STATS'] = 'true' | ||
| 6 | + | ||
| 7 | +project 'Runner', { | ||
| 8 | + 'Debug' => :debug, | ||
| 9 | + 'Profile' => :release, | ||
| 10 | + 'Release' => :release, | ||
| 11 | +} | ||
| 12 | + | ||
| 13 | +def flutter_root | ||
| 14 | + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) | ||
| 15 | + unless File.exist?(generated_xcode_build_settings_path) | ||
| 16 | + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" | ||
| 17 | + end | ||
| 18 | + | ||
| 19 | + File.foreach(generated_xcode_build_settings_path) do |line| | ||
| 20 | + matches = line.match(/FLUTTER_ROOT\=(.*)/) | ||
| 21 | + return matches[1].strip if matches | ||
| 22 | + end | ||
| 23 | + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" | ||
| 24 | +end | ||
| 25 | + | ||
| 26 | +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) | ||
| 27 | + | ||
| 28 | +flutter_ios_podfile_setup | ||
| 29 | + | ||
| 30 | +target 'Runner' do | ||
| 31 | + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) | ||
| 32 | +end | ||
| 33 | + | ||
| 34 | +post_install do |installer| | ||
| 35 | + installer.pods_project.targets.each do |target| | ||
| 36 | + flutter_additional_ios_build_settings(target) | ||
| 37 | + end | ||
| 38 | +end |
wakelock/example/ios/Podfile.lock
0 → 100644
| 1 | +PODS: | ||
| 2 | + - Flutter (1.0.0) | ||
| 3 | + - integration_test (0.0.1): | ||
| 4 | + - Flutter | ||
| 5 | + - wakelock (0.0.1): | ||
| 6 | + - Flutter | ||
| 7 | + | ||
| 8 | +DEPENDENCIES: | ||
| 9 | + - Flutter (from `Flutter`) | ||
| 10 | + - integration_test (from `.symlinks/plugins/integration_test/ios`) | ||
| 11 | + - wakelock (from `.symlinks/plugins/wakelock/ios`) | ||
| 12 | + | ||
| 13 | +EXTERNAL SOURCES: | ||
| 14 | + Flutter: | ||
| 15 | + :path: Flutter | ||
| 16 | + integration_test: | ||
| 17 | + :path: ".symlinks/plugins/integration_test/ios" | ||
| 18 | + wakelock: | ||
| 19 | + :path: ".symlinks/plugins/wakelock/ios" | ||
| 20 | + | ||
| 21 | +SPEC CHECKSUMS: | ||
| 22 | + Flutter: 0e3d915762c693b495b44d77113d4970485de6ec | ||
| 23 | + integration_test: 5ed24a436eb7ec17b6a13046e9bf7ca4a404e59e | ||
| 24 | + wakelock: bfc7955c418d0db797614075aabbc58a39ab5107 | ||
| 25 | + | ||
| 26 | +PODFILE CHECKSUM: 8e679eca47255a8ca8067c4c67aab20e64cb974d | ||
| 27 | + | ||
| 28 | +COCOAPODS: 1.9.3 |
| 1 | +// !$*UTF8*$! | ||
| 2 | +{ | ||
| 3 | + archiveVersion = 1; | ||
| 4 | + classes = { | ||
| 5 | + }; | ||
| 6 | + objectVersion = 46; | ||
| 7 | + objects = { | ||
| 8 | + | ||
| 9 | +/* Begin PBXBuildFile section */ | ||
| 10 | + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; | ||
| 11 | + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; | ||
| 12 | + 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; | ||
| 13 | + 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; | ||
| 14 | + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; | ||
| 15 | + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; | ||
| 16 | + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; | ||
| 17 | + A6847046D3B647529A66EE97 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 320D1841761F9CD1E849A1F0 /* libPods-Runner.a */; }; | ||
| 18 | +/* End PBXBuildFile section */ | ||
| 19 | + | ||
| 20 | +/* Begin PBXCopyFilesBuildPhase section */ | ||
| 21 | + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { | ||
| 22 | + isa = PBXCopyFilesBuildPhase; | ||
| 23 | + buildActionMask = 2147483647; | ||
| 24 | + dstPath = ""; | ||
| 25 | + dstSubfolderSpec = 10; | ||
| 26 | + files = ( | ||
| 27 | + ); | ||
| 28 | + name = "Embed Frameworks"; | ||
| 29 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 30 | + }; | ||
| 31 | +/* End PBXCopyFilesBuildPhase section */ | ||
| 32 | + | ||
| 33 | +/* Begin PBXFileReference section */ | ||
| 34 | + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; }; | ||
| 35 | + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; }; | ||
| 36 | + 2111AD0340E57F623E74EE98 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; }; | ||
| 37 | + 320D1841761F9CD1E849A1F0 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; | ||
| 38 | + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; }; | ||
| 39 | + 6937DE1C1E231CE26C21EB6B /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; }; | ||
| 40 | + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; }; | ||
| 41 | + 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; | ||
| 42 | + 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; | ||
| 43 | + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; }; | ||
| 44 | + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; }; | ||
| 45 | + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; | ||
| 46 | + 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; | ||
| 47 | + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; | ||
| 48 | + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; | ||
| 49 | + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; | ||
| 50 | + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; | ||
| 51 | + F6CC63182AFEEC23EAC5C95F /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; }; | ||
| 52 | +/* End PBXFileReference section */ | ||
| 53 | + | ||
| 54 | +/* Begin PBXFrameworksBuildPhase section */ | ||
| 55 | + 97C146EB1CF9000F007C117D /* Frameworks */ = { | ||
| 56 | + isa = PBXFrameworksBuildPhase; | ||
| 57 | + buildActionMask = 2147483647; | ||
| 58 | + files = ( | ||
| 59 | + A6847046D3B647529A66EE97 /* libPods-Runner.a in Frameworks */, | ||
| 60 | + ); | ||
| 61 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 62 | + }; | ||
| 63 | +/* End PBXFrameworksBuildPhase section */ | ||
| 64 | + | ||
| 65 | +/* Begin PBXGroup section */ | ||
| 66 | + 356EF92E5865B0B43E707F28 /* Frameworks */ = { | ||
| 67 | + isa = PBXGroup; | ||
| 68 | + children = ( | ||
| 69 | + 320D1841761F9CD1E849A1F0 /* libPods-Runner.a */, | ||
| 70 | + ); | ||
| 71 | + name = Frameworks; | ||
| 72 | + sourceTree = "<group>"; | ||
| 73 | + }; | ||
| 74 | + 7865595A245EC8291D1003FA /* Pods */ = { | ||
| 75 | + isa = PBXGroup; | ||
| 76 | + children = ( | ||
| 77 | + F6CC63182AFEEC23EAC5C95F /* Pods-Runner.debug.xcconfig */, | ||
| 78 | + 2111AD0340E57F623E74EE98 /* Pods-Runner.release.xcconfig */, | ||
| 79 | + 6937DE1C1E231CE26C21EB6B /* Pods-Runner.profile.xcconfig */, | ||
| 80 | + ); | ||
| 81 | + name = Pods; | ||
| 82 | + path = Pods; | ||
| 83 | + sourceTree = "<group>"; | ||
| 84 | + }; | ||
| 85 | + 9740EEB11CF90186004384FC /* Flutter */ = { | ||
| 86 | + isa = PBXGroup; | ||
| 87 | + children = ( | ||
| 88 | + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, | ||
| 89 | + 9740EEB21CF90195004384FC /* Debug.xcconfig */, | ||
| 90 | + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, | ||
| 91 | + 9740EEB31CF90195004384FC /* Generated.xcconfig */, | ||
| 92 | + ); | ||
| 93 | + name = Flutter; | ||
| 94 | + sourceTree = "<group>"; | ||
| 95 | + }; | ||
| 96 | + 97C146E51CF9000F007C117D = { | ||
| 97 | + isa = PBXGroup; | ||
| 98 | + children = ( | ||
| 99 | + 9740EEB11CF90186004384FC /* Flutter */, | ||
| 100 | + 97C146F01CF9000F007C117D /* Runner */, | ||
| 101 | + 97C146EF1CF9000F007C117D /* Products */, | ||
| 102 | + 7865595A245EC8291D1003FA /* Pods */, | ||
| 103 | + 356EF92E5865B0B43E707F28 /* Frameworks */, | ||
| 104 | + ); | ||
| 105 | + sourceTree = "<group>"; | ||
| 106 | + }; | ||
| 107 | + 97C146EF1CF9000F007C117D /* Products */ = { | ||
| 108 | + isa = PBXGroup; | ||
| 109 | + children = ( | ||
| 110 | + 97C146EE1CF9000F007C117D /* Runner.app */, | ||
| 111 | + ); | ||
| 112 | + name = Products; | ||
| 113 | + sourceTree = "<group>"; | ||
| 114 | + }; | ||
| 115 | + 97C146F01CF9000F007C117D /* Runner */ = { | ||
| 116 | + isa = PBXGroup; | ||
| 117 | + children = ( | ||
| 118 | + 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, | ||
| 119 | + 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, | ||
| 120 | + 97C146FA1CF9000F007C117D /* Main.storyboard */, | ||
| 121 | + 97C146FD1CF9000F007C117D /* Assets.xcassets */, | ||
| 122 | + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, | ||
| 123 | + 97C147021CF9000F007C117D /* Info.plist */, | ||
| 124 | + 97C146F11CF9000F007C117D /* Supporting Files */, | ||
| 125 | + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, | ||
| 126 | + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, | ||
| 127 | + ); | ||
| 128 | + path = Runner; | ||
| 129 | + sourceTree = "<group>"; | ||
| 130 | + }; | ||
| 131 | + 97C146F11CF9000F007C117D /* Supporting Files */ = { | ||
| 132 | + isa = PBXGroup; | ||
| 133 | + children = ( | ||
| 134 | + 97C146F21CF9000F007C117D /* main.m */, | ||
| 135 | + ); | ||
| 136 | + name = "Supporting Files"; | ||
| 137 | + sourceTree = "<group>"; | ||
| 138 | + }; | ||
| 139 | +/* End PBXGroup section */ | ||
| 140 | + | ||
| 141 | +/* Begin PBXNativeTarget section */ | ||
| 142 | + 97C146ED1CF9000F007C117D /* Runner */ = { | ||
| 143 | + isa = PBXNativeTarget; | ||
| 144 | + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; | ||
| 145 | + buildPhases = ( | ||
| 146 | + 112EA101BE908B08DE569906 /* [CP] Check Pods Manifest.lock */, | ||
| 147 | + 9740EEB61CF901F6004384FC /* Run Script */, | ||
| 148 | + 97C146EA1CF9000F007C117D /* Sources */, | ||
| 149 | + 97C146EB1CF9000F007C117D /* Frameworks */, | ||
| 150 | + 97C146EC1CF9000F007C117D /* Resources */, | ||
| 151 | + 9705A1C41CF9048500538489 /* Embed Frameworks */, | ||
| 152 | + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, | ||
| 153 | + FAD6D21B222DFE9FB43C310E /* [CP] Embed Pods Frameworks */, | ||
| 154 | + ); | ||
| 155 | + buildRules = ( | ||
| 156 | + ); | ||
| 157 | + dependencies = ( | ||
| 158 | + ); | ||
| 159 | + name = Runner; | ||
| 160 | + productName = Runner; | ||
| 161 | + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; | ||
| 162 | + productType = "com.apple.product-type.application"; | ||
| 163 | + }; | ||
| 164 | +/* End PBXNativeTarget section */ | ||
| 165 | + | ||
| 166 | +/* Begin PBXProject section */ | ||
| 167 | + 97C146E61CF9000F007C117D /* Project object */ = { | ||
| 168 | + isa = PBXProject; | ||
| 169 | + attributes = { | ||
| 170 | + LastUpgradeCheck = 1020; | ||
| 171 | + ORGANIZATIONNAME = ""; | ||
| 172 | + TargetAttributes = { | ||
| 173 | + 97C146ED1CF9000F007C117D = { | ||
| 174 | + CreatedOnToolsVersion = 7.3.1; | ||
| 175 | + }; | ||
| 176 | + }; | ||
| 177 | + }; | ||
| 178 | + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; | ||
| 179 | + compatibilityVersion = "Xcode 9.3"; | ||
| 180 | + developmentRegion = en; | ||
| 181 | + hasScannedForEncodings = 0; | ||
| 182 | + knownRegions = ( | ||
| 183 | + en, | ||
| 184 | + Base, | ||
| 185 | + ); | ||
| 186 | + mainGroup = 97C146E51CF9000F007C117D; | ||
| 187 | + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; | ||
| 188 | + projectDirPath = ""; | ||
| 189 | + projectRoot = ""; | ||
| 190 | + targets = ( | ||
| 191 | + 97C146ED1CF9000F007C117D /* Runner */, | ||
| 192 | + ); | ||
| 193 | + }; | ||
| 194 | +/* End PBXProject section */ | ||
| 195 | + | ||
| 196 | +/* Begin PBXResourcesBuildPhase section */ | ||
| 197 | + 97C146EC1CF9000F007C117D /* Resources */ = { | ||
| 198 | + isa = PBXResourcesBuildPhase; | ||
| 199 | + buildActionMask = 2147483647; | ||
| 200 | + files = ( | ||
| 201 | + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, | ||
| 202 | + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, | ||
| 203 | + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, | ||
| 204 | + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, | ||
| 205 | + ); | ||
| 206 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 207 | + }; | ||
| 208 | +/* End PBXResourcesBuildPhase section */ | ||
| 209 | + | ||
| 210 | +/* Begin PBXShellScriptBuildPhase section */ | ||
| 211 | + 112EA101BE908B08DE569906 /* [CP] Check Pods Manifest.lock */ = { | ||
| 212 | + isa = PBXShellScriptBuildPhase; | ||
| 213 | + buildActionMask = 2147483647; | ||
| 214 | + files = ( | ||
| 215 | + ); | ||
| 216 | + inputFileListPaths = ( | ||
| 217 | + ); | ||
| 218 | + inputPaths = ( | ||
| 219 | + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", | ||
| 220 | + "${PODS_ROOT}/Manifest.lock", | ||
| 221 | + ); | ||
| 222 | + name = "[CP] Check Pods Manifest.lock"; | ||
| 223 | + outputFileListPaths = ( | ||
| 224 | + ); | ||
| 225 | + outputPaths = ( | ||
| 226 | + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", | ||
| 227 | + ); | ||
| 228 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 229 | + shellPath = /bin/sh; | ||
| 230 | + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; | ||
| 231 | + showEnvVarsInLog = 0; | ||
| 232 | + }; | ||
| 233 | + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { | ||
| 234 | + isa = PBXShellScriptBuildPhase; | ||
| 235 | + buildActionMask = 2147483647; | ||
| 236 | + files = ( | ||
| 237 | + ); | ||
| 238 | + inputPaths = ( | ||
| 239 | + ); | ||
| 240 | + name = "Thin Binary"; | ||
| 241 | + outputPaths = ( | ||
| 242 | + ); | ||
| 243 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 244 | + shellPath = /bin/sh; | ||
| 245 | + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; | ||
| 246 | + }; | ||
| 247 | + 9740EEB61CF901F6004384FC /* Run Script */ = { | ||
| 248 | + isa = PBXShellScriptBuildPhase; | ||
| 249 | + buildActionMask = 2147483647; | ||
| 250 | + files = ( | ||
| 251 | + ); | ||
| 252 | + inputPaths = ( | ||
| 253 | + ); | ||
| 254 | + name = "Run Script"; | ||
| 255 | + outputPaths = ( | ||
| 256 | + ); | ||
| 257 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 258 | + shellPath = /bin/sh; | ||
| 259 | + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; | ||
| 260 | + }; | ||
| 261 | + FAD6D21B222DFE9FB43C310E /* [CP] Embed Pods Frameworks */ = { | ||
| 262 | + isa = PBXShellScriptBuildPhase; | ||
| 263 | + buildActionMask = 2147483647; | ||
| 264 | + files = ( | ||
| 265 | + ); | ||
| 266 | + inputPaths = ( | ||
| 267 | + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", | ||
| 268 | + "${PODS_ROOT}/../Flutter/Flutter.framework", | ||
| 269 | + ); | ||
| 270 | + name = "[CP] Embed Pods Frameworks"; | ||
| 271 | + outputPaths = ( | ||
| 272 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", | ||
| 273 | + ); | ||
| 274 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 275 | + shellPath = /bin/sh; | ||
| 276 | + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; | ||
| 277 | + showEnvVarsInLog = 0; | ||
| 278 | + }; | ||
| 279 | +/* End PBXShellScriptBuildPhase section */ | ||
| 280 | + | ||
| 281 | +/* Begin PBXSourcesBuildPhase section */ | ||
| 282 | + 97C146EA1CF9000F007C117D /* Sources */ = { | ||
| 283 | + isa = PBXSourcesBuildPhase; | ||
| 284 | + buildActionMask = 2147483647; | ||
| 285 | + files = ( | ||
| 286 | + 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, | ||
| 287 | + 97C146F31CF9000F007C117D /* main.m in Sources */, | ||
| 288 | + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, | ||
| 289 | + ); | ||
| 290 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 291 | + }; | ||
| 292 | +/* End PBXSourcesBuildPhase section */ | ||
| 293 | + | ||
| 294 | +/* Begin PBXVariantGroup section */ | ||
| 295 | + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { | ||
| 296 | + isa = PBXVariantGroup; | ||
| 297 | + children = ( | ||
| 298 | + 97C146FB1CF9000F007C117D /* Base */, | ||
| 299 | + ); | ||
| 300 | + name = Main.storyboard; | ||
| 301 | + sourceTree = "<group>"; | ||
| 302 | + }; | ||
| 303 | + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { | ||
| 304 | + isa = PBXVariantGroup; | ||
| 305 | + children = ( | ||
| 306 | + 97C147001CF9000F007C117D /* Base */, | ||
| 307 | + ); | ||
| 308 | + name = LaunchScreen.storyboard; | ||
| 309 | + sourceTree = "<group>"; | ||
| 310 | + }; | ||
| 311 | +/* End PBXVariantGroup section */ | ||
| 312 | + | ||
| 313 | +/* Begin XCBuildConfiguration section */ | ||
| 314 | + 249021D3217E4FDB00AE95B9 /* Profile */ = { | ||
| 315 | + isa = XCBuildConfiguration; | ||
| 316 | + buildSettings = { | ||
| 317 | + ALWAYS_SEARCH_USER_PATHS = NO; | ||
| 318 | + CLANG_ANALYZER_NONNULL = YES; | ||
| 319 | + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; | ||
| 320 | + CLANG_CXX_LIBRARY = "libc++"; | ||
| 321 | + CLANG_ENABLE_MODULES = YES; | ||
| 322 | + CLANG_ENABLE_OBJC_ARC = YES; | ||
| 323 | + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; | ||
| 324 | + CLANG_WARN_BOOL_CONVERSION = YES; | ||
| 325 | + CLANG_WARN_COMMA = YES; | ||
| 326 | + CLANG_WARN_CONSTANT_CONVERSION = YES; | ||
| 327 | + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; | ||
| 328 | + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | ||
| 329 | + CLANG_WARN_EMPTY_BODY = YES; | ||
| 330 | + CLANG_WARN_ENUM_CONVERSION = YES; | ||
| 331 | + CLANG_WARN_INFINITE_RECURSION = YES; | ||
| 332 | + CLANG_WARN_INT_CONVERSION = YES; | ||
| 333 | + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; | ||
| 334 | + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; | ||
| 335 | + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; | ||
| 336 | + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | ||
| 337 | + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; | ||
| 338 | + CLANG_WARN_STRICT_PROTOTYPES = YES; | ||
| 339 | + CLANG_WARN_SUSPICIOUS_MOVE = YES; | ||
| 340 | + CLANG_WARN_UNREACHABLE_CODE = YES; | ||
| 341 | + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | ||
| 342 | + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; | ||
| 343 | + COPY_PHASE_STRIP = NO; | ||
| 344 | + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; | ||
| 345 | + ENABLE_NS_ASSERTIONS = NO; | ||
| 346 | + ENABLE_STRICT_OBJC_MSGSEND = YES; | ||
| 347 | + GCC_C_LANGUAGE_STANDARD = gnu99; | ||
| 348 | + GCC_NO_COMMON_BLOCKS = YES; | ||
| 349 | + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | ||
| 350 | + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | ||
| 351 | + GCC_WARN_UNDECLARED_SELECTOR = YES; | ||
| 352 | + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | ||
| 353 | + GCC_WARN_UNUSED_FUNCTION = YES; | ||
| 354 | + GCC_WARN_UNUSED_VARIABLE = YES; | ||
| 355 | + IPHONEOS_DEPLOYMENT_TARGET = 9.0; | ||
| 356 | + MTL_ENABLE_DEBUG_INFO = NO; | ||
| 357 | + SDKROOT = iphoneos; | ||
| 358 | + SUPPORTED_PLATFORMS = iphoneos; | ||
| 359 | + TARGETED_DEVICE_FAMILY = "1,2"; | ||
| 360 | + VALIDATE_PRODUCT = YES; | ||
| 361 | + }; | ||
| 362 | + name = Profile; | ||
| 363 | + }; | ||
| 364 | + 249021D4217E4FDB00AE95B9 /* Profile */ = { | ||
| 365 | + isa = XCBuildConfiguration; | ||
| 366 | + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; | ||
| 367 | + buildSettings = { | ||
| 368 | + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||
| 369 | + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; | ||
| 370 | + ENABLE_BITCODE = NO; | ||
| 371 | + FRAMEWORK_SEARCH_PATHS = ( | ||
| 372 | + "$(inherited)", | ||
| 373 | + "$(PROJECT_DIR)/Flutter", | ||
| 374 | + ); | ||
| 375 | + INFOPLIST_FILE = Runner/Info.plist; | ||
| 376 | + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; | ||
| 377 | + LIBRARY_SEARCH_PATHS = ( | ||
| 378 | + "$(inherited)", | ||
| 379 | + "$(PROJECT_DIR)/Flutter", | ||
| 380 | + ); | ||
| 381 | + PRODUCT_BUNDLE_IDENTIFIER = creativemaybeno.wakelockExample; | ||
| 382 | + PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| 383 | + VERSIONING_SYSTEM = "apple-generic"; | ||
| 384 | + }; | ||
| 385 | + name = Profile; | ||
| 386 | + }; | ||
| 387 | + 97C147031CF9000F007C117D /* Debug */ = { | ||
| 388 | + isa = XCBuildConfiguration; | ||
| 389 | + buildSettings = { | ||
| 390 | + ALWAYS_SEARCH_USER_PATHS = NO; | ||
| 391 | + CLANG_ANALYZER_NONNULL = YES; | ||
| 392 | + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; | ||
| 393 | + CLANG_CXX_LIBRARY = "libc++"; | ||
| 394 | + CLANG_ENABLE_MODULES = YES; | ||
| 395 | + CLANG_ENABLE_OBJC_ARC = YES; | ||
| 396 | + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; | ||
| 397 | + CLANG_WARN_BOOL_CONVERSION = YES; | ||
| 398 | + CLANG_WARN_COMMA = YES; | ||
| 399 | + CLANG_WARN_CONSTANT_CONVERSION = YES; | ||
| 400 | + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; | ||
| 401 | + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | ||
| 402 | + CLANG_WARN_EMPTY_BODY = YES; | ||
| 403 | + CLANG_WARN_ENUM_CONVERSION = YES; | ||
| 404 | + CLANG_WARN_INFINITE_RECURSION = YES; | ||
| 405 | + CLANG_WARN_INT_CONVERSION = YES; | ||
| 406 | + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; | ||
| 407 | + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; | ||
| 408 | + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; | ||
| 409 | + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | ||
| 410 | + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; | ||
| 411 | + CLANG_WARN_STRICT_PROTOTYPES = YES; | ||
| 412 | + CLANG_WARN_SUSPICIOUS_MOVE = YES; | ||
| 413 | + CLANG_WARN_UNREACHABLE_CODE = YES; | ||
| 414 | + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | ||
| 415 | + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; | ||
| 416 | + COPY_PHASE_STRIP = NO; | ||
| 417 | + DEBUG_INFORMATION_FORMAT = dwarf; | ||
| 418 | + ENABLE_STRICT_OBJC_MSGSEND = YES; | ||
| 419 | + ENABLE_TESTABILITY = YES; | ||
| 420 | + GCC_C_LANGUAGE_STANDARD = gnu99; | ||
| 421 | + GCC_DYNAMIC_NO_PIC = NO; | ||
| 422 | + GCC_NO_COMMON_BLOCKS = YES; | ||
| 423 | + GCC_OPTIMIZATION_LEVEL = 0; | ||
| 424 | + GCC_PREPROCESSOR_DEFINITIONS = ( | ||
| 425 | + "DEBUG=1", | ||
| 426 | + "$(inherited)", | ||
| 427 | + ); | ||
| 428 | + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | ||
| 429 | + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | ||
| 430 | + GCC_WARN_UNDECLARED_SELECTOR = YES; | ||
| 431 | + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | ||
| 432 | + GCC_WARN_UNUSED_FUNCTION = YES; | ||
| 433 | + GCC_WARN_UNUSED_VARIABLE = YES; | ||
| 434 | + IPHONEOS_DEPLOYMENT_TARGET = 9.0; | ||
| 435 | + MTL_ENABLE_DEBUG_INFO = YES; | ||
| 436 | + ONLY_ACTIVE_ARCH = YES; | ||
| 437 | + SDKROOT = iphoneos; | ||
| 438 | + TARGETED_DEVICE_FAMILY = "1,2"; | ||
| 439 | + }; | ||
| 440 | + name = Debug; | ||
| 441 | + }; | ||
| 442 | + 97C147041CF9000F007C117D /* Release */ = { | ||
| 443 | + isa = XCBuildConfiguration; | ||
| 444 | + buildSettings = { | ||
| 445 | + ALWAYS_SEARCH_USER_PATHS = NO; | ||
| 446 | + CLANG_ANALYZER_NONNULL = YES; | ||
| 447 | + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; | ||
| 448 | + CLANG_CXX_LIBRARY = "libc++"; | ||
| 449 | + CLANG_ENABLE_MODULES = YES; | ||
| 450 | + CLANG_ENABLE_OBJC_ARC = YES; | ||
| 451 | + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; | ||
| 452 | + CLANG_WARN_BOOL_CONVERSION = YES; | ||
| 453 | + CLANG_WARN_COMMA = YES; | ||
| 454 | + CLANG_WARN_CONSTANT_CONVERSION = YES; | ||
| 455 | + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; | ||
| 456 | + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | ||
| 457 | + CLANG_WARN_EMPTY_BODY = YES; | ||
| 458 | + CLANG_WARN_ENUM_CONVERSION = YES; | ||
| 459 | + CLANG_WARN_INFINITE_RECURSION = YES; | ||
| 460 | + CLANG_WARN_INT_CONVERSION = YES; | ||
| 461 | + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; | ||
| 462 | + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; | ||
| 463 | + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; | ||
| 464 | + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | ||
| 465 | + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; | ||
| 466 | + CLANG_WARN_STRICT_PROTOTYPES = YES; | ||
| 467 | + CLANG_WARN_SUSPICIOUS_MOVE = YES; | ||
| 468 | + CLANG_WARN_UNREACHABLE_CODE = YES; | ||
| 469 | + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | ||
| 470 | + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; | ||
| 471 | + COPY_PHASE_STRIP = NO; | ||
| 472 | + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; | ||
| 473 | + ENABLE_NS_ASSERTIONS = NO; | ||
| 474 | + ENABLE_STRICT_OBJC_MSGSEND = YES; | ||
| 475 | + GCC_C_LANGUAGE_STANDARD = gnu99; | ||
| 476 | + GCC_NO_COMMON_BLOCKS = YES; | ||
| 477 | + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | ||
| 478 | + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | ||
| 479 | + GCC_WARN_UNDECLARED_SELECTOR = YES; | ||
| 480 | + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | ||
| 481 | + GCC_WARN_UNUSED_FUNCTION = YES; | ||
| 482 | + GCC_WARN_UNUSED_VARIABLE = YES; | ||
| 483 | + IPHONEOS_DEPLOYMENT_TARGET = 9.0; | ||
| 484 | + MTL_ENABLE_DEBUG_INFO = NO; | ||
| 485 | + SDKROOT = iphoneos; | ||
| 486 | + SUPPORTED_PLATFORMS = iphoneos; | ||
| 487 | + TARGETED_DEVICE_FAMILY = "1,2"; | ||
| 488 | + VALIDATE_PRODUCT = YES; | ||
| 489 | + }; | ||
| 490 | + name = Release; | ||
| 491 | + }; | ||
| 492 | + 97C147061CF9000F007C117D /* Debug */ = { | ||
| 493 | + isa = XCBuildConfiguration; | ||
| 494 | + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; | ||
| 495 | + buildSettings = { | ||
| 496 | + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||
| 497 | + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; | ||
| 498 | + ENABLE_BITCODE = NO; | ||
| 499 | + FRAMEWORK_SEARCH_PATHS = ( | ||
| 500 | + "$(inherited)", | ||
| 501 | + "$(PROJECT_DIR)/Flutter", | ||
| 502 | + ); | ||
| 503 | + INFOPLIST_FILE = Runner/Info.plist; | ||
| 504 | + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; | ||
| 505 | + LIBRARY_SEARCH_PATHS = ( | ||
| 506 | + "$(inherited)", | ||
| 507 | + "$(PROJECT_DIR)/Flutter", | ||
| 508 | + ); | ||
| 509 | + PRODUCT_BUNDLE_IDENTIFIER = creativemaybeno.wakelockExample; | ||
| 510 | + PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| 511 | + VERSIONING_SYSTEM = "apple-generic"; | ||
| 512 | + }; | ||
| 513 | + name = Debug; | ||
| 514 | + }; | ||
| 515 | + 97C147071CF9000F007C117D /* Release */ = { | ||
| 516 | + isa = XCBuildConfiguration; | ||
| 517 | + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; | ||
| 518 | + buildSettings = { | ||
| 519 | + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||
| 520 | + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; | ||
| 521 | + ENABLE_BITCODE = NO; | ||
| 522 | + FRAMEWORK_SEARCH_PATHS = ( | ||
| 523 | + "$(inherited)", | ||
| 524 | + "$(PROJECT_DIR)/Flutter", | ||
| 525 | + ); | ||
| 526 | + INFOPLIST_FILE = Runner/Info.plist; | ||
| 527 | + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; | ||
| 528 | + LIBRARY_SEARCH_PATHS = ( | ||
| 529 | + "$(inherited)", | ||
| 530 | + "$(PROJECT_DIR)/Flutter", | ||
| 531 | + ); | ||
| 532 | + PRODUCT_BUNDLE_IDENTIFIER = creativemaybeno.wakelockExample; | ||
| 533 | + PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| 534 | + VERSIONING_SYSTEM = "apple-generic"; | ||
| 535 | + }; | ||
| 536 | + name = Release; | ||
| 537 | + }; | ||
| 538 | +/* End XCBuildConfiguration section */ | ||
| 539 | + | ||
| 540 | +/* Begin XCConfigurationList section */ | ||
| 541 | + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { | ||
| 542 | + isa = XCConfigurationList; | ||
| 543 | + buildConfigurations = ( | ||
| 544 | + 97C147031CF9000F007C117D /* Debug */, | ||
| 545 | + 97C147041CF9000F007C117D /* Release */, | ||
| 546 | + 249021D3217E4FDB00AE95B9 /* Profile */, | ||
| 547 | + ); | ||
| 548 | + defaultConfigurationIsVisible = 0; | ||
| 549 | + defaultConfigurationName = Release; | ||
| 550 | + }; | ||
| 551 | + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { | ||
| 552 | + isa = XCConfigurationList; | ||
| 553 | + buildConfigurations = ( | ||
| 554 | + 97C147061CF9000F007C117D /* Debug */, | ||
| 555 | + 97C147071CF9000F007C117D /* Release */, | ||
| 556 | + 249021D4217E4FDB00AE95B9 /* Profile */, | ||
| 557 | + ); | ||
| 558 | + defaultConfigurationIsVisible = 0; | ||
| 559 | + defaultConfigurationName = Release; | ||
| 560 | + }; | ||
| 561 | +/* End XCConfigurationList section */ | ||
| 562 | + }; | ||
| 563 | + rootObject = 97C146E61CF9000F007C117D /* Project object */; | ||
| 564 | +} |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<Scheme | ||
| 3 | + LastUpgradeVersion = "1020" | ||
| 4 | + version = "1.3"> | ||
| 5 | + <BuildAction | ||
| 6 | + parallelizeBuildables = "YES" | ||
| 7 | + buildImplicitDependencies = "YES"> | ||
| 8 | + <BuildActionEntries> | ||
| 9 | + <BuildActionEntry | ||
| 10 | + buildForTesting = "YES" | ||
| 11 | + buildForRunning = "YES" | ||
| 12 | + buildForProfiling = "YES" | ||
| 13 | + buildForArchiving = "YES" | ||
| 14 | + buildForAnalyzing = "YES"> | ||
| 15 | + <BuildableReference | ||
| 16 | + BuildableIdentifier = "primary" | ||
| 17 | + BlueprintIdentifier = "97C146ED1CF9000F007C117D" | ||
| 18 | + BuildableName = "Runner.app" | ||
| 19 | + BlueprintName = "Runner" | ||
| 20 | + ReferencedContainer = "container:Runner.xcodeproj"> | ||
| 21 | + </BuildableReference> | ||
| 22 | + </BuildActionEntry> | ||
| 23 | + </BuildActionEntries> | ||
| 24 | + </BuildAction> | ||
| 25 | + <TestAction | ||
| 26 | + buildConfiguration = "Debug" | ||
| 27 | + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
| 28 | + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
| 29 | + shouldUseLaunchSchemeArgsEnv = "YES"> | ||
| 30 | + <Testables> | ||
| 31 | + </Testables> | ||
| 32 | + <MacroExpansion> | ||
| 33 | + <BuildableReference | ||
| 34 | + BuildableIdentifier = "primary" | ||
| 35 | + BlueprintIdentifier = "97C146ED1CF9000F007C117D" | ||
| 36 | + BuildableName = "Runner.app" | ||
| 37 | + BlueprintName = "Runner" | ||
| 38 | + ReferencedContainer = "container:Runner.xcodeproj"> | ||
| 39 | + </BuildableReference> | ||
| 40 | + </MacroExpansion> | ||
| 41 | + <AdditionalOptions> | ||
| 42 | + </AdditionalOptions> | ||
| 43 | + </TestAction> | ||
| 44 | + <LaunchAction | ||
| 45 | + buildConfiguration = "Debug" | ||
| 46 | + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
| 47 | + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
| 48 | + launchStyle = "0" | ||
| 49 | + useCustomWorkingDirectory = "NO" | ||
| 50 | + ignoresPersistentStateOnLaunch = "NO" | ||
| 51 | + debugDocumentVersioning = "YES" | ||
| 52 | + debugServiceExtension = "internal" | ||
| 53 | + allowLocationSimulation = "YES"> | ||
| 54 | + <BuildableProductRunnable | ||
| 55 | + runnableDebuggingMode = "0"> | ||
| 56 | + <BuildableReference | ||
| 57 | + BuildableIdentifier = "primary" | ||
| 58 | + BlueprintIdentifier = "97C146ED1CF9000F007C117D" | ||
| 59 | + BuildableName = "Runner.app" | ||
| 60 | + BlueprintName = "Runner" | ||
| 61 | + ReferencedContainer = "container:Runner.xcodeproj"> | ||
| 62 | + </BuildableReference> | ||
| 63 | + </BuildableProductRunnable> | ||
| 64 | + <AdditionalOptions> | ||
| 65 | + </AdditionalOptions> | ||
| 66 | + </LaunchAction> | ||
| 67 | + <ProfileAction | ||
| 68 | + buildConfiguration = "Profile" | ||
| 69 | + shouldUseLaunchSchemeArgsEnv = "YES" | ||
| 70 | + savedToolIdentifier = "" | ||
| 71 | + useCustomWorkingDirectory = "NO" | ||
| 72 | + debugDocumentVersioning = "YES"> | ||
| 73 | + <BuildableProductRunnable | ||
| 74 | + runnableDebuggingMode = "0"> | ||
| 75 | + <BuildableReference | ||
| 76 | + BuildableIdentifier = "primary" | ||
| 77 | + BlueprintIdentifier = "97C146ED1CF9000F007C117D" | ||
| 78 | + BuildableName = "Runner.app" | ||
| 79 | + BlueprintName = "Runner" | ||
| 80 | + ReferencedContainer = "container:Runner.xcodeproj"> | ||
| 81 | + </BuildableReference> | ||
| 82 | + </BuildableProductRunnable> | ||
| 83 | + </ProfileAction> | ||
| 84 | + <AnalyzeAction | ||
| 85 | + buildConfiguration = "Debug"> | ||
| 86 | + </AnalyzeAction> | ||
| 87 | + <ArchiveAction | ||
| 88 | + buildConfiguration = "Release" | ||
| 89 | + revealArchiveInOrganizer = "YES"> | ||
| 90 | + </ArchiveAction> | ||
| 91 | +</Scheme> |
wakelock/example/ios/Runner/AppDelegate.h
0 → 100644
wakelock/example/ios/Runner/AppDelegate.m
0 → 100644
| 1 | +#import "AppDelegate.h" | ||
| 2 | +#import "GeneratedPluginRegistrant.h" | ||
| 3 | + | ||
| 4 | +@implementation AppDelegate | ||
| 5 | + | ||
| 6 | +- (BOOL)application:(UIApplication *)application | ||
| 7 | + didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | ||
| 8 | + [GeneratedPluginRegistrant registerWithRegistry:self]; | ||
| 9 | + // Override point for customization after application launch. | ||
| 10 | + return [super application:application didFinishLaunchingWithOptions:launchOptions]; | ||
| 11 | +} | ||
| 12 | + | ||
| 13 | +@end |
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "size" : "20x20", | ||
| 5 | + "idiom" : "iphone", | ||
| 6 | + "filename" : "Icon-App-20x20@2x.png", | ||
| 7 | + "scale" : "2x" | ||
| 8 | + }, | ||
| 9 | + { | ||
| 10 | + "size" : "20x20", | ||
| 11 | + "idiom" : "iphone", | ||
| 12 | + "filename" : "Icon-App-20x20@3x.png", | ||
| 13 | + "scale" : "3x" | ||
| 14 | + }, | ||
| 15 | + { | ||
| 16 | + "size" : "29x29", | ||
| 17 | + "idiom" : "iphone", | ||
| 18 | + "filename" : "Icon-App-29x29@1x.png", | ||
| 19 | + "scale" : "1x" | ||
| 20 | + }, | ||
| 21 | + { | ||
| 22 | + "size" : "29x29", | ||
| 23 | + "idiom" : "iphone", | ||
| 24 | + "filename" : "Icon-App-29x29@2x.png", | ||
| 25 | + "scale" : "2x" | ||
| 26 | + }, | ||
| 27 | + { | ||
| 28 | + "size" : "29x29", | ||
| 29 | + "idiom" : "iphone", | ||
| 30 | + "filename" : "Icon-App-29x29@3x.png", | ||
| 31 | + "scale" : "3x" | ||
| 32 | + }, | ||
| 33 | + { | ||
| 34 | + "size" : "40x40", | ||
| 35 | + "idiom" : "iphone", | ||
| 36 | + "filename" : "Icon-App-40x40@2x.png", | ||
| 37 | + "scale" : "2x" | ||
| 38 | + }, | ||
| 39 | + { | ||
| 40 | + "size" : "40x40", | ||
| 41 | + "idiom" : "iphone", | ||
| 42 | + "filename" : "Icon-App-40x40@3x.png", | ||
| 43 | + "scale" : "3x" | ||
| 44 | + }, | ||
| 45 | + { | ||
| 46 | + "size" : "60x60", | ||
| 47 | + "idiom" : "iphone", | ||
| 48 | + "filename" : "Icon-App-60x60@2x.png", | ||
| 49 | + "scale" : "2x" | ||
| 50 | + }, | ||
| 51 | + { | ||
| 52 | + "size" : "60x60", | ||
| 53 | + "idiom" : "iphone", | ||
| 54 | + "filename" : "Icon-App-60x60@3x.png", | ||
| 55 | + "scale" : "3x" | ||
| 56 | + }, | ||
| 57 | + { | ||
| 58 | + "size" : "20x20", | ||
| 59 | + "idiom" : "ipad", | ||
| 60 | + "filename" : "Icon-App-20x20@1x.png", | ||
| 61 | + "scale" : "1x" | ||
| 62 | + }, | ||
| 63 | + { | ||
| 64 | + "size" : "20x20", | ||
| 65 | + "idiom" : "ipad", | ||
| 66 | + "filename" : "Icon-App-20x20@2x.png", | ||
| 67 | + "scale" : "2x" | ||
| 68 | + }, | ||
| 69 | + { | ||
| 70 | + "size" : "29x29", | ||
| 71 | + "idiom" : "ipad", | ||
| 72 | + "filename" : "Icon-App-29x29@1x.png", | ||
| 73 | + "scale" : "1x" | ||
| 74 | + }, | ||
| 75 | + { | ||
| 76 | + "size" : "29x29", | ||
| 77 | + "idiom" : "ipad", | ||
| 78 | + "filename" : "Icon-App-29x29@2x.png", | ||
| 79 | + "scale" : "2x" | ||
| 80 | + }, | ||
| 81 | + { | ||
| 82 | + "size" : "40x40", | ||
| 83 | + "idiom" : "ipad", | ||
| 84 | + "filename" : "Icon-App-40x40@1x.png", | ||
| 85 | + "scale" : "1x" | ||
| 86 | + }, | ||
| 87 | + { | ||
| 88 | + "size" : "40x40", | ||
| 89 | + "idiom" : "ipad", | ||
| 90 | + "filename" : "Icon-App-40x40@2x.png", | ||
| 91 | + "scale" : "2x" | ||
| 92 | + }, | ||
| 93 | + { | ||
| 94 | + "size" : "76x76", | ||
| 95 | + "idiom" : "ipad", | ||
| 96 | + "filename" : "Icon-App-76x76@1x.png", | ||
| 97 | + "scale" : "1x" | ||
| 98 | + }, | ||
| 99 | + { | ||
| 100 | + "size" : "76x76", | ||
| 101 | + "idiom" : "ipad", | ||
| 102 | + "filename" : "Icon-App-76x76@2x.png", | ||
| 103 | + "scale" : "2x" | ||
| 104 | + }, | ||
| 105 | + { | ||
| 106 | + "size" : "83.5x83.5", | ||
| 107 | + "idiom" : "ipad", | ||
| 108 | + "filename" : "Icon-App-83.5x83.5@2x.png", | ||
| 109 | + "scale" : "2x" | ||
| 110 | + }, | ||
| 111 | + { | ||
| 112 | + "size" : "1024x1024", | ||
| 113 | + "idiom" : "ios-marketing", | ||
| 114 | + "filename" : "Icon-App-1024x1024@1x.png", | ||
| 115 | + "scale" : "1x" | ||
| 116 | + } | ||
| 117 | + ], | ||
| 118 | + "info" : { | ||
| 119 | + "version" : 1, | ||
| 120 | + "author" : "xcode" | ||
| 121 | + } | ||
| 122 | +} |
10.7 KB
564 Bytes
1.25 KB
1.55 KB
1 KB
1.68 KB
1.88 KB
1.25 KB
1.85 KB
2.6 KB
2.6 KB
3.74 KB
1.84 KB
3.22 KB
3.53 KB
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "filename" : "LaunchImage.png", | ||
| 6 | + "scale" : "1x" | ||
| 7 | + }, | ||
| 8 | + { | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "filename" : "LaunchImage@2x.png", | ||
| 11 | + "scale" : "2x" | ||
| 12 | + }, | ||
| 13 | + { | ||
| 14 | + "idiom" : "universal", | ||
| 15 | + "filename" : "LaunchImage@3x.png", | ||
| 16 | + "scale" : "3x" | ||
| 17 | + } | ||
| 18 | + ], | ||
| 19 | + "info" : { | ||
| 20 | + "version" : 1, | ||
| 21 | + "author" : "xcode" | ||
| 22 | + } | ||
| 23 | +} |
68 Bytes
68 Bytes
68 Bytes
| 1 | +# Launch Screen Assets | ||
| 2 | + | ||
| 3 | +You can customize the launch screen with your own desired assets by replacing the image files in this directory. | ||
| 4 | + | ||
| 5 | +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. |
| 1 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
| 2 | +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> | ||
| 3 | + <dependencies> | ||
| 4 | + <deployment identifier="iOS"/> | ||
| 5 | + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/> | ||
| 6 | + </dependencies> | ||
| 7 | + <scenes> | ||
| 8 | + <!--View Controller--> | ||
| 9 | + <scene sceneID="EHf-IW-A2E"> | ||
| 10 | + <objects> | ||
| 11 | + <viewController id="01J-lp-oVM" sceneMemberID="viewController"> | ||
| 12 | + <layoutGuides> | ||
| 13 | + <viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/> | ||
| 14 | + <viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/> | ||
| 15 | + </layoutGuides> | ||
| 16 | + <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> | ||
| 17 | + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | ||
| 18 | + <subviews> | ||
| 19 | + <imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4"> | ||
| 20 | + </imageView> | ||
| 21 | + </subviews> | ||
| 22 | + <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | ||
| 23 | + <constraints> | ||
| 24 | + <constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/> | ||
| 25 | + <constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/> | ||
| 26 | + </constraints> | ||
| 27 | + </view> | ||
| 28 | + </viewController> | ||
| 29 | + <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> | ||
| 30 | + </objects> | ||
| 31 | + <point key="canvasLocation" x="53" y="375"/> | ||
| 32 | + </scene> | ||
| 33 | + </scenes> | ||
| 34 | + <resources> | ||
| 35 | + <image name="LaunchImage" width="168" height="185"/> | ||
| 36 | + </resources> | ||
| 37 | +</document> |
| 1 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
| 2 | +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r"> | ||
| 3 | + <dependencies> | ||
| 4 | + <deployment identifier="iOS"/> | ||
| 5 | + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/> | ||
| 6 | + </dependencies> | ||
| 7 | + <scenes> | ||
| 8 | + <!--Flutter View Controller--> | ||
| 9 | + <scene sceneID="tne-QT-ifu"> | ||
| 10 | + <objects> | ||
| 11 | + <viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController"> | ||
| 12 | + <layoutGuides> | ||
| 13 | + <viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/> | ||
| 14 | + <viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/> | ||
| 15 | + </layoutGuides> | ||
| 16 | + <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC"> | ||
| 17 | + <rect key="frame" x="0.0" y="0.0" width="600" height="600"/> | ||
| 18 | + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | ||
| 19 | + <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> | ||
| 20 | + </view> | ||
| 21 | + </viewController> | ||
| 22 | + <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/> | ||
| 23 | + </objects> | ||
| 24 | + </scene> | ||
| 25 | + </scenes> | ||
| 26 | +</document> |
wakelock/example/ios/Runner/Info.plist
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| 3 | +<plist version="1.0"> | ||
| 4 | +<dict> | ||
| 5 | + <key>CFBundleDevelopmentRegion</key> | ||
| 6 | + <string>$(DEVELOPMENT_LANGUAGE)</string> | ||
| 7 | + <key>CFBundleExecutable</key> | ||
| 8 | + <string>$(EXECUTABLE_NAME)</string> | ||
| 9 | + <key>CFBundleIdentifier</key> | ||
| 10 | + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
| 11 | + <key>CFBundleInfoDictionaryVersion</key> | ||
| 12 | + <string>6.0</string> | ||
| 13 | + <key>CFBundleName</key> | ||
| 14 | + <string>wakelock_example</string> | ||
| 15 | + <key>CFBundlePackageType</key> | ||
| 16 | + <string>APPL</string> | ||
| 17 | + <key>CFBundleShortVersionString</key> | ||
| 18 | + <string>$(FLUTTER_BUILD_NAME)</string> | ||
| 19 | + <key>CFBundleSignature</key> | ||
| 20 | + <string>????</string> | ||
| 21 | + <key>CFBundleVersion</key> | ||
| 22 | + <string>$(FLUTTER_BUILD_NUMBER)</string> | ||
| 23 | + <key>LSRequiresIPhoneOS</key> | ||
| 24 | + <true/> | ||
| 25 | + <key>UILaunchStoryboardName</key> | ||
| 26 | + <string>LaunchScreen</string> | ||
| 27 | + <key>UIMainStoryboardFile</key> | ||
| 28 | + <string>Main</string> | ||
| 29 | + <key>UISupportedInterfaceOrientations</key> | ||
| 30 | + <array> | ||
| 31 | + <string>UIInterfaceOrientationPortrait</string> | ||
| 32 | + <string>UIInterfaceOrientationLandscapeLeft</string> | ||
| 33 | + <string>UIInterfaceOrientationLandscapeRight</string> | ||
| 34 | + </array> | ||
| 35 | + <key>UISupportedInterfaceOrientations~ipad</key> | ||
| 36 | + <array> | ||
| 37 | + <string>UIInterfaceOrientationPortrait</string> | ||
| 38 | + <string>UIInterfaceOrientationPortraitUpsideDown</string> | ||
| 39 | + <string>UIInterfaceOrientationLandscapeLeft</string> | ||
| 40 | + <string>UIInterfaceOrientationLandscapeRight</string> | ||
| 41 | + </array> | ||
| 42 | + <key>UIViewControllerBasedStatusBarAppearance</key> | ||
| 43 | + <false/> | ||
| 44 | +</dict> | ||
| 45 | +</plist> |
wakelock/example/ios/Runner/main.m
0 → 100644
| @@ -2,30 +2,37 @@ import 'package:flutter/material.dart'; | @@ -2,30 +2,37 @@ import 'package:flutter/material.dart'; | ||
| 2 | import 'package:wakelock/wakelock.dart'; | 2 | import 'package:wakelock/wakelock.dart'; |
| 3 | 3 | ||
| 4 | void main() { | 4 | void main() { |
| 5 | - runApp(ExampleApp()); | 5 | + runApp(WakelockExampleApp()); |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | -/// The wakelock implementation is located inside the [FlatButton.onPressed] functions and a [FutureBuilder]. | ||
| 9 | -/// The [FlatButton]'s and the [FutureBuilder] sit inside the [Column] that is a child of the [Scaffold] in [_ExampleAppState]. | ||
| 10 | -class ExampleApp extends StatefulWidget { | ||
| 11 | - const ExampleApp({Key key}) : super(key: key); | ||
| 12 | - | 8 | +/// Example app widget demonstrating how to use the wakelock plugin. |
| 9 | +/// | ||
| 10 | +/// The example implementation is located inside [OutlineButton.onPressed] | ||
| 11 | +/// callback functions and a [FutureBuilder]. | ||
| 12 | +class WakelockExampleApp extends StatefulWidget { | ||
| 13 | @override | 13 | @override |
| 14 | - _ExampleAppState createState() => _ExampleAppState(); | 14 | + _WakelockExampleAppState createState() => _WakelockExampleAppState(); |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | -class _ExampleAppState extends State<ExampleApp> { | 17 | +class _WakelockExampleAppState extends State<WakelockExampleApp> { |
| 18 | @override | 18 | @override |
| 19 | Widget build(BuildContext context) { | 19 | Widget build(BuildContext context) { |
| 20 | return MaterialApp( | 20 | return MaterialApp( |
| 21 | home: Scaffold( | 21 | home: Scaffold( |
| 22 | + appBar: AppBar( | ||
| 23 | + title: const Text('Wakelock example app'), | ||
| 24 | + ), | ||
| 22 | body: Center( | 25 | body: Center( |
| 23 | child: Column( | 26 | child: Column( |
| 24 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, | 27 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
| 25 | children: <Widget>[ | 28 | children: <Widget>[ |
| 26 | - FlatButton( | 29 | + const Spacer( |
| 30 | + flex: 3, | ||
| 31 | + ), | ||
| 32 | + OutlineButton( | ||
| 27 | onPressed: () { | 33 | onPressed: () { |
| 28 | - // The following code will enable the wakelock on Android or iOS using the wakelock plugin. | 34 | + // The following code will enable the wakelock on the device |
| 35 | + // using the wakelock plugin. | ||
| 29 | setState(() { | 36 | setState(() { |
| 30 | Wakelock.enable(); | 37 | Wakelock.enable(); |
| 31 | // You could also use Wakelock.toggle(on: true); | 38 | // You could also use Wakelock.toggle(on: true); |
| @@ -33,9 +40,11 @@ class _ExampleAppState extends State<ExampleApp> { | @@ -33,9 +40,11 @@ class _ExampleAppState extends State<ExampleApp> { | ||
| 33 | }, | 40 | }, |
| 34 | child: const Text('enable wakelock'), | 41 | child: const Text('enable wakelock'), |
| 35 | ), | 42 | ), |
| 36 | - FlatButton( | 43 | + const Spacer(), |
| 44 | + OutlineButton( | ||
| 37 | onPressed: () { | 45 | onPressed: () { |
| 38 | - // The following code will disable the wakelock on Android or iOS using the wakelock plugin. | 46 | + // The following code will disable the wakelock on the device |
| 47 | + // using the wakelock plugin. | ||
| 39 | setState(() { | 48 | setState(() { |
| 40 | Wakelock.disable(); | 49 | Wakelock.disable(); |
| 41 | // You could also use Wakelock.toggle(on: false); | 50 | // You could also use Wakelock.toggle(on: false); |
| @@ -43,16 +52,27 @@ class _ExampleAppState extends State<ExampleApp> { | @@ -43,16 +52,27 @@ class _ExampleAppState extends State<ExampleApp> { | ||
| 43 | }, | 52 | }, |
| 44 | child: const Text('disable wakelock'), | 53 | child: const Text('disable wakelock'), |
| 45 | ), | 54 | ), |
| 55 | + const Spacer( | ||
| 56 | + flex: 2, | ||
| 57 | + ), | ||
| 46 | FutureBuilder( | 58 | FutureBuilder( |
| 47 | - future: Wakelock.isEnabled, | 59 | + future: Wakelock.enabled, |
| 48 | builder: (context, AsyncSnapshot<bool> snapshot) { | 60 | builder: (context, AsyncSnapshot<bool> snapshot) { |
| 49 | - // The use of FutureBuilder is necessary here to await the bool value from isEnabled. | ||
| 50 | - if (!snapshot.hasData) | ||
| 51 | - return Container(); // The Future is retrieved so fast that you will not be able to see any loading indicator. | ||
| 52 | - return Text( | ||
| 53 | - 'wakelock is currently ${snapshot.data ? 'enabled' : 'disabled'}'); | 61 | + // The use of FutureBuilder is necessary here to await the |
| 62 | + // bool value from the `enabled` getter. | ||
| 63 | + if (!snapshot.hasData) { | ||
| 64 | + // The Future is retrieved so fast that you will not be able | ||
| 65 | + // to see any loading indicator. | ||
| 66 | + return Container(); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + return Text('The wakelock is currently ' | ||
| 70 | + '${snapshot.data ? 'enabled' : 'disabled'}.'); | ||
| 54 | }, | 71 | }, |
| 55 | ), | 72 | ), |
| 73 | + const Spacer( | ||
| 74 | + flex: 3, | ||
| 75 | + ), | ||
| 56 | ], | 76 | ], |
| 57 | ), | 77 | ), |
| 58 | ), | 78 | ), |
| 1 | name: wakelock_example | 1 | name: wakelock_example |
| 2 | -description: Demonstrates how to use the wakelock plugin and is used for integration testing. | 2 | +description: >-2 |
| 3 | + Example app demonstrating how to use the wakelock plugin. It also includes integration tests for | ||
| 4 | + testing the plugin in an integrated example. | ||
| 3 | publish_to: 'none' | 5 | publish_to: 'none' |
| 4 | 6 | ||
| 5 | environment: | 7 | environment: |
| @@ -9,15 +11,20 @@ dependencies: | @@ -9,15 +11,20 @@ dependencies: | ||
| 9 | flutter: | 11 | flutter: |
| 10 | sdk: flutter | 12 | sdk: flutter |
| 11 | 13 | ||
| 12 | -dev_dependencies: | ||
| 13 | - pedantic: 1.9.0 | ||
| 14 | - | ||
| 15 | wakelock: | 14 | wakelock: |
| 15 | + # When depending on this package from a real application you should use: | ||
| 16 | + # wakelock: ^x.y.z | ||
| 17 | + # See https://dart.dev/tools/pub/dependencies#version-constraints | ||
| 18 | + # The example app is bundled with the plugin so we use a path dependency on | ||
| 19 | + # the parent directory to use the current plugin's version. | ||
| 16 | path: ../ | 20 | path: ../ |
| 17 | 21 | ||
| 22 | +dev_dependencies: | ||
| 23 | + flutter_test: | ||
| 24 | + sdk: flutter | ||
| 18 | flutter_driver: | 25 | flutter_driver: |
| 19 | sdk: flutter | 26 | sdk: flutter |
| 20 | - test: # This is equivalent to any. | 27 | + integration_test: ^0.9.1 |
| 28 | + test: any | ||
| 21 | 29 | ||
| 22 | -dependency_overrides: | ||
| 23 | - pedantic: 1.9.0 | 30 | + pedantic: ^1.9.2 |
wakelock/example/web/index.html
0 → 100644
| 1 | +<!DOCTYPE html> | ||
| 2 | +<html> | ||
| 3 | +<head> | ||
| 4 | + <meta charset="UTF-8"> | ||
| 5 | + <meta content="IE=Edge" http-equiv="X-UA-Compatible"> | ||
| 6 | + <meta name="description" content="Example app demonstrating how to use the wakelock plugin."> | ||
| 7 | + | ||
| 8 | + <!-- iOS meta tags --> | ||
| 9 | + <meta name="apple-mobile-web-app-capable" content="yes"> | ||
| 10 | + <meta name="apple-mobile-web-app-status-bar-style" content="black"> | ||
| 11 | + <meta name="apple-mobile-web-app-title" content="wakelock example"> | ||
| 12 | + | ||
| 13 | + <title>wakelock example</title> | ||
| 14 | + <link rel="manifest" href="manifest.json"> | ||
| 15 | +</head> | ||
| 16 | +<body> | ||
| 17 | + <!-- This script installs service_worker.js to provide PWA functionality to | ||
| 18 | + application. For more information, see: | ||
| 19 | + https://developers.google.com/web/fundamentals/primers/service-workers --> | ||
| 20 | + <script> | ||
| 21 | + if ('serviceWorker' in navigator) { | ||
| 22 | + window.addEventListener('load', function () { | ||
| 23 | + navigator.serviceWorker.register('flutter_service_worker.js'); | ||
| 24 | + }); | ||
| 25 | + } | ||
| 26 | + </script> | ||
| 27 | + <script src="main.dart.js" type="application/javascript"></script> | ||
| 28 | +</body> | ||
| 29 | +</html> |
wakelock/example/web/manifest.json
0 → 100644
| 1 | +{ | ||
| 2 | + "name": "wakelock example", | ||
| 3 | + "short_name": "wakelock", | ||
| 4 | + "start_url": ".", | ||
| 5 | + "display": "standalone", | ||
| 6 | + "background_color": "#0175C2", | ||
| 7 | + "theme_color": "#0175C2", | ||
| 8 | + "description": "Example app demonstrating how to use the wakelock plugin.", | ||
| 9 | + "orientation": "portrait-primary", | ||
| 10 | + "prefer_related_applications": false | ||
| 11 | +} |
wakelock/ios/Assets/.gitkeep
0 → 100644
-
Please register or login to post a comment