-
Notifications
You must be signed in to change notification settings - Fork 45
SQ-60/Check remote config for onboarding #256
SQ-60/Check remote config for onboarding #256
Conversation
Still needs cleaning up
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.
Few questions 💃
@@ -21,6 +23,8 @@ public static RoutingComponent obtain(Activity activity) { | |||
.navigationModule(new NavigationModule()) | |||
.signInModule(new SignInModule()) | |||
.routingModule(new RoutingModule()) | |||
.proximityFeatureModule(new ProximityFeatureModule()) |
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.
Why does this have the proximity feature?
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.
Used by the Onboarding
class (through the OnboardingModule
) to decide whether we can show the Proximity onboarding page (https://github.com/rock3r/squanchy/pull/256/files#diff-e08306406758fca42ffe92c82be63267R35)
} | ||
|
||
@Override | ||
public void featureDisabled() { |
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.
can we have Timber.e
something here? This shouldn't happen I suppose (as in you shouldn't get here to start with if the feature is disabled)
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.
abc912e (same for the SettingsFragment
)
}; | ||
} | ||
|
||
private void showNonFatalProximityError(Snackbar snackbar) { |
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.
can we do the same as showFatalProximityError
? As in passing only the @StringRes
and making the snackbar here.
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 will have to make it more complicated because some snackbars have actions
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. Used to. Failed miserably and now we have two things that show the same message. That is bad. Will fix
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.
Don't really care about that case that was covered by the snackbar actions, so I will simply uniform all the things.
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.
public class BluetoothModule { | ||
|
||
@Provides | ||
BluetoothManager bluetoothManager(Activity activity) { |
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.
do you really need an activity? what about a context?
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.
Good luck injecting a Context
. Dagger will explode because there's different kinds of Context
, Application
and Activity
, and it doesn't know which one to use. This could, I suppose, use an Application
instead. But no, you cannot have a @Provide Context
if you need to also distinguish between Activity
and Application
in other modules (which is our case).
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.
You technically could 😅 using a qualifier :P but ok
@@ -15,9 +15,9 @@ | |||
|
|||
boolean anyUnsatisfied() { | |||
for (Precondition precondition : preconditions) { | |||
boolean canCheck = precondition.performsSynchronousSatisfiedCheck(); | |||
//boolean canCheckIfSatisfied = precondition.performsSynchronousSatisfiedCheck(); |
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.
do you need this?
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.
No, will take out
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.
.addApi(LocationServices.API) | ||
.build(); | ||
|
||
SettingsFragmentComponent component = SettingsInjector.obtainForFragment( |
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.
why is there an obtainForFragment
method?
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.
Two different components (Activity and Fragment), one injector
return new ProximityPreconditions.Callback() { | ||
@Override | ||
public void notOptedIn() { | ||
showProximityEnablingError(Snackbar.make(getViewOrThrow(), R.string.proximity_error_not_opted_in, Snackbar.LENGTH_LONG)); |
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.
I think you can encapsulate Snackbar.make
inside showProximityEnablingError
and pass only the message
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.
Done already in 615db96 addressing the equivalent comment in LocationOnboardingActivity
. This was once used to offer actions in snackbars, then I took them out and forgot to re-simplify this. Sorry.
app/src/main/res/values/strings.xml
Outdated
<string name="onboarding_error_location_failed_action">ENABLE MANUALLY</string> | ||
<string name="onboarding_error_google_client_connection">Unable to verify location settings for the device. Please try again shortly.</string> | ||
|
||
<string name="proximity_error_not_opted_in">Sorry, unable to opt in because… you’re not opted in? If that makes any sense.</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.
you didn't opt in? It's not like a state in which you are 👅
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.
It's an illegal state, someone started the preconditions satisfaction action (which is meant to be run after opting in) while not opted in :)
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.
Yeah but what I meant is "You're not opted in" isn't correct, the correct form is "You didn't opt in"
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.
app/src/main/res/values/strings.xml
Outdated
|
||
<string name="proximity_error_not_opted_in">Sorry, unable to opt in because… you’re not opted in? If that makes any sense.</string> | ||
<string name="proximity_error_remote_config_kill_switch">Sorry, the feature has been disabled remotely.</string> | ||
<string name="proximity_error_permission_denied">We need the location permission to continue.</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.
the proximity_error_location_denied
string is the same
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.
app/src/main/res/values/strings.xml
Outdated
<string name="proximity_error_location_denied">We need the location permission to continue.</string> | ||
<string name="proximity_error_bluetooth_denied">We need the Bluetooth to be active to continue.</string> | ||
<string name="proximity_error_location_failed">Unable to verify location settings for the device.</string> | ||
<string name="proximity_error_location_failed_action">ENABLE MANUALLY</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.
what is this? XD
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.
Old thing. Will take out.
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.
This PR is HUGE and I'm really sorry about that but I went up and down paths that led me nowhere. I have tidied things up as much as I could but it's still a significant amount of changes, because the original idea turned out to be somewhat flawed. Sorryyyyy
The idea is that now we have a
ProximityFeature
that checks whether the Bluetooth is available on the device, and if the kill switch has not been pulled. There's a lot of refactoring and cleaning (hence a noisy diff).Next (and last) step is to understand why the preferences don't look disabled when they are, and possibly use the
Feature
in thePreconditions
to reduce duplication.