Skip to content

Commit

Permalink
Implement FlareUI (#28)
Browse files Browse the repository at this point in the history
* Create `FlareUI` library

* Implement both `SubscriptionsView` & `ProductsView`

* Implement a user interface for products

* Implement fetching & purchasing storekit product via `ProductView`

* Implement an appearing & disappearing animation

* Fix UI elements

* Implement displaying product's icon

* Implement updaing view with animation

* Remove the example app

* Add code comments

* Create a test target for `FlareUI` library

* Update `SwiftLint` action

* Implement `upload_test_coverage_report.yml`

* Update `workflows`

* Implement `build_and_test` action

* Implement test cases for `ProductView`

- Create the shared `FlareMock` package
- Implement snapshot tests
- Implement unit tests

* Implement test cases for `ProductsView`

* Implement store buttons

- Implement the `restore` button

* Implement various product styles

* Update the logic for generating `swiftgen` files

* Displaying an error alert when restoring purchases

* Displaying a subscription duration next to the price

* Implement the display of a placeholder icon

* Implement tests

* Update tests

* Implement passing parameters to a view

- Implement `onInAppPurchaseCompletion` to handle the completion of a purchase.
- Implement `inAppPurchaseOptions` to pass additional parameters for a purchase.

* Update the `FlareUITests` target's configuration

* Update `CHANGELOG.md`

* Create a test plan for snapshot testing

* Update the snapshot tests

* Implement the snapshot tests target

* Refactor the finish transaction logic

* Implement `compact` & `large` product style for iOS

* Make the `large` and `compact` product styles public

* Remove unnecessary test cases for specific platforms

* Implement passing assemblies using `environment`

* Fix displaying price for compact product style

* Make `ProductView` & `ProductsView` public

* Implement wrappers in `UIKit` for `ProductView` & `ProductsView`

* Implement UIKit wrappers for `tvOS` and `macOS`

* Add Russian localization

* Implement the passing of view styles to UIKit wrappers

* Implement scrolling for products

* Implement sorting for fetched products

* Implement the `loading` & `error` state for `SubscriptionsView`

* Implement customization of subscription item styles

* Update the footer view

* Implement passing tint colors

* Implement the creation of marketing content for the subscription view

* Implement settings background for subscription view

* Implement constast text

* Implement the formatting of a subscription price

* Implement bold button style

* Implement `Privacy Policy` & `Terms of Service` buttons

* Fix tests

* Temp commit

* Refactor `SubscriptionsWrapperView`

* Update `CardButtonSubscriptionStoreControlStyle`

* Implement `PoliciesButtonStyle`

* Update the `CardButtonSubscriptionStoreControlView` style

* Add `MARK`

* Implement auto-detection of active subscriptions

* Implement `SubscriptionStatusVerifierProvider`

* Fix building `Flare` for macOS

* Implement displaying a header for tvOS

* Implement the `SubscriptionsViewController` wrapper

* Implement `SubscriptionsPresenterTests`

* Fix typos

* Fixing the project build for Xcode 14

* Disable support for `watchOS`

* Implement snapshot tests

* Fix project building

* Fix tests
  • Loading branch information
nik3212 committed Apr 29, 2024
1 parent c6eddbd commit e333aaf
Show file tree
Hide file tree
Showing 358 changed files with 11,453 additions and 240 deletions.
48 changes: 48 additions & 0 deletions .github/actions/build_and_test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build and Test Action

inputs:
scheme:
required: true
type: string
destination:
required: true
type: string
name:
required: true
type: string
test_plan:
required: false
type: string
generate_project:
required: false
type: boolean
default: true

runs:
using: "composite"

steps:
- name: Install Dependencies & Generate project
shell: bash
run: |
if [ "${{ inputs.generate_project }}" = "true" ]; then
make setup_build_tools
make generate
fi
- name: ${{ inputs.name }}
shell: bash
run: |
if [ -n "${{ inputs.test_plan }}" ]; then
xcodebuild clean test \
-scheme ${{ inputs.scheme }} \
-destination "${{ inputs.destination }}" \
-testPlan ${{ inputs.test_plan }} \
-enableCodeCoverage YES \
-resultBundlePath "test_output/${{ inputs.name }}.xcresult" || exit 1
else
xcodebuild clean test \
-scheme ${{ inputs.scheme }} \
-destination "${{ inputs.destination }}" \
-enableCodeCoverage YES \
-resultBundlePath "test_output/${{ inputs.name }}.xcresult" || exit 1
fi
34 changes: 34 additions & 0 deletions .github/actions/upload_test_coverage_report/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Upload a Test Coverage Report

inputs:
filename:
required: true
type: string
scheme_name:
required: true
type: string
token:
description: 'A CodeCov Token'
required: true

runs:
using: "composite"

steps:
- name: Dir
shell: bash
run: pwd && ls -al
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3.1.0
with:
token: ${{ inputs.token }}
xcode: true
flags: ${{ inputs.scheme_name }}
xcode_archive_path: test_output/${{ inputs.filename }}.xcresult
- name: Dir
shell: bash
run: pwd && ls -al
- uses: actions/upload-artifact@v4
with:
name: ${{ inputs.filename }}
path: test_output
96 changes: 43 additions & 53 deletions .github/workflows/ci.yml → .github/workflows/flare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,13 @@ on:
paths:
- '.swiftlint.yml'
- ".github/workflows/**"
- "Package@swift-5.7.swift"
- "Package@swift-5.8.swift"
- "Package.swift"
- "Source/**"
- "Source/Flare/**"
- "Tests/**"

jobs:
SwiftLint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: GitHub Action for SwiftLint
uses: norio-nomura/action-swiftlint@3.2.1
with:
args: --strict
env:
DIFF_BASE: ${{ github.base_ref }}
macOS:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runsOn }}
Expand All @@ -49,17 +41,18 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: ${{ matrix.name }}
run: xcodebuild test -scheme "Flare" -destination "platform=macOS" clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
xcode: true
xcode_archive_path: test_output/${{ matrix.name }}.xcresult
- uses: actions/upload-artifact@v4
uses: ./.github/actions/build_and_test
with:
scheme: Flare
destination: "platform=macOS"
name: ${{ matrix.name }}
path: test_output
generate_project: false
- name: Upload test coverage reports to Codecov
uses: ./.github/actions/upload_test_coverage_report
with:
scheme_name: Flare
filename: ${{ matrix.name }}
token: ${{ secrets.CODECOV_TOKEN }}

