Skip to content

Commit a9d85a5

Browse files
committed
refactor(APPCredential): change config name
1 parent 4134794 commit a9d85a5

File tree

7 files changed

+57
-25
lines changed

7 files changed

+57
-25
lines changed

.DS_Store

6 KB
Binary file not shown.

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# API Keys
2-
api_keys_debug*.json
1+
# config
2+
config.json
33

44
# xcuserstate
55
*.xcuserstate

Monotone.xcodeproj/project.pbxproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
14F016B32567981400F60C99 /* RxSwift+Opeartors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14F016B22567981400F60C99 /* RxSwift+Opeartors.swift */; };
171171
14F36F91254D3AB80086B8CC /* ColorPalette.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14F36F90254D3AB80086B8CC /* ColorPalette.swift */; };
172172
14F36FB0254D53940086B8CC /* NetworkManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14F36FAF254D53940086B8CC /* NetworkManager.swift */; };
173-
14F37071254EA14B0086B8CC /* api_keys_sample.json in Resources */ = {isa = PBXBuildFile; fileRef = 14F37070254EA14B0086B8CC /* api_keys_sample.json */; };
173+
14F37071254EA14B0086B8CC /* config_debug.json in Resources */ = {isa = PBXBuildFile; fileRef = 14F37070254EA14B0086B8CC /* config_debug.json */; };
174174
14F3707A254EA9300086B8CC /* BaseRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14F37079254EA9300086B8CC /* BaseRequest.swift */; };
175175
14F3707D254EABDA0086B8CC /* BaseResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14F3707C254EABDA0086B8CC /* BaseResponse.swift */; };
176176
14F37083254ED2F60086B8CC /* SearchPhotosRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14F37082254ED2F60086B8CC /* SearchPhotosRequest.swift */; };
@@ -412,7 +412,7 @@
412412
14F016B22567981400F60C99 /* RxSwift+Opeartors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RxSwift+Opeartors.swift"; sourceTree = "<group>"; };
413413
14F36F90254D3AB80086B8CC /* ColorPalette.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorPalette.swift; sourceTree = "<group>"; };
414414
14F36FAF254D53940086B8CC /* NetworkManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkManager.swift; sourceTree = "<group>"; };
415-
14F37070254EA14B0086B8CC /* api_keys_sample.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = api_keys_sample.json; sourceTree = SOURCE_ROOT; };
415+
14F37070254EA14B0086B8CC /* config_debug.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = config_debug.json; sourceTree = SOURCE_ROOT; };
416416
14F37079254EA9300086B8CC /* BaseRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseRequest.swift; sourceTree = "<group>"; };
417417
14F3707C254EABDA0086B8CC /* BaseResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseResponse.swift; sourceTree = "<group>"; };
418418
14F37082254ED2F60086B8CC /* SearchPhotosRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchPhotosRequest.swift; sourceTree = "<group>"; };
@@ -965,7 +965,7 @@
965965
14D5E8F7254A589E0021FE3E /* Info.plist */,
966966
14CCDC6325CA4DA900638FDF /* InfoPlist.strings */,
967967
148FF23D255237A600CADB4C /* Localizable.strings */,
968-
14F37070254EA14B0086B8CC /* api_keys_sample.json */,
968+
14F37070254EA14B0086B8CC /* config_debug.json */,
969969
);
970970
path = Monotone;
971971
sourceTree = "<group>";
@@ -1375,7 +1375,7 @@
13751375
14D5E8F3254A589E0021FE3E /* Assets.xcassets in Resources */,
13761376
EB8B909725A9B01200336A39 /* terms_and_conditions_cn.html in Resources */,
13771377
14D5E8F6254A589E0021FE3E /* LaunchScreen.storyboard in Resources */,
1378-
14F37071254EA14B0086B8CC /* api_keys_sample.json in Resources */,
1378+
14F37071254EA14B0086B8CC /* config_debug.json in Resources */,
13791379
14D5E8F1254A589D0021FE3E /* Main.storyboard in Resources */,
13801380
EB8B90A125A9B01D00336A39 /* terms_and_conditions_en.html in Resources */,
13811381
EB8B90A225A9B01D00336A39 /* privacy_policy_en.html in Resources */,
@@ -1400,7 +1400,7 @@
14001400
);
14011401
runOnlyForDeploymentPostprocessing = 0;
14021402
shellPath = /bin/sh;
1403-
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n\n# Reveal Script\nREVEAL_APP_PATH=$(mdfind kMDItemCFBundleIdentifier=\"com.ittybittyapps.Reveal2\" | head -n 1)\nBUILD_SCRIPT_PATH=\"${REVEAL_APP_PATH}/Contents/SharedSupport/Scripts/reveal_server_build_phase.sh\"\nif [ \"${REVEAL_APP_PATH}\" -a -e \"${BUILD_SCRIPT_PATH}\" ]; then\n \"${BUILD_SCRIPT_PATH}\"\nelse\n echo \"Reveal Server not loaded: Cannot find a compatible Reveal app.\"\nfi\n\n# Copy API keys\n# cp ${PROJECT_DIR}/APIKeys/api_keys_debug.json ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app\n\nCONFIG_FILE_BASE_NAME=\"api_keys\"\nCONFIG_FILE_NAME=${CONFIG_FILE_BASE_NAME}_debug.json\nCONFIG_FILE_PATH=${PROJECT_DIR}/$CONFIG_FILE_NAME\n\necho \"path is ${CONFIG_FILE_PATH}\"\n\nif [ -f \"${CONFIG_FILE_PATH}\" ]; then\n cp -v \"${CONFIG_FILE_PATH}\" \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app\"\n echo \"copy ${CONFIG_FILE_PATH} to ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app.\"\nelse\n echo \"${CONFIG_FILE_PATH} does not exist.\"\nfi\n";
1403+
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n\n# Reveal Script\nREVEAL_APP_PATH=$(mdfind kMDItemCFBundleIdentifier=\"com.ittybittyapps.Reveal2\" | head -n 1)\nBUILD_SCRIPT_PATH=\"${REVEAL_APP_PATH}/Contents/SharedSupport/Scripts/reveal_server_build_phase.sh\"\nif [ \"${REVEAL_APP_PATH}\" -a -e \"${BUILD_SCRIPT_PATH}\" ]; then\n \"${BUILD_SCRIPT_PATH}\"\nelse\n echo \"Reveal Server not loaded: Cannot find a compatible Reveal app.\"\nfi\n\n# Copy API keys\n# cp ${PROJECT_DIR}/APIKeys/api_keys_debug.json ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app\n\nCONFIG_FILE_BASE_NAME=\"config\"\n# CONFIG_FILE_NAME=${CONFIG_FILE_BASE_NAME}_debug.json\nCONFIG_FILE_NAME=${CONFIG_FILE_BASE_NAME}.json\nCONFIG_FILE_PATH=${PROJECT_DIR}/$CONFIG_FILE_NAME\n\necho \"Config path is ${CONFIG_FILE_PATH}\"\n\nif [ -f \"${CONFIG_FILE_PATH}\" ]; then\n cp -v \"${CONFIG_FILE_PATH}\" \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app\"\n echo \"copy ${CONFIG_FILE_PATH} to ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app.\"\nelse\n echo \"${CONFIG_FILE_PATH} does not exist.\"\nfi\n";
14041404
};
14051405
CEDF1C8637EF40323ABEBFB4 /* [CP] Embed Pods Frameworks */ = {
14061406
isa = PBXShellScriptBuildPhase;

Monotone.xcworkspace/xcuserdata/sheran_chen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,37 @@
5252
landmarkType = "7">
5353
</BreakpointContent>
5454
</BreakpointProxy>
55+
<BreakpointProxy
56+
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
57+
<BreakpointContent
58+
uuid = "463BD4AE-D970-4F96-A51B-D3DA165956B1"
59+
shouldBeEnabled = "Yes"
60+
ignoreCount = "0"
61+
continueAfterRunningActions = "No"
62+
filePath = "Monotone/Application/AppCredential.swift"
63+
startingColumnNumber = "9223372036854775807"
64+
endingColumnNumber = "9223372036854775807"
65+
startingLineNumber = "20"
66+
endingLineNumber = "20"
67+
landmarkName = "init()"
68+
landmarkType = "7">
69+
</BreakpointContent>
70+
</BreakpointProxy>
71+
<BreakpointProxy
72+
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
73+
<BreakpointContent
74+
uuid = "C920C0A8-499B-4ABE-AA8E-CF1D906D028F"
75+
shouldBeEnabled = "Yes"
76+
ignoreCount = "0"
77+
continueAfterRunningActions = "No"
78+
filePath = "Monotone/Application/AppCredential.swift"
79+
startingColumnNumber = "9223372036854775807"
80+
endingColumnNumber = "9223372036854775807"
81+
startingLineNumber = "32"
82+
endingLineNumber = "32"
83+
landmarkName = "init()"
84+
landmarkType = "7">
85+
</BreakpointContent>
86+
</BreakpointProxy>
5587
</Breakpoints>
5688
</Bucket>

Monotone/Application/AppCredential.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,30 @@ import SwiftyJSON
1010

1111
class AppCredential{
1212

13-
let debugKeyFileName: String = "api_keys_debug"
14-
let sampleKeyFileName: String = "api_keys_sample"
13+
let configDebugFileName: String = "config_debug"
14+
let configFileName: String = "config"
1515

1616
init(){
1717

18-
// Load API keys.
19-
var keyFilePath: String? = nil
20-
keyFilePath = Bundle.main.path(forResource: sampleKeyFileName, ofType: "json") ?? keyFilePath
21-
keyFilePath = Bundle.main.path(forResource: debugKeyFileName, ofType: "json") ?? keyFilePath
18+
// Load Config.
19+
var configFilePath: String? = nil
20+
configFilePath = Bundle.main.path(forResource: configDebugFileName, ofType: "json") ?? configFilePath
21+
configFilePath = Bundle.main.path(forResource: configFileName, ofType: "json") ?? configFilePath
2222

23-
if(keyFilePath == nil){
24-
fatalError("API key file does not exist.")
23+
if(configFilePath == nil){
24+
fatalError("Config file does not exist.")
2525
}
2626

2727
do{
28-
let data = try Data(contentsOf: URL(fileURLWithPath: keyFilePath!))
28+
let data = try Data(contentsOf: URL(fileURLWithPath: configFilePath!))
2929
let json = try JSON(data: data)
3030

3131
self._accessKey = json["api_keys"]["access_key"].stringValue
3232
self._secretKey = json["api_keys"]["secret_key"].stringValue
3333

3434
}
3535
catch{
36-
fatalError("Could not read json format for API key file.")
36+
fatalError("Could not read json format for config file.")
3737
}
3838

3939
}

Pods/Pods.xcodeproj/xcuserdata/sheran_chen.xcuserdatad/xcschemes/xcschememanagement.plist

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

0 commit comments

Comments
 (0)