Skip to content

Commit

Permalink
Merge branch 'release/0.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffGuKang committed Jul 10, 2017
2 parents f5f0868 + 44280ea commit 3214f20
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 11 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ app_scheme는 IAmPort 모듈에 정의할 것을 입력한다. (아래 Example

### AndroidManifest.xml 추가

리엑트 네이티브 안드로이드 환경에서는 manifest상에 redirect를 위한 **appscheme을 등록하지 않습니다.**

```
<activity
android:name=".MainActivity"
Expand All @@ -95,7 +97,7 @@ app_scheme는 IAmPort 모듈에 정의할 것을 입력한다. (아래 Example
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="yourappscheme" />
<data android:scheme="" /> <-- iOS와 달리 파라미터에 사용된 appscheme을 등록하지 않습니다.
</intent-filter>
</activity>
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,16 @@ else if(pg.equals("kakao")){
view.setWebViewClient(new KakaoWebViewClient(activity, view));
}
else if(pg.equals("payco")){
PaycoWebViewClient webViewClient = new PaycoWebViewClient(activity, view, new UrlLoadingCallBack() {

view.setWebViewClient(new PaycoWebViewClient(activity, view));
@Override
public void shouldOverrideUrlLoadingCallBack(String s) {
Log.i("iamport", "shouldOverrideUrlLoadingCallBack - " + s);
emitPaymentEvent(s, s, s);
}

});
view.setWebViewClient(webViewClient);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ public void bankPayPostProcess(String bankpayCode, String bankpayValue) {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {

// TODO: emit event
Log.i("iamport", "shouldOverrideUrlLoading: " + url);
mCallBack.shouldOverrideUrlLoadingCallBack(url);
// TODO: emit event
Log.i("iamport", "shouldOverrideUrlLoading: " + url);
mCallBack.shouldOverrideUrlLoadingCallBack(url);

if (!url.startsWith("http://") && !url.startsWith("https://") && !url.startsWith("javascript:")) {
Intent intent = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,25 @@

import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import com.jeongjuwon.iamport.UrlLoadingCallBack;

public class PaycoWebViewClient extends WebViewClient {

private Activity activity;
UrlLoadingCallBack mCallBack;

public PaycoWebViewClient(Activity activity, WebView target) {
public PaycoWebViewClient(Activity activity, WebView target, UrlLoadingCallBack callBack) {
this.activity = activity;
this.mCallBack = callBack;
}

@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {

// TODO: emit event
Log.i("iamport", "shouldOverrideUrlLoading: " + url);
mCallBack.shouldOverrideUrlLoadingCallBack(url);

if (!url.startsWith("http://") && !url.startsWith("https://") && !url.startsWith("javascript:")) {
Intent intent = null;

Expand Down
11 changes: 7 additions & 4 deletions index.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class IAmPort extends Component {

componentDidMount() {

DeviceEventEmitter.addListener('paymentEvent', this._onShouldStartLoadWithRequest.bind(this));
DeviceEventEmitter.addListener('paymentEvent', this.paymentEvent.bind(this));
}

componentWillUnmount() {
Expand All @@ -33,14 +33,17 @@ class IAmPort extends Component {
return decodeURIComponent(results[2].replace(/\+/g, " "));
}

_onShouldStartLoadWithRequest(e) {
paymentEvent(e) {

var url = e.result;
var me = this;
var original = e;

//TODO delete
// console.log("onShouldStartLoadWithRequest", e);
console.log("paymentEvent", e);
if (e.result == "success" || e.result == "failed") {
this.props.onPaymentResultReceive(e);
}

var imp_uid = this.getParameterByName("imp_uid", url),
merchant_uid = this.getParameterByName("merchant_uid", url),
Expand Down Expand Up @@ -98,7 +101,7 @@ class IAmPort extends Component {
return;
}
iamport.receiveResult(rsp.success ? "success" : "failure", rsp.imp_uid, rsp.merchant_uid);
iamport.receiveResult(rsp.success ? "success" : "failed", rsp.imp_uid, rsp.merchant_uid);
});
</script>
</body>
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
{
"name": "Jeong Juwon",
"email": "[email protected]"
},
{
"name": "Jeff Gu Kang",
"email": "[email protected]"
}
],
"name": "react-native-iamport",
Expand All @@ -38,5 +42,5 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"version": "0.2.0"
"version": "0.2.1"
}

0 comments on commit 3214f20

Please sign in to comment.