Skip to content

Commit

Permalink
Merge branch 'main' into samsung-pay
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanskar2001 committed Nov 21, 2024
2 parents f4d0ef3 + 5e9a5f4 commit afd0bff
Show file tree
Hide file tree
Showing 70 changed files with 3,197 additions and 2,051 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/gradle-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Publish to Maven Central

on:
repository_dispatch:
types: [android_repo_push]

jobs:
update:
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v4

publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4

- name: Checkout Android Repo
uses: actions/checkout@v4
with:
repository: juspay/hyperswitch-sdk-android
ref: main
path: android

- name: Check android subrepo branch and commit message
id: extract-libs
working-directory: ./android
run: |
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [[ "$CURRENT_BRANCH" != "main" ]]; then
echo "Not on main branch in android directory. Skipping workflow."
exit 1
fi
COMMIT_MSG=$(git log -1 --pretty=%B)
# if [[ ! "$COMMIT_MSG" =~ ^release:\[(.*)\] ]]; then
# echo "$COMMIT_MSG"
# echo "Invalid commit message format. Expected: release:[lib1,lib2]"
# exit 0
# fi
if [[ ! "$COMMIT_MSG" =~ ^release:\[([-a-zA-Z0-9,_-]+)\] ]]; then
echo "$COMMIT_MSG"
echo "Invalid commit message format. Expected: release:[lib1,lib2]"
exit 0
fi
LIBS="${BASH_REMATCH[1]}"
echo "Found libraries: $LIBS"
echo "libraries=$LIBS" >> $GITHUB_OUTPUT
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
server-id: central
server-username: ${{secrets.ANDROID_CENTRAL_TOKEN_USERNAME }}
server-password: ${{ secrets.ANDROID_CENTRAL_TOKEN_PASSWORD }}
gpg-private-key: ${{ secrets.ANDROID_GPG_SIGNING_KEY }}
gpg-passphrase: ${{ secrets.ANDROID_GPG_SIGNING_KEY_PASSWORD }}

- name: Dependency Install
run: |
# Install dependencies using npm
npm i
npm run re:start
- name: Setup Gradle
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582
with:
build-root-directory: ./android

- name: Remove demo-app from settings.gradle
working-directory: ./android
run: |
sed -i "s/include ':app', ':react-native-code-push', ':demo-app', ':hyperswitch-sdk-android-lite'/include ':app', ':react-native-code-push', ':hyperswitch-sdk-android-lite'/" settings.gradle
- name: Build and Publish
working-directory: ./android
env:
SONATYPE_TOKEN: ${{ secrets.ANDROID_SONATYPE_AUTH_TOKEN }}
SELECTED_LIBRARIES: ${{ steps.extract-libs.outputs.libraries }}
GPG_PASSPHRASE: ${{ secrets.ANDROID_GPG_SIGNING_KEY_PASSWORD }}

run: |
./build-lib.sh
2 changes: 1 addition & 1 deletion android
2 changes: 1 addition & 1 deletion ios
62 changes: 0 additions & 62 deletions next.config.js

This file was deleted.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"web": "webpack serve --mode=development --config reactNativeWeb/webpack.config.js",
"ios": "cd ios && rm -rf build && pod install && cd .. && react-native run-ios",
"android": "react-native run-android --appIdSuffix demoapp --main-activity .demoapp.MainActivity && yarn run adb",
"web:next": "next",
"web:next": "cd reactNativeWeb && next",
"bundle:android": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/hyperswitch.bundle",
"bundle:ios": "react-native bundle --platform ios --dev false --entry-file index.js --bundle-output ios/hyperswitchSDK/Core/Resources/hyperswitch.bundle",
"codepush:android": "appcenter codepush release-react -b hyperswitch.bundle -a Hyperswitch/hyperswitch-android -d Production",
Expand Down Expand Up @@ -93,6 +93,7 @@
"react-content-loader": "^6.2.1",
"react-dom": "18.3.1",
"react-native": "^0.75.2",
"react-native-bundle-visualizer": "^3.1.3",
"react-native-dotenv": "^3.4.11",
"react-native-web": "^0.19.12",
"react-test-renderer": "18.3.1",
Expand Down
98 changes: 0 additions & 98 deletions pages/index.tsx

This file was deleted.

62 changes: 33 additions & 29 deletions reactNativeWeb/DemoApp/DemoAppIndex.html
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>HyperSwitch Web</title>
<style>
body {
margin: 0;
}
#app-root {
display: flex;
flex: 1 1 100%;
height: 100vh;
}
iframe {
width: 100%;
border: 0;
}
</style>
<script defer="defer" src="./DemoAppIndex.js"></script>
</head>
<body>
<div id="app-root">
<iframe src="http://localhost:8080/"></iframe>
</div>
</body>
</html>

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>HyperSwitch Web</title>
<style>
body {
margin: 0;
}

#app-root {
display: flex;
flex: 1 1 100%;
height: 100vh;
}

iframe {
width: 100%;
border: 0;
}
</style>
<script defer="defer" src="./DemoAppIndex.js"></script>
</head>

<body>
<div id="app-root" style="justify-content:center;">
<div id="status" style="align-self: center;"></div>
<iframe src="http://localhost:8080"></iframe>
</div>
</body>

</html>
13 changes: 10 additions & 3 deletions reactNativeWeb/DemoApp/DemoAppIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ let defaultProps = {
// borderRadius:20.0
// }}
// locale: "en"
typography: {
fontResId: 'montserrat'
}
},
},
hyperParams: {
Expand Down Expand Up @@ -61,11 +64,15 @@ const initReactNativeWeb = async () => {

const handleMessage = event => {
try {
console.log(JSON.parse(event.data));
if (JSON.parse(event.data).sdkLoaded) {
let data = JSON.parse(event.data)
if (data.sdkLoaded) {
createProps();
}
} catch (ex) {}
if (data.status) {
document.querySelector("iframe").style.display = "none"
document.getElementById("status").innerHTML = `Status: ${data.status} ${data.message ? "Message: " + data.message : ""}`
}
} catch (ex) { }
};

window.addEventListener('message', handleMessage);
Expand Down
3 changes: 0 additions & 3 deletions reactNativeWeb/WebApp.res
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@get external data: ReactEvent.Form.t => string = "data"

@react.component
let app = (~props) => {
let (propFromEvent, setPropFromEvent) = React.useState(() => None)
Expand All @@ -23,7 +21,6 @@ let app = (~props) => {
"sdkLoaded": true,
})->Option.getOr("")

Window.postMessageToParent(sdkInitialisedProp, "*")
sdkInitialised(sdkInitialisedProp)

None
Expand Down
Loading

0 comments on commit afd0bff

Please sign in to comment.