iOS:
name: ${{ matrix.name }}
Expand All @@ -81,16 +74,19 @@ jobs:
runsOn: macos-13
steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: make setup_build_tools
- name: Generate project
run: make generate
- name: ${{ matrix.name }}
run: xcodebuild test -scheme "Flare" -destination "${{ matrix.destination }}" -testPlan AllTests clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
- uses: actions/upload-artifact@v4
uses: ./.github/actions/build_and_test
with:
scheme: Flare
destination: ${{ matrix.destination }}
name: ${{ matrix.name }}
path: test_output
test_plan: AllTests
- name: Upload test coverage reports to Codecov
uses: ./.github/actions/upload_test_coverage_report
with:
scheme_name: Flare
filename: ${{ matrix.name }}
token: ${{ secrets.CODECOV_TOKEN }}

tvOS:
name: ${{ matrix.name }}
Expand All @@ -112,22 +108,19 @@ jobs:
runsOn: macos-13
steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: make setup_build_tools
- name: Generate project
run: make generate
- name: ${{ matrix.name }}
run: xcodebuild test -scheme "Flare" -destination "${{ matrix.destination }}" -testPlan AllTests clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
xcode: true
xcode_archive_path: test_output/${{ matrix.name }}.xcresult
- uses: actions/upload-artifact@v4
uses: ./.github/actions/build_and_test
with:
scheme: Flare
destination: ${{ matrix.destination }}
name: ${{ matrix.name }}
path: test_output
test_plan: AllTests
- name: Upload test coverage reports to Codecov
uses: ./.github/actions/upload_test_coverage_report
with:
scheme_name: Flare
filename: ${{ matrix.name }}
token: ${{ secrets.CODECOV_TOKEN }}

watchOS:
name: ${{ matrix.name }}
Expand All @@ -153,22 +146,19 @@ jobs:
runsOn: macos-13
steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: make setup_build_tools
- name: Generate project
run: make generate
- name: ${{ matrix.name }}
run: xcodebuild test -scheme "Flare" -destination "${{ matrix.destination }}" -testPlan UnitTests clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
xcode: true
xcode_archive_path: test_output/${{ matrix.name }}.xcresult
- uses: actions/upload-artifact@v4
uses: ./.github/actions/build_and_test
with:
scheme: Flare
destination: ${{ matrix.destination }}
name: ${{ matrix.name }}
path: test_output
test_plan: UnitTests
- name: Upload test coverage reports to Codecov
uses: ./.github/actions/upload_test_coverage_report
with:
scheme_name: Flare
filename: ${{ matrix.name }}
token: ${{ secrets.CODECOV_TOKEN }}

spm:
name: ${{ matrix.name }}
Expand Down
Loading

0 comments on commit e333aaf

Please sign in to comment.