├── .swift-version ├── docs ├── img │ ├── gh.png │ ├── carat.png │ └── dash.png ├── docsets │ ├── Insider.tgz │ └── Insider.docset │ │ └── Contents │ │ ├── Resources │ │ ├── docSet.dsidx │ │ └── Documents │ │ │ ├── img │ │ │ ├── dash.png │ │ │ ├── gh.png │ │ │ └── carat.png │ │ │ ├── undocumented.json │ │ │ ├── badge.svg │ │ │ ├── js │ │ │ └── jazzy.js │ │ │ ├── search.json │ │ │ ├── Classes.html │ │ │ ├── Protocols.html │ │ │ └── css │ │ │ └── highlight.css │ │ └── Info.plist ├── undocumented.json ├── badge.svg ├── js │ └── jazzy.js ├── search.json ├── Classes.html ├── Protocols.html └── css │ └── highlight.css ├── assets └── sandbox.png ├── Libs ├── GCDWebServer │ ├── GCDWebUploader.bundle │ │ ├── Info.plist │ │ ├── fonts │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ └── glyphicons-halflings-regular.woff │ │ ├── en.lproj │ │ │ └── Localizable.strings │ │ ├── css │ │ │ ├── jquery.fileupload.css │ │ │ └── index.css │ │ └── js │ │ │ ├── tmpl.min.js │ │ │ ├── html5shiv.min.js │ │ │ └── respond.min.js │ ├── LICENSE │ ├── Requests │ │ ├── GCDWebServerFileRequest.h │ │ ├── GCDWebServerURLEncodedFormRequest.h │ │ ├── GCDWebServerDataRequest.h │ │ ├── GCDWebServerURLEncodedFormRequest.m │ │ ├── GCDWebServerDataRequest.m │ │ ├── GCDWebServerFileRequest.m │ │ └── GCDWebServerMultiPartFormRequest.h │ ├── Responses │ │ ├── GCDWebServerStreamedResponse.m │ │ ├── GCDWebServerStreamedResponse.h │ │ ├── GCDWebServerErrorResponse.h │ │ ├── GCDWebServerDataResponse.h │ │ ├── GCDWebServerFileResponse.h │ │ ├── GCDWebServerDataResponse.m │ │ └── GCDWebServerErrorResponse.m │ └── Core │ │ ├── GCDWebServerFunctions.h │ │ └── GCDWebServerHTTPStatusCodes.h ├── System Services │ └── Utilities │ │ ├── SSProcessInfo.h │ │ ├── SSUUID.h │ │ ├── SSBatteryInfo.h │ │ ├── SSLocalizationInfo.h │ │ ├── SSApplicationInfo.h │ │ ├── SSProcessorInfo.h │ │ ├── SSAccessoryInfo.h │ │ ├── SSDiskInfo.h │ │ ├── SSCarrierInfo.h │ │ ├── SSMemoryInfo.h │ │ ├── SSProcessInfo.m │ │ ├── SSHardwareInfo.h │ │ ├── SSNetworkInfo.h │ │ ├── SSJailbreakCheck.h │ │ ├── SSUUID.m │ │ ├── SSAccelerometerInfo.h │ │ ├── SSBatteryInfo.m │ │ ├── SSLocalizationInfo.m │ │ ├── SSApplicationInfo.m │ │ ├── SSProcessorInfo.m │ │ ├── SSCarrierInfo.m │ │ ├── SSAccessoryInfo.m │ │ └── SSAccelerometerInfo.m └── PublicHeaders.h ├── generate-docs.sh ├── .travis.yml ├── .swiftlint.yml ├── Insider.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcshareddata │ └── xcschemes │ ├── SwiftLint.xcscheme │ ├── Insider.xcscheme │ └── InsiderDemo.xcscheme ├── InsiderDemo ├── LogViewController.h ├── main.m ├── AppDelegate.h ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── LogViewController.m ├── Info.plist ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard └── AppDelegate.m ├── scripts ├── system_info.rb ├── send_message.rb ├── notification.rb ├── send_message_with_response.rb └── http_client.rb ├── Insider ├── DeviceInfoService.swift ├── Insider.h ├── LocalWebServerResponse.swift ├── Info.plist └── LocalWebServer.swift ├── Insider.podspec ├── LICENSE └── .gitignore /.swift-version: -------------------------------------------------------------------------------- 1 | 4.0 2 | -------------------------------------------------------------------------------- /docs/img/gh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmx/Insider/HEAD/docs/img/gh.png -------------------------------------------------------------------------------- /assets/sandbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmx/Insider/HEAD/assets/sandbox.png -------------------------------------------------------------------------------- /docs/img/carat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmx/Insider/HEAD/docs/img/carat.png -------------------------------------------------------------------------------- /docs/img/dash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmx/Insider/HEAD/docs/img/dash.png -------------------------------------------------------------------------------- /docs/docsets/Insider.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmx/Insider/HEAD/docs/docsets/Insider.tgz -------------------------------------------------------------------------------- /docs/undocumented.json: -------------------------------------------------------------------------------- 1 | { 2 | "warnings": [ 3 | 4 | ], 5 | "source_directory": "/Users/amaimescu/Documents/Projects/mine/Insider" 6 | } -------------------------------------------------------------------------------- /Libs/GCDWebServer/GCDWebUploader.bundle/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmx/Insider/HEAD/Libs/GCDWebServer/GCDWebUploader.bundle/Info.plist -------------------------------------------------------------------------------- /docs/docsets/Insider.docset/Contents/Resources/docSet.dsidx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmx/Insider/HEAD/docs/docsets/Insider.docset/Contents/Resources/docSet.dsidx -------------------------------------------------------------------------------- /generate-docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Author: Alex Maimescu 3 | 4 | jazzy --module Insider --github_url https://github.com/alexmx/Insider --author "Alex Maimescu" 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | osx_image: xcode9 3 | 4 | script: 5 | - xcodebuild clean build -project Insider.xcodeproj -scheme InsiderDemo -sdk iphonesimulator 6 | -------------------------------------------------------------------------------- /docs/docsets/Insider.docset/Contents/Resources/Documents/img/dash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmx/Insider/HEAD/docs/docsets/Insider.docset/Contents/Resources/Documents/img/dash.png -------------------------------------------------------------------------------- /docs/docsets/Insider.docset/Contents/Resources/Documents/img/gh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmx/Insider/HEAD/docs/docsets/Insider.docset/Contents/Resources/Documents/img/gh.png -------------------------------------------------------------------------------- /docs/docsets/Insider.docset/Contents/Resources/Documents/img/carat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmx/Insider/HEAD/docs/docsets/Insider.docset/Contents/Resources/Documents/img/carat.png -------------------------------------------------------------------------------- /docs/docsets/Insider.docset/Contents/Resources/Documents/undocumented.json: -------------------------------------------------------------------------------- 1 | { 2 | "warnings": [ 3 | 4 | ], 5 | "source_directory": "/Users/amaimescu/Documents/Projects/mine/Insider" 6 | } -------------------------------------------------------------------------------- /.swiftlint.yml: -------------------------------------------------------------------------------- 1 | disabled_rules: 2 | - trailing_whitespace 3 | - trailing_newline 4 | - line_length 5 | - type_name 6 | 7 | excluded: 8 | - Carthage 9 | - Pods 10 | - Libs 11 | -------------------------------------------------------------------------------- /Libs/GCDWebServer/GCDWebUploader.bundle/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmx/Insider/HEAD/Libs/GCDWebServer/GCDWebUploader.bundle/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /Libs/GCDWebServer/GCDWebUploader.bundle/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmx/Insider/HEAD/Libs/GCDWebServer/GCDWebUploader.bundle/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /Libs/GCDWebServer/GCDWebUploader.bundle/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmx/Insider/HEAD/Libs/GCDWebServer/GCDWebUploader.bundle/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /Insider.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Libs/GCDWebServer/GCDWebUploader.bundle/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | "PROLOGUE" = "

Drag & drop files on this window or use the \"Upload Files…\" button to upload new files.

