Browse Source

Download to server

master
marcoschmickler 5 years ago
parent
commit
3c992ef82c
  1. 21
      Pods/WebBrowser/LICENSE.md
  2. 90
      Pods/WebBrowser/README.md
  3. 44
      Pods/WebBrowser/WebBrowser/InternationalControl.swift
  4. 39
      Pods/WebBrowser/WebBrowser/NavigationBarAppearance.swift
  5. 14
      Pods/WebBrowser/WebBrowser/Resources/LocalizedStrings/en.lproj/WebBrowser.strings
  6. 14
      Pods/WebBrowser/WebBrowser/Resources/LocalizedStrings/ja.lproj/WebBrowser.strings
  7. 14
      Pods/WebBrowser/WebBrowser/Resources/LocalizedStrings/ko.lproj/WebBrowser.strings
  8. 14
      Pods/WebBrowser/WebBrowser/Resources/LocalizedStrings/zh-Hans.lproj/WebBrowser.strings
  9. 14
      Pods/WebBrowser/WebBrowser/Resources/LocalizedStrings/zh-Hant.lproj/WebBrowser.strings
  10. 6
      Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/Contents.json
  11. 23
      Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/backIcon.imageset/Contents.json
  12. BIN
      Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/backIcon.imageset/backIcon.png
  13. BIN
      Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/backIcon.imageset/backIcon@2x.png
  14. BIN
      Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/backIcon.imageset/backIcon@3x.png
  15. 23
      Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/forwardIcon.imageset/Contents.json
  16. BIN
      Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/forwardIcon.imageset/forwardIcon.png
  17. BIN
      Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/forwardIcon.imageset/forwardIcon@2x.png
  18. BIN
      Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/forwardIcon.imageset/forwardIcon@3x.png
  19. 33
      Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/safariIcon.imageset/Contents.json
  20. BIN
      Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/safariIcon.imageset/safariIcon.png
  21. BIN
      Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/safariIcon.imageset/safariIcon@2x.png
  22. BIN
      Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/safariIcon.imageset/safariIcon@2x~iPad.png
  23. BIN
      Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/safariIcon.imageset/safariIcon@3x.png
  24. BIN
      Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/safariIcon.imageset/safariIcon~iPad.png
  25. 49
      Pods/WebBrowser/WebBrowser/SafariActivity.swift
  26. 30
      Pods/WebBrowser/WebBrowser/ToolbarAppearance.swift
  27. 38
      Pods/WebBrowser/WebBrowser/WebBrowser.swift
  28. 46
      Pods/WebBrowser/WebBrowser/WebBrowserDelegate.swift

21
Pods/WebBrowser/LICENSE.md

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 Teambition
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

90
Pods/WebBrowser/README.md

