Removed secrets! Woo!
This commit is contained in:
parent
bb34a2635f
commit
4a8c65d751
1
.gitignore
vendored
1
.gitignore
vendored
@ -69,3 +69,4 @@ Pods/
|
||||
Carthage/Build
|
||||
|
||||
.DS_Store
|
||||
FitKit/Secrets.plist
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
0C314390200143FE00E214BA /* FitbitClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C31438F200143FE00E214BA /* FitbitClient.swift */; };
|
||||
0CB282D02012F4CA004E355E /* Secrets.plist in Resources */ = {isa = PBXBuildFile; fileRef = 0CB282CF2012F4CA004E355E /* Secrets.plist */; };
|
||||
0CC8D443200C69EF00480D5D /* FitbitWeight.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CC8D442200C69EF00480D5D /* FitbitWeight.swift */; };
|
||||
0CC8D446200C6EB900480D5D /* HealthKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0CC8D445200C6EB900480D5D /* HealthKit.framework */; };
|
||||
0CC8D448200C73D000480D5D /* HealthKitHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CC8D447200C73D000480D5D /* HealthKitHelper.swift */; };
|
||||
@ -21,6 +22,7 @@
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
0C31438F200143FE00E214BA /* FitbitClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FitbitClient.swift; sourceTree = "<group>"; };
|
||||
0CB282CF2012F4CA004E355E /* Secrets.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Secrets.plist; sourceTree = "<group>"; };
|
||||
0CC8D442200C69EF00480D5D /* FitbitWeight.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FitbitWeight.swift; sourceTree = "<group>"; };
|
||||
0CC8D444200C6EB900480D5D /* FitKit.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = FitKit.entitlements; sourceTree = "<group>"; };
|
||||
0CC8D445200C6EB900480D5D /* HealthKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = HealthKit.framework; path = System/Library/Frameworks/HealthKit.framework; sourceTree = SDKROOT; };
|
||||
@ -81,6 +83,7 @@
|
||||
0CC990F620013C3D00624436 /* Info.plist */,
|
||||
0CC8D442200C69EF00480D5D /* FitbitWeight.swift */,
|
||||
0CC8D447200C73D000480D5D /* HealthKitHelper.swift */,
|
||||
0CB282CF2012F4CA004E355E /* Secrets.plist */,
|
||||
);
|
||||
path = FitKit;
|
||||
sourceTree = "<group>";
|
||||
@ -170,6 +173,7 @@
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
0CB282D02012F4CA004E355E /* Secrets.plist in Resources */,
|
||||
0CC990F520013C3D00624436 /* LaunchScreen.storyboard in Resources */,
|
||||
0CC990F220013C3D00624436 /* Assets.xcassets in Resources */,
|
||||
0CC990F020013C3D00624436 /* Main.storyboard in Resources */,
|
||||
|
@ -19,8 +19,8 @@ class FitbitClient {
|
||||
}
|
||||
|
||||
private var oauthClient: OAuth2Swift
|
||||
private let consumerKey = "22CPJ4"
|
||||
private let consumerSecret = "eb05e27f6aa224bcc1cf273119565b28"
|
||||
private var consumerKey = "invalid-key" // Set in Fitkit/Secrets.plist
|
||||
private var consumerSecret = "invalid-secret" // Set in Fitkit/Secrets.plist
|
||||
private let callbackUrl = "fitkit://oauth-callback/fitbit"
|
||||
private let authorizeUrl = "https://www.fitbit.com/oauth2/authorize"
|
||||
private let accessTokenUrl = "https://api.fitbit.com/oauth2/token"
|
||||
@ -29,6 +29,15 @@ class FitbitClient {
|
||||
|
||||
init() {
|
||||
// Init inner client
|
||||
if let path = Bundle.main.path(forResource: "Secrets", ofType: "plist"),
|
||||
let secrets = NSDictionary(contentsOfFile: path),
|
||||
let fitbitCreds = secrets["Fitbit Credentials"] as? NSDictionary,
|
||||
let consumerKey = fitbitCreds["Consumer Key"] as? String,
|
||||
let consumerSecret = fitbitCreds["Consumer Secret"] as? String
|
||||
{
|
||||
self.consumerKey = consumerKey
|
||||
self.consumerSecret = consumerSecret
|
||||
}
|
||||
self.oauthClient = OAuth2Swift(
|
||||
consumerKey: self.consumerKey,
|
||||
consumerSecret: self.consumerSecret,
|
||||
|
13
FitKit/Secrets.example.plist
Normal file
13
FitKit/Secrets.example.plist
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Fitbit Credentials</key>
|
||||
<dict>
|
||||
<key>Consumer Key</key>
|
||||
<string>your-key</string>
|
||||
<key>Consumer Secret</key>
|
||||
<string>your-secret</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
Loading…
Reference in New Issue
Block a user