From 9bc4d1317c81b18a916dcef289bbf82b1d7796e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adria=CC=81n=20Moreno=20Pen=CC=83a?= Date: Sun, 8 Nov 2015 19:30:36 +0100 Subject: [PATCH 1/5] Added automatic versioning script. --- .../Kodi Remote.xcodeproj/project.pbxproj | 24 ++++- Kodi Remote/automatic_versioning.sh | 97 +++++++++++++++++++ 2 files changed, 119 insertions(+), 2 deletions(-) create mode 100755 Kodi Remote/automatic_versioning.sh diff --git a/Kodi Remote/Kodi Remote.xcodeproj/project.pbxproj b/Kodi Remote/Kodi Remote.xcodeproj/project.pbxproj index fefbde6..76da3b8 100644 --- a/Kodi Remote/Kodi Remote.xcodeproj/project.pbxproj +++ b/Kodi Remote/Kodi Remote.xcodeproj/project.pbxproj @@ -43,6 +43,7 @@ 0AA7A1E01B8E78490014FCF4 /* TransparentButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AA7A1DF1B8E78490014FCF4 /* TransparentButton.swift */; }; 0AA7A1E31B8E7C9A0014FCF4 /* secondary_action.png in Resources */ = {isa = PBXBuildFile; fileRef = 0AA7A1E11B8E7C9A0014FCF4 /* secondary_action.png */; }; 0AA7A1E41B8E7C9A0014FCF4 /* secondary_action@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 0AA7A1E21B8E7C9A0014FCF4 /* secondary_action@2x.png */; }; + 0AF2EE5A1BEFCA3000395313 /* automatic_versioning.sh in Resources */ = {isa = PBXBuildFile; fileRef = 0AF2EE591BEFCA3000395313 /* automatic_versioning.sh */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -100,6 +101,7 @@ 0AA7A1DF1B8E78490014FCF4 /* TransparentButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransparentButton.swift; sourceTree = ""; }; 0AA7A1E11B8E7C9A0014FCF4 /* secondary_action.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = secondary_action.png; sourceTree = ""; }; 0AA7A1E21B8E7C9A0014FCF4 /* secondary_action@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "secondary_action@2x.png"; sourceTree = ""; }; + 0AF2EE591BEFCA3000395313 /* automatic_versioning.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = automatic_versioning.sh; sourceTree = ""; }; 14042A5C9B757E5A202DEC29 /* Pods-Kodi Remote.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Kodi Remote.release.xcconfig"; path = "Pods/Target Support Files/Pods-Kodi Remote/Pods-Kodi Remote.release.xcconfig"; sourceTree = ""; }; 20E51806F2D31FE52785684C /* Pods-Kodi Remote.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Kodi Remote.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Kodi Remote/Pods-Kodi Remote.debug.xcconfig"; sourceTree = ""; }; 52B2AE5329A537DA9172082B /* Pods_Kodi_Remote.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Kodi_Remote.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -171,6 +173,7 @@ 0A3F9EEA1AC0C2BC008C6A4E = { isa = PBXGroup; children = ( + 0AF2EE591BEFCA3000395313 /* automatic_versioning.sh */, 0A3F9EF51AC0C2BC008C6A4E /* Kodi Remote */, 0A3F9F0B1AC0C2BC008C6A4E /* Kodi RemoteTests */, 0A3F9EF41AC0C2BC008C6A4E /* Products */, @@ -321,7 +324,8 @@ F2C8BBF503771874FFF16E09 /* Embed Pods Frameworks */, F2B7443FE76BCECC014B3414 /* Copy Pods Resources */, 0A71771E1B55B149000CA6E0 /* Embed Frameworks */, - 0AC0E3181B62D4EB003D940C /* ShellScript */, + 0AC0E3181B62D4EB003D940C /* Run script: Fabric */, + 0AF2EE581BEFC9D600395313 /* Run Script: Automatic Versioning */, ); buildRules = ( ); @@ -377,6 +381,7 @@ 0AA7A1D41B8E749E0014FCF4 /* bottom@2x.png in Resources */, 0A3F9F001AC0C2BC008C6A4E /* Images.xcassets in Resources */, 0AA7A1D21B8E749E0014FCF4 /* back@2x.png in Resources */, + 0AF2EE5A1BEFCA3000395313 /* automatic_versioning.sh in Resources */, 0AA7A1DE1B8E749E0014FCF4 /* top@2x.png in Resources */, 0AA7A1DB1B8E749E0014FCF4 /* right.png in Resources */, 0AA7A1D61B8E749E0014FCF4 /* left@2x.png in Resources */, @@ -395,19 +400,34 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 0AC0E3181B62D4EB003D940C /* ShellScript */ = { + 0AC0E3181B62D4EB003D940C /* Run script: Fabric */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); + name = "Run script: Fabric"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "./Fabric.framework/run 887247ff2f9ad003c64692515d957f39c279b45f 7e55f8835ec9d902cac6fb40edde02b6b3912de2e4f9793f4c932d9a210c9a4b"; }; + 0AF2EE581BEFC9D600395313 /* Run Script: Automatic Versioning */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script: Automatic Versioning"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = ./automatic_versioning.sh; + }; D2C7D2BD8DD1684C4401C13D /* Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/Kodi Remote/automatic_versioning.sh b/Kodi Remote/automatic_versioning.sh new file mode 100755 index 0000000..d844b3a --- /dev/null +++ b/Kodi Remote/automatic_versioning.sh @@ -0,0 +1,97 @@ +#!/bin/bash + +# This script automatically sets the version and short version string of +# an Xcode project from the Git repository containing the project. +# +# To use this script in Xcode, add the script's path to a "Run Script" build +# phase for your application target. + +# +# Check if a variable is set +# param1 name of the variable +# +function is_set() +{ + [[ -n "${1}" ]] && test -n "$(eval "echo "\${${1}+x}"")" +} + +set -o errexit +set -o nounset + +# First, check for git in $PATH +hash git 2>/dev/null || { echo >&2 "Git required, not installed. Aborting build number update script."; exit 0; } + +# Alternatively, we could use Xcode's copy of the Git binary, +# but old Xcodes don't have this. +#GIT=$(xcrun -find git) + +# Run Script build phases that operate on product files of the target that defines them should use the value of this build setting [TARGET_BUILD_DIR]. But Run Script build phases that operate on product files of other targets should use “BUILT_PRODUCTS_DIR” instead. +INFO_PLIST="${TARGET_BUILD_DIR}/${INFOPLIST_PATH}" + +# Build version (closest-tag-or-branch "-" commits-since-tag "-" short-hash dirty-flag) +BUILD_VERSION=$(git describe --tags --always --dirty=+) + +# Use the latest tag for short version (expected tag format "vn[.n[.n]]") +# or if there are no tags, we make up version 0.0. +LATEST_TAG=$(git describe --tags --match 'v*' --abbrev=0 2>/dev/null) || LATEST_TAG="HEAD" +if [ $LATEST_TAG = "HEAD" ] +then COMMIT_COUNT=$(git rev-list --count HEAD) + LATEST_TAG="0.0.$COMMIT_COUNT" + COMMIT_COUNT_SINCE_TAG=0 +else + COMMIT_COUNT_SINCE_TAG=$(git rev-list --count ${LATEST_TAG}..) + LATEST_TAG=${LATEST_TAG##v} # Remove the "v" from the front of the tag +fi +if [ $COMMIT_COUNT_SINCE_TAG = 0 ]; then + SHORT_VERSION="$LATEST_TAG" +else + # increment final digit of tag and append "d" + commit-count-since-tag + # e.g. commit after 1.0 is 1.1d1, commit after 1.0.0 is 1.0.1d1 + # this is the bit that requires /bin/bash + OLD_IFS=$IFS + IFS="." + VERSION_PARTS=($LATEST_TAG) + LAST_PART=$((${#VERSION_PARTS[@]}-1)) + #VERSION_PARTS[$LAST_PART]=$((${VERSION_PARTS[${LAST_PART}]}+1)) + #echo "VERSION_PARTS_LAST_PART: $VERSION_PARTS[$LAST_PART]" + + SHORT_VERSION="${VERSION_PARTS[*]}.d${COMMIT_COUNT_SINCE_TAG}" + echo "SHORT_VERSION: $SHORT_VERSION" + + IFS=$OLD_IFS +fi + + + +# Bundle version (commits-on-master[-until-branch "." commits-on-branch]) +# Assumes that two release branches will not diverge from the same commit on master. +if [ $(git rev-parse --abbrev-ref HEAD) = "$(git rev-parse --abbrev-ref HEAD)" ]; then + MASTER_COMMIT_COUNT=$(git rev-list --count HEAD) + BRANCH_COMMIT_COUNT=0 + BUNDLE_VERSION="$MASTER_COMMIT_COUNT" +else + MASTER_COMMIT_COUNT=$(git rev-list --count $(git rev-list master.. | tail -n 1)^) + BRANCH_COMMIT_COUNT=$(git rev-list --count master..) + if [ $BRANCH_COMMIT_COUNT = 0 ] + then BUNDLE_VERSION="$MASTER_COMMIT_COUNT" + else BUNDLE_VERSION="${MASTER_COMMIT_COUNT}.${BRANCH_COMMIT_COUNT}" + fi +fi + +CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) +BUILD_VERSION+=".$CURRENT_BRANCH" +SHORT_VERSION+=".$CURRENT_BRANCH" + +# For debugging: +echo "AUTOVERSION - BUILD VERSION: $BUILD_VERSION" +echo "AUTOVERSION - CURRENT BRANCH: $CURRENT_BRANCH" +echo "AUTOVERSION - LATEST_TAG: $LATEST_TAG" +echo "AUTOVERSION - COMMIT_COUNT_SINCE_TAG: $COMMIT_COUNT_SINCE_TAG" +echo "AUTOVERSION - SHORT VERSION: $SHORT_VERSION" +echo "AUTOVERSION - MASTER_COMMIT_COUNT: $MASTER_COMMIT_COUNT" +echo "AUTOVERSION - BRANCH_COMMIT_COUNT: $BRANCH_COMMIT_COUNT" +echo "AUTOVERSION - BUNDLE_VERSION: $BUNDLE_VERSION" + +/usr/libexec/PlistBuddy -c "Add :CFBundleBuildVersion string $BUILD_VERSION" "$INFO_PLIST" 2>/dev/null || /usr/libexec/PlistBuddy -c "Set :CFBundleBuildVersion $BUILD_VERSION" "$INFO_PLIST" +/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $SHORT_VERSION" "$INFO_PLIST" +/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $BUNDLE_VERSION" "$INFO_PLIST" From 15d406d03757b402692ed4112d3bfb2b73dbca8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adria=CC=81n=20Moreno=20Pen=CC=83a?= Date: Sun, 8 Nov 2015 23:53:07 +0100 Subject: [PATCH 2/5] Added internatinalization. --- Kodi Remote/Kodi Remote.xcodeproj/project.pbxproj | 12 ++++++++++++ .../Kodi Remote/Controllers/WindowController.swift | 2 +- .../ViewControllers/SettingsViewController.swift | 6 +++--- Kodi Remote/Resources/Strings/ProjectTexts.strings | 9 +++++++++ 4 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 Kodi Remote/Resources/Strings/ProjectTexts.strings diff --git a/Kodi Remote/Kodi Remote.xcodeproj/project.pbxproj b/Kodi Remote/Kodi Remote.xcodeproj/project.pbxproj index 76da3b8..23c5c89 100644 --- a/Kodi Remote/Kodi Remote.xcodeproj/project.pbxproj +++ b/Kodi Remote/Kodi Remote.xcodeproj/project.pbxproj @@ -9,6 +9,7 @@ /* Begin PBXBuildFile section */ 0A016C731AC4AEB900590E32 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0A016C711AC4AEB900590E32 /* Main.storyboard */; }; 0A1E6C131ACB579700142684 /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A1E6C121ACB579700142684 /* SettingsViewController.swift */; }; + 0A2A1BA81BEFD6A700587FAE /* ProjectTexts.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0A2A1BA71BEFD6A700587FAE /* ProjectTexts.strings */; }; 0A3F9EF91AC0C2BC008C6A4E /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A3F9EF81AC0C2BC008C6A4E /* AppDelegate.swift */; }; 0A3F9F001AC0C2BC008C6A4E /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0A3F9EFF1AC0C2BC008C6A4E /* Images.xcassets */; }; 0A4C62CB1B6584BD00178BF5 /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A4C62CA1B6584BD00178BF5 /* MainViewController.swift */; }; @@ -63,6 +64,7 @@ /* Begin PBXFileReference section */ 0A016C721AC4AEB900590E32 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 0A1E6C121ACB579700142684 /* SettingsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = ""; }; + 0A2A1BA71BEFD6A700587FAE /* ProjectTexts.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; path = ProjectTexts.strings; sourceTree = ""; }; 0A3F9EF31AC0C2BC008C6A4E /* Kodi Remote.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Kodi Remote.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 0A3F9EF71AC0C2BC008C6A4E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 0A3F9EF81AC0C2BC008C6A4E /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -131,6 +133,7 @@ 0A016C491AC36C3C00590E32 /* Resources */ = { isa = PBXGroup; children = ( + 0A2A1BA61BEFD6A700587FAE /* Strings */, 0A016C4A1AC36C4600590E32 /* Imgs */, ); path = Resources; @@ -170,6 +173,14 @@ path = Views; sourceTree = ""; }; + 0A2A1BA61BEFD6A700587FAE /* Strings */ = { + isa = PBXGroup; + children = ( + 0A2A1BA71BEFD6A700587FAE /* ProjectTexts.strings */, + ); + path = Strings; + sourceTree = ""; + }; 0A3F9EEA1AC0C2BC008C6A4E = { isa = PBXGroup; children = ( @@ -378,6 +389,7 @@ 0AA7A1E31B8E7C9A0014FCF4 /* secondary_action.png in Resources */, 0AA7A1D81B8E749E0014FCF4 /* menu@2x.png in Resources */, 0AA7A1D11B8E749E0014FCF4 /* back.png in Resources */, + 0A2A1BA81BEFD6A700587FAE /* ProjectTexts.strings in Resources */, 0AA7A1D41B8E749E0014FCF4 /* bottom@2x.png in Resources */, 0A3F9F001AC0C2BC008C6A4E /* Images.xcassets in Resources */, 0AA7A1D21B8E749E0014FCF4 /* back@2x.png in Resources */, diff --git a/Kodi Remote/Kodi Remote/Controllers/WindowController.swift b/Kodi Remote/Kodi Remote/Controllers/WindowController.swift index 180a976..dbdacb8 100644 --- a/Kodi Remote/Kodi Remote/Controllers/WindowController.swift +++ b/Kodi Remote/Kodi Remote/Controllers/WindowController.swift @@ -32,7 +32,7 @@ class WindowController : NSWindowController { override func windowDidLoad() { - self.window?.title = "Kodi Remote" + self.window?.title = NSLocalizedString("AppTitle", "") self.window?.titlebarAppearsTransparent = true self.window?.movableByWindowBackground = true self.window?.backgroundColor = NSColor.blackColor() diff --git a/Kodi Remote/Kodi Remote/ViewControllers/SettingsViewController.swift b/Kodi Remote/Kodi Remote/ViewControllers/SettingsViewController.swift index d0d94d8..bcb1ee7 100644 --- a/Kodi Remote/Kodi Remote/ViewControllers/SettingsViewController.swift +++ b/Kodi Remote/Kodi Remote/ViewControllers/SettingsViewController.swift @@ -73,7 +73,7 @@ class SettingsViewController : NSViewController { }else{ let alertMessage:NSAlert = NSAlert() - alertMessage.messageText = "Ooops!" + alertMessage.messageText = NSLocalizedString("error_title", comment: "") alertMessage.informativeText = formValidationResult.errorMessage as String alertMessage.runModal() @@ -98,12 +98,12 @@ extension SettingsViewController{ if (!isValidUrl(txtUrl.stringValue)){ log.debug("Invalid URL") - return (false, "You must enter a valid URL, starting with http") + return (false, NSLocalizedString("error_invalid_url", comment: "")) } if (!txtPort.stringValue.isEmpty && !isValidNumber(txtPort.stringValue)){ log.debug("Invalid port") - return (false, "You must enter a valid port number") + return (false, NSLocalizedString("error_invalid_port", comment: "")) } diff --git a/Kodi Remote/Resources/Strings/ProjectTexts.strings b/Kodi Remote/Resources/Strings/ProjectTexts.strings new file mode 100644 index 0000000..1f4dd4f --- /dev/null +++ b/Kodi Remote/Resources/Strings/ProjectTexts.strings @@ -0,0 +1,9 @@ +/* + ProjectTexts.strings + Kodi Remote + + Created by Adrián Moreno Peña on 08/11/15. + Copyright © 2015 Nyan Software. All rights reserved. +*/ +"AppTitle" = "Kodi Remote"; + From 34a313edcaeef6a461f0db14de00c4d3995311cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adria=CC=81n=20Moreno=20Pen=CC=83a?= Date: Sun, 8 Nov 2015 23:53:20 +0100 Subject: [PATCH 3/5] Added internatinalization. --- Kodi Remote/Kodi Remote/Controllers/WindowController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kodi Remote/Kodi Remote/Controllers/WindowController.swift b/Kodi Remote/Kodi Remote/Controllers/WindowController.swift index dbdacb8..a3af9bf 100644 --- a/Kodi Remote/Kodi Remote/Controllers/WindowController.swift +++ b/Kodi Remote/Kodi Remote/Controllers/WindowController.swift @@ -32,7 +32,7 @@ class WindowController : NSWindowController { override func windowDidLoad() { - self.window?.title = NSLocalizedString("AppTitle", "") + self.window?.title = NSLocalizedString("AppTitle", comment: "") self.window?.titlebarAppearsTransparent = true self.window?.movableByWindowBackground = true self.window?.backgroundColor = NSColor.blackColor() From 6e6680622b5f2127ca821b3e5072fa4d3835d844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adria=CC=81n=20Moreno=20Pen=CC=83a?= Date: Sun, 8 Nov 2015 23:53:37 +0100 Subject: [PATCH 4/5] Adding parse for analytics. --- Kodi Remote/Kodi Remote/AppDelegate.swift | 1 + Kodi Remote/Podfile | 1 + Kodi Remote/Podfile.lock | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/Kodi Remote/Kodi Remote/AppDelegate.swift b/Kodi Remote/Kodi Remote/AppDelegate.swift index 4b3391d..813b5e3 100644 --- a/Kodi Remote/Kodi Remote/AppDelegate.swift +++ b/Kodi Remote/Kodi Remote/AppDelegate.swift @@ -10,6 +10,7 @@ import Cocoa import XCGLogger import Fabric import Crashlytics +import Parse let log = XCGLogger.defaultInstance() diff --git a/Kodi Remote/Podfile b/Kodi Remote/Podfile index c7eb29d..80bbcb1 100644 --- a/Kodi Remote/Podfile +++ b/Kodi Remote/Podfile @@ -10,4 +10,5 @@ target 'Kodi Remote' do pod 'Box', '~> 2.0' pod 'Result', '0.6.0-beta.6' pod 'XCGLogger', '~> 3.0' + pod 'Parse', '~> 1.9' end diff --git a/Kodi Remote/Podfile.lock b/Kodi Remote/Podfile.lock index 0a86604..e6c8a16 100644 --- a/Kodi Remote/Podfile.lock +++ b/Kodi Remote/Podfile.lock @@ -1,6 +1,9 @@ PODS: - Alamofire (3.1.2) + - Bolts/Tasks (1.4.0) - Box (2.0) + - Parse (1.9.1): + - Bolts/Tasks (>= 1.4.0) - Result (0.6.0-beta.6) - SwiftyJSON (2.3.1) - XCGLogger (3.0) @@ -8,13 +11,16 @@ PODS: DEPENDENCIES: - Alamofire (~> 3.1.2) - Box (~> 2.0) + - Parse (~> 1.9) - Result (= 0.6.0-beta.6) - SwiftyJSON (~> 2.3.1) - XCGLogger (~> 3.0) SPEC CHECKSUMS: Alamofire: 7c16ca65f3c7e681fd925fd7f2dec7747ff96855 + Bolts: 0e9bce58b9b9f5e8a7a4d47b16d2fabec289072b Box: 70713ca3679e4e11ad4c470e9b58265f506fc659 + Parse: 54a965c8c19a6dde90284ab654dbcc77ef8c001b Result: dc390d0b58f9ec43fcd536f1ebdd130803cc6cbc SwiftyJSON: 592b53bee5ef3dd9b3bebc6b9cb7ee35426ae8c3 XCGLogger: 5802533aff8bafc8b3b9776ab8972576f31d0a4e From 14b36044ea839ce540726b429b8a4e7ca77071ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adria=CC=81n=20Moreno=20Pen=CC=83a?= Date: Mon, 9 Nov 2015 00:04:46 +0100 Subject: [PATCH 5/5] Integrating parse.com statistics, and adding a API Keys example file. --- .../Kodi Remote.xcodeproj/project.pbxproj | 4 ++++ Kodi Remote/Kodi Remote/AppDelegate.swift | 23 ++++++++++++++++--- .../Resources/Strings/APIKeys.example.plist | 10 ++++++++ 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 Kodi Remote/Resources/Strings/APIKeys.example.plist diff --git a/Kodi Remote/Kodi Remote.xcodeproj/project.pbxproj b/Kodi Remote/Kodi Remote.xcodeproj/project.pbxproj index 23c5c89..1ff4fa7 100644 --- a/Kodi Remote/Kodi Remote.xcodeproj/project.pbxproj +++ b/Kodi Remote/Kodi Remote.xcodeproj/project.pbxproj @@ -15,6 +15,7 @@ 0A4C62CB1B6584BD00178BF5 /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A4C62CA1B6584BD00178BF5 /* MainViewController.swift */; }; 0A4C62D11B659FCD00178BF5 /* MainViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A4C62D01B659FCD00178BF5 /* MainViewModel.swift */; }; 0A4C62D31B66E68700178BF5 /* PreferenceUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A4C62D21B66E68700178BF5 /* PreferenceUtils.swift */; }; + 0A524BF51BF00A750095740C /* APIKeys.plist in Resources */ = {isa = PBXBuildFile; fileRef = 0A524BF41BF00A750095740C /* APIKeys.plist */; }; 0A7177091B55AB59000CA6E0 /* Fabric.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7177071B55AB59000CA6E0 /* Fabric.framework */; }; 0A71770B1B55AB59000CA6E0 /* Crashlytics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7177081B55AB59000CA6E0 /* Crashlytics.framework */; }; 0A71770E1B55ABDF000CA6E0 /* libc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A71770D1B55ABDF000CA6E0 /* libc++.dylib */; }; @@ -75,6 +76,7 @@ 0A4C62CD1B65878600178BF5 /* SwiftLog.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftLog.framework; path = "Pods/../build/Debug/Pods-Kodi Remote/SwiftLog.framework"; sourceTree = ""; }; 0A4C62D01B659FCD00178BF5 /* MainViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MainViewModel.swift; path = ViewModels/MainViewModel.swift; sourceTree = ""; }; 0A4C62D21B66E68700178BF5 /* PreferenceUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreferenceUtils.swift; sourceTree = ""; }; + 0A524BF41BF00A750095740C /* APIKeys.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = APIKeys.plist; path = Resources/Strings/APIKeys.plist; sourceTree = SOURCE_ROOT; }; 0A7177071B55AB59000CA6E0 /* Fabric.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Fabric.framework; sourceTree = ""; }; 0A7177081B55AB59000CA6E0 /* Crashlytics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Crashlytics.framework; sourceTree = ""; }; 0A71770D1B55ABDF000CA6E0 /* libc++.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libc++.dylib"; path = "usr/lib/libc++.dylib"; sourceTree = SDKROOT; }; @@ -176,6 +178,7 @@ 0A2A1BA61BEFD6A700587FAE /* Strings */ = { isa = PBXGroup; children = ( + 0A524BF41BF00A750095740C /* APIKeys.plist */, 0A2A1BA71BEFD6A700587FAE /* ProjectTexts.strings */, ); path = Strings; @@ -395,6 +398,7 @@ 0AA7A1D21B8E749E0014FCF4 /* back@2x.png in Resources */, 0AF2EE5A1BEFCA3000395313 /* automatic_versioning.sh in Resources */, 0AA7A1DE1B8E749E0014FCF4 /* top@2x.png in Resources */, + 0A524BF51BF00A750095740C /* APIKeys.plist in Resources */, 0AA7A1DB1B8E749E0014FCF4 /* right.png in Resources */, 0AA7A1D61B8E749E0014FCF4 /* left@2x.png in Resources */, 0AA7A1DC1B8E749E0014FCF4 /* right@2x.png in Resources */, diff --git a/Kodi Remote/Kodi Remote/AppDelegate.swift b/Kodi Remote/Kodi Remote/AppDelegate.swift index 813b5e3..fbcf3e7 100644 --- a/Kodi Remote/Kodi Remote/AppDelegate.swift +++ b/Kodi Remote/Kodi Remote/AppDelegate.swift @@ -19,12 +19,29 @@ class AppDelegate: NSObject, NSApplicationDelegate { func applicationDidFinishLaunching(aNotification: NSNotification) { log.setup(.Debug, showLogLevel: true, showFileNames: true, showLineNumbers: true) + + // SDKs Fabric.with([Crashlytics.self]) + + if let path = NSBundle.mainBundle().pathForResource("APIKeys", ofType: "plist") { + + if let keys = NSDictionary(contentsOfFile: path) { + let applicationId = keys["parseApplicationId"] as? String + let clientKey = keys["parseClientKey"] as? String + + // Initialize Parse. + Parse.setApplicationId(applicationId!, clientKey: clientKey!) + PFAnalytics.trackAppOpenedWithLaunchOptions(nil) + + } + + } + } - + func applicationWillTerminate(aNotification: NSNotification) { - + } - + } diff --git a/Kodi Remote/Resources/Strings/APIKeys.example.plist b/Kodi Remote/Resources/Strings/APIKeys.example.plist new file mode 100644 index 0000000..e320ee0 --- /dev/null +++ b/Kodi Remote/Resources/Strings/APIKeys.example.plist @@ -0,0 +1,10 @@ + + + + + parseApplicationId + 1234 + parseClientKey + 5678 + +