@ -0,0 +1,90 @@
# WebBrowser
A web browser using WebKit and written in Swift for iOS apps.
![Example](Gif/WebBrowserExample.gif "WebBrowserExample")
## How To Get Started
### Carthage
Specify "WebBrowser" in your ```Cartfile```:
```ogdl
github "teambition/WebBrowser"
```
### CocoaPods
Specify "WebBrowser" in your ```Podfile```:
```ruby
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'WebBrowser'
```
### Usage
#### Initialization
```swift
let webBrowserViewController = WebBrowserViewController()
// assign delegate
webBrowserViewController.delegate = self
webBrowserViewController.language = .english
webBrowserViewController.tintColor = ...
webBrowserViewController.barTintColor = ...
webBrowserViewController.isToolbarHidden = false
webBrowserViewController.isShowActionBarButton = true
webBrowserViewController.toolbarItemSpace = 50
webBrowserViewController.isShowURLInNavigationBarWhenLoading = true
webBrowserViewController.isShowPageTitleInNavigationBar = true
webBrowserViewController.customApplicationActivities = ...
webBrowserViewController.loadURLString("https://www.apple.com/cn/")
```
#### Pushing to the navigation stack
```swift
navigationController?.pushViewController(webBrowserViewController, animated: true)
```
#### Presenting modally
```swift
let navigationWebBrowser = WebBrowserViewController.rootNavigationWebBrowser(webBrowser: webBrowserViewController)
present(navigationWebBrowser, animated: true, completion: nil)
```
#### Implement the delegate
```swift
func webBrowser(_ webBrowser: WebBrowserViewController, didStartLoad url: URL?) {
// do something
}
func webBrowser(_ webBrowser: WebBrowserViewController, didFinishLoad url: URL?) {
// do something
}
func webBrowser(_ webBrowser: WebBrowserViewController, didFailLoad url: URL?, withError error: Error) {
// do something
}
func webBrowserWillDismiss(_ webBrowser: WebBrowserViewController) {
// do something
}
func webBrowserDidDismiss(_ webBrowser: WebBrowserViewController) {
// do something
}
```
## Minimum Requirement
iOS 8.0
## Localization
WebBrowser supports 5 languages: English, Simplified Chinese, Traditional Chinese, Korean, Japanese. You can set the language when initialization.
## Release Notes
* [Release Notes](https://github.com/teambition/WebBrowser/releases)
## License
WebBrowser is released under the MIT license. See [LICENSE](https://github.com/teambition/WebBrowser/blob/master/LICENSE.md) for details.
## More Info
Have a question? Please [open an issue](https://github.com/teambition/WebBrowser/issues/new)!

44
Pods/WebBrowser/WebBrowser/InternationalControl.swift

@ -0,0 +1,44 @@
//
// InternationalControl.swift
// WebBrowser
//
// Created by Xin Hong on 16/4/27.
// Copyright © 2016 Teambition. All rights reserved.
//
import Foundation
public enum WebBrowserLanguage {
case english
case simplifiedChinese
case traditionalChinese
case korean
case japanese
internal var identifier: String {
switch self {
case .english: return "en"
case .simplifiedChinese: return "zh-Hans"
case .traditionalChinese: return "zh-Hant"
case .korean: return "ko"
case .japanese: return "ja"
}
}
}
internal func LocalizedString(key: String, comment: String? = nil) -> String {
return InternationalControl.sharedControl.localizedString(key: key, comment: comment)
}
internal struct InternationalControl {
internal static var sharedControl = InternationalControl()
internal var language: WebBrowserLanguage = .english
internal func localizedString(key: String, comment: String? = nil) -> String {
guard let localizationPath = WebBrowser.localizationPath(forIdentifier: language.identifier) else {
return key
}
let bundle = Bundle(path: localizationPath)
return bundle?.localizedString(forKey: key, value: nil, table: "WebBrowser") ?? key
}
}

39
Pods/WebBrowser/WebBrowser/NavigationBarAppearance.swift

@ -0,0 +1,39 @@
//
// NavigationBarAppearance.swift
// WebBrowser
//
// Created by Xin Hong on 16/4/30.
// Copyright © 2016 Teambition. All rights reserved.
//
import UIKit
internal struct NavigationBarAppearance {
var isHidden = false
var tintColor = UIColor.blue
var barTintColor: UIColor?
var isTranslucent = true
var shadowImage: UIImage?
var backgroundImageForBarMetricsDefault: UIImage?
var backgroundImageForBarMetricsCompact: UIImage?
init() { }
init(navigationBar: UINavigationBar) {
tintColor = navigationBar.tintColor
barTintColor = navigationBar.barTintColor
isTranslucent = navigationBar.isTranslucent
shadowImage = navigationBar.shadowImage
backgroundImageForBarMetricsDefault = navigationBar.backgroundImage(for: .default)
backgroundImageForBarMetricsCompact = navigationBar.backgroundImage(for: .compact)
}
func apply(to navigationBar: UINavigationBar) {
navigationBar.tintColor = tintColor
navigationBar.barTintColor = barTintColor
navigationBar.isTranslucent = isTranslucent
navigationBar.shadowImage = shadowImage
navigationBar.setBackgroundImage(backgroundImageForBarMetricsDefault, for: .default)
navigationBar.setBackgroundImage(backgroundImageForBarMetricsCompact, for: .compact)
}
}

14
Pods/WebBrowser/WebBrowser/Resources/LocalizedStrings/en.lproj/WebBrowser.strings

@ -0,0 +1,14 @@
/*
WebBrowser.strings
WebBrowser
Created by Xin Hong on 16/4/27.
Copyright © 2016年 Teambition. All rights reserved.
*/
"Done" = "Done";
"Cancel" = "Cancel";
"Open" = "Open";
"OpenExternalAppAlert.title" = "Leave this app?";
"OpenExternalAppAlert.message" = "This web page is trying to open an outside app. Are you sure to open it?";
"Open in Safari" = "Open in Safari";

14
Pods/WebBrowser/WebBrowser/Resources/LocalizedStrings/ja.lproj/WebBrowser.strings

@ -0,0 +1,14 @@
/*
WebBrowser.strings
WebBrowser
Created by Xin Hong on 16/4/27.
Copyright © 2016年 Teambition. All rights reserved.
*/
"Done" = "完了";
"Cancel" = "キャンセル";
"Open" = "開く";
"OpenExternalAppAlert.title" = "離れるこの App?";
"OpenExternalAppAlert.message" = "このページこのページしようとして開くもうひとつApp, 確定開く?";
"Open in Safari" = "Safariで開く";

14
Pods/WebBrowser/WebBrowser/Resources/LocalizedStrings/ko.lproj/WebBrowser.strings

@ -0,0 +1,14 @@
/*
WebBrowser.strings
WebBrowser
Created by Xin Hong on 16/4/27.
Copyright © 2016年 Teambition. All rights reserved.
*/
"Done" = "완료";
"Cancel" = "취소";
"Open" = "열기";
"OpenExternalAppAlert.title" = "떠나다이 App?";
"OpenExternalAppAlert.message" = "이 페이지 애쓰고 있다 열기 다른 App, 확정 열기?";
"Open in Safari" = "Safari로 열기";

14
Pods/WebBrowser/WebBrowser/Resources/LocalizedStrings/zh-Hans.lproj/WebBrowser.strings

@ -0,0 +1,14 @@
/*
WebBrowser.strings
WebBrowser
Created by Xin Hong on 16/4/27.
Copyright © 2016年 Teambition. All rights reserved.
*/
"Done" = "完成";
"Cancel" = "取消";
"Open" = "打开";
"OpenExternalAppAlert.title" = "离开此应用?";
"OpenExternalAppAlert.message" = "此页面正试图打开另一个应用,确定要打开吗?";
"Open in Safari" = "在 Safari 中打开";

14
Pods/WebBrowser/WebBrowser/Resources/LocalizedStrings/zh-Hant.lproj/WebBrowser.strings

@ -0,0 +1,14 @@
/*
WebBrowser.strings
WebBrowser
Created by Xin Hong on 16/4/27.
Copyright © 2016年 Teambition. All rights reserved.
*/
"Done" = "完成";
"Cancel" = "取消";
"Open" = "打開";
"OpenExternalAppAlert.title" = "離開此App?";
"OpenExternalAppAlert.message" = "此頁面正試圖打開另一App,確定要打開嗎?";
"Open in Safari" = "在 Safari 中打開";

6
Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/Contents.json

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

23
Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/backIcon.imageset/Contents.json

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "backIcon.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "backIcon@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "backIcon@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

BIN
Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/backIcon.imageset/backIcon.png

After

Width: 22  |  Height: 22  |  Size: 1.2 KiB

BIN
Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/backIcon.imageset/backIcon@2x.png

After

Width: 44  |  Height: 44  |  Size: 1.6 KiB

BIN
Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/backIcon.imageset/backIcon@3x.png

After

Width: 66  |  Height: 66  |  Size: 1.9 KiB

23
Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/forwardIcon.imageset/Contents.json

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "forwardIcon.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "forwardIcon@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "forwardIcon@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

BIN
Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/forwardIcon.imageset/forwardIcon.png

After

Width: 22  |  Height: 22  |  Size: 1.3 KiB

BIN
Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/forwardIcon.imageset/forwardIcon@2x.png

After

Width: 44  |  Height: 44  |  Size: 1.6 KiB

BIN
Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/forwardIcon.imageset/forwardIcon@3x.png

After

Width: 66  |  Height: 66  |  Size: 1.9 KiB

33
Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/safariIcon.imageset/Contents.json

@ -0,0 +1,33 @@
{
"images" : [
{
"idiom" : "iphone",
"filename" : "safariIcon.png",
"scale" : "1x"
},
{
"idiom" : "iphone",
"filename" : "safariIcon@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"filename" : "safariIcon@3x.png",
"scale" : "3x"
},
{
"idiom" : "ipad",
"filename" : "safariIcon~iPad.png",
"scale" : "1x"
},
{
"idiom" : "ipad",
"filename" : "safariIcon@2x~iPad.png",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

BIN
Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/safariIcon.imageset/safariIcon.png

After

Width: 60  |  Height: 60  |  Size: 1.5 KiB

BIN
Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/safariIcon.imageset/safariIcon@2x.png

After

Width: 120  |  Height: 120  |  Size: 3.6 KiB

BIN
Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/safariIcon.imageset/safariIcon@2x~iPad.png

After

Width: 152  |  Height: 152  |  Size: 4.9 KiB

BIN
Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/safariIcon.imageset/safariIcon@3x.png

After

Width: 180  |  Height: 180  |  Size: 6.0 KiB

BIN
Pods/WebBrowser/WebBrowser/Resources/WebBrowser.xcassets/safariIcon.imageset/safariIcon~iPad.png

After

Width: 76  |  Height: 76  |  Size: 2.1 KiB

49
Pods/WebBrowser/WebBrowser/SafariActivity.swift

@ -0,0 +1,49 @@
//
// SafariActivity.swift
// WebBrowser
//
// Created by Xin Hong on 16/4/27.
// Copyright © 2016 Teambition. All rights reserved.
//
import UIKit
open class SafariActivity: UIActivity {
open var url: URL?
open override var activityType: UIActivity.ActivityType? {
return ActivityType(String(describing: self))
}
open override var activityTitle : String? {
return LocalizedString(key: "Open in Safari")
}
open override var activityImage : UIImage? {
return WebBrowser.image(named: "safariIcon")
}
open override func canPerform(withActivityItems activityItems: [Any]) -> Bool {
for activityItem in activityItems {
if let activityURL = activityItem as? URL {
return UIApplication.shared.canOpenURL(activityURL)
}
}
return false
}
open override func prepare(withActivityItems activityItems: [Any]) {
for activityItem in activityItems {
if let activityURL = activityItem as? URL {
url = activityURL
}
}
}
open override func perform() {
if let url = url {
let completed = UIApplication.shared.openURL(url)
activityDidFinish(completed)
}
}
}

30
Pods/WebBrowser/WebBrowser/ToolbarAppearance.swift

@ -0,0 +1,30 @@
//
// ToolbarAppearance.swift
// WebBrowser
//
// Created by Xin Hong on 16/4/30.
// Copyright © 2016 Teambition. All rights reserved.
//
import UIKit
internal struct ToolbarAppearance {
var isHidden = true
var tintColor = UIColor.blue
var barTintColor: UIColor?
var isTranslucent = true
init() { }
init(toolbar: UIToolbar) {
tintColor = toolbar.tintColor
barTintColor = toolbar.barTintColor
isTranslucent = toolbar.isTranslucent
}
func apply(to toolbar: UIToolbar) {
toolbar.tintColor = tintColor
toolbar.barTintColor = barTintColor
toolbar.isTranslucent = isTranslucent
}
}

38
Pods/WebBrowser/WebBrowser/WebBrowser.swift

@ -0,0 +1,38 @@
//
// WebBrowser.swift
// WebBrowser
//
// Created by Xin Hong on 16/4/27.
// Copyright © 2016 Teambition. All rights reserved.
//
import UIKit
internal struct WebBrowser {
static let estimatedProgressKeyPath = "estimatedProgress"
static var estimatedProgressContext = 0
static let defaultToolbarItemSpace: CGFloat = 50
static var resourceBundleURL: URL? {
let resourceBundleURL = Bundle(for: WebBrowserViewController.self).url(forResource: "WebBrowser", withExtension: "bundle")
return resourceBundleURL
}
static func localizationPath(forIdentifier identifier: String) -> String? {
if let path = Bundle(identifier: "Teambition.WebBrowser")?.path(forResource: identifier, ofType: "lproj") {
return path
} else if let resourceBundleURL = resourceBundleURL, let resourceBundle = Bundle(url: resourceBundleURL) {
return resourceBundle.path(forResource: identifier, ofType: "lproj")
}
return nil
}
static func image(named name: String) -> UIImage? {
if let image = UIImage(named: name, in: Bundle(for: WebBrowserViewController.self), compatibleWith: nil) {
return image
} else if let resourceBundleURL = resourceBundleURL, let resourceBundle = Bundle(url: resourceBundleURL) {
return UIImage(named: name, in: resourceBundle, compatibleWith: nil)
}
return nil
}
}

46
Pods/WebBrowser/WebBrowser/WebBrowserDelegate.swift

@ -0,0 +1,46 @@
//
// WebBrowserDelegate.swift
// WebBrowser
//
// Created by Xin Hong on 16/4/26.
// Copyright © 2016 Teambition. All rights reserved.
//
import UIKit
import WebKit
public protocol WebBrowserDelegate: class {
func webBrowser(_ webBrowser: WebBrowserViewController, didStartLoad url: URL?)
func webBrowser(_ webBrowser: WebBrowserViewController, didFinishLoad url: URL?)
func webBrowser(_ webBrowser: WebBrowserViewController, didFailLoad url: URL?, withError error: Error)
func webBrowserWillDismiss(_ webBrowser: WebBrowserViewController)
func webBrowserDidDismiss(_ webBrowser: WebBrowserViewController)
func webBrowser(_ webBrowser: WebBrowserViewController, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) -> Bool
}
public extension WebBrowserDelegate {
func webBrowser(_ webBrowser: WebBrowserViewController, didStartLoad url: URL?) {
}
func webBrowser(_ webBrowser: WebBrowserViewController, didFinishLoad url: URL?) {
}
func webBrowser(_ webBrowser: WebBrowserViewController, didFailLoad url: URL?, withError error: Error) {
}
func webBrowserWillDismiss(_ webBrowser: WebBrowserViewController) {
}
func webBrowserDidDismiss(_ webBrowser: WebBrowserViewController) {
}
func webBrowser(_ webBrowser: WebBrowserViewController, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) -> Bool {
return false
}
}
Loading…
Cancel
Save