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

Fix anonymous login #639

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ android {
compileSdkVersion 28
buildToolsVersion '28.0.3'

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

def getCurrentFlavor = { ->
if (getGradle().getStartParameter().getTaskRequests().toString().contains("legacy")) {
return "legacy"
Expand All @@ -27,8 +32,8 @@ android {
defaultConfig {
applicationId "com.github.yeriomin.yalpstore"
minSdkVersion 5
targetSdkVersion 28
versionCode 45
targetSdkVersion 29
versionCode 47
versionName getVersionName()
vectorDrawables.useSupportLibrary = true
resConfigs "ar", "ast", "bg", "cs", "de", "el", "en", "es", "eu", "fr", "fr-rBE", "in", "it", "ja", "kk", "ko", "nl", "pl", "pt", "pt-rBR", "ru", "sk", "uk", "zh", "zh-rTW"
Expand All @@ -43,7 +48,7 @@ android {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
resValue "string", "app_name", "Yalp Store"
resValue "string", "app_name", "Yalp Store +"
}
}
flavorDimensions "minApi"
Expand All @@ -68,9 +73,8 @@ dependencies {
contemporaryImplementation 'com.android.support:design:28.0.0'
contemporaryImplementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'info.guardianproject.netcipher:netcipher:2.0.0-beta1'
implementation 'commons-net:commons-net:3.5'
implementation 'commons-net:commons-net:3.6'
implementation 'com.nothome:javaxdelta:2.0.1'
debugImplementation ('com.github.yeriomin:play-store-api:master-SNAPSHOT') { changing = true }
releaseImplementation 'com.github.yeriomin:play-store-api:0.44.2'
implementation 'com.github.whyorean:playstore-api-v2:2.4'
implementation 'eu.chainfire:libsuperuser:1.0.0.201608240809'
}
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:banner="@mipmap/ic_launcher"
android:usesCleartextTraffic="true"
android:supportsRtl="true">
<provider
android:name="android.support.v4.content.FileProvider"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

import android.util.Log;

import com.github.yeriomin.playstoreapi.DocV2;
import com.github.yeriomin.playstoreapi.GooglePlayAPI;
import com.dragons.aurora.playstoreapiv2.DocV2;
import com.dragons.aurora.playstoreapiv2.GooglePlayAPI;
import com.github.yeriomin.yalpstore.model.App;
import com.github.yeriomin.yalpstore.model.AppBuilder;
import com.github.yeriomin.yalpstore.model.Filter;
Expand All @@ -34,9 +34,9 @@
public class AppListIterator implements Iterator {

private Filter filter;
protected com.github.yeriomin.playstoreapi.AppListIterator iterator;
protected com.dragons.aurora.playstoreapiv2.AppListIterator iterator;

public AppListIterator(com.github.yeriomin.playstoreapi.AppListIterator iterator) {
public AppListIterator(com.dragons.aurora.playstoreapiv2.AppListIterator iterator) {
this.iterator = iterator;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

package com.github.yeriomin.yalpstore;

import com.github.yeriomin.playstoreapi.AuthException;
import com.dragons.aurora.playstoreapiv2.AuthException;

public class CredentialsEmptyException extends AuthException {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
import android.view.View;
import android.widget.TextView;

import com.github.yeriomin.playstoreapi.GooglePlayAPI;
import com.github.yeriomin.playstoreapi.GooglePlayException;
import com.github.yeriomin.playstoreapi.ReviewResponse;
import com.dragons.aurora.playstoreapiv2.GooglePlayAPI;
import com.dragons.aurora.playstoreapiv2.GooglePlayException;
import com.dragons.aurora.playstoreapiv2.ReviewResponse;
import com.github.yeriomin.yalpstore.download.DetailsProgressListener;
import com.github.yeriomin.yalpstore.download.DownloadManager;
import com.github.yeriomin.yalpstore.fragment.ButtonCancel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
import android.text.TextUtils;
import android.util.Log;

import com.github.yeriomin.playstoreapi.Base64;
import com.github.yeriomin.playstoreapi.DeveloperAppsRequest;
import com.github.yeriomin.playstoreapi.DeveloperIdContainer;
import com.github.yeriomin.playstoreapi.GooglePlayAPI;
import com.github.yeriomin.playstoreapi.UrlRequestWrapper;
import com.dragons.aurora.playstoreapiv2.Base64;
import com.dragons.aurora.playstoreapiv2.DeveloperAppsRequest;
import com.dragons.aurora.playstoreapiv2.DeveloperIdContainer;
import com.dragons.aurora.playstoreapiv2.GooglePlayAPI;
import com.dragons.aurora.playstoreapiv2.UrlRequestWrapper;

import java.net.URLEncoder;

import static com.github.yeriomin.playstoreapi.Base64.NO_WRAP;
import static com.dragons.aurora.playstoreapiv2.Base64.NO_WRAP;

public class DeveloperActivity extends YalpStoreActivity {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
import android.text.TextUtils;
import android.util.DisplayMetrics;

import com.github.yeriomin.playstoreapi.AndroidBuildProto;
import com.github.yeriomin.playstoreapi.AndroidCheckinProto;
import com.github.yeriomin.playstoreapi.AndroidCheckinRequest;
import com.github.yeriomin.playstoreapi.DeviceConfigurationProto;
import com.github.yeriomin.playstoreapi.DeviceInfoProvider;
import com.dragons.aurora.playstoreapiv2.AndroidBuildProto;
import com.dragons.aurora.playstoreapiv2.AndroidCheckinProto;
import com.dragons.aurora.playstoreapiv2.AndroidCheckinRequest;
import com.dragons.aurora.playstoreapiv2.DeviceConfigurationProto;
import com.dragons.aurora.playstoreapiv2.DeviceInfoProvider;

import java.net.URLEncoder;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
import android.text.TextUtils;
import android.util.Log;

import com.github.yeriomin.playstoreapi.AuthException;
import com.github.yeriomin.playstoreapi.GooglePlayAPI;
import com.github.yeriomin.playstoreapi.GooglePlayException;
import com.github.yeriomin.playstoreapi.HttpClientAdapter;
import com.dragons.aurora.playstoreapiv2.AuthException;
import com.dragons.aurora.playstoreapiv2.GooglePlayAPI;
import com.dragons.aurora.playstoreapiv2.GooglePlayException;
import com.dragons.aurora.playstoreapiv2.HttpClientAdapter;

import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/com/github/yeriomin/yalpstore/Paths.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public class Paths {
static public File filesDir;

static public File getStorageRoot(Context context) {
return new File("/sdcard/");
/*
File storageRoot = Environment.getExternalStorageDirectory();
File[] externalFilesDirs = getExternalFilesDirs(context);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP
Expand All @@ -55,6 +57,7 @@ static public File getStorageRoot(Context context) {
}
}
return storageRoot;
*/
}

static public File getYalpPath(Context context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@
import android.text.TextUtils;
import android.util.Log;

import com.github.yeriomin.playstoreapi.ApiBuilderException;
import com.github.yeriomin.playstoreapi.AuthException;
import com.github.yeriomin.playstoreapi.DeviceInfoProvider;
import com.github.yeriomin.playstoreapi.GooglePlayAPI;
import com.github.yeriomin.playstoreapi.PropertiesDeviceInfoProvider;
import com.github.yeriomin.playstoreapi.TokenDispenserException;
import com.dragons.aurora.playstoreapiv2.ApiBuilderException;
import com.dragons.aurora.playstoreapiv2.AuthException;
import com.dragons.aurora.playstoreapiv2.DeviceInfoProvider;
import com.dragons.aurora.playstoreapiv2.GooglePlayAPI;
import com.dragons.aurora.playstoreapiv2.PlayStoreApiBuilder;
import com.dragons.aurora.playstoreapiv2.PropertiesDeviceInfoProvider;
import com.dragons.aurora.playstoreapiv2.TokenDispenserException;
import com.github.yeriomin.yalpstore.model.LoginInfo;
import com.github.yeriomin.yalpstore.model.LoginInfoDao;
import com.github.yeriomin.yalpstore.task.playstore.BackgroundCategoryTask;
Expand All @@ -48,16 +49,10 @@ public class PlayStoreApiAuthenticator {
public static final String PREFERENCE_USER_ID = "PREFERENCE_USER_ID";

static private final int RETRIES = 5;

private Context context;
private Set<PlayStorePayloadTask> onLoginTasks = new HashSet<>();

private static GooglePlayAPI api;
private static TokenDispenserMirrors tokenDispenserMirrors = new TokenDispenserMirrors();

public static void forceRelogin() {
api = null;
}
private Context context;
private Set<PlayStorePayloadTask> onLoginTasks = new HashSet<>();

public PlayStoreApiAuthenticator(Context context) {
this.context = context;
Expand All @@ -68,6 +63,10 @@ public PlayStoreApiAuthenticator(Context context) {
onLoginTasks.add(new UserProfileTask());
}

public static void forceRelogin() {
api = null;
}

public GooglePlayAPI getApi() throws IOException {
if (api == null) {
if (!YalpStoreApplication.user.isLoggedIn()) {
Expand Down Expand Up @@ -127,7 +126,7 @@ private GooglePlayAPI build(LoginInfo loginInfo, int retries) throws IOException
tokenDispenserMirrors.reset();
while (tried < retries) {
try {
com.github.yeriomin.playstoreapi.PlayStoreApiBuilder builder = getBuilder(loginInfo);
com.dragons.aurora.playstoreapiv2.PlayStoreApiBuilder builder = getBuilder(loginInfo);
GooglePlayAPI api = builder.build();
loginInfo.setEmail(builder.getEmail());
return api;
Expand All @@ -151,25 +150,25 @@ private GooglePlayAPI build(LoginInfo loginInfo, int retries) throws IOException
}
}
throw loginInfo.appProvidedEmail()
? new TokenDispenserException("Try again later")
: new IOException("Unknown error happened during login")
;
? new TokenDispenserException("Try again later")
: new IOException("Unknown error happened during login")
;
}

private com.github.yeriomin.playstoreapi.PlayStoreApiBuilder getBuilder(LoginInfo loginInfo) {
return new com.github.yeriomin.playstoreapi.PlayStoreApiBuilder()
.setHttpClient(BuildConfig.DEBUG ? new DebugHttpClientAdapter() : new NativeHttpClientAdapter())
.setDeviceInfoProvider(getDeviceInfoProvider(loginInfo.getDeviceDefinitionName()))
.setLocale(loginInfo.getLocale())
.setEmail(loginInfo.getEmail())
.setPassword(loginInfo.getPassword())
.setGsfId(loginInfo.getGsfId())
.setToken(loginInfo.getToken())
.setTokenDispenserUrl(loginInfo.getTokenDispenserUrl())
.setDeviceCheckinConsistencyToken(loginInfo.getDeviceCheckinConsistencyToken())
.setDeviceConfigToken(loginInfo.getDeviceConfigToken())
.setDfeCookie(loginInfo.getDfeCookie())
;
private PlayStoreApiBuilder getBuilder(LoginInfo loginInfo) {
PlayStoreApiBuilder builder = new PlayStoreApiBuilder();
builder.setHttpClient(BuildConfig.DEBUG ? new DebugHttpClientAdapter() : new NativeHttpClientAdapter());
builder.setDeviceInfoProvider(getDeviceInfoProvider(loginInfo.getDeviceDefinitionName()));
builder.setLocale(loginInfo.getLocale());
builder.setEmail(loginInfo.getEmail());
builder.setAasToken(loginInfo.getPassword());
builder.setGsfId(loginInfo.getGsfId());
builder.setAuthToken(loginInfo.getToken());
builder.setTokenDispenserUrl(loginInfo.getTokenDispenserUrl());
builder.setDeviceCheckinConsistencyToken(loginInfo.getDeviceCheckinConsistencyToken());
builder.setDeviceConfigToken(loginInfo.getDeviceConfigToken());
builder.setDfeCookie(loginInfo.getDfeCookie());
return builder;
}

private DeviceInfoProvider getDeviceInfoProvider(String spoofDevice) {
Expand Down Expand Up @@ -197,7 +196,7 @@ private void save(LoginInfo loginInfo) {
}

private void runOnLoginTasks() {
for (PlayStorePayloadTask task: onLoginTasks) {
for (PlayStorePayloadTask task : onLoginTasks) {
task.setContext(context);
task.executeOnExecutorIfPossible();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import android.util.Log;

import com.github.yeriomin.playstoreapi.GooglePlayAPI;
import com.dragons.aurora.playstoreapiv2.GooglePlayAPI;
import com.github.yeriomin.yalpstore.model.Review;
import com.github.yeriomin.yalpstore.model.ReviewBuilder;

Expand Down Expand Up @@ -58,7 +58,7 @@ public List<Review> next() {

private List<Review> getReviews(String packageId, int offset, int numberOfResults) throws IOException {
List<Review> reviews = new ArrayList<>();
for (com.github.yeriomin.playstoreapi.Review review: new PlayStoreApiAuthenticator(context).getApi().reviews(
for (com.dragons.aurora.playstoreapiv2.Review review: new PlayStoreApiAuthenticator(context).getApi().reviews(
packageId,
GooglePlayAPI.REVIEW_SORT.HELPFUL,
offset,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ public class TokenDispenserMirrors {
private int n = 0;

static private String[] mirrors = new String[] {
"https://token-dispenser.herokuapp.com",
"https://token-dispenser-mirror.herokuapp.com",
"http://route-token-dispenser.193b.starter-ca-central-1.openshiftapps.com",
"http://token-dispenser.duckdns.org:8080"
"http://auroraoss.com:8080",
"http://auroraoss.in:8080"
};

public void reset() {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/github/yeriomin/yalpstore/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ static public byte[] getFileChecksum(File file) {
}

public static byte[] base64StringToByteArray(String string) {
return com.github.yeriomin.playstoreapi.Base64.decode(
return com.dragons.aurora.playstoreapiv2.Base64.decode(
string,
com.github.yeriomin.playstoreapi.Base64.URL_SAFE | com.github.yeriomin.playstoreapi.Base64.NO_PADDING
com.dragons.aurora.playstoreapiv2.Base64.URL_SAFE | com.dragons.aurora.playstoreapiv2.Base64.NO_PADDING
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import android.widget.AdapterView;
import android.widget.TextView;

import com.github.yeriomin.playstoreapi.BulkDetailsEntry;
import com.github.yeriomin.playstoreapi.GooglePlayAPI;
import com.dragons.aurora.playstoreapiv2.BulkDetailsEntry;
import com.dragons.aurora.playstoreapiv2.GooglePlayAPI;
import com.github.yeriomin.yalpstore.model.App;
import com.github.yeriomin.yalpstore.model.AppBuilder;
import com.github.yeriomin.yalpstore.task.playstore.CloneableTask;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
import android.text.TextUtils;
import android.util.Log;

import com.github.yeriomin.playstoreapi.GooglePlayAPI;
import com.github.yeriomin.playstoreapi.GooglePlayException;
import com.github.yeriomin.playstoreapi.SearchSuggestEntry;
import com.dragons.aurora.playstoreapiv2.GooglePlayAPI;
import com.dragons.aurora.playstoreapiv2.GooglePlayException;
import com.dragons.aurora.playstoreapiv2.SearchSuggestEntry;

import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import android.content.Context;

import com.github.yeriomin.playstoreapi.GooglePlayAPI;
import com.dragons.aurora.playstoreapiv2.GooglePlayAPI;
import com.github.yeriomin.yalpstore.model.App;

public class PatcherFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import android.os.StatFs;
import android.util.Log;

import com.github.yeriomin.playstoreapi.AndroidAppDeliveryData;
import com.dragons.aurora.playstoreapiv2.AndroidAppDeliveryData;
import com.github.yeriomin.yalpstore.ContextUtil;
import com.github.yeriomin.yalpstore.DetailsActivity;
import com.github.yeriomin.yalpstore.InstalledApkCopier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@

import android.text.TextUtils;

import com.github.yeriomin.playstoreapi.AndroidAppDeliveryData;
import com.github.yeriomin.playstoreapi.AndroidAppPatchData;
import com.github.yeriomin.playstoreapi.AppFileMetadata;
import com.github.yeriomin.playstoreapi.GooglePlayAPI;
import com.github.yeriomin.playstoreapi.HttpCookie;
import com.github.yeriomin.playstoreapi.Split;
import com.dragons.aurora.playstoreapiv2.AndroidAppDeliveryData;
import com.dragons.aurora.playstoreapiv2.AndroidAppPatchData;
import com.dragons.aurora.playstoreapiv2.AppFileMetadata;
import com.dragons.aurora.playstoreapiv2.GooglePlayAPI;
import com.dragons.aurora.playstoreapiv2.HttpCookie;
import com.dragons.aurora.playstoreapiv2.Split;
import com.github.yeriomin.yalpstore.Util;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

package com.github.yeriomin.yalpstore.download;

import com.github.yeriomin.playstoreapi.GooglePlayAPI;
import com.dragons.aurora.playstoreapiv2.GooglePlayAPI;

public class RequestDelta extends Request {

Expand Down
Loading