Skip to content

Commit

Permalink
Making iOS Install help consistent with the documentation (#455)
Browse files Browse the repository at this point in the history
* Update install-ios.js

* Updating initialisation code for iOS

* Update create user documentation code for iOS

* Formatting

Co-authored-by: Rudrank Riyam <rudrankriyam@gmail.com>
  • Loading branch information
dabeeeenster and rudrankriyam authored Nov 1, 2021
1 parent b0953b9 commit f894761
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
11 changes: 5 additions & 6 deletions frontend/common/code-help/create-user/create-user-ios.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
import Utils from '../../utils/utils';

module.exports = (envId, { FEATURE_NAME,USER_ID, FEATURE_FUNCTION, FEATURE_NAME_ALT }) => `import BulletTrainClient
module.exports = (envId, { FEATURE_NAME,USER_ID, FEATURE_FUNCTION, FEATURE_NAME_ALT }) => `import FlagsmithClient
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions:
[UIApplication.LaunchOptionsKey: Any]?) -> Bool {
BulletTrain.shared.apiKey = "${envId}"
Flagsmith.shared.apiKey = "${envId}"
// This will create a user in the dashboard if they don't already exist
// Check for a feature
BulletTrain.shared
Flagsmith.shared
.hasFeatureFlag(withID: "${FEATURE_NAME}", forIdentity: "${USER_ID}") { (result) in
print(result)
}
// Or, use the value of a feature
BulletTrain.shared
Flagsmith.shared
.getFeatureValue(withID: "${FEATURE_NAME_ALT}", forIdentity: "${USER_ID}") { (result) in
switch result {
case .success(let value):
Expand Down
8 changes: 4 additions & 4 deletions frontend/common/code-help/init/init-ios.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import Utils from '../../utils/utils';

module.exports = (envId, { FEATURE_NAME, FEATURE_FUNCTION, FEATURE_NAME_ALT }) => `import BulletTrainClient
module.exports = (envId, { FEATURE_NAME, FEATURE_FUNCTION, FEATURE_NAME_ALT }) => `import FlagsmithClient
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
BulletTrain.shared.apiKey = "${envId}"
Flagsmith.shared.apiKey = "${envId}"
// Check for a feature
BulletTrain.shared
Flagsmith.shared
.hasFeatureFlag(withID: "${FEATURE_NAME}", forIdentity: nil) { (result) in
print(result)
}
// Or, use the value of a feature
BulletTrain.shared
Flagsmith.shared
.getFeatureValue(withID: "${FEATURE_NAME_ALT}", forIdentity: nil) { (result) in
switch result {
case .success(let value):
Expand Down
2 changes: 1 addition & 1 deletion frontend/common/code-help/install/install-ios.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = ({ NPM_RN_CLIENT }) => `// cocoapods
pod 'BulletTrainClient', '~> 1.0.1'
pod 'FlagsmithClient', '~> 1.0.1'
`;

0 comments on commit f894761

Please sign in to comment.