Skip to content

Commit 7889fed

Browse files
authored
Look for Imgur client ID in Info.plist (#1204)
1 parent da632d3 commit 7889fed

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

App/Extensions/ImgurAnonymousAPI+Shared.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ import AwfulSettings
1010
import KeychainAccess
1111
import AuthenticationServices
1212

13-
// App-specific Imgur constants
14-
private enum AppImgurConstants {
15-
static let clientID = "99240c4154dd0b4"
16-
}
17-
1813
// MARK: - Imgur Auth Manager
1914

2015
private let authLogger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "ImgurAuthManager")
@@ -60,7 +55,10 @@ public final class ImgurAuthManager: NSObject, ImgurAuthProvider {
6055
// MARK: - ImgurAuthProvider Protocol
6156

6257
public var clientID: String {
63-
return AppImgurConstants.clientID
58+
guard let clientID = Bundle.main.object(forInfoDictionaryKey: "ImgurClientId") as? String else {
59+
fatalError("Missing Imgur client ID (is the IMGUR_CLIENT_ID build setting set, e.g. in Local.xcconfig?")
60+
}
61+
return clientID
6462
}
6563

6664
public var isAuthenticated: Bool {

App/Resources/Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,7 @@
9797
</array>
9898
<key>UIViewControllerBasedStatusBarAppearance</key>
9999
<true/>
100+
<key>ImgurClientId</key>
101+
<string>${IMGUR_CLIENT_ID}</string>
100102
</dict>
101103
</plist>

Awful.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@
340340
1C16FC171CD1848400C88BD1 /* ComposeTextViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ComposeTextViewController.swift; sourceTree = "<group>"; };
341341
1C16FC191CD42EB300C88BD1 /* PostPreviewViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PostPreviewViewController.swift; sourceTree = "<group>"; };
342342
1C1BF9C119AB9E6200E8FBBC /* InAppActionSheet.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = InAppActionSheet.xib; sourceTree = "<group>"; };
343+
1C1CB8DB2D9A5D7800900BAA /* Local.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Local.entitlements; sourceTree = SOURCE_ROOT; };
343344
1C1E57502C2521580075E3B6 /* platinum-member-white.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "platinum-member-white.png"; sourceTree = "<group>"; };
344345
1C1F0F0E2B8A8C9700F097D3 /* AwfulModelTypes */ = {isa = PBXFileReference; lastKnownFileType = text; path = AwfulModelTypes; sourceTree = SOURCE_ROOT; };
345346
1C1F0F132B8B091600F097D3 /* AwfulTheming */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = AwfulTheming; sourceTree = "<group>"; };
@@ -652,6 +653,7 @@
652653
1C15334E20708F140021A2BD /* Common-Debug.xcconfig */,
653654
1C15334F20708F250021A2BD /* Common-Release.xcconfig */,
654655
1C15334B20707EB10021A2BD /* Common.xcconfig */,
656+
1C1CB8DB2D9A5D7800900BAA /* Local.entitlements */,
655657
1C15335220709E950021A2BD /* Local.xcconfig */,
656658
);
657659
path = Config;

Local.sample.xcconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@
55

66
// To get builds running on your device, uncomment this next line and paste in your Team ID from the Developer Portal.
77
// DEVELOPMENT_TEAM = YOUR_TEAM_ID_HERE
8+
9+
// For Imgur functionality, obtain an Imgur API client ID by making a new one at http://api.imgur.com/oauth2/addclientor or using an existing one from https://imgur.com/account/settings/apps then specify the ID here.
10+
// IMGUR_CLIENT_ID = YOUR_CLIENT_ID_HERE

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ This app is not endorsed by Something Awful.
2424

2525
Please drop by [the thread][current thread] if you could use a hand with any of these steps!
2626

27-
You need Xcode 15 to build and run Awful. You can [download Xcode for free from Apple](https://developer.apple.com/download/). Then:
27+
You need Xcode 16 to build and run Awful. You can [download Xcode for free from Apple](https://developer.apple.com/download/). Then:
2828

2929
1. Clone the repository: `git clone --recursive https://github.com/Awful/Awful.app Awful-app`
3030
2. Open the Xcode project and build away: `xed Awful-app`

0 commit comments

Comments
 (0)