Skip to content

Changed CredentialProviders to allow easier extending of existing CredentialProviders #350

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

Merged

Conversation

s7092910
Copy link
Collaborator

Changes made:

  • Changed private fields in GoogleUserCredentialProvider and PTCCredentialProvider to protected so they are visible in child classes.
  • Allows easier modifications of these classes outside of the API.

…rs for API users without having to rewrite the whole class.
@Jari27
Copy link
Contributor

Jari27 commented Jul 29, 2016

Right now there are only PTC and Google logins. I don't see that changing in the near feature. If it doesn't, less visibility is better, imho.

Thoughts?

@vmarchaud
Copy link
Contributor

If you want to make change to a provider, why not implementing your own since the interface is public ? It should be simpler for you i think.

@s7092910
Copy link
Collaborator Author

@vmarchaud that is what I told the rest of my team, but they said it would be better to extend the already existing CredentialProvider. And they wanted me to make this PR. But I would say this would be a nice idea, for instance I know people have been asking for a method in the PTCCredentialProvider to take in a TokenId. This in theory would allow them to do that along with if they want to change a bit of how the internals of the Provider works, without having to rewrite everything.

@vmarchaud
Copy link
Contributor

vmarchaud commented Jul 29, 2016

@s7092910
I agree that the lib is actually may be too high level for people that know who the networking is done, thats why i'm making another lib (that maybe will get introduced into the java implementation) that doesnt force any implementation of auth, just provide interface to do it.
In regard of your PR, wait for @Grover-c13 for this PR, i personally prefer that your team make their provider has they want to over allow the modification of our provider.

@rajulbhatnagar
Copy link
Contributor

If you want to implement your provider to suit your needs you can do so by implementing the interface however I do feel that making those fields protected is reasonable enough. I dont see any downside to it. @vmarchaud Do you see any downsides to this?

@Grover-c13
Copy link
Owner

@s7092910 are you on the PKRE slack?

@s7092910
Copy link
Collaborator Author

@Grover-c13 No I'm not, do you want me to join?

@Grover-c13
Copy link
Owner

nothing major just wanted to discuss something relating to the login providers and the API :P

@Grover-c13 Grover-c13 merged commit adb4c3a into Grover-c13:Development Jul 31, 2016
Grover-c13 added a commit that referenced this pull request Aug 1, 2016
* Refresh the OAuth token when it expires

* Fix my siliness and provide API consumers a way to provide their refresh token when using static auth

* add query from hatched eggs + rewrite stuff around EggPokemon

* fix the explaination for eclipse user

* Level enum public for custom loggers

* Publish sources jar

Fixes #128

* add license to GoogleLoginSecrets

* Use a reset instead of using another instance

* Fix the checkstyle config to not break other modules

* find Pokemon by ID
update inventory after hatching eggs
add missing license

* Meta info on pokemon

* add method the incubator

* fix typo

* Add a callback for when the Initial oAuth completes so that the app can automate the flow

* Power up pokemon API

* Add info about native google sign in

* REAME.md: fix Usefull->Useful typo

* README.md: fix PtcLogin classname type

* fix force updating inventories

* Fix incorrect static statements on point

