Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ios feature set #1

Merged
merged 6 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
open_collective: react-native-iap
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: 🐛 Bug Report
about: Report an issue to help us improve expo-iap
title: ''
labels: 'bug'
assignees: ''
---

> Please use the [Discussion board](https://github.com/hyochan/expo-iap/discussions) if you want to get some help. Please use issues to report bugs.

**Description**

<!-- A brief description of the issue. -->

**Expected Behavior**

<!-- A brief description of what you expected to happen. -->

**Screenshots**

<!-- Add screenshots, if applicable, to help explain your problem. -->

**Environment:**

- expo-iap:
- react-native:
- Platforms (iOS, Android, emulator, simulator, device):

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Press '...'
3. Error '...' is shown

---

[Optional] **Additional Context**

<!-- Add any other context about the problem here. -->
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
24 changes: 24 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Configuration for probot-stale - https://github.com/probot/stale
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 90
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 30
# Issues with these labels will never be considered stale
exemptLabels:
- Good first issue
- For Discussion
- Core Team
- "Help Wanted :octocat:"
- ":warning:Regression"
- ":clock1:PR Pending"
# Label to use when marking an issue as stale
staleLabel: Stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs.
You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open.
Thank you for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: >
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.
only: issues
24 changes: 24 additions & 0 deletions .github/workflows/ci-ktlint-android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CI / Ktlint Android

on:
pull_request:
paths:
- .github/workflows/ci-ktlint-android.yml
- 'android/src/**/*.kt'
- '**.kts'

jobs:
ktlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.48.2/ktlint && chmod a+x ktlint && sudo mv ktlint /usr/local/bin/
- name: run ktlint
run: |
ktlint --reporter=checkstyle,output=build/ktlint-report.xml
continue-on-error: true
- uses: yutailang0119/action-ktlint@v3
with:
report-path: build/*.xml # Support glob patterns by https://www.npmjs.com/package/@actions/glob
continue-on-error: false # If annotations contain error of severity, action-ktlint exit 1.
71 changes: 71 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: CI

on:
push:
branches: [main, next]
paths:
- 'docs/**'
- 'src/**'
- 'scripts/**'
- 'test/**'
- '*.md'
- '*.json'
- '*.js'
- '*.lock'
- 'IapExample/src/**'
- 'IapExample/*.json'
- 'IapExample/*.js'
- 'IapExample/*.lock'
- 'IapExample/*.tsx'
- .github/**

pull_request:
types: [opened, synchronize, reopened]
paths:
- 'docs/**'
- 'src/**'
- 'scripts/**'
- 'test/**'
- '*.md'
- '*.json'
- '*.js'
- '*.lock'
- 'IapExample/src/**'
- 'IapExample/*.json'
- 'IapExample/*.js'
- 'IapExample/*.lock'
- 'IapExample/*.tsx'
- .github/**

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: 'yarn'

- name: Install reviewdog
uses: reviewdog/action-setup@v1

- name: Install dependencies
run: yarn install --immutable

# - name: Install node_modules for `IapExample/`
# run: yarn install --immutable
# working-directory: IapExample

# - name: Run TypeScript
# run: |
# yarn lint:tsc | reviewdog -name="tsc" -efm="%f(%l,%c): error TS%n: %m" -reporter="github-pr-review" -filter-mode="nofilter" -fail-on-error -tee
# env:
# REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# - name: Run lint scripts
# run: yarn lint:ci

24 changes: 24 additions & 0 deletions .github/workflows/code-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Code Review GPT

on:
pull_request:
branches: [main]

permissions:
pull-requests: write
contents: read

jobs:
run_code_review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Code Review GPT
uses: mattzcarey/[email protected]
with:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
MODEL: 'gpt-4o'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/publish-next.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish next package

on:
release:
types: [created]

jobs:
deploy:
if: github.event.release.prerelease
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: 'yarn'
registry-url: 'https://registry.npmjs.org'

- name: Remove example code
run: rm -rf IapExample

- name: Install dependencies
run: yarn install --immutable

- name: Build typescript
run: yarn lint:ci

- name: Verify no files have changed after auto-fix
run: git diff -- ":(exclude)IapExample/*" --exit-code HEAD

- run: npm publish --tag next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
35 changes: 35 additions & 0 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish main package

on:
release:
types: [created]

jobs:
deploy:
if: '!github.event.release.prerelease'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: 'yarn'
registry-url: 'https://registry.npmjs.org'

- name: Remove example code
run: rm -rf IapExample

- name: Install dependencies
run: yarn install --immutable

- name: Run lint scripts
run: yarn lint:ci

- name: Verify no files have changed after auto-fix
run: git diff -- ":(exclude)IapExample/*" --exit-code HEAD

- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
10 changes: 10 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
opt_in_rules:
- vertical_whitespace_between_cases
- vertical_whitespace_closing_braces
- vertical_whitespace_opening_braces
- vertical_parameter_alignment_on_call
- operator_usage_whitespace
- redundant_type_annotation

vertical_whitespace_closing_braces: true
vertical_whitespace_opening_braces: true
58 changes: 31 additions & 27 deletions android/src/main/java/expo/modules/iap/ExpoIapModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,39 @@ import expo.modules.kotlin.modules.Module
import expo.modules.kotlin.modules.ModuleDefinition

class ExpoIapModule : Module() {
// Each module class must implement the definition function. The definition consists of components
// that describes the module's functionality and behavior.
// See https://docs.expo.dev/modules/module-api for more details about available components.
override fun definition() = ModuleDefinition {
// Sets the name of the module that JavaScript code will use to refer to the module. Takes a string as an argument.
// Can be inferred from module's class name, but it's recommended to set it explicitly for clarity.
// The module will be accessible from `requireNativeModule('ExpoIap')` in JavaScript.
Name("ExpoIap")
// Each module class must implement the definition function. The definition consists of components
// that describes the module's functionality and behavior.
// See https://docs.expo.dev/modules/module-api for more details about available components.
override fun definition() =
ModuleDefinition {
// Sets the name of the module that JavaScript code will use to refer to the module. Takes a string as an argument.
// Can be inferred from module's class name, but it's recommended to set it explicitly for clarity.
// The module will be accessible from `requireNativeModule('ExpoIap')` in JavaScript.
Name("ExpoIap")

// Sets constant properties on the module. Can take a dictionary or a closure that returns a dictionary.
Constants(
"PI" to Math.PI
)
// Sets constant properties on the module. Can take a dictionary or a closure that returns a dictionary.
Constants(
"PI" to Math.PI,
)

// Defines event names that the module can send to JavaScript.
Events("onChange")
// Defines event names that the module can send to JavaScript.
Events("onChange")

// Defines a JavaScript synchronous function that runs the native code on the JavaScript thread.
Function("hello") {
"Hello world! 👋"
}
// Defines a JavaScript synchronous function that runs the native code on the JavaScript thread.
Function("hello") {
"Hello world! 👋"
}

// Defines a JavaScript function that always returns a Promise and whose native code
// is by default dispatched on the different thread than the JavaScript runtime runs on.
AsyncFunction("setValueAsync") { value: String ->
// Send an event to JavaScript.
sendEvent("onChange", mapOf(
"value" to value
))
}
}
// Defines a JavaScript function that always returns a Promise and whose native code
// is by default dispatched on the different thread than the JavaScript runtime runs on.
AsyncFunction("setValueAsync") { value: String ->
// Send an event to JavaScript.
sendEvent(
"onChange",
mapOf(
"value" to value,
),
)
}
}
}
Binary file added bun.lockb
Binary file not shown.
Loading
Loading