Merge dev
This commit is contained in:
commit
48b3a2d18c
183 changed files with 62850 additions and 59577 deletions
5
extensions/strava/build.gradle.kts
Normal file
5
extensions/strava/build.gradle.kts
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
dependencies {
|
||||
compileOnly(project(":extensions:shared:library"))
|
||||
compileOnly(project(":extensions:strava:stub"))
|
||||
compileOnly(libs.okhttp)
|
||||
}
|
||||
1
extensions/strava/src/main/AndroidManifest.xml
Normal file
1
extensions/strava/src/main/AndroidManifest.xml
Normal file
|
|
@ -0,0 +1 @@
|
|||
<manifest/>
|
||||
|
|
@ -0,0 +1,217 @@
|
|||
package app.revanced.extension.strava;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.provider.MediaStore;
|
||||
import android.webkit.MimeTypeMap;
|
||||
|
||||
import app.revanced.extension.shared.ResourceType;
|
||||
import com.strava.mediamodels.data.MediaType;
|
||||
import com.strava.photos.data.Media;
|
||||
|
||||
import okhttp3.*;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import app.revanced.extension.shared.Utils;
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public final class AddMediaDownloadPatch {
|
||||
public static final int ACTION_DOWNLOAD = -1;
|
||||
public static final int ACTION_OPEN_LINK = -2;
|
||||
public static final int ACTION_COPY_LINK = -3;
|
||||
|
||||
private static final OkHttpClient client = new OkHttpClient();
|
||||
|
||||
public static boolean handleAction(int actionId, Media media) {
|
||||
String url = getUrl(media);
|
||||
switch (actionId) {
|
||||
case ACTION_DOWNLOAD:
|
||||
String name = media.getId();
|
||||
if (media.getType() == MediaType.VIDEO) {
|
||||
downloadVideo(url, name);
|
||||
} else {
|
||||
downloadPhoto(url, name);
|
||||
}
|
||||
return true;
|
||||
case ACTION_OPEN_LINK:
|
||||
Utils.openLink(url);
|
||||
return true;
|
||||
case ACTION_COPY_LINK:
|
||||
copyLink(url);
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void copyLink(CharSequence url) {
|
||||
Utils.setClipboard(url);
|
||||
showInfoToast("link_copied_to_clipboard", "🔗");
|
||||
}
|
||||
|
||||
public static void downloadPhoto(String url, String name) {
|
||||
showInfoToast("loading", "⏳");
|
||||
Utils.runOnBackgroundThread(() -> {
|
||||
try (Response response = fetch(url)) {
|
||||
ResponseBody body = response.body();
|
||||
String mimeType = body.contentType().toString();
|
||||
String extension = MimeTypeMap.getSingleton().getExtensionFromMimeType(mimeType);
|
||||
ContentResolver resolver = Utils.getContext().getContentResolver();
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(MediaStore.Images.Media.DISPLAY_NAME, name + '.' + extension);
|
||||
values.put(MediaStore.Images.Media.IS_PENDING, 1);
|
||||
values.put(MediaStore.Images.Media.MIME_TYPE, mimeType);
|
||||
values.put(MediaStore.Images.Media.RELATIVE_PATH, Environment.DIRECTORY_PICTURES + "/Strava");
|
||||
Uri collection = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q
|
||||
? MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL)
|
||||
: MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
|
||||
Uri row = resolver.insert(collection, values);
|
||||
try (OutputStream outputStream = resolver.openOutputStream(row)) {
|
||||
transferTo(body.byteStream(), outputStream);
|
||||
} finally {
|
||||
values.clear();
|
||||
values.put(MediaStore.Images.Media.IS_PENDING, 0);
|
||||
resolver.update(row, values, null);
|
||||
}
|
||||
showInfoToast("yis_2024_local_save_image_success", "✔️");
|
||||
} catch (IOException e) {
|
||||
showErrorToast("download_failure", "❌", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloads a video in the M3U8 / HLS (HTTP Live Streaming) format.
|
||||
*/
|
||||
public static void downloadVideo(String url, String name) {
|
||||
// The first request yields multiple URLs with different stream options.
|
||||
// In case of Strava, the first one is always of highest quality.
|
||||
// Each stream can consist of multiple chunks.
|
||||
// The second request yields the URLs of all of these chunks.
|
||||
// Fetch all of them concurrently and pipe their streams into the file in order.
|
||||
showInfoToast("loading", "⏳");
|
||||
Utils.runOnBackgroundThread(() -> {
|
||||
try {
|
||||
String highestQualityStreamUrl;
|
||||
try (Response response = fetch(url)) {
|
||||
highestQualityStreamUrl = replaceFileName(url, lines(response).findFirst().get());
|
||||
}
|
||||
List<Future<Response>> futures;
|
||||
try (Response response = fetch(highestQualityStreamUrl)) {
|
||||
futures = lines(response)
|
||||
.map(line -> replaceFileName(highestQualityStreamUrl, line))
|
||||
.map(chunkUrl -> Utils.submitOnBackgroundThread(() -> fetch(chunkUrl)))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
ContentResolver resolver = Utils.getContext().getContentResolver();
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(MediaStore.Video.Media.DISPLAY_NAME, name + '.' + "mp4");
|
||||
values.put(MediaStore.Video.Media.IS_PENDING, 1);
|
||||
values.put(MediaStore.Video.Media.MIME_TYPE, MimeTypeMap.getSingleton().getMimeTypeFromExtension("mp4"));
|
||||
values.put(MediaStore.Video.Media.RELATIVE_PATH, Environment.DIRECTORY_MOVIES + "/Strava");
|
||||
Uri collection = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q
|
||||
? MediaStore.Video.Media.getContentUri(MediaStore.VOLUME_EXTERNAL)
|
||||
: MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
|
||||
Uri row = resolver.insert(collection, values);
|
||||
try (OutputStream outputStream = resolver.openOutputStream(row)) {
|
||||
Throwable error = null;
|
||||
for (Future<Response> future : futures) {
|
||||
if (error != null) {
|
||||
if (future.cancel(true)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
try (Response response = future.get()) {
|
||||
if (error == null) {
|
||||
transferTo(response.body().byteStream(), outputStream);
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
error = e;
|
||||
} catch (ExecutionException e) {
|
||||
error = e.getCause();
|
||||
}
|
||||
}
|
||||
if (error != null) {
|
||||
throw new IOException(error);
|
||||
}
|
||||
} finally {
|
||||
values.clear();
|
||||
values.put(MediaStore.Video.Media.IS_PENDING, 0);
|
||||
resolver.update(row, values, null);
|
||||
}
|
||||
showInfoToast("yis_2024_local_save_video_success", "✔️");
|
||||
} catch (IOException e) {
|
||||
showErrorToast("download_failure", "❌", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static String getUrl(Media media) {
|
||||
return media.getType() == MediaType.VIDEO
|
||||
? ((Media.Video) media).getVideoUrl()
|
||||
: media.getLargestUrl();
|
||||
}
|
||||
|
||||
private static String getString(String name, String fallback) {
|
||||
int id = Utils.getResourceIdentifier(ResourceType.STRING, name);
|
||||
return id != 0
|
||||
? Utils.getResourceString(id)
|
||||
: fallback;
|
||||
}
|
||||
|
||||
private static void showInfoToast(String resourceName, String fallback) {
|
||||
String text = getString(resourceName, fallback);
|
||||
Utils.showToastShort(text);
|
||||
}
|
||||
|
||||
private static void showErrorToast(String resourceName, String fallback, IOException exception) {
|
||||
String text = getString(resourceName, fallback);
|
||||
Utils.showToastLong(text + ' ' + exception.getLocalizedMessage());
|
||||
}
|
||||
|
||||
private static Response fetch(String url) throws IOException {
|
||||
Request request = new Request.Builder().url(url).build();
|
||||
Response response = client.newCall(request).execute();
|
||||
if (!response.isSuccessful()) {
|
||||
throw new IOException("Got HTTP status code " + response.code());
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@code inputStream.transferTo(outputStream)} is "too new".
|
||||
*/
|
||||
private static void transferTo(InputStream in, OutputStream out) throws IOException {
|
||||
byte[] buffer = new byte[1024 * 8];
|
||||
int length;
|
||||
while ((length = in.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, length);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all file names.
|
||||
*/
|
||||
private static Stream<String> lines(Response response) {
|
||||
BufferedReader reader = new BufferedReader(response.body().charStream());
|
||||
return reader.lines().filter(line -> !line.startsWith("#"));
|
||||
}
|
||||
|
||||
private static String replaceFileName(String uri, String newName) {
|
||||
return uri.substring(0, uri.lastIndexOf('/') + 1) + newName;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,227 @@
|
|||
package app.revanced.extension.strava;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
|
||||
import com.strava.modularframework.data.Destination;
|
||||
import com.strava.modularframework.data.GenericLayoutModule;
|
||||
import com.strava.modularframework.data.GenericModuleField;
|
||||
import com.strava.modularframework.data.ListField;
|
||||
import com.strava.modularframework.data.ListProperties;
|
||||
import com.strava.modularframework.data.ModularComponent;
|
||||
import com.strava.modularframework.data.ModularEntry;
|
||||
import com.strava.modularframework.data.ModularEntryContainer;
|
||||
import com.strava.modularframework.data.ModularMenuItem;
|
||||
import com.strava.modularframework.data.Module;
|
||||
import com.strava.modularframework.data.MultiStateFieldDescriptor;
|
||||
import com.strava.modularframeworknetwork.ModularEntryNetworkContainer;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public class HideDistractionsPatch {
|
||||
public static boolean upselling;
|
||||
public static boolean promo;
|
||||
public static boolean followSuggestions;
|
||||
public static boolean challengeSuggestions;
|
||||
public static boolean joinChallenge;
|
||||
public static boolean joinClub;
|
||||
public static boolean activityLookback;
|
||||
|
||||
public static List<ModularEntry> filterChildrenEntries(ModularEntry modularEntry) {
|
||||
if (hideModularEntry(modularEntry)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return modularEntry.getChildrenEntries$original().stream()
|
||||
.filter(childrenEntry -> !hideModularEntry(childrenEntry))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static List<ModularEntry> filterEntries(ModularEntryContainer modularEntryContainer) {
|
||||
if (hideModularEntryContainer(modularEntryContainer)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return modularEntryContainer.getEntries$original().stream()
|
||||
.filter(entry -> !hideModularEntry(entry))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static List<ModularEntry> filterEntries(ModularEntryNetworkContainer modularEntryNetworkContainer) {
|
||||
if (hideModularEntryNetworkContainer(modularEntryNetworkContainer)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return modularEntryNetworkContainer.getEntries$original().stream()
|
||||
.filter(entry -> !hideModularEntry(entry))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static List<ModularMenuItem> filterMenuItems(ModularEntryContainer modularEntryContainer) {
|
||||
if (hideModularEntryContainer(modularEntryContainer)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return modularEntryContainer.getMenuItems$original().stream()
|
||||
.filter(menuItem -> !hideModularMenuItem(menuItem))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static ListProperties filterProperties(ModularEntryContainer modularEntryContainer) {
|
||||
if (hideModularEntryContainer(modularEntryContainer)) {
|
||||
return null;
|
||||
}
|
||||
return modularEntryContainer.getProperties$original();
|
||||
}
|
||||
|
||||
public static ListProperties filterProperties(ModularEntryNetworkContainer modularEntryNetworkContainer) {
|
||||
if (hideModularEntryNetworkContainer(modularEntryNetworkContainer)) {
|
||||
return null;
|
||||
}
|
||||
return modularEntryNetworkContainer.getProperties$original();
|
||||
}
|
||||
|
||||
public static ListField filterField(ListProperties listProperties, String key) {
|
||||
ListField listField = listProperties.getField$original(key);
|
||||
if (hideListField(listField)) {
|
||||
return null;
|
||||
}
|
||||
return listField;
|
||||
}
|
||||
|
||||
public static List<ListField> filterFields(ListField listField) {
|
||||
if (hideListField(listField)) {
|
||||
return null;
|
||||
}
|
||||
return listField.getFields$original().stream()
|
||||
.filter(field -> !hideListField(field))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static List<Module> filterModules(ModularEntry modularEntry) {
|
||||
if (hideModularEntry(modularEntry)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return modularEntry.getModules$original().stream()
|
||||
.filter(module -> !hideModule(module))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static GenericModuleField filterField(GenericLayoutModule genericLayoutModule, String key) {
|
||||
if (hideGenericLayoutModule(genericLayoutModule)) {
|
||||
return null;
|
||||
}
|
||||
GenericModuleField field = genericLayoutModule.getField$original(key);
|
||||
if (hideGenericModuleField(field)) {
|
||||
return null;
|
||||
}
|
||||
return field;
|
||||
}
|
||||
|
||||
public static GenericModuleField[] filterFields(GenericLayoutModule genericLayoutModule) {
|
||||
if (hideGenericLayoutModule(genericLayoutModule)) {
|
||||
return new GenericModuleField[0];
|
||||
}
|
||||
return Arrays.stream(genericLayoutModule.getFields$original())
|
||||
.filter(field -> !hideGenericModuleField(field))
|
||||
.toArray(GenericModuleField[]::new);
|
||||
}
|
||||
|
||||
public static GenericLayoutModule[] filterSubmodules(GenericLayoutModule genericLayoutModule) {
|
||||
if (hideGenericLayoutModule(genericLayoutModule)) {
|
||||
return new GenericLayoutModule[0];
|
||||
}
|
||||
return Arrays.stream(genericLayoutModule.getSubmodules$original())
|
||||
.filter(submodule -> !hideGenericLayoutModule(submodule))
|
||||
.toArray(GenericLayoutModule[]::new);
|
||||
}
|
||||
|
||||
public static List<Module> filterSubmodules(ModularComponent modularComponent) {
|
||||
if (hideByName(modularComponent.getPage()) || hideByName(modularComponent.getElement())) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return modularComponent.getSubmodules$original().stream()
|
||||
.filter(submodule -> !hideModule(submodule))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static Map<String, GenericModuleField> filterStateMap(MultiStateFieldDescriptor multiStateFieldDescriptor) {
|
||||
return multiStateFieldDescriptor.getStateMap$original().entrySet().stream()
|
||||
.filter(entry -> !hideGenericModuleField(entry.getValue()))
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
}
|
||||
|
||||
private static boolean hideModule(Module module) {
|
||||
return module == null ||
|
||||
hideByName(module.getPage()) ||
|
||||
hideByName(module.getElement());
|
||||
}
|
||||
|
||||
private static boolean hideModularEntry(ModularEntry modularEntry) {
|
||||
return modularEntry == null ||
|
||||
hideByName(modularEntry.getPage()) ||
|
||||
hideByName(modularEntry.getElement()) ||
|
||||
hideByDestination(modularEntry.getDestination());
|
||||
}
|
||||
|
||||
private static boolean hideGenericLayoutModule(GenericLayoutModule genericLayoutModule) {
|
||||
try {
|
||||
return genericLayoutModule == null ||
|
||||
hideByName(genericLayoutModule.getPage()) ||
|
||||
hideByName(genericLayoutModule.getElement()) ||
|
||||
hideByDestination(genericLayoutModule.getDestination());
|
||||
} catch (RuntimeException getParentEntryOrThrowException) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean hideListField(ListField listField) {
|
||||
return listField == null ||
|
||||
hideByName(listField.getElement()) ||
|
||||
hideByDestination(listField.getDestination());
|
||||
}
|
||||
|
||||
private static boolean hideGenericModuleField(GenericModuleField genericModuleField) {
|
||||
return genericModuleField == null ||
|
||||
hideByName(genericModuleField.getElement()) ||
|
||||
hideByDestination(genericModuleField.getDestination());
|
||||
}
|
||||
|
||||
private static boolean hideModularEntryContainer(ModularEntryContainer modularEntryContainer) {
|
||||
return modularEntryContainer == null ||
|
||||
hideByName(modularEntryContainer.getPage());
|
||||
}
|
||||
|
||||
private static boolean hideModularEntryNetworkContainer(ModularEntryNetworkContainer modularEntryNetworkContainer) {
|
||||
return modularEntryNetworkContainer == null ||
|
||||
hideByName(modularEntryNetworkContainer.getPage());
|
||||
}
|
||||
|
||||
private static boolean hideModularMenuItem(ModularMenuItem modularMenuItem) {
|
||||
return modularMenuItem == null ||
|
||||
hideByName(modularMenuItem.getElementName()) ||
|
||||
hideByDestination(modularMenuItem.getDestination());
|
||||
}
|
||||
|
||||
private static boolean hideByName(String name) {
|
||||
return name != null && (
|
||||
upselling && name.contains("_upsell") ||
|
||||
promo && (name.equals("promo") || name.equals("top_of_tab_promo")) ||
|
||||
followSuggestions && name.equals("suggested_follows") ||
|
||||
challengeSuggestions && name.equals("suggested_challenges") ||
|
||||
joinChallenge && name.equals("challenge") ||
|
||||
joinClub && name.equals("club") ||
|
||||
activityLookback && name.equals("highlighted_activity_lookback")
|
||||
);
|
||||
}
|
||||
|
||||
private static boolean hideByDestination(Destination destination) {
|
||||
if (destination == null) {
|
||||
return false;
|
||||
}
|
||||
String url = destination.getUrl();
|
||||
return url != null && (
|
||||
upselling && url.startsWith("strava://subscription/checkout")
|
||||
);
|
||||
}
|
||||
}
|
||||
12
extensions/strava/stub/build.gradle.kts
Normal file
12
extensions/strava/stub/build.gradle.kts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
plugins {
|
||||
alias(libs.plugins.android.library)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "app.revanced.extension"
|
||||
compileSdk = 34
|
||||
|
||||
defaultConfig {
|
||||
minSdk = 21
|
||||
}
|
||||
}
|
||||
1
extensions/strava/stub/src/main/AndroidManifest.xml
Normal file
1
extensions/strava/stub/src/main/AndroidManifest.xml
Normal file
|
|
@ -0,0 +1 @@
|
|||
<manifest/>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.strava.mediamodels.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public interface MediaContent extends Serializable {
|
||||
String getCaption();
|
||||
|
||||
String getId();
|
||||
|
||||
String getReferenceId();
|
||||
|
||||
MediaType getType();
|
||||
|
||||
void setCaption(String caption);
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package com.strava.mediamodels.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public final class MediaDimension implements Comparable<MediaDimension>, Serializable {
|
||||
private final int height;
|
||||
private final int width;
|
||||
|
||||
public MediaDimension(int width, int height) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public float getHeightScale() {
|
||||
if (width <= 0 || height <= 0) {
|
||||
return 1f;
|
||||
}
|
||||
return height / width;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public float getWidthScale() {
|
||||
if (width <= 0 || height <= 0) {
|
||||
return 1f;
|
||||
}
|
||||
return width / height;
|
||||
}
|
||||
|
||||
public boolean isLandscape() {
|
||||
return width > 0 && width >= height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(MediaDimension other) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.strava.mediamodels.data;
|
||||
|
||||
public enum MediaType {
|
||||
PHOTO(1),
|
||||
VIDEO(2);
|
||||
|
||||
private final int remoteValue;
|
||||
|
||||
private MediaType(int remoteValue) {
|
||||
this.remoteValue = remoteValue;
|
||||
}
|
||||
|
||||
public int getRemoteValue() {
|
||||
return remoteValue;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.strava.mediamodels.data;
|
||||
|
||||
import java.util.SortedMap;
|
||||
|
||||
public interface RemoteMediaContent extends MediaContent {
|
||||
MediaDimension getLargestSize();
|
||||
|
||||
String getLargestUrl();
|
||||
|
||||
SortedMap<Integer, MediaDimension> getSizes();
|
||||
|
||||
String getSmallestUrl();
|
||||
|
||||
RemoteMediaStatus getStatus();
|
||||
|
||||
SortedMap<Integer, String> getUrls();
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.strava.mediamodels.data;
|
||||
|
||||
public enum RemoteMediaStatus {
|
||||
NEW,
|
||||
PENDING,
|
||||
PROCESSED,
|
||||
REPORTED,
|
||||
REINSTATED,
|
||||
DELETED,
|
||||
FAILED
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package com.strava.modularframework.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public abstract class Destination implements Serializable {
|
||||
public abstract String getUrl();
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.strava.modularframework.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public abstract class GenericLayoutModule implements Serializable, Module {
|
||||
public abstract Destination getDestination();
|
||||
|
||||
@Override
|
||||
public abstract String getElement();
|
||||
|
||||
public abstract GenericModuleField getField(String key);
|
||||
|
||||
// Added by patch.
|
||||
public abstract GenericModuleField getField$original(String key);
|
||||
|
||||
public abstract GenericModuleField[] getFields();
|
||||
|
||||
// Added by patch.
|
||||
public abstract GenericModuleField[] getFields$original();
|
||||
|
||||
@Override
|
||||
public abstract String getPage();
|
||||
|
||||
public abstract GenericLayoutModule[] getSubmodules();
|
||||
|
||||
// Added by patch.
|
||||
public abstract GenericLayoutModule[] getSubmodules$original();
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.strava.modularframework.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public abstract class GenericModuleField implements Serializable {
|
||||
public abstract Destination getDestination();
|
||||
|
||||
public abstract String getElement();
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.strava.modularframework.data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ListField {
|
||||
public abstract Destination getDestination();
|
||||
|
||||
public abstract String getElement();
|
||||
|
||||
public abstract List<ListField> getFields();
|
||||
|
||||
// Added by patch.
|
||||
public abstract List<ListField> getFields$original();
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.strava.modularframework.data;
|
||||
|
||||
public abstract class ListProperties {
|
||||
public abstract ListField getField(String key);
|
||||
|
||||
// Added by patch.
|
||||
public abstract ListField getField$original(String key);
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.strava.modularframework.data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ModularComponent implements Module {
|
||||
@Override
|
||||
public abstract String getElement();
|
||||
|
||||
@Override
|
||||
public abstract String getPage();
|
||||
|
||||
public abstract List<Module> getSubmodules();
|
||||
|
||||
// Added by patch.
|
||||
public abstract List<Module> getSubmodules$original();
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.strava.modularframework.data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ModularEntry {
|
||||
List<ModularEntry> getChildrenEntries();
|
||||
|
||||
// Added by patch.
|
||||
List<ModularEntry> getChildrenEntries$original();
|
||||
|
||||
Destination getDestination();
|
||||
|
||||
String getElement();
|
||||
|
||||
List<Module> getModules();
|
||||
|
||||
// Added by patch.
|
||||
List<Module> getModules$original();
|
||||
|
||||
String getPage();
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.strava.modularframework.data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ModularEntryContainer {
|
||||
public abstract List<ModularEntry> getEntries();
|
||||
|
||||
// Added by patch.
|
||||
public abstract List<ModularEntry> getEntries$original();
|
||||
|
||||
public abstract List<ModularMenuItem> getMenuItems();
|
||||
|
||||
// Added by patch.
|
||||
public abstract List<ModularMenuItem> getMenuItems$original();
|
||||
|
||||
public abstract String getPage();
|
||||
|
||||
public abstract ListProperties getProperties();
|
||||
|
||||
// Added by patch.
|
||||
public abstract ListProperties getProperties$original();
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package com.strava.modularframework.data;
|
||||
|
||||
public abstract class ModularMenuItem {
|
||||
public abstract Destination getDestination();
|
||||
|
||||
public abstract String getElementName();
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package com.strava.modularframework.data;
|
||||
|
||||
public interface Module {
|
||||
String getElement();
|
||||
|
||||
String getPage();
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.strava.modularframework.data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class MultiStateFieldDescriptor {
|
||||
public abstract Map<String, GenericModuleField> getStateMap();
|
||||
|
||||
// Added by patch.
|
||||
public abstract Map<String, GenericModuleField> getStateMap$original();
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.strava.modularframeworknetwork;
|
||||
|
||||
import com.strava.modularframework.data.ListProperties;
|
||||
import com.strava.modularframework.data.ModularEntry;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ModularEntryNetworkContainer {
|
||||
public abstract List<ModularEntry> getEntries();
|
||||
|
||||
// Added by patch.
|
||||
public abstract List<ModularEntry> getEntries$original();
|
||||
|
||||
public abstract String getPage();
|
||||
|
||||
public abstract ListProperties getProperties();
|
||||
|
||||
// Added by patch.
|
||||
public abstract ListProperties getProperties$original();
|
||||
}
|
||||
|
|
@ -0,0 +1,287 @@
|
|||
package com.strava.photos.data;
|
||||
|
||||
import com.strava.mediamodels.data.MediaDimension;
|
||||
import com.strava.mediamodels.data.MediaType;
|
||||
import com.strava.mediamodels.data.RemoteMediaContent;
|
||||
import com.strava.mediamodels.data.RemoteMediaStatus;
|
||||
|
||||
import java.util.SortedMap;
|
||||
|
||||
public abstract class Media implements RemoteMediaContent {
|
||||
public static final class Photo extends Media {
|
||||
private final Long activityId;
|
||||
private final String activityName;
|
||||
private final long athleteId;
|
||||
private String caption;
|
||||
private final String createdAt;
|
||||
private final String createdAtLocal;
|
||||
private final String cursor;
|
||||
private final String id;
|
||||
private final SortedMap<Integer, MediaDimension> sizes;
|
||||
private final RemoteMediaStatus status;
|
||||
private final String tag;
|
||||
private final MediaType type;
|
||||
private final SortedMap<Integer, String> urls;
|
||||
|
||||
@Override
|
||||
public Long getActivityId() {
|
||||
return activityId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getActivityName() {
|
||||
return activityName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAthleteId() {
|
||||
return athleteId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCaption() {
|
||||
return caption;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCreatedAtLocal() {
|
||||
return createdAtLocal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCursor() {
|
||||
return cursor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SortedMap<Integer, MediaDimension> getSizes() {
|
||||
return sizes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RemoteMediaStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MediaType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SortedMap<Integer, String> getUrls() {
|
||||
return urls;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCaption(String caption) {
|
||||
this.caption = caption;
|
||||
}
|
||||
|
||||
public Photo(String id,
|
||||
String caption,
|
||||
SortedMap<Integer, String> urls,
|
||||
SortedMap<Integer, MediaDimension> sizes,
|
||||
long athleteId,
|
||||
String createdAt,
|
||||
String createdAtLocal,
|
||||
Long activityId,
|
||||
String activityName,
|
||||
RemoteMediaStatus status,
|
||||
String tag,
|
||||
String cursor) {
|
||||
this.id = id;
|
||||
this.caption = caption;
|
||||
this.urls = urls;
|
||||
this.sizes = sizes;
|
||||
this.athleteId = athleteId;
|
||||
this.createdAt = createdAt;
|
||||
this.createdAtLocal = createdAtLocal;
|
||||
this.activityId = activityId;
|
||||
this.activityName = activityName;
|
||||
this.status = status;
|
||||
this.tag = tag;
|
||||
this.cursor = cursor;
|
||||
this.type = MediaType.PHOTO;
|
||||
}
|
||||
}
|
||||
|
||||
public static final class Video extends Media {
|
||||
private final Long activityId;
|
||||
private final String activityName;
|
||||
private final long athleteId;
|
||||
private String caption;
|
||||
private final String createdAt;
|
||||
private final String createdAtLocal;
|
||||
private final String cursor;
|
||||
private final Float durationSeconds;
|
||||
private final String id;
|
||||
private final SortedMap<Integer, MediaDimension> sizes;
|
||||
private final RemoteMediaStatus status;
|
||||
private final String tag;
|
||||
private final MediaType type;
|
||||
private final SortedMap<Integer, String> urls;
|
||||
private final String videoUrl;
|
||||
|
||||
@Override
|
||||
public Long getActivityId() {
|
||||
return activityId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getActivityName() {
|
||||
return activityName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAthleteId() {
|
||||
return athleteId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCaption() {
|
||||
return caption;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCreatedAtLocal() {
|
||||
return createdAtLocal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCursor() {
|
||||
return cursor;
|
||||
}
|
||||
|
||||
public final Float getDurationSeconds() {
|
||||
return durationSeconds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SortedMap<Integer, MediaDimension> getSizes() {
|
||||
return sizes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RemoteMediaStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MediaType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SortedMap<Integer, String> getUrls() {
|
||||
return urls;
|
||||
}
|
||||
|
||||
public final String getVideoUrl() {
|
||||
return videoUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCaption(String caption) {
|
||||
this.caption = caption;
|
||||
}
|
||||
|
||||
public Video(String id,
|
||||
String caption,
|
||||
SortedMap<Integer, String> urls,
|
||||
SortedMap<Integer, MediaDimension> sizes,
|
||||
long athleteId,
|
||||
String createdAt,
|
||||
String createdAtLocal,
|
||||
Long activityId,
|
||||
String activityName,
|
||||
RemoteMediaStatus status,
|
||||
String videoUrl,
|
||||
Float durationSeconds,
|
||||
String tag,
|
||||
String cursor) {
|
||||
this.id = id;
|
||||
this.caption = caption;
|
||||
this.urls = urls;
|
||||
this.sizes = sizes;
|
||||
this.athleteId = athleteId;
|
||||
this.createdAt = createdAt;
|
||||
this.createdAtLocal = createdAtLocal;
|
||||
this.activityId = activityId;
|
||||
this.activityName = activityName;
|
||||
this.status = status;
|
||||
this.videoUrl = videoUrl;
|
||||
this.durationSeconds = durationSeconds;
|
||||
this.tag = tag;
|
||||
this.cursor = cursor;
|
||||
this.type = MediaType.VIDEO;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract Long getActivityId();
|
||||
|
||||
public abstract String getActivityName();
|
||||
|
||||
public abstract long getAthleteId();
|
||||
|
||||
public abstract String getCreatedAt();
|
||||
|
||||
public abstract String getCreatedAtLocal();
|
||||
|
||||
public abstract String getCursor();
|
||||
|
||||
@Override
|
||||
public MediaDimension getLargestSize() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLargestUrl() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReferenceId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSmallestUrl() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract String getTag();
|
||||
|
||||
private Media() {
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue