-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* response and toolbar in rtl languages issue fixed * body aligment in search mode fixed * body issue on dark mode fixed Co-authored-by: Arash Goodarzi <[email protected]> Co-authored-by: Arash Goodarzi <[email protected]>
- Loading branch information
1 parent
584abc1
commit c5c9838
Showing
4 changed files
with
119 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Arash on 9/14/22. | ||
// | ||
|
||
import UIKit | ||
import SafariServices | ||
|
||
struct JSONValidatorOnline { | ||
|
||
func open(jsonString: String?, on vc: UIViewController) { | ||
guard let jsonString = jsonString, | ||
let encodedJson = jsonString.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) | ||
else { | ||
print("NetShears - jsonString not received") | ||
return | ||
} | ||
let base = "https://jsoneditoronline.org/#left=json." | ||
let mode = "&mode=tree" | ||
let url = base + encodedJson + mode | ||
openBrowser(for: url, on: vc) | ||
} | ||
|
||
private func openBrowser(for url: String, on vc: UIViewController) { | ||
guard #available(iOS 11.0, *) else { | ||
print("NetShears - iOS version not supported") | ||
return | ||
} | ||
let config = SFSafariViewController.Configuration() | ||
config.entersReaderIfAvailable = true | ||
guard let url = URL(string: url) else { | ||
print("NetShears - invalid url") | ||
return | ||
} | ||
let browserVc = SFSafariViewController(url: url, configuration: config) | ||
vc.present(browserVc, animated: true) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters