Browse Source

downloads working

master
boB Rudis 3 months ago
parent
commit
bb9e9d1d0c
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
15 changed files with 323 additions and 29 deletions
  1. +1
    -1
      Pods/Pods.xcodeproj/xcuserdata/hrbrmstr.xcuserdatad/xcschemes/Just.xcscheme
  2. +1
    -1
      Pods/Pods.xcodeproj/xcuserdata/hrbrmstr.xcuserdatad/xcschemes/Pods-RSwitch.xcscheme
  3. +17
    -1
      RSwitch.xcodeproj/project.pbxproj
  4. +1
    -1
      RSwitch.xcodeproj/xcshareddata/xcschemes/RSwitch.xcscheme
  5. BIN
      RSwitch.xcworkspace/xcuserdata/hrbrmstr.xcuserdatad/UserInterfaceState.xcuserstate
  6. +36
    -2
      RSwitch/Base.lproj/Main.storyboard
  7. +51
    -0
      RSwitch/Swift/Downloaders/DownloadFromRStudioServer.swift
  8. +22
    -0
      RSwitch/Swift/ExportWebViewController.swift
  9. +8
    -8
      RSwitch/Swift/MenuActions/BrowseMenuAction.swift
  10. +36
    -9
      RSwitch/Swift/RStudioServerSessionWebViewController.swift
  11. +26
    -0
      RSwitch/Swift/Utils/urls.swift
  12. +104
    -0
      RSwitch/Swift/exportPopupViewController.swift
  13. +17
    -2
      RSwitch/Swift/plotPopupViewController.swift
  14. +3
    -4
      guide/index.Rmd
  15. BIN
      guide/r-macos-downloads.png

+ 1
- 1
Pods/Pods.xcodeproj/xcuserdata/hrbrmstr.xcuserdatad/xcschemes/Just.xcscheme View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1140"
LastUpgradeVersion = "1150"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"


+ 1
- 1
Pods/Pods.xcodeproj/xcuserdata/hrbrmstr.xcuserdatad/xcschemes/Pods-RSwitch.xcscheme View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1140"
LastUpgradeVersion = "1150"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"


+ 17
- 1
RSwitch.xcodeproj/project.pbxproj View File

