diff --git a/DiscordX.xcodeproj/project.pbxproj b/DiscordX.xcodeproj/project.pbxproj new file mode 100644 index 0000000..dd7fa60 --- /dev/null +++ b/DiscordX.xcodeproj/project.pbxproj @@ -0,0 +1,383 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 52; + objects = { + +/* Begin PBXBuildFile section */ + 5028EA45244B181D003A1830 /* HelperFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5028EA44244B181D003A1830 /* HelperFunctions.swift */; }; + 5068E2DF244AA3C90012CCF7 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5068E2DE244AA3C90012CCF7 /* Constants.swift */; }; + 50C66C1B244B3A5800A4BECD /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 50C66C1A244B3A5800A4BECD /* Main.storyboard */; }; + 50C6CBB3244974A400F10C5D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50C6CBB2244974A400F10C5D /* AppDelegate.swift */; }; + 50C6CBB7244974A700F10C5D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 50C6CBB6244974A700F10C5D /* Assets.xcassets */; }; + 50C6CBBA244974A700F10C5D /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 50C6CBB9244974A700F10C5D /* Preview Assets.xcassets */; }; + 50C6CBC9244975F200F10C5D /* Applescript.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50C6CBC8244975F200F10C5D /* Applescript.swift */; }; + C3DCE3CB251FBE3F008A8718 /* SwordRPC in Frameworks */ = {isa = PBXBuildFile; productRef = C3DCE3CA251FBE3F008A8718 /* SwordRPC */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 5028EA44244B181D003A1830 /* HelperFunctions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HelperFunctions.swift; sourceTree = ""; }; + 5068E2DE244AA3C90012CCF7 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; + 50C66C1A244B3A5800A4BECD /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; + 50C6CBAF244974A400F10C5D /* DiscordX.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DiscordX.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 50C6CBB2244974A400F10C5D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 50C6CBB6244974A700F10C5D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 50C6CBB9244974A700F10C5D /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 50C6CBBE244974A700F10C5D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 50C6CBBF244974A700F10C5D /* DiscordX.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DiscordX.entitlements; sourceTree = ""; }; + 50C6CBC8244975F200F10C5D /* Applescript.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Applescript.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 50C6CBAC244974A400F10C5D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + C3DCE3CB251FBE3F008A8718 /* SwordRPC in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 50C6CBA6244974A400F10C5D = { + isa = PBXGroup; + children = ( + 50C6CBB1244974A400F10C5D /* DiscordX */, + 50C6CBB0244974A400F10C5D /* Products */, + ); + sourceTree = ""; + }; + 50C6CBB0244974A400F10C5D /* Products */ = { + isa = PBXGroup; + children = ( + 50C6CBAF244974A400F10C5D /* DiscordX.app */, + ); + name = Products; + sourceTree = ""; + }; + 50C6CBB1244974A400F10C5D /* DiscordX */ = { + isa = PBXGroup; + children = ( + 50C6CBB2244974A400F10C5D /* AppDelegate.swift */, + 5028EA44244B181D003A1830 /* HelperFunctions.swift */, + 5068E2DE244AA3C90012CCF7 /* Constants.swift */, + 50C6CBC8244975F200F10C5D /* Applescript.swift */, + 50C6CBB6244974A700F10C5D /* Assets.xcassets */, + 50C66C1A244B3A5800A4BECD /* Main.storyboard */, + 50C6CBBE244974A700F10C5D /* Info.plist */, + 50C6CBBF244974A700F10C5D /* DiscordX.entitlements */, + 50C6CBB8244974A700F10C5D /* Preview Content */, + ); + path = DiscordX; + sourceTree = ""; + }; + 50C6CBB8244974A700F10C5D /* Preview Content */ = { + isa = PBXGroup; + children = ( + 50C6CBB9244974A700F10C5D /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 50C6CBAE244974A400F10C5D /* DiscordX */ = { + isa = PBXNativeTarget; + buildConfigurationList = 50C6CBC2244974A700F10C5D /* Build configuration list for PBXNativeTarget "DiscordX" */; + buildPhases = ( + 50C6CBAB244974A400F10C5D /* Sources */, + 50C6CBAC244974A400F10C5D /* Frameworks */, + 50C6CBAD244974A400F10C5D /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = DiscordX; + packageProductDependencies = ( + C3DCE3CA251FBE3F008A8718 /* SwordRPC */, + ); + productName = RPFX; + productReference = 50C6CBAF244974A400F10C5D /* DiscordX.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 50C6CBA7244974A400F10C5D /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1110; + LastUpgradeCheck = 1200; + ORGANIZATIONNAME = "Vincent Liu"; + TargetAttributes = { + 50C6CBAE244974A400F10C5D = { + CreatedOnToolsVersion = 11.1; + LastSwiftMigration = 1110; + }; + }; + }; + buildConfigurationList = 50C6CBAA244974A400F10C5D /* Build configuration list for PBXProject "DiscordX" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 50C6CBA6244974A400F10C5D; + packageReferences = ( + C3DCE3C9251FBE3F008A8718 /* XCRemoteSwiftPackageReference "SwordRPC" */, + ); + productRefGroup = 50C6CBB0244974A400F10C5D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 50C6CBAE244974A400F10C5D /* DiscordX */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 50C6CBAD244974A400F10C5D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 50C66C1B244B3A5800A4BECD /* Main.storyboard in Resources */, + 50C6CBBA244974A700F10C5D /* Preview Assets.xcassets in Resources */, + 50C6CBB7244974A700F10C5D /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 50C6CBAB244974A400F10C5D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5028EA45244B181D003A1830 /* HelperFunctions.swift in Sources */, + 50C6CBB3244974A400F10C5D /* AppDelegate.swift in Sources */, + 50C6CBC9244975F200F10C5D /* Applescript.swift in Sources */, + 5068E2DF244AA3C90012CCF7 /* Constants.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 50C6CBC0244974A700F10C5D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = s; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.12; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 50C6CBC1244974A700F10C5D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.12; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + 50C6CBC3244974A700F10C5D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = DiscordX/DiscordX.entitlements; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 2020.9.30; + DEVELOPMENT_ASSET_PATHS = "\"DiscordX/Preview Content\""; + DEVELOPMENT_TEAM = CQZU37S3DP; + ENABLE_HARDENED_RUNTIME = YES; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = DiscordX/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.12; + MARKETING_VERSION = 1.0.3; + PRODUCT_BUNDLE_IDENTIFIER = com.asad.DiscordX; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 50C6CBC4244974A700F10C5D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = DiscordX/DiscordX.entitlements; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 2020.9.30; + DEVELOPMENT_ASSET_PATHS = "\"DiscordX/Preview Content\""; + DEVELOPMENT_TEAM = CQZU37S3DP; + ENABLE_HARDENED_RUNTIME = YES; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = DiscordX/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.12; + MARKETING_VERSION = 1.0.3; + PRODUCT_BUNDLE_IDENTIFIER = com.asad.DiscordX; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 50C6CBAA244974A400F10C5D /* Build configuration list for PBXProject "DiscordX" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 50C6CBC0244974A700F10C5D /* Debug */, + 50C6CBC1244974A700F10C5D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + 50C6CBC2244974A700F10C5D /* Build configuration list for PBXNativeTarget "DiscordX" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 50C6CBC3244974A700F10C5D /* Debug */, + 50C6CBC4244974A700F10C5D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; +/* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + C3DCE3C9251FBE3F008A8718 /* XCRemoteSwiftPackageReference "SwordRPC" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/PKBeam/SwordRPC.git"; + requirement = { + branch = master; + kind = branch; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + C3DCE3CA251FBE3F008A8718 /* SwordRPC */ = { + isa = XCSwiftPackageProductDependency; + package = C3DCE3C9251FBE3F008A8718 /* XCRemoteSwiftPackageReference "SwordRPC" */; + productName = SwordRPC; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = 50C6CBA7244974A400F10C5D /* Project object */; +} diff --git a/DiscordX.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/DiscordX.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/DiscordX.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/DiscordX.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/DiscordX.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/DiscordX.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/DiscordX.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/DiscordX.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/DiscordX.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/DiscordX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DiscordX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..34ec365 --- /dev/null +++ b/DiscordX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,25 @@ +{ + "object": { + "pins": [ + { + "package": "Socket", + "repositoryURL": "https://github.com/IBM-Swift/BlueSocket.git", + "state": { + "branch": null, + "revision": "26c8f4e4e3000421a0c97aaf0c7b5e9aa5475222", + "version": "0.12.94" + } + }, + { + "package": "SwordRPC", + "repositoryURL": "https://github.com/PKBeam/SwordRPC.git", + "state": { + "branch": "master", + "revision": "2a4f993f96c5d84c0081d7fc2f290eadeacd5a8b", + "version": null + } + } + ] + }, + "version": 1 +} diff --git a/DiscordX.xcodeproj/project.xcworkspace/xcuserdata/asad.xcuserdatad/IDEFindNavigatorScopes.plist b/DiscordX.xcodeproj/project.xcworkspace/xcuserdata/asad.xcuserdatad/IDEFindNavigatorScopes.plist new file mode 100644 index 0000000..5dd5da8 --- /dev/null +++ b/DiscordX.xcodeproj/project.xcworkspace/xcuserdata/asad.xcuserdatad/IDEFindNavigatorScopes.plist @@ -0,0 +1,5 @@ + + + + + diff --git a/DiscordX.xcodeproj/project.xcworkspace/xcuserdata/asad.xcuserdatad/UserInterfaceState.xcuserstate b/DiscordX.xcodeproj/project.xcworkspace/xcuserdata/asad.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..16afc1a Binary files /dev/null and b/DiscordX.xcodeproj/project.xcworkspace/xcuserdata/asad.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/DiscordX.xcodeproj/xcshareddata/xcschemes/DiscordX.xcscheme b/DiscordX.xcodeproj/xcshareddata/xcschemes/DiscordX.xcscheme new file mode 100644 index 0000000..b738d07 --- /dev/null +++ b/DiscordX.xcodeproj/xcshareddata/xcschemes/DiscordX.xcscheme @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DiscordX.xcodeproj/xcuserdata/asad.xcuserdatad/xcschemes/xcschememanagement.plist b/DiscordX.xcodeproj/xcuserdata/asad.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..02e1784 --- /dev/null +++ b/DiscordX.xcodeproj/xcuserdata/asad.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + DiscordX.xcscheme_^#shared#^_ + + orderHint + 0 + + + SuppressBuildableAutocreation + + 50C6CBAE244974A400F10C5D + + primary + + + + + diff --git a/DiscordX/.DS_Store b/DiscordX/.DS_Store new file mode 100644 index 0000000..5c317f1 Binary files /dev/null and b/DiscordX/.DS_Store differ diff --git a/DiscordX/AppDelegate.swift b/DiscordX/AppDelegate.swift new file mode 100644 index 0000000..a04b600 --- /dev/null +++ b/DiscordX/AppDelegate.swift @@ -0,0 +1,159 @@ +// +// AppDelegate.swift +// DiscordX +// +// Created by Asad Azam on 28/9/20. +// Copyright © 2020 Asad Azam. All rights reserved. +// + +import Cocoa + +import SwordRPC + +@NSApplicationMain +class AppDelegate: NSObject, NSApplicationDelegate { + +// var window: NSWindow! + var timer: Timer? + var rpc: SwordRPC? + var startDate: Date? + var lastWindow: String? + + func beginTimer() { + timer = Timer(timeInterval: TimeInterval(refreshInterval), repeats: true, block: { _ in + self.updateStatus() +// print(Date()) + }) + RunLoop.main.add(timer!, forMode: .common) + timer!.fire() + } + + func clearTimer() { + timer?.invalidate() + } + + func updateStatus() { + var p = RichPresence() + + let an = getActiveWindow() // an -> Application Name + + let fn = getActiveFilename() //fn -> File Name + let ws = getActiveWorkspace() //ws -> Workspace + + // determine file type + if fn != nil && an == "Xcode" { + p.details = "Editing \(fn!)" + + if let fileExt = getFileExt(fn!), discordRPImageKeys.contains(fileExt) { + p.assets.largeImage = fileExt + p.assets.smallImage = discordRPImageKeyXcode + } else { + p.assets.largeImage = discordRPImageKeyDefault + } + } else { + if let appName = an, xcodeWindowNames.contains(appName) { + p.details = "Using \(appName)" + p.assets.largeImage = appName.replacingOccurrences(of: "\\s", with: "", options: .regularExpression).lowercased() + p.assets.smallImage = discordRPImageKeyXcode + } + } + + // determine workspace type + if ws != nil { + if an == "Xcode"{ + if ws != "Untitled" { + p.state = "in \(withoutFileExt(ws!))" + lastWindow = ws! + } + } else { + p.state = "on \(withoutFileExt(lastWindow ?? "?" ))" + } + } + + // Xcode was just launched? + if fn == nil && ws == nil { + p.assets.largeImage = discordRPImageKeyXcode + p.details = "No file open" + } + + p.timestamps.start = startDate! + p.timestamps.end = nil + rpc!.setPresence(p) +// print("updating RP") + } + + func initRPC() { + // init discord stuff + rpc = SwordRPC.init(appId: discordClientId) + rpc!.delegate = self + rpc!.connect() + } + + func deinitRPC() { + self.rpc!.setPresence(RichPresence()) + self.rpc!.disconnect() + self.rpc = nil + } + + func applicationDidFinishLaunching(_ aNotification: Notification) { +// print("app launched") + + for app in NSWorkspace.shared.runningApplications { + // check if xcode is running + if app.bundleIdentifier == xcodeBundleId { +// print("xcode running, connecting...") + initRPC() + } + } + + let notifCenter = NSWorkspace.shared.notificationCenter + + // run on Xcode launch + notifCenter.addObserver(forName: NSWorkspace.didLaunchApplicationNotification, object: nil, queue: nil, using: { notif in + if let app = notif.userInfo?[NSWorkspace.applicationUserInfoKey] as? NSRunningApplication { + if app.bundleIdentifier == xcodeBundleId { +// print("xcode launched, connecting...") + self.initRPC() + } + } + }) + + // run on Xcode close + notifCenter.addObserver(forName: NSWorkspace.didTerminateApplicationNotification, object: nil, queue: nil, using: { notif in + if let app = notif.userInfo?[NSWorkspace.applicationUserInfoKey] as? NSRunningApplication { + if app.bundleIdentifier == xcodeBundleId { +// print("xcode closed, disconnecting...") + self.deinitRPC() + } + } + }) + + + } + + func applicationWillTerminate(_ aNotification: Notification) { + // Insert code here to tear down your application +// print("app closing") + deinitRPC() + clearTimer() + } + + +} + +extension AppDelegate: SwordRPCDelegate { + func swordRPCDidConnect(_ rpc: SwordRPC) { +// print("connected") + startDate = Date() + beginTimer() + } + + func swordRPCDidDisconnect(_ rpc: SwordRPC, code: Int?, message msg: String?) { +// print("disconnected") + clearTimer() + } + + func swordRPCDidReceiveError(_ rpc: SwordRPC, code: Int, message msg: String) { + + } +} diff --git a/DiscordX/Applescript.swift b/DiscordX/Applescript.swift new file mode 100644 index 0000000..aec5b49 --- /dev/null +++ b/DiscordX/Applescript.swift @@ -0,0 +1,104 @@ +// +// Applescript.swift +// DiscordX +// +// Created by Asad Azam on 28/9/20. +// Copyright © 2020 Asad Azam. All rights reserved. +// + +import Foundation +import Cocoa + +enum APScripts: String { + case windowNames = "return name of windows" + case filePaths = "return file of documents" + case documentNames = "return name of documents" + case activeWorkspaceDocument = "return active workspace document" +} + +func runAPScript(_ s: APScripts) -> [String]? { + let scr = """ + tell application "Xcode" + \(s.rawValue) + end tell + """ + + // execute the script + let script = NSAppleScript.init(source: scr) + let result = script?.executeAndReturnError(nil) + + // format the result as a Swift array + if let desc = result { + var arr: [String] = [] + if desc.numberOfItems == 0 { + return arr + } + for i in 1...desc.numberOfItems { + let strVal = desc.atIndex(i)!.stringValue + if var uwStrVal = strVal { + // remove " — Edited" suffix if it exists + if uwStrVal.hasSuffix(" — Edited") { + uwStrVal.removeSubrange(uwStrVal.lastIndex(of: "—")!...) + uwStrVal.removeLast() + } + arr.append(uwStrVal) + } + } + return arr + } + return nil +} + +func getActiveFilename() -> String? { + guard let fileNames = runAPScript(.documentNames) else { + return nil + } + + guard let windowNames = runAPScript(.windowNames) else { + return nil + } + + // find the first window title that matches a filename + // (the first window name is the one in focus) + for window in windowNames { + // make sure the focused window refers to a file + for file in fileNames { + if file == window { + return file + } + } + } + + return nil +} + +func getActiveWorkspace() -> String? { + if let awd = runAPScript(.activeWorkspaceDocument), awd.count >= 2 { + return awd[1] + } + return nil +} + +func getActiveWindow() -> String? { + let activeApplication = """ + tell application "System Events" + get the name of every application process whose frontmost is true + end tell + """ + +// get the name of every process whose visible is true + + let script = NSAppleScript.init(source: activeApplication) + let result = script?.executeAndReturnError(nil) + + if let desc = result { + var arr: [String] = [] + for i in 1...desc.numberOfItems { + guard let strVal = desc.atIndex(i)!.stringValue else { return "Xcode" } + arr.append(strVal) + } +// print(arr[0]) + return arr[0] + } + return "Xcode" +} diff --git a/DiscordX/Assets.xcassets/AppIcon.appiconset/Contents.json b/DiscordX/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..f9155be --- /dev/null +++ b/DiscordX/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "filename" : "discordX copy-8.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "filename" : "discordX copy-7.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "filename" : "discordX copy-6.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "filename" : "discordX copy-5.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "filename" : "discordX copy-4.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "filename" : "discordX copy-2.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "filename" : "discordX copy-3.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "filename" : "discordX copy-1.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "filename" : "discordX copy.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "filename" : "discordX.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy-1.png b/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy-1.png new file mode 100644 index 0000000..512e62e Binary files /dev/null and b/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy-1.png differ diff --git a/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy-2.png b/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy-2.png new file mode 100644 index 0000000..ed00566 Binary files /dev/null and b/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy-2.png differ diff --git a/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy-3.png b/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy-3.png new file mode 100644 index 0000000..ed00566 Binary files /dev/null and b/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy-3.png differ diff --git a/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy-4.png b/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy-4.png new file mode 100644 index 0000000..f408932 Binary files /dev/null and b/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy-4.png differ diff --git a/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy-5.png b/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy-5.png new file mode 100644 index 0000000..1f9dc16 Binary files /dev/null and b/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy-5.png differ diff --git a/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy-6.png b/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy-6.png new file mode 100644 index 0000000..14d410d Binary files /dev/null and b/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy-6.png differ diff --git a/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy-7.png b/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy-7.png new file mode 100644 index 0000000..14d410d Binary files /dev/null and b/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy-7.png differ diff --git a/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy-8.png b/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy-8.png new file mode 100644 index 0000000..4379381 Binary files /dev/null and b/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy-8.png differ diff --git a/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy.png b/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy.png new file mode 100644 index 0000000..512e62e Binary files /dev/null and b/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX copy.png differ diff --git a/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX.png b/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX.png new file mode 100644 index 0000000..a12be66 Binary files /dev/null and b/DiscordX/Assets.xcassets/AppIcon.appiconset/discordX.png differ diff --git a/DiscordX/Assets.xcassets/Contents.json b/DiscordX/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/DiscordX/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/DiscordX/Constants.swift b/DiscordX/Constants.swift new file mode 100644 index 0000000..4189205 --- /dev/null +++ b/DiscordX/Constants.swift @@ -0,0 +1,69 @@ +// +// Constants.swift +// DiscordX +// +// Created by Asad Azam on 28/9/20. +// Copyright © 2020 Asad Azam. All rights reserved. +// + +import Foundation + +// used to register for notifs when Xcode opens/closes +let xcodeBundleId = "com.apple.dt.Xcode" + +// how often we check Xcode for a status update +let refreshInterval = 5 // seconds + +// some other window names of Xcode +let xcodeWindowNames = [ + "Simulator", + "Instruments", + "Accessibility Inspector", + "FileMerge", + "Create ML", + "RealityComposer", + //doc://com.apple.documentation -> Process name -> Xcode Documentation + //unable to find organiser +] + +// The following constants are for use with the Discord App +// if you're using your own Discord App, update this as needed + +let discordClientId = "759699771689795615" + +// Chaniging the below list of files won't do anything as they are hardcoded +// on the discord application. To add images you need to create your own application + +// discord image keys of supported file types +let discordRPImageKeys = [ + "swift", + "playground", + "storyboard", + "xcodeproj", + "h", + "m", + "cpp", + "c", + "sdef", + "plist", + "md", + "appex", + "rcproject", + "rtf", + "rtfd", + "pch", + "mm", + "xcassets", + "iig", + "metal", + "xib", + "arobject", + "entitlements", +] + +// default for unsupported file types +let discordRPImageKeyDefault = "xcode" + +// Xcode application icon +let discordRPImageKeyXcode = "xcode" + diff --git a/DiscordX/DiscordX.entitlements b/DiscordX/DiscordX.entitlements new file mode 100644 index 0000000..0bdd9d3 --- /dev/null +++ b/DiscordX/DiscordX.entitlements @@ -0,0 +1,12 @@ + + + + + com.apple.security.automation.apple-events + + com.apple.security.temporary-exception.apple-events + + com.apple.dt.Xcode + + + diff --git a/DiscordX/HelperFunctions.swift b/DiscordX/HelperFunctions.swift new file mode 100644 index 0000000..a06c1b8 --- /dev/null +++ b/DiscordX/HelperFunctions.swift @@ -0,0 +1,26 @@ +// +// HelperFunctions.swift +// DiscordX +// +// Created by Asad Azam on 28/9/20. +// Copyright © 2020 Asad Azam. All rights reserved. +// + +import Foundation + +func getFileExt(_ file: String) -> String? { + if let ext = file.split(separator: ".").last { + return String(ext) + } + return nil +} + +func withoutFileExt(_ file: String) -> String { + if !file.contains(".") || file.last == "." { + return file + } + + var ret = file + while (ret.popLast() != ".") {} + return ret +} diff --git a/DiscordX/Info.plist b/DiscordX/Info.plist new file mode 100644 index 0000000..4e4cf11 --- /dev/null +++ b/DiscordX/Info.plist @@ -0,0 +1,40 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + $(MARKETING_VERSION) + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + LSApplicationCategoryType + public.app-category.developer-tools + LSBackgroundOnly + + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSAppleEventsUsageDescription + This is needed to monitor Xcode. + NSHumanReadableCopyright + Copyright © 2020 Asad Azam. All rights reserved. + NSMainStoryboardFile + Main + NSPrincipalClass + NSApplication + NSSupportsAutomaticTermination + + NSSupportsSuddenTermination + + + diff --git a/DiscordX/Main.storyboard b/DiscordX/Main.storyboard new file mode 100644 index 0000000..d91d794 --- /dev/null +++ b/DiscordX/Main.storyboard @@ -0,0 +1,683 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DiscordX/Preview Content/Preview Assets.xcassets/Contents.json b/DiscordX/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/DiscordX/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..08568ae --- /dev/null +++ b/README.md @@ -0,0 +1,87 @@ +# DiscordX +DiscordX adds support for Xcode on Discord AKA Discord Rich Presence + + + +DiscordX displays, the current file you are working on, as well as the current workspace in use. It uses the same icons which exist in Xcode 12.0.1 (12A7300) +DIscordX adds support for current application in use too. There are other applications that do the exact same thing but none of them which I used supported applications or such a wide variety of file types, also none of them are updated for Xcode 12. + +The following file type extensions are supported: +- `.swift` +- `.playground` +- `.storyboard` +- `.xcodeproj` +- `.h` +- `.m` +- `.cpp` +- `.c` +- `.sdef` +- `.plist` +- `.md` +- `.appex` +- `.rcproject` +- `.rtf` +- `.rtfd` +- `.pch` +- `.mm` +- `.xcassets` +- `.iig` +- `.metal` +- `.xib` +- `.arobject` +- `.entitlements` + +The following applications are supported: +- `Simulator` +- `Instruments` +- `Accessibility Inspector` +- `FileMerge` +- `Create ML` +- `RealityComposer` + +## Dependencies +If you are modifing/ tweaking the applicaton make sure you change the Development Team +DiscordX uses [PKBeam's Fork](https://github.com/PKBeam/SwordRPC) of [Azoy's SwordRPC](https://github.com/Azoy/SwordRPC). + +## System Requirements +- macOS Sierra (10.12) (Minimum) +- Xcode installed + +## Usage +Simply place the application under Applications Folder (not mandatory) and it will ask for two permissions, one is for controlling Xcode and other is for System Events, +As the app uses Apple script and to perform any operation it would need access to whatever the script is going to run on. + +List of Apple Scipts run: +``` +tell application "Xcode" + return name of windows +end tell +``` +``` +tell application "Xcode" + return file of documents +end tell +``` +``` +tell application "Xcode" + return name of documents +end tell +``` +``` +tell application "Xcode" + return active workspace document +end tell +``` +``` +tell application "System Events" + get the name of every application process whose frontmost is true +end tell +``` + +You can verify what permissions DiscordX uses by opening System Preferences and looking in Security & Privacy under Privacy, then Automation. +That's it, you're done - DiscordX will now automatically monitor Xcode. + +If you like, you can set DiscordX to automatically open on login. + +# Note +DiscordX is a fork of [RPFX](https://github.com/PKBeam/RPFX) I didn't contribute to the orignal as I didn't like the name RPFX.