Merge commits from upstream LBRY Android
This commit is contained in:
commit
624e0d7857
16 changed files with 119 additions and 50 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -66,3 +66,4 @@ app/twitter.properties
|
|||
*.hprof
|
||||
app/build
|
||||
bin
|
||||
app/debuglib
|
||||
|
|
|
@ -9,8 +9,8 @@ build apk:
|
|||
image: lbry/android-base:platform-28
|
||||
before_script:
|
||||
- echo "$PGP_PRIVATE_KEY" | gpg --batch --import
|
||||
- echo "deb https://dl.bintray.com/sobolevn/deb git-secret main" | tee -a /etc/apt/sources.list
|
||||
- wget -O - https://api.bintray.com/users/sobolevn/keys/gpg/public.key | apt-key add -
|
||||
- echo 'deb https://gitsecret.jfrog.io/artifactory/git-secret-deb git-secret main' >> /etc/apt/sources.list
|
||||
- wget -qO - 'https://gitsecret.jfrog.io/artifactory/api/gpg/key/public' | apt-key add -
|
||||
- apt-get -y update && apt-get -y install build-essential ca-certificates curl git gpg-agent openjdk-8-jdk software-properties-common wget zipalign git-secret
|
||||
- git secret reveal
|
||||
- chmod u+x $CI_PROJECT_DIR/gradlew
|
||||
|
@ -36,8 +36,8 @@ deploy build.lbry.io:
|
|||
before_script:
|
||||
- apt-get -y update && apt-get -y install apt-transport-https
|
||||
- echo "$PGP_PRIVATE_KEY" | gpg --batch --import
|
||||
- echo "deb https://dl.bintray.com/sobolevn/deb git-secret main" | tee -a /etc/apt/sources.list
|
||||
- wget -O - https://api.bintray.com/users/sobolevn/keys/gpg/public.key | apt-key add -
|
||||
- echo 'deb https://gitsecret.jfrog.io/artifactory/git-secret-deb git-secret main' >> /etc/apt/sources.list
|
||||
- wget -qO - 'https://gitsecret.jfrog.io/artifactory/api/gpg/key/public' | apt-key add -
|
||||
- apt-get -y update && apt-get -y install openjdk-8-jdk git git-secret
|
||||
- pip install awscli
|
||||
- chmod u+x $CI_PROJECT_DIR/gradlew
|
||||
|
@ -60,8 +60,8 @@ release apk:
|
|||
before_script:
|
||||
- apt-get -y update && apt-get -y install apt-transport-https
|
||||
- echo "$PGP_PRIVATE_KEY" | gpg --batch --import
|
||||
- echo "deb https://dl.bintray.com/sobolevn/deb git-secret main" | tee -a /etc/apt/sources.list
|
||||
- wget -O - https://api.bintray.com/users/sobolevn/keys/gpg/public.key | apt-key add -
|
||||
- echo 'deb https://gitsecret.jfrog.io/artifactory/git-secret-deb git-secret main' >> /etc/apt/sources.list
|
||||
- wget -qO - 'https://gitsecret.jfrog.io/artifactory/api/gpg/key/public' | apt-key add -
|
||||
- apt-get -y update && apt-get -y install openjdk-8-jdk git git-secret
|
||||
- pip install awscli githubrelease
|
||||
- git secret reveal
|
||||
|
|
|
@ -14,8 +14,8 @@ android {
|
|||
applicationId "io.lbry.browser"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 29
|
||||
versionCode 1700
|
||||
versionName "0.17.0"
|
||||
versionCode 1701
|
||||
versionName "0.17.1"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,8 @@ dependencies {
|
|||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
|
||||
__32bitImplementation 'io.lbry:lbrysdk32:0.91.0'
|
||||
// __64bitImplementation 'io.lbry:lbrysdk64:0.91.0'
|
||||
__32bitImplementation 'io.lbry:lbrysdk32:0.100.0'
|
||||
//__64bitImplementation 'io.lbry:lbrysdk64:0.100.0'
|
||||
//__64bitImplementation(name: 'lbrysdk', ext: 'aar')
|
||||
}
|
||||
|
||||
|
|
|
@ -137,6 +137,14 @@ public class Claim {
|
|||
return null;
|
||||
}
|
||||
|
||||
public boolean hasSource() {
|
||||
if (value instanceof StreamMetadata) {
|
||||
StreamMetadata metadata = (StreamMetadata) value;
|
||||
return metadata.getSource() != null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isPlayable() {
|
||||
if (value instanceof StreamMetadata) {
|
||||
StreamMetadata metadata = (StreamMetadata) value;
|
||||
|
|
|
@ -230,7 +230,8 @@ public class ChannelContentFragment extends Fragment implements DownloadActionLi
|
|||
0,
|
||||
0,
|
||||
currentClaimSearchPage == 0 ? 1 : currentClaimSearchPage,
|
||||
Helper.CONTENT_PAGE_SIZE);
|
||||
Helper.CONTENT_PAGE_SIZE,
|
||||
true);
|
||||
}
|
||||
|
||||
private List<String> getContentSortOrder() {
|
||||
|
|
|
@ -421,7 +421,8 @@ public class AllContentFragment extends BaseFragment implements DownloadActionLi
|
|||
0,
|
||||
0,
|
||||
currentClaimSearchPage == 0 ? 1 : currentClaimSearchPage,
|
||||
Helper.CONTENT_PAGE_SIZE);
|
||||
Helper.CONTENT_PAGE_SIZE,
|
||||
true);
|
||||
}
|
||||
|
||||
private List<String> getContentSortOrder() {
|
||||
|
|
|
@ -79,7 +79,8 @@ public class EditorsChoiceFragment extends BaseFragment {
|
|||
Arrays.asList(Claim.ORDER_BY_RELEASE_TIME),
|
||||
null,
|
||||
1,
|
||||
99);
|
||||
99,
|
||||
true);
|
||||
}
|
||||
|
||||
public void onResume() {
|
||||
|
|
|
@ -1515,7 +1515,7 @@ public class FileViewFragment extends BaseFragment implements
|
|||
Helper.setViewVisibility(layoutLoadingState, View.GONE);
|
||||
Helper.setViewVisibility(layoutNothingAtLocation, View.GONE);
|
||||
|
||||
if (claim.getTags().contains("disable-support") || claim.getSigningChannel().getTags().contains("disable-support"))
|
||||
if ((claim.getTags() != null && claim.getTags().contains("disable-support")) || (claim.getSigningChannel() != null && claim.getSigningChannel().getTags().contains("disable-support")))
|
||||
Helper.setViewVisibility(tipButton, View.GONE);
|
||||
else
|
||||
Helper.setViewVisibility(tipButton, View.VISIBLE);
|
||||
|
@ -1618,7 +1618,7 @@ public class FileViewFragment extends BaseFragment implements
|
|||
root.findViewById(R.id.file_view_open_external_button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
openClaimExternally(claim, claim.getMediaType());
|
||||
openClaimExternally(claim, claim.getMediaType(), !claim.hasSource());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1676,7 +1676,10 @@ public class FileViewFragment extends BaseFragment implements
|
|||
restoreMainActionButton();
|
||||
}
|
||||
|
||||
if (Lbry.SDK_READY && !claim.isPlayable() && !claim.isViewable() && Helper.isNullOrEmpty(commentHash)) {
|
||||
if (Lbry.SDK_READY) {
|
||||
if (!claim.hasSource()) {
|
||||
showUnsupportedView();
|
||||
} else if (!claim.isPlayable() && !claim.isViewable() && Helper.isNullOrEmpty(commentHash)) {
|
||||
if (claim.getFile() == null) {
|
||||
loadFile();
|
||||
} else {
|
||||
|
@ -1684,6 +1687,7 @@ public class FileViewFragment extends BaseFragment implements
|
|||
showUnsupportedView();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkRewardsDriver();
|
||||
checkOwnClaim();
|
||||
|
@ -1705,7 +1709,7 @@ public class FileViewFragment extends BaseFragment implements
|
|||
View commentsDisabledText = root.findViewById(R.id.file_view_disabled_comments);
|
||||
View commentForm = root.findViewById(R.id.container_comment_form);
|
||||
RecyclerView commentsList = root.findViewById(R.id.file_view_comments_list);
|
||||
if (claim.getTags().contains("disable-comments") || claim.getSigningChannel().getTags().contains("disable-comments")) {
|
||||
if ((claim.getTags() != null && (claim.getTags().contains("disable-comments")) || (claim.getSigningChannel() != null && claim.getSigningChannel().getTags().contains("disable-comments")))) {
|
||||
Helper.setViewVisibility(commentsDisabledText, View.VISIBLE);
|
||||
Helper.setViewVisibility(commentForm, View.GONE);
|
||||
Helper.setViewVisibility(commentsList, View.GONE);
|
||||
|
@ -1725,6 +1729,7 @@ public class FileViewFragment extends BaseFragment implements
|
|||
if (root != null) {
|
||||
root.findViewById(R.id.file_view_exoplayer_container).setVisibility(View.GONE);
|
||||
root.findViewById(R.id.file_view_unsupported_container).setVisibility(View.VISIBLE);
|
||||
if (claim.hasSource()) {
|
||||
String fileNameString = "";
|
||||
if (claim.getFile() != null && !Helper.isNullOrEmpty(claim.getFile().getDownloadPath())) {
|
||||
LbryFile lbryFile = claim.getFile();
|
||||
|
@ -1732,6 +1737,11 @@ public class FileViewFragment extends BaseFragment implements
|
|||
fileNameString = String.format("\"%s\" ", file.getName());
|
||||
}
|
||||
((TextView) root.findViewById(R.id.file_view_unsupported_text)).setText(getString(R.string.unsupported_content_desc, fileNameString));
|
||||
((MaterialButton) root.findViewById(R.id.file_view_open_external_button)).setText(getString(R.string.open));
|
||||
} else {
|
||||
((TextView) root.findViewById(R.id.file_view_unsupported_text)).setText(getString(R.string.unsupported_content_to_odysee_desc));
|
||||
((MaterialButton) root.findViewById(R.id.file_view_open_external_button)).setText(getString(R.string.open_on_odysee_com));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2173,7 +2183,7 @@ public class FileViewFragment extends BaseFragment implements
|
|||
handled = true;
|
||||
}
|
||||
} else {
|
||||
openClaimExternally(claim, mediaType);
|
||||
openClaimExternally(claim, mediaType, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2257,7 +2267,16 @@ public class FileViewFragment extends BaseFragment implements
|
|||
" </html>";
|
||||
}
|
||||
|
||||
private void openClaimExternally(Claim claim, String mediaType) {
|
||||
private void openClaimExternally(Claim claim, String mediaType, boolean odyseeLink) {
|
||||
if (odyseeLink) {
|
||||
try {
|
||||
LbryUri lbryUri = LbryUri.parse(claim.getCanonicalUrl());
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(lbryUri.toOdyseeString()));
|
||||
startActivity(intent);
|
||||
} catch (LbryUriException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
Uri fileUri = Uri.parse(claim.getFile().getDownloadPath());
|
||||
|
||||
Intent intent = new Intent();
|
||||
|
@ -2267,6 +2286,7 @@ public class FileViewFragment extends BaseFragment implements
|
|||
Intent chooser = Intent.createChooser(intent, getString(R.string.choose_app));
|
||||
startActivityForResult(chooser, 419);
|
||||
}
|
||||
}
|
||||
|
||||
public void showError(String message) {
|
||||
View root = getView();
|
||||
|
|
|
@ -415,7 +415,8 @@ public class FollowingFragment extends BaseFragment implements
|
|||
Arrays.asList(Claim.ORDER_BY_EFFECTIVE_AMOUNT),
|
||||
null,
|
||||
currentSuggestedPage == 0 ? 1 : currentSuggestedPage,
|
||||
SUGGESTED_PAGE_SIZE);
|
||||
SUGGESTED_PAGE_SIZE,
|
||||
true);
|
||||
}
|
||||
|
||||
private Map<String, Object> buildContentOptions() {
|
||||
|
@ -437,7 +438,8 @@ public class FollowingFragment extends BaseFragment implements
|
|||
0,
|
||||
0,
|
||||
currentClaimSearchPage == 0 ? 1 : currentClaimSearchPage,
|
||||
Helper.CONTENT_PAGE_SIZE);
|
||||
Helper.CONTENT_PAGE_SIZE,
|
||||
true);
|
||||
}
|
||||
|
||||
private List<String> getChannelIds() {
|
||||
|
|
|
@ -210,7 +210,8 @@ public class ShuffleFragment extends BaseFragment {
|
|||
121, // 2 minutes or less
|
||||
1,
|
||||
currentClaimSearchPage == 0 ? 1 : currentClaimSearchPage,
|
||||
PAGE_SIZE);
|
||||
PAGE_SIZE,
|
||||
true);
|
||||
}
|
||||
|
||||
public void onStart() {
|
||||
|
|
|
@ -688,7 +688,7 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
|
|||
double totalBalance = walletBalance.getTotal().doubleValue();
|
||||
double spendableBalance = walletBalance.getAvailable().doubleValue();
|
||||
double supportingBalance = walletBalance.getClaims().doubleValue() + walletBalance.getTips().doubleValue() + walletBalance.getSupports().doubleValue();
|
||||
double usdBalance = spendableBalance * Lbryio.LBCUSDRate;
|
||||
double usdBalance = totalBalance * Lbryio.LBCUSDRate;
|
||||
double tipsBalance = walletBalance.getTips().doubleValue();
|
||||
|
||||
if (detailRows == null)
|
||||
|
|
|
@ -373,7 +373,7 @@ public final class Lbry {
|
|||
|
||||
// build claim search for surf mode
|
||||
public static Map<String, Object> buildClaimSearchOptions(
|
||||
String claimType, List<String> notTags, List<String> channelIds, List<String> orderBy, long maxDuration, int limitClaimsPerChannel, int page, int pageSize) {
|
||||
String claimType, List<String> notTags, List<String> channelIds, List<String> orderBy, long maxDuration, int limitClaimsPerChannel, int page, int pageSize, boolean hasSource) {
|
||||
return buildClaimSearchOptions(
|
||||
Collections.singletonList(claimType),
|
||||
null,
|
||||
|
@ -385,7 +385,8 @@ public final class Lbry {
|
|||
maxDuration,
|
||||
limitClaimsPerChannel,
|
||||
page,
|
||||
pageSize);
|
||||
pageSize,
|
||||
hasSource);
|
||||
}
|
||||
|
||||
public static Map<String, Object> buildClaimSearchOptions(
|
||||
|
@ -397,7 +398,8 @@ public final class Lbry {
|
|||
List<String> orderBy,
|
||||
String releaseTime,
|
||||
int page,
|
||||
int pageSize) {
|
||||
int pageSize,
|
||||
boolean hasSource) {
|
||||
return buildClaimSearchOptions(
|
||||
Collections.singletonList(claimType),
|
||||
anyTags,
|
||||
|
@ -409,7 +411,8 @@ public final class Lbry {
|
|||
0,
|
||||
0,
|
||||
page,
|
||||
pageSize);
|
||||
pageSize,
|
||||
hasSource);
|
||||
}
|
||||
|
||||
public static Map<String, Object> buildClaimSearchOptions(
|
||||
|
@ -423,7 +426,8 @@ public final class Lbry {
|
|||
long maxDuration,
|
||||
int limitClaimsPerChannel,
|
||||
int page,
|
||||
int pageSize) {
|
||||
int pageSize,
|
||||
boolean hasSource) {
|
||||
Map<String, Object> options = new HashMap<>();
|
||||
if (claimType != null && claimType.size() > 0) {
|
||||
options.put("claim_type", claimType);
|
||||
|
@ -441,6 +445,12 @@ public final class Lbry {
|
|||
options.put("limit_claims_per_channel", limitClaimsPerChannel);
|
||||
}
|
||||
|
||||
if (hasSource) {
|
||||
options.put("has_source", true);
|
||||
} else {
|
||||
options.put("has_no_source", true);
|
||||
}
|
||||
|
||||
addClaimSearchListOption("any_tags", anyTags, options);
|
||||
addClaimSearchListOption("not_tags", notTags, options);
|
||||
addClaimSearchListOption("channel_ids", channelIds, options);
|
||||
|
|
|
@ -16,6 +16,7 @@ import static org.apache.commons.codec.CharEncoding.UTF_8;
|
|||
@Data
|
||||
public class LbryUri {
|
||||
public static final String LBRY_TV_BASE_URL = "https://lbry.tv/";
|
||||
public static final String ODYSEE_COM_BASE_URL = "https://odysee.com/";
|
||||
public static final String PROTO_DEFAULT = "lbry://";
|
||||
public static final String REGEX_INVALID_URI = "[ =&#:$@%?;/\\\\\"<>%\\{\\}|^~\\[\\]`\u0000-\u0008\u000b-\u000c\u000e-\u001F\uD800-\uDFFF\uFFFE-\uFFFF]";
|
||||
public static final String REGEX_ADDRESS = "^(b)(?=[^0OIl]{32,33})[0-9A-Za-z]{32,33}$";
|
||||
|
@ -202,7 +203,7 @@ public class LbryUri {
|
|||
}
|
||||
String primaryClaimName = null;
|
||||
|
||||
if (protocol.equals(LBRY_TV_BASE_URL) && Helper.isNullOrEmpty(formattedChannelName)) {
|
||||
if ((protocol.equals(LBRY_TV_BASE_URL) || protocol.equals(ODYSEE_COM_BASE_URL)) && Helper.isNullOrEmpty(formattedChannelName)) {
|
||||
try {
|
||||
primaryClaimName = URLEncoder.encode(claimName, UTF_8);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
|
@ -241,7 +242,7 @@ public class LbryUri {
|
|||
secondaryClaimName = contentName;
|
||||
}
|
||||
if (Helper.isNullOrEmpty(secondaryClaimName)) {
|
||||
if (protocol.equals(LBRY_TV_BASE_URL)) {
|
||||
if (protocol.equals(LBRY_TV_BASE_URL) || protocol.equals(ODYSEE_COM_BASE_URL)) {
|
||||
try {
|
||||
secondaryClaimName = !Helper.isNullOrEmpty(formattedChannelName) ? URLEncoder.encode(streamName, UTF_8) : null;
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
|
@ -254,7 +255,7 @@ public class LbryUri {
|
|||
String secondaryClaimId = !Helper.isNullOrEmpty(secondaryClaimName) ? streamClaimId : null;
|
||||
|
||||
if (!Helper.isNullOrEmpty(primaryClaimId)) {
|
||||
if (protocol.equals(LBRY_TV_BASE_URL))
|
||||
if (protocol.equals(LBRY_TV_BASE_URL) || protocol.equals(ODYSEE_COM_BASE_URL))
|
||||
sb.append(':').append(primaryClaimId);
|
||||
else
|
||||
sb.append('#').append(primaryClaimId);
|
||||
|
@ -269,7 +270,7 @@ public class LbryUri {
|
|||
}
|
||||
|
||||
if (!Helper.isNullOrEmpty(secondaryClaimId)) {
|
||||
if (protocol.equals(LBRY_TV_BASE_URL))
|
||||
if (protocol.equals(LBRY_TV_BASE_URL) || protocol.equals(ODYSEE_COM_BASE_URL))
|
||||
sb.append(':').append(secondaryClaimId);
|
||||
else
|
||||
sb.append('#').append(secondaryClaimId);
|
||||
|
@ -289,6 +290,9 @@ public class LbryUri {
|
|||
public String toTvString() {
|
||||
return build(true, LBRY_TV_BASE_URL, false);
|
||||
}
|
||||
public String toOdyseeString() {
|
||||
return build(true, ODYSEE_COM_BASE_URL, false);
|
||||
}
|
||||
public String toVanityString() {
|
||||
return build(true, PROTO_DEFAULT, true);
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
<string name="delete">Delete</string>
|
||||
<string name="download">Download</string>
|
||||
<string name="open">Open</string>
|
||||
<string name="open_on_odysee_com">Open on ODYSEE.COM</string>
|
||||
<string name="report">Report</string>
|
||||
<string name="loading_decentralized_data">Loading decentralized data…</string>
|
||||
<string name="related_content">Related Content</string>
|
||||
|
@ -71,6 +72,7 @@
|
|||
<string name="play">Play</string>
|
||||
<string name="unsupported_content">Unsupported Content</string>
|
||||
<string name="unsupported_content_desc">Sorry, we are unable to display this content in the app. You can find the file %1$sin your downloads folder.</string>
|
||||
<string name="unsupported_content_to_odysee_desc">Sorry, we are unable to display this content in the app. Click the button to open it on the Odysee website.</string>
|
||||
<string name="nothing_at_this_location">There\'s nothing at this location.</string>
|
||||
<string name="dmca_complaint_blocked">In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content from our applications. <a href="https://lbry.com/faq/dmca">Read more</a></string>
|
||||
<string name="dmca_complaint_channel_blocked">In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this channel from our applications. <a href="https://lbry.com/faq/dmca">Read more</a></string>
|
||||
|
|
|
@ -178,6 +178,19 @@ public class LbryUriTest {
|
|||
assertEquals("https://lbry.tv/@test:1/La-Peur%2C-Nos-Attentats%2C-c%27est-VOTRE-Se%CC%81curite%CC%81%21-Les-Guignols:6", obtained.toTvString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lbryToOdyseeString() {
|
||||
LbryUri obtained = new LbryUri();
|
||||
|
||||
try {
|
||||
obtained = LbryUri.parse("lbry://@lbry#3f/lbryturns4#6",false);
|
||||
} catch (LbryUriException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
assertEquals("https://odysee.com/@lbry:3f/lbryturns4:6", obtained.toOdyseeString());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private LbryUri sinthesizeExpected() {
|
||||
LbryUri expectedForChannel = new LbryUri();
|
||||
|
|
|
@ -5,7 +5,7 @@ buildscript {
|
|||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.6.4'
|
||||
|
@ -20,7 +20,11 @@ allprojects {
|
|||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
maven { url "https://jitpack.io" }
|
||||
/*flatDir {
|
||||
dirs 'debuglib'
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue