Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifications request after action #245

Merged
merged 18 commits into from
Mar 12, 2018
Merged

Conversation

Ostrenkiy
Copy link
Contributor

@Ostrenkiy Ostrenkiy commented Mar 6, 2018

Задача: #APPS-1792 #APPS-1732

Коротко для Release Notes, в формате «Сделали/Добавили/Исправили N»:
Запрашиваем разрешение на уведомления красиво и в тот момент, когда пользователь хочет ответить "да"

Описание:
С помощью NotificationPermissionManager теперь контролируем то, как пользователь записывается на уведомления. В алерте показываем анимацию с колокольчиком с помощью Lottie. С помощью NotificationSuggestionManager мы контролируем частоту и интервалы показа уведомлений. StreakAlertViewController превратили в NotificationRequestAlertViewController, который переиспользуем для отображения алертов про разрешение нотификаций.

TODO

  • StreakAlertViewController -> NotificationRequestAlertViewController, в котором можно выбирать отображаемый текст в зависимости от контекста.
  • Запрос на уведомления с алертом при входе на вкладку "Уведомления"
  • Запрос на уведомления с алертом при записи на курс
  • Убедиться, что все работает на iOS 9
  • Добавить аналитику

@Ostrenkiy Ostrenkiy added the main label Mar 6, 2018
@Ostrenkiy Ostrenkiy added this to the 1.54 milestone Mar 6, 2018
@Ostrenkiy Ostrenkiy self-assigned this Mar 6, 2018
@Ostrenkiy Ostrenkiy requested a review from kvld March 6, 2018 12:08
@Ostrenkiy
Copy link
Contributor Author

@kvld надо смотреть

@kvld
Copy link
Contributor

kvld commented Mar 7, 2018

@Ostrenkiy а оставшиеся пункты в TODO?

@@ -114,7 +118,7 @@ class BaseCardsStepsPresenter: CardsStepsPresenter, StepCardViewDelegate {
return true
}

init(stepsAPI: StepsAPI, lessonsAPI: LessonsAPI, recommendationsAPI: RecommendationsAPI, unitsAPI: UnitsAPI, viewsAPI: ViewsAPI, ratingsAPI: AdaptiveRatingsAPI, ratingManager: AdaptiveRatingManager, statsManager: AdaptiveStatsManager, storageManager: AdaptiveStorageManager, lastViewedUpdater: LocalProgressLastViewedUpdater, course: Course?, view: CardsStepsView) {
init(stepsAPI: StepsAPI, lessonsAPI: LessonsAPI, recommendationsAPI: RecommendationsAPI, unitsAPI: UnitsAPI, viewsAPI: ViewsAPI, ratingsAPI: AdaptiveRatingsAPI, ratingManager: AdaptiveRatingManager, statsManager: AdaptiveStatsManager, storageManager: AdaptiveStorageManager, lastViewedUpdater: LocalProgressLastViewedUpdater, notificationSuggestionManager: NotificationSuggestionManager, notificationPermissionManager: NotificationPermissionManager, course: Course?, view: CardsStepsView) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это не ломает ничего в адаптивных таргетах?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Скорее всего ломает, сейчас посмотрю

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

пофиксил

case .authorized:
self?.selectStreakNotificationTime()
case .denied:
//TODO: Add dialog to tell user he should have permitteed the notifications
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не делаем?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пока нет

@@ -18,25 +18,40 @@ class StreaksStepikAlertManager: AlertManager, StreaksAlertPresentationDelegate
// controller.present(alert, animated: true, completion: nil)
}

//TODO: Add DI here
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не добавляем?

@@ -132,6 +133,10 @@ class CardsStepsViewController: UIViewController, CardsStepsView {
state = .congratulation
Alerts.congratulation.present(alert: controller, inController: ControllerHelper.getTopViewController() ?? self)
}

func present(alertManager: AlertManager, alert: UIViewController) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

На самом деле, метод showCongratulationPopup выше делает почти то же самое. И кажется, что он теперь не нужен. Надо или переделать сразу или как-то пометить, наверное, чтобы выпилить не в рамках этого пулл-реквеста.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пока не будем выпиливать

lastStreakAlertShownTime = Date().timeIntervalSince1970
private func setLastAlertShownTime(time: TimeInterval, for context: NotificationRequestAlertContext) {
defaults.set(time, forKey: lastTimeKey(for: context))
defaults.synchronize()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

На самом деле

synchronize()
Waits for any pending asynchronous updates to the defaults database and returns; this method is unnecessary and shouldn't be used.

@@ -401,5 +401,12 @@ LessonDownloadTooltip = "Download lesson ";
ContinueLearningWidgetTooltip = "Tap to continue from where you finished last time";
StreaksSwitchTooltip = "Turn on to get new portion of knowledge every day";

/* Notification alerts */
NotificationTabNotificationRequestAlertTitle = "Stay tuned";
NotificationTabNotificationRequestAlertMessage = "We are trying to make learning process effective and comfortable. Enable notifications to follow discussions and promptly recieve courses updates?";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recieve -> receive

NotificationTabNotificationRequestAlertMessage = "We are trying to make learning process effective and comfortable. Enable notifications to follow discussions and promptly recieve courses updates?";

CourseSubscriptionNotificationRequestAlertTitle = "Stay tuned";
CourseSubscriptionNotificationRequestAlertMessage = "We are trying to make learning process effective and comfortable. Enable notifications to follow deadlines and promptly recieve course updates?";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recieve -> receive

@Ostrenkiy Ostrenkiy merged commit 8c82194 into dev Mar 12, 2018
@Ostrenkiy Ostrenkiy deleted the feature/notifications-after-action branch March 12, 2018 10:41
@kvld kvld mentioned this pull request Mar 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants