-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
🦺[Tech debt] Add configuration to hide / unhide card tab #47
Conversation
- Added test at launch of locale
Implemented switching of the tabs
- Added a EXUS ViewContoller - Added the setup code for both EXUS and TabBar ViewContollers - Basic tests
Added the Locale Detail view
cc: @JasperHeist |
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.
@kcw-grunt , I know you didn't add me as a reviewer but I took a look at it anyways and don't have any issues. I see we have a test that failed. Im not too familiar with how checks work on github, but I guess we should look at that.
I still can't build but i don't think you were mean this pull request would fix that when you mentioned it was a start. So, I can't test it locally but let me know if you'd like to me to approve it, because I didn't find any issues.
Thanks @JasperHeist really appreciate it. I cc'ed you while we get you into the repo org. |
- Clean up of code - Added SwiftUI Locale Detail View
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.
If this sounds good, it seems that all we would need to do is have different list of Storyboard names and ID's. The other changes to the file, the only other change i found is the switch statements which would be fine to stay in the BaseTabViewController
.
|
||
import UIKit | ||
import Foundation | ||
|
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.
Is it feasible to create a BaseTabBarViewController class from this and inherit from that to create the US TabBarViewController since the behavior is nearly identical?
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.
Actually, I would prefer to refactor to a TabView
and set a conditional layout . The problem is this code is quite old and we have limited time to put in the changes.
The app leverages a weird view stack, which is not typical but was inherited from the Bread fork.
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.
Let me review the switch statements...👀
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.
@kcw-grunt yeah agreed with @JasperHeist to have a BaseTabBarViewController since the both TabBarViewController
and NonUSTabBarViewController
are almost the same. But as you said it could take time . So for now let's add it into the technical debt issues
- meeting switch block indentation standards
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.
Ok sounds good to me 👍
Thanks for the 🍀. As you have probably already figured out , the code base is in need of a serious refactor. Yet, we need to make progress as well. |
|
||
let suffix = String(localeId.suffix(3)) | ||
|
||
if suffix == "_US" { |
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.
@kcw-grunt we can simplify the expression like this:
UserDefaults.userIsInUSA = suffix == "_US"
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.
Hey @mosadialiou this is to allow people that are in the US but speak other languages . So, someone that speaks French and has their phone set for french but are in say, New York . This region code would be "fr_US".
So this code truncates the fr
.
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.
@kcw-grunt yeah I understand. I am talking about the code. You can simplify it like I said!
@@ -91,40 +91,61 @@ class MainViewController : UIViewController, Subscriber, LoginViewControllerDele | |||
} | |||
|
|||
func didUnlockLogin() { |
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.
@kcw-grunt refactor this method like this:
func didUnlockLogin() {
var vc : UIViewController
if UserDefaults.userIsInUSA {
vc = UIStoryboard.init(name: "Main", bundle: nil)
.instantiateViewController(withIdentifier: "TabBarViewController")
as? TabBarViewController
} else {
vc = UIStoryboard.init(name: "Main", bundle: nil)
.instantiateViewController(withIdentifier: "NonUSTabBarViewController")
as? NonUSTabBarViewController
}
vc.store = self.store
vc.walletManager = walletManager
addChildViewController(vc, layout: {
vc.view.constrain(toSuperviewEdges: nil)
vc.view.alpha = 0
vc.view.layoutIfNeeded()
})
UIView.animate(withDuration: 0.3,
delay: 0.1,
options: .transitionCrossDissolve,
animations: {
vc.view.alpha = 1
}) { (finished) in
NSLog("\(UserDefaults.userIsInUSA ? US : Ex US) MainView Controller presented")
}
}
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.
Oh that won't work. The classes are custom and inherit so the values can't be passed to the NonUS and Tab ViewControllers
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.
@kcw-grunt hmm I see. Can you do this 👇 ?
func didUnlockLogin() {
var vc : UIViewController
if UserDefaults.userIsInUSA {
guard let usaVC = UIStoryboard.init(name: "Main", bundle: nil)
.instantiateViewController(withIdentifier: "TabBarViewController")
as? TabBarViewController else {
NSLog("TabBarViewController not intialized")
return
}
usaVC.store = self.store
usaVC.walletManager = walletManager
vc = usaVC
} else {
guard let exUSAVC = UIStoryboard.init(name: "Main", bundle: nil)
.instantiateViewController(withIdentifier: "NonUSTabBarViewController")
as? NonUSTabBarViewController else {
NSLog("NonUSTabBarViewController not intialized")
return
}
exUSAVC.store = self.store
exUSAVC.walletManager = walletManager
vc = exUSAVC
}
addChildViewController(vc, layout: {
vc.view.constrain(toSuperviewEdges: nil)
vc.view.alpha = 0
vc.view.layoutIfNeeded()
})
UIView.animate(withDuration: 0.3,
delay: 0.1,
options: .transitionCrossDissolve,
animations: {
vc.view.alpha = 1
}) { (finished) in
NSLog("\(UserDefaults.userIsInUSA ? US : Ex US) MainView Controller presented")
}
}
|
||
import UIKit | ||
import Foundation | ||
|
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.
@kcw-grunt yeah agreed with @JasperHeist to have a BaseTabBarViewController since the both TabBarViewController
and NonUSTabBarViewController
are almost the same. But as you said it could take time . So for now let's add it into the technical debt issues
@mosadialiou going to merge this after the changes you recommended were brought up and tests pass. TYVM. |
@kcw-grunt can you please attach here a screenshot or clip of the localchangeView |
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.
LGTM
3234250
to
2f89a91
Compare
A code base in serious need of a refactor? I've never HEARD of such a thing 🤣 /s |
Problem
The users are using Litewallet and some are located outside the US which means they are unable to use the Litecoin Card. This causes major support issues and generally makes Litewallet bad as a product. There is also alot confusion about what the Card does and who does what.
Fixes device locale and the users ability to see the Card tab and it will reduce the confusion
Approach
TabView
a US and Non-US TabViewController is usedKeywords
Closes #40