         licenseLabel.attributedText = licenseLabelAttributedString
         loginLabel.attributedText = loginLabelAttributedString
     }
-    
+
+    private var titleDescriptionFor: NSAttributedString {
+        let formatString = WMFLocalizedString("description-edit-for-article", value: "Title description for %1$@", comment: "String describing which article title description is being edited. %1$@ is replaced with the article title")
+        return String.localizedStringWithFormat(formatString, article?.displayTitleHTML ?? "").byAttributingHTML(with: .headline, matching: traitCollection)
+    }
+    
+    private func characterCountWarningString(for descriptionCharacterCount: Int) -> String? {
+        guard descriptionCharacterCount > 0 else {
+            return nil
+        }
+        return String.localizedStringWithFormat(WMFLocalizedString("description-edit-length-warning", value: "%1$@ / %2$@", comment: "Displayed to indicate how many description characters were entered. Separator can be customized depending on the language. %1$@ is replaced with the number of characters entered, %2$@ is replaced with the recommended maximum number of characters."), String(descriptionCharacterCount), String(showWarningIfDescriptionLongerThanCount))
+    }
+    
+    private var licenseLabelAttributedString: NSAttributedString {
+        let formatString = WMFLocalizedString("description-edit-license", value: "By changing the title description, I agree to the %1$@ and to irrevocably release my contributions under the %2$@ license.", comment: "Button text for information about the Terms of Use and edit licenses. Parameters:\n* %1$@ - 'Terms of Use' link, %2$@ - license name link")
+        
+        let baseAttributes: [NSAttributedString.Key: Any] = [
+            NSAttributedString.Key.foregroundColor : theme.colors.secondaryText,
+            NSAttributedString.Key.font : licenseLabel.font // Grab font so we get font updated for current dynamic type size
+        ]
+        let linkAttributes: [NSAttributedString.Key: Any] = [
+            NSAttributedString.Key.foregroundColor : theme.colors.link
+        ]
+        return formatString.attributedString(attributes: baseAttributes, substitutionStrings: [Licenses.localizedSaveTermsTitle, Licenses.localizedCCZEROTitle], substitutionAttributes: [linkAttributes, linkAttributes])
+    }
+    
+    private var loginLabelAttributedString: NSAttributedString {
+        let formatString = CommonStrings.editAttribution
+        
+        let baseAttributes: [NSAttributedString.Key: Any] = [
+            NSAttributedString.Key.foregroundColor : theme.colors.secondaryText,
+            NSAttributedString.Key.font : loginLabel.font // Grab font so we get font updated for current dynamic type size
+        ]
+        let linkAttributes: [NSAttributedString.Key: Any] = [
+            NSAttributedString.Key.foregroundColor : theme.colors.link
+        ]
+        return formatString.attributedString(attributes: baseAttributes, substitutionStrings: [CommonStrings.editSignIn], substitutionAttributes: [linkAttributes])
+    }
+    
+    @IBAction private func descriptionPlaceholderLabelTapped() {
+        isPlaceholderLabelHidden = true
+    }
+
     @IBAction func showAboutWikidataPage() {
         wmf_openExternalUrl(URL(string: "https://m.wikidata.org/wiki/Wikidata:Introduction"))
     }
     
