commit | author | age
|
655e66
|
1 |
/* |
H |
2 |
* Copyright (C) 2017 Twitter, Inc. |
|
3 |
* |
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 |
* you may not use this file except in compliance with the License. |
|
6 |
* You may obtain a copy of the License at |
|
7 |
* |
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
9 |
* |
|
10 |
* Unless required by applicable law or agreed to in writing, software |
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 |
* See the License for the specific language governing permissions and |
|
14 |
* limitations under the License. |
|
15 |
* |
|
16 |
*/ |
|
17 |
|
a0a843
|
18 |
#import <Foundation/Foundation.h> |
H |
19 |
|
|
20 |
#if IS_UIKIT_AVAILABLE |
|
21 |
#import <UIKit/UIKit.h> |
|
22 |
#else |
|
23 |
#import <Cocoa/Cocoa.h> |
|
24 |
#endif |
|
25 |
|
|
26 |
NS_ASSUME_NONNULL_BEGIN |
|
27 |
|
7be7ad
|
28 |
FOUNDATION_EXPORT NSString *const TWTRResourcesUtilLanguageType; |
a0a843
|
29 |
|
H |
30 |
@interface TWTRResourcesUtil : NSObject |
|
31 |
|
|
32 |
/** |
|
33 |
* Returns the bundle given its name. This is useful for retrieving any bundle and future refactoring |
|
34 |
* such as when Digits has its own kit resources. |
|
35 |
* |
|
36 |
* @param bundlePath path of the bundle e.g. TwitterKitResources.bundle |
|
37 |
* |
|
38 |
* @return the bundle |
|
39 |
*/ |
|
40 |
+ (NSBundle *)bundleWithBundlePath:(NSString *)bundlePath; |
|
41 |
|
|
42 |
/** |
|
43 |
* Retrieves the localized bundle of the given resource bundle. |
|
44 |
* |
|
45 |
* @param bundle localized bundle |
|
46 |
* |
|
47 |
* @return localized bundle |
|
48 |
*/ |
|
49 |
+ (NSBundle *)localizedBundleWithBundle:(NSBundle *)bundle; |
|
50 |
|
|
51 |
/** |
|
52 |
* Retrieves the localized bundle for the given bundle path. |
|
53 |
* |
|
54 |
* @param bundlePath path of the bundle e.g. TwitterKitResources.bundle |
|
55 |
* |
|
56 |
* @return localized bundle in the given resource bundle path |
|
57 |
*/ |
|
58 |
+ (NSBundle *)localizedBundleWithBundlePath:(NSString *)bundlePath; |
|
59 |
|
|
60 |
/** |
|
61 |
* Retrieves the localized string for the given key. If the string is not found in the right locale strings file, falls back to English. |
|
62 |
* |
|
63 |
* @param key key for the desired localized string, e.g. "BUTTON_OKAY" |
|
64 |
* @param bundlePath path of the bundle e.g. TwitterKitResources.bundle |
|
65 |
* |
|
66 |
* @return localized string |
|
67 |
*/ |
|
68 |
+ (NSString *)localizedStringForKey:(NSString *)key bundlePath:(NSString *)bundlePath; |
|
69 |
|
|
70 |
/** |
|
71 |
* Constructs the canonical user agent string based on |
|
72 |
* kit info in the main bundle. |
|
73 |
* |
|
74 |
* @return Kit user agent string for URL requests. |
|
75 |
*/ |
|
76 |
+ (NSString *)userAgentFromKitBundle; |
|
77 |
|
|
78 |
/** |
|
79 |
* Returns the localized display name of the application. |
|
80 |
*/ |
|
81 |
+ (NSString *)localizedApplicationDisplayName; |
|
82 |
|
|
83 |
/** |
|
84 |
* Returns the platform of the application. |
|
85 |
*/ |
|
86 |
+ (NSString *)platform; |
|
87 |
|
|
88 |
/** |
|
89 |
* Returns the screen scale of the application. |
|
90 |
*/ |
|
91 |
+ (CGFloat)screenScale; |
|
92 |
|
|
93 |
/** |
|
94 |
* Set the version of the parent Kit (Twitter Kit or Digits) |
|
95 |
*/ |
|
96 |
+ (void)setKitVersion:(nullable NSString *)version; |
|
97 |
|
|
98 |
@end |
|
99 |
|
|
100 |
NS_ASSUME_NONNULL_END |