@@ -47,6 +47,10 @@
01FC5D02232874F600771CD7 /* ToolbarWebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01FC5CFE232874F600771CD7 /* ToolbarWebViewController.swift */; };
01FC5D03232874F600771CD7 /* RStudioServerSessionWebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01FC5CFF232874F600771CD7 /* RStudioServerSessionWebViewController.swift */; };
01FC5D04232874F600771CD7 /* PlotWebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01FC5D00232874F600771CD7 /* PlotWebViewController.swift */; };
01FC6E97247B0AB60091AC87 /* exportPopupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01FC6E96247B0AB60091AC87 /* exportPopupViewController.swift */; };
01FC6E99247B0AF80091AC87 /* urls.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01FC6E98247B0AF80091AC87 /* urls.swift */; };
01FC6E9B247B0B370091AC87 /* ExportWebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01FC6E9A247B0B370091AC87 /* ExportWebViewController.swift */; };
01FC6E9D247B2FF80091AC87 /* DownloadFromRStudioServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01FC6E9C247B2FF80091AC87 /* DownloadFromRStudioServer.swift */; };
52B8A14237DA712A6A2ABDE0 /* Pods_RSwitch.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E2F8556B6C8EF8ED93F7E99 /* Pods_RSwitch.framework */; };
C4290DD6231F190F00AA5955 /* AppMenuActions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4290DD5231F190E00AA5955 /* AppMenuActions.swift */; };
/* End PBXBuildFile section */
@@ -118,6 +122,10 @@
01FC5CFE232874F600771CD7 /* ToolbarWebViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToolbarWebViewController.swift; sourceTree = "<group>"; };
01FC5CFF232874F600771CD7 /* RStudioServerSessionWebViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RStudioServerSessionWebViewController.swift; sourceTree = "<group>"; };
01FC5D00232874F600771CD7 /* PlotWebViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PlotWebViewController.swift; sourceTree = "<group>"; };
01FC6E96247B0AB60091AC87 /* exportPopupViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = exportPopupViewController.swift; sourceTree = "<group>"; };
01FC6E98247B0AF80091AC87 /* urls.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = urls.swift; sourceTree = "<group>"; };
01FC6E9A247B0B370091AC87 /* ExportWebViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExportWebViewController.swift; sourceTree = "<group>"; };
01FC6E9C247B2FF80091AC87 /* DownloadFromRStudioServer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DownloadFromRStudioServer.swift; sourceTree = "<group>"; };
0E2F8556B6C8EF8ED93F7E99 /* Pods_RSwitch.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RSwitch.framework; sourceTree = BUILT_PRODUCTS_DIR; };
53FF56D90FA7100C1726A4F7 /* Pods-RSwitch.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RSwitch.debug.xcconfig"; path = "Target Support Files/Pods-RSwitch/Pods-RSwitch.debug.xcconfig"; sourceTree = "<group>"; };
574911021B3B7938E36AB013 /* Pods-RSwitch.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RSwitch.release.xcconfig"; path = "Target Support Files/Pods-RSwitch/Pods-RSwitch.release.xcconfig"; sourceTree = "<group>"; };
@@ -158,6 +166,8 @@
0178970C230ED25100F8F5BC /* AboutViewController.swift */,
01FC5CFD232874F500771CD7 /* plotPopupViewController.swift */,
01FC5D00232874F600771CD7 /* PlotWebViewController.swift */,
01FC6E96247B0AB60091AC87 /* exportPopupViewController.swift */,
01FC6E9A247B0B370091AC87 /* ExportWebViewController.swift */,
01FC5CFF232874F600771CD7 /* RStudioServerSessionWebViewController.swift */,
01FC5CFE232874F600771CD7 /* ToolbarWebViewController.swift */,
01073F202311E6BD007162C9 /* HandleRSwitch.swift */,
@@ -233,6 +243,7 @@
children = (
01073F1A2311E613007162C9 /* DownloadTarball.swift */,
01073F1C2311E64E007162C9 /* DownloadRStudio.swift */,
01FC6E9C247B2FF80091AC87 /* DownloadFromRStudioServer.swift */,
);
path = Downloaders;
sourceTree = "<group>";
@@ -242,6 +253,7 @@
children = (
01073F182311E3B8007162C9 /* Bundle.swift */,
01073F122311E1CF007162C9 /* Globals.swift */,
01FC6E98247B0AF80091AC87 /* urls.swift */,
0117C9DF232270F0004BC889 /* RStudioUtils.swift */,
01975549231BD919003FAD7B /* RVersions.swift */,
0198B9A923197D3A003F7578 /* Running.swift */,
@@ -374,7 +386,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1140;
LastUpgradeCheck = 1140;
LastUpgradeCheck = 1150;
ORGANIZATIONNAME = "Bob Rudis";
TargetAttributes = {
01575A33245443D7004A5715 = {
@@ -498,16 +510,20 @@
01073F152311E370007162C9 /* Notify.swift in Sources */,
C4290DD6231F190F00AA5955 /* AppMenuActions.swift in Sources */,
01FC5D03232874F600771CD7 /* RStudioServerSessionWebViewController.swift in Sources */,
01FC6E9D247B2FF80091AC87 /* DownloadFromRStudioServer.swift in Sources */,
01073F1D2311E64E007162C9 /* DownloadRStudio.swift in Sources */,
01073F172311E397007162C9 /* Menu.swift in Sources */,
01F3EF0E230E635300DF5DF9 /* ViewController.swift in Sources */,
01FC6E97247B0AB60091AC87 /* exportPopupViewController.swift in Sources */,
01FC5D04232874F600771CD7 /* PlotWebViewController.swift in Sources */,
01A4F40C23F30DB4005B88C2 /* Associations.swift in Sources */,
01F3EF0C230E635300DF5DF9 /* AppDelegate.swift in Sources */,
01FC6E9B247B0B370091AC87 /* ExportWebViewController.swift in Sources */,
01FC5D01232874F600771CD7 /* plotPopupViewController.swift in Sources */,
01D3E441232131F300E3BC02 /* RStudioServerSessionManager.swift in Sources */,
01B611EC232176A200432807 /* NewSessionViewController.swift in Sources */,
01073F0F2311AE2E007162C9 /* String+Version.swift in Sources */,
01FC6E99247B0AF80091AC87 /* urls.swift in Sources */,
0198B99E23196689003F7578 /* BrowseMenuAction.swift in Sources */,
01FC5D02232874F600771CD7 /* ToolbarWebViewController.swift in Sources */,
01073F132311E1CF007162C9 /* Globals.swift in Sources */,


+ 1
- 1
RSwitch.xcodeproj/xcshareddata/xcschemes/RSwitch.xcscheme View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1140"
LastUpgradeVersion = "1150"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"


BIN
RSwitch.xcworkspace/xcuserdata/hrbrmstr.xcuserdatad/UserInterfaceState.xcuserstate View File


+ 36
- 2
RSwitch/Base.lproj/Main.storyboard View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="16085" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="16097" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="16085"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="16097"/>
<capability name="System colors introduced in macOS 10.14" minToolsVersion="10.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
@@ -943,6 +943,40 @@ Just by Daniel Duan</string>
</objects>
<point key="canvasLocation" x="1543" y="1669"/>
</scene>
<!--Window Controller-->
<scene sceneID="EW7-BM-Jxb">
<objects>
<windowController storyboardIdentifier="exportPopupPanel" id="VkT-PO-mgW" customClass="ExportWebViewController" customModule="RSwitch" customModuleProvider="target" sceneMemberID="viewController">
<window key="window" title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="jld-Yw-4I9" customClass="NSPanel">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="425" y="470" width="480" height="270"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1440"/>
<connections>
<outlet property="delegate" destination="VkT-PO-mgW" id="Kk8-u6-crK"/>
</connections>
</window>
<connections>
<segue destination="Emi-lu-BKC" kind="relationship" relationship="window.shadowedContentViewController" id="Zko-qD-0ow"/>
</connections>
</windowController>
<customObject id="ewW-uJ-OlL" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2423" y="406"/>
</scene>
<!--Export Popup View Controller-->
<scene sceneID="2dv-Ig-duI">
<objects>
<viewController id="Emi-lu-BKC" customClass="exportPopupViewController" customModule="RSwitch" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" id="ta8-41-7dT">
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
<autoresizingMask key="autoresizingMask"/>
</view>
</viewController>
<customObject id="RCl-OA-PEF" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2382" y="1492"/>
</scene>
<!--Rstudio Server Session Web View Controller-->
<scene sceneID="g2O-De-dmv">
<objects>


+ 51
- 0
RSwitch/Swift/Downloaders/DownloadFromRStudioServer.swift View File

@@ -0,0 +1,51 @@
//
// DownloadFromRStudioServer.swift
// RSwitch
//
// Created by hrbrmstr on 8/24/19.
// Copyright © 2019 Bob Rudis. All rights reserved.
//

import Foundation
import Cocoa

func download_from_studio_server(fromRS : String, toFS : String) {
NSLog("download from rstudio server")
let rsURL = URL(string: fromRS)!
let fsURL = URL(string: toFS)!
let task = URLSession.shared.downloadTask(with: rsURL) {
localURL, urlResponse, error in
if (error != nil) {
NSLog("dler \(String(describing: error))")

} else {
if let localURL = localURL {
NSLog("We've got the data");
do {
NSLog("Trying to move the data from \(localURL) to \(fsURL)");
try FileManager.default.moveItem(at: localURL, to: fsURL)
// NSWorkspace.shared.openFile(
// fsURL.deletingLastPathComponent().absoluteString, withApplication: "Finder"
// )
// NSWorkspace.shared.activateFileViewerSelecting([fsURL])
} catch {
NSLog("Move Error \(error)")
}
}
}
}
task.resume()
}


+ 22
- 0
RSwitch/Swift/ExportWebViewController.swift View File

@@ -0,0 +1,22 @@
//
// ExportWebViewController.swift
// RSwitch
//
// Created by hrbrmstr on 5/24/20.
// Copyright © 2020 Bob Rudis. All rights reserved.
//

import Cocoa

class ExportWebViewController: NSWindowController {

override func windowDidLoad() {
shouldCascadeWindows = false
window?.setFrameAutosaveName(window!.title)
super.windowDidLoad()
}

}

+ 8
- 8
RSwitch/Swift/MenuActions/BrowseMenuAction.swift View File

@@ -30,7 +30,7 @@ class BrowseMenuAction {
public var url : URL

private static let webItemsR = [
BrowseMenuAction(title: "R for macOS Developer's…", url: "https://mac.r-project.org/"),
BrowseMenuAction(title: "R for macOS…", url: "https://mac.r-project.org/"),
BrowseMenuAction(title: "R for macOS CRAN…", url: "https://cran.rstudio.org/bin/macosx/"),
BrowseMenuAction(title: "R-SIG-Mac Archives…", url: "https://stat.ethz.ch/pipermail/r-sig-mac/"),
BrowseMenuAction(title: "R-devel News…", url: "https://developer.r-project.org/blosxom.cgi/R-devel/NEWS"),
@@ -41,7 +41,7 @@ class BrowseMenuAction {

private static let webItemsExt = [
BrowseMenuAction(title: "R Package Documentation (rdrr.io)…", url: "https://rdrr.io/"),
BrowseMenuAction(title: "R Compiler Tools for RCpp on macOS…", url: "https://thecoatlessprofessor.com/programming/cpp/r-compiler-tools-for-rcpp-on-macos/"),
BrowseMenuAction(title: "R Compiler Tools for Rcpp on macOS…", url: "https://thecoatlessprofessor.com/programming/cpp/r-compiler-tools-for-rcpp-on-macos/"),
BrowseMenuAction(title: "Rseek…", url: "https://rseek.org"),
BrowseMenuAction(title: "R StackOverflow…", url: "https://stackoverflow.com/questions/tagged/r"),
BrowseMenuAction(title: "ROpenSci Discuss…", url: "https://discuss.ropensci.org/"),
@@ -54,12 +54,12 @@ class BrowseMenuAction {
]

private static let webItemsMan = [
BrowseMenuAction(title: "An Introduction to R…", url: "file:///Library/Frameworks/R.framework/Versions/3.6/Resources/doc/manual/R-intro.html"),
BrowseMenuAction(title: "R Data Import/Export…", url: "file:///Library/Frameworks/R.framework/Versions/3.6/Resources/doc/manual/R-data.html"),
BrowseMenuAction(title: "R Installation and Administration…", url: "file:///Library/Frameworks/R.framework/Versions/3.6/Resources/doc/manual/R-admin.html"),
BrowseMenuAction(title: "Writing R Extensions…", url: "file:///Library/Frameworks/R.framework/Versions/3.6/Resources/doc/manual/"),
BrowseMenuAction(title: "The R language definition…", url: "file:///Library/Frameworks/R.framework/Versions/3.6/Resources/doc/manual/R-exts.html"),
BrowseMenuAction(title: "R Internals…", url: "file:///Library/Frameworks/R.framework/Versions/3.6/Resources/doc/manual/R-ints.html")
BrowseMenuAction(title: "An Introduction to R…", url: "file:///Library/Frameworks/R.framework/Resources/doc/manual/R-intro.html"),
BrowseMenuAction(title: "R Data Import/Export…", url: "file:///Library/Frameworks/R.framework/Resources/doc/manual/R-data.html"),
BrowseMenuAction(title: "R Installation and Administration…", url: "file:///Library/Frameworks/R.framework/Resources/doc/manual/R-admin.html"),
BrowseMenuAction(title: "Writing R Extensions…", url: "file:///Library/Frameworks/R.framework/Resources/doc/manual/"),
BrowseMenuAction(title: "The R language definition…", url: "file:///Library/Frameworks/R.framework/Resources/doc/manual/R-exts.html"),
BrowseMenuAction(title: "R Internals…", url: "file:///Library/Frameworks/R.framework/Resources/doc/manual/R-ints.html")
]
private static let webItemsBook = [


+ 36
- 9
RSwitch/Swift/RStudioServerSessionWebViewController.swift View File

@@ -55,7 +55,6 @@ extension RstudioServerSessionWebViewController: WKUIDelegate {
NSLog("PANELING!")
print("PANELING!")

let openPanel = NSOpenPanel()
openPanel.canChooseFiles = true
@@ -77,15 +76,43 @@ extension RstudioServerSessionWebViewController: WKUIDelegate {
if navigationAction.targetFrame == nil {
let plotWindowController = NSStoryboard(name: "Main", bundle: nil).instantiateController(withIdentifier: "plotPopupPanel") as! PlotWebViewController
let plotWV = (plotWindowController.contentViewController as! plotPopupViewController)
plotWV.view.window?.title = navigationAction.request.url!.absoluteString
plotWV.setupWebView(configuration: configuration)
plotWindowController.showWindow(self)
plotWV.loadWebView(urlIn: navigationAction.request.url!.absoluteString)
let u = URL(string: navigationAction.request.url!.absoluteString)!
return(plotWV.webView)
if ((u.urlComponents?.path.starts(with: "/export/")) != nil) {
NSLog("Navigation action thing: " + navigationAction.request.url!.absoluteString)
let exportWindowController = NSStoryboard(name: "Main", bundle: nil).instantiateController(withIdentifier: "exportPopupPanel") as! ExportWebViewController
let exportWV = (exportWindowController.contentViewController as! exportPopupViewController)

exportWV.view.window?.title = navigationAction.request.url!.absoluteString
exportWV.setupWebView(configuration: configuration)
exportWindowController.showWindow(self)
NSLog("Before exportWV.loadWebView")
exportWV.loadWebView(urlIn: navigationAction.request.url!.absoluteString)
return(exportWV.webView)

} else {
let plotWindowController = NSStoryboard(name: "Main", bundle: nil).instantiateController(withIdentifier: "plotPopupPanel") as! PlotWebViewController
let plotWV = (plotWindowController.contentViewController as! plotPopupViewController)

plotWV.view.window?.title = navigationAction.request.url!.absoluteString
plotWV.setupWebView(configuration: configuration)
plotWindowController.showWindow(self)
plotWV.loadWebView(urlIn: navigationAction.request.url!.absoluteString)
return(plotWV.webView)

}
}


+ 26
- 0
RSwitch/Swift/Utils/urls.swift View File

@@ -0,0 +1,26 @@
//
// urls.swift
// RSwitch
//
// Created by hrbrmstr on 5/24/20.
// Copyright © 2020 Bob Rudis. All rights reserved.
//

import Foundation
import Cocoa
import WebKit

extension URL {
var queryParameters: QueryParameters { return QueryParameters(url: self) }
}

class QueryParameters {
let queryItems: [URLQueryItem]
init(url: URL?) {
queryItems = URLComponents(string: url?.absoluteString ?? "")?.queryItems ?? []
print(queryItems)
}
subscript(name: String) -> String? {
return queryItems.first(where: { $0.name == name })?.value
}
}

+ 104
- 0
RSwitch/Swift/exportPopupViewController.swift View File

@@ -0,0 +1,104 @@
//
// exportPopupViewController.swift
// RSwitch
//
// Created by hrbrmstr on 5/24/20.
// Copyright © 2020 Bob Rudis. All rights reserved.
//

import Cocoa
import WebKit

// EXPORT

class exportPopupViewController: NSViewController {

var webView: WKWebView!
var urlPath: String = ""
open override func viewDidLoad() {
super.viewDidLoad()
}
func setupWebView(configuration: WKWebViewConfiguration) {
webView = WKWebView(frame: view.bounds, configuration: configuration)
webView.autoresizingMask = [.width, .height]
webView.uiDelegate = self
webView.navigationDelegate = self
view.addSubview(webView)
}

func loadWebView(urlIn: String) {
urlPath = urlIn
NSLog("loadWebView: " + urlPath)
// Check for "/export/"
// If export, then get bring up a Save Panel and then download the file to that location

if let url = URL(string: urlPath) {
NSLog("URL path: " + url.path)
if (url.path.starts(with: "/export")) {
NSLog(" Name: " + url.queryParameters["name"]!)
let savePanel = NSSavePanel()
savePanel.canCreateDirectories = true
savePanel.nameFieldStringValue = url.queryParameters["name"]!
savePanel.beginSheetModal(for:self.view.window!) { (response) in
if (response == NSApplication.ModalResponse.OK) {
//completionHandler([savePanel.url!])
NSLog("SP OK RESP")
NSLog("From here " + url.absoluteString)
NSLog("To here " + savePanel.url!.absoluteString)
download_from_studio_server(fromRS: url.absoluteString, toFS: savePanel.url!.absoluteString)
} else {
//completionHandler(nil)
NSLog("Don't do anything!")
}
savePanel.close()
}

}
}
}
override func viewDidAppear() {
super.viewDidAppear()
}
}

extension exportPopupViewController: WKUIDelegate {
func webViewDidClose(_ webView: WKWebView) {
self.view.window?.close()
}

}

extension exportPopupViewController: WKNavigationDelegate {
open func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
print("Export DID START")
}
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
print("Export DID FINISH")
}
}


+ 17
- 2
RSwitch/Swift/plotPopupViewController.swift View File

@@ -29,7 +29,6 @@ class plotPopupViewController: NSViewController {
}

func loadWebView(urlIn: String) {
urlPath = urlIn
@@ -40,8 +39,24 @@ class plotPopupViewController: NSViewController {
// If export, then get bring up a Save Panel and then download the file to that location

if let url = URL(string: urlPath) {
let urlRequest = URLRequest(url: url)
webView.load(urlRequest)

NSLog("URL path: " + url.path)
if (url.path.starts(with: "/export")) {
NSLog(" Name: " + url.queryParameters["name"]!)
DispatchQueue.main.async {
self.webView.removeFromSuperview()
}
} else {
webView.load(urlRequest)

}
}
}


+ 3
- 4
guide/index.Rmd View File

@@ -51,16 +51,15 @@ The `Resources` directory (and everything else in `/Library/Frameworks/R.framewo
- `Resources@ -> Versions/Current/Resources`
- `Versions/`

For the most control, you can install a coexisting version of R **oldrel**-1, **oldrel** (as of the date this document was created those would be R 3.4 and R 3.5), current **release** (R 3.6) and **devel** (3.7) by hand by going to the [R for macOS Developer's Page](https://mac.r-project.org/) and downloading the `tar.gz` version of those distributions:
For the most control, you can install a coexisting version of R **oldrel**-1, **oldrel** (as of the date this document was created those would be R 3.5 and R 3.6), current **release** (R 4.0) and **devel** (4.1) by hand by going to [R for macOS](https://mac.r-project.org/) and downloading the `tar.gz` version of those distributions:

![](r-macos-downloads.png)

Here are direct `https` links to the tarballs:

- [R 3.4](https://mac.r-project.org/mavericks/R-3.4-branch/R-3.4-branch-mavericks-sa-x86_64.tar.gz) (oldrel-1)
- [R 3.5](https://mac.r-project.org/el-capitan/R-3.5-branch/R-3.5-branch-el-capitan-sa-x86_64.tar.gz) (oldrel)
- [R 3.6](https://mac.r-project.org/el-capitan/R-3.6-branch/R-3.6-branch-el-capitan-sa-x86_64.tar.gz) (current)
- [R 3.7](https://mac.r-project.org/el-capitan/R-devel/R-devel-el-capitan-sa-x86_64.tar.gz) (devel)
- [R 4.0](https://mac.r-project.org/el-capitan/R-3.6-branch/R-4.0-branch-el-capitan-sa-x86_64.tar.gz) (current)
- [R 4.1](https://mac.r-project.org/el-capitan/R-devel/R-devel-el-capitan-sa-x86_64.tar.gz) (devel)

Once downloaded, you can fire up a terminal prompt, head to the root directory (i.e. `cd /`) and run `tar -xvzf path-to-thing-you-just-downloaded` to lay out the contents of the tarball onto the filesystem. You can also use the `.pkg` versions if you prefer a clicky-installer wizard, but these installers will remove any previous versions of the framework (kinda defeating the purpose). You can still use the `.pkg` format by heading over to the command line and using `pkgutil --forget` to prevent said clobbering behavior (as noted in [Section 4.2](https://cran.rstudio.org/doc/manuals/R-admin.html#Uninstalling-under-macOS) of _R Installation and Administration_. For example:



BIN
guide/r-macos-downloads.png View File

Before After
Width: 962  |  Height: 408  |  Size: 204KB Width: 2284  |  Height: 996  |  Size: 346KB

Loading…
Cancel
Save