diff --git a/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/1024_768.png b/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/1024_768.png deleted file mode 100644 index e90aa93..0000000 Binary files a/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/1024_768.png and /dev/null differ diff --git a/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/120_90.png b/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/120_90.png deleted file mode 100644 index d17014d..0000000 Binary files a/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/120_90.png and /dev/null differ diff --git a/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/134_100.png b/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/134_100.png deleted file mode 100644 index 0d4b53f..0000000 Binary files a/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/134_100.png and /dev/null differ diff --git a/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/148_110.png b/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/148_110.png deleted file mode 100644 index 59f4736..0000000 Binary files a/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/148_110.png and /dev/null differ diff --git a/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/180_135.png b/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/180_135.png deleted file mode 100644 index 94354c6..0000000 Binary files a/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/180_135.png and /dev/null differ diff --git a/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/54_40.png b/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/54_40.png deleted file mode 100644 index 3e5cc2b..0000000 Binary files a/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/54_40.png and /dev/null differ diff --git a/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/64_48.png b/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/64_48.png deleted file mode 100644 index fe7f539..0000000 Binary files a/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/64_48.png and /dev/null differ diff --git a/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/81_60.png b/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/81_60.png deleted file mode 100644 index b340d03..0000000 Binary files a/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/81_60.png and /dev/null differ diff --git a/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/96_72.png b/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/96_72.png deleted file mode 100644 index 4ed59db..0000000 Binary files a/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/96_72.png and /dev/null differ diff --git a/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/Contents.json b/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/Contents.json index 9bc32c8..bc3c4ee 100644 --- a/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/Contents.json +++ b/interject/Interject! iMessage/Assets.xcassets/iMessage App Icon.stickersiconset/Contents.json @@ -1,59 +1,70 @@ { "images" : [ { - "filename" : "120_90.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { "idiom" : "iphone", "scale" : "2x", "size" : "60x45" }, { - "filename" : "180_135.png", "idiom" : "iphone", "scale" : "3x", "size" : "60x45" }, { - "filename" : "134_100.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { "idiom" : "ipad", "scale" : "2x", "size" : "67x50" }, { - "filename" : "148_110.png", "idiom" : "ipad", "scale" : "2x", "size" : "74x55" }, { - "filename" : "54_40.png", + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + }, + { "idiom" : "universal", "platform" : "ios", "scale" : "2x", "size" : "27x20" }, { - "filename" : "81_60.png", "idiom" : "universal", "platform" : "ios", "scale" : "3x", "size" : "27x20" }, { - "filename" : "64_48.png", "idiom" : "universal", "platform" : "ios", "scale" : "2x", "size" : "32x24" }, { - "filename" : "96_72.png", "idiom" : "universal", "platform" : "ios", "scale" : "3x", "size" : "32x24" }, { - "filename" : "1024_768.png", "idiom" : "ios-marketing", "platform" : "ios", "scale" : "1x", diff --git a/interject/Interject! iMessage/MessagesViewController.swift b/interject/Interject! iMessage/MessagesViewController.swift index 14d25f6..f01f800 100644 --- a/interject/Interject! iMessage/MessagesViewController.swift +++ b/interject/Interject! iMessage/MessagesViewController.swift @@ -17,24 +17,24 @@ extension String { // This uses the Words Structure, it doesn't need History. class MessagesViewController: MSMessagesAppViewController { - + // MARK: UI VARS @IBOutlet weak var sfwLabel: UIBarButtonItem! @IBOutlet weak var phraseLabel: UILabel! - - + + // MARK: Local Vars var sfw = true var sentence = Sentence() - - + + // MARK: functions // first load, Let's explain what the need to do. override func viewDidLoad() { super.viewDidLoad() phraseLabel.text = "Swipe down for new words, up to send." } - + // Toggle sfw @IBAction func sfwToggle(_ sender: Any) { if !sfw { @@ -47,22 +47,22 @@ class MessagesViewController: MSMessagesAppViewController { updatePhraseLabel() } } - + // Let's get a new phrase @IBAction func newPhrase(_ sender: Any) { sentence = Sentence().new(current: sentence) updatePhraseLabel() } - + // Send a phrase to messages @IBAction func sendPhrase(_ sender: Any) { let conversation = self.activeConversation conversation?.insertText(phraseLabel.text!) { error in } } - + // Update the label func updatePhraseLabel() { - phraseLabel.text = + phraseLabel.text = sentence.word(.first, safe: sfw).uppercaseFirst + " " + sentence.word(.second, safe: sfw).uppercaseFirst + " " + sentence.word(.noun, safe: sfw).uppercaseFirst diff --git a/interject/Interject!.xcodeproj/project.pbxproj b/interject/Interject!.xcodeproj/project.pbxproj index 898e952..c29c751 100644 --- a/interject/Interject!.xcodeproj/project.pbxproj +++ b/interject/Interject!.xcodeproj/project.pbxproj @@ -3,10 +3,15 @@ archiveVersion = 1; classes = { }; - objectVersion = 63; + objectVersion = 70; objects = { /* Begin PBXBuildFile section */ + 761EDD473003EB67006FC7FB /* Intents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761EDD463003EB67006FC7FB /* Intents.swift */; }; + 761EDD4D3003F175006FC7FB /* Messages.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76C445E02BDD4DE30033B339 /* Messages.framework */; }; + 761EDD593003F176006FC7FB /* Interject! iMessage.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 761EDD4C3003F175006FC7FB /* Interject! iMessage.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 761EDD6E3003F269006FC7FB /* words.json in Resources */ = {isa = PBXBuildFile; fileRef = 765F5A4B30029EC7004C2F29 /* words.json */; }; + 761EDD703003F5FF006FC7FB /* Words.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98D0A2DE274721620084F7F9 /* Words.swift */; }; 762C51A22BC33AE5000689D9 /* Tips.swift in Sources */ = {isa = PBXBuildFile; fileRef = 762C51A12BC33AE5000689D9 /* Tips.swift */; }; 762C51A42BCAD9BC000689D9 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 762C51A32BCAD9BC000689D9 /* StoreKit.framework */; }; 762C51A62BCADA1C000689D9 /* Products.storekit in Resources */ = {isa = PBXBuildFile; fileRef = 762C51A52BCADA1C000689D9 /* Products.storekit */; }; @@ -34,6 +39,13 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + 761EDD573003F176006FC7FB /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 98D0A29D27471FF80084F7F9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 761EDD4B3003F175006FC7FB; + remoteInfo = "Interject! iMessage"; + }; 98D0A2B627471FF90084F7F9 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 98D0A29D27471FF80084F7F9 /* Project object */; @@ -57,6 +69,7 @@ dstPath = ""; dstSubfolderSpec = 13; files = ( + 761EDD593003F176006FC7FB /* Interject! iMessage.appex in Embed Foundation Extensions */, ); name = "Embed Foundation Extensions"; runOnlyForDeploymentPostprocessing = 0; @@ -64,11 +77,8 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 760B5A742BDD538100ADE31A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 761F89D12BDF0AC1003D2DD2 /* MainInterface.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = MainInterface.storyboard; sourceTree = ""; }; - 761F89D32BDF0ACC003D2DD2 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; - 761F89D52BDF0AE3003D2DD2 /* MessagesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessagesViewController.swift; sourceTree = ""; }; - 761F89D72BDF0AF3003D2DD2 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 761EDD463003EB67006FC7FB /* Intents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Intents.swift; sourceTree = ""; }; + 761EDD4C3003F175006FC7FB /* Interject! iMessage.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Interject! iMessage.appex"; sourceTree = BUILT_PRODUCTS_DIR; }; 762C51A12BC33AE5000689D9 /* Tips.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tips.swift; sourceTree = ""; }; 762C51A32BCAD9BC000689D9 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; }; 762C51A52BCADA1C000689D9 /* Products.storekit */ = {isa = PBXFileReference; lastKnownFileType = text; path = Products.storekit; sourceTree = ""; }; @@ -99,7 +109,29 @@ 98EA0F3628636B6400B4E136 /* ToolbarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToolbarView.swift; sourceTree = ""; }; /* End PBXFileReference section */ +/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ + 761EDD6F3003F317006FC7FB /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = { + isa = PBXFileSystemSynchronizedBuildFileExceptionSet; + membershipExceptions = ( + Info.plist, + ); + target = 761EDD4B3003F175006FC7FB /* Interject! iMessage */; + }; +/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ + +/* Begin PBXFileSystemSynchronizedRootGroup section */ + 761EDD4E3003F175006FC7FB /* Interject! iMessage */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (761EDD6F3003F317006FC7FB /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = "Interject! iMessage"; sourceTree = ""; }; +/* End PBXFileSystemSynchronizedRootGroup section */ + /* Begin PBXFrameworksBuildPhase section */ + 761EDD493003F175006FC7FB /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 761EDD4D3003F175006FC7FB /* Messages.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 98D0A2A227471FF80084F7F9 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -125,18 +157,6 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 760B5A6C2BDD537F00ADE31A /* Interject! iMessage */ = { - isa = PBXGroup; - children = ( - 761F89D72BDF0AF3003D2DD2 /* Assets.xcassets */, - 761F89D52BDF0AE3003D2DD2 /* MessagesViewController.swift */, - 761F89D12BDF0AC1003D2DD2 /* MainInterface.storyboard */, - 761F89D32BDF0ACC003D2DD2 /* LaunchScreen.storyboard */, - 760B5A742BDD538100ADE31A /* Info.plist */, - ); - path = "Interject! iMessage"; - sourceTree = ""; - }; 9814700B286161EC0097E0A7 /* Utils */ = { isa = PBXGroup; children = ( @@ -160,7 +180,7 @@ 98D0A2A727471FF80084F7F9 /* Interject! */, 98D0A2B827471FF90084F7F9 /* Interject!Tests */, 98D0A2C227471FF90084F7F9 /* Interject!UITests */, - 760B5A6C2BDD537F00ADE31A /* Interject! iMessage */, + 761EDD4E3003F175006FC7FB /* Interject! iMessage */, 9879879A2865299F00E82AF6 /* Frameworks */, 98D0A2A627471FF80084F7F9 /* Products */, ); @@ -172,6 +192,7 @@ 98D0A2A527471FF80084F7F9 /* Interject!.app */, 98D0A2B527471FF90084F7F9 /* Interject!Tests.xctest */, 98D0A2BF27471FF90084F7F9 /* Interject!UITests.xctest */, + 761EDD4C3003F175006FC7FB /* Interject! iMessage.appex */, ); name = Products; sourceTree = ""; @@ -188,6 +209,7 @@ 762C51A92BCB4305000689D9 /* Products.plist */, 76CBBDC12BD46EA10019C344 /* PrivacyInfo.xcprivacy */, 765F5A4B30029EC7004C2F29 /* words.json */, + 761EDD463003EB67006FC7FB /* Intents.swift */, ); path = "Interject!"; sourceTree = ""; @@ -247,6 +269,28 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ + 761EDD4B3003F175006FC7FB /* Interject! iMessage */ = { + isa = PBXNativeTarget; + buildConfigurationList = 761EDD5B3003F176006FC7FB /* Build configuration list for PBXNativeTarget "Interject! iMessage" */; + buildPhases = ( + 761EDD483003F175006FC7FB /* Sources */, + 761EDD493003F175006FC7FB /* Frameworks */, + 761EDD4A3003F175006FC7FB /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + fileSystemSynchronizedGroups = ( + 761EDD4E3003F175006FC7FB /* Interject! iMessage */, + ); + name = "Interject! iMessage"; + packageProductDependencies = ( + ); + productName = "Interject! iMessage"; + productReference = 761EDD4C3003F175006FC7FB /* Interject! iMessage.appex */; + productType = "com.apple.product-type.app-extension.messages"; + }; 98D0A2A427471FF80084F7F9 /* Interject! */ = { isa = PBXNativeTarget; buildConfigurationList = 98D0A2C927471FF90084F7F9 /* Build configuration list for PBXNativeTarget "Interject!" */; @@ -259,6 +303,7 @@ buildRules = ( ); dependencies = ( + 761EDD583003F176006FC7FB /* PBXTargetDependency */, ); name = "Interject!"; productName = "Interject!"; @@ -308,9 +353,13 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = 1; - LastSwiftUpdateCheck = 1530; + LastSwiftUpdateCheck = 2650; LastUpgradeCheck = 2650; TargetAttributes = { + 761EDD4B3003F175006FC7FB = { + CreatedOnToolsVersion = 26.5; + LastSwiftMigration = 2650; + }; 98D0A2A427471FF80084F7F9 = { CreatedOnToolsVersion = 13.1; }; @@ -340,11 +389,20 @@ 98D0A2A427471FF80084F7F9 /* Interject! */, 98D0A2B427471FF90084F7F9 /* Interject!Tests */, 98D0A2BE27471FF90084F7F9 /* Interject!UITests */, + 761EDD4B3003F175006FC7FB /* Interject! iMessage */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 761EDD4A3003F175006FC7FB /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 761EDD6E3003F269006FC7FB /* words.json in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 98D0A2A327471FF80084F7F9 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -375,6 +433,14 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 761EDD483003F175006FC7FB /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 761EDD703003F5FF006FC7FB /* Words.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 98D0A2A127471FF80084F7F9 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -391,6 +457,7 @@ 981334CE2754530100E9E53A /* WordView.swift in Sources */, 98EA0F3728636B6400B4E136 /* ToolbarView.swift in Sources */, 98D0A2E1274721620084F7F9 /* Words.swift in Sources */, + 761EDD473003EB67006FC7FB /* Intents.swift in Sources */, 98D0A2E2274721620084F7F9 /* Settings.swift in Sources */, 98D0A2D8274720360084F7F9 /* SentenceView.swift in Sources */, ); @@ -416,6 +483,11 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ + 761EDD583003F176006FC7FB /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 761EDD4B3003F175006FC7FB /* Interject! iMessage */; + targetProxy = 761EDD573003F176006FC7FB /* PBXContainerItemProxy */; + }; 98D0A2B727471FF90084F7F9 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 98D0A2A427471FF80084F7F9 /* Interject! */; @@ -429,6 +501,74 @@ /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ + 761EDD5C3003F176006FC7FB /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = "iMessage App Icon"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "Interject! iMessage/Info.plist"; + INFOPLIST_KEY_CFBundleDisplayName = "Interject! iMessage"; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + IPHONEOS_DEPLOYMENT_TARGET = 26.5; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + ); + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 3.04; + PRODUCT_BUNDLE_IDENTIFIER = "us.hinnen.Interject-.Interject--iMessage"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + STRING_CATALOG_GENERATE_SYMBOLS = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_APPROACHABLE_CONCURRENCY = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 761EDD5D3003F176006FC7FB /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = "iMessage App Icon"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "Interject! iMessage/Info.plist"; + INFOPLIST_KEY_CFBundleDisplayName = "Interject! iMessage"; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + IPHONEOS_DEPLOYMENT_TARGET = 26.5; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + ); + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 3.04; + PRODUCT_BUNDLE_IDENTIFIER = "us.hinnen.Interject-.Interject--iMessage"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + STRING_CATALOG_GENERATE_SYMBOLS = YES; + SWIFT_APPROACHABLE_CONCURRENCY = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; 98D0A2C727471FF90084F7F9 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -708,6 +848,15 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 761EDD5B3003F176006FC7FB /* Build configuration list for PBXNativeTarget "Interject! iMessage" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 761EDD5C3003F176006FC7FB /* Debug */, + 761EDD5D3003F176006FC7FB /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 98D0A2A027471FF80084F7F9 /* Build configuration list for PBXProject "Interject!" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/interject/Interject!.xcodeproj/project.xcworkspace/xcuserdata/roryhinnen.xcuserdatad/UserInterfaceState.xcuserstate b/interject/Interject!.xcodeproj/project.xcworkspace/xcuserdata/roryhinnen.xcuserdatad/UserInterfaceState.xcuserstate index 9eabf51..3882ca6 100644 Binary files a/interject/Interject!.xcodeproj/project.xcworkspace/xcuserdata/roryhinnen.xcuserdatad/UserInterfaceState.xcuserstate and b/interject/Interject!.xcodeproj/project.xcworkspace/xcuserdata/roryhinnen.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/interject/Interject!/Assets.xcassets/AccentColor.colorset/Contents.json b/interject/Interject!/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/interject/Interject!/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/interject/Interject!/Intents.swift b/interject/Interject!/Intents.swift new file mode 100644 index 0000000..9f6c045 --- /dev/null +++ b/interject/Interject!/Intents.swift @@ -0,0 +1,40 @@ +// +// Intents.swift +// Interject! +// + +import AppIntents + +@available(iOS 16.0, *) +struct GenerateInsultIntent: AppIntent { + static var title: LocalizedStringResource = "Generate Insult" + static var description = IntentDescription("Generates a new random insult phrase.") + + func perform() async throws -> some IntentResult & ReturnsValue { + // Fall back to true (safe mode) if the app hasn't set the preference yet + let isSfw = UserDefaults.standard.object(forKey: "SFW") as? Bool ?? true + let sentence = Sentence().new(current: Sentence()) + let insult = [ + sentence.word(.first, safe: isSfw), + sentence.word(.second, safe: isSfw), + sentence.word(.noun, safe: isSfw) + ].joined(separator: " ") + return .result(value: insult) + } +} + +@available(iOS 16.0, *) +struct InterjectShortcuts: AppShortcutsProvider { + static var appShortcuts: [AppShortcut] { + AppShortcut( + intent: GenerateInsultIntent(), + phrases: [ + "Generate an insult with \(.applicationName)", + "Insult me with \(.applicationName)", + "Give me an insult from \(.applicationName)" + ], + shortTitle: "Generate Insult", + systemImageName: "bubble.left.fill" + ) + } +} diff --git a/interject/Interject!/Model/Settings.swift b/interject/Interject!/Model/Settings.swift index e936eb2..f5f2b1a 100644 --- a/interject/Interject!/Model/Settings.swift +++ b/interject/Interject!/Model/Settings.swift @@ -71,6 +71,65 @@ enum Appearance: Int, CaseIterable, Identifiable { } } +class Settings: ObservableObject { + @Published var phrases: [Sentence] + @Published var sfw: Bool + @Published var locked: Locked + @Published var font: Fonts + @Published var colorScheme: Appearance + + init(phrases: [Sentence], sfw: Bool, locked: Locked, font: Fonts, colorScheme: Appearance) { + self.phrases = phrases + self.sfw = sfw + self.locked = locked + self.font = font + self.colorScheme = colorScheme + } + + func add() { + let maxPhrase = 100 + let newPhrase = new(current: self.phrases.first!) + if self.locked.adjective1 { newPhrase.adjective1 = self.phrases.first!.adjective1 } + if self.locked.adjective2 { newPhrase.adjective2 = self.phrases.first!.adjective2 } + if self.locked.noun { newPhrase.noun = self.phrases.first!.noun } + self.phrases.insert(newPhrase, at: 0) + if self.phrases.count > maxPhrase { + self.phrases.remove(at: self.phrases.count-1) + } + save() + } + + func remove() { + if self.phrases.count > 1 { + if self.locked.adjective1 { self.phrases[1].adjective1 = self.phrases[0].adjective1 } + if self.locked.adjective2 { self.phrases[1].adjective2 = self.phrases[0].adjective2 } + if self.locked.noun { self.phrases[1].noun = self.phrases[0].noun } + self.phrases.remove(at: 0) + } + save() + } + + func new(current: Sentence) -> Sentence { + let firstList = Sentence.first + Sentence.adjectives + let adj1List = firstList.filter({$0.word(true) + != current.adjective1.word(true)}).filter({$0.word(true) + != current.adjective2.word(true)}) + let firstAdj = adj1List[Int.random(in: 0...adj1List.count-1)] + + let adj2List = Sentence.adjectives.filter({$0.word(true) + != current.adjective1.word(true)}).filter({$0.word(true) + != current.adjective2.word(true)}).filter({$0.word(true) + != firstAdj.word(true)}) + let adjective2 = adj2List[Int.random(in: 0...adj2List.count-1)] + + let nounList = Sentence.nouns.filter({$0.word(true) + != current.noun.word(true)}) + let noun = nounList[Int.random(in: 0...nounList.count-1)] + + return Sentence(adjective1: firstAdj, adjective2: adjective2, noun: noun) + } +} + extension Settings { convenience init() { diff --git a/interject/Interject!/Model/Words.swift b/interject/Interject!/Model/Words.swift index 71da3ba..93a2329 100644 --- a/interject/Interject!/Model/Words.swift +++ b/interject/Interject!/Model/Words.swift @@ -6,7 +6,7 @@ // Copyright © 2018 Rory Hinnen. All rights reserved. // import Foundation -import SwiftUI +import Combine // MARK: enum enum Place { @@ -52,99 +52,6 @@ struct Locked { } } -/* func newSentence(current: Sentence) -> Sentence { - // find adjective one, which could be from the pool of first words or adjectives. - // remove the current words from the list of possible words - // pick from the list for just one word. - let firstList = Sentence.first + Sentence.adjectives - let adj1List = firstList.filter({$0.word(true) != current.adjective1.word(true)}).filter({$0.word(true) != current.adjective2.word(true)}) - let firstAdj = adj1List[Int.random(in: 0...adj1List.count-1)] - - // find adjective two, only from the pool of adjectives - // remove current words and adjective one from the pool - // pick from the list for just one word - let adj2List = Sentence.adjectives.filter({$0.word(true) != current.adjective1.word(true)}).filter({$0.word(true) != current.adjective2.word(true)}).filter({$0.word(true) != firstAdj.word(true)}) - let adjective2 = adj2List[Int.random(in: 0...adj2List.count-1)] - - // find the noun, only from the pool of nouns - // remove the current word from the pool - // select the new noun. - let nounList = Sentence.nouns.filter({$0.word(true) != current.noun.word(true)}) - let noun = nounList[Int.random(in: 0...nounList.count-1)] - - // make a new sentence - return(Sentence(adjective1: firstAdj, adjective2: adjective2, noun: noun)) -} */ - -class Settings: ObservableObject { - @Published var phrases: [Sentence] - @Published var sfw: Bool - @Published var locked: Locked - @Published var font: Fonts - @Published var colorScheme: Appearance - - init(phrases: [Sentence], sfw: Bool, locked: Locked, font: Fonts, colorScheme: Appearance) { - self.phrases = phrases - self.sfw = sfw - self.locked = locked - self.font = font - self.colorScheme = colorScheme - } - - func add() { - let maxPhrase = 100 - let newPhrase = new(current: self.phrases.first!) - if self.locked.adjective1 { newPhrase.adjective1 = self.phrases.first!.adjective1 } - if self.locked.adjective2 { newPhrase.adjective2 = self.phrases.first!.adjective2} - if self.locked.noun { newPhrase.noun = self.phrases.first!.noun } - self.phrases.insert(newPhrase, at: 0) - if self.phrases.count > maxPhrase { - self.phrases.remove(at: self.phrases.count-1) - } - save() - } - - func remove() { - if self.phrases.count > 1 { - if self.locked.adjective1 {self.phrases[1].adjective1 = self.phrases[0].adjective1} - if self.locked.adjective2 {self.phrases[1].adjective2 = self.phrases[0].adjective2} - if self.locked.noun {self.phrases[1].noun = self.phrases[0].noun} - self.phrases.remove(at: 0) - } - save() - } - - func new(current: Sentence) -> Sentence { - // find adjective one, which could be from the pool of first words or adjectives. - // remove the current words from the list of possible words - // pick from the list for just one word. - let firstList = Sentence.first + Sentence.adjectives - let adj1List = firstList.filter({$0.word(true) - != current.adjective1.word(true)}).filter({$0.word(true) - != current.adjective2.word(true)}) - let firstAdj = adj1List[Int.random(in: 0...adj1List.count-1)] - - // find adjective two, only from the pool of adjectives - // remove current words and adjective one from the pool - // pick from the list for just one word - let adj2List = Sentence.adjectives.filter({$0.word(true) - != current.adjective1.word(true)}).filter({$0.word(true) - != current.adjective2.word(true)}).filter({$0.word(true) - != firstAdj.word(true)}) - let adjective2 = adj2List[Int.random(in: 0...adj2List.count-1)] - - // find the noun, only from the pool of nouns - // remove the current word from the pool - // select the new noun. - let nounList = Sentence.nouns.filter({$0.word(true) - != current.noun.word(true)}) - let noun = nounList[Int.random(in: 0...nounList.count-1)] - - // make a new sentence - return(Sentence(adjective1: firstAdj, adjective2: adjective2, noun: noun)) - } -} - // MARK: Entry struct Entry: Codable { // The structure of the words themself. @@ -187,9 +94,9 @@ class Sentence: NSObject, Codable { // (like when I'm handing off to meaning) // There are two initializers. - fileprivate var adjective1: Entry - fileprivate var adjective2: Entry - fileprivate var noun: Entry + var adjective1: Entry + var adjective2: Entry + var noun: Entry // This initializer will take three Entry vars and assign them into a sentence init(adjective1: Entry, adjective2: Entry, noun: Entry) { @@ -267,7 +174,7 @@ private struct WordList: Codable { extension Sentence { // MARK: Create the pool of words private static let wordList: WordList = { - guard let url = Bundle.main.url(forResource: "words", withExtension: "json"), + guard let url = Bundle(for: Sentence.self).url(forResource: "words", withExtension: "json"), let data = try? Data(contentsOf: url), let list = try? JSONDecoder().decode(WordList.self, from: data) else { fatalError("words.json missing or malformed in bundle")