"; 2 | "EPILOGUE" = ""; 3 | "FOOTER_FORMAT" = "%@ %@"; 4 | -------------------------------------------------------------------------------- /InsiderDemo/LogViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LogViewController.h 3 | // Insider 4 | // 5 | // Created by Alexandru Maimescu on 2/22/16. 6 | // Copyright © 2016 Alex Maimescu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LogViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Insider.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /scripts/system_info.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | # author: Alex Maimescu 3 | # twitter: https://twitter.com/amaimescu 4 | 5 | require './http_client' 6 | require 'json' 7 | 8 | ENDPOINT = "systemInfo" 9 | 10 | puts "Get System Info" 11 | response = send_get_request(ENDPOINT) 12 | puts "System Info:" 13 | puts JSON.pretty_generate(JSON.parse(response.body)) -------------------------------------------------------------------------------- /Libs/System Services/Utilities/SSProcessInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSProcessInfo.h 3 | // SystemServicesDemo 4 | // 5 | // Created by Shmoopi LLC on 9/18/12. 6 | // Copyright (c) 2012 Shmoopi LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SSProcessInfo : NSObject 12 | 13 | // Process Information 14 | 15 | // Process ID 16 | + (int)processID; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Libs/System Services/Utilities/SSUUID.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSUUID.h 3 | // SystemServicesDemo 4 | // 5 | // Created by Shmoopi LLC on 9/21/12. 6 | // Copyright (c) 2012 Shmoopi LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SSUUID : NSObject 12 | 13 | // CFUUID - Random Unique Identifier that changes every time 14 | + (nullable NSString *)cfuuid; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /InsiderDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // InsiderDemo 4 | // 5 | // Created by Alexandru Maimescu on 2/16/16. 6 | // Copyright © 2016 Alex Maimescu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Insider/DeviceInfoService.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DeviceInfoService.swift 3 | // Insider 4 | // 5 | // Created by Alexandru Maimescu on 2/18/16. 6 | // Copyright © 2016 Alex Maimescu. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | final class DeviceInfoService { 12 | 13 | var allSystemInfo: InsiderMessage? { 14 | return SystemServices.shared().allSystemInformation as InsiderMessage? 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /InsiderDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // InsiderDemo 4 | // 5 | // Created by Alexandru Maimescu on 2/16/16. 6 | // Copyright © 2016 Alex Maimescu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | extern NSString * kLogMessageNotificationKey; 12 | 13 | @interface AppDelegate : UIResponder 14 | 15 | @property (strong, nonatomic) UIWindow *window; 16 | 17 | @end 18 | 19 | -------------------------------------------------------------------------------- /Insider/Insider.h: -------------------------------------------------------------------------------- 1 | // 2 | // Insider.h 3 | // Insider 4 | // 5 | // Created by Alexandru Maimescu on 2/16/16. 6 | // Copyright © 2016 Alex Maimescu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for Insider. 12 | FOUNDATION_EXPORT double InsiderVersionNumber; 13 | 14 | //! Project version string for Insider. 15 | FOUNDATION_EXPORT const unsigned char InsiderVersionString[]; 16 | 17 | #import 18 | -------------------------------------------------------------------------------- /scripts/send_message.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | # author: Alex Maimescu 3 | # twitter: https://twitter.com/amaimescu 4 | 5 | require './http_client' 6 | require 'json' 7 | 8 | ENDPOINT = "send" 9 | 10 | arguments = ARGV[0] 11 | params = nil 12 | 13 | if arguments == nil 14 | params = { 15 | 'project' => 'Insider', 16 | 'action'=> 'send_message' 17 | } 18 | else 19 | params = JSON.parse(arguments) 20 | end 21 | 22 | puts "Send POST request with params #{params}" 23 | send_post_request(ENDPOINT, params) -------------------------------------------------------------------------------- /Libs/System Services/Utilities/SSBatteryInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSBatteryInfo.h 3 | // SystemServicesDemo 4 | // 5 | // Created by Shmoopi LLC on 9/18/12. 6 | // Copyright (c) 2012 Shmoopi LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SSBatteryInfo : NSObject 12 | 13 | // Battery Information 14 | 15 | // Battery Level 16 | + (float)batteryLevel; 17 | 18 | // Charging? 19 | + (BOOL)charging; 20 | 21 | // Fully Charged? 22 | + (BOOL)fullyCharged; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /scripts/notification.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | # author: Alex Maimescu 3 | # twitter: https://twitter.com/amaimescu 4 | 5 | require './http_client' 6 | require 'json' 7 | 8 | ENDPOINT = "notification" 9 | 10 | arguments = ARGV[0] 11 | params = nil 12 | 13 | if arguments == nil 14 | params = { 15 | 'project' => 'Insider', 16 | 'action'=> 'notification' 17 | } 18 | else 19 | params = JSON.parse(arguments) 20 | end 21 | 22 | puts "Send POST request with params #{params}" 23 | send_post_request(ENDPOINT, params) -------------------------------------------------------------------------------- /scripts/send_message_with_response.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | # author: Alex Maimescu 3 | # twitter: https://twitter.com/amaimescu 4 | 5 | require './http_client' 6 | require 'json' 7 | 8 | ENDPOINT = "sendAndWaitForResponse" 9 | 10 | arguments = ARGV[0] 11 | params = nil 12 | 13 | if arguments == nil 14 | params = { 15 | 'project' => 'Insider', 16 | 'action'=> 'send_message_with_response' 17 | } 18 | else 19 | params = JSON.parse(arguments) 20 | end 21 | 22 | puts "Send POST request with params #{params}" 23 | response = send_post_request(ENDPOINT, params) 24 | puts "Response: #{response.body}" -------------------------------------------------------------------------------- /Libs/System Services/Utilities/SSLocalizationInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSLocalizationInfo.h 3 | // SystemServicesDemo 4 | // 5 | // Created by Shmoopi LLC on 9/20/12. 6 | // Copyright (c) 2012 Shmoopi LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SSLocalizationInfo : NSObject 12 | 13 | // Localization Information 14 | 15 | // Country 16 | + (nullable NSString *)country; 17 | 18 | // Language 19 | + (nullable NSString *)language; 20 | 21 | // TimeZone 22 | + (nullable NSString *)timeZone; 23 | 24 | // Currency Symbol 25 | + (nullable NSString *)currency; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Libs/PublicHeaders.h: -------------------------------------------------------------------------------- 1 | // 2 | // PublicHeaders.h 3 | // Insider 4 | // 5 | // Created by Alexandru Maimescu on 3/2/16. 6 | // Copyright © 2016 Alex Maimescu. All rights reserved. 7 | // 8 | 9 | #ifndef PublicHeaders_h 10 | #define PublicHeaders_h 11 | 12 | // GCDWebServer https://github.com/swisspol/GCDWebServer 13 | 14 | #import "GCDWebServer.h" 15 | #import "GCDWebServerURLEncodedFormRequest.h" 16 | #import "GCDWebServerDataResponse.h" 17 | #import "GCDWebUploader.h" 18 | 19 | // iOS-System-Services https://github.com/Shmoopi/iOS-System-Services 20 | 21 | #import "SystemServices.h" 22 | 23 | #endif /* PublicHeaders_h */ 24 | -------------------------------------------------------------------------------- /Libs/System Services/Utilities/SSApplicationInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSApplicationInfo.h 3 | // SystemServicesDemo 4 | // 5 | // Created by Shmoopi LLC on 9/20/12. 6 | // Created by binaryboy on 10/24/15. 7 | // Copyright (c) 2012 Shmoopi LLC. All rights reserved. 8 | // 9 | 10 | #import 11 | 12 | @interface SSApplicationInfo : NSObject 13 | 14 | // Application Information 15 | 16 | // Application Version 17 | + (nullable NSString *)applicationVersion; 18 | 19 | // Clipboard Content 20 | + (nullable NSString *)clipboardContent; 21 | 22 | // Application CPU Usage 23 | + (float)cpuUsage; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Libs/System Services/Utilities/SSProcessorInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSProcessorInfo.h 3 | // SystemServicesDemo 4 | // 5 | // Created by Shmoopi LLC on 9/17/12. 6 | // Copyright (c) 2012 Shmoopi LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SSProcessorInfo : NSObject 12 | 13 | // Processor Information 14 | 15 | // Number of processors 16 | + (NSInteger)numberProcessors; 17 | 18 | // Number of Active Processors 19 | + (NSInteger)numberActiveProcessors; 20 | 21 | // Get Processor Usage Information (i.e. ["0.2216801", "0.1009614"]) 22 | + (NSArray *)processorsUsage; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /scripts/http_client.rb: -------------------------------------------------------------------------------- 1 | # author: Alex Maimescu 2 | # twitter: https://twitter.com/amaimescu 3 | 4 | require 'net/http' 5 | 6 | TESTING_HTTP_SERVER_URL = 'http://localhost:8080/' 7 | 8 | def send_post_request(endpoint, params) 9 | url = URI.parse(TESTING_HTTP_SERVER_URL + endpoint) 10 | req = Net::HTTP::Post.new(url.to_s) 11 | req.body = URI.encode_www_form(params) 12 | res = Net::HTTP.start(url.host, url.port) {|http| 13 | http.request(req) 14 | } 15 | end 16 | 17 | def send_get_request(endpoint) 18 | url = URI.parse(TESTING_HTTP_SERVER_URL + endpoint) 19 | req = Net::HTTP::Get.new(url.to_s) 20 | res = Net::HTTP.start(url.host, url.port) {|http| 21 | http.request(req) 22 | } 23 | end -------------------------------------------------------------------------------- /Libs/System Services/Utilities/SSAccessoryInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSAccessoryInfo.h 3 | // SystemServicesDemo 4 | // 5 | // Created by Shmoopi LLC on 9/17/12. 6 | // Copyright (c) 2012 Shmoopi LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SSAccessoryInfo : NSObject 12 | 13 | // Accessory Information 14 | 15 | // Are any accessories attached? 16 | + (BOOL)accessoriesAttached; 17 | 18 | // Are headphone attached? 19 | + (BOOL)headphonesAttached; 20 | 21 | // Number of attached accessories 22 | + (NSInteger)numberAttachedAccessories; 23 | 24 | // Name of attached accessory/accessories (seperated by , comma's) 25 | + (nullable NSString *)nameAttachedAccessories; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /docs/docsets/Insider.docset/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIdentifier 6 | com.jazzy.insider 7 | CFBundleName 8 | Insider 9 | DocSetPlatformFamily 10 | insider 11 | isDashDocset 12 | 13 | dashIndexFilePath 14 | index.html 15 | isJavaScriptEnabled 16 | 17 | DashDocSetFamily 18 | dashtoc 19 | 20 | 21 | -------------------------------------------------------------------------------- /Libs/System Services/Utilities/SSDiskInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSDiskInfo.h 3 | // SystemServicesDemo 4 | // 5 | // Created by Shmoopi LLC on 9/18/12. 6 | // Copyright (c) 2012 Shmoopi LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SSDiskInfo : NSObject 12 | 13 | // Disk Information 14 | 15 | // Total Disk Space 16 | + (nullable NSString *)diskSpace; 17 | 18 | // Total Free Disk Space 19 | + (nullable NSString *)freeDiskSpace:(BOOL)inPercent; 20 | 21 | // Total Used Disk Space 22 | + (nullable NSString *)usedDiskSpace:(BOOL)inPercent; 23 | 24 | // Get the total disk space in long format 25 | + (long long)longDiskSpace; 26 | 27 | // Get the total free disk space in long format 28 | + (long long)longFreeDiskSpace; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Insider/LocalWebServerResponse.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LocalWebServerResponse.swift 3 | // Insider 4 | // 5 | // Created by Alexandru Maimescu on 2/19/16. 6 | // Copyright © 2016 Alex Maimescu. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | enum LocalWebServerResponseStatusCode: Int { 12 | case success = 200 13 | case notFound = 404 14 | } 15 | 16 | final class LocalWebServerResponse { 17 | 18 | var statusCode: LocalWebServerResponseStatusCode 19 | var response: InsiderMessage? 20 | 21 | init(statusCode: LocalWebServerResponseStatusCode) { 22 | self.statusCode = statusCode 23 | } 24 | 25 | init(response: InsiderMessage?) { 26 | self.statusCode = .success 27 | self.response = response 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /docs/badge.svg: -------------------------------------------------------------------------------- 1 | documentationdocumentation100%100% -------------------------------------------------------------------------------- /Libs/System Services/Utilities/SSCarrierInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSCarrierInfo.h 3 | // SystemServicesDemo 4 | // 5 | // Created by Shmoopi LLC on 9/17/12. 6 | // Copyright (c) 2012 Shmoopi LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SSCarrierInfo : NSObject 12 | 13 | // Carrier Information 14 | 15 | // Carrier Name 16 | + (nullable NSString *)carrierName; 17 | 18 | // Carrier Country 19 | + (nullable NSString *)carrierCountry; 20 | 21 | // Carrier Mobile Country Code 22 | + (nullable NSString *)carrierMobileCountryCode; 23 | 24 | // Carrier ISO Country Code 25 | + (nullable NSString *)carrierISOCountryCode; 26 | 27 | // Carrier Mobile Network Code 28 | + (nullable NSString *)carrierMobileNetworkCode; 29 | 30 | // Carrier Allows VOIP 31 | + (BOOL)carrierAllowsVOIP; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Libs/System Services/Utilities/SSMemoryInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSMemoryInfo.h 3 | // SystemServicesDemo 4 | // 5 | // Created by Shmoopi LLC on 9/19/12. 6 | // Copyright (c) 2012 Shmoopi LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SSMemoryInfo : NSObject 12 | 13 | // Memory Information 14 | 15 | // Total Memory 16 | + (double)totalMemory; 17 | 18 | // Free Memory 19 | + (double)freeMemory:(BOOL)inPercent; 20 | 21 | // Used Memory 22 | + (double)usedMemory:(BOOL)inPercent; 23 | 24 | // Active Memory 25 | + (double)activeMemory:(BOOL)inPercent; 26 | 27 | // Inactive Memory 28 | + (double)inactiveMemory:(BOOL)inPercent; 29 | 30 | // Wired Memory 31 | + (double)wiredMemory:(BOOL)inPercent; 32 | 33 | // Purgable Memory 34 | + (double)purgableMemory:(BOOL)inPercent; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /docs/docsets/Insider.docset/Contents/Resources/Documents/badge.svg: -------------------------------------------------------------------------------- 1 | documentationdocumentation100%100% -------------------------------------------------------------------------------- /Libs/System Services/Utilities/SSProcessInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSProcessInfo.m 3 | // SystemServicesDemo 4 | // 5 | // Created by Shmoopi LLC on 9/18/12. 6 | // Copyright (c) 2012 Shmoopi LLC. All rights reserved. 7 | // 8 | 9 | #import "SSProcessInfo.h" 10 | 11 | // sysctl 12 | #import 13 | 14 | @implementation SSProcessInfo 15 | 16 | // Process Information 17 | 18 | // Process ID 19 | + (int)processID { 20 | // Get the Process ID 21 | @try { 22 | // Get the PID 23 | int pid = getpid(); 24 | // Make sure it's correct 25 | if (pid <= 0) { 26 | // Incorrect PID 27 | return -1; 28 | } 29 | // Successful 30 | return pid; 31 | } 32 | @catch (NSException *exception) { 33 | // Error 34 | return -1; 35 | } 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /Libs/GCDWebServer/GCDWebUploader.bundle/css/jquery.fileupload.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | /* 3 | * jQuery File Upload Plugin CSS 1.3.0 4 | * https://github.com/blueimp/jQuery-File-Upload 5 | * 6 | * Copyright 2013, Sebastian Tschan 7 | * https://blueimp.net 8 | * 9 | * Licensed under the MIT license: 10 | * http://www.opensource.org/licenses/MIT 11 | */ 12 | 13 | .fileinput-button { 14 | position: relative; 15 | overflow: hidden; 16 | } 17 | .fileinput-button input { 18 | position: absolute; 19 | top: 0; 20 | right: 0; 21 | margin: 0; 22 | opacity: 0; 23 | -ms-filter: 'alpha(opacity=0)'; 24 | font-size: 200px; 25 | direction: ltr; 26 | cursor: pointer; 27 | } 28 | 29 | /* Fixes for IE < 8 */ 30 | @media screen\9 { 31 | .fileinput-button input { 32 | filter: alpha(opacity=0); 33 | font-size: 100%; 34 | height: 100%; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Insider/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Libs/GCDWebServer/GCDWebUploader.bundle/js/tmpl.min.js: -------------------------------------------------------------------------------- 1 | !function(a){"use strict";var b=function(a,c){var d=/[^\w\-\.:]/.test(a)?new Function(b.arg+",tmpl","var _e=tmpl.encode"+b.helper+",_s='"+a.replace(b.regexp,b.func)+"';return _s;"):b.cache[a]=b.cache[a]||b(b.load(a));return c?d(c,b):function(a){return d(a,b)}};b.cache={},b.load=function(a){return document.getElementById(a).innerHTML},b.regexp=/([\s'\\])(?!(?:[^{]|\{(?!%))*%\})|(?:\{%(=|#)([\s\S]+?)%\})|(\{%)|(%\})/g,b.func=function(a,b,c,d,e,f){return b?{"\n":"\\n","\r":"\\r"," ":"\\t"," ":" "}[b]||"\\"+b:c?"="===c?"'+_e("+d+")+'":"'+("+d+"==null?'':"+d+")+'":e?"';":f?"_s+='":void 0},b.encReg=/[<>&"'\x00]/g,b.encMap={"<":"<",">":">","&":"&",'"':""","'":"'"},b.encode=function(a){return(null==a?"":""+a).replace(b.encReg,function(a){return b.encMap[a]||""})},b.arg="o",b.helper=",print=function(s,e){_s+=e?(s==null?'':s):_e(s);},include=function(s,d){_s+=tmpl(s,d);}","function"==typeof define&&define.amd?define(function(){return b}):a.tmpl=b}(this); -------------------------------------------------------------------------------- /Insider.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | 4 | s.name = "Insider" 5 | s.version = "1.0.1" 6 | s.summary = "Insider is an utility framework which sets a backdoor into your app for testing tools like Appium, Calabash, Frank, etc." 7 | 8 | s.description = <<-DESC 9 | Insider is an utility framework which sets a backdoor into your app for testing tools like Appium, Calabash, Frank, etc. 10 | Insider runs an HTTP server inside the application and listens for commands (RPCs). 11 | DESC 12 | 13 | 14 | s.homepage = "https://github.com/alexmx/Insider" 15 | s.license = "MIT" 16 | s.authors = "Alex Maimescu" 17 | 18 | s.platform = :ios 19 | s.ios.deployment_target = '8.0' 20 | 21 | s.source = { :git => "https://github.com/alexmx/Insider.git", :tag => "v#{s.version}" } 22 | s.source_files = "Insider/**/*.{swift}", "Libs/**/*.{h,m,swift}" 23 | 24 | s.libraries = 'xml2', 'z' 25 | 26 | end 27 | -------------------------------------------------------------------------------- /InsiderDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "size" : "1024x1024", 46 | "scale" : "1x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /InsiderDemo/LogViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // LogViewController.m 3 | // Insider 4 | // 5 | // Created by Alexandru Maimescu on 2/22/16. 6 | // Copyright © 2016 Alex Maimescu. All rights reserved. 7 | // 8 | 9 | #import "LogViewController.h" 10 | #import "AppDelegate.h" 11 | 12 | @interface LogViewController () 13 | 14 | @property (weak, nonatomic) IBOutlet UILabel *instructionsLabel; 15 | @property (weak, nonatomic) IBOutlet UITextView *logTextView; 16 | 17 | @end 18 | 19 | @implementation LogViewController 20 | 21 | - (void)viewDidLoad 22 | { 23 | [super viewDidLoad]; 24 | 25 | self.logTextView.text = nil; 26 | 27 | [[NSNotificationCenter defaultCenter] addObserver:self 28 | selector:@selector(didReceiveNotification:) 29 | name:kLogMessageNotificationKey 30 | object:nil]; 31 | } 32 | 33 | - (void)didReceiveNotification:(NSNotification *)notification 34 | { 35 | self.logTextView.text = [NSString stringWithFormat:@"%@\n%@", self.logTextView.text, notification.object]; 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Alex Maimescu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Libs/System Services/Utilities/SSHardwareInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSHardwareInfo.h 3 | // SystemServicesDemo 4 | // 5 | // Created by Shmoopi LLC on 9/15/12. 6 | // Copyright (c) 2012 Shmoopi LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SSHardwareInfo : NSObject 12 | 13 | // System Hardware Information 14 | 15 | // System Uptime (dd hh mm) 16 | + (nullable NSString *)systemUptime; 17 | 18 | // Model of Device 19 | + (nullable NSString *)deviceModel; 20 | 21 | // Device Name 22 | + (nullable NSString *)deviceName; 23 | 24 | // System Name 25 | + (nullable NSString *)systemName; 26 | 27 | // System Version 28 | + (nullable NSString *)systemVersion; 29 | 30 | // System Device Type (iPhone1,0) (Formatted = iPhone 1) 31 | + (nullable NSString *)systemDeviceTypeFormatted:(BOOL)formatted; 32 | 33 | // Get the Screen Width (X) 34 | + (NSInteger)screenWidth; 35 | 36 | // Get the Screen Height (Y) 37 | + (NSInteger)screenHeight; 38 | 39 | // Get the Screen Brightness 40 | + (float)screenBrightness; 41 | 42 | // Multitasking enabled? 43 | + (BOOL)multitaskingEnabled; 44 | 45 | // Proximity sensor enabled? 46 | + (BOOL)proximitySensorEnabled; 47 | 48 | // Debugger Attached? 49 | + (BOOL)debuggerAttached; 50 | 51 | // Plugged In? 52 | + (BOOL)pluggedIn; 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /Libs/System Services/Utilities/SSNetworkInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSNetworkInfo.h 3 | // SystemServicesDemo 4 | // 5 | // Created by Shmoopi LLC on 9/18/12. 6 | // Copyright (c) 2012 Shmoopi LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SSNetworkInfo : NSObject 12 | 13 | // Network Information 14 | 15 | // Get Current IP Address 16 | + (nullable NSString *)currentIPAddress; 17 | 18 | // Get the External IP Address 19 | + (nullable NSString *)externalIPAddress; 20 | 21 | // Get Cell IP Address 22 | + (nullable NSString *)cellIPAddress; 23 | 24 | // Get Cell IPv6 Address 25 | + (nullable NSString *)cellIPv6Address; 26 | 27 | // Get Cell Netmask Address 28 | + (nullable NSString *)cellNetmaskAddress; 29 | 30 | // Get Cell Broadcast Address 31 | + (nullable NSString *)cellBroadcastAddress; 32 | 33 | // Get WiFi IP Address 34 | + (nullable NSString *)wiFiIPAddress; 35 | 36 | // Get WiFi IPv6 Address 37 | + (nullable NSString *)wiFiIPv6Address; 38 | 39 | // Get WiFi Netmask Address 40 | + (nullable NSString *)wiFiNetmaskAddress; 41 | 42 | // Get WiFi Broadcast Address 43 | + (nullable NSString *)wiFiBroadcastAddress; 44 | 45 | // Get WiFi Router Address 46 | + (nullable NSString *)wiFiRouterAddress; 47 | 48 | // Connected to WiFi? 49 | + (BOOL)connectedToWiFi; 50 | 51 | // Connected to Cellular Network? 52 | + (BOOL)connectedToCellNetwork; 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /InsiderDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationPortraitUpsideDown 37 | UIInterfaceOrientationLandscapeLeft 38 | UIInterfaceOrientationLandscapeRight 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Libs/GCDWebServer/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2014, Pierre-Olivier Latour 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * The name of Pierre-Olivier Latour may not be used to endorse 12 | or promote products derived from this software without specific 13 | prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /docs/js/jazzy.js: -------------------------------------------------------------------------------- 1 | window.jazzy = {'docset': false} 2 | if (typeof window.dash != 'undefined') { 3 | document.documentElement.className += ' dash' 4 | window.jazzy.docset = true 5 | } 6 | if (navigator.userAgent.match(/xcode/i)) { 7 | document.documentElement.className += ' xcode' 8 | window.jazzy.docset = true 9 | } 10 | 11 | // On doc load, toggle the URL hash discussion if present 12 | $(document).ready(function() { 13 | if (!window.jazzy.docset) { 14 | var linkToHash = $('a[href="' + window.location.hash +'"]'); 15 | linkToHash.trigger("click"); 16 | } 17 | }); 18 | 19 | // On token click, toggle its discussion and animate token.marginLeft 20 | $(".token").click(function(event) { 21 | if (window.jazzy.docset) { 22 | return; 23 | } 24 | var link = $(this); 25 | var animationDuration = 300; 26 | var tokenOffset = "15px"; 27 | var original = link.css('marginLeft') == tokenOffset; 28 | link.animate({'margin-left':original ? "0px" : tokenOffset}, animationDuration); 29 | $content = link.parent().parent().next(); 30 | $content.slideToggle(animationDuration); 31 | 32 | // Keeps the document from jumping to the hash. 33 | var href = $(this).attr('href'); 34 | if (history.pushState) { 35 | history.pushState({}, '', href); 36 | } else { 37 | location.hash = href; 38 | } 39 | event.preventDefault(); 40 | }); 41 | 42 | // Dumb down quotes within code blocks that delimit strings instead of quotations 43 | // https://github.com/realm/jazzy/issues/714 44 | $("code q").replaceWith(function () { 45 | return ["\"", $(this).contents(), "\""]; 46 | }); 47 | -------------------------------------------------------------------------------- /docs/docsets/Insider.docset/Contents/Resources/Documents/js/jazzy.js: -------------------------------------------------------------------------------- 1 | window.jazzy = {'docset': false} 2 | if (typeof window.dash != 'undefined') { 3 | document.documentElement.className += ' dash' 4 | window.jazzy.docset = true 5 | } 6 | if (navigator.userAgent.match(/xcode/i)) { 7 | document.documentElement.className += ' xcode' 8 | window.jazzy.docset = true 9 | } 10 | 11 | // On doc load, toggle the URL hash discussion if present 12 | $(document).ready(function() { 13 | if (!window.jazzy.docset) { 14 | var linkToHash = $('a[href="' + window.location.hash +'"]'); 15 | linkToHash.trigger("click"); 16 | } 17 | }); 18 | 19 | // On token click, toggle its discussion and animate token.marginLeft 20 | $(".token").click(function(event) { 21 | if (window.jazzy.docset) { 22 | return; 23 | } 24 | var link = $(this); 25 | var animationDuration = 300; 26 | var tokenOffset = "15px"; 27 | var original = link.css('marginLeft') == tokenOffset; 28 | link.animate({'margin-left':original ? "0px" : tokenOffset}, animationDuration); 29 | $content = link.parent().parent().next(); 30 | $content.slideToggle(animationDuration); 31 | 32 | // Keeps the document from jumping to the hash. 33 | var href = $(this).attr('href'); 34 | if (history.pushState) { 35 | history.pushState({}, '', href); 36 | } else { 37 | location.hash = href; 38 | } 39 | event.preventDefault(); 40 | }); 41 | 42 | // Dumb down quotes within code blocks that delimit strings instead of quotations 43 | // https://github.com/realm/jazzy/issues/714 44 | $("code q").replaceWith(function () { 45 | return ["\"", $(this).contents(), "\""]; 46 | }); 47 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata 19 | 20 | ## Other 21 | *.xccheckout 22 | *.moved-aside 23 | *.xcuserstate 24 | *.xcscmblueprint 25 | 26 | ## Obj-C/Swift specific 27 | *.hmap 28 | *.ipa 29 | 30 | ## Playgrounds 31 | timeline.xctimeline 32 | playground.xcworkspace 33 | 34 | # Swift Package Manager 35 | # 36 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 37 | # Packages/ 38 | .build/ 39 | 40 | # CocoaPods 41 | # 42 | # We recommend against adding the Pods directory to your .gitignore. However 43 | # you should judge for yourself, the pros and cons are mentioned at: 44 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 45 | # 46 | # Pods/ 47 | 48 | # Carthage 49 | # 50 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 51 | # Carthage/Checkouts 52 | 53 | Carthage/Build 54 | 55 | # fastlane 56 | # 57 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 58 | # screenshots whenever they are needed. 59 | # For more information about the recommended setup visit: 60 | # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md 61 | 62 | fastlane/report.xml 63 | fastlane/screenshots 64 | -------------------------------------------------------------------------------- /Libs/System Services/Utilities/SSJailbreakCheck.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSJailbreakCheck.h 3 | // SystemServicesDemo 4 | // 5 | // Created by Shmoopi LLC on 9/17/12. 6 | // Copyright (c) 2012 Shmoopi LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /* Jailbreak Check Definitions */ 12 | 13 | #define NOTJAIL 4783242 14 | 15 | // Define the filesystem check 16 | #define FILECHECK [NSFileManager defaultManager] fileExistsAtPath: 17 | // Define the exe path 18 | #define EXEPATH [[NSBundle mainBundle] executablePath] 19 | // Define the plist path 20 | #define PLISTPATH [[NSBundle mainBundle] infoDictionary] 21 | 22 | // Jailbreak Check Definitions 23 | #define CYDIAPACKAGE @"cydia://package/com.fake.package" 24 | #define CYDIALOC @"/Applications/Cydia.app" 25 | #define HIDDENFILES [NSArray arrayWithObjects:@"/Applications/RockApp.app",@"/Applications/Icy.app",@"/usr/sbin/sshd",@"/usr/bin/sshd",@"/usr/libexec/sftp-server",@"/Applications/WinterBoard.app",@"/Applications/SBSettings.app",@"/Applications/MxTube.app",@"/Applications/IntelliScreen.app",@"/Library/MobileSubstrate/DynamicLibraries/Veency.plist",@"/Library/MobileSubstrate/DynamicLibraries/LiveClock.plist",@"/private/var/lib/apt",@"/private/var/stash",@"/System/Library/LaunchDaemons/com.ikey.bbot.plist",@"/System/Library/LaunchDaemons/com.saurik.Cydia.Startup.plist",@"/private/var/tmp/cydia.log",@"/private/var/lib/cydia", @"/etc/clutch.conf", @"/var/cache/clutch.plist", @"/etc/clutch_cracked.plist", @"/var/cache/clutch_cracked.plist", @"/var/lib/clutch/overdrive.dylib", @"/var/root/Documents/Cracked/", nil] 26 | 27 | /* End Jailbreak Definitions */ 28 | 29 | @interface SSJailbreakCheck : NSObject 30 | 31 | // Jailbreak Check 32 | 33 | // Jailbroken? 34 | + (int)jailbroken; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Libs/System Services/Utilities/SSUUID.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSUUID.m 3 | // SystemServicesDemo 4 | // 5 | // Created by Shmoopi LLC on 9/21/12. 6 | // Copyright (c) 2012 Shmoopi LLC. All rights reserved. 7 | // 8 | 9 | #import "SSUUID.h" 10 | #import "SSHardwareInfo.h" 11 | #import "SSProcessorInfo.h" 12 | #import "SSNetworkInfo.h" 13 | #import "SSDiskInfo.h" 14 | #import "SSAccelerometerInfo.h" 15 | #import "SSLocalizationInfo.h" 16 | #import "SSMemoryInfo.h" 17 | #import "SSJailbreakCheck.h" 18 | #import "SSAccessoryInfo.h" 19 | #import "SSBatteryInfo.h" 20 | 21 | @implementation SSUUID 22 | 23 | // CFUUID 24 | + (NSString *)cfuuid { 25 | // Create a new CFUUID (Unique, random ID number) (Always different) 26 | @try { 27 | // Create a new instance of CFUUID using CFUUIDCreate using the default allocator 28 | CFUUIDRef theUUID = CFUUIDCreate(kCFAllocatorDefault); 29 | 30 | // Check to make sure it exists 31 | if (theUUID) 32 | { 33 | // Make the new UUID String 34 | NSString *tempUniqueID = (__bridge NSString *)CFUUIDCreateString(kCFAllocatorDefault, theUUID); 35 | 36 | // Check to make sure it created it 37 | if (tempUniqueID == nil || tempUniqueID.length <= 0) { 38 | // Error, Unable to create 39 | // Release the UUID Reference 40 | CFRelease(theUUID); 41 | // Return nil 42 | return nil; 43 | } 44 | 45 | // Release the UUID Reference 46 | CFRelease(theUUID); 47 | 48 | // Successful 49 | return tempUniqueID; 50 | } else { 51 | // Error 52 | // Release the UUID Reference 53 | CFRelease(theUUID); 54 | // Return nil 55 | return nil; 56 | } 57 | } 58 | @catch (NSException *exception) { 59 | // Error 60 | return nil; 61 | } 62 | } 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /Libs/System Services/Utilities/SSAccelerometerInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSAccelerometerInfo.h 3 | // SystemServicesDemo 4 | // 5 | // Created by Shmoopi LLC on 9/20/12. 6 | // Copyright (c) 2012 Shmoopi LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | // Core Motion 13 | #import 14 | 15 | @interface SSAccelerometerInfo : NSObject { 16 | CMMotionManager *motionManager; 17 | 18 | NSOperationQueue *deviceMotionQueue; 19 | NSOperationQueue *accelQueue; 20 | NSOperationQueue *gyroQueue; 21 | } 22 | 23 | // Accelerometer Information 24 | 25 | // Device Orientation 26 | + (UIInterfaceOrientation)deviceOrientation; 27 | 28 | // Attitude 29 | @property (nonatomic, readonly, nullable) NSString *attitudeString; 30 | 31 | // Gravity 32 | @property (nonatomic, readonly, nullable) NSString *gravityString; 33 | 34 | // Magnetic Field 35 | @property (nonatomic, readonly, nullable) NSString *magneticFieldString; 36 | 37 | // Rotation Rate 38 | @property (nonatomic, readonly, nullable) NSString *rotationRateString; 39 | 40 | // User Acceleration 41 | @property (nonatomic, readonly, nullable) NSString *userAccelerationString; 42 | 43 | // Raw Gyroscope 44 | @property (nonatomic, readonly, nullable) NSString *rawGyroscopeString; 45 | 46 | // Raw Accelerometer 47 | @property (nonatomic, readonly, nullable) NSString *rawAccelerometerString; 48 | 49 | /** 50 | * startLoggingMotionData 51 | * 52 | * This method uses the boolean instance variables to tell the CMMotionManager what 53 | * to do. The three main types of IMU capture each have their own NSOperationQueue. 54 | * A queue will only be utilized if its respective motion type is going to be logged. 55 | * 56 | */ 57 | - (void)startLoggingMotionData; 58 | 59 | /** 60 | * stopLoggingMotionDataAndSave 61 | * 62 | * Tells the CMMotionManager to stop the motion updates and calls the writeDataToDisk 63 | * method. The only gotchya is that we wait for the NSOperationQueues to finish 64 | * what they are doing first so that we're not accessing the same resource from 65 | * different points in the program. 66 | */ 67 | - (void)stopLoggingMotionData; 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /Libs/GCDWebServer/Requests/GCDWebServerFileRequest.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import "GCDWebServerRequest.h" 29 | 30 | /** 31 | * The GCDWebServerFileRequest subclass of GCDWebServerRequest stores the body 32 | * of the HTTP request to a file on disk. 33 | */ 34 | @interface GCDWebServerFileRequest : GCDWebServerRequest 35 | 36 | /** 37 | * Returns the path to the temporary file containing the request body. 38 | * 39 | * @warning This temporary file will be automatically deleted when the 40 | * GCDWebServerFileRequest is deallocated. If you want to preserve this file, 41 | * you must move it to a different location beforehand. 42 | */ 43 | @property(nonatomic, readonly) NSString* temporaryPath; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Libs/GCDWebServer/Requests/GCDWebServerURLEncodedFormRequest.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import "GCDWebServerDataRequest.h" 29 | 30 | /** 31 | * The GCDWebServerURLEncodedFormRequest subclass of GCDWebServerRequest 32 | * parses the body of the HTTP request as a URL encoded form using 33 | * GCDWebServerParseURLEncodedForm(). 34 | */ 35 | @interface GCDWebServerURLEncodedFormRequest : GCDWebServerDataRequest 36 | 37 | /** 38 | * Returns the unescaped control names and values for the URL encoded form. 39 | * 40 | * The text encoding used to interpret the data is extracted from the 41 | * "Content-Type" header or defaults to UTF-8. 42 | */ 43 | @property(nonatomic, readonly) NSDictionary* arguments; 44 | 45 | /** 46 | * Returns the MIME type for URL encoded forms 47 | * i.e. "application/x-www-form-urlencoded". 48 | */ 49 | + (NSString*)mimeType; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Libs/GCDWebServer/GCDWebUploader.bundle/js/html5shiv.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | HTML5 Shiv v3.7.0 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed 3 | */ 4 | (function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag(); 5 | a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x"; 6 | c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode|| 7 | "undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:"3.7.0",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f); 8 | if(g)return a.createDocumentFragment();for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d 13 | 14 | @implementation SSBatteryInfo 15 | 16 | // Battery Information 17 | 18 | // Battery Level 19 | + (float)batteryLevel { 20 | // Find the battery level 21 | @try { 22 | // Get the device 23 | UIDevice *device = [UIDevice currentDevice]; 24 | // Set battery monitoring on 25 | device.batteryMonitoringEnabled = YES; 26 | 27 | // Set up the battery level float 28 | float batteryLevel = 0.0; 29 | // Get the battery level 30 | float batteryCharge = [device batteryLevel]; 31 | 32 | // Check to make sure the battery level is more than zero 33 | if (batteryCharge > 0.0f) { 34 | // Make the battery level float equal to the charge * 100 35 | batteryLevel = batteryCharge * 100; 36 | } else { 37 | // Unable to find the battery level 38 | return -1; 39 | } 40 | 41 | // Output the battery level 42 | return batteryLevel; 43 | } 44 | @catch (NSException *exception) { 45 | // Error out 46 | return -1; 47 | } 48 | } 49 | 50 | // Charging? 51 | + (BOOL)charging { 52 | // Is the battery charging? 53 | @try { 54 | // Get the device 55 | UIDevice *device = [UIDevice currentDevice]; 56 | // Set battery monitoring on 57 | device.batteryMonitoringEnabled = YES; 58 | 59 | // Check the battery state 60 | if ([device batteryState] == UIDeviceBatteryStateCharging || [device batteryState] == UIDeviceBatteryStateFull) { 61 | // Device is charging 62 | return true; 63 | } else { 64 | // Device is not charging 65 | return false; 66 | } 67 | } 68 | @catch (NSException *exception) { 69 | // Error out 70 | return false; 71 | } 72 | } 73 | 74 | // Fully Charged? 75 | + (BOOL)fullyCharged { 76 | // Is the battery fully charged? 77 | @try { 78 | // Get the device 79 | UIDevice *device = [UIDevice currentDevice]; 80 | // Set battery monitoring on 81 | device.batteryMonitoringEnabled = YES; 82 | 83 | // Check the battery state 84 | if ([device batteryState] == UIDeviceBatteryStateFull) { 85 | // Device is fully charged 86 | return true; 87 | } else { 88 | // Device is not fully charged 89 | return false; 90 | } 91 | } 92 | @catch (NSException *exception) { 93 | // Error out 94 | return false; 95 | } 96 | } 97 | 98 | @end 99 | -------------------------------------------------------------------------------- /Libs/GCDWebServer/Requests/GCDWebServerURLEncodedFormRequest.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #if !__has_feature(objc_arc) 29 | #error GCDWebServer requires ARC 30 | #endif 31 | 32 | #import "GCDWebServerPrivate.h" 33 | 34 | @interface GCDWebServerURLEncodedFormRequest () { 35 | @private 36 | NSDictionary* _arguments; 37 | } 38 | @end 39 | 40 | @implementation GCDWebServerURLEncodedFormRequest 41 | 42 | @synthesize arguments=_arguments; 43 | 44 | + (NSString*)mimeType { 45 | return @"application/x-www-form-urlencoded"; 46 | } 47 | 48 | - (BOOL)close:(NSError**)error { 49 | if (![super close:error]) { 50 | return NO; 51 | } 52 | 53 | NSString* charset = GCDWebServerExtractHeaderValueParameter(self.contentType, @"charset"); 54 | NSString* string = [[NSString alloc] initWithData:self.data encoding:GCDWebServerStringEncodingFromCharset(charset)]; 55 | _arguments = GCDWebServerParseURLEncodedForm(string); 56 | GWS_DCHECK(_arguments); 57 | 58 | return YES; 59 | } 60 | 61 | - (NSString*)description { 62 | NSMutableString* description = [NSMutableString stringWithString:[super description]]; 63 | [description appendString:@"\n"]; 64 | for (NSString* argument in [[_arguments allKeys] sortedArrayUsingSelector:@selector(compare:)]) { 65 | [description appendFormat:@"\n%@ = %@", argument, [_arguments objectForKey:argument]]; 66 | } 67 | return description; 68 | } 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /InsiderDemo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Libs/System Services/Utilities/SSLocalizationInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSLocalizationInfo.m 3 | // SystemServicesDemo 4 | // 5 | // Created by Shmoopi LLC on 9/20/12. 6 | // Copyright (c) 2012 Shmoopi LLC. All rights reserved. 7 | // 8 | 9 | #import "SSLocalizationInfo.h" 10 | 11 | @implementation SSLocalizationInfo 12 | 13 | // Localization Information 14 | 15 | // Country 16 | + (NSString *)country { 17 | // Get the user's country 18 | @try { 19 | // Get the locale 20 | NSLocale *locale = [NSLocale currentLocale]; 21 | // Get the country from the locale 22 | NSString *country = [locale localeIdentifier]; 23 | // Check for validity 24 | if (country == nil || country.length <= 0) { 25 | // Error, invalid country 26 | return nil; 27 | } 28 | // Completed Successfully 29 | return country; 30 | } 31 | @catch (NSException *exception) { 32 | // Error 33 | return nil; 34 | } 35 | } 36 | 37 | // Language 38 | + (NSString *)language { 39 | // Get the user's language 40 | @try { 41 | // Get the list of languages 42 | NSArray *languageArray = [NSLocale preferredLanguages]; 43 | // Get the user's language 44 | NSString *language = [languageArray objectAtIndex:0]; 45 | // Check for validity 46 | if (language == nil || language.length <= 0) { 47 | // Error, invalid language 48 | return nil; 49 | } 50 | // Completed Successfully 51 | return language; 52 | } 53 | @catch (NSException *exception) { 54 | // Error 55 | return nil; 56 | } 57 | } 58 | 59 | // TimeZone 60 | + (NSString *)timeZone { 61 | // Get the user's timezone 62 | @try { 63 | // Get the system timezone 64 | NSTimeZone *localTime = [NSTimeZone systemTimeZone]; 65 | // Convert the time zone to a string 66 | NSString *timeZone = [localTime name]; 67 | // Check for validity 68 | if (timeZone == nil || timeZone.length <= 0) { 69 | // Error, invalid TimeZone 70 | return nil; 71 | } 72 | // Completed Successfully 73 | return timeZone; 74 | } 75 | @catch (NSException *exception) { 76 | // Error 77 | return nil; 78 | } 79 | } 80 | 81 | // Currency Symbol 82 | + (NSString *)currency { 83 | // Get the user's currency 84 | @try { 85 | // Get the system currency 86 | NSString *currency = [[NSLocale currentLocale] objectForKey:NSLocaleCurrencySymbol]; 87 | // Check for validity 88 | if (currency == nil || currency.length <= 0) { 89 | // Error, invalid Currency 90 | return nil; 91 | } 92 | // Completed Successfully 93 | return currency; 94 | } 95 | @catch (NSException *exception) { 96 | // Error 97 | return nil; 98 | } 99 | } 100 | 101 | @end 102 | -------------------------------------------------------------------------------- /Insider.xcodeproj/xcshareddata/xcschemes/SwiftLint.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 47 | 48 | 54 | 55 | 56 | 57 | 58 | 59 | 65 | 66 | 72 | 73 | 74 | 75 | 77 | 78 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /Insider.xcodeproj/xcshareddata/xcschemes/Insider.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 47 | 48 | 54 | 55 | 56 | 57 | 58 | 59 | 65 | 66 | 72 | 73 | 74 | 75 | 77 | 78 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /Libs/GCDWebServer/Responses/GCDWebServerStreamedResponse.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #if !__has_feature(objc_arc) 29 | #error GCDWebServer requires ARC 30 | #endif 31 | 32 | #import "GCDWebServerPrivate.h" 33 | 34 | @interface GCDWebServerStreamedResponse () { 35 | @private 36 | GCDWebServerAsyncStreamBlock _block; 37 | } 38 | @end 39 | 40 | @implementation GCDWebServerStreamedResponse 41 | 42 | + (instancetype)responseWithContentType:(NSString*)type streamBlock:(GCDWebServerStreamBlock)block { 43 | return [[[self class] alloc] initWithContentType:type streamBlock:block]; 44 | } 45 | 46 | + (instancetype)responseWithContentType:(NSString*)type asyncStreamBlock:(GCDWebServerAsyncStreamBlock)block { 47 | return [[[self class] alloc] initWithContentType:type asyncStreamBlock:block]; 48 | } 49 | 50 | - (instancetype)initWithContentType:(NSString*)type streamBlock:(GCDWebServerStreamBlock)block { 51 | return [self initWithContentType:type asyncStreamBlock:^(GCDWebServerBodyReaderCompletionBlock completionBlock) { 52 | 53 | NSError* error = nil; 54 | NSData* data = block(&error); 55 | completionBlock(data, error); 56 | 57 | }]; 58 | } 59 | 60 | - (instancetype)initWithContentType:(NSString*)type asyncStreamBlock:(GCDWebServerAsyncStreamBlock)block { 61 | if ((self = [super init])) { 62 | _block = [block copy]; 63 | 64 | self.contentType = type; 65 | } 66 | return self; 67 | } 68 | 69 | - (void)asyncReadDataWithCompletion:(GCDWebServerBodyReaderCompletionBlock)block { 70 | _block(block); 71 | } 72 | 73 | - (NSString*)description { 74 | NSMutableString* description = [NSMutableString stringWithString:[super description]]; 75 | [description appendString:@"\n\n"]; 76 | return description; 77 | } 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /Libs/GCDWebServer/GCDWebUploader.bundle/css/index.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | .row-file { 29 | height: 40px; 30 | } 31 | 32 | .column-icon { 33 | width: 40px; 34 | text-align: center; 35 | } 36 | 37 | .column-name { 38 | } 39 | 40 | .column-size { 41 | width: 100px; 42 | text-align: right; 43 | } 44 | 45 | .column-move { 46 | width: 40px; 47 | text-align: center; 48 | } 49 | 50 | .column-delete { 51 | width: 40px; 52 | text-align: center; 53 | } 54 | 55 | .column-path { 56 | } 57 | 58 | .column-progress { 59 | width: 200px; 60 | } 61 | 62 | .footer { 63 | color: #999; 64 | text-align: center; 65 | font-size: 0.9em; 66 | } 67 | 68 | #reload { 69 | float: right; 70 | } 71 | 72 | #create-input { 73 | width: 50%; 74 | height: 20px; 75 | } 76 | 77 | #move-input { 78 | width: 80%; 79 | height: 20px; 80 | } 81 | 82 | /* Bootstrap overrides */ 83 | 84 | .btn:focus { 85 | outline: none; /* FIXME: Work around for Chrome only but still draws focus ring while button pressed */ 86 | } 87 | 88 | .btn-toolbar { 89 | margin-top: 30px; 90 | margin-bottom: 20px; 91 | } 92 | 93 | .table .progress { 94 | margin-top: 0px; 95 | margin-bottom: 0px; 96 | height: 16px; 97 | } 98 | 99 | .panel-default > .panel-heading { 100 | color: #555; 101 | } 102 | 103 | .breadcrumb { 104 | background-color: transparent; 105 | border-radius: 0px; 106 | margin-bottom: 0px; 107 | padding: 0px; 108 | } 109 | 110 | .breadcrumb > .active { 111 | color: #555; 112 | } 113 | 114 | .breadcrumb > li + li:before { 115 | color: #999; 116 | } 117 | 118 | .table > tbody > tr > td { 119 | vertical-align: middle; 120 | } 121 | 122 | .table > tbody > tr > td > p { 123 | margin: 0px; 124 | } 125 | 126 | /* Initial state */ 127 | 128 | .uploading { 129 | display: none; 130 | } 131 | -------------------------------------------------------------------------------- /Libs/GCDWebServer/Responses/GCDWebServerStreamedResponse.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import "GCDWebServerResponse.h" 29 | 30 | /** 31 | * The GCDWebServerStreamBlock is called to stream the data for the HTTP body. 32 | * The block must return either a chunk of data, an empty NSData when done, or 33 | * nil on error and set the "error" argument which is guaranteed to be non-NULL. 34 | */ 35 | typedef NSData* (^GCDWebServerStreamBlock)(NSError** error); 36 | 37 | /** 38 | * The GCDWebServerAsyncStreamBlock works like the GCDWebServerStreamBlock 39 | * except the streamed data can be returned at a later time allowing for 40 | * truly asynchronous generation of the data. 41 | * 42 | * The block must call "completionBlock" passing the new chunk of data when ready, 43 | * an empty NSData when done, or nil on error and pass a NSError. 44 | * 45 | * The block cannot call "completionBlock" more than once per invocation. 46 | */ 47 | typedef void (^GCDWebServerAsyncStreamBlock)(GCDWebServerBodyReaderCompletionBlock completionBlock); 48 | 49 | /** 50 | * The GCDWebServerStreamedResponse subclass of GCDWebServerResponse streams 51 | * the body of the HTTP response using a GCD block. 52 | */ 53 | @interface GCDWebServerStreamedResponse : GCDWebServerResponse 54 | 55 | /** 56 | * Creates a response with streamed data and a given content type. 57 | */ 58 | + (instancetype)responseWithContentType:(NSString*)type streamBlock:(GCDWebServerStreamBlock)block; 59 | 60 | /** 61 | * Creates a response with async streamed data and a given content type. 62 | */ 63 | + (instancetype)responseWithContentType:(NSString*)type asyncStreamBlock:(GCDWebServerAsyncStreamBlock)block; 64 | 65 | /** 66 | * Initializes a response with streamed data and a given content type. 67 | */ 68 | - (instancetype)initWithContentType:(NSString*)type streamBlock:(GCDWebServerStreamBlock)block; 69 | 70 | /** 71 | * This method is the designated initializer for the class. 72 | */ 73 | - (instancetype)initWithContentType:(NSString*)type asyncStreamBlock:(GCDWebServerAsyncStreamBlock)block; 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /Insider.xcodeproj/xcshareddata/xcschemes/InsiderDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 56 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 77 | 83 | 84 | 85 | 86 | 88 | 89 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /docs/search.json: -------------------------------------------------------------------------------- 1 | {"Protocols/InsiderDelegate.html#/c:@M@Insider@objc(pl)InsiderDelegate(im)insider:didReceiveRemoteMessage:":{"name":"insider(_:didReceiveRemote:)","abstract":"