-    override func viewWillAppear(_ animated: Bool) {
-        super.viewWillAppear(animated)
-        enableProgressiveButton(false)
-        loginLabel.isHidden = WMFAuthenticationManager.sharedInstance.isLoggedIn
-    }
-    
-    override func viewDidAppear(_ animated: Bool) {
-        super.viewDidAppear(animated)
-        descriptionTextView.becomeFirstResponder()
-    }
-    
-    override func viewWillDisappear(_ animated: Bool) {
-        super.viewWillDisappear(animated)
-        enableProgressiveButton(false)
-    }
-
-    func enableProgressiveButton(_ highlight: Bool) {
-        publishDescriptionButton.isEnabled = highlight
+    @IBAction func licenseTapped() {
+        let sheet = UIAlertController.init(title: nil, message: nil, preferredStyle: .alert)
+        sheet.addAction(UIAlertAction.init(title: Licenses.localizedSaveTermsTitle, style: .default, handler: { _ in
+            self.wmf_openExternalUrl(Licenses.saveTermsURL)
+        }))
+        sheet.addAction(UIAlertAction.init(title: Licenses.localizedCCZEROTitle, style: .default, handler: { _ in
+            self.wmf_openExternalUrl(Licenses.CCZEROURL)
+        }))
+        sheet.addAction(UIAlertAction.init(title: CommonStrings.cancelActionTitle, style: .cancel, handler: nil))
+        present(sheet, animated: true, completion: nil)
+    }
+    
+    @IBAction func loginTapped() {
+        wmf_showLoginViewController(theme: theme)
     }
 
     @IBAction private func publishDescriptionButton(withSender sender: UIButton) {
         save()
     }
 
+    @objc func closeButtonPushed(_ : UIBarButtonItem) {
+        dismiss(animated: true, completion: nil)
+    }
+
+    private func enableProgressiveButton(_ highlight: Bool) {
+        publishDescriptionButton.isEnabled = highlight
+    }
+
     private func save() {
         wmf_hideKeyboard()
         

// - change title to "add description" if no descrip!

class DescriptionEditViewController: WMFScrollViewController, Themeable, UITextViewDelegate {
    
    private var licenseLabelAttributedString: NSAttributedString {
        let formatString = WMFLocalizedString("description-edit-license", value: "By changing the title description, I agree to the %1$@ and to irrevocably release my contributions under the %2$@ license.", comment: "Button text for information about the Terms of Use and edit licenses. Parameters:\n* %1$@ - 'Terms of Use' link, %2$@ - license name link")
        
        let baseAttributes: [NSAttributedString.Key: Any] = [
            NSAttributedString.Key.foregroundColor : theme.colors.secondaryText,
            NSAttributedString.Key.font : licenseLabel.font // Grab font so we get font updated for current dynamic type size
        ]
        let linkAttributes: [NSAttributedString.Key: Any] = [
            NSAttributedString.Key.foregroundColor : theme.colors.link
        ]
        return formatString.attributedString(attributes: baseAttributes, substitutionStrings: [Licenses.localizedSaveTermsTitle, Licenses.localizedCCZEROTitle], substitutionAttributes: [linkAttributes, linkAttributes])
    }

    private var loginLabelAttributedString: NSAttributedString {
        let formatString = CommonStrings.editAttribution
        
        let baseAttributes: [NSAttributedString.Key: Any] = [
            NSAttributedString.Key.foregroundColor : theme.colors.secondaryText,
            NSAttributedString.Key.font : loginLabel.font // Grab font so we get font updated for current dynamic type size
        ]
        let linkAttributes: [NSAttributedString.Key: Any] = [
            NSAttributedString.Key.foregroundColor : theme.colors.link
        ]
        return formatString.attributedString(attributes: baseAttributes, substitutionStrings: [CommonStrings.editSignIn], substitutionAttributes: [linkAttributes])
    }

    @objc var article: WMFArticle? = nil

    @IBAction func licenseTapped() {
        let sheet = UIAlertController.init(title: nil, message: nil, preferredStyle: .alert)
        sheet.addAction(UIAlertAction.init(title: Licenses.localizedSaveTermsTitle, style: .default, handler: { _ in
            self.wmf_openExternalUrl(Licenses.saveTermsURL)
        }))
        sheet.addAction(UIAlertAction.init(title: Licenses.localizedCCZEROTitle, style: .default, handler: { _ in
            self.wmf_openExternalUrl(Licenses.CCZEROURL)
        }))
        sheet.addAction(UIAlertAction.init(title: CommonStrings.cancelActionTitle, style: .cancel, handler: nil))
        present(sheet, animated: true, completion: nil)
    }
    
    @IBAction func loginTapped() {
        wmf_showLoginViewController(theme: theme) // should this func add a funnel as seen below?
/*
WMFLoginViewController *loginVC = [WMFLoginViewController wmf_initialViewControllerFromClassStoryboard];
loginVC.funnel = [[WMFLoginFunnel alloc] init];
[loginVC.funnel logStartFromEdit:self.funnel.editSessionToken];
[loginVC applyTheme:self.theme];
UINavigationController *nc = [[WMFThemeableNavigationController alloc] initWithRootViewController:loginVC theme:self.theme];
[self presentViewController:nc animated:YES completion:nil];
*/
    }

/*
override func didReceiveMemoryWarning() {
    guard view.superview != nil else {
        return
    }
    dismiss(animated: true, completion: nil)
}
*/

    public func textViewDidChange(_ textView: UITextView) {
        guard let description = descriptionTextView.text else{
            enableProgressiveButton(false)
            return
        }
        descriptionTextView.normalizeWhitespace()
        enableProgressiveButton(description.count > 0)
        updateWarningLabelsForDescriptionCount()
    }

    @IBOutlet private var learnMoreButton: UIButton!
    @IBOutlet private var subTitleLabel: UILabel!
    @IBOutlet private var descriptionTextView: UITextView!

        }
    }
    
    public func textViewDidBeginEditing(_ textView: UITextView) {
        isPlaceholderLabelHidden = shouldHidePlaceholder()
    }