* Added iv calculator (#207)

* Added iv calculator

* checkstyleMain fix

* Fix @returns in doc of getIVRatio()

* take care that the candies actually are in the map

* forgot that cancerous check style

* tweak checkstyle config to be friendly (#226)

* Add cause to LoginFailedExceptions. (#220)

Signed-off-by: Niklas Walter <[email protected]>

* Remove printStackTrace from updateProfile (#221)

updateProfile, in case of failure, would dump stacktraces to the console and then crash in the next line with a NullPointerException

* Added request to add modifiers to forts, for example a lure-module on a pokestop (#217)

* implemented request to add fort modifier

* added @throws to javadoc for addModifier in Pokestop.java

* Added SetFavoritePokemon method (#222)

* add lombok to more objects (#212)

* add lombok to more objects

* add lombok to GoogleAuthJson

* add lombok to Team

* getItemsCount function (#224)

* get total space used by items

* get total space used by items

* add javadoc

* Rewrote and Refactored login logic. Now the credential providers transparently handle providing credentials and refreshing tokens.

* Update the protobuf dependency (#235)

Includes fix for hatched eggs IndexOutOfBoundsException

* WIP: Gym/Battle (#203)

* Add info about native google sign in

* fix force updating inventories

* REAME.md: fix Usefull->Useful typo

* README.md: fix PtcLogin classname type

* Start Gym + Battle API

* Battle API - Example included, utility functions to get state of battle. Can only spam attack right now.

* Deprecate pokemon.getFavorite, rename to pokemon.isFavorite (#230)

* deprecate getFavorite, rename to isFavorite

* Adhere to checkstyle

* Use gradle-wrapper instead (#200)

* Use gradle-wrapper instead

* Changed second gradle usage to use gradlew aswell

* Fix typos (#218)

* Fix UTF-8 encoding

* Fix typo recieved -> received

* fix example

* Consistently use RemoteServerException for network/server errors (#243)

* Redone meta pm, lots of info available, several enums for pokemon (some may be duplicates of proto enums), fix catchable pokemon (#246)

* fix #237 + #227 (#240)

* Update protobufs to latest version

* Add getPoints() to gym wrapper (#247)

* Fix #171 - Implement logging levels

* Hypno should actually be in FAMILY_DROWZEE (#262)

* Update README.md (#257)

Clarification on what the function calls do. If we're going to change the API wrapper, we should at least briefly comment on how it works underneath.

* added the ability to use potions & revive on pokemon (#236)

* inizio pozioni pokemon

* inizio pozioni pokemon

* fixed space

* checkstyle fixes

* refresh pokemon stamina after heal/revive

* added a request to accept level up rewards and unlocks (#259)

* Fix silly error

* Rewrite readme with all new stuff

- explain the risk of using this api
- more examples
- got to jitpack to build with maven/graddle
- update contributor

* abstract time behavior to allow mocking and replacing the time by non-System time (#277)

* set time implementation correctly (#282)

make old PtcCredentialProvider constructor @deprecated

* settings via DownloadSettings + protobuf update (#285)

* inizio pozioni pokemon

* inizio pozioni pokemon

* fixed space

* checkstyle fixes

* refresh pokemon stamina after heal/revive

* add support for settings

* add support for settings

* Added CP based calculations (#272)

* Added CP based calculations

* Implemented method instead of lookup

* Added check if meta info exists. Swapped map

* #272 (comment)

* Add usage instructions for Eclipse users (#290)

Many will opt for simply copying the lib to the libs folder, but this
allows building the API project as necessary, while maintaining an
updated version of the lib produced in the target project.
** Intended for only building the target project with Eclipse **

* fix for #279 (#292)

* check and equip badges

* check and equip badges

* Automatic google login with username and password (#265)

* Add gpsoauth dependency

* Add google auto credentials provider

* Add token refresh

* svarzee-Development (#297)

* Add gpsoauth dependency

* Add google auto credentials provider

* Add token refresh

* Checkstyle will not stop you building now, but you are still expected to correct issues before submitting a PR. (#300)

* Checkstyle will not stop you building now, but you are still expected to correct issues before submitting a PR.

fixed issue with checkstyle in google auto login.

* Checkstyle fix

* gdev (#305)

* Checkstyle will not stop you building now, but you are still expected to correct issues before submitting a PR.

fixed issue with checkstyle in google auto login.

* Checkstyle fix

* Added time to new provider

* added time

* added PokemonMoveMeta + Registry (#298)

* created PokemonMoveMeta.java

* added PokemonMoveMetaRegistry

* Update PokemonType.java

* modify build process to generate javadoc and one bundled jar + fix checkstyle (#307)

* add javadoc link to readme

* Added weight getter to Pokemon.java (#309)

* trigger bundle after creating the jar

* bundle is done for every build now

* Added new oauth for google user interaction to supercede GoogleCredentialProvider (example included) added a new hasLure method to Pokestops that is more reliable. Undeprecrated constructors that construct time objects by default (#316)

* delete old google token provider since its working + add explain on example

* Correct, organize, and format README

- Correct spelling, grammar, and punctuation errors
- Format lists into individual steps
- Break comments into smaller segments
- Simplify complex explanations

* fix styles

* Update the readme example to use the latest google provider

* add javadoc

* added getter to get refresh token for GoogleAutoProvider + constructor without Time impl in GoogleUserProvider

* Feature request Issue 311

* - replaced for loop by iterator because of concurrent modification in MapObjects Update method

* update readme with slack invitation link

* hotfix spamming request when constructing PokemonGo instance

* test

* test

* -also changed update method of gyms to use iterator

* Upgrade gpsoauth

* - fixed styling

* Cleaned up some doc blocks (#352)

* Added Util class to get Name for Pokedex Numbers, Also added Translations (#284)

* Added Util class to get NAme for Pokedex Numbers, Also added Translations for those

* Adjusted Files According to Pullrequest Review

* Removed Double License Headeer, Added Missing License Header

* Fixed hasLurePokemon() from always returning false unless the lure module expired and the pokestop was still in memory with a pokemon. It now properly returns true if there is a pokemon at the pokestop and the lure is not expired.

* Async implementation based in Futures (#360)

* Base for async

* Transparent async requests

* Converted map

* Converted map, may have broken cache

* Cleanup leftovers of Rx

* Start on catchable pokemon

* Did some methods on CatchablePokemon. Implemented NestedFutureWrapper to link Futures

* Switched Pokestop

* Some tinkering with timings and forgetting to clear lists

* Exceptions shoudl accept Throwable

* Cleanup of deprecate methods,
Removed sleeps

* Fixed sending garbage

* Actually got it working

* Checkstyle update

* Checkstyle update

* Upped timer a bit because of a few issues with empty requests

* Sync list (#370)

* Add moves to pokemon meta registry (#368)

* Fix get catchablePokemon (#386)

* Sync list

* Hopefully fix map.getObject/getCatchablePokemon issue

* Make constructor lightweight (#388)

* Sync list

* Hopefully fix map.getObject/getCatchablePokemon issue

* Refactor some player profile stuff, make the constructor shorter, made it lazy init (wont call for an update on the server unless you call a method to get data)

* The api constructor will not make any server requests, it will lazy load any sections of the api a person needs (ie callling getInventories will get stuff from the server if its yet to happen). Some extra methods now throw RemoteServer/Login exceptions so please keep that in mind. cleaned up a few things (mainly javadoc).

* Refactor some player profile stuff, make the constructor shorter, made it lazy init (wont call for an update on the server unless you call a method to get data)

* Implemented inventory settings (#376)

* added support for incense activation (#314)

* Changed private fields to protected to allow extending of the Providers for API users without having to rewrite the whole class. (#350)

* Optimize imports (#390)

* Optimize imports

* Optimize imports

* added Japanese pokemon names and fixed garbled characters in Russian and Chinese (#383)

* Fort details should be doubles instead of longs (#393)

* #378 (#392)

* Fix import.*, fix other checkstyle stuff, fix NPE when getting stats (#401)

* Add evolution auxiliaries (#400)

* fix infinite loop when pokemon flees using catch(), removed pokemon from catchable list after being caught/fleeing

* fix infinite loop when pokemon flees using catch(), removed pokemon from catchable list after being caught/fleeing

* catchfix (#404)

* fix infinite loop when pokemon flees using catch(), removed pokemon from catchable list after being caught/fleeing

* fix infinite loop when pokemon flees using catch(), removed pokemon from catchable list after being caught/fleeing

* Lucky egg for spinnix yay

* useLuckyEgg() in ItemBag for spinnix,
Fix NPE on catch result
Fix issue when pokemon broke out of ball
Fix checkstyle issues

* Remove print

* Fixes an ArrayOutOfBoundsException (#411)

Fixes an ArrayOutOfBoundsException in EvolutionInfo.
Currently it takes the length of an array as an index in the array which will result in an exception being thrown anytime this function is called.

* Extra log levels: all and none (#409)

* Extra log levels: all and none

* Fix indentation (tabs only)

* Adding Sorting Map Objects (#396)

* Adding map util to get distance between two points

* Adding sorting function for objects in the map

* Adding the check if the user have enough poke ball´s

* Adding the check if the user have enough poke ball´s

* Adding license

* Fixing example class

* Fix code style

* Updating code style

* Updating code style

* Fixing import

* luresfixesandgoodtimes (#418)

* Added lured pokemon to getCatchablePokemon
removed DummyFuture
Fixed NPE in FutureWrapper when using .just
Fixed issue when caught pokemon will still appearing in catchable pokemon
Added a little more detail to the PTC login exception
Changed exception message from "Error in url" to "Invalid auth status code recieved"

* Checkstyle

* Travis fix

* updated moves (#416)

https://www.reddit.com/r/TheSilphRoad/comments/4v99uo/move_powers_have_been_updated/

* Adding the check if the user have enough poke ball´s (#397)

* Adding the check if the user have enough poke ball´s

* Adding the check if the user have enough poke ball´s

* Fixing example class

* Fix code style

* updating submodule to latest (#419)
@s7092910 s7092910 deleted the OpenUpCredentialProvider branch February 22, 2017 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants