Browse Source

update

master
boB Rudis 4 years ago
parent
commit
6ba016004a
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 4
      NEWS.md
  2. 14
      Pods/Pods.xcodeproj/project.pbxproj
  3. 24
      Pods/Pods.xcodeproj/xcuserdata/hrbrmstr.xcuserdatad/xcschemes/Just.xcscheme
  4. 2
      Pods/Pods.xcodeproj/xcuserdata/hrbrmstr.xcuserdatad/xcschemes/Pods-RSwitch.xcscheme
  5. 18
      RSwitch.xcodeproj/project.pbxproj
  6. 38
      RSwitch/Base.lproj/Main.storyboard
  7. 2
      RSwitch/Info.plist
  8. 18
      RSwitch/Swift/AppDelegate.swift
  9. 25
      RSwitch/Swift/Notify.swift
  10. 23
      RSwitch/Swift/RStudioServerSessionWebViewController.swift
  11. 59
      RSwitch/Swift/Utils/Associations.swift
  12. 51
      RSwitch/Swift/Utils/Reachable.swift
  13. 32
      RSwitch/Swift/plotPopupViewController.swift

4
NEWS.md

@ -1,3 +1,7 @@
# 1.7.0
- Added checks for network availability
# 1.4.0 # 1.4.0
- Use Notification Center vs alerts for everything but super-fatal errors - Use Notification Center vs alerts for everything but super-fatal errors

14
Pods/Pods.xcodeproj/project.pbxproj

