-
Notifications
You must be signed in to change notification settings - Fork 34
User registration for new exam target #312
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
Conversation
Add compile sources files to the ExamEGERussian target to be able to use Stepic API's.
Create: - Auth.plist - holds own the keys for performing API requests - Config.plist - contains API's endpoints URL's
Create: - UserRegistrationService - for anonymous user registration and login - UserSubscriptionsService - for managing user subscriptions preferences
Create RootNavigationManager and assembly for services.
|
@vanyaland в dev ветке обновился PromiseKit, подмерджи себе |
kvld
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Всё очень круто! Давай обсудим/поправим и вмерджим.
|
|
||
| final class ServiceComponentsAssembly: ServiceComponents { | ||
|
|
||
| // MARK: Object Initialization |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Когда код достаточно декомпозирован, нужды в MARK: особо нет (к тому же, не все используют XCode). Но это ИМХО и если привык и считаешь, что это нужно – ок.
|
|
||
| // MARK: - UserRegistrationService | ||
|
|
||
| let userRegistrationService: UserRegistrationService |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Мы выносим поля перед конструкторами и остальными методами.
| // MARK: UserRegistrationServiceError: Error | ||
|
|
||
| enum UserRegistrationServiceError: Error { | ||
| case userNotRegistered |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Если здесь все ошибки будут с префиксом user-, то имеет смысл его опустить.
|
|
||
| let stepicsAPI: StepicsAPI | ||
|
|
||
| func registerNewUser() -> Promise<User> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Было бы круто шарить этот код с адаптивными, но можно перенести его сюда, а потом заюзать его там.
| @@ -0,0 +1,28 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Раз уж начинаем с чистого листа, то стоит подумать перед тем, как юзать сториборды. Возможно, лучше отдельные xibы для каждого контроллера.
|
|
||
| // MARK: - UserSubscriptionsService - | ||
|
|
||
| protocol UserSubscriptionsService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Пока непонятно, зачем размазывать похожую логику на два сервиса.
Если бы у нас была отдельная работа с профилями, то имело бы смысл отделить её от работы с пользователями, но тут, кажется, не планируется ничего кроме отписки.
|
|
||
| // MARK: - Instance Properties | ||
|
|
||
| var userRegistrationService: UserRegistrationService? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Надеюсь, это для дебага и потом здесь добавится отдельная абстракция между view и бизнес логикой.
| <key>password</key> | ||
| <dict> | ||
| <key>id</key> | ||
| <string>m3uu1NAGnAGFDHRf4S2Wvg1megAjuqwBsX0OUDru</string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это надо закрывать под git-crypt.
|
|
||
| let predicate = NSPredicate(format: "isAuthorized == %@", NSNumber(value: true)) | ||
| let exp = expectation(for: predicate, evaluatedWith: self, handler: nil) | ||
| let result = XCTWaiter.wait(for: [exp], timeout: 5.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Если пишешь тесты с использованием реального API, то есть два варианта:
- замокать API
- отделять их от остальных тестов, потому что на CI они могут отвалиться с таймаутом
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
могут отвалиться
обязательно отвалятся, поправил тебя ![]()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
прерывная интеграция ![]()
Ostrenkiy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Мне нравится. Тему с Assembly слоем (который не является чем-то необходимым, как по мне) хотели имплементить в основном приложении еще прошлой осенью, но после обсуждений и споров решили, что это будет довольно сложно. Классно, если в новом проекте это будет реализовано. Предлагаю с осторожностью относиться к выделению большого количества слоев, так как время на разработку ограничено и излишняя декомпозиция зачастую усложняет восприятие кода.
А вообще Влад очень много полезных комментариев оставил, мне в принципе особо нечего добавить.
|
@Ostrenkiy, @kvld, спасибо за комментарии. Согласен, возможно я преждевременной оптимизацией занимаюсь и только все усложняю. |
|
Тесты не хочется сейчас пока поправлять? |
|
@Ostrenkiy Хочется, нужно еще поразбираться, т.к. с моками и библиотеками для них не знаком. |
|
Отпишусь как будет готово для ревью. |
- Delete Main.storyboard file - Create MainViewController.xib file - Create UIViewController from nib instantiation extensions
| // MARK: Public API | ||
|
|
||
| func setup(with window: UIWindow) { | ||
| let mainController: MainViewController = MainViewController.fromNib() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MainViewController.fromNib() – это то же самое, что просто MainViewController(), если есть xib с именем MainViewController.xib
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ага, открыл для себя магию 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
И я
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/*
The designated initializer. If you subclass UIViewController, you must call the super implementation of this
method, even if you aren't using a NIB. (As a convenience, the default init method will do this for you,
and specify nil for both of this methods arguments.) In the specified NIB, the File's Owner proxy should
have its class set to your view controller subclass, with the view outlet connected to the main view. If you
invoke this method with a nil nib name, then this class' -loadView method will attempt to load a NIB whose
name is the same as your view controller's class. If no such NIB in fact exists then you must either call
-setView: before -view is invoked, or override the -loadView method to set up your views programatically.
*/
public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?)
|
@kvld @Ostrenkiy вроде бы все замечания поправил. |
Задача: #APPS-1940
Коротко для Release Notes, в формате «Сделали/Добавили/Исправили N»:
ExamEGERussianдля приложения экзаменов по русскому языку.Compile Sourcesдля работы API.Описание:
Анонимная авторизация пользователя в модули для экзаменов по русскому языку.
Сорян, неудобно будет проверять, нужно было разбить на несколько PR :)