Created
October 22, 2018 13:59
-
-
Save dennda/ce3b5467459faf326fd3fd13eebfee3d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/DuolingoMobile/Sources/Explanations/Smart_Tips/SmartTipManager.swift b/DuolingoMobile/Sources/Explanations/Smart_Tips/SmartTipManager.swift | |
index 332ca7b2b8..10026a6d01 100644 | |
--- a/DuolingoMobile/Sources/Explanations/Smart_Tips/SmartTipManager.swift | |
+++ b/DuolingoMobile/Sources/Explanations/Smart_Tips/SmartTipManager.swift | |
@@ -172,16 +172,16 @@ class SmartTipManager: NSObject { | |
let eligibleSmartTips = smartTips.filter({ _, smartTip in | |
// Have we shown this particular one in this session already? | |
- if smartTipsShownInCurrentSession.contains(smartTip.identifier) { | |
- LogInfo("We've already shown smart tip '\(smartTip.identifier)' in this session. Won't show it again.") | |
- return false | |
- } | |
- | |
- // Have we shown this particular one too recently or are we not in the right point in the tree? | |
- if !smartTip.mayShow(forUserID: self.userID, inSkill: skillID, inCourse: course) { | |
- LogInfo("Won't show Smart Tip \(smartTip.identifier) due to policy.") | |
- return false | |
- } | |
+// if smartTipsShownInCurrentSession.contains(smartTip.identifier) { | |
+// LogInfo("We've already shown smart tip '\(smartTip.identifier)' in this session. Won't show it again.") | |
+// return false | |
+// } | |
+// | |
+// // Have we shown this particular one too recently or are we not in the right point in the tree? | |
+// if !smartTip.mayShow(forUserID: self.userID, inSkill: skillID, inCourse: course) { | |
+// LogInfo("Won't show Smart Tip \(smartTip.identifier) due to policy.") | |
+// return false | |
+// } | |
return true | |
}) | |
@@ -229,4 +229,38 @@ class SmartTipManager: NSObject { | |
return DUOAccountManager.instance().getConditionAndTreat(experimentName) == "experiment" | |
} | |
+ @objc | |
+ static func makeDebugExplanation() -> DUOSessionElementModel? { | |
+// struct SpecificViolation: Violation { | |
+// let rule: Rule | |
+// | |
+// let verb: Verb | |
+// let regularity: Verb.Regularity | |
+// let verbFamily: Verb.Family | |
+// let verbFamilyRepresentative: Verb.Family.Representative? | |
+// let incorrectConjugation: Verb.Conjugation | |
+// let correctConjugation: Verb.Conjugation | |
+// } | |
+ | |
+ let rule = IncorrectConjugationInCorrectTenseRule() | |
+ | |
+ let tokenizer = try! Tokenizer() | |
+ let verb = tokenizer.getWords(forToken: "vivir")[0].verb! | |
+ let incorrectConjugation = verb.listConjugations(forTenses: [.presentIndicative], pluralities: [.singular], persons: [.third])[0] | |
+ let correctConjugation = verb.listConjugations(forTenses: [.presentIndicative], pluralities: [.plural], persons: [.third])[0] | |
+ | |
+ let violation = IncorrectConjugationInCorrectTenseRule.SpecificViolation(rule: rule, | |
+ verb: verb, | |
+ regularity: Verb.Regularity.regular(stem: "viv"), | |
+ verbFamily: verb.family, | |
+ verbFamilyRepresentative: verb.family.getRepresentative(withTokenizer: tokenizer), | |
+ incorrectConjugation: incorrectConjugation, | |
+ correctConjugation: correctConjugation) | |
+ let smartTip = SmartTip.create(forRuleViolation: violation)! | |
+ | |
+ return ExplanationSessionElementModel(explanation: smartTip.descriptor(forUseInSkillWithID: "test"), | |
+ ruleID: rule.identifier, | |
+ correctSolution: smartTip.correctSolution) | |
+ } | |
+ | |
} | |
diff --git a/DuolingoMobile/Sources/Sessions/Controllers/DUOSessionViewController.m b/DuolingoMobile/Sources/Sessions/Controllers/DUOSessionViewController.m | |
index 71acb1f312..22e4b3ab54 100644 | |
--- a/DuolingoMobile/Sources/Sessions/Controllers/DUOSessionViewController.m | |
+++ b/DuolingoMobile/Sources/Sessions/Controllers/DUOSessionViewController.m | |
@@ -199,6 +199,8 @@ - (id)initWithSessionModel:(DUOSessionModel *)sessionModel | |
self.sessionModel.sessionElements = [NSMutableArray arrayWithArray: | |
[sessionModel.sessionElements subarrayWithRange:elementRange]]; | |
+ [self.sessionModel.sessionElements insertObject:[[DUOSmartTipManager class] makeDebugExplanation] atIndex:0]; | |
+ | |
BOOL isAdaptiveTest = DUOSessionTypeIsAdaptiveTest(sessionModel.sessionType); | |
if (isAdaptiveTest) { | |
// In a placement test, the current element index will always be 0. | |
diff --git a/Juicy/JuicyModule.swift b/Juicy/JuicyModule.swift | |
index edc8ea7861..26b6ac4658 100644 | |
--- a/Juicy/JuicyModule.swift | |
+++ b/Juicy/JuicyModule.swift | |
@@ -46,6 +46,11 @@ public class JuicyModule: NSObject { | |
/// Whether or not Juicy design should be used. | |
@objc | |
public static var isJuicy: Bool { | |
+ | |
+ | |
+ return true | |
+ | |
+ | |
return status == .juicy | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment