-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New Example - PurchaseTester TypeScript (#320)
* Initial commit of purchaseTester typescript example * Made things a little prettier for offering detail * Removed console log * Typescript example using local RNPurchases pod * Fix some things were states weren't updating * Trying to fix CircleCI * This is it * name isn't a thing for the RN builds * name also isn't a thing for iOS RN builds * Add set attributes which isnt really working yet * Fix broken test * Fix broken test... again * Ignore package-lock.json, try using rn/yarn_install on circleci, move RC init to app.tsx * Trying to get yarn_install to run in the example directory * Change yarn cache folder * Try bringing in the yarn install from the orb for testing * Try yarn cwd before calling rn/yarn_install * That didn't work * This should fix android * This should fix macos symlink issue * Reset cache to see if fix worked * Lets start over on circleci * Add path for yarn pod * Experimenting * This should do it * --cwd doesnt work with yarn pods * Need to warn install both examples * Try with rn/yarn_install but copied over with path param * Forgot to replace cache path * Cleanup because things works :) * Need to put path to ios directory * Use conditional logic and use --cwd if not empty string * Rename to use standard revenuecat tester package and bundle id * Bump to react-native-community/[email protected] * Rename isSetup to hasKeys * Setup local testing for PurchaseTester Typescript (#326) * This works so much better for local testing * Updated comments to be more helpful * Fixed typo * Need to await the initial fetchData * Rename storekit config file and add second target that does not use sk config file Co-authored-by: Josh Holtz <[email protected]>
- Loading branch information
1 parent
cd69aa0
commit a90ea99
Showing
73 changed files
with
3,985 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ node_modules/ | |
npm-debug.log | ||
yarn-error.log | ||
**/yarn.lock | ||
**/package-lock.json | ||
|
||
# Xcode | ||
# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
[android] | ||
target = Google Inc.:Google APIs:23 | ||
|
||
[maven_repositories] | ||
central = https://repo1.maven.org/maven2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Windows files | ||
[*.bat] | ||
end_of_line = crlf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
root: true, | ||
extends: '@react-native-community', | ||
rules: { | ||
"no-shadow": "off", | ||
"@typescript-eslint/no-shadow": ["error"], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Windows files should use crlf line endings | ||
# https://help.github.com/articles/dealing-with-line-endings/ | ||
*.bat text eol=crlf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# OSX | ||
# | ||
.DS_Store | ||
|
||
# Xcode | ||
# | ||
build/ | ||
*.pbxuser | ||
!default.pbxuser | ||
*.mode1v3 | ||
!default.mode1v3 | ||
*.mode2v3 | ||
!default.mode2v3 | ||
*.perspectivev3 | ||
!default.perspectivev3 | ||
xcuserdata | ||
*.xccheckout | ||
*.moved-aside | ||
DerivedData | ||
*.hmap | ||
*.ipa | ||
*.xcuserstate | ||
|
||
# Android/IntelliJ | ||
# | ||
build/ | ||
.idea | ||
.gradle | ||
local.properties | ||
*.iml | ||
*.hprof | ||
|
||
# node.js | ||
# | ||
node_modules/ | ||
npm-debug.log | ||
yarn-error.log | ||
|
||
# BUCK | ||
buck-out/ | ||
\.buckd/ | ||
*.keystore | ||
!debug.keystore | ||
|
||
# fastlane | ||
# | ||
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the | ||
# screenshots whenever they are needed. | ||
# For more information about the recommended setup visit: | ||
# https://docs.fastlane.tools/best-practices/source-control/ | ||
|
||
*/fastlane/report.xml | ||
*/fastlane/Preview.html | ||
*/fastlane/screenshots | ||
|
||
# Bundle artifact | ||
*.jsbundle | ||
|
||
# CocoaPods | ||
/ios/Pods/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
bracketSpacing: false, | ||
jsxBracketSameLine: true, | ||
singleQuote: true, | ||
trailingComma: 'all', | ||
arrowParens: 'avoid', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/** | ||
* Sample React Native App | ||
* https://github.com/facebook/react-native | ||
* | ||
* Generated with the TypeScript template | ||
* https://github.com/react-native-community/react-native-template-typescript | ||
* | ||
* @format | ||
*/ | ||
|
||
import React, { useEffect } from 'react'; | ||
|
||
import { Platform, Text } from 'react-native'; | ||
import { NavigationContainer } from '@react-navigation/native'; | ||
import { createNativeStackNavigator } from '@react-navigation/native-stack'; | ||
|
||
import Purchases from 'react-native-purchases'; | ||
|
||
import HomeScreen from './app/screens/HomeScreen'; | ||
import CustomerInfoScreen from './app/screens/CustomerInfoScreen'; | ||
import OfferingDetailScreen from './app/screens/OfferingDetailScreen'; | ||
|
||
import APIKeys from './app/APIKeys'; | ||
import { SafeAreaView } from 'react-native-safe-area-context'; | ||
|
||
const Stack = createNativeStackNavigator(); | ||
|
||
const App = () => { | ||
const hasKeys = () => { | ||
return APIKeys.apple.length > 0 || APIKeys.google.length > 0; | ||
} | ||
|
||
useEffect(() => { | ||
if (!hasKeys()) { return } | ||
|
||
Purchases.setDebugLogsEnabled(true); | ||
if (Platform.OS == "android") { | ||
Purchases.setup(APIKeys.google); | ||
} else { | ||
Purchases.setup(APIKeys.apple); | ||
} | ||
}, []); | ||
|
||
return !hasKeys() ? ( | ||
<SafeAreaView> | ||
<Text style={{margin: 20, textAlign: 'center'}}> | ||
Update RevenueCat API Keys in APIKeys.tsx | ||
</Text> | ||
</SafeAreaView> | ||
) : ( | ||
<NavigationContainer> | ||
<Stack.Navigator initialRouteName="Home"> | ||
<Stack.Screen | ||
name="Home" | ||
component={HomeScreen} | ||
options={{ title: 'PurchaseTester' }} | ||
/> | ||
<Stack.Screen name="CustomerInfo" component={CustomerInfoScreen} /> | ||
<Stack.Screen name="OfferingDetail" component={OfferingDetailScreen} /> | ||
</Stack.Navigator> | ||
</NavigationContainer> | ||
); | ||
}; | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* @format | ||
*/ | ||
|
||
import 'react-native'; | ||
import React from 'react'; | ||
import App from '../App'; | ||
|
||
// Note: test renderer must be required after react-native. | ||
import renderer from 'react-test-renderer'; | ||
|
||
it('renders correctly', () => { | ||
renderer.create(<App />); | ||
}); |
Oops, something went wrong.