question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve Migration Documentation Around Browser Switch Activity

See original GitHub issue

The migration guide suggests that we use our own activity rather than V3 com.braintreepayments.api.BraintreeBrowserSwitchActivity. But it is unclear what that activity is supposed to do.

MyPaymentsActivity referenced in the manifest snippet isn’t used anywhere else in the guide.

In my use case I have multiple activities that can create a paypal payment method but I am unsure on how I am supposed to handle this.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
sdowardcommented, Jan 10, 2022

@sshropshire To be clear this is not my example, this is your API. All consumers of the lib have to deal with that. If they don’t it is poor practice. It could be considered defensive programming to take care of all code paths.

This means that I want my code to work 100% of the time, I don’t want it to be “highly probable” that it works. So I need to write code to account of these states that shouldn’t happen. The only reason I have to write code for these states is because of the API design.

It is still possible to use SAM interfaces and not have this mixed up state. RxJava would be a good API to use as a reference, it’s really common that one has to receive a successful result or an error. The API looks like so…

Observable.subscribe(@NonNull Consumer<? super T> onNext, @NonNull Consumer<? super Throwable> onError)

public interface Consumer<@NonNull T> {
    void accept(T t) throws Throwable;
}

The generics make it a little more complex than what is actually necessary but you get the idea. If the RxJava devs decided to pass everything as nullable in 1 interface I don’t think it would have had the adoption that it did.

With regards to the either… They are typically complex for the author to write but pretty straight forward for the consumers to consume. You can take a look at kotlins result class for another approach to the same problem

With regards to your target audience… I am a little surprised. I guess that is a business decision but it would be interesting to see where your revenue streams come from… beginner devs or professional apps devs. It seems a little surprising that beginners to java would try and incorporate a payment system into anything they are making.

0reactions
sshropshirecommented, Jan 27, 2022

@gomera not sure exactly what we missed, but we do have an open discussion on improving the developer experience. Feel free to add input. We’re looking to improve the SDK and we welcome merchant feedback.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrate to the Navigation component - Android Developers
Move screen-specific UI logic out of activities · Integrate the Navigation component · Add activity destinations · Combine activities ...
Read more >
browser-switch-android/v2_MIGRATION.md at master - GitHub
See the CHANGELOG for a complete list of changes. This migration guide outlines the basics for updating your browser switch integration from v1...
Read more >
Understanding Data Migration: Strategy and Best Practices
Data migration is the process of moving data from one system to another. See why it's important, and get best practices and key...
Read more >
The Website Migration Guide: SEO Strategy, Process ... - Moz
It's absolutely possible to migrate your site without suffering significant losses, if you do it carefully and correctly.
Read more >
Migration to Google Cloud: Getting started
In an improve and move migration, you modernize the workload while migrating it. In this type of migration, you modify the workloads to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found