@ -30,14 +30,14 @@
4F000B9DE332C7D2340B760411896249 /* Pods-RSwitch-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-RSwitch-umbrella.h"; sourceTree = "<group>"; }; 4F000B9DE332C7D2340B760411896249 /* Pods-RSwitch-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-RSwitch-umbrella.h"; sourceTree = "<group>"; };
574603E2D7597AEEB79587D7C3889AA1 /* Just.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Just.xcconfig; sourceTree = "<group>"; }; 574603E2D7597AEEB79587D7C3889AA1 /* Just.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Just.xcconfig; sourceTree = "<group>"; };
5A65C21E7E55D2FB16F3F2767B0063C7 /* Just-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Just-dummy.m"; sourceTree = "<group>"; }; 5A65C21E7E55D2FB16F3F2767B0063C7 /* Just-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Just-dummy.m"; sourceTree = "<group>"; };
5D52FFF81A1E26634DAD54B2BE7CBA99 /* Pods_RSwitch.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_RSwitch.framework; path = "Pods-RSwitch.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; 5D52FFF81A1E26634DAD54B2BE7CBA99 /* Pods_RSwitch.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RSwitch.framework; sourceTree = BUILT_PRODUCTS_DIR; };
614B6A9B3F94B8D815819AA921D78D95 /* Just-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Just-prefix.pch"; sourceTree = "<group>"; }; 614B6A9B3F94B8D815819AA921D78D95 /* Just-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Just-prefix.pch"; sourceTree = "<group>"; };
6848EDAB880F7E2D2B180B0D25F67504 /* Just.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = Just.modulemap; sourceTree = "<group>"; }; 6848EDAB880F7E2D2B180B0D25F67504 /* Just.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = Just.modulemap; sourceTree = "<group>"; };
6B076A7E6A9514F7BC8853C054606452 /* Just-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Just-umbrella.h"; sourceTree = "<group>"; }; 6B076A7E6A9514F7BC8853C054606452 /* Just-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Just-umbrella.h"; sourceTree = "<group>"; };
6B5F1D02B43D15E9D5752784305E1A5D /* Pods-RSwitch.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-RSwitch.debug.xcconfig"; sourceTree = "<group>"; }; 6B5F1D02B43D15E9D5752784305E1A5D /* Pods-RSwitch.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-RSwitch.debug.xcconfig"; sourceTree = "<group>"; };
7B194431FBE08FAA54D43A7D8C27124C /* Pods-RSwitch-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-RSwitch-Info.plist"; sourceTree = "<group>"; }; 7B194431FBE08FAA54D43A7D8C27124C /* Pods-RSwitch-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-RSwitch-Info.plist"; sourceTree = "<group>"; };
9A212383B73C76EDF23FB6126214CAB4 /* Just.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Just.framework; path = Just.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 9A212383B73C76EDF23FB6126214CAB4 /* Just.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Just.framework; sourceTree = BUILT_PRODUCTS_DIR; };
9D940727FF8FB9C785EB98E56350EF41 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
ACB677C58AE332368BBEB1AF0A6918B1 /* Pods-RSwitch-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-RSwitch-acknowledgements.plist"; sourceTree = "<group>"; }; ACB677C58AE332368BBEB1AF0A6918B1 /* Pods-RSwitch-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-RSwitch-acknowledgements.plist"; sourceTree = "<group>"; };
B39AAB51B4D348DDE0A772879510BD57 /* Pods-RSwitch-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-RSwitch-frameworks.sh"; sourceTree = "<group>"; }; B39AAB51B4D348DDE0A772879510BD57 /* Pods-RSwitch-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-RSwitch-frameworks.sh"; sourceTree = "<group>"; };
B8F0FBF810ECE65109C95E0C8BBB893F /* Just.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Just.swift; path = Sources/Just/Just.swift; sourceTree = "<group>"; }; B8F0FBF810ECE65109C95E0C8BBB893F /* Just.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Just.swift; path = Sources/Just/Just.swift; sourceTree = "<group>"; };
@ -131,7 +131,6 @@
B8F0FBF810ECE65109C95E0C8BBB893F /* Just.swift */, B8F0FBF810ECE65109C95E0C8BBB893F /* Just.swift */,
46872DBB8C34D63DE630A92868138E93 /* Support Files */, 46872DBB8C34D63DE630A92868138E93 /* Support Files */,
); );
name = Just;
path = Just; path = Just;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
@ -228,7 +227,7 @@
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastSwiftUpdateCheck = 1100; LastSwiftUpdateCheck = 1100;
LastUpgradeCheck = 1100; LastUpgradeCheck = 1120;
}; };
buildConfigurationList = 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */; buildConfigurationList = 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */;
compatibilityVersion = "Xcode 10.0"; compatibilityVersion = "Xcode 10.0";
@ -236,6 +235,7 @@
hasScannedForEncodings = 0; hasScannedForEncodings = 0;
knownRegions = ( knownRegions = (
en, en,
Base,
); );
mainGroup = CF1408CF629C7361332E53B88F7BD30C; mainGroup = CF1408CF629C7361332E53B88F7BD30C;
productRefGroup = 623DD1C81238D9DB831E4CF39661DBBE /* Products */; productRefGroup = 623DD1C81238D9DB831E4CF39661DBBE /* Products */;
@ -363,7 +363,6 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = 574603E2D7597AEEB79587D7C3889AA1 /* Just.xcconfig */; baseConfigurationReference = 574603E2D7597AEEB79587D7C3889AA1 /* Just.xcconfig */;
buildSettings = { buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_WEAK = NO; CLANG_ENABLE_OBJC_WEAK = NO;
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
@ -461,7 +460,6 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = 574603E2D7597AEEB79587D7C3889AA1 /* Just.xcconfig */; baseConfigurationReference = 574603E2D7597AEEB79587D7C3889AA1 /* Just.xcconfig */;
buildSettings = { buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_WEAK = NO; CLANG_ENABLE_OBJC_WEAK = NO;
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
@ -500,7 +498,6 @@
baseConfigurationReference = D722B0A61F22FDFBDEF11F24016B4D1D /* Pods-RSwitch.release.xcconfig */; baseConfigurationReference = D722B0A61F22FDFBDEF11F24016B4D1D /* Pods-RSwitch.release.xcconfig */;
buildSettings = { buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_WEAK = NO; CLANG_ENABLE_OBJC_WEAK = NO;
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
@ -540,7 +537,6 @@
baseConfigurationReference = 6B5F1D02B43D15E9D5752784305E1A5D /* Pods-RSwitch.debug.xcconfig */; baseConfigurationReference = 6B5F1D02B43D15E9D5752784305E1A5D /* Pods-RSwitch.debug.xcconfig */;
buildSettings = { buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_WEAK = NO; CLANG_ENABLE_OBJC_WEAK = NO;
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";

24
Pods/Pods.xcodeproj/xcuserdata/hrbrmstr.xcuserdatad/xcschemes/Just.xcscheme

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Scheme <Scheme
LastUpgradeVersion = "1100" LastUpgradeVersion = "1130"
version = "1.3"> version = "1.3">
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"> buildImplicitDependencies = "YES">
<BuildActionEntries> <BuildActionEntries>
<BuildActionEntry <BuildActionEntry
buildForAnalyzing = "YES"
buildForTesting = "YES" buildForTesting = "YES"
buildForRunning = "YES" buildForRunning = "YES"
buildForProfiling = "YES" buildForProfiling = "YES"
buildForArchiving = "YES"> buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "CE86A5B255D405184FBF7B919824D937" BlueprintIdentifier = "CE86A5B255D405184FBF7B919824D937"
@ -23,14 +23,15 @@
</BuildActionEntries> </BuildActionEntries>
</BuildAction> </BuildAction>
<TestAction <TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES" shouldUseLaunchSchemeArgsEnv = "YES">
buildConfiguration = "Debug"> <Testables>
<AdditionalOptions> </Testables>
</AdditionalOptions>
</TestAction> </TestAction>
<LaunchAction <LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0" launchStyle = "0"
@ -38,17 +39,14 @@
ignoresPersistentStateOnLaunch = "NO" ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES" debugDocumentVersioning = "YES"
debugServiceExtension = "internal" debugServiceExtension = "internal"
buildConfiguration = "Debug"
allowLocationSimulation = "YES"> allowLocationSimulation = "YES">
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction> </LaunchAction>
<ProfileAction <ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = "" savedToolIdentifier = ""
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES" debugDocumentVersioning = "YES">
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES">
</ProfileAction> </ProfileAction>
<AnalyzeAction <AnalyzeAction
buildConfiguration = "Debug"> buildConfiguration = "Debug">

2
Pods/Pods.xcodeproj/xcuserdata/hrbrmstr.xcuserdatad/xcschemes/Pods-RSwitch.xcscheme

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

18
RSwitch.xcodeproj/project.pbxproj

@ -27,6 +27,8 @@
0198B99E23196689003F7578 /* BrowseMenuAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0198B99D23196689003F7578 /* BrowseMenuAction.swift */; }; 0198B99E23196689003F7578 /* BrowseMenuAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0198B99D23196689003F7578 /* BrowseMenuAction.swift */; };
0198B9A0231970ED003F7578 /* AppAlerts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0198B99F231970ED003F7578 /* AppAlerts.swift */; }; 0198B9A0231970ED003F7578 /* AppAlerts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0198B99F231970ED003F7578 /* AppAlerts.swift */; };
0198B9AA23197D3A003F7578 /* Running.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0198B9A923197D3A003F7578 /* Running.swift */; }; 0198B9AA23197D3A003F7578 /* Running.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0198B9A923197D3A003F7578 /* Running.swift */; };
01A4F40A23F3084E005B88C2 /* Reachable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01A4F40923F3084E005B88C2 /* Reachable.swift */; };
01A4F40C23F30DB4005B88C2 /* Associations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01A4F40B23F30DB4005B88C2 /* Associations.swift */; };
01B611EC232176A200432807 /* NewSessionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01B611EB232176A200432807 /* NewSessionViewController.swift */; }; 01B611EC232176A200432807 /* NewSessionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01B611EB232176A200432807 /* NewSessionViewController.swift */; };
01D3E43A232119DD00E3BC02 /* WebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01D3E439232119DD00E3BC02 /* WebViewController.swift */; }; 01D3E43A232119DD00E3BC02 /* WebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01D3E439232119DD00E3BC02 /* WebViewController.swift */; };
01D3E43C23211B4C00E3BC02 /* RStudioServerAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01D3E43B23211B4C00E3BC02 /* RStudioServerAction.swift */; }; 01D3E43C23211B4C00E3BC02 /* RStudioServerAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01D3E43B23211B4C00E3BC02 /* RStudioServerAction.swift */; };
@ -69,6 +71,8 @@
0198B99D23196689003F7578 /* BrowseMenuAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrowseMenuAction.swift; sourceTree = "<group>"; }; 0198B99D23196689003F7578 /* BrowseMenuAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrowseMenuAction.swift; sourceTree = "<group>"; };
0198B99F231970ED003F7578 /* AppAlerts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppAlerts.swift; sourceTree = "<group>"; }; 0198B99F231970ED003F7578 /* AppAlerts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppAlerts.swift; sourceTree = "<group>"; };
0198B9A923197D3A003F7578 /* Running.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Running.swift; sourceTree = "<group>"; }; 0198B9A923197D3A003F7578 /* Running.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Running.swift; sourceTree = "<group>"; };
01A4F40923F3084E005B88C2 /* Reachable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Reachable.swift; sourceTree = "<group>"; };
01A4F40B23F30DB4005B88C2 /* Associations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Associations.swift; sourceTree = "<group>"; };
01B611EB232176A200432807 /* NewSessionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewSessionViewController.swift; sourceTree = "<group>"; }; 01B611EB232176A200432807 /* NewSessionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewSessionViewController.swift; sourceTree = "<group>"; };
01D3E439232119DD00E3BC02 /* WebViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewController.swift; sourceTree = "<group>"; }; 01D3E439232119DD00E3BC02 /* WebViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewController.swift; sourceTree = "<group>"; };
01D3E43B23211B4C00E3BC02 /* RStudioServerAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RStudioServerAction.swift; sourceTree = "<group>"; }; 01D3E43B23211B4C00E3BC02 /* RStudioServerAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RStudioServerAction.swift; sourceTree = "<group>"; };
@ -195,6 +199,8 @@
01975549231BD919003FAD7B /* RVersions.swift */, 01975549231BD919003FAD7B /* RVersions.swift */,
0198B9A923197D3A003F7578 /* Running.swift */, 0198B9A923197D3A003F7578 /* Running.swift */,
011951B3231F00A000B62C3A /* Preferences.swift */, 011951B3231F00A000B62C3A /* Preferences.swift */,
01A4F40923F3084E005B88C2 /* Reachable.swift */,
01A4F40B23F30DB4005B88C2 /* Associations.swift */,
); );
path = Utils; path = Utils;
sourceTree = "<group>"; sourceTree = "<group>";
@ -285,7 +291,7 @@
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastSwiftUpdateCheck = 1100; LastSwiftUpdateCheck = 1100;
LastUpgradeCheck = 1100; LastUpgradeCheck = 1130;
ORGANIZATIONNAME = "Bob Rudis"; ORGANIZATIONNAME = "Bob Rudis";
TargetAttributes = { TargetAttributes = {
01F3EF07230E635300DF5DF9 = { 01F3EF07230E635300DF5DF9 = {
@ -372,6 +378,7 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
01073F212311E6BD007162C9 /* HandleRSwitch.swift in Sources */, 01073F212311E6BD007162C9 /* HandleRSwitch.swift in Sources */,
01A4F40A23F3084E005B88C2 /* Reachable.swift in Sources */,
0198B9A0231970ED003F7578 /* AppAlerts.swift in Sources */, 0198B9A0231970ED003F7578 /* AppAlerts.swift in Sources */,
011951B4231F00A000B62C3A /* Preferences.swift in Sources */, 011951B4231F00A000B62C3A /* Preferences.swift in Sources */,
010A1C1423215B0900E32A9A /* SessionWindowController.swift in Sources */, 010A1C1423215B0900E32A9A /* SessionWindowController.swift in Sources */,
@ -394,6 +401,7 @@
01073F172311E397007162C9 /* Menu.swift in Sources */, 01073F172311E397007162C9 /* Menu.swift in Sources */,
01F3EF0E230E635300DF5DF9 /* ViewController.swift in Sources */, 01F3EF0E230E635300DF5DF9 /* ViewController.swift in Sources */,
01FC5D04232874F600771CD7 /* PlotWebViewController.swift in Sources */, 01FC5D04232874F600771CD7 /* PlotWebViewController.swift in Sources */,
01A4F40C23F30DB4005B88C2 /* Associations.swift in Sources */,
01F3EF0C230E635300DF5DF9 /* AppDelegate.swift in Sources */, 01F3EF0C230E635300DF5DF9 /* AppDelegate.swift in Sources */,
01FC5D01232874F600771CD7 /* plotPopupViewController.swift in Sources */, 01FC5D01232874F600771CD7 /* plotPopupViewController.swift in Sources */,
01D3E441232131F300E3BC02 /* RStudioServerSessionManager.swift in Sources */, 01D3E441232131F300E3BC02 /* RStudioServerSessionManager.swift in Sources */,
@ -557,8 +565,8 @@
"$(PROJECT_DIR)/RSwitch/ObjC", "$(PROJECT_DIR)/RSwitch/ObjC",
"$(PROJECT_DIR)/RSwitch/ObjC/ProcInfo", "$(PROJECT_DIR)/RSwitch/ObjC/ProcInfo",
); );
MACOSX_DEPLOYMENT_TARGET = 10.14; MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 1.5.1; MARKETING_VERSION = 1.7.0;
PRODUCT_BUNDLE_IDENTIFIER = is.rud.bob.RSwitch; PRODUCT_BUNDLE_IDENTIFIER = is.rud.bob.RSwitch;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "rswitch-1+"; PROVISIONING_PROFILE_SPECIFIER = "rswitch-1+";
@ -590,8 +598,8 @@
"$(PROJECT_DIR)/RSwitch/ObjC", "$(PROJECT_DIR)/RSwitch/ObjC",
"$(PROJECT_DIR)/RSwitch/ObjC/ProcInfo", "$(PROJECT_DIR)/RSwitch/ObjC/ProcInfo",
); );
MACOSX_DEPLOYMENT_TARGET = 10.14; MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 1.5.1; MARKETING_VERSION = 1.7.0;
PRODUCT_BUNDLE_IDENTIFIER = is.rud.bob.RSwitch; PRODUCT_BUNDLE_IDENTIFIER = is.rud.bob.RSwitch;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "rswitch-1+"; PROVISIONING_PROFILE_SPECIFIER = "rswitch-1+";

