[ios] Fix isolines reminder being displayed on top of other dialogs #7694

Merged
v-lozko merged 3 commits from Isoline into master 2024-04-05 22:16:20 +00:00
v-lozko commented 2024-03-26 00:40:44 +00:00 (Migrated from github.com)

Fixing issue #7555 by adding capability to hide toast when view disappears. Also addressed potential other cases.

https://github.com/organicmaps/organicmaps/assets/156805389/b8c4d10a-56ca-4544-9417-61b4eab98f79

Tested on iPhone 15 simulator

Fixing issue #7555 by adding capability to hide toast when view disappears. Also addressed potential other cases. https://github.com/organicmaps/organicmaps/assets/156805389/b8c4d10a-56ca-4544-9417-61b4eab98f79 Tested on iPhone 15 simulator
biodranik (Migrated from github.com) approved these changes 2024-03-26 22:20:34 +00:00
biodranik (Migrated from github.com) left a comment

Great!

Please also check DCO. If you need to set a different email for OM, you can edit .git/config file in organicmaps repo.

Great! Please also check DCO. If you need to set a different email for OM, you can edit .git/config file in organicmaps repo.
biodranik (Migrated from github.com) reviewed 2024-03-27 21:25:42 +00:00
biodranik (Migrated from github.com) left a comment

Thanks! @kirylkaveryn WDYT?

Thanks! @kirylkaveryn WDYT?
kirylkaveryn reviewed 2024-03-30 10:38:20 +00:00

It seems like the onTimer() method can be removed now and you can pass the hide in selector.

It seems like the `onTimer()` method can be removed now and you can pass the `hide` in selector.

I'm not sure about this approach... to store toast on every controller that we have in the project (where it needed of cours). And the other issue can happen: sometimes we can have 2-3 toasts at the same time (not in the current place, but in the PlacePage) and when we call hide() manually we will close only the last toast stored in the property.
Maybe it would be better to incapsulate toast logic inside of Toast class and store toasts in the static property?
With this approach we can hide all toasts from every place we want.
Some kine of:

