Skip to content

Commit

Permalink
1.0.3 publish
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyun-J committed Jan 27, 2022
1 parent 8412924 commit 2482dc4
Show file tree
Hide file tree
Showing 12 changed files with 1,559 additions and 1,412 deletions.
4 changes: 2 additions & 2 deletions FlexHybridApp.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
Pod::Spec.new do |spec|

spec.name = "FlexHybridApp"
spec.version = "1.0.2"
spec.version = "1.0.3"
spec.summary = "FlexibleHybridApp-iOS"
spec.ios.deployment_target = '10.0'
spec.swift_version = '5.5.1'
spec.swift_version = '5.5.2'
spec.author = { "Kyun-J" => "[email protected]" }
spec.source = { :git => "https://github.com/Kyun-J/FlexHybridApp-iOS.git", :tag => "#{spec.version}" }
spec.license = { :type => "BSD", :file => "license" }
Expand Down
33 changes: 18 additions & 15 deletions README-ko.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Android Version](https://github.com/Kyun-J/FlexHybridApp-Android)

[Typescript Support](https://github.com/Kyun-J/FlexHybridApp-Script)
[Typescript Support](https://github.com/Kyun-J/FlexHybridApp-Scripts)

# FlexibleHybrid

Expand All @@ -15,7 +15,7 @@ Podfile에 다음을 추가
pod 'FlexHybridApp'
```

***iOS Deployment Target은 10.0 입니다.***
**_iOS Deployment Target은 10.0 입니다._**

# Flex 프레임워크 주요 특징

Expand Down Expand Up @@ -112,7 +112,7 @@ component.evalFlexFunc("funcName", "sendData") { response in
## FlexData

Web에서 전달받은 데이터는 TypeSafe하게 불러오기 위하여 FlexData 객체로 변환됩니다.
Web to native 인터페이스시, Web의 함수에서 전달하는 Arguments들은 Array\<FlexData\>로 전달됩니다.
Web to native 인터페이스시, Web의 함수에서 전달하는 Arguments들은 Array\<FlexData\>로 전달됩니다.

```js
// in js
Expand Down Expand Up @@ -142,7 +142,6 @@ component.setInterface("funcName") { args in
2. Web에서는 Object 형태로 변환됩니다.
3. Native에서 Model Object를 Arguments로 받을 때는, Web에서 해당 Model에 대응되는 Object 하나만 전달해야 합니다.


```swift
// in swift
struct TestModel: Codable {
Expand Down Expand Up @@ -196,7 +195,7 @@ component.setAction("actionTest") { (action, _) in
self.getLocation()
}

func getLocation() {
func getLocation() {
let status = CLLocationManager.authorizationStatus()
var locationResult = LocationResult();
switch status {
Expand Down Expand Up @@ -308,37 +307,40 @@ component.setBaseUrl(".*.myurl.com")

### AllowUrlList

AllowUrlList을 설정하면, 설정된 url들과 BaseUrl을 제외한 모든 url의 접근이 차단됩니다.
**iOS 11.0 이상에서만 사용할 수 있습니다.**

AllowUrlList을 설정하면, 설정된 url들과 BaseUrl을 제외한 모든 url의 접근이 차단됩니다.

```swift
component.setAllowUrl(".*.myurl.com")
component.addAllowUrl(".*.myurl.com")
```

URL설정 시 인터페이스를 허용하려면 setAllowUrl함수의 두번째 canFlexLoad 프로퍼티에 true를 추가하면 됩니다.

```swift
component.setAllowUrl(".*.myurl.com", canFlexLoad: true)
component.addAllowUrl(".*.myurl.com", canFlexLoad: true)
```

## cookie 유지

**iOS 11.0 이상에서만 사용할 수 있습니다.**
**이 기능은 아주 기본적인 기능으로, 문제 발생시 직접 cookie 관련 기능을 구현하여 사용하시기 바랍니다.**
**이 기능은 아주 기본적인 기능으로, 문제 발생시 직접 cookie 관련 기능을 구현하여 사용하시기 바랍니다.**

쿠키를 자동으로 유지하는 기능입니다.
기본값은 비활성이며, 기능 활성 시 자동으로 동작합니다.
앱 내에 해당 기능이 활성화된 FlexWebView들은 모든 쿠키를 공유합니다.

```swift
component.setAutoCookieManage(true) // activate
component.setAutoCookieManage(true, clearAll: true) // activate and delete all cookies
component.setAutoCookieManage(true, clearAll: true) // activate and delete all cookies
```

## Web console 메시지 출력
web의 console.log, debug, error, info의 메시지를 xcode의 output창에 표시합니다.
기본값으로 활성화되어 있습니다.

**이 출력은 web의 console 메시지와 같지 않을 수 있습니다.**
web의 console.log, debug, error, info, warn의 메시지를 xcode의 output창에 표시합니다.
기본값으로 활성화되어 있습니다.

**이 출력은 web의 console 메시지와 같지 않을 수 있습니다.**

```swift
component.setShowWebViewConsole(true)
Expand Down Expand Up @@ -372,7 +374,8 @@ $flex.isAndroid; // false
$flex.isiOS; // true
$fles.isScript; // false
```

# ToDo

swift5.5 이상에서 async await 적용
Flutter 버전 FlexHybirdApp
Flutter 버전 FlexHybirdApp
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Add in Podfile
pod 'FlexHybridApp'
```

***iOS Deployment Target is 10.0***
**_iOS Deployment Target is 10.0_**

# Key Features

Expand All @@ -31,7 +31,6 @@ Add in Podfile

and include other features...


## FlexComponent

To utilize the features of FlexWebView, you must use FlexComponent.
Expand Down Expand Up @@ -145,7 +144,6 @@ At this time, the following rules apply.
2. In the Web, it is converted into an object form.
3. When receiving Model Objects from Native as Arguments, you must deliver only one object corresponding to that model on the Web.


```swift
// in swift
struct TestModel: Codable {
Expand Down Expand Up @@ -199,7 +197,7 @@ component.setAction("actionTest") { (action, _) in
self.getLocation()
}

func getLocation() {
func getLocation() {
let status = CLLocationManager.authorizationStatus()
var locationResult = LocationResult();
switch status {
Expand Down Expand Up @@ -311,16 +309,18 @@ component.setBaseUrl(".*.myurl.com")

### AllowUrlList

**Only available for iOS 11.0 and above.**

Setting the AllowUrlList blocks access to all url except for the set url and BaseUrl.

```swift
component.setAllowUrl(".*.myurl.com")
component.addAllowUrl(".*.myurl.com")
```

To allow an interface when setting up a URL, add true to the second canFlexLoad property of the setAllowUrl function.
To allow an interface when setting up a URL, add true to the second canFlexLoad property of the addAllowUrl function.

```swift
component.setAllowUrl(".*.myurl.com", canFlexLoad: true)
component.addAllowUrl(".*.myurl.com", canFlexLoad: true)
```

## Automanage cookie
Expand All @@ -333,12 +333,13 @@ FlexWebViews with that feature enabled in the app share all cookies.

```swift
component.setAutoCookieManage(true) // activate
component.setAutoCookieManage(true, clearAll: true) // activate and delete all cookies
component.setAutoCookieManage(true, clearAll: true) // activate and delete all cookies
```

## Web console message output.
Displays messages from web console.log, debug, error, and info in the output window of xcode.
It is activated by default.

Displays messages from web console.log, debug, error, warn, and info in the output window of xcode.
It is activated by default.

**This output may not be the same as the console message on web.**

Expand Down Expand Up @@ -374,6 +375,7 @@ $flex.isAndroid; // false
$flex.isiOS; // true
$fles.isScript; // false
```

# ToDo

Apply async awit from Swift 5.5.
Expand Down
4 changes: 2 additions & 2 deletions demo/flex-demo/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ class ViewController: UIViewController, WKNavigationDelegate, WKScriptMessageHan

// setBaseUrl
component.setBaseUrl("file://")
component.setAllowUrl(".*.facebook.com", canFlexLoad: false)
component.setAllowUrl(".*.google.com", canFlexLoad: true)
component.addAllowUrl(".*.facebook.com", canFlexLoad: false)
component.addAllowUrl(".*.google.com", canFlexLoad: true)
component.setInterfaceTimeout(0)
// component.setFlexOnloadWait(0)
component.setAllowsUrlAccessInFile(true)
Expand Down
168 changes: 86 additions & 82 deletions demo/flex-demo/test.html
Original file line number Diff line number Diff line change
@@ -1,104 +1,108 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, minimal-ui,, viewport-fit=cover, user-scalable=no"
/>
<script type="application/javascript" src="https://unpkg.com/vconsole/dist/vconsole.min.js"></script>
<script
type="application/javascript"
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/script.min.js"
></script>
</head>
<script type="text/javascript">
let t = 0;
const t1 = async () => {
console.log('Send to Native --- ' + t);
<script>
let t = 0;
const t1 = async () => {
console.log("Send to Native --- " + t);
const z = await $flex.test1(t);
console.log('Return by Native with t1 --- ' + z);
console.log("Return by Native with t1 --- " + z);
t = z;
}
const t2 = async () => {
await $flex.test2();
}
const t3 = async () => {
};
const t2 = async () => {
await $flex.test2();
};
const t3 = async () => {
const z = await $flex.testAction();
console.log(z); // {key1: "value1", key2: {subkey2: 1000.1, subkey1: ["dictionaryValue", 0.12]}, key3: ["arrayValue1", null], key4: true}
console.log(typeof z) // Object
}
const t4 = async () => {
console.log(typeof z); // Object
};
const t4 = async () => {
try {
const z = await $flex.testReject1();
const z = await $flex.testReject1();
} catch (e) {
console.log("testReject1");
console.log(e);
console.log("testReject1");
console.log(e);
}
}
const t5 = async () => {
};
const t5 = async () => {
try {
const z = await $flex.testReject2();
const z = await $flex.testReject2();
} catch (e) {
console.log("testReject2");
console.log(e);
console.log("testReject2");
console.log(e);
}
}
const t6 = async () => {
const z = await $flex.testReceive({ "d1": 10, "d2": { "data": true } });
};
const t6 = async () => {
const z = await $flex.testReceive({ d1: 10, d2: { data: true } });
console.log(z);
}
const t7 = async () => {
};
const t7 = async () => {
await $flex.modelTest1({ string: "string test", integer: 0 });
}
const t8 = async () => {
await $flex.modelTest2({ array: ["array"], dic: { dic: "dictionary" }, model: { bool: false } });
}
const t9 = async () => {
};
const t8 = async () => {
await $flex.modelTest2({
array: ["array"],
dic: { dic: "dictionary" },
model: { bool: false },
});
};
const t9 = async () => {
const z = await $flex.modelTest3();
console.log(z);
}
const t10 = () => {
window.location.href = "https://google.com";
};
const t11 = () => {
window.location.href = "https://facebook.com";
};
const t12 = () => {
window.location.href = "https://microsoft.com";
};
$flex.web.help = function(data) {
console.log('Received by Native ---- ' + String(data));
return Promise.resolve(['Thanks Flex!', false])
}
$flex.web.directTest = () => {
console.log('direct test!!!!');
}
// when $flex on ready.....
window.onFlexLoad = function() {
console.log('Flex Load Success!!');
}
</script>
<body style="width: 100%; height: 450px;">
<button onclick='t1()' style="width: 100%; height: 50px;">test1</button>
<button onclick='t2()' style="width: 100%; height: 50px;">test2</button>
<button onclick='t3()' style="width: 100%; height: 50px;">testAction</button>
<button onclick='t4()' style="width: 100%; height: 50px;">testReject1</button>
<button onclick='t5()' style="width: 100%; height: 50px;">testReject2</button>
<button onclick='t6()' style="width: 100%; height: 50px;">testReceive</button>
<button onclick='t7()' style="width: 100%; height: 50px;">modelTest1</button>
<button onclick='t8()' style="width: 100%; height: 50px;">modelTest2</button>
<button onclick='t9()' style="width: 100%; height: 50px;">modelTest3</button>
<button onclick="t10()" style="width: 100%; height: 50px">
AllowUrl Test(google)
</button>
<button onclick="t11()" style="width: 100%; height: 50px">
AllowUrl Test(facebook)
</button>
<button onclick="t12()" style="width: 100%; height: 50px">
AllowUrl Test(microsoft)
</button>
<iframe src="./frame.html"></iframe>
</body>
};
const t10 = () => {
window.location.href = "https://google.com";
};
const t11 = () => {
window.location.href = "https://facebook.com";
};
const t12 = () => {
window.location.href = "https://microsoft.com";
};
// when $flex on ready.....
window.onFlexLoad = function () {
console.log("Flex Load Success!!");
$flex.web.help = function (data) {
console.log("Received by Native ---- " + String(data));
return Promise.resolve(["Thanks Flex!", false]);
};
$flex.web.directTest = () => {
console.log("direct test!!!!");
};
};
</script>
</head>
<body style="width: 100%; height: 450px">
<button onclick="t1()" style="width: 100%; height: 50px">test1</button>
<button onclick="t2()" style="width: 100%; height: 50px">test2</button>
<button onclick="t3()" style="width: 100%; height: 50px">testAction</button>
<button onclick="t4()" style="width: 100%; height: 50px">
testReject1
</button>
<button onclick="t5()" style="width: 100%; height: 50px">
testReject2
</button>
<button onclick="t6()" style="width: 100%; height: 50px">
testReceive
</button>
<button onclick="t7()" style="width: 100%; height: 50px">modelTest1</button>
<button onclick="t8()" style="width: 100%; height: 50px">modelTest2</button>
<button onclick="t9()" style="width: 100%; height: 50px">modelTest3</button>
<button onclick="t10()" style="width: 100%; height: 50px">
AllowUrl Test(google)
</button>
<button onclick="t11()" style="width: 100%; height: 50px">
AllowUrl Test(facebook)
</button>
<button onclick="t12()" style="width: 100%; height: 50px">
AllowUrl Test(microsoft)
</button>
<iframe src="./frame.html"></iframe>
</body>
</html>

Loading

0 comments on commit 2482dc4

Please sign in to comment.