This method will be called on delegate for send command

","parent_name":"InsiderDelegate"},"Protocols/InsiderDelegate.html#/c:@M@Insider@objc(pl)InsiderDelegate(im)insider:returnResponseMessageForRemoteMessage:":{"name":"insider(_:returnResponseMessageForRemote:)","abstract":"

This method will be called on delegate for sendAndWaitForResponse command

","parent_name":"InsiderDelegate"},"Protocols/InsiderDelegate.html#/c:@M@Insider@objc(pl)InsiderDelegate(im)insider:didSendNotificationWithMessage:":{"name":"insider(_:didSendNotificationWith:)","abstract":"

This method will be called on delegate for notification command

","parent_name":"InsiderDelegate"},"Protocols/InsiderDelegate.html#/c:@M@Insider@objc(pl)InsiderDelegate(im)insider:didReturnSystemInfo:":{"name":"insider(_:didReturn:)","abstract":"

This method will be called on delegate for systemInfo command

","parent_name":"InsiderDelegate"},"Protocols/InsiderDelegate.html#/c:@M@Insider@objc(pl)InsiderDelegate(im)insider:didCreateDirectoryAtPath:":{"name":"insider(_:didCreateDirectoryAt:)","abstract":"

This method is caled when a new directory is created in sandbox