38
RSwitch/Base.lproj/Main.storyboard

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14868" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> <document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="15505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies> <dependencies>
<deployment identifier="macosx"/> <deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14868"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15505"/>
<capability name="System colors introduced in macOS 10.14" minToolsVersion="10.0"/> <capability name="System colors introduced in macOS 10.14" minToolsVersion="10.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
@ -839,29 +839,47 @@ DQ
<textView ambiguous="YES" editable="NO" drawsBackground="NO" importsGraphics="NO" verticallyResizable="YES" smartInsertDelete="YES" id="kWH-Et-k6l"> <textView ambiguous="YES" editable="NO" drawsBackground="NO" importsGraphics="NO" verticallyResizable="YES" smartInsertDelete="YES" id="kWH-Et-k6l">
<rect key="frame" x="0.0" y="0.0" width="463" height="247"/> <rect key="frame" x="0.0" y="0.0" width="463" height="247"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="textColor" name="systemBlueColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="alternatingContentBackgroundColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="alternatingContentBackgroundColor" catalog="System" colorSpace="catalog"/>
<size key="minSize" width="463" height="247"/> <size key="minSize" width="463" height="247"/>
<size key="maxSize" width="463" height="10000000"/> <size key="maxSize" width="463" height="10000000"/>
<attributedString key="textStorage"> <attributedString key="textStorage">
<fragment> <fragment>
<string key="content"> <string key="content" base64-UTF8="YES">
RSwitch v1.5.1 Cg
</string>
<attributes>
<color key="NSColor" name="textColor" catalog="System" colorSpace="catalog"/>
<font key="NSFont" metaFont="label" size="17"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes>
</fragment>
<fragment>
<string key="content">RSwitch v1.6.0
Copyright © 2019 Bob Rudis Copyright © 2019 Bob Rudis
MIT Licensed MIT Licensed
</string> </string>
<attributes> <attributes>
<color key="NSColor" name="systemBlueColor" catalog="System" colorSpace="catalog"/> <color key="NSColor" red="0.0" green="0.56031829119999998" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<font key="NSFont" metaFont="label" size="17"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes>
</fragment>
<fragment>
<string key="content" base64-UTF8="YES">
Cg
</string>
<attributes>
<color key="NSColor" name="textColor" catalog="System" colorSpace="catalog"/>
<font key="NSFont" metaFont="label" size="17"/> <font key="NSFont" metaFont="label" size="17"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/> <paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes> </attributes>
</fragment> </fragment>
<fragment content="https://rud.is/rswitch/"> <fragment content="https://rud.is/rswitch/">
<attributes> <attributes>
<color key="NSColor" name="systemBlueColor" catalog="System" colorSpace="catalog"/> <color key="NSColor" name="textColor" catalog="System" colorSpace="catalog"/>
<font key="NSFont" metaFont="label" size="17"/> <font key="NSFont" metaFont="label" size="17"/>
<url key="NSLink" string="https://rud.is/rswitch/"/> <url key="NSLink" string="https://rud.is/rswitch/"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/> <paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
@ -872,7 +890,7 @@ MIT Licensed
Cgo Cgo
</string> </string>
<attributes> <attributes>
<color key="NSColor" name="systemBlueColor" catalog="System" colorSpace="catalog"/> <color key="NSColor" name="textColor" catalog="System" colorSpace="catalog"/>
<font key="NSFont" metaFont="label" size="17"/> <font key="NSFont" metaFont="label" size="17"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/> <paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes> </attributes>
@ -883,7 +901,7 @@ String+Version by DragonCherry
ProcInfo by Patrick Wardle ProcInfo by Patrick Wardle
Just by Daniel Duan</string> Just by Daniel Duan</string>
<attributes> <attributes>
<color key="NSColor" name="systemBlueColor" catalog="System" colorSpace="catalog"/> <color key="NSColor" red="0.0" green="0.56031829119999998" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<font key="NSFont" size="11" name="HelveticaNeue"/> <font key="NSFont" size="11" name="HelveticaNeue"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/> <paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes> </attributes>

