Skip to content

Commit

Permalink
Add watchOS to ResearchSuiteUI project
Browse files Browse the repository at this point in the history
  • Loading branch information
syoung-smallwisdom committed Nov 29, 2017
1 parent d7ac7c3 commit 10a7e76
Show file tree
Hide file tree
Showing 8 changed files with 344 additions and 160 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 4B822CZK9N;
INFOPLIST_FILE = ResearchSuiteTestApp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = org.sagebase.ResearchSuiteTestApp;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -518,6 +519,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 4B822CZK9N;
INFOPLIST_FILE = ResearchSuiteTestApp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = org.sagebase.ResearchSuiteTestApp;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"actions": {
"cancel": { "iconName": "closeActivity" }
},
"shouldHideActions": ["goBackward", "skip"],
"shouldHideActions": ["skip"],
"steps": [{
"identifier": "step1",
"type": "instruction",
"title": "Step 1",
"text": "This is the first step of the Foo task.",
"detail": "On this screen you should see an image above the text with a picture of an envelop. There is also a short footnote. The button should say 'Go, Dogs! Go!'. Tap it to continue.",
"detail": "On this screen you should see an image above the text with a picture of an envelop. There is also a short footnote. The button should say 'Go, Dogs!'. Tap it to continue.",
"footnote": "This is a footnote.",
"image": "before",
"actions": {
Expand All @@ -32,16 +32,23 @@
}
},
{
"identifier": "countdownStep",
"type": "countdown",
"title": "It's the Final Countdown",
"text": "Some text.",
"duration": 5,
"commands": ["vibrate", "transitionAutomatically"],
},
{
"identifier": "movingStep",
"type": "active",
"title": "Active Step",
"text": "Some text.",
"shouldHideActions": ["goBackward", "goForward"],
"duration": 5,
"duration": 20,
"commands": ["playSound", "transitionAutomatically"],
"spokenInstructions": {
"0": "Start moving",
"10": "Keep going",
"5": "Keep going",
"halfway": "Halfway there",
"end": "Stop moving"
}
Expand Down
434 changes: 284 additions & 150 deletions ResearchSuiteUI/ResearchSuiteUI.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

19 changes: 18 additions & 1 deletion ResearchSuiteUI/ResearchSuiteUI/Localization/Localization.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ open class Localization: NSObject {
public static var allBundles: [Bundle] = {
return [Bundle.main, Bundle(for: Localization.self), Bundle(for: RSDFactory.self)]
}()

public static var allTargetSuffixes: [String] = {
return ["-iOS", "-tvOS", "-watchOS", "-macOS"]
}()

@objc open class func localizedString(_ key: String) -> String {
public static func localizedString(_ key: String) -> String {
// Look in these bundles for a localization for the given key
for bundle in allBundles {
let tableName = defaultTableNameForBundle(bundle)
Expand All @@ -48,6 +52,19 @@ open class Localization: NSObject {
// If something is found here then return
return bundleStr
}
if let tableName = tableName {
// Otherwise, look in the a resource that is shared between targets.
for suffix in allTargetSuffixes {
if let range = tableName.range(of: suffix) {
let sharedName = String(tableName.prefix(upTo: range.lowerBound))
let sharedStr = NSLocalizedString(key, tableName: sharedName, bundle: bundle, value: key, comment: "")
if sharedStr != key {
// If something is found here then return
return sharedStr
}
}
}
}
}
// Fallback to the key
return key
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -488,11 +488,11 @@ open class RSDGenericStepViewController: RSDStepViewController, UITableViewDataS

// use the keyboard properties defined for this step
if let textAnswerFormat = itemGroup.textFieldOptions {
fieldCell.textField.keyboardType = textAnswerFormat.keyboardType
fieldCell.textField.keyboardType = textAnswerFormat.keyboardType.keyboardType()
fieldCell.textField.isSecureTextEntry = textAnswerFormat.isSecureTextEntry
fieldCell.textField.autocapitalizationType = textAnswerFormat.autocapitalizationType
fieldCell.textField.autocorrectionType = textAnswerFormat.autocorrectionType
fieldCell.textField.spellCheckingType = textAnswerFormat.spellCheckingType
fieldCell.textField.autocapitalizationType = textAnswerFormat.autocapitalizationType.textAutocapitalizationType()
fieldCell.textField.autocorrectionType = textAnswerFormat.autocorrectionType.textAutocorrectionType()
fieldCell.textField.spellCheckingType = textAnswerFormat.spellCheckingType.textSpellCheckingType()
}

// TODO: syoung 10/23/2017 Add support for picker views
Expand Down
24 changes: 24 additions & 0 deletions ResearchSuiteUI/ResearchSuiteUI/watchOS/Info-watchOS.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?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>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

0 comments on commit 10a7e76

Please sign in to comment.