Giter Site home page Giter Site logo

Comments (3)

stefan-niedermann avatar stefan-niedermann commented on July 24, 2024

Are there any reasons for not supporting Activity Result API except for the lack of dev time?

In short: Nope. Maybe you want to start a Pull Request? I will happily review it 🙂

from android-singlesignon.

bubelov avatar bubelov commented on July 24, 2024

@stefan-niedermann I don't have a NC instance at the moment, so it would be hard to test the code. Do you know any reliable hosted services? I tried a couple from the official website, one of them was freezing for hours and another one wasn't able to send me an email confirmation for some reason =)

from android-singlesignon.

stefan-niedermann avatar stefan-niedermann commented on July 24, 2024

Do you know any reliable hosted services?

For testing around just use one of those free hosters.

So, I played a bit around with the idea of ActivityResultContracts. I think, we need three different ActivityResultContracts:

  1. CHOOSE_ACCOUNT_SSOChooseAccountContract
  2. REQUEST_AUTH_TOKEN_SSORequestAuthTokenContract
  3. REQUEST_GET_ACCOUNTS_PERMISSIONRequestGetAccountsPermissionContract

Further thoughts:

  1. Do 3rd party apps really need to control the import aspect this detailed? Wouldn't it be better to provide just one ImportSingleSignOnAccountContract which handles the rest of the stuff under the hood?
  2. While implementing ActivityResultContract I stumbled upon the problem, that one needs to override createIntent and parseResult - both methods do not throw any exception according their signature. This leads to the problem, that we can't check and throw NextcloudFilesAppNotInstalledException for example without wrapping it into a RuntimeException or extending SSOException RuntimeException - I don't like any of those approaches. Another idea is to do the check within a constructor, but this again leads to an ugly static initialization from the 3rd party apps perspective:
private final ActivityResultLauncher<Void> launcher;

{
  try {
      launcher = registerForActivityResult(
              new ImportAccountContract(this),
              (ActivityResultCallback<SingleSignOnAccount>) this::onActivityResult
      );
  } catch (NextcloudFilesAppNotInstalledException e) {
      throw new RuntimeException(e);
  }
}

from android-singlesignon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.