Skip to content

Commit

Permalink
chore: migrate expo config plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
hyochan committed Jun 13, 2024
1 parent 013df81 commit afbc228
Show file tree
Hide file tree
Showing 17 changed files with 2,519 additions and 402 deletions.
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ To run the example app on Android:
```bash
yarn android:play
```

or

```bash
yarn android:amazon
```
Expand Down Expand Up @@ -83,6 +85,7 @@ yarn lint --fix
```

To fix formatting errors in `swift` files:

- prerequisity: on your Mac install [SwiftLint](https://github.com/realm/SwiftLint)

```bash
Expand Down
3 changes: 2 additions & 1 deletion IapExample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ This is a new [**React Native**](https://reactnative.dev) project, bootstrapped

# Getting Started with IapExample

>**Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding.
> **Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding.
## Step 1: Install dependencies

Expand All @@ -19,6 +19,7 @@ yarn install
### For iOS

Install pods:

```bash
cd ios
pod install
Expand Down
6 changes: 3 additions & 3 deletions IapExample/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ PODS:
- RNGestureHandler (2.14.0):
- RCT-Folly (= 2021.07.22.00)
- React-Core
- RNIap (12.13.2):
- RNIap (12.14.0):
- React-Core
- RNScreens (3.29.0):
- RCT-Folly (= 2021.07.22.00)
Expand Down Expand Up @@ -734,12 +734,12 @@ SPEC CHECKSUMS:
ReactCommon: 5f704096ccf7733b390f59043b6fa9cc180ee4f6
RNCMaskedView: f7c74478c83c4fdfc5cf4df51f80c0dd5cf125c6
RNGestureHandler: 32a01c29ecc9bb0b5bf7bc0a33547f61b4dc2741
RNIap: b30126ab51607421ba595d534a3710d2796212f4
RNIap: 7518779bdb5bc2ce934fdccfc731a7b75a7b0f94
RNScreens: 3c5b9f4a9dcde752466854b6109b79c0e205dad3
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
Yoga: 4c3aa327e4a6a23eeacd71f61c81df1bcdf677d5
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

PODFILE CHECKSUM: 495071a5be8a043154d26c3aa360258ffdd9da6f
PODFILE CHECKSUM: 9a53c17705c562b91aa83a5cd6b6817e2766e96b

COCOAPODS: 1.13.0
212 changes: 6 additions & 206 deletions IapExample/yarn.lock

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
---

## Announcement

Announcing the Migration of react-native-iap to an Expo Module for Improved Maintenance and Compatibility in [discussion #2754](https://github.com/dooboolab-community/react-native-iap/discussions/2754).

## Documentation
Expand Down Expand Up @@ -53,16 +54,14 @@ Follow [this guide](./IapExample/README.md) to get the example running.

### <p style="color: gold;">Gold Tier</p>

| [NAMI](https://namiml.com) |
|:--:|
| [NAMI](https://namiml.com) |
| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| <a href="https://namiml.com"><img src="https://github.com/dooboolab-community/react-native-iap/assets/27461460/89d71f61-bb73-400a-83bd-fe0f96eb726e" width="450"/></a> |


## Past Sponsors
## Past Sponsors

<a href="https://www.revenuecat.com"><img src="https://github.com/dooboolab-community/react-native-iap/assets/27461460/1e387a47-afe0-4b85-ad78-1064ca6623fa" width="200"/></a>


Support this project by becoming a sponsor. Your logo will show up here with
a link to your website. [Buy me a coffee](https://www.buymeacoffee.com/dooboolab) or
[Become a sponsor](https://opencollective.com/react-native-iap#sponsor).
Expand All @@ -83,4 +82,3 @@ Thank you to all the people who helped to maintain and upgrade this project!
---

[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fdooboolab%2Freact-native-iap.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fdooboolab%2Freact-native-iap?ref=badge_large)

2 changes: 1 addition & 1 deletion docs/docs/api-reference/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const App = () => {
<>
<Button
title="Get the products"
onPress={getProducts({ skus: ['product.id'] })}
onPress={getProducts({skus: ['product.id']})}
/>

{products.map((product) => (
Expand Down
33 changes: 17 additions & 16 deletions docs/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
import React, { useEffect, useState } from 'react';
import React, {useEffect, useState} from 'react';
import {Redirect} from 'react-router-dom';
import useBaseUrl from '@docusaurus/useBaseUrl';
import AdFit from '../uis/AdFit';

export default function Home() {

useEffect(() => {
location.href = '/docs/get-started';
}, [])
}, []);

return <div>
<AdFit
unit="DAN-YTmjDwlbcP42HBg6"
height={100}
width={320}
className="adfit-top"
style={{
height: 100,
width: 320,
marginTop: 48,
}}
/>
</div>
return (
<div>
<AdFit
unit="DAN-YTmjDwlbcP42HBg6"
height={100}
width={320}
className="adfit-top"
style={{
height: 100,
width: 320,
marginTop: 48,
}}
/>
</div>
);
}
25 changes: 12 additions & 13 deletions docs/src/uis/AdFit.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { useEffect } from "react";
import React from 'react';
import {useEffect} from 'react';

export default function AdFit({
className = 'adfit',
Expand All @@ -8,20 +8,19 @@ export default function AdFit({
height,
width,
}) {

useEffect(() => {
let ins = document.createElement("ins");
let scr = document.createElement("script");
ins.className = "kakao_ad_area";
let ins = document.createElement('ins');
let scr = document.createElement('script');
ins.className = 'kakao_ad_area';
// @ts-ignore
ins.style = "display:none; width:100%;";
ins.style = 'display:none; width:100%;';
// @ts-ignore
scr.async = "true";
scr.type = "text/javascript";
scr.src = "//t1.daumcdn.net/kas/static/ba.min.js";
ins.setAttribute("data-ad-width", width.toString());
ins.setAttribute("data-ad-height", height.toString());
ins.setAttribute("data-ad-unit", unit.toString());
scr.async = 'true';
scr.type = 'text/javascript';
scr.src = '//t1.daumcdn.net/kas/static/ba.min.js';
ins.setAttribute('data-ad-width', width.toString());
ins.setAttribute('data-ad-height', height.toString());
ins.setAttribute('data-ad-unit', unit.toString());
document.querySelector(`.${className}`).appendChild(ins);
document.querySelector(`.${className}`).appendChild(scr);
}, []);
Expand Down
2 changes: 1 addition & 1 deletion docs/src/uis/AdFitTopFixed.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import AdFit from "./AdFit";
import AdFit from './AdFit';

export default function AdFitTopFixed() {
return (
Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
},
"devDependencies": {
"@babel/eslint-parser": "7.21.8",
"@firmnav/eslint-github-actions-formatter": "1.0.1",
"@firmnav/eslint-github-actions-formatter": "^1.0.1",
"@jeremybarbet/apple-api-types": "1.4.0",
"@jeremybarbet/google-api-types": "1.4.0",
"@react-native-community/eslint-config": "3.2.0",
Expand All @@ -95,6 +95,7 @@
"eslint-plugin-jest": "27.2.2",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-simple-import-sort": "10.0.0",
"expo": "^51.0.14",
"expo-module-scripts": "^3.0.7",
"jest": "29.5.0",
"monolinter": "1.0.4",
Expand All @@ -110,13 +111,13 @@
"typescript": "5.0.4"
},
"peerDependencies": {
"expo": ">=47.0.0",
"react": ">=16.13.1",
"react-native": ">=0.65.1"
},
"resolutions": {
"@types/react": "17.0.59"
},
"dependencies": {
"@expo/config-plugins": "^7.8.4"
"peerDependenciesMeta": {
"expo": {
"optional": true
}
}
}
4 changes: 2 additions & 2 deletions plugin/__tests__/withIAP-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
projectBuildGradleWithoutIAP,
} from './fixtures/buildGradleFiles';

jest.mock('@expo/config-plugins', () => {
const plugins = jest.requireActual('@expo/config-plugins');
jest.mock('expo/config-plugins', () => {
const plugins = jest.requireActual('expo/config-plugins');

return {
...plugins,
Expand Down
9 changes: 6 additions & 3 deletions plugin/build/withIAP.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { ConfigPlugin } from '@expo/config-plugins';
import {ConfigPlugin} from 'expo/config-plugins';
type PaymentProvider = 'Amazon AppStore' | 'both' | 'Play Store';
export declare const modifyAppBuildGradle: (buildGradle: string, paymentProvider: PaymentProvider) => string;
export declare const modifyAppBuildGradle: (
buildGradle: string,
paymentProvider: PaymentProvider,
) => string;
export declare const modifyProjectBuildGradle: (buildGradle: string) => string;
interface Props {
paymentProvider?: PaymentProvider;
paymentProvider?: PaymentProvider;
}
declare const _default: ConfigPlugin<Props | undefined>;
export default _default;
Loading

0 comments on commit afbc228

Please sign in to comment.