Skip to content
Draft
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
6 changes: 0 additions & 6 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]

indent_style = space
indent_size = 2

end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
Expand Down
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ DerivedData
*.ipa
*.xcuserstate
project.xcworkspace
**/.xcode.env.local

# Android/IJ
#
Expand Down Expand Up @@ -78,5 +79,8 @@ android/keystores/debug.keystore
lib/

# React Native Codegen
ios
android
ios/generated
android/generated

# React Native Nitro Modules
nitrogen/
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18
v22
5 changes: 5 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"semi": false,
"singleQuote": true,
"jsxSingleQuote": true,
}
4 changes: 2 additions & 2 deletions COPYRIGHT
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Longer version:
Copyright 2024, Korea PortOne Co., Ltd.

Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
<LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
<LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
option. This file may not be copied, modified, or distributed
except according to those terms.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ yarn add -D @portone/browser-sdk
내용을 추가합니다.

```xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="https://schemas.android.com/apk/res/android">
<!-- 중략 -->
<queries>
<package android:name="com.kftc.bankpay.android" />
Expand Down
83 changes: 83 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
buildscript {
ext.getExtOrDefault = {name ->
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['PortOneReactNativeSdk_' + name]
}

repositories {
google()
mavenCentral()
}

dependencies {
classpath "com.android.tools.build:gradle:8.10.0"
// noinspection DifferentKotlinGradleVersion
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
}
}


apply plugin: "com.android.library"
apply plugin: "kotlin-android"

apply plugin: "com.facebook.react"

def getExtOrIntegerDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["PortOneReactNativeSdk_" + name]).toInteger()
}

android {
namespace "io.portone.sdk.reactnative"

compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")

defaultConfig {
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
}

buildFeatures {
buildConfig true
}

buildTypes {
release {
minifyEnabled false
}
}

lintOptions {
disable "GradleCompatible"
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

sourceSets {
main {
java.srcDirs += [
"generated/java",
"generated/jni"
]
}
}
}

repositories {
mavenCentral()
google()
}

def kotlin_version = getExtOrDefault("kotlinVersion")

dependencies {
implementation "com.facebook.react:react-android"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}

react {
jsRootDir = file("../src/")
libraryName = "PortOneReactNativeSdk"
codegenJavaPackageName = "io.portone.sdk.reactnative"
}
5 changes: 5 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PortOneReactNativeSdk_kotlinVersion=2.1.20
PortOneReactNativeSdk_minSdkVersion=24
PortOneReactNativeSdk_targetSdkVersion=36
PortOneReactNativeSdk_compileSdkVersion=36
PortOneReactNativeSdk_ndkVersion=27.2.12479018
2 changes: 2 additions & 0 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
36 changes: 36 additions & 0 deletions android/src/main/kotlin/io/portone/sdk/reactnative/NativeModule.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package io.portone.sdk.reactnative

import android.content.ActivityNotFoundException
import android.content.Intent
import com.facebook.react.bridge.Promise
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.module.annotations.ReactModule
import java.net.URISyntaxException

@ReactModule(name = NativeModule.NAME)
class NativeModule(reactContext: ReactApplicationContext) : NativeModuleSpec(reactContext) {
override fun getName(): String = NAME

override fun startActivity(
uri: String,
promise: Promise,
) {
val intent = try {
Intent.parseUri(uri, 0)
} catch (e: URISyntaxException) {
promise.reject("URI_SYNTAX", e)
return
}
try {
reactApplicationContext.currentActivity!!.startActivity(intent)
} catch (e: ActivityNotFoundException) {
promise.reject("ACTIVITY_NOT_FOUND", e)
return
}
promise.resolve(Unit)
}

companion object {
const val NAME = "PortOneReactNativeSdkNativeModule"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package io.portone.sdk.reactnative

import com.facebook.react.BaseReactPackage
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.module.model.ReactModuleInfo
import com.facebook.react.module.model.ReactModuleInfoProvider

class NativePackage : BaseReactPackage() {
override fun getModule(
name: String,
reactContext: ReactApplicationContext
): com.facebook.react.bridge.NativeModule? =
if (name == NativeModule.NAME) NativeModule(reactContext) else null

override fun getReactModuleInfoProvider(): ReactModuleInfoProvider = ReactModuleInfoProvider {
mapOf(
NativeModule.NAME to ReactModuleInfo(
NativeModule.NAME,
NativeModule.NAME,
canOverrideExistingModule = false,
needsEagerInit = false,
isCxxModule = false,
isTurboModule = true,
)
)
}
}
1 change: 0 additions & 1 deletion app.plugin.js

This file was deleted.

5 changes: 0 additions & 5 deletions babel.config.js

This file was deleted.

12 changes: 12 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"overrides": [
{
"exclude": "\/node_modules\/",
"presets": ["module:react-native-builder-bob/babel-preset"]
},
{
"include": "\/node_modules\/",
"presets": ["module:@react-native/babel-preset"]
}
]
}
25 changes: 25 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { fixupConfigRules } from '@eslint/compat'
import { FlatCompat } from '@eslint/eslintrc'
import js from '@eslint/js'
import { defineConfig } from 'eslint/config'
import path from 'node:path'
import { fileURLToPath } from 'node:url'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
})

export default defineConfig({
ignores: [
'node_modules/',
'lib/'
],
extends: fixupConfigRules(compat.extends('@react-native', 'prettier')),
rules: {
'react/react-in-jsx-scope': 'off',
},
})
6 changes: 3 additions & 3 deletions lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ pre-commit:
commands:
lint:
glob: '*.{js,ts,jsx,tsx}'
run: npx eslint {staged_files}
run: pnpm exec eslint {staged_files}
types:
glob: '*.{js,ts, jsx, tsx}'
run: npx tsc -p tsconfig.json
run: pnpm exec tsc -p tsconfig.json
commit-msg:
parallel: true
commands:
commitlint:
run: npx commitlint --edit
run: pnpm exec commitlint --edit
Loading