","parent_name":"InsiderDelegate"},"Protocols/InsiderDelegate.html#/c:@M@Insider@objc(pl)InsiderDelegate(im)insider:didDeleteItemAtPath:":{"name":"insider(_:didDeleteItemAt:)","abstract":"

This method is called when an item is removed from sandbox

","parent_name":"InsiderDelegate"},"Protocols/InsiderDelegate.html#/c:@M@Insider@objc(pl)InsiderDelegate(im)insider:didDownloadFileAtPath:":{"name":"insider(_:didDownloadFileAt:)","abstract":"

This method is called when an item is downloaded from sandbox

","parent_name":"InsiderDelegate"},"Protocols/InsiderDelegate.html#/c:@M@Insider@objc(pl)InsiderDelegate(im)insider:didMoveItemFromPath:toPath:":{"name":"insider(_:didMoveItem:to:)","abstract":"

This method is called when an item is moved in sandbox

","parent_name":"InsiderDelegate"},"Protocols/InsiderDelegate.html#/c:@M@Insider@objc(pl)InsiderDelegate(im)insider:didUploadFileAtPath:":{"name":"insider(_:didUploadFileAt:)","abstract":"

This method is called when an item is uploaded to sandbox

","parent_name":"InsiderDelegate"},"Protocols/InsiderDelegate.html":{"name":"InsiderDelegate","abstract":"

The Insider delegate protocol.

"},"Classes/Insider.html#/c:@M@Insider@objc(cs)Insider(cpy)shared":{"name":"shared","abstract":"

The shared instance.

","parent_name":"Insider"},"Classes/Insider.html#/c:@M@Insider@objc(cs)Insider(py)delegate":{"name":"delegate","abstract":"

The Insider delegate.

","parent_name":"Insider"},"Classes/Insider.html#/c:@M@Insider@objc(cs)Insider(cpy)insiderNotificationKey":{"name":"insiderNotificationKey","abstract":"

The Insider notification key.

","parent_name":"Insider"},"Classes/Insider.html#/c:@M@Insider@objc(cs)Insider(im)start":{"name":"start()","abstract":"

Start the local web server which will listen for commands.","parent_name":"Insider"},"Classes/Insider.html#/c:@M@Insider@objc(cs)Insider(im)startWithDelegate:":{"name":"start(withDelegate:)","abstract":"

Start the local web server which will listen for commands, for given delegate.","parent_name":"Insider"},"Classes/Insider.html#/c:@M@Insider@objc(cs)Insider(im)startWithDelegate:port:":{"name":"start(withDelegate:port:)","abstract":"

Start the local web server which will listen for commands, for given delegate and port number.

","parent_name":"Insider"},"Classes/Insider.html#/c:@M@Insider@objc(cs)Insider(im)stop":{"name":"stop()","abstract":"

Stop the local web server.

","parent_name":"Insider"},"Classes/Insider.html":{"name":"Insider","abstract":"

The Insider API facade class.

"},"Classes.html":{"name":"Classes","abstract":"

The following classes are available globally.

"},"Protocols.html":{"name":"Protocols","abstract":"

The following protocols are available globally.

"}} -------------------------------------------------------------------------------- /docs/docsets/Insider.docset/Contents/Resources/Documents/search.json: -------------------------------------------------------------------------------- 1 | {"Protocols/InsiderDelegate.html#/c:@M@Insider@objc(pl)InsiderDelegate(im)insider:didReceiveRemoteMessage:":{"name":"insider(_:didReceiveRemote:)","abstract":"

This method will be called on delegate for send command

","parent_name":"InsiderDelegate"},"Protocols/InsiderDelegate.html#/c:@M@Insider@objc(pl)InsiderDelegate(im)insider:returnResponseMessageForRemoteMessage:":{"name":"insider(_:returnResponseMessageForRemote:)","abstract":"

This method will be called on delegate for sendAndWaitForResponse command

","parent_name":"InsiderDelegate"},"Protocols/InsiderDelegate.html#/c:@M@Insider@objc(pl)InsiderDelegate(im)insider:didSendNotificationWithMessage:":{"name":"insider(_:didSendNotificationWith:)","abstract":"

This method will be called on delegate for notification command

","parent_name":"InsiderDelegate"},"Protocols/InsiderDelegate.html#/c:@M@Insider@objc(pl)InsiderDelegate(im)insider:didReturnSystemInfo:":{"name":"insider(_:didReturn:)","abstract":"

This method will be called on delegate for systemInfo command

","parent_name":"InsiderDelegate"},"Protocols/InsiderDelegate.html#/c:@M@Insider@objc(pl)InsiderDelegate(im)insider:didCreateDirectoryAtPath:":{"name":"insider(_:didCreateDirectoryAt:)","abstract":"

This method is caled when a new directory is created in sandbox

","parent_name":"InsiderDelegate"},"Protocols/InsiderDelegate.html#/c:@M@Insider@objc(pl)InsiderDelegate(im)insider:didDeleteItemAtPath:":{"name":"insider(_:didDeleteItemAt:)","abstract":"

This method is called when an item is removed from sandbox

","parent_name":"InsiderDelegate"},"Protocols/InsiderDelegate.html#/c:@M@Insider@objc(pl)InsiderDelegate(im)insider:didDownloadFileAtPath:":{"name":"insider(_:didDownloadFileAt:)","abstract":"

This method is called when an item is downloaded from sandbox

","parent_name":"InsiderDelegate"},"Protocols/InsiderDelegate.html#/c:@M@Insider@objc(pl)InsiderDelegate(im)insider:didMoveItemFromPath:toPath:":{"name":"insider(_:didMoveItem:to:)","abstract":"

This method is called when an item is moved in sandbox

","parent_name":"InsiderDelegate"},"Protocols/InsiderDelegate.html#/c:@M@Insider@objc(pl)InsiderDelegate(im)insider:didUploadFileAtPath:":{"name":"insider(_:didUploadFileAt:)","abstract":"

This method is called when an item is uploaded to sandbox

","parent_name":"InsiderDelegate"},"Protocols/InsiderDelegate.html":{"name":"InsiderDelegate","abstract":"

The Insider delegate protocol.

"},"Classes/Insider.html#/c:@M@Insider@objc(cs)Insider(cpy)shared":{"name":"shared","abstract":"

The shared instance.

","parent_name":"Insider"},"Classes/Insider.html#/c:@M@Insider@objc(cs)Insider(py)delegate":{"name":"delegate","abstract":"

The Insider delegate.

","parent_name":"Insider"},"Classes/Insider.html#/c:@M@Insider@objc(cs)Insider(cpy)insiderNotificationKey":{"name":"insiderNotificationKey","abstract":"

The Insider notification key.

","parent_name":"Insider"},"Classes/Insider.html#/c:@M@Insider@objc(cs)Insider(im)start":{"name":"start()","abstract":"

Start the local web server which will listen for commands.","parent_name":"Insider"},"Classes/Insider.html#/c:@M@Insider@objc(cs)Insider(im)startWithDelegate:":{"name":"start(withDelegate:)","abstract":"

Start the local web server which will listen for commands, for given delegate.","parent_name":"Insider"},"Classes/Insider.html#/c:@M@Insider@objc(cs)Insider(im)startWithDelegate:port:":{"name":"start(withDelegate:port:)","abstract":"

Start the local web server which will listen for commands, for given delegate and port number.

","parent_name":"Insider"},"Classes/Insider.html#/c:@M@Insider@objc(cs)Insider(im)stop":{"name":"stop()","abstract":"

Stop the local web server.

","parent_name":"Insider"},"Classes/Insider.html":{"name":"Insider","abstract":"

The Insider API facade class.

"},"Classes.html":{"name":"Classes","abstract":"

The following classes are available globally.

"},"Protocols.html":{"name":"Protocols","abstract":"

The following protocols are available globally.

"}} -------------------------------------------------------------------------------- /Libs/GCDWebServer/Requests/GCDWebServerDataRequest.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #if !__has_feature(objc_arc) 29 | #error GCDWebServer requires ARC 30 | #endif 31 | 32 | #import "GCDWebServerPrivate.h" 33 | 34 | @interface GCDWebServerDataRequest () { 35 | @private 36 | NSMutableData* _data; 37 | 38 | NSString* _text; 39 | id _jsonObject; 40 | } 41 | @end 42 | 43 | @implementation GCDWebServerDataRequest 44 | 45 | @synthesize data=_data; 46 | 47 | - (BOOL)open:(NSError**)error { 48 | if (self.contentLength != NSUIntegerMax) { 49 | _data = [[NSMutableData alloc] initWithCapacity:self.contentLength]; 50 | } else { 51 | _data = [[NSMutableData alloc] init]; 52 | } 53 | if (_data == nil) { 54 | if (error) { 55 | *error = [NSError errorWithDomain:kGCDWebServerErrorDomain code:-1 userInfo:@{NSLocalizedDescriptionKey: @"Failed allocating memory"}]; 56 | } 57 | return NO; 58 | } 59 | return YES; 60 | } 61 | 62 | - (BOOL)writeData:(NSData*)data error:(NSError**)error { 63 | [_data appendData:data]; 64 | return YES; 65 | } 66 | 67 | - (BOOL)close:(NSError**)error { 68 | return YES; 69 | } 70 | 71 | - (NSString*)description { 72 | NSMutableString* description = [NSMutableString stringWithString:[super description]]; 73 | if (_data) { 74 | [description appendString:@"\n\n"]; 75 | [description appendString:GCDWebServerDescribeData(_data, self.contentType)]; 76 | } 77 | return description; 78 | } 79 | 80 | @end 81 | 82 | @implementation GCDWebServerDataRequest (Extensions) 83 | 84 | - (NSString*)text { 85 | if (_text == nil) { 86 | if ([self.contentType hasPrefix:@"text/"]) { 87 | NSString* charset = GCDWebServerExtractHeaderValueParameter(self.contentType, @"charset"); 88 | _text = [[NSString alloc] initWithData:self.data encoding:GCDWebServerStringEncodingFromCharset(charset)]; 89 | } else { 90 | GWS_DNOT_REACHED(); 91 | } 92 | } 93 | return _text; 94 | } 95 | 96 | - (id)jsonObject { 97 | if (_jsonObject == nil) { 98 | NSString* mimeType = GCDWebServerTruncateHeaderValue(self.contentType); 99 | if ([mimeType isEqualToString:@"application/json"] || [mimeType isEqualToString:@"text/json"] || [mimeType isEqualToString:@"text/javascript"]) { 100 | _jsonObject = [NSJSONSerialization JSONObjectWithData:_data options:0 error:NULL]; 101 | } else { 102 | GWS_DNOT_REACHED(); 103 | } 104 | } 105 | return _jsonObject; 106 | } 107 | 108 | @end 109 | -------------------------------------------------------------------------------- /Libs/GCDWebServer/Core/GCDWebServerFunctions.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | /** 35 | * Converts a file extension to the corresponding MIME type. 36 | * If there is no match, "application/octet-stream" is returned. 37 | */ 38 | NSString* GCDWebServerGetMimeTypeForExtension(NSString* extension); 39 | 40 | /** 41 | * Add percent-escapes to a string so it can be used in a URL. 42 | * The legal characters ":@/?&=+" are also escaped to ensure compatibility 43 | * with URL encoded forms and URL queries. 44 | */ 45 | NSString* GCDWebServerEscapeURLString(NSString* string); 46 | 47 | /** 48 | * Unescapes a URL percent-encoded string. 49 | */ 50 | NSString* GCDWebServerUnescapeURLString(NSString* string); 51 | 52 | /** 53 | * Extracts the unescaped names and values from an 54 | * "application/x-www-form-urlencoded" form. 55 | * http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1 56 | */ 57 | NSDictionary* GCDWebServerParseURLEncodedForm(NSString* form); 58 | 59 | /** 60 | * On OS X, returns the IPv4 or IPv6 address as a string of the primary 61 | * connected service or nil if not available. 62 | * 63 | * On iOS, returns the IPv4 or IPv6 address as a string of the WiFi 64 | * interface if connected or nil otherwise. 65 | */ 66 | NSString* GCDWebServerGetPrimaryIPAddress(BOOL useIPv6); 67 | 68 | /** 69 | * Converts a date into a string using RFC822 formatting. 70 | * https://tools.ietf.org/html/rfc822#section-5 71 | * https://tools.ietf.org/html/rfc1123#section-5.2.14 72 | */ 73 | NSString* GCDWebServerFormatRFC822(NSDate* date); 74 | 75 | /** 76 | * Converts a RFC822 formatted string into a date. 77 | * https://tools.ietf.org/html/rfc822#section-5 78 | * https://tools.ietf.org/html/rfc1123#section-5.2.14 79 | * 80 | * @warning Timezones other than GMT are not supported by this function. 81 | */ 82 | NSDate* GCDWebServerParseRFC822(NSString* string); 83 | 84 | /** 85 | * Converts a date into a string using IOS 8601 formatting. 86 | * http://tools.ietf.org/html/rfc3339#section-5.6 87 | */ 88 | NSString* GCDWebServerFormatISO8601(NSDate* date); 89 | 90 | /** 91 | * Converts a ISO 8601 formatted string into a date. 92 | * http://tools.ietf.org/html/rfc3339#section-5.6 93 | * 94 | * @warning Only "calendar" variant is supported at this time and timezones 95 | * other than GMT are not supported either. 96 | */ 97 | NSDate* GCDWebServerParseISO8601(NSString* string); 98 | 99 | #ifdef __cplusplus 100 | } 101 | #endif 102 | -------------------------------------------------------------------------------- /Libs/GCDWebServer/Responses/GCDWebServerErrorResponse.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import "GCDWebServerDataResponse.h" 29 | #import "GCDWebServerHTTPStatusCodes.h" 30 | 31 | /** 32 | * The GCDWebServerDataResponse subclass of GCDWebServerDataResponse generates 33 | * an HTML body from an HTTP status code and an error message. 34 | */ 35 | @interface GCDWebServerErrorResponse : GCDWebServerDataResponse 36 | 37 | /** 38 | * Creates a client error response with the corresponding HTTP status code. 39 | */ 40 | + (instancetype)responseWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode message:(NSString*)format, ... NS_FORMAT_FUNCTION(2,3); 41 | 42 | /** 43 | * Creates a server error response with the corresponding HTTP status code. 44 | */ 45 | + (instancetype)responseWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode message:(NSString*)format, ... NS_FORMAT_FUNCTION(2,3); 46 | 47 | /** 48 | * Creates a client error response with the corresponding HTTP status code 49 | * and an underlying NSError. 50 | */ 51 | + (instancetype)responseWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... NS_FORMAT_FUNCTION(3,4); 52 | 53 | /** 54 | * Creates a server error response with the corresponding HTTP status code 55 | * and an underlying NSError. 56 | */ 57 | + (instancetype)responseWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... NS_FORMAT_FUNCTION(3,4); 58 | 59 | /** 60 | * Initializes a client error response with the corresponding HTTP status code. 61 | */ 62 | - (instancetype)initWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode message:(NSString*)format, ... NS_FORMAT_FUNCTION(2,3); 63 | 64 | /** 65 | * Initializes a server error response with the corresponding HTTP status code. 66 | */ 67 | - (instancetype)initWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode message:(NSString*)format, ... NS_FORMAT_FUNCTION(2,3); 68 | 69 | /** 70 | * Initializes a client error response with the corresponding HTTP status code 71 | * and an underlying NSError. 72 | */ 73 | - (instancetype)initWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... NS_FORMAT_FUNCTION(3,4); 74 | 75 | /** 76 | * Initializes a server error response with the corresponding HTTP status code 77 | * and an underlying NSError. 78 | */ 79 | - (instancetype)initWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... NS_FORMAT_FUNCTION(3,4); 80 | 81 | @end 82 | -------------------------------------------------------------------------------- /docs/Classes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Classes Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |

Insider Docs (100% documented)

17 |

View on GitHub

18 |
19 |
20 |
21 | 26 |
27 |
28 | 48 |
49 |
50 |
51 |

Classes

52 |

The following classes are available globally.

53 | 54 |
55 |
56 |
57 |
    58 |
  • 59 |
    60 | 61 | 62 | 63 | Insider 64 | 65 |
    66 |
    67 |
    68 |
    69 |
    70 |
    71 |

    The Insider API facade class.

    72 | 73 | See more 74 |
    75 |
    76 |

    Declaration

    77 |
    78 |

    Swift

    79 |
    final public class Insider: NSObject
    80 | 81 |
    82 |
    83 |
    84 |
    85 |
  • 86 |
