diff --git a/.circleci/config.yml b/.circleci/config.yml index f381592c1..c4fab230c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,6 +11,9 @@ jobs: xcode-version: "10.2.0" steps: - checkout + - run: + name: Copy demo SPCredentials + command: cp Simplenote/SPCredentials-demo.swift Simplenote/Credentials/SPCredentials.swift - ios/test: xcode-version: "10.2.0" workspace: Simplenote.xcworkspace diff --git a/README.md b/README.md index b8c168305..7b4ffe8e9 100644 --- a/README.md +++ b/README.md @@ -60,10 +60,10 @@ Simplenote is powered by the [Simperium Sync'ing protocol](https://www.simperium After you've created your own Simperium application, copy the sample config. For example: ``` -cp Simplenote/simplenote_app_credentials_demo.json ~/.mobile-secrets/iOS/simplenote/simplenote_app_credentials.json +cp Simplenote/SPCredentials-demo.swift Simplenote/Credentials/SPCredentials.swift ``` -Then edit the new `simplenote_app_credentials.json` file and change the `simperium_app_id` and `simperium_api_key` fields to the correct values for your new app. +Then edit the new `SPCredentials.swift` file and change the `simperium_app_id` and `simperium_api_key` fields to the correct values for your new app. This will allow you to compile and run the app on a device or a simulator. diff --git a/Scripts/build-phases/generate_credentials.sh b/Scripts/build-phases/generate_credentials.sh deleted file mode 100755 index 0aefd6883..000000000 --- a/Scripts/build-phases/generate_credentials.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env bash - -DERIVED_PATH=${SOURCE_ROOT}/Simplenote/DerivedSources -SCRIPT_PATH=${SOURCE_ROOT}/Scripts/build-phases/replace_secrets.rb - -CREDS_INPUT_PATH=${SOURCE_ROOT}/Simplenote/Credentials/SPCredentials.tpl -CREDS_OUTPUT_PATH=${DERIVED_PATH}/SPCredentials.swift - -CREDS_TEMPLATE_PATH=${SOURCE_ROOT}/Simplenote/Credentials/SPCredentials.tpl - -## Validate Secrets! -## -if [ ! -f $SECRETS_PATH ]; then - - echo ">> Using Templated Secrets" - - ## Generate the Derived Folder. If needed - ## - mkdir -p ${DERIVED_PATH} - - ## Create a credentials file from the template (if needed) - ## then copy it into place for the build. - ## - if [ ! -f $CREDS_OUTPUT_PATH ]; then - echo ">> Creating Credentials File from Template: ${CREDS_FILE_PATH}" - cp ${CREDS_TEMPLATE_PATH} ${CREDS_OUTPUT_PATH} - fi - -else - - echo ">> Loading Secrets ${SECRETS_PATH}" - - ## Generate the Derived Folder. If needed - ## - mkdir -p ${DERIVED_PATH} - - ## Generate ApiCredentials.swift - ## - echo ">> Generating Credentials ${CREDS_OUTPUT_PATH}" - ruby ${SCRIPT_PATH} -i ${CREDS_INPUT_PATH} -s ${SECRETS_PATH} > ${CREDS_OUTPUT_PATH} - -fi diff --git a/Scripts/build-phases/replace_secrets.rb b/Scripts/build-phases/replace_secrets.rb deleted file mode 100755 index 9a5e92843..000000000 --- a/Scripts/build-phases/replace_secrets.rb +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env ruby -## -## This Script loads a collection of (JSON Encoded) secrets, and performs replacement operations -## over a given Template. -## -## Note that in order for the Replacement OP's to work, your placeholders should look like this: -## -## %{SIMPLENOTE_CREDENTIALS} -## -require 'json' -require 'optparse' - - -## Parse Input Parameters -## -options = {} - -optparse = OptionParser.new do |opts| - opts.on('-s', '--secrets file', 'Secrets filename (must be in JSON format!)') do |secrets| - options[:secrets] = secrets - end - - opts.on('-i', '--input file', 'Input filename') do |input| - options[:input] = input - end -end - -optparse.parse! - - -## Validate Parameters -## -for parameter in [:secrets, :input] - filename = options[parameter] - - if filename.nil? == true || File.exists?(filename) == false then - puts optparse - exit - end -end - - -## Loads the Secrets at the specified Path. This must be a JSON Valid file! -## -def load(secrets_path) - raw_secrets = File.read(secrets_path) - output = JSON.parse(raw_secrets, :symbolize_names => true) - output[:timestamp] = Time.now.strftime("%b %d, %Y at %H:%M:%S") - - return output -end - - -## Loads the Template at the specified path, and applies Placeholder Replacement OP's, with the secrets -## located at a given path. -## -def process(template_path, secrets_path) - secrets = load(secrets_path) - template = File.open(template_path, "r") - - template.each_line { |line| - puts line % secrets - } - - template.close -end - - -## Main! -## -process(options[:input], options[:secrets]) diff --git a/Simplenote.xcodeproj/project.pbxproj b/Simplenote.xcodeproj/project.pbxproj index fdb55b059..28ea98aef 100644 --- a/Simplenote.xcodeproj/project.pbxproj +++ b/Simplenote.xcodeproj/project.pbxproj @@ -215,11 +215,6 @@ B5BFAEBB21519DCA00918DC8 /* SPPrivacyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5BFAEBA21519DCA00918DC8 /* SPPrivacyViewController.swift */; }; B5C57A3E22E77ABD009166EA /* UIColor+Simplenote.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C57A3C22E77ABD009166EA /* UIColor+Simplenote.swift */; }; B5C57A4122E78F4D009166EA /* UIColorName.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C57A4022E78F4D009166EA /* UIColorName.swift */; }; - B5C7BFA8230C7190000DEC91 /* SPCredentials.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C7BFA1230C5D96000DEC91 /* SPCredentials.swift */; }; - B5C7BFA9230C7190000DEC91 /* SPCredentials.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C7BFA1230C5D96000DEC91 /* SPCredentials.swift */; }; - B5C7BFAA230C7637000DEC91 /* SPLegacyCredentials.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE83424D1D5AA83B0000811F /* SPLegacyCredentials.swift */; }; - B5C7BFAB230C7637000DEC91 /* SPLegacyCredentials.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE83424D1D5AA83B0000811F /* SPLegacyCredentials.swift */; }; - B5C7BFAE230C76DF000DEC91 /* SPCredentialsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C7BFAD230C76DF000DEC91 /* SPCredentialsTests.swift */; }; B5C9F71E193E75FE00FD2491 /* SPDebugViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B5C9F71C193E75FE00FD2491 /* SPDebugViewController.m */; }; B5CBEF4022D3AD92009DBE67 /* MigrationsHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5CBEF3F22D3AD92009DBE67 /* MigrationsHandler.swift */; }; B5CBEF4222D3B419009DBE67 /* Bundle+Simplenote.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5CBEF4122D3B419009DBE67 /* Bundle+Simplenote.swift */; }; @@ -235,6 +230,8 @@ B5DF734422A56E2800602CE7 /* UserDefaults+Simplenote.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5DF734322A56E2800602CE7 /* UserDefaults+Simplenote.swift */; }; B5DF734622A5713600602CE7 /* SortMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5DF734522A5713600602CE7 /* SortMode.swift */; }; B5DF734F22A599D100602CE7 /* SPNotifications.m in Sources */ = {isa = PBXBuildFile; fileRef = B5DF734E22A599D100602CE7 /* SPNotifications.m */; }; + B5E196BB230F522D00F5658A /* SPCredentials.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E196BA230F522D00F5658A /* SPCredentials.swift */; }; + B5E196BC230F522D00F5658A /* SPCredentials.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E196BA230F522D00F5658A /* SPCredentials.swift */; }; B5E96B611BDE5ACA00D707F5 /* SPMarkdownParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 174838281BBDCAA400E834AF /* SPMarkdownParser.m */; }; B5EB1EEF1C204EBD0080A1B3 /* ShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5EB1EEE1C204EBD0080A1B3 /* ShareViewController.swift */; }; B5EB1EF21C204EBD0080A1B3 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B5EB1EF01C204EBD0080A1B3 /* MainInterface.storyboard */; }; @@ -496,9 +493,6 @@ B5BFAEBA21519DCA00918DC8 /* SPPrivacyViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPPrivacyViewController.swift; sourceTree = ""; }; B5C57A3C22E77ABD009166EA /* UIColor+Simplenote.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+Simplenote.swift"; sourceTree = ""; }; B5C57A4022E78F4D009166EA /* UIColorName.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = UIColorName.swift; path = Classes/UIColorName.swift; sourceTree = ""; }; - B5C7BFA1230C5D96000DEC91 /* SPCredentials.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPCredentials.swift; sourceTree = ""; }; - B5C7BFA4230C5E2F000DEC91 /* SPCredentials.tpl */ = {isa = PBXFileReference; explicitFileType = sourcecode.swift; path = SPCredentials.tpl; sourceTree = ""; }; - B5C7BFAD230C76DF000DEC91 /* SPCredentialsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPCredentialsTests.swift; sourceTree = ""; }; B5C9F71B193E75FE00FD2491 /* SPDebugViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SPDebugViewController.h; path = Classes/SPDebugViewController.h; sourceTree = ""; }; B5C9F71C193E75FE00FD2491 /* SPDebugViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SPDebugViewController.m; path = Classes/SPDebugViewController.m; sourceTree = ""; }; B5CA3E0D22B1503700AC0D47 /* RELEASE-NOTES.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "RELEASE-NOTES.txt"; sourceTree = ""; }; @@ -524,6 +518,7 @@ B5DF734522A5713600602CE7 /* SortMode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SortMode.swift; path = Classes/SortMode.swift; sourceTree = ""; }; B5DF734D22A599D100602CE7 /* SPNotifications.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SPNotifications.h; path = Classes/SPNotifications.h; sourceTree = ""; }; B5DF734E22A599D100602CE7 /* SPNotifications.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SPNotifications.m; path = Classes/SPNotifications.m; sourceTree = ""; }; + B5E196BA230F522D00F5658A /* SPCredentials.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPCredentials.swift; sourceTree = ""; }; B5EB1EEC1C204EBD0080A1B3 /* SimplenoteShare.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = SimplenoteShare.appex; sourceTree = BUILT_PRODUCTS_DIR; }; B5EB1EEE1C204EBD0080A1B3 /* ShareViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareViewController.swift; sourceTree = ""; }; B5EB1EF11C204EBD0080A1B3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = ""; }; @@ -531,7 +526,6 @@ B5EB1EFD1C205A800080A1B3 /* Icons.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Icons.xcassets; path = ../Icons.xcassets; sourceTree = ""; }; B5F52F0522CCEEF100B376F9 /* UIColor+Simplenote.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "UIColor+Simplenote.swift"; path = "Classes/UIColor+Simplenote.swift"; sourceTree = ""; }; BE7F27BB1D5A47DE00A1A0A9 /* config.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = config.plist; sourceTree = ""; }; - BE83424D1D5AA83B0000811F /* SPLegacyCredentials.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SPLegacyCredentials.swift; path = ../SPLegacyCredentials.swift; sourceTree = ""; }; DE7E545A214E34C8008D9928 /* NSString+Count.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "NSString+Count.swift"; path = "Classes/NSString+Count.swift"; sourceTree = ""; }; DF3BADF5A954AA00BCF9B169 /* Pods-Automattic-Simplenote.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Automattic-Simplenote.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Automattic-Simplenote/Pods-Automattic-Simplenote.debug.xcconfig"; sourceTree = ""; }; E201864617A4892300217E0B /* SPActionButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SPActionButton.h; path = Classes/SPActionButton.h; sourceTree = ""; }; @@ -1041,7 +1035,6 @@ B58218981FCC45170094ECA1 /* SimplenoteTests */ = { isa = PBXGroup; children = ( - B5C7BFAC230C76CC000DEC91 /* Credentials */, B52F35D422F3573300724793 /* Extensions */, B5B9AB4122EA6FE1001CB0AD /* Themes */, B55AC57822D27B7F00D8CEB2 /* Settings */, @@ -1111,28 +1104,11 @@ B5C7BF92230C592B000DEC91 /* Credentials */ = { isa = PBXGroup; children = ( - B5C7BFA4230C5E2F000DEC91 /* SPCredentials.tpl */, + B5E196BA230F522D00F5658A /* SPCredentials.swift */, ); path = Credentials; sourceTree = ""; }; - B5C7BF94230C5950000DEC91 /* DerivedSources */ = { - isa = PBXGroup; - children = ( - B5C7BFA1230C5D96000DEC91 /* SPCredentials.swift */, - BE83424D1D5AA83B0000811F /* SPLegacyCredentials.swift */, - ); - path = DerivedSources; - sourceTree = ""; - }; - B5C7BFAC230C76CC000DEC91 /* Credentials */ = { - isa = PBXGroup; - children = ( - B5C7BFAD230C76DF000DEC91 /* SPCredentialsTests.swift */, - ); - name = Credentials; - sourceTree = ""; - }; B5CFFFDF22AA9AD100B968CD /* Tools */ = { isa = PBXGroup; children = ( @@ -1324,7 +1300,6 @@ children = ( 467D9C7A1788D10400785EF3 /* Categories */, B5C7BF92230C592B000DEC91 /* Credentials */, - B5C7BF94230C5950000DEC91 /* DerivedSources */, B569DBFE1C03411500EC1FE8 /* Extensions */, B52BB74C22CFD14C0042C162 /* Exporter */, 467D9C601788A53700785EF3 /* Models */, @@ -1797,18 +1772,16 @@ inputFileListPaths = ( ); inputPaths = ( - "$(SRCROOT)/Simplenote/Credentials/replace_secrets.rb", - "$(SRCROOT)/Simplenote/Credentials/SPCredentials.tpl", - "~/.mobile-secrets/iOS/simplenote/simplenote_app_credentials.json", + "~/.mobile-secrets/iOS/simplenote/SPCredentials.swift", ); outputFileListPaths = ( ); outputPaths = ( - "$(SRCROOT)/Simplenote/DerivedSources/SPCredentials.swift", + "$(SRCROOT)/Simplenote/Credentials/SPCredentials.swift", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "$SRCROOT/Scripts/build-phases/generate_credentials.sh\n"; + shellScript = "echo \"Copying Credentials...\"\n\ncp ~/.mobile-secrets/iOS/simplenote/SPCredentials.swift ${SRCROOT}/Simplenote/Credentials/SPCredentials.swift\n"; }; C62AC7EF4EA894D0C1FAFFC0 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; @@ -1905,7 +1878,7 @@ 46A3C97F17DFA81A002865AE /* SPSideBySideView.m in Sources */, B5B8AE7F1AB9F8BD0082775D /* UIDevice+Extensions.m in Sources */, 46A3C98017DFA81A002865AE /* UIImage+Colorization.m in Sources */, - B5C7BFA8230C7190000DEC91 /* SPCredentials.swift in Sources */, + B5E196BB230F522D00F5658A /* SPCredentials.swift in Sources */, 375D24BC21E01131007AB25A /* html_smartypants.c in Sources */, 46A3C98117DFA81A002865AE /* VSTheme.m in Sources */, 74F454ED22DD4BC0000C66DB /* KeyboardObservable.swift in Sources */, @@ -1960,7 +1933,6 @@ B5DF734622A5713600602CE7 /* SortMode.swift in Sources */, 46A3C99D17DFA81A002865AE /* SPAddCollaboratorsViewController.m in Sources */, 46A3C99E17DFA81A002865AE /* SPTableViewCell.m in Sources */, - B5C7BFAB230C7637000DEC91 /* SPLegacyCredentials.swift in Sources */, 46A3C99F17DFA81A002865AE /* VSThemeManager.m in Sources */, B52646AA22D3E04C00EBF299 /* UIViewController+Simplenote.swift in Sources */, B55E428C22A1A4550018C0CE /* SPSortOrderViewController.swift in Sources */, @@ -2008,7 +1980,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - B5C7BFAE230C76DF000DEC91 /* SPCredentialsTests.swift in Sources */, B52F35D322F356F500724793 /* UserDefaults+Tests.swift in Sources */, B58218A51FCC45330094ECA1 /* KeychainMigratorTests.swift in Sources */, 374F5EF521BF057E00B57E8B /* SPChecklistTest.swift in Sources */, @@ -2031,14 +2002,13 @@ B5CFFFE922AA9DD700B968CD /* Note.swift in Sources */, B56AA00622B03CBB003F85CB /* Extractors.swift in Sources */, B5CFFFE222AA9AD100B968CD /* TextBundleWrapper.m in Sources */, - B5C7BFAA230C7637000DEC91 /* SPLegacyCredentials.swift in Sources */, B5CFFFE722AA9DB100B968CD /* Uploader.swift in Sources */, 74388F4722CFFAB6001C5EC0 /* UIViewController+Helpers.swift in Sources */, B5AA4B5222F46A0F0072BF5D /* UIColorName.swift in Sources */, 74F6637D22BADB2100FA147E /* ExtensionTransitioningManager.swift in Sources */, 74F454EE22DD4BC0000C66DB /* KeyboardObservable.swift in Sources */, 74F6638122BADBD200FA147E /* ExtensionPresentationAnimator.swift in Sources */, - B5C7BFA9230C7190000DEC91 /* SPCredentials.swift in Sources */, + B5E196BC230F522D00F5658A /* SPCredentials.swift in Sources */, B56A9FFE22AEDCB0003F85CB /* URLExtractor.swift in Sources */, B5C57A3E22E77ABD009166EA /* UIColor+Simplenote.swift in Sources */, 74F6638322BADD0300FA147E /* SharePresentationController.swift in Sources */, diff --git a/Simplenote/Credentials/SPCredentials.tpl b/Simplenote/Credentials/SPCredentials.tpl deleted file mode 100644 index 63c45a867..000000000 --- a/Simplenote/Credentials/SPCredentials.tpl +++ /dev/null @@ -1,53 +0,0 @@ -/// Simplenote API Credentials. Generated on %{timestamp} -/// -@objcMembers -class SPCredentials: NSObject { - - /// AppBot - /// - static let appbotKey = "%{appbot_key}" - - /// BitHockey - /// - static let bitHockeyIdentifier = "%{bithockey_id}" - - /// Google Analytics - /// - static let googleAnalyticsID = "%{google_analytics_id}" - - /// iTunes: AppID - /// - static let iTunesAppID = "%{itunes_app_id}" - - /// iTunes: Review URL - /// - static let iTunesReviewURL = URL(string: "%{itunes_review_url}")! - - /// Sentry DSN - /// - static let sentryDSN = "%{sentry_dsn}" - - /// Simperium: AppID - /// - static let simperiumAppID = "%{simperium_app_id}" - - /// Simperium: API Key - /// - static let simperiumApiKey = "%{simperium_api_key}" - - /// Simperium: Preferences Object Key - /// - static let simperiumPreferencesObjectKey = "%{simperium_preferences_key}" - - /// Simperium: Settings Object Key - /// - static let simperiumSettingsObjectKey = "%{simperium_settings_key}" - - /// WordPressSSO: Client ID - /// - static let wpcomClientID = "%{wordpress_client_id}" - - /// WordPressSSO: Redirect URL - /// - static let wpcomRedirectURL = "%{wordpress_redirect_url}" -} diff --git a/Simplenote/SPCredentials-demo.swift b/Simplenote/SPCredentials-demo.swift new file mode 100644 index 000000000..f191c2f3c --- /dev/null +++ b/Simplenote/SPCredentials-demo.swift @@ -0,0 +1,53 @@ +/// Simplenote API Credentials +/// +@objcMembers +class SPCredentials: NSObject { + + /// AppBot + /// + static let appbotKey = "not-required" + + /// BitHockey + /// + static let bitHockeyIdentifier = "not-required" + + /// Google Analytics + /// + static let googleAnalyticsID = "not-required" + + /// iTunes: AppID + /// + static let iTunesAppID = "not-required" + + /// iTunes: Review URL + /// + static let iTunesReviewURL = URL(string: "http://not.required")! + + /// Sentry DSN + /// + static let sentryDSN = "" + + /// Simperium: AppID + /// + static let simperiumAppID = "history-analyst-dad" + + /// Simperium: API Key + /// + static let simperiumApiKey = "6805ca9a091e45ada8a9d8988367f14e" + + /// Simperium: Preferences Object Key + /// + static let simperiumPreferencesObjectKey = "not-required" + + /// Simperium: Settings Object Key + /// + static let simperiumSettingsObjectKey = "not-required" + + /// WordPressSSO: Client ID + /// + static let wpcomClientID = "not-required" + + /// WordPressSSO: Redirect URL + /// + static let wpcomRedirectURL = "not-required" +} diff --git a/Simplenote/SPLegacyCredentials.swift b/Simplenote/SPLegacyCredentials.swift deleted file mode 100644 index de5e6d905..000000000 --- a/Simplenote/SPLegacyCredentials.swift +++ /dev/null @@ -1,131 +0,0 @@ -// -// SPCredentials.swift -// Simplenote -// -// Created by Will Kwon on 8/9/16. -// Copyright © 2016 Automattic. All rights reserved. -// - -import UIKit - - -// TODO: We're keeping this class around until `SPCredentialsTests` is verified to be evergreen. Nuke this class along with -// the unit test ASAP. -// -class SPLegacyCredentials: NSObject { - - static let configName = "config" - static let plistType = "plist" - - @objc static func simperiumAppID() -> String { - if let value = configDictionary().value(forKey: "SPSimperiumAppID") { - return value as! String - } else { - return "" - } - } - - @objc static func simperiumApiKey() -> String { - if let value = configDictionary().value(forKey: "SPSimperiumApiKey") { - return value as! String - } else { - return "" - } - } - - @objc static func simperiumSettingsObjectKey() -> String { - if let value = configDictionary().value(forKey: "SPSimperiumSettingsObjectKey") { - return value as! String - } else { - return "" - } - } - - @objc static func simperiumPreferencesObjectKey() -> String { - let output = configDictionary().value(forKey: "SPSimperiumPreferencesObjectKey") as? String - return output ?? String() - } - - @objc static func simplenoteSentryDSN() -> String { - if let value = configDictionary().value(forKey: "SimplenoteSentryDSN") { - return value as! String - } else { - return "" - } - } - - @objc static func bitHockeyIdentifier() -> String { - if let value = configDictionary().value(forKey: "BitHockeyIdentifier") { - return value as! String - } else { - return "" - } - } - - @objc static func googleAnalyticsID() -> String { - if let value = configDictionary().value(forKey: "GoogleAnalyticsID") { - return value as! String - } else { - return "" - } - } - - @objc static func appbotKey() -> String { - if let value = configDictionary().value(forKey: "AppbotKey") { - return value as! String - } else { - return "" - } - } - - - @objc static func iTunesAppId() -> String { - if let value = configDictionary().value(forKey: "SimplenoteiTunesAppId") { - return value as! String - } else { - return "" - } - } - - @objc static func iTunesReviewURL() -> URL? { - guard let value = configDictionary().value(forKey: "SimplenoteiTunesReviewURL") as? String, - let targetURL = URL(string: value) - else { - return nil - } - - return targetURL - } - - @objc static func WPCCClientID() -> String { - if let value = configDictionary().value(forKey: "WPCCClientID") { - return (value as! String) - } else { - return "" - } - } - -// @objc static func WPCCClientSecret() -> String { -// if let value = configDictionary().value(forKey: "WPCCClientSecret") { -// return (value as! String) -// } else { -// return "" -// } -// } - - @objc static func WPCCRedirectURL() -> String { - if let value = configDictionary().value(forKey: "WPCCRedirectURL") { - return (value as! String) - } else { - return "" - } - } - - fileprivate static func configDictionary() -> NSDictionary { - guard let plistPath = Bundle.main.path(forResource: configName, ofType: plistType) else { - return NSDictionary() - } - - return NSDictionary(contentsOfFile: plistPath)! - } -} diff --git a/Simplenote/simplenote_app_credentials_demo.json b/Simplenote/simplenote_app_credentials_demo.json deleted file mode 100644 index eb2f42ac8..000000000 --- a/Simplenote/simplenote_app_credentials_demo.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "appbot_key": "not-required", - "bithockey_id": "not-required", - "google_analytics_id": "not-required", - "itunes_app_id": "not-required", - "itunes_review_url": "not-required", - "sentry_dsn": "not-required", - "simperium_app_id": "history-analyst-dad", - "simperium_api_key": "6805ca9a091e45ada8a9d8988367f14e", - "simperium_preferences_key": "not-required", - "simperium_settings_key": "not-required", - "wordpress_client_id": "not-required", - "wordpress_redirect_url": "not-required" -} diff --git a/SimplenoteTests/SPCredentialsTests.swift b/SimplenoteTests/SPCredentialsTests.swift deleted file mode 100644 index 0f84c0c6a..000000000 --- a/SimplenoteTests/SPCredentialsTests.swift +++ /dev/null @@ -1,25 +0,0 @@ -import XCTest -@testable import Simplenote - - -// MARK: - SPCredentials Unit Tests -// -class SPCredentialsTests: XCTestCase { - - /// Verifies that the new Credentials mechanism match the legacy values - /// - func testCredentialsMatchTheirLegacyCredentialsCounterpart() { - XCTAssertEqual(SPCredentials.appbotKey, SPLegacyCredentials.appbotKey()) - XCTAssertEqual(SPCredentials.bitHockeyIdentifier, SPLegacyCredentials.bitHockeyIdentifier()) - XCTAssertEqual(SPCredentials.googleAnalyticsID, SPLegacyCredentials.googleAnalyticsID()) - XCTAssertEqual(SPCredentials.iTunesAppID, SPLegacyCredentials.iTunesAppId()) - XCTAssertEqual(SPCredentials.iTunesReviewURL, SPLegacyCredentials.iTunesReviewURL()) - XCTAssertEqual(SPCredentials.sentryDSN, SPLegacyCredentials.simplenoteSentryDSN()) - XCTAssertEqual(SPCredentials.simperiumAppID, SPLegacyCredentials.simperiumAppID()) - XCTAssertEqual(SPCredentials.simperiumApiKey, SPLegacyCredentials.simperiumApiKey()) - XCTAssertEqual(SPCredentials.simperiumPreferencesObjectKey, SPLegacyCredentials.simperiumPreferencesObjectKey()) - XCTAssertEqual(SPCredentials.simperiumSettingsObjectKey, SPLegacyCredentials.simperiumSettingsObjectKey()) - XCTAssertEqual(SPCredentials.wpcomClientID, SPLegacyCredentials.WPCCClientID()) - XCTAssertEqual(SPCredentials.wpcomRedirectURL, SPLegacyCredentials.WPCCRedirectURL()) - } -}