Skip to content
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

How to build with your own token #3485

Open
clach04 opened this issue Jul 8, 2023 · 2 comments
Open

How to build with your own token #3485

clach04 opened this issue Jul 8, 2023 · 2 comments

Comments

@clach04
Copy link

clach04 commented Jul 8, 2023

Based on https://www.reddit.com/r/slideforreddit/comments/14nm1ko/how_to_rebuild_slide_for_android_with_your_own/ by https://www.reddit.com/user/ModWilliam/

How to rebuild Slide for Android with your own API key

This is a high level overview, so look up more information on the individual steps before you ask questions

  1. Download and install Android Studio with standard (default) configurations from https://developer.android.com/studio (as of 2023-07 Android Studio Flamingo | 2022.2.1 Patch 2) - initial ~1Gb download, then install over internet which requires additional ~2.3Gb

  2. Checkout code from https://github.com/clach04/Slide/tree/custom_token (or download zip of source)

     git clone https://github.com/clach04/Slide.git
    
  3. Go to https://old.reddit.com/prefs/apps and create your own installed app. After creation you should see your client ID two lines under your app's name. Pick any URL you want, it doesn't matter. For example, http://127.0.0.1/redirect

  4. Edit 3 files https://github.com/search?q=repo%3Aclach04%2FSlide%20EDITME&type=code

    • app\src\main\java\me\ccrama\redditslide\Authentication.java app/src/main/java/me/ccrama/redditslide/Authentication.java
    • app\src\main\java\me\ccrama\redditslide\Activities\Reauthenticate.java app/src/main/java/me/ccrama/redditslide/Activities/Reauthenticate.java
    • app\src\main\java\me\ccrama\redditslide\Activities\Login.java app/src/main/java/me/ccrama/redditslide/Activities/Login.java
      Replace EDITME_TOKEN with generated token. Replace http://127.0.0.1/redirect if your redirect URL is different.
  5. Open the project file inside Android Studio (potentially you can perform step 4 in Android Studio). Potentially open from VCS? Wait....

  6. Build by opening Build menu and selecting Make Project (F9 key under Windows).

  7. copy app\build\intermediates\apk\noGPlay\debug app/build/intermediates/apk/noGPlay/debug to device

  8. install APK. Should end up with Slide v5.7.1-817.... (which is behind latest Google Play version 6.7.1? ). NOTE some users seeing "unknown"

Original

Download the source code from the github repository: https://github.com/Haptic-Apps/Slide (Direct link: https://github.com/Haptic-Apps/Slide/archive/refs/heads/master.zip)

Download and install Android Studio with default configurations

Open the project file inside Android Studio - **you should be opening the Slide-master folder within the other Slide-master folder. It should have a bunch of files in it. If you only see the Slide-master folder and .idea folder in the folder you open it's wrong **. Wait a while for indexing

Make the following changes to fix build issues https://github.com/timawesomeness/Slide/commit/43c7993a214e00786f41da90cf586efbf6dcb12f

Go to https://old.reddit.com/prefs/apps and create your own app. After creation you should see your client ID two lines under your app's name. Pick any URL you want, it doesn't matter

Modify the CLIENT_ID and redirect URL variables in these three files https://github.com/search?q=repo%3AHaptic-Apps%2FSlide+KI2Nl9A_ouG9Qw&type=code to become the client ID I refer to in the previous step and whatever URL you set last step

Build and run your app.

If you have a USB cable to connect your phone to your computer, go to your phone's debug settings, enable USB debugging, then plug your phone in to your computer. Give access for USB debugging from your phone, then hit the green run button (windows shortcut: Shift + F10) at the top to launch on your phone.

Otherwise, go to build at the top, select build bundles / apks, then build APKs. After the APK is built, hit "locate" at the bottom right, transfer the APK to your device, and install. I'm not 100% sure on these steps since I used the USB cable method.

To transfer your settings...

Back up the settings to a file from your "old" Slide app (the one that no longer works)

WITHOUT RESTORING THAT FILE YET, run your "fresh" new debug instance of Slide and log in to your account, making sure that everything works.

Back up the settings from the "fresh" file.

Open up both the "old" and "fresh" settings files in a text editor, and copy over the settings under STARTAUTH.xml from the "fresh" to "old" settings file. From a quick look, this includes these values: expires, tokens, accounts, backedCreds, lasttoken but there may be more

Restore this new, modified file to the "fresh" app. 1. I'm not 100% sure on restoring the settings files since this method didn't work for me at first but it eventually did after some finagling, and I don't completely understand why. Feel free to comment what is and isn't working.
@clach04 clach04 mentioned this issue Jul 8, 2023
@clach04
Copy link
Author

clach04 commented Jul 8, 2023

See #3309 for someone's code to add a new config setting (and use it) which could be used as a model for configurable token/redirect_uri.

clach04 added a commit to clach04/Slide that referenced this issue Jul 8, 2023
@clach04
Copy link
Author

clach04 commented Jul 8, 2023

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

No branches or pull requests

1 participant