87 |
88 |
89 |
90 | 94 |
95 |
96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /Libs/GCDWebServer/Responses/GCDWebServerDataResponse.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import "GCDWebServerResponse.h" 29 | 30 | /** 31 | * The GCDWebServerDataResponse subclass of GCDWebServerResponse reads the body 32 | * of the HTTP response from memory. 33 | */ 34 | @interface GCDWebServerDataResponse : GCDWebServerResponse 35 | 36 | /** 37 | * Creates a response with data in memory and a given content type. 38 | */ 39 | + (instancetype)responseWithData:(NSData*)data contentType:(NSString*)type; 40 | 41 | /** 42 | * This method is the designated initializer for the class. 43 | */ 44 | - (instancetype)initWithData:(NSData*)data contentType:(NSString*)type; 45 | 46 | @end 47 | 48 | @interface GCDWebServerDataResponse (Extensions) 49 | 50 | /** 51 | * Creates a data response from text encoded using UTF-8. 52 | */ 53 | + (instancetype)responseWithText:(NSString*)text; 54 | 55 | /** 56 | * Creates a data response from HTML encoded using UTF-8. 57 | */ 58 | + (instancetype)responseWithHTML:(NSString*)html; 59 | 60 | /** 61 | * Creates a data response from an HTML template encoded using UTF-8. 62 | * See -initWithHTMLTemplate:variables: for details. 63 | */ 64 | + (instancetype)responseWithHTMLTemplate:(NSString*)path variables:(NSDictionary*)variables; 65 | 66 | /** 67 | * Creates a data response from a serialized JSON object and the default 68 | * "application/json" content type. 69 | */ 70 | + (instancetype)responseWithJSONObject:(id)object; 71 | 72 | /** 73 | * Creates a data response from a serialized JSON object and a custom 74 | * content type. 75 | */ 76 | + (instancetype)responseWithJSONObject:(id)object contentType:(NSString*)type; 77 | 78 | /** 79 | * Initializes a data response from text encoded using UTF-8. 80 | */ 81 | - (instancetype)initWithText:(NSString*)text; 82 | 83 | /** 84 | * Initializes a data response from HTML encoded using UTF-8. 85 | */ 86 | - (instancetype)initWithHTML:(NSString*)html; 87 | 88 | /** 89 | * Initializes a data response from an HTML template encoded using UTF-8. 90 | * 91 | * All occurences of "%variable%" within the HTML template are replaced with 92 | * their corresponding values. 93 | */ 94 | - (instancetype)initWithHTMLTemplate:(NSString*)path variables:(NSDictionary*)variables; 95 | 96 | /** 97 | * Initializes a data response from a serialized JSON object and the default 98 | * "application/json" content type. 99 | */ 100 | - (instancetype)initWithJSONObject:(id)object; 101 | 102 | /** 103 | * Initializes a data response from a serialized JSON object and a custom 104 | * content type. 105 | */ 106 | - (instancetype)initWithJSONObject:(id)object contentType:(NSString*)type; 107 | 108 | @end 109 | -------------------------------------------------------------------------------- /Libs/GCDWebServer/Responses/GCDWebServerFileResponse.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import "GCDWebServerResponse.h" 29 | 30 | /** 31 | * The GCDWebServerFileResponse subclass of GCDWebServerResponse reads the body 32 | * of the HTTP response from a file on disk. 33 | * 34 | * It will automatically set the contentType, lastModifiedDate and eTag 35 | * properties of the GCDWebServerResponse according to the file extension and 36 | * metadata. 37 | */ 38 | @interface GCDWebServerFileResponse : GCDWebServerResponse 39 | 40 | /** 41 | * Creates a response with the contents of a file. 42 | */ 43 | + (instancetype)responseWithFile:(NSString*)path; 44 | 45 | /** 46 | * Creates a response like +responseWithFile: and sets the "Content-Disposition" 47 | * HTTP header for a download if the "attachment" argument is YES. 48 | */ 49 | + (instancetype)responseWithFile:(NSString*)path isAttachment:(BOOL)attachment; 50 | 51 | /** 52 | * Creates a response like +responseWithFile: but restricts the file contents 53 | * to a specific byte range. 54 | * 55 | * See -initWithFile:byteRange: for details. 56 | */ 57 | + (instancetype)responseWithFile:(NSString*)path byteRange:(NSRange)range; 58 | 59 | /** 60 | * Creates a response like +responseWithFile:byteRange: and sets the 61 | * "Content-Disposition" HTTP header for a download if the "attachment" 62 | * argument is YES. 63 | */ 64 | + (instancetype)responseWithFile:(NSString*)path byteRange:(NSRange)range isAttachment:(BOOL)attachment; 65 | 66 | /** 67 | * Initializes a response with the contents of a file. 68 | */ 69 | - (instancetype)initWithFile:(NSString*)path; 70 | 71 | /** 72 | * Initializes a response like +responseWithFile: and sets the 73 | * "Content-Disposition" HTTP header for a download if the "attachment" 74 | * argument is YES. 75 | */ 76 | - (instancetype)initWithFile:(NSString*)path isAttachment:(BOOL)attachment; 77 | 78 | /** 79 | * Initializes a response like -initWithFile: but restricts the file contents 80 | * to a specific byte range. This range should be set to (NSUIntegerMax, 0) for 81 | * the full file, (offset, length) if expressed from the beginning of the file, 82 | * or (NSUIntegerMax, length) if expressed from the end of the file. The "offset" 83 | * and "length" values will be automatically adjusted to be compatible with the 84 | * actual size of the file. 85 | * 86 | * This argument would typically be set to the value of the byteRange property 87 | * of the current GCDWebServerRequest. 88 | */ 89 | - (instancetype)initWithFile:(NSString*)path byteRange:(NSRange)range; 90 | 91 | /** 92 | * This method is the designated initializer for the class. 93 | */ 94 | - (instancetype)initWithFile:(NSString*)path byteRange:(NSRange)range isAttachment:(BOOL)attachment; 95 | 96 | @end 97 | -------------------------------------------------------------------------------- /docs/Protocols.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Protocols Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |

Insider Docs (100% documented)

17 |

View on GitHub

18 |
19 |
20 |
21 | 26 |
27 |
28 | 48 |
49 |
50 |
51 |

Protocols

52 |

The following protocols are available globally.

53 | 54 |
55 |
56 |
57 |
    58 |
  • 59 |
    60 | 61 | 62 | 63 | InsiderDelegate 64 | 65 |
    66 |
    67 |
    68 |
    69 |
    70 |
    71 |

    The Insider delegate protocol.

    72 | 73 | See more 74 |
    75 |
    76 |

    Declaration

    77 |
    78 |

    Swift

    79 |
    public protocol InsiderDelegate: AnyObject
    80 | 81 |
    82 |
    83 |
    84 |
    85 |
  • 86 |