class Toast {
// ...
static private var toasts: [Toast] = []
static func hideAll() {
  toasts.forEach { $0.hide }
}
func show(...) {
  Toast.appent(toast)
  // ... showing code ... 
}

func hide(...) {
  //... hiding code ...
  Toast.remove(toast)
}

@biodranik what do you think?

I'm not sure about this approach... to store toast on every controller that we have in the project (where it needed of cours). And the other issue can happen: sometimes we can have 2-3 toasts at the same time (not in the current place, but in the PlacePage) and when we call `hide()` manually we will close only the last toast stored in the property. Maybe it would be better to incapsulate toast logic inside of Toast class and store toasts in the static property? With this approach we can hide all toasts from every place we want. Some kine of: ```swift class Toast { // ... static private var toasts: [Toast] = [] static func hideAll() { toasts.forEach { $0.hide } } func show(...) { Toast.appent(toast) // ... showing code ... } func hide(...) { //... hiding code ... Toast.remove(toast) } ``` @biodranik what do you think?
biodranik (Migrated from github.com) reviewed 2024-03-30 21:20:16 +00:00
biodranik (Migrated from github.com) commented 2024-03-30 21:20:16 +00:00

In the long term, it would be great if users could read all toasts without overlapping each other if they appear simultaneously (e.g. stack them, or show one after another). A simpler way to control toast visibility is also great.

How does Apple solve toast issue?

In the long term, it would be great if users could read all toasts without overlapping each other if they appear simultaneously (e.g. stack them, or show one after another). A simpler way to control toast visibility is also great. How does Apple solve toast issue?
kirylkaveryn reviewed 2024-03-31 05:32:34 +00:00

Apple doesn't have toasts at all. Only push notifications.
This is why toasts are so different from an app to app.

Storing all toasts logic inside the Toast class helps us in the future to handle the toasts queue properly with animations and gesture recognizers.

Apple doesn't have toasts at all. Only push notifications. This is why toasts are so different from an app to app. Storing all toasts logic inside the Toast class helps us in the future to handle the toasts queue properly with animations and gesture recognizers.
v-lozko (Migrated from github.com) reviewed 2024-04-02 12:59:24 +00:00
v-lozko (Migrated from github.com) commented 2024-04-02 12:59:24 +00:00

So, what are the next steps regarding this issue? Would you like me to edit the commit and remove the onTimer method?

So, what are the next steps regarding this issue? Would you like me to edit the commit and remove the onTimer method?
biodranik (Migrated from github.com) reviewed 2024-04-02 20:58:23 +00:00
biodranik (Migrated from github.com) commented 2024-04-02 20:58:23 +00:00

@v-lozko is it hard to implement it in a way described by @kirylkaveryn ? What do you think about that approach?

@v-lozko is it hard to implement it in a way described by @kirylkaveryn ? What do you think about that approach?
v-lozko (Migrated from github.com) reviewed 2024-04-03 18:00:37 +00:00
v-lozko (Migrated from github.com) reviewed 2024-04-03 20:28:28 +00:00
v-lozko (Migrated from github.com) commented 2024-04-03 20:28:28 +00:00

@biodranik , @kirylkaveryn I made the changes as suggested. Seems to work correctly

https://github.com/organicmaps/organicmaps/assets/156805389/e08717e5-3406-49a8-bc18-aa59e9646f2e

@biodranik , @kirylkaveryn I made the changes as suggested. Seems to work correctly https://github.com/organicmaps/organicmaps/assets/156805389/e08717e5-3406-49a8-bc18-aa59e9646f2e
biodranik (Migrated from github.com) reviewed 2024-04-04 22:09:59 +00:00
biodranik (Migrated from github.com) commented 2024-04-04 22:09:18 +00:00

Why a copy is needed?

Why a copy is needed?
kirylkaveryn reviewed 2024-04-05 07:29:41 +00:00
@ -7,11 +7,20 @@ final class Toast: NSObject {
}
  @objc static func hideAll() {
```suggestion @objc static func hideAll() { ```

nit: it's better to write in single line easy iterations toastsCopy.forEach { $0.hide() }

nit: it's better to write in single line easy iterations `toastsCopy.forEach { $0.hide() }`
@ -85,0 +97,4 @@
if self.blurView.superview != nil {
UIView.animate(withDuration: kDefaultAnimationDuration,
animations: { self.blurView.alpha = 0 }) { [self] _ in
self.blurView.removeFromSuperview()

I think it's better to try to place this line into the UIView.animate's completion handler to remove the toast instance as a final step.

I think it's better to try to place this line into the `UIView.animate`'s completion handler to remove the toast instance as a final step.
v-lozko (Migrated from github.com) reviewed 2024-04-05 11:40:14 +00:00
v-lozko (Migrated from github.com) commented 2024-04-05 11:40:14 +00:00

Was afraid of mutating the array while iterating over it. Doing a little looking it seems like it doesn't matter so i can make the change

Was afraid of mutating the array while iterating over it. Doing a little looking it seems like it doesn't matter so i can make the change
kirylkaveryn approved these changes 2024-04-05 18:39:12 +00:00
biodranik (Migrated from github.com) approved these changes 2024-04-05 22:15:55 +00:00
biodranik (Migrated from github.com) left a comment

Great, thanks for your contribution!

Great, thanks for your contribution!
This repo is archived. You cannot comment on pull requests.
No labels
Accessibility
Accessibility
Address
Address
Android
Android
Android Auto
Android Auto
Android Automotive (AAOS)
Android Automotive (AAOS)
API
API
AppGallery
AppGallery
AppStore
AppStore
Battery and Performance
Battery and Performance
Blocker
Blocker
Bookmarks and Tracks
Bookmarks and Tracks
Borders
Borders
Bug
Bug
Build
Build
CarPlay
CarPlay
Classificator
Classificator
Community
Community
Core
Core
CrashReports
CrashReports
Cycling
Cycling
Desktop
Desktop
DevEx
DevEx
DevOps
DevOps
dev_sandbox
dev_sandbox
Directions
Directions
Documentation
Documentation
Downloader
Downloader
Drape
Drape
Driving
Driving
Duplicate
Duplicate
Editor
Editor
Elevation
Elevation
Enhancement
Enhancement
Epic
Epic
External Map Datasets
External Map Datasets
F-Droid
F-Droid
Fonts
Fonts
Frequently User Reported
Frequently User Reported
Fund
Fund
Generator
Generator
Good first issue
Good first issue
Google Play
Google Play
GPS
GPS
GSoC
GSoC
iCloud
iCloud
Icons
Icons
iOS
iOS
Legal
Legal
Linux Desktop
Linux Desktop
Linux packaging
Linux packaging
Linux Phone
Linux Phone
Mac OS
Mac OS
Map Data
Map Data
Metro
Metro
Navigation
Navigation
Need Feedback
Need Feedback
Night Mode
Night Mode
NLnet 2024-06-281
NLnet 2024-06-281
No Feature Parity
No Feature Parity
Opening Hours
Opening Hours
Outdoors
Outdoors
POI Info
POI Info
Privacy
Privacy
Public Transport
Public Transport
Raw Idea
Raw Idea
Refactoring
Refactoring
Regional
Regional
Regression
Regression
Releases
Releases
RoboTest
RoboTest
Route Planning
Route Planning
Routing
Routing
Ruler
Ruler
Search
Search
Security
Security
Styles
Styles
Tests
Tests
Track Recording
Track Recording
Translations
Translations
TTS
TTS
UI
UI
UX
UX
Walk Navigation
Walk Navigation
Watches
Watches
Web
Web
Wikipedia
Wikipedia
Windows
Windows
Won't fix
Won't fix
World Map
World Map
No milestone
No project
No assignees
2 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: organicmaps/organicmaps-tmp#7694
No description provided.