2
RSwitch/Info.plist

@ -25,7 +25,7 @@
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string> <string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>
<string>Copyright © 2019 Bob Rudis. All rights reserved. MIT Licensed</string> <string>Copyright © 2020 Bob Rudis. All rights reserved. MIT Licensed</string>
<key>NSMainStoryboardFile</key> <key>NSMainStoryboardFile</key>
<string>Main</string> <string>Main</string>
<key>NSPrincipalClass</key> <key>NSPrincipalClass</key>

18
RSwitch/Swift/AppDelegate.swift

@ -27,10 +27,12 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSToolbarDelegate {
} }
@objc func performRStudioCheck(_ sender: NSObject) { @objc func performRStudioCheck(_ sender: NSObject) {
let v = RStudioUtils.latestVersionNumber() if (currentReachabilityStatus != .notReachable) {
if (!Preferences.lastVersionNotified.isVersion(equalTo: v)) { let v = RStudioUtils.latestVersionNumber()
Preferences.lastVersionNotified = v if (!Preferences.lastVersionNotified.isVersion(equalTo: v)) {
notifyUser(title: "New RStudio Daily version available", text: ("Version: " + v)) Preferences.lastVersionNotified = v
notifyUserWithDL(title: "New RStudio Daily version available", text: ("Version: " + v))
}
} }
} }
@ -73,7 +75,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSToolbarDelegate {
} }
DockIcon.standard.setVisibility(Preferences.showDockIcon) DockIcon.standard.setVisibility(Preferences.showDockIcon)
} }
func applicationDidFinishLaunching(_ aNotification: Notification) { func applicationDidFinishLaunching(_ aNotification: Notification) {
@ -89,7 +91,11 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSToolbarDelegate {
newSessController = (mainStoryboard.instantiateController(withIdentifier: "newSessPanel") as! NSWindowController) newSessController = (mainStoryboard.instantiateController(withIdentifier: "newSessPanel") as! NSWindowController)
sess = RStudioServerSessionManager() sess = RStudioServerSessionManager()
FileAssociationUtils.getHandlers();
FileAssociationUtils.setHandlers();
FileAssociationUtils.getHandlers();
timer = Timer.scheduledTimer( timer = Timer.scheduledTimer(
timeInterval: 3600, timeInterval: 3600,
target: self, target: self,

25
RSwitch/Swift/Notify.swift

@ -10,8 +10,27 @@ import Foundation
import Cocoa import Cocoa
extension AppDelegate : NSUserNotificationCenterDelegate { extension AppDelegate : NSUserNotificationCenterDelegate {
func notifyUser(title: String? = nil, subtitle: String? = nil, text: String? = nil) -> Void { func notifyUserWithDL(title: String? = nil, subtitle: String? = nil, text: String? = nil) -> Void {
let notification = NSUserNotification()
notification.title = title
notification.subtitle = subtitle
notification.informativeText = text
notification.hasActionButton = true
notification.actionButtonTitle = "Download"
notification.soundName = NSUserNotificationDefaultSoundName
NSUserNotificationCenter.default.delegate = self
NSUserNotificationCenter.default.deliver(notification)
}
func notifyUser(title: String? = nil, subtitle: String? = nil, text: String? = nil) -> Void {
let notification = NSUserNotification() let notification = NSUserNotification()
@ -30,4 +49,8 @@ func notifyUser(title: String? = nil, subtitle: String? = nil, text: String? = n
return(true) return(true)
} }
func userNotificationCenter(_ center: NSUserNotificationCenter, didActivate notification: NSUserNotification) {
print(notification)
}
} }

23
RSwitch/Swift/RStudioServerSessionWebViewController.swift

@ -50,6 +50,29 @@ class RstudioServerSessionWebViewController: NSViewController, NSWindowDelegate
extension RstudioServerSessionWebViewController: WKUIDelegate { extension RstudioServerSessionWebViewController: WKUIDelegate {
func webView(_ webView: WKWebView, runOpenPanelWith parameters: WKOpenPanelParameters, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping ([URL]?) -> Void) {
NSLog("PANELING!")
print("PANELING!")
let openPanel = NSOpenPanel()
openPanel.canChooseFiles = true
openPanel.allowsMultipleSelection = false
openPanel.canChooseDirectories = false
openPanel.canCreateDirectories = false
openPanel.beginSheetModal(for:self.view.window!) { (response) in
if (response == NSApplication.ModalResponse.OK) {
completionHandler([openPanel.url!])
} else {
completionHandler(nil)
}
openPanel.close()
}
}
func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? { func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? {
if navigationAction.targetFrame == nil { if navigationAction.targetFrame == nil {

59
RSwitch/Swift/Utils/Associations.swift

@ -0,0 +1,59 @@
//
// Associations.swift
// RSwitch
//
// Created by hrbrmstr on 2/11/20.
// Copyright © 2020 Bob Rudis. All rights reserved.
//
import Foundation
import AppKit
import ApplicationServices
class FileAssociationUtils {
public static func getHandlers() {
let workspace = NSWorkspace.shared;
let setResR : String = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, "R" as CFString, nil)?.takeRetainedValue() as String? ?? "";
NSLog("UTI of .R extension: " + setResR);
let handlerR : String = LSCopyDefaultRoleHandlerForContentType(setResR as CFString, LSRolesMask.all)?.takeRetainedValue() as String? ?? "";
NSLog("Bundle ID of handler for .R files is: [" + handlerR + "]");
let rAppUrl : URL = (workspace.urlForApplication(withBundleIdentifier: handlerR))!.appendingPathComponent("Contents/Info.plist");
NSLog("The Info.plist for the app that handles .R files is: " + rAppUrl.absoluteString);
let rAppDict : NSDictionary = NSDictionary(contentsOf: rAppUrl)!;
NSLog("The name of the app that handles .R files is: " + (rAppDict.object(forKey: "CFBundleName") as! String));
let setResRmd : String = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, "Rmd" as CFString, nil)?.takeRetainedValue() as String? ?? "";
NSLog("UTI of .Rmd extension: " + setResRmd);
let handlerRmd : String = LSCopyDefaultRoleHandlerForContentType(setResRmd as CFString, LSRolesMask.all)?.takeRetainedValue() as String? ?? "";
NSLog("Bundle ID of handler for .Rmd files is: [" + handlerRmd + "]");
let rmdAppUrl : URL = (workspace.urlForApplication(withBundleIdentifier: handlerRmd))!.appendingPathComponent("Contents/Info.plist");
NSLog("The Info.plist for the app that handles .Rmd files is: " + rmdAppUrl.absoluteString);
let rmdAppDict : NSDictionary = NSDictionary(contentsOf: rmdAppUrl)!;
NSLog("The name of the app that handles .Rmd files is: " + (rmdAppDict.object(forKey: "CFBundleName") as! String));
}
public static func setHandlers() {
let setResR : String = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, "R" as CFString, nil)?.takeRetainedValue() as String? ?? "";
NSLog("UTI of .R extension: " + setResR);
LSSetDefaultRoleHandlerForContentType(setResR as CFString, LSRolesMask.all, "org.rstudio.RStudio" as CFString);
let setResRmd : String = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, "Rmd" as CFString, nil)?.takeRetainedValue() as String? ?? "";
NSLog("UTI of .Rmd extension: " + setResRmd);
LSSetDefaultRoleHandlerForContentType(setResRmd as CFString, LSRolesMask.all, "org.rstudio.RStudio" as CFString);
}
}

51
RSwitch/Swift/Utils/Reachable.swift

@ -0,0 +1,51 @@
//
// Reachable.swift
// RSwitch
//
// Created by hrbrmstr on 2/11/20.
// Copyright © 2020 Bob Rudis. All rights reserved.
//
import Foundation
import SystemConfiguration
protocol Utilities {}
extension NSObject: Utilities {
enum ReachabilityStatus {
case notReachable
case reachableViaWWAN
case reachableViaWiFi
}
var currentReachabilityStatus: ReachabilityStatus {
var zeroAddress = sockaddr_in()
zeroAddress.sin_len = UInt8(MemoryLayout<sockaddr_in>.size)
zeroAddress.sin_family = sa_family_t(AF_INET)
guard let defaultRouteReachability = withUnsafePointer(to: &zeroAddress, {
$0.withMemoryRebound(to: sockaddr.self, capacity: 1) {
SCNetworkReachabilityCreateWithAddress(nil, $0)
}
}) else {
return .notReachable
}
var flags: SCNetworkReachabilityFlags = []
if !SCNetworkReachabilityGetFlags(defaultRouteReachability, &flags) {
return .notReachable
}
if flags.contains(.reachable) == false {
// The target host is not reachable.
return .notReachable
} else if flags.contains(.connectionRequired) == false {
// If the target host is reachable and no connection is required then we'll assume that you're on Wi-Fi...
return .reachableViaWiFi
} else if (flags.contains(.connectionOnDemand) == true || flags.contains(.connectionOnTraffic) == true) && flags.contains(.interventionRequired) == false {
// The connection is on-demand (or on-traffic) if the calling application is using the CFSocketStream or higher APIs and no [user] intervention is needed
return .reachableViaWiFi
} else {
return .notReachable
}
}
}

32
RSwitch/Swift/plotPopupViewController.swift

@ -28,10 +28,17 @@ class plotPopupViewController: NSViewController {
view.addSubview(webView) view.addSubview(webView)
} }
func loadWebView(urlIn: String) { func loadWebView(urlIn: String) {
urlPath = urlIn urlPath = urlIn
NSLog(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) { if let url = URL(string: urlPath) {
let urlRequest = URLRequest(url: url) let urlRequest = URLRequest(url: url)
webView.load(urlRequest) webView.load(urlRequest)
@ -50,12 +57,37 @@ extension plotPopupViewController: WKUIDelegate {
func webViewDidClose(_ webView: WKWebView) { func webViewDidClose(_ webView: WKWebView) {
self.view.window?.close() self.view.window?.close()
} }
func webView(_ webView: WKWebView, runOpenPanelWith parameters: WKOpenPanelParameters, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping ([URL]?) -> Void) {
NSLog("savePanel!")
let savePanel = NSSavePanel()
savePanel.canCreateDirectories = true
savePanel.beginSheetModal(for:self.view.window!) { (response) in
if (response == NSApplication.ModalResponse.OK) {
completionHandler([savePanel.url!])
} else {
completionHandler(nil)
}
savePanel.close()
}
}
} }
extension plotPopupViewController: WKNavigationDelegate { extension plotPopupViewController: WKNavigationDelegate {
open func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) { open func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
print("DID START")
} }
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
print("DID FINISH")
} }
} }

Loading…
Cancel
Save