87 |
88 |
89 |
90 | 94 |
95 |
96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /Libs/GCDWebServer/GCDWebUploader.bundle/js/respond.min.js: -------------------------------------------------------------------------------- 1 | /*! Respond.js v1.4.2: min/max-width media query polyfill * Copyright 2013 Scott Jehl 2 | * Licensed under https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT 3 | * */ 4 | 5 | !function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='­',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){u(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))};if(c.ajax=f,c.queue=d,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,maxw:/\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var g,h,i,j=a.document,k=j.documentElement,l=[],m=[],n=[],o={},p=30,q=j.getElementsByTagName("head")[0]||k,r=j.getElementsByTagName("base")[0],s=q.getElementsByTagName("link"),t=function(){var a,b=j.createElement("div"),c=j.body,d=k.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=j.createElement("body"),c.style.background="none"),k.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&k.insertBefore(c,k.firstChild),a=b.offsetWidth,f?k.removeChild(c):c.removeChild(b),k.style.fontSize=d,e&&(c.style.fontSize=e),a=i=parseFloat(a)},u=function(b){var c="clientWidth",d=k[c],e="CSS1Compat"===j.compatMode&&d||j.body[c]||d,f={},o=s[s.length-1],r=(new Date).getTime();if(b&&g&&p>r-g)return a.clearTimeout(h),h=a.setTimeout(u,p),void 0;g=r;for(var v in l)if(l.hasOwnProperty(v)){var w=l[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?i||t():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?i||t():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(m[w.rules]))}for(var C in n)n.hasOwnProperty(C)&&n[C]&&n[C].parentNode===q&&q.removeChild(n[C]);n.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=j.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,q.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(j.createTextNode(F)),n.push(E)}},v=function(a,b,d){var e=a.replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var g=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},h=!f&&d;b.length&&(b+="/"),h&&(f=1);for(var i=0;f>i;i++){var j,k,n,o;h?(j=d,m.push(g(a))):(j=e[i].match(c.regex.findStyles)&&RegExp.$1,m.push(RegExp.$2&&g(RegExp.$2))),n=j.split(","),o=n.length;for(var p=0;o>p;p++)k=n[p],l.push({media:k.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:m.length-1,hasquery:k.indexOf("(")>-1,minw:k.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:k.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},w=function(){if(d.length){var b=d.shift();f(b.href,function(c){v(c,b.href,b.media),o[b.href]=!0,a.setTimeout(function(){w()},0)})}},x=function(){for(var b=0;b 2 | 3 | 4 | Classes Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |

Insider Docs (100% documented)

17 |

View on GitHub

18 |
19 |
20 |
21 | 26 |
27 |
28 | 48 |
49 |
50 |
51 |

Classes

52 |

The following classes are available globally.

53 | 54 |
55 |
56 |
57 |
    58 |
  • 59 |
    60 | 61 | 62 | 63 | Insider 64 | 65 |
    66 |
    67 |
    68 |
    69 |
    70 |
    71 |

    The Insider API facade class.

    72 | 73 | See more 74 |
    75 |
    76 |

    Declaration

    77 |
    78 |

    Swift

    79 |
    final public class Insider: NSObject
    80 | 81 |
    82 |
    83 |
    84 |
    85 |
  • 86 |
87 |
88 |
89 |
90 | 94 |
95 |
96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /docs/docsets/Insider.docset/Contents/Resources/Documents/Protocols.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Protocols Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |

Insider Docs (100% documented)

17 |

View on GitHub

18 |
19 |
20 |
21 | 26 |
27 |
28 | 48 |
49 |
50 |
51 |

Protocols

52 |

The following protocols are available globally.

53 | 54 |
55 |
56 |
57 |
    58 |
  • 59 |
    60 | 61 | 62 | 63 | InsiderDelegate 64 | 65 |
    66 |
    67 |
    68 |
    69 |
    70 |
    71 |

    The Insider delegate protocol.

    72 | 73 | See more 74 |
    75 |
    76 |

    Declaration

    77 |
    78 |

    Swift

    79 |
    public protocol InsiderDelegate: AnyObject
    80 | 81 |
    82 |
    83 |
    84 |
    85 |
  • 86 |
87 |
88 |
89 |
90 | 94 |
95 |
96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /Libs/GCDWebServer/Requests/GCDWebServerFileRequest.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #if !__has_feature(objc_arc) 29 | #error GCDWebServer requires ARC 30 | #endif 31 | 32 | #import "GCDWebServerPrivate.h" 33 | 34 | @interface GCDWebServerFileRequest () { 35 | @private 36 | NSString* _temporaryPath; 37 | int _file; 38 | } 39 | @end 40 | 41 | @implementation GCDWebServerFileRequest 42 | 43 | @synthesize temporaryPath=_temporaryPath; 44 | 45 | - (instancetype)initWithMethod:(NSString*)method url:(NSURL*)url headers:(NSDictionary*)headers path:(NSString*)path query:(NSDictionary*)query { 46 | if ((self = [super initWithMethod:method url:url headers:headers path:path query:query])) { 47 | _temporaryPath = [NSTemporaryDirectory() stringByAppendingPathComponent:[[NSProcessInfo processInfo] globallyUniqueString]]; 48 | } 49 | return self; 50 | } 51 | 52 | - (void)dealloc { 53 | unlink([_temporaryPath fileSystemRepresentation]); 54 | } 55 | 56 | - (BOOL)open:(NSError**)error { 57 | _file = open([_temporaryPath fileSystemRepresentation], O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); 58 | if (_file <= 0) { 59 | if (error) { 60 | *error = GCDWebServerMakePosixError(errno); 61 | } 62 | return NO; 63 | } 64 | return YES; 65 | } 66 | 67 | - (BOOL)writeData:(NSData*)data error:(NSError**)error { 68 | if (write(_file, data.bytes, data.length) != (ssize_t)data.length) { 69 | if (error) { 70 | *error = GCDWebServerMakePosixError(errno); 71 | } 72 | return NO; 73 | } 74 | return YES; 75 | } 76 | 77 | - (BOOL)close:(NSError**)error { 78 | if (close(_file) < 0) { 79 | if (error) { 80 | *error = GCDWebServerMakePosixError(errno); 81 | } 82 | return NO; 83 | } 84 | #ifdef __GCDWEBSERVER_ENABLE_TESTING__ 85 | NSString* creationDateHeader = [self.headers objectForKey:@"X-GCDWebServer-CreationDate"]; 86 | if (creationDateHeader) { 87 | NSDate* date = GCDWebServerParseISO8601(creationDateHeader); 88 | if (!date || ![[NSFileManager defaultManager] setAttributes:@{NSFileCreationDate: date} ofItemAtPath:_temporaryPath error:error]) { 89 | return NO; 90 | } 91 | } 92 | NSString* modifiedDateHeader = [self.headers objectForKey:@"X-GCDWebServer-ModifiedDate"]; 93 | if (modifiedDateHeader) { 94 | NSDate* date = GCDWebServerParseRFC822(modifiedDateHeader); 95 | if (!date || ![[NSFileManager defaultManager] setAttributes:@{NSFileModificationDate: date} ofItemAtPath:_temporaryPath error:error]) { 96 | return NO; 97 | } 98 | } 99 | #endif 100 | return YES; 101 | } 102 | 103 | - (NSString*)description { 104 | NSMutableString* description = [NSMutableString stringWithString:[super description]]; 105 | [description appendFormat:@"\n\n{%@}", _temporaryPath]; 106 | return description; 107 | } 108 | 109 | @end 110 | -------------------------------------------------------------------------------- /Libs/System Services/Utilities/SSApplicationInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSApplicationInfo.m 3 | // SystemServicesDemo 4 | // 5 | // Created by Shmoopi LLC on 9/20/12. 6 | // Copyright (c) 2012 Shmoopi LLC. All rights reserved. 7 | // 8 | 9 | #import "SSApplicationInfo.h" 10 | 11 | // UIKit 12 | #import 13 | 14 | // mach 15 | #import 16 | 17 | @implementation SSApplicationInfo 18 | 19 | // Application Information 20 | 21 | // Application Version 22 | + (NSString *)applicationVersion { 23 | // Get the Application Version Number 24 | @try { 25 | 26 | // Query the plist for the version 27 | NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]; 28 | 29 | // Validate the Version 30 | if (version == nil || version.length <= 0) { 31 | // Invalid Version number 32 | return nil; 33 | } 34 | // Successful 35 | return version; 36 | } 37 | @catch (NSException *exception) { 38 | // Error 39 | return nil; 40 | } 41 | } 42 | 43 | // Clipboard Content 44 | + (NSString *)clipboardContent { 45 | // Get the string content of the clipboard (copy, paste) 46 | @try { 47 | // Get the Pasteboard 48 | UIPasteboard *pasteBoard = [UIPasteboard generalPasteboard]; 49 | // Get the string value of the pasteboard 50 | NSString *clipboardContent = [pasteBoard string]; 51 | // Check for validity 52 | if (clipboardContent == nil || clipboardContent.length <= 0) { 53 | // Error, invalid pasteboard 54 | return nil; 55 | } 56 | // Successful 57 | return clipboardContent; 58 | } 59 | @catch (NSException *exception) { 60 | // Error 61 | return nil; 62 | } 63 | } 64 | 65 | // Application CPU Usage 66 | + (float)cpuUsage { 67 | @try { 68 | kern_return_t kr; 69 | task_info_data_t tinfo; 70 | mach_msg_type_number_t task_info_count; 71 | 72 | task_info_count = TASK_INFO_MAX; 73 | kr = task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)tinfo, &task_info_count); 74 | if (kr != KERN_SUCCESS) { 75 | return -1; 76 | } 77 | 78 | task_basic_info_t basic_info; 79 | thread_array_t thread_list; 80 | mach_msg_type_number_t thread_count; 81 | 82 | thread_info_data_t thinfo; 83 | mach_msg_type_number_t thread_info_count; 84 | 85 | thread_basic_info_t basic_info_th; 86 | uint32_t stat_thread = 0; // Mach threads 87 | 88 | basic_info = (task_basic_info_t)tinfo; 89 | 90 | // get threads in the task 91 | kr = task_threads(mach_task_self(), &thread_list, &thread_count); 92 | if (kr != KERN_SUCCESS) { 93 | return -1; 94 | } 95 | if (thread_count > 0) 96 | stat_thread += thread_count; 97 | 98 | long tot_sec = 0; 99 | long tot_usec = 0; 100 | float tot_cpu = 0; 101 | int j; 102 | 103 | for (j = 0; j < thread_count; j++) 104 | { 105 | thread_info_count = THREAD_INFO_MAX; 106 | kr = thread_info(thread_list[j], THREAD_BASIC_INFO, 107 | (thread_info_t)thinfo, &thread_info_count); 108 | if (kr != KERN_SUCCESS) { 109 | return -1; 110 | } 111 | 112 | basic_info_th = (thread_basic_info_t)thinfo; 113 | 114 | if (!(basic_info_th->flags & TH_FLAGS_IDLE)) { 115 | tot_sec = tot_sec + basic_info_th->user_time.seconds + basic_info_th->system_time.seconds; 116 | tot_usec = tot_usec + basic_info_th->system_time.microseconds + basic_info_th->system_time.microseconds; 117 | tot_cpu = tot_cpu + basic_info_th->cpu_usage / (float)TH_USAGE_SCALE * 100.0; 118 | } 119 | 120 | } // for each thread 121 | 122 | kr = vm_deallocate(mach_task_self(), (vm_offset_t)thread_list, thread_count * sizeof(thread_t)); 123 | assert(kr == KERN_SUCCESS); 124 | 125 | return tot_cpu; 126 | } 127 | @catch (NSException *exception) { 128 | // Error 129 | return -1; 130 | } 131 | } 132 | 133 | @end 134 | -------------------------------------------------------------------------------- /Libs/System Services/Utilities/SSProcessorInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSProcessorInfo.m 3 | // SystemServicesDemo 4 | // 5 | // Created by Shmoopi LLC on 9/17/12. 6 | // Copyright (c) 2012 Shmoopi LLC. All rights reserved. 7 | // 8 | 9 | #import "SSProcessorInfo.h" 10 | 11 | // Sysctl 12 | #import 13 | 14 | // Mach 15 | #include 16 | 17 | @implementation SSProcessorInfo 18 | 19 | // Processor Information 20 | 21 | // Number of processors 22 | + (NSInteger)numberProcessors { 23 | // See if the process info responds to selector 24 | if ([[NSProcessInfo processInfo] respondsToSelector:@selector(processorCount)]) { 25 | // Get the number of processors 26 | NSInteger processorCount = [[NSProcessInfo processInfo] processorCount]; 27 | // Return the number of processors 28 | return processorCount; 29 | } else { 30 | // Return -1 (not found) 31 | return -1; 32 | } 33 | } 34 | 35 | // Number of Active Processors 36 | + (NSInteger)numberActiveProcessors { 37 | // See if the process info responds to selector 38 | if ([[NSProcessInfo processInfo] respondsToSelector:@selector(activeProcessorCount)]) { 39 | // Get the number of active processors 40 | NSInteger activeprocessorCount = [[NSProcessInfo processInfo] activeProcessorCount]; 41 | // Return the number of active processors 42 | return activeprocessorCount; 43 | } else { 44 | // Return -1 (not found) 45 | return -1; 46 | } 47 | } 48 | 49 | // Get Processor Usage Information (i.e. ["0.2216801", "0.1009614"]) 50 | + (NSArray *)processorsUsage { 51 | 52 | // Try to get Processor Usage Info 53 | @try { 54 | // Variables 55 | processor_info_array_t _cpuInfo, _prevCPUInfo = nil; 56 | mach_msg_type_number_t _numCPUInfo, _numPrevCPUInfo = 0; 57 | unsigned _numCPUs; 58 | NSLock *_cpuUsageLock; 59 | 60 | // Get the number of processors from sysctl 61 | int _mib[2U] = { CTL_HW, HW_NCPU }; 62 | size_t _sizeOfNumCPUs = sizeof(_numCPUs); 63 | int _status = sysctl(_mib, 2U, &_numCPUs, &_sizeOfNumCPUs, NULL, 0U); 64 | if (_status) 65 | _numCPUs = 1; 66 | 67 | // Allocate the lock 68 | _cpuUsageLock = [[NSLock alloc] init]; 69 | 70 | // Get the processor info 71 | natural_t _numCPUsU = 0U; 72 | kern_return_t err = host_processor_info(mach_host_self(), PROCESSOR_CPU_LOAD_INFO, &_numCPUsU, &_cpuInfo, &_numCPUInfo); 73 | if (err == KERN_SUCCESS) { 74 | [_cpuUsageLock lock]; 75 | 76 | // Go through info for each processor 77 | NSMutableArray *processorInfo = [NSMutableArray new]; 78 | for (unsigned i = 0U; i < _numCPUs; ++i) { 79 | Float32 _inUse, _total; 80 | if (_prevCPUInfo) { 81 | _inUse = ( 82 | (_cpuInfo[(CPU_STATE_MAX * i) + CPU_STATE_USER] - _prevCPUInfo[(CPU_STATE_MAX * i) + CPU_STATE_USER]) 83 | + (_cpuInfo[(CPU_STATE_MAX * i) + CPU_STATE_SYSTEM] - _prevCPUInfo[(CPU_STATE_MAX * i) + CPU_STATE_SYSTEM]) 84 | + (_cpuInfo[(CPU_STATE_MAX * i) + CPU_STATE_NICE] - _prevCPUInfo[(CPU_STATE_MAX * i) + CPU_STATE_NICE]) 85 | ); 86 | _total = _inUse + (_cpuInfo[(CPU_STATE_MAX * i) + CPU_STATE_IDLE] - _prevCPUInfo[(CPU_STATE_MAX * i) + CPU_STATE_IDLE]); 87 | } else { 88 | _inUse = _cpuInfo[(CPU_STATE_MAX * i) + CPU_STATE_USER] + _cpuInfo[(CPU_STATE_MAX * i) + CPU_STATE_SYSTEM] + _cpuInfo[(CPU_STATE_MAX * i) + CPU_STATE_NICE]; 89 | _total = _inUse + _cpuInfo[(CPU_STATE_MAX * i) + CPU_STATE_IDLE]; 90 | } 91 | // Add to the processor usage info 92 | [processorInfo addObject:@(_inUse / _total)]; 93 | } 94 | 95 | [_cpuUsageLock unlock]; 96 | if (_prevCPUInfo) { 97 | size_t prevCpuInfoSize = sizeof(integer_t) * _numPrevCPUInfo; 98 | vm_deallocate(mach_task_self(), (vm_address_t)_prevCPUInfo, prevCpuInfoSize); 99 | } 100 | // Retrieved processor information 101 | return processorInfo; 102 | } else { 103 | // Unable to get processor information 104 | return nil; 105 | } 106 | } @catch (NSException *exception) { 107 | // Getting processor information failed 108 | return nil; 109 | } 110 | } 111 | 112 | @end 113 | -------------------------------------------------------------------------------- /InsiderDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // InsiderDemo 4 | // 5 | // Created by Alexandru Maimescu on 2/16/16. 6 | // Copyright © 2016 Alex Maimescu. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | NSString * kLogMessageNotificationKey = @"com.alexmx.notificationLogMessage"; 12 | 13 | @import Insider; 14 | 15 | @interface AppDelegate () 16 | 17 | @end 18 | 19 | @implementation AppDelegate 20 | 21 | 22 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 23 | 24 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(insiderNotification:) name:[Insider insiderNotificationKey] object:nil]; 25 | 26 | [[Insider shared] startWithDelegate:self]; 27 | 28 | return YES; 29 | } 30 | 31 | - (void)applicationWillResignActive:(UIApplication *)application { 32 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 33 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 34 | } 35 | 36 | - (void)applicationDidEnterBackground:(UIApplication *)application { 37 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 38 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 39 | } 40 | 41 | - (void)applicationWillEnterForeground:(UIApplication *)application { 42 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 43 | } 44 | 45 | - (void)applicationDidBecomeActive:(UIApplication *)application { 46 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 47 | } 48 | 49 | - (void)applicationWillTerminate:(UIApplication *)application { 50 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 51 | } 52 | 53 | - (void)postLogNotificationWithObject:(id)object 54 | { 55 | [[NSNotificationCenter defaultCenter] postNotificationName:kLogMessageNotificationKey object:object]; 56 | } 57 | 58 | #pragma mark - InsiderDelegate 59 | 60 | - (void)insider:(Insider *)insider didReceiveRemoteMessage:(NSDictionary * _Nullable)message 61 | { 62 | NSLog(@"Insider invoke object: %@", message); 63 | [self postLogNotificationWithObject:message]; 64 | } 65 | 66 | - (NSDictionary *)insider:(Insider *)insider returnResponseMessageForRemoteMessage:(NSDictionary * _Nullable)message 67 | { 68 | [self postLogNotificationWithObject:message]; 69 | 70 | return @{@"test": @YES}; 71 | } 72 | 73 | - (void)insider:(Insider *)insider didSendNotificationWithMessage:(NSDictionary * _Nullable)message 74 | { 75 | [self postLogNotificationWithObject:message]; 76 | } 77 | 78 | - (void)insider:(Insider *)insider didReturnSystemInfo:(NSDictionary * _Nullable)systemInfo 79 | { 80 | [self postLogNotificationWithObject:systemInfo]; 81 | } 82 | 83 | - (void)insider:(Insider *)insider didCreateDirectoryAtPath:(NSString * _Nonnull)path 84 | { 85 | [self postLogNotificationWithObject:[NSString stringWithFormat:@"Did create path: %@", path]]; 86 | } 87 | 88 | - (void)insider:(Insider *)insider didDeleteItemAtPath:(NSString * _Nonnull)path 89 | { 90 | [self postLogNotificationWithObject:[NSString stringWithFormat:@"Did delete item: %@", path]]; 91 | } 92 | 93 | - (void)insider:(Insider *)insider didDownloadFileAtPath:(NSString * _Nonnull)path 94 | { 95 | [self postLogNotificationWithObject:[NSString stringWithFormat:@"Did download item: %@", path]]; 96 | } 97 | 98 | - (void)insider:(Insider *)insider didMoveItemFromPath:(NSString * _Nonnull)fromPath toPath:(NSString * _Nonnull)path 99 | { 100 | [self postLogNotificationWithObject:[NSString stringWithFormat:@"Did move item from: %@ to: %@", fromPath, path]]; 101 | } 102 | 103 | - (void)insider:(Insider *)insider didUploadFileAtPath:(NSString * _Nonnull)path 104 | { 105 | [self postLogNotificationWithObject:[NSString stringWithFormat:@"Did upload item: %@", path]]; 106 | } 107 | 108 | #pragma mark - Notification 109 | 110 | - (void)insiderNotification:(NSNotification *)notification 111 | { 112 | NSLog(@"Did recieve notification with params: %@", notification.object); 113 | } 114 | 115 | @end 116 | -------------------------------------------------------------------------------- /Libs/GCDWebServer/Requests/GCDWebServerMultiPartFormRequest.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import "GCDWebServerRequest.h" 29 | 30 | /** 31 | * The GCDWebServerMultiPart class is an abstract class that wraps the content 32 | * of a part. 33 | */ 34 | @interface GCDWebServerMultiPart : NSObject 35 | 36 | /** 37 | * Returns the control name retrieved from the part headers. 38 | */ 39 | @property(nonatomic, readonly) NSString* controlName; 40 | 41 | /** 42 | * Returns the content type retrieved from the part headers or "text/plain" 43 | * if not available (per HTTP specifications). 44 | */ 45 | @property(nonatomic, readonly) NSString* contentType; 46 | 47 | /** 48 | * Returns the MIME type component of the content type for the part. 49 | */ 50 | @property(nonatomic, readonly) NSString* mimeType; 51 | 52 | @end 53 | 54 | /** 55 | * The GCDWebServerMultiPartArgument subclass of GCDWebServerMultiPart wraps 56 | * the content of a part as data in memory. 57 | */ 58 | @interface GCDWebServerMultiPartArgument : GCDWebServerMultiPart 59 | 60 | /** 61 | * Returns the data for the part. 62 | */ 63 | @property(nonatomic, readonly) NSData* data; 64 | 65 | /** 66 | * Returns the data for the part interpreted as text. If the content 67 | * type of the part is not a text one, or if an error occurs, nil is returned. 68 | * 69 | * The text encoding used to interpret the data is extracted from the 70 | * "Content-Type" header or defaults to UTF-8. 71 | */ 72 | @property(nonatomic, readonly) NSString* string; 73 | 74 | @end 75 | 76 | /** 77 | * The GCDWebServerMultiPartFile subclass of GCDWebServerMultiPart wraps 78 | * the content of a part as a file on disk. 79 | */ 80 | @interface GCDWebServerMultiPartFile : GCDWebServerMultiPart 81 | 82 | /** 83 | * Returns the file name retrieved from the part headers. 84 | */ 85 | @property(nonatomic, readonly) NSString* fileName; 86 | 87 | /** 88 | * Returns the path to the temporary file containing the part data. 89 | * 90 | * @warning This temporary file will be automatically deleted when the 91 | * GCDWebServerMultiPartFile is deallocated. If you want to preserve this file, 92 | * you must move it to a different location beforehand. 93 | */ 94 | @property(nonatomic, readonly) NSString* temporaryPath; 95 | 96 | @end 97 | 98 | /** 99 | * The GCDWebServerMultiPartFormRequest subclass of GCDWebServerRequest 100 | * parses the body of the HTTP request as a multipart encoded form. 101 | */ 102 | @interface GCDWebServerMultiPartFormRequest : GCDWebServerRequest 103 | 104 | /** 105 | * Returns the argument parts from the multipart encoded form as 106 | * name / GCDWebServerMultiPartArgument pairs. 107 | */ 108 | @property(nonatomic, readonly) NSArray* arguments; 109 | 110 | /** 111 | * Returns the files parts from the multipart encoded form as 112 | * name / GCDWebServerMultiPartFile pairs. 113 | */ 114 | @property(nonatomic, readonly) NSArray* files; 115 | 116 | /** 117 | * Returns the MIME type for multipart encoded forms 118 | * i.e. "multipart/form-data". 119 | */ 120 | + (NSString*)mimeType; 121 | 122 | /** 123 | * Returns the first argument for a given control name or nil if not found. 124 | */ 125 | - (GCDWebServerMultiPartArgument*)firstArgumentForControlName:(NSString*)name; 126 | 127 | /** 128 | * Returns the first file for a given control name or nil if not found. 129 | */ 130 | - (GCDWebServerMultiPartFile*)firstFileForControlName:(NSString*)name; 131 | 132 | @end 133 | -------------------------------------------------------------------------------- /Insider/LocalWebServer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LocalWebServer.swift 3 | // Insider 4 | // 5 | // Created by Alexandru Maimescu on 2/19/16. 6 | // Copyright © 2016 Alex Maimescu. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | typealias LocalWebServerRequestHandler = (InsiderMessage?) -> (LocalWebServerResponse) 12 | 13 | enum LocalWebServerRequestMethod: String { 14 | case GET 15 | case POST 16 | case PUT 17 | case DELETE 18 | } 19 | 20 | protocol GCDWebServerDataResponseConvertible { 21 | 22 | func convertedToGCDWebServerDataResponse() -> GCDWebServerDataResponse 23 | } 24 | 25 | protocol LocalWebServerDelegate: class { 26 | 27 | func localWebServer(_ server: LocalWebServer, didCreateDirectoryAtPath path: String) 28 | func localWebServer(_ server: LocalWebServer, didDeleteItemAtPath path: String) 29 | func localWebServer(_ server: LocalWebServer, didDownloadFileAtPath path: String) 30 | func localWebServer(_ server: LocalWebServer, didMoveItemFromPath fromPath: String, toPath: String) 31 | func localWebServer(_ server: LocalWebServer, didUploadFileAtPath path: String) 32 | } 33 | 34 | extension LocalWebServerResponse: GCDWebServerDataResponseConvertible { 35 | 36 | func convertedToGCDWebServerDataResponse() -> GCDWebServerDataResponse { 37 | 38 | if let jsonObject = self.response { 39 | return GCDWebServerDataResponse(jsonObject: jsonObject) 40 | } else { 41 | return GCDWebServerDataResponse(statusCode: self.statusCode.rawValue) 42 | } 43 | } 44 | } 45 | 46 | final class LocalWebServer: NSObject { 47 | 48 | struct Constants { 49 | static let defaultPort: UInt = 8080 50 | } 51 | 52 | private let localWebServer = GCDWebUploader() 53 | 54 | weak var delegate: LocalWebServerDelegate? 55 | 56 | func start() { 57 | startWithPort(Constants.defaultPort) 58 | } 59 | 60 | func startWithPort(_ port: UInt) { 61 | localWebServer?.delegate = self 62 | localWebServer?.start(withPort: port, bonjourName: nil) 63 | } 64 | 65 | func stop() { 66 | localWebServer?.stop() 67 | } 68 | 69 | func addSandboxDirectory(_ path: String, endpoint: String) { 70 | localWebServer?.addDirectory(path, endpoint: endpoint) 71 | } 72 | 73 | func addHandlerForMethod(_ method: LocalWebServerRequestMethod, path: String, handler: @escaping LocalWebServerRequestHandler) { 74 | 75 | localWebServer?.addHandler(forMethod: method.rawValue, 76 | path: path, 77 | request: GCDWebServerURLEncodedFormRequest.self) { (request) -> GCDWebServerResponse! in 78 | 79 | let params = self.paramsForRequest(request as? GCDWebServerURLEncodedFormRequest) 80 | var response: LocalWebServerResponse? 81 | self.executeOnMainQueue { 82 | response = handler(params) 83 | } 84 | 85 | return response?.convertedToGCDWebServerDataResponse() 86 | } 87 | } 88 | 89 | private func executeOnMainQueue(_ closure: (() -> Void)?) { 90 | DispatchQueue.main.sync { closure?() } 91 | } 92 | 93 | private func paramsForRequest(_ request: GCDWebServerURLEncodedFormRequest?) -> InsiderMessage? { 94 | guard let request = request, LocalWebServerRequestMethod(rawValue: request.method) != .GET else { 95 | return nil 96 | } 97 | 98 | var params: InsiderMessage? 99 | let contentType = request.contentType 100 | let jsonTypes = ["application/json", "text/json", "text/javascript"] 101 | if jsonTypes.contains(contentType!) { 102 | if let json = request.jsonObject { 103 | params = json as? InsiderMessage 104 | } 105 | } else { 106 | if let encodedParams = request.arguments { 107 | params = encodedParams as InsiderMessage? 108 | } 109 | } 110 | 111 | return params 112 | } 113 | } 114 | 115 | extension LocalWebServer: GCDWebUploaderDelegate { 116 | 117 | func webUploader(_ uploader: GCDWebUploader!, didCreateDirectoryAtPath path: String!) { 118 | delegate?.localWebServer(self, didCreateDirectoryAtPath: path) 119 | } 120 | 121 | func webUploader(_ uploader: GCDWebUploader!, didDeleteItemAtPath path: String!) { 122 | delegate?.localWebServer(self, didDeleteItemAtPath: path) 123 | } 124 | 125 | func webUploader(_ uploader: GCDWebUploader!, didDownloadFileAtPath path: String!) { 126 | delegate?.localWebServer(self, didDownloadFileAtPath: path) 127 | } 128 | 129 | func webUploader(_ uploader: GCDWebUploader!, didMoveItemFromPath fromPath: String!, toPath: String!) { 130 | delegate?.localWebServer(self, didMoveItemFromPath: fromPath, toPath: toPath) 131 | } 132 | 133 | func webUploader(_ uploader: GCDWebUploader!, didUploadFileAtPath path: String!) { 134 | delegate?.localWebServer(self, didUploadFileAtPath: path) 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /Libs/GCDWebServer/Responses/GCDWebServerDataResponse.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #if !__has_feature(objc_arc) 29 | #error GCDWebServer requires ARC 30 | #endif 31 | 32 | #import "GCDWebServerPrivate.h" 33 | 34 | @interface GCDWebServerDataResponse () { 35 | @private 36 | NSData* _data; 37 | BOOL _done; 38 | } 39 | @end 40 | 41 | @implementation GCDWebServerDataResponse 42 | 43 | + (instancetype)responseWithData:(NSData*)data contentType:(NSString*)type { 44 | return [[[self class] alloc] initWithData:data contentType:type]; 45 | } 46 | 47 | - (instancetype)initWithData:(NSData*)data contentType:(NSString*)type { 48 | if (data == nil) { 49 | GWS_DNOT_REACHED(); 50 | return nil; 51 | } 52 | 53 | if ((self = [super init])) { 54 | _data = data; 55 | 56 | self.contentType = type; 57 | self.contentLength = data.length; 58 | } 59 | return self; 60 | } 61 | 62 | - (NSData*)readData:(NSError**)error { 63 | NSData* data; 64 | if (_done) { 65 | data = [NSData data]; 66 | } else { 67 | data = _data; 68 | _done = YES; 69 | } 70 | return data; 71 | } 72 | 73 | - (NSString*)description { 74 | NSMutableString* description = [NSMutableString stringWithString:[super description]]; 75 | [description appendString:@"\n\n"]; 76 | [description appendString:GCDWebServerDescribeData(_data, self.contentType)]; 77 | return description; 78 | } 79 | 80 | @end 81 | 82 | @implementation GCDWebServerDataResponse (Extensions) 83 | 84 | + (instancetype)responseWithText:(NSString*)text { 85 | return [[self alloc] initWithText:text]; 86 | } 87 | 88 | + (instancetype)responseWithHTML:(NSString*)html { 89 | return [[self alloc] initWithHTML:html]; 90 | } 91 | 92 | + (instancetype)responseWithHTMLTemplate:(NSString*)path variables:(NSDictionary*)variables { 93 | return [[self alloc] initWithHTMLTemplate:path variables:variables]; 94 | } 95 | 96 | + (instancetype)responseWithJSONObject:(id)object { 97 | return [[self alloc] initWithJSONObject:object]; 98 | } 99 | 100 | + (instancetype)responseWithJSONObject:(id)object contentType:(NSString*)type { 101 | return [[self alloc] initWithJSONObject:object contentType:type]; 102 | } 103 | 104 | - (instancetype)initWithText:(NSString*)text { 105 | NSData* data = [text dataUsingEncoding:NSUTF8StringEncoding]; 106 | if (data == nil) { 107 | GWS_DNOT_REACHED(); 108 | return nil; 109 | } 110 | return [self initWithData:data contentType:@"text/plain; charset=utf-8"]; 111 | } 112 | 113 | - (instancetype)initWithHTML:(NSString*)html { 114 | NSData* data = [html dataUsingEncoding:NSUTF8StringEncoding]; 115 | if (data == nil) { 116 | GWS_DNOT_REACHED(); 117 | return nil; 118 | } 119 | return [self initWithData:data contentType:@"text/html; charset=utf-8"]; 120 | } 121 | 122 | - (instancetype)initWithHTMLTemplate:(NSString*)path variables:(NSDictionary*)variables { 123 | NSMutableString* html = [[NSMutableString alloc] initWithContentsOfFile:path encoding:NSUTF8StringEncoding error:NULL]; 124 | [variables enumerateKeysAndObjectsUsingBlock:^(NSString* key, NSString* value, BOOL* stop) { 125 | [html replaceOccurrencesOfString:[NSString stringWithFormat:@"%%%@%%", key] withString:value options:0 range:NSMakeRange(0, html.length)]; 126 | }]; 127 | id response = [self initWithHTML:html]; 128 | return response; 129 | } 130 | 131 | - (instancetype)initWithJSONObject:(id)object { 132 | return [self initWithJSONObject:object contentType:@"application/json"]; 133 | } 134 | 135 | - (instancetype)initWithJSONObject:(id)object contentType:(NSString*)type { 136 | NSData* data = [NSJSONSerialization dataWithJSONObject:object options:0 error:NULL]; 137 | if (data == nil) { 138 | return nil; 139 | } 140 | return [self initWithData:data contentType:type]; 141 | } 142 | 143 | @end 144 | -------------------------------------------------------------------------------- /docs/css/highlight.css: -------------------------------------------------------------------------------- 1 | /* Credit to https://gist.github.com/wataru420/2048287 */ 2 | .highlight { 3 | /* Comment */ 4 | /* Error */ 5 | /* Keyword */ 6 | /* Operator */ 7 | /* Comment.Multiline */ 8 | /* Comment.Preproc */ 9 | /* Comment.Single */ 10 | /* Comment.Special */ 11 | /* Generic.Deleted */ 12 | /* Generic.Deleted.Specific */ 13 | /* Generic.Emph */ 14 | /* Generic.Error */ 15 | /* Generic.Heading */ 16 | /* Generic.Inserted */ 17 | /* Generic.Inserted.Specific */ 18 | /* Generic.Output */ 19 | /* Generic.Prompt */ 20 | /* Generic.Strong */ 21 | /* Generic.Subheading */ 22 | /* Generic.Traceback */ 23 | /* Keyword.Constant */ 24 | /* Keyword.Declaration */ 25 | /* Keyword.Pseudo */ 26 | /* Keyword.Reserved */ 27 | /* Keyword.Type */ 28 | /* Literal.Number */ 29 | /* Literal.String */ 30 | /* Name.Attribute */ 31 | /* Name.Builtin */ 32 | /* Name.Class */ 33 | /* Name.Constant */ 34 | /* Name.Entity */ 35 | /* Name.Exception */ 36 | /* Name.Function */ 37 | /* Name.Namespace */ 38 | /* Name.Tag */ 39 | /* Name.Variable */ 40 | /* Operator.Word */ 41 | /* Text.Whitespace */ 42 | /* Literal.Number.Float */ 43 | /* Literal.Number.Hex */ 44 | /* Literal.Number.Integer */ 45 | /* Literal.Number.Oct */ 46 | /* Literal.String.Backtick */ 47 | /* Literal.String.Char */ 48 | /* Literal.String.Doc */ 49 | /* Literal.String.Double */ 50 | /* Literal.String.Escape */ 51 | /* Literal.String.Heredoc */ 52 | /* Literal.String.Interpol */ 53 | /* Literal.String.Other */ 54 | /* Literal.String.Regex */ 55 | /* Literal.String.Single */ 56 | /* Literal.String.Symbol */ 57 | /* Name.Builtin.Pseudo */ 58 | /* Name.Variable.Class */ 59 | /* Name.Variable.Global */ 60 | /* Name.Variable.Instance */ 61 | /* Literal.Number.Integer.Long */ } 62 | .highlight .c { 63 | color: #999988; 64 | font-style: italic; } 65 | .highlight .err { 66 | color: #a61717; 67 | background-color: #e3d2d2; } 68 | .highlight .k { 69 | color: #000000; 70 | font-weight: bold; } 71 | .highlight .o { 72 | color: #000000; 73 | font-weight: bold; } 74 | .highlight .cm { 75 | color: #999988; 76 | font-style: italic; } 77 | .highlight .cp { 78 | color: #999999; 79 | font-weight: bold; } 80 | .highlight .c1 { 81 | color: #999988; 82 | font-style: italic; } 83 | .highlight .cs { 84 | color: #999999; 85 | font-weight: bold; 86 | font-style: italic; } 87 | .highlight .gd { 88 | color: #000000; 89 | background-color: #ffdddd; } 90 | .highlight .gd .x { 91 | color: #000000; 92 | background-color: #ffaaaa; } 93 | .highlight .ge { 94 | color: #000000; 95 | font-style: italic; } 96 | .highlight .gr { 97 | color: #aa0000; } 98 | .highlight .gh { 99 | color: #999999; } 100 | .highlight .gi { 101 | color: #000000; 102 | background-color: #ddffdd; } 103 | .highlight .gi .x { 104 | color: #000000; 105 | background-color: #aaffaa; } 106 | .highlight .go { 107 | color: #888888; } 108 | .highlight .gp { 109 | color: #555555; } 110 | .highlight .gs { 111 | font-weight: bold; } 112 | .highlight .gu { 113 | color: #aaaaaa; } 114 | .highlight .gt { 115 | color: #aa0000; } 116 | .highlight .kc { 117 | color: #000000; 118 | font-weight: bold; } 119 | .highlight .kd { 120 | color: #000000; 121 | font-weight: bold; } 122 | .highlight .kp { 123 | color: #000000; 124 | font-weight: bold; } 125 | .highlight .kr { 126 | color: #000000; 127 | font-weight: bold; } 128 | .highlight .kt { 129 | color: #445588; } 130 | .highlight .m { 131 | color: #009999; } 132 | .highlight .s { 133 | color: #d14; } 134 | .highlight .na { 135 | color: #008080; } 136 | .highlight .nb { 137 | color: #0086B3; } 138 | .highlight .nc { 139 | color: #445588; 140 | font-weight: bold; } 141 | .highlight .no { 142 | color: #008080; } 143 | .highlight .ni { 144 | color: #800080; } 145 | .highlight .ne { 146 | color: #990000; 147 | font-weight: bold; } 148 | .highlight .nf { 149 | color: #990000; } 150 | .highlight .nn { 151 | color: #555555; } 152 | .highlight .nt { 153 | color: #000080; } 154 | .highlight .nv { 155 | color: #008080; } 156 | .highlight .ow { 157 | color: #000000; 158 | font-weight: bold; } 159 | .highlight .w { 160 | color: #bbbbbb; } 161 | .highlight .mf { 162 | color: #009999; } 163 | .highlight .mh { 164 | color: #009999; } 165 | .highlight .mi { 166 | color: #009999; } 167 | .highlight .mo { 168 | color: #009999; } 169 | .highlight .sb { 170 | color: #d14; } 171 | .highlight .sc { 172 | color: #d14; } 173 | .highlight .sd { 174 | color: #d14; } 175 | .highlight .s2 { 176 | color: #d14; } 177 | .highlight .se { 178 | color: #d14; } 179 | .highlight .sh { 180 | color: #d14; } 181 | .highlight .si { 182 | color: #d14; } 183 | .highlight .sx { 184 | color: #d14; } 185 | .highlight .sr { 186 | color: #009926; } 187 | .highlight .s1 { 188 | color: #d14; } 189 | .highlight .ss { 190 | color: #990073; } 191 | .highlight .bp { 192 | color: #999999; } 193 | .highlight .vc { 194 | color: #008080; } 195 | .highlight .vg { 196 | color: #008080; } 197 | .highlight .vi { 198 | color: #008080; } 199 | .highlight .il { 200 | color: #009999; } 201 | -------------------------------------------------------------------------------- /docs/docsets/Insider.docset/Contents/Resources/Documents/css/highlight.css: -------------------------------------------------------------------------------- 1 | /* Credit to https://gist.github.com/wataru420/2048287 */ 2 | .highlight { 3 | /* Comment */ 4 | /* Error */ 5 | /* Keyword */ 6 | /* Operator */ 7 | /* Comment.Multiline */ 8 | /* Comment.Preproc */ 9 | /* Comment.Single */ 10 | /* Comment.Special */ 11 | /* Generic.Deleted */ 12 | /* Generic.Deleted.Specific */ 13 | /* Generic.Emph */ 14 | /* Generic.Error */ 15 | /* Generic.Heading */ 16 | /* Generic.Inserted */ 17 | /* Generic.Inserted.Specific */ 18 | /* Generic.Output */ 19 | /* Generic.Prompt */ 20 | /* Generic.Strong */ 21 | /* Generic.Subheading */ 22 | /* Generic.Traceback */ 23 | /* Keyword.Constant */ 24 | /* Keyword.Declaration */ 25 | /* Keyword.Pseudo */ 26 | /* Keyword.Reserved */ 27 | /* Keyword.Type */ 28 | /* Literal.Number */ 29 | /* Literal.String */ 30 | /* Name.Attribute */ 31 | /* Name.Builtin */ 32 | /* Name.Class */ 33 | /* Name.Constant */ 34 | /* Name.Entity */ 35 | /* Name.Exception */ 36 | /* Name.Function */ 37 | /* Name.Namespace */ 38 | /* Name.Tag */ 39 | /* Name.Variable */ 40 | /* Operator.Word */ 41 | /* Text.Whitespace */ 42 | /* Literal.Number.Float */ 43 | /* Literal.Number.Hex */ 44 | /* Literal.Number.Integer */ 45 | /* Literal.Number.Oct */ 46 | /* Literal.String.Backtick */ 47 | /* Literal.String.Char */ 48 | /* Literal.String.Doc */ 49 | /* Literal.String.Double */ 50 | /* Literal.String.Escape */ 51 | /* Literal.String.Heredoc */ 52 | /* Literal.String.Interpol */ 53 | /* Literal.String.Other */ 54 | /* Literal.String.Regex */ 55 | /* Literal.String.Single */ 56 | /* Literal.String.Symbol */ 57 | /* Name.Builtin.Pseudo */ 58 | /* Name.Variable.Class */ 59 | /* Name.Variable.Global */ 60 | /* Name.Variable.Instance */ 61 | /* Literal.Number.Integer.Long */ } 62 | .highlight .c { 63 | color: #999988; 64 | font-style: italic; } 65 | .highlight .err { 66 | color: #a61717; 67 | background-color: #e3d2d2; } 68 | .highlight .k { 69 | color: #000000; 70 | font-weight: bold; } 71 | .highlight .o { 72 | color: #000000; 73 | font-weight: bold; } 74 | .highlight .cm { 75 | color: #999988; 76 | font-style: italic; } 77 | .highlight .cp { 78 | color: #999999; 79 | font-weight: bold; } 80 | .highlight .c1 { 81 | color: #999988; 82 | font-style: italic; } 83 | .highlight .cs { 84 | color: #999999; 85 | font-weight: bold; 86 | font-style: italic; } 87 | .highlight .gd { 88 | color: #000000; 89 | background-color: #ffdddd; } 90 | .highlight .gd .x { 91 | color: #000000; 92 | background-color: #ffaaaa; } 93 | .highlight .ge { 94 | color: #000000; 95 | font-style: italic; } 96 | .highlight .gr { 97 | color: #aa0000; } 98 | .highlight .gh { 99 | color: #999999; } 100 | .highlight .gi { 101 | color: #000000; 102 | background-color: #ddffdd; } 103 | .highlight .gi .x { 104 | color: #000000; 105 | background-color: #aaffaa; } 106 | .highlight .go { 107 | color: #888888; } 108 | .highlight .gp { 109 | color: #555555; } 110 | .highlight .gs { 111 | font-weight: bold; } 112 | .highlight .gu { 113 | color: #aaaaaa; } 114 | .highlight .gt { 115 | color: #aa0000; } 116 | .highlight .kc { 117 | color: #000000; 118 | font-weight: bold; } 119 | .highlight .kd { 120 | color: #000000; 121 | font-weight: bold; } 122 | .highlight .kp { 123 | color: #000000; 124 | font-weight: bold; } 125 | .highlight .kr { 126 | color: #000000; 127 | font-weight: bold; } 128 | .highlight .kt { 129 | color: #445588; } 130 | .highlight .m { 131 | color: #009999; } 132 | .highlight .s { 133 | color: #d14; } 134 | .highlight .na { 135 | color: #008080; } 136 | .highlight .nb { 137 | color: #0086B3; } 138 | .highlight .nc { 139 | color: #445588; 140 | font-weight: bold; } 141 | .highlight .no { 142 | color: #008080; } 143 | .highlight .ni { 144 | color: #800080; } 145 | .highlight .ne { 146 | color: #990000; 147 | font-weight: bold; } 148 | .highlight .nf { 149 | color: #990000; } 150 | .highlight .nn { 151 | color: #555555; } 152 | .highlight .nt { 153 | color: #000080; } 154 | .highlight .nv { 155 | color: #008080; } 156 | .highlight .ow { 157 | color: #000000; 158 | font-weight: bold; } 159 | .highlight .w { 160 | color: #bbbbbb; } 161 | .highlight .mf { 162 | color: #009999; } 163 | .highlight .mh { 164 | color: #009999; } 165 | .highlight .mi { 166 | color: #009999; } 167 | .highlight .mo { 168 | color: #009999; } 169 | .highlight .sb { 170 | color: #d14; } 171 | .highlight .sc { 172 | color: #d14; } 173 | .highlight .sd { 174 | color: #d14; } 175 | .highlight .s2 { 176 | color: #d14; } 177 | .highlight .se { 178 | color: #d14; } 179 | .highlight .sh { 180 | color: #d14; } 181 | .highlight .si { 182 | color: #d14; } 183 | .highlight .sx { 184 | color: #d14; } 185 | .highlight .sr { 186 | color: #009926; } 187 | .highlight .s1 { 188 | color: #d14; } 189 | .highlight .ss { 190 | color: #990073; } 191 | .highlight .bp { 192 | color: #999999; } 193 | .highlight .vc { 194 | color: #008080; } 195 | .highlight .vg { 196 | color: #008080; } 197 | .highlight .vi { 198 | color: #008080; } 199 | .highlight .il { 200 | color: #009999; } 201 | -------------------------------------------------------------------------------- /Libs/System Services/Utilities/SSCarrierInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSCarrierInfo.m 3 | // SystemServicesDemo 4 | // 5 | // Created by Shmoopi LLC on 9/17/12. 6 | // Copyright (c) 2012 Shmoopi LLC. All rights reserved. 7 | // 8 | 9 | #import "SSCarrierInfo.h" 10 | 11 | // Core Telephony 12 | #import 13 | #import 14 | 15 | @implementation SSCarrierInfo 16 | 17 | // Carrier Information 18 | 19 | // Carrier Name 20 | + (NSString *)carrierName { 21 | // Get the carrier name 22 | @try { 23 | // Get the Telephony Network Info 24 | CTTelephonyNetworkInfo *telephonyInfo = [[CTTelephonyNetworkInfo alloc] init]; 25 | // Get the carrier 26 | CTCarrier *carrier = [telephonyInfo subscriberCellularProvider]; 27 | // Get the carrier name 28 | NSString *carrierName = [carrier carrierName]; 29 | 30 | // Check to make sure it's valid 31 | if (carrierName == nil || carrierName.length <= 0) { 32 | // Return unknown 33 | return nil; 34 | } 35 | 36 | // Return the name 37 | return carrierName; 38 | } 39 | @catch (NSException *exception) { 40 | // Error finding the name 41 | return nil; 42 | } 43 | } 44 | 45 | // Carrier Country 46 | + (NSString *)carrierCountry { 47 | // Get the country that the carrier is located in 48 | @try { 49 | // Get the locale 50 | NSLocale *currentCountry = [NSLocale currentLocale]; 51 | // Get the country Code 52 | NSString *country = [currentCountry objectForKey:NSLocaleCountryCode]; 53 | // Check if it returned anything 54 | if (country == nil || country.length <= 0) { 55 | // No country found 56 | return nil; 57 | } 58 | // Return the country 59 | return country; 60 | } 61 | @catch (NSException *exception) { 62 | // Failed, return nil 63 | return nil; 64 | } 65 | } 66 | 67 | // Carrier Mobile Country Code 68 | + (NSString *)carrierMobileCountryCode { 69 | // Get the carrier mobile country code 70 | @try { 71 | // Get the Telephony Network Info 72 | CTTelephonyNetworkInfo *telephonyInfo = [[CTTelephonyNetworkInfo alloc] init]; 73 | // Get the carrier 74 | CTCarrier *carrier = [telephonyInfo subscriberCellularProvider]; 75 | // Get the carrier mobile country code 76 | NSString *carrierCode = [carrier mobileCountryCode]; 77 | 78 | // Check to make sure it's valid 79 | if (carrierCode == nil || carrierCode.length <= 0) { 80 | // Return unknown 81 | return nil; 82 | } 83 | 84 | // Return the name 85 | return carrierCode; 86 | } 87 | @catch (NSException *exception) { 88 | // Error finding the name 89 | return nil; 90 | } 91 | } 92 | 93 | // Carrier ISO Country Code 94 | + (NSString *)carrierISOCountryCode { 95 | // Get the carrier ISO country code 96 | @try { 97 | // Get the Telephony Network Info 98 | CTTelephonyNetworkInfo *telephonyInfo = [[CTTelephonyNetworkInfo alloc] init]; 99 | // Get the carrier 100 | CTCarrier *carrier = [telephonyInfo subscriberCellularProvider]; 101 | // Get the carrier ISO country code 102 | NSString *carrierCode = [carrier isoCountryCode]; 103 | 104 | // Check to make sure it's valid 105 | if (carrierCode == nil || carrierCode.length <= 0) { 106 | // Return unknown 107 | return nil; 108 | } 109 | 110 | // Return the name 111 | return carrierCode; 112 | } 113 | @catch (NSException *exception) { 114 | // Error finding the name 115 | return nil; 116 | } 117 | } 118 | 119 | // Carrier Mobile Network Code 120 | + (NSString *)carrierMobileNetworkCode { 121 | // Get the carrier mobile network code 122 | @try { 123 | // Get the Telephony Network Info 124 | CTTelephonyNetworkInfo *telephonyInfo = [[CTTelephonyNetworkInfo alloc] init]; 125 | // Get the carrier 126 | CTCarrier *carrier = [telephonyInfo subscriberCellularProvider]; 127 | // Get the carrier mobile network code 128 | NSString *carrierCode = [carrier mobileNetworkCode]; 129 | 130 | // Check to make sure it's valid 131 | if (carrierCode == nil || carrierCode.length <= 0) { 132 | // Return unknown 133 | return nil; 134 | } 135 | 136 | // Return the name 137 | return carrierCode; 138 | } 139 | @catch (NSException *exception) { 140 | // Error finding the name 141 | return nil; 142 | } 143 | } 144 | 145 | // Carrier Allows VOIP 146 | + (BOOL)carrierAllowsVOIP { 147 | // Check if the carrier allows VOIP 148 | @try { 149 | // Get the Telephony Network Info 150 | CTTelephonyNetworkInfo *telephonyInfo = [[CTTelephonyNetworkInfo alloc] init]; 151 | // Get the carrier 152 | CTCarrier *carrier = [telephonyInfo subscriberCellularProvider]; 153 | // Get the carrier VOIP Status 154 | BOOL carrierVOIP = [carrier allowsVOIP]; 155 | 156 | // Return the VOIP Status 157 | return carrierVOIP; 158 | } 159 | @catch (NSException *exception) { 160 | // Error finding the VOIP Status 161 | return false; 162 | } 163 | } 164 | 165 | @end 166 | -------------------------------------------------------------------------------- /Libs/System Services/Utilities/SSAccessoryInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSAccessoryInfo.m 3 | // SystemServicesDemo 4 | // 5 | // Created by Shmoopi LLC on 9/17/12. 6 | // Copyright (c) 2012 Shmoopi LLC. All rights reserved. 7 | // 8 | 9 | #import "SSAccessoryInfo.h" 10 | 11 | // Accessory Manager 12 | #import 13 | 14 | // AVFoundation 15 | #import 16 | 17 | @implementation SSAccessoryInfo 18 | 19 | // Accessory Information 20 | 21 | // Are any accessories attached? 22 | + (BOOL)accessoriesAttached { 23 | // Check if any accessories are connected 24 | @try { 25 | // Set up the accessory manger 26 | EAAccessoryManager *accessoryManager = [EAAccessoryManager sharedAccessoryManager]; 27 | // Get the number of accessories connected 28 | int numberOfAccessoriesConnected = (int)[accessoryManager.connectedAccessories count]; 29 | // Check if there are any connected 30 | if (numberOfAccessoriesConnected > 0) { 31 | // There are accessories connected 32 | return true; 33 | } else { 34 | // There are no accessories connected 35 | return false; 36 | } 37 | } 38 | @catch (NSException *exception) { 39 | // Error, return false 40 | return false; 41 | } 42 | } 43 | 44 | // Are headphone attached? 45 | + (BOOL)headphonesAttached { 46 | // Check if the headphones are connected 47 | @try { 48 | // Get the audiosession route information 49 | AVAudioSessionRouteDescription *route = [[AVAudioSession sharedInstance] currentRoute]; 50 | 51 | // Run through all the route outputs 52 | for (AVAudioSessionPortDescription *desc in [route outputs]) { 53 | 54 | // Check if any of the ports are equal to the string headphones 55 | if ([[desc portType] isEqualToString:AVAudioSessionPortHeadphones]) { 56 | 57 | // Return YES 58 | return YES; 59 | } 60 | } 61 | 62 | // No headphones attached 63 | return NO; 64 | } 65 | @catch (NSException *exception) { 66 | // Error, return false 67 | return false; 68 | } 69 | } 70 | 71 | // Number of attached accessories 72 | + (NSInteger)numberAttachedAccessories { 73 | // Get the number of attached accessories 74 | @try { 75 | // Set up the accessory manger 76 | EAAccessoryManager *accessoryManager = [EAAccessoryManager sharedAccessoryManager]; 77 | // Get the number of accessories connected 78 | int numberOfAccessoriesConnected = (int)[accessoryManager.connectedAccessories count]; 79 | // Return how many accessories are attached 80 | return numberOfAccessoriesConnected; 81 | } 82 | @catch (NSException *exception) { 83 | // Error, return false 84 | return false; 85 | } 86 | } 87 | 88 | // Name of attached accessory/accessories (seperated by , comma's) 89 | + (NSString *)nameAttachedAccessories { 90 | // Get the name of the attached accessories 91 | @try { 92 | // Set up the accessory manger 93 | EAAccessoryManager *accessoryManager = [EAAccessoryManager sharedAccessoryManager]; 94 | // Set up an accessory (for later use) 95 | EAAccessory *accessory; 96 | // Get the number of accessories connected 97 | int numberOfAccessoriesConnected = (int)[accessoryManager.connectedAccessories count]; 98 | 99 | // Check to make sure there are accessories connected 100 | if (numberOfAccessoriesConnected > 0) { 101 | // Set up a string for all the accessory names 102 | NSString *allAccessoryNames = @""; 103 | // Set up a string for the accessory names 104 | NSString *accessoryName; 105 | // Get the accessories 106 | NSArray *accessoryArray = accessoryManager.connectedAccessories; 107 | // Run through all the accessories 108 | for (int x = 0; x < numberOfAccessoriesConnected; x++) { 109 | // Get the accessory at that index 110 | accessory = [accessoryArray objectAtIndex:x]; 111 | // Get the name of it 112 | accessoryName = [accessory name]; 113 | // Make sure there is a name 114 | if (accessoryName == nil || accessoryName.length == 0) { 115 | // If there isn't, try and get the manufacturer name 116 | accessoryName = [accessory manufacturer]; 117 | } 118 | // Make sure there is a manufacturer name 119 | if (accessoryName == nil || accessoryName.length == 0) { 120 | // If there isn't a manufacturer name still 121 | accessoryName = @"Unknown"; 122 | } 123 | // Format that name 124 | allAccessoryNames = [allAccessoryNames stringByAppendingFormat:@"%@", accessoryName]; 125 | if (x < numberOfAccessoriesConnected - 1) { 126 | allAccessoryNames = [allAccessoryNames stringByAppendingFormat:@", "]; 127 | } 128 | } 129 | // Return the name/s of the connected accessories 130 | return allAccessoryNames; 131 | } else { 132 | // No accessories connected 133 | return nil; 134 | } 135 | } 136 | @catch (NSException *exception) { 137 | // Error, return false 138 | return nil; 139 | } 140 | } 141 | 142 | @end 143 | -------------------------------------------------------------------------------- /Libs/GCDWebServer/Core/GCDWebServerHTTPStatusCodes.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | // http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 29 | // http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml 30 | 31 | #import 32 | 33 | /** 34 | * Convenience constants for "informational" HTTP status codes. 35 | */ 36 | typedef NS_ENUM(NSInteger, GCDWebServerInformationalHTTPStatusCode) { 37 | kGCDWebServerHTTPStatusCode_Continue = 100, 38 | kGCDWebServerHTTPStatusCode_SwitchingProtocols = 101, 39 | kGCDWebServerHTTPStatusCode_Processing = 102 40 | }; 41 | 42 | /** 43 | * Convenience constants for "successful" HTTP status codes. 44 | */ 45 | typedef NS_ENUM(NSInteger, GCDWebServerSuccessfulHTTPStatusCode) { 46 | kGCDWebServerHTTPStatusCode_OK = 200, 47 | kGCDWebServerHTTPStatusCode_Created = 201, 48 | kGCDWebServerHTTPStatusCode_Accepted = 202, 49 | kGCDWebServerHTTPStatusCode_NonAuthoritativeInformation = 203, 50 | kGCDWebServerHTTPStatusCode_NoContent = 204, 51 | kGCDWebServerHTTPStatusCode_ResetContent = 205, 52 | kGCDWebServerHTTPStatusCode_PartialContent = 206, 53 | kGCDWebServerHTTPStatusCode_MultiStatus = 207, 54 | kGCDWebServerHTTPStatusCode_AlreadyReported = 208 55 | }; 56 | 57 | /** 58 | * Convenience constants for "redirection" HTTP status codes. 59 | */ 60 | typedef NS_ENUM(NSInteger, GCDWebServerRedirectionHTTPStatusCode) { 61 | kGCDWebServerHTTPStatusCode_MultipleChoices = 300, 62 | kGCDWebServerHTTPStatusCode_MovedPermanently = 301, 63 | kGCDWebServerHTTPStatusCode_Found = 302, 64 | kGCDWebServerHTTPStatusCode_SeeOther = 303, 65 | kGCDWebServerHTTPStatusCode_NotModified = 304, 66 | kGCDWebServerHTTPStatusCode_UseProxy = 305, 67 | kGCDWebServerHTTPStatusCode_TemporaryRedirect = 307, 68 | kGCDWebServerHTTPStatusCode_PermanentRedirect = 308 69 | }; 70 | 71 | /** 72 | * Convenience constants for "client error" HTTP status codes. 73 | */ 74 | typedef NS_ENUM(NSInteger, GCDWebServerClientErrorHTTPStatusCode) { 75 | kGCDWebServerHTTPStatusCode_BadRequest = 400, 76 | kGCDWebServerHTTPStatusCode_Unauthorized = 401, 77 | kGCDWebServerHTTPStatusCode_PaymentRequired = 402, 78 | kGCDWebServerHTTPStatusCode_Forbidden = 403, 79 | kGCDWebServerHTTPStatusCode_NotFound = 404, 80 | kGCDWebServerHTTPStatusCode_MethodNotAllowed = 405, 81 | kGCDWebServerHTTPStatusCode_NotAcceptable = 406, 82 | kGCDWebServerHTTPStatusCode_ProxyAuthenticationRequired = 407, 83 | kGCDWebServerHTTPStatusCode_RequestTimeout = 408, 84 | kGCDWebServerHTTPStatusCode_Conflict = 409, 85 | kGCDWebServerHTTPStatusCode_Gone = 410, 86 | kGCDWebServerHTTPStatusCode_LengthRequired = 411, 87 | kGCDWebServerHTTPStatusCode_PreconditionFailed = 412, 88 | kGCDWebServerHTTPStatusCode_RequestEntityTooLarge = 413, 89 | kGCDWebServerHTTPStatusCode_RequestURITooLong = 414, 90 | kGCDWebServerHTTPStatusCode_UnsupportedMediaType = 415, 91 | kGCDWebServerHTTPStatusCode_RequestedRangeNotSatisfiable = 416, 92 | kGCDWebServerHTTPStatusCode_ExpectationFailed = 417, 93 | kGCDWebServerHTTPStatusCode_UnprocessableEntity = 422, 94 | kGCDWebServerHTTPStatusCode_Locked = 423, 95 | kGCDWebServerHTTPStatusCode_FailedDependency = 424, 96 | kGCDWebServerHTTPStatusCode_UpgradeRequired = 426, 97 | kGCDWebServerHTTPStatusCode_PreconditionRequired = 428, 98 | kGCDWebServerHTTPStatusCode_TooManyRequests = 429, 99 | kGCDWebServerHTTPStatusCode_RequestHeaderFieldsTooLarge = 431 100 | }; 101 | 102 | /** 103 | * Convenience constants for "server error" HTTP status codes. 104 | */ 105 | typedef NS_ENUM(NSInteger, GCDWebServerServerErrorHTTPStatusCode) { 106 | kGCDWebServerHTTPStatusCode_InternalServerError = 500, 107 | kGCDWebServerHTTPStatusCode_NotImplemented = 501, 108 | kGCDWebServerHTTPStatusCode_BadGateway = 502, 109 | kGCDWebServerHTTPStatusCode_ServiceUnavailable = 503, 110 | kGCDWebServerHTTPStatusCode_GatewayTimeout = 504, 111 | kGCDWebServerHTTPStatusCode_HTTPVersionNotSupported = 505, 112 | kGCDWebServerHTTPStatusCode_InsufficientStorage = 507, 113 | kGCDWebServerHTTPStatusCode_LoopDetected = 508, 114 | kGCDWebServerHTTPStatusCode_NotExtended = 510, 115 | kGCDWebServerHTTPStatusCode_NetworkAuthenticationRequired = 511 116 | }; 117 | -------------------------------------------------------------------------------- /InsiderDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 27 | 28 | 29 | Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /Libs/System Services/Utilities/SSAccelerometerInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSAccelerometerInfo.m 3 | // SystemServicesDemo 4 | // 5 | // Created by Shmoopi LLC on 9/20/12. 6 | // Copyright (c) 2012 Shmoopi LLC. All rights reserved. 7 | // 8 | 9 | #import "SSAccelerometerInfo.h" 10 | 11 | // Private 12 | @interface SSAccelerometerInfo () 13 | 14 | /** 15 | * processMotion:withError: 16 | * 17 | * Appends the new motion data to the appropriate instance variable strings. 18 | */ 19 | - (void)processMotion:(CMDeviceMotion*)motion withError:(NSError*)error; 20 | 21 | /** 22 | * processAccel:withError: 23 | * 24 | * Appends the new raw accleration data to the appropriate instance variable string. 25 | */ 26 | - (void)processAccel:(CMAccelerometerData*)accelData withError:(NSError*)error; 27 | 28 | /** 29 | * processGyro:withError: 30 | * 31 | * Appends the new raw gyro data to the appropriate instance variable string. 32 | */ 33 | - (void)processGyro:(CMGyroData*)gyroData withError:(NSError*)error; 34 | 35 | @end 36 | 37 | // Implementation 38 | @implementation SSAccelerometerInfo 39 | 40 | @synthesize attitudeString, gravityString, magneticFieldString, rotationRateString, userAccelerationString, rawGyroscopeString, rawAccelerometerString; 41 | 42 | // Accelerometer Information 43 | 44 | // Device Orientation 45 | + (UIInterfaceOrientation)deviceOrientation { 46 | // Get the device's current orientation 47 | @try { 48 | #if !(defined(__has_feature) && __has_feature(attribute_availability_app_extension)) 49 | // Device orientation 50 | UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; 51 | 52 | // Successful 53 | return orientation; 54 | #endif 55 | } 56 | @catch (NSException *exception) { 57 | return -1; 58 | } 59 | // Error 60 | return -1; 61 | } 62 | 63 | // Start logging motion data 64 | - (void)startLoggingMotionData { 65 | motionManager = [[CMMotionManager alloc] init]; 66 | motionManager.deviceMotionUpdateInterval = 0.01; //100 Hz 67 | motionManager.accelerometerUpdateInterval = 0.01; 68 | motionManager.gyroUpdateInterval = 0.01; 69 | 70 | // Limiting the concurrent ops to 1 is a cheap way to avoid two handlers editing the same 71 | // string at the same time. 72 | deviceMotionQueue = [[NSOperationQueue alloc] init]; 73 | [deviceMotionQueue setMaxConcurrentOperationCount:1]; 74 | 75 | accelQueue = [[NSOperationQueue alloc] init]; 76 | [accelQueue setMaxConcurrentOperationCount:1]; 77 | 78 | gyroQueue = [[NSOperationQueue alloc] init]; 79 | [gyroQueue setMaxConcurrentOperationCount:1]; 80 | 81 | // Logging Motion Data 82 | 83 | CMDeviceMotionHandler motionHandler = ^(CMDeviceMotion *motion, NSError *error) { 84 | [self processMotion:motion withError:error]; 85 | }; 86 | 87 | CMGyroHandler gyroHandler = ^(CMGyroData *gyroData, NSError *error) { 88 | [self processGyro:gyroData withError:error]; 89 | }; 90 | 91 | CMAccelerometerHandler accelHandler = ^(CMAccelerometerData *accelerometerData, NSError *error) { 92 | [self processAccel:accelerometerData withError:error]; 93 | }; 94 | 95 | [motionManager startDeviceMotionUpdatesToQueue:deviceMotionQueue withHandler:motionHandler]; 96 | 97 | [motionManager startGyroUpdatesToQueue:gyroQueue withHandler:gyroHandler]; 98 | 99 | [motionManager startAccelerometerUpdatesToQueue:accelQueue withHandler:accelHandler]; 100 | } 101 | 102 | // Stop logging motion data 103 | - (void)stopLoggingMotionData { 104 | 105 | // Stop everything 106 | [motionManager stopDeviceMotionUpdates]; 107 | [deviceMotionQueue waitUntilAllOperationsAreFinished]; 108 | 109 | [motionManager stopAccelerometerUpdates]; 110 | [accelQueue waitUntilAllOperationsAreFinished]; 111 | 112 | [motionManager stopGyroUpdates]; 113 | [gyroQueue waitUntilAllOperationsAreFinished]; 114 | 115 | } 116 | 117 | #pragma mark - Set Motion Variables when Updating (in background) 118 | 119 | - (void)processAccel:(CMAccelerometerData*)accelData withError:(NSError*)error { 120 | rawAccelerometerString = [NSString stringWithFormat:@"%f,%f,%f,%f\n", accelData.timestamp, 121 | accelData.acceleration.x, 122 | accelData.acceleration.y, 123 | accelData.acceleration.z, 124 | nil]; 125 | } 126 | 127 | - (void)processGyro:(CMGyroData*)gyroData withError:(NSError*)error { 128 | 129 | rawGyroscopeString = [NSString stringWithFormat:@"%f,%f,%f,%f\n", gyroData.timestamp, 130 | gyroData.rotationRate.x, 131 | gyroData.rotationRate.y, 132 | gyroData.rotationRate.z, 133 | nil]; 134 | } 135 | 136 | - (void)processMotion:(CMDeviceMotion*)motion withError:(NSError*)error { 137 | 138 | attitudeString = [NSString stringWithFormat:@"%f,%f,%f,%f\n", motion.timestamp, 139 | motion.attitude.roll, 140 | motion.attitude.pitch, 141 | motion.attitude.yaw, 142 | nil]; 143 | 144 | gravityString = [NSString stringWithFormat:@"%f,%f,%f,%f\n", motion.timestamp, 145 | motion.gravity.x, 146 | motion.gravity.y, 147 | motion.gravity.z, 148 | nil]; 149 | 150 | magneticFieldString = [NSString stringWithFormat:@"%f,%f,%f,%f,%d\n", motion.timestamp, 151 | motion.magneticField.field.x, 152 | motion.magneticField.field.y, 153 | motion.magneticField.field.z, 154 | (int)motion.magneticField.accuracy, 155 | nil]; 156 | 157 | rotationRateString = [NSString stringWithFormat:@"%f,%f,%f,%f\n", motion.timestamp, 158 | motion.rotationRate.x, 159 | motion.rotationRate.y, 160 | motion.rotationRate.z, 161 | nil]; 162 | 163 | userAccelerationString = [NSString stringWithFormat:@"%f,%f,%f,%f\n", motion.timestamp, 164 | motion.userAcceleration.x, 165 | motion.userAcceleration.y, 166 | motion.userAcceleration.z, 167 | nil]; 168 | 169 | } 170 | 171 | 172 | @end 173 | -------------------------------------------------------------------------------- /Libs/GCDWebServer/Responses/GCDWebServerErrorResponse.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012-2015, Pierre-Olivier Latour 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * The name of Pierre-Olivier Latour may not be used to endorse 13 | or promote products derived from this software without specific 14 | prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #if !__has_feature(objc_arc) 29 | #error GCDWebServer requires ARC 30 | #endif 31 | 32 | #import "GCDWebServerPrivate.h" 33 | 34 | @interface GCDWebServerErrorResponse () 35 | - (instancetype)initWithStatusCode:(NSInteger)statusCode underlyingError:(NSError*)underlyingError messageFormat:(NSString*)format arguments:(va_list)arguments; 36 | @end 37 | 38 | @implementation GCDWebServerErrorResponse 39 | 40 | + (instancetype)responseWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode message:(NSString*)format, ... { 41 | GWS_DCHECK(((NSInteger)errorCode >= 400) && ((NSInteger)errorCode < 500)); 42 | va_list arguments; 43 | va_start(arguments, format); 44 | GCDWebServerErrorResponse* response = [[self alloc] initWithStatusCode:errorCode underlyingError:nil messageFormat:format arguments:arguments]; 45 | va_end(arguments); 46 | return response; 47 | } 48 | 49 | + (instancetype)responseWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode message:(NSString*)format, ... { 50 | GWS_DCHECK(((NSInteger)errorCode >= 500) && ((NSInteger)errorCode < 600)); 51 | va_list arguments; 52 | va_start(arguments, format); 53 | GCDWebServerErrorResponse* response = [[self alloc] initWithStatusCode:errorCode underlyingError:nil messageFormat:format arguments:arguments]; 54 | va_end(arguments); 55 | return response; 56 | } 57 | 58 | + (instancetype)responseWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... { 59 | GWS_DCHECK(((NSInteger)errorCode >= 400) && ((NSInteger)errorCode < 500)); 60 | va_list arguments; 61 | va_start(arguments, format); 62 | GCDWebServerErrorResponse* response = [[self alloc] initWithStatusCode:errorCode underlyingError:underlyingError messageFormat:format arguments:arguments]; 63 | va_end(arguments); 64 | return response; 65 | } 66 | 67 | + (instancetype)responseWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... { 68 | GWS_DCHECK(((NSInteger)errorCode >= 500) && ((NSInteger)errorCode < 600)); 69 | va_list arguments; 70 | va_start(arguments, format); 71 | GCDWebServerErrorResponse* response = [[self alloc] initWithStatusCode:errorCode underlyingError:underlyingError messageFormat:format arguments:arguments]; 72 | va_end(arguments); 73 | return response; 74 | } 75 | 76 | static inline NSString* _EscapeHTMLString(NSString* string) { 77 | return [string stringByReplacingOccurrencesOfString:@"\"" withString:@"""]; 78 | } 79 | 80 | - (instancetype)initWithStatusCode:(NSInteger)statusCode underlyingError:(NSError*)underlyingError messageFormat:(NSString*)format arguments:(va_list)arguments { 81 | NSString* message = [[NSString alloc] initWithFormat:format arguments:arguments]; 82 | NSString* title = [NSString stringWithFormat:@"HTTP Error %i", (int)statusCode]; 83 | NSString* error = underlyingError ? [NSString stringWithFormat:@"[%@] %@ (%li)", underlyingError.domain, _EscapeHTMLString(underlyingError.localizedDescription), (long)underlyingError.code] : @""; 84 | NSString* html = [NSString stringWithFormat:@"%@

%@: %@

%@

", 85 | title, title, _EscapeHTMLString(message), error]; 86 | if ((self = [self initWithHTML:html])) { 87 | self.statusCode = statusCode; 88 | } 89 | return self; 90 | } 91 | 92 | - (instancetype)initWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode message:(NSString*)format, ... { 93 | GWS_DCHECK(((NSInteger)errorCode >= 400) && ((NSInteger)errorCode < 500)); 94 | va_list arguments; 95 | va_start(arguments, format); 96 | self = [self initWithStatusCode:errorCode underlyingError:nil messageFormat:format arguments:arguments]; 97 | va_end(arguments); 98 | return self; 99 | } 100 | 101 | - (instancetype)initWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode message:(NSString*)format, ... { 102 | GWS_DCHECK(((NSInteger)errorCode >= 500) && ((NSInteger)errorCode < 600)); 103 | va_list arguments; 104 | va_start(arguments, format); 105 | self = [self initWithStatusCode:errorCode underlyingError:nil messageFormat:format arguments:arguments]; 106 | va_end(arguments); 107 | return self; 108 | } 109 | 110 | - (instancetype)initWithClientError:(GCDWebServerClientErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... { 111 | GWS_DCHECK(((NSInteger)errorCode >= 400) && ((NSInteger)errorCode < 500)); 112 | va_list arguments; 113 | va_start(arguments, format); 114 | self = [self initWithStatusCode:errorCode underlyingError:underlyingError messageFormat:format arguments:arguments]; 115 | va_end(arguments); 116 | return self; 117 | } 118 | 119 | - (instancetype)initWithServerError:(GCDWebServerServerErrorHTTPStatusCode)errorCode underlyingError:(NSError*)underlyingError message:(NSString*)format, ... { 120 | GWS_DCHECK(((NSInteger)errorCode >= 500) && ((NSInteger)errorCode < 600)); 121 | va_list arguments; 122 | va_start(arguments, format); 123 | self = [self initWithStatusCode:errorCode underlyingError:underlyingError messageFormat:format arguments:arguments]; 124 | va_end(arguments); 125 | return self; 126 | } 127 | 128 | @end 129 | --------------------------------------------------------------------------------