Compare commits

..

No commits in common. "master" and "0.17.1" have entirely different histories.

26 changed files with 51 additions and 166 deletions

View file

@ -1 +0,0 @@

View file

@ -28,8 +28,6 @@ twitterConsumerKey=XXXXXX
twitterConsumerSecret=XXXXXX twitterConsumerSecret=XXXXXX
``` ```
Copy the file 'google-services.sample.json' to 'google-services.json' in the app/ folder.
Click the Sync button and when process finishes, the Run button to launch the app on your simulator or connected debugging device after the build process is complete. Click the Sync button and when process finishes, the Run button to launch the app on your simulator or connected debugging device after the build process is complete.
## Contributing ## Contributing
@ -39,7 +37,7 @@ Contributions to this project are welcome, encouraged, and compensated. For more
This project is MIT licensed. For the full license, see [LICENSE](LICENSE). This project is MIT licensed. For the full license, see [LICENSE](LICENSE).
## Security ## Security
We take security seriously. Please contact security@lbry.com regarding any security issues. Our PGP key is [here](https://lbry.com/faq/pgp-key) if you need it. We take security seriously. Please contact security@lbry.com regarding any security issues. Our PGP key is [here](https://keybase.io/lbry/key.asc) if you need it.
## Contact ## Contact
The primary contact for this project is [@akinwale](https://github.com/akinwale) (akinwale@lbry.com) The primary contact for this project is [@akinwale](https://github.com/akinwale) (akinwale@lbry.com)

View file

@ -21,7 +21,7 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
packagingOptions { packagingOptions {
exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/DEPENDENCIES'
exclude 'lib/x86_64/darwin/libscrypt.dylib' exclude 'lib/x86_64/darwin/libscrypt.dylib'
} }
@ -122,9 +122,6 @@ dependencies {
implementation 'org.bitcoinj:bitcoinj-tools:0.14.7' implementation 'org.bitcoinj:bitcoinj-tools:0.14.7'
implementation 'org.java-websocket:Java-WebSocket:1.5.1' implementation 'org.java-websocket:Java-WebSocket:1.5.1'
implementation ('com.journeyapps:zxing-android-embedded:4.1.0') { transitive = false }
implementation 'com.google.zxing:core:3.3.0'
compileOnly 'org.projectlombok:lombok:1.18.10' compileOnly 'org.projectlombok:lombok:1.18.10'
annotationProcessor 'org.projectlombok:lombok:1.18.10' annotationProcessor 'org.projectlombok:lombok:1.18.10'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
@ -135,8 +132,8 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.2' androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
__32bitImplementation 'io.lbry:lbrysdk32:0.102.0' __32bitImplementation 'io.lbry:lbrysdk32:0.100.0'
__64bitImplementation 'io.lbry:lbrysdk64:0.102.0' __64bitImplementation 'io.lbry:lbrysdk64:0.100.0'
//__64bitImplementation(name: 'lbrysdk', ext: 'aar') //__64bitImplementation(name: 'lbrysdk', ext: 'aar')
} }

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="io.lbry.browser" package="io.lbry.browser"
android:installLocation="auto"> android:installLocation="auto">
@ -14,8 +13,6 @@
<uses-permission android:name="com.android.vending.BILLING" /> <uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.WAKE_LOCK"/> <uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-sdk tools:overrideLibrary="com.google.zxing.client.android" />
<application <application
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
@ -101,11 +98,6 @@
android:theme="@style/AppTheme.NoActionBarTranslucent" android:theme="@style/AppTheme.NoActionBarTranslucent"
android:windowSoftInputMode="adjustResize" /> android:windowSoftInputMode="adjustResize" />
<activity
android:name="com.journeyapps.barcodescanner.CaptureActivity"
android:screenOrientation="fullSensor"
tools:replace="screenOrientation" />
<service <service
android:name="io.lbry.browser.LbrynetMessagingService" android:name="io.lbry.browser.LbrynetMessagingService"
android:exported="false"> android:exported="false">

View file

@ -2102,7 +2102,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
if (nowPlayingClaimBitmap == null && if (nowPlayingClaimBitmap == null &&
nowPlayingClaim != null && nowPlayingClaim != null &&
!Helper.isNullOrEmpty(nowPlayingClaim.getThumbnailUrl())) { !Helper.isNullOrEmpty(nowPlayingClaim.getThumbnailUrl())) {
Glide.with(getApplicationContext()).asBitmap().load(nowPlayingClaim.getThumbnailUrl(0, 0, 75)).into(new CustomTarget<Bitmap>() { Glide.with(getApplicationContext()).asBitmap().load(nowPlayingClaim.getThumbnailUrl()).into(new CustomTarget<Bitmap>() {
@Override @Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) { public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
nowPlayingClaimBitmap = resource; nowPlayingClaimBitmap = resource;

View file

@ -95,7 +95,7 @@ public class ChannelFilterListAdapter extends RecyclerView.Adapter<ChannelFilter
vh.allView.setVisibility(claim.isPlaceholder() ? View.VISIBLE : View.GONE); vh.allView.setVisibility(claim.isPlaceholder() ? View.VISIBLE : View.GONE);
vh.titleView.setText(Helper.isNullOrEmpty(claim.getTitle()) ? claim.getName() : claim.getTitle()); vh.titleView.setText(Helper.isNullOrEmpty(claim.getTitle()) ? claim.getName() : claim.getTitle());
String thumbnailUrl = claim.getThumbnailUrl(vh.thumbnailView.getLayoutParams().width, vh.thumbnailView.getLayoutParams().height, 85); String thumbnailUrl = claim.getThumbnailUrl();
if (!Helper.isNullOrEmpty(thumbnailUrl) && context != null) { if (!Helper.isNullOrEmpty(thumbnailUrl) && context != null) {
Glide.with(context.getApplicationContext()).load(thumbnailUrl).apply(RequestOptions.circleCropTransform()).into(vh.thumbnailView); Glide.with(context.getApplicationContext()).load(thumbnailUrl).apply(RequestOptions.circleCropTransform()).into(vh.thumbnailView);
} }

View file

@ -334,8 +334,7 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
if (metadata instanceof Claim.StreamMetadata) { if (metadata instanceof Claim.StreamMetadata) {
streamMetadata = (Claim.StreamMetadata) metadata; streamMetadata = (Claim.StreamMetadata) metadata;
} }
String thumbnailUrl = item.getThumbnailUrl();
String thumbnailUrl = item.getThumbnailUrl(vh.thumbnailView.getLayoutParams().width, vh.thumbnailView.getLayoutParams().height, 85);
long publishTime = (streamMetadata != null && streamMetadata.getReleaseTime() > 0) ? streamMetadata.getReleaseTime() * 1000 : item.getTimestamp() * 1000; long publishTime = (streamMetadata != null && streamMetadata.getReleaseTime() > 0) ? streamMetadata.getReleaseTime() * 1000 : item.getTimestamp() * 1000;
int bgColor = Helper.generateRandomColorForValue(item.getClaimId()); int bgColor = Helper.generateRandomColorForValue(item.getClaimId());
if (bgColor == 0) { if (bgColor == 0) {

View file

@ -190,7 +190,7 @@ public class CommentListAdapter extends RecyclerView.Adapter<CommentListAdapter.
int bgColor = Helper.generateRandomColorForValue(comment.getChannelId()); int bgColor = Helper.generateRandomColorForValue(comment.getChannelId());
Helper.setIconViewBackgroundColor(holder.noThumbnailView, bgColor, false, context); Helper.setIconViewBackgroundColor(holder.noThumbnailView, bgColor, false, context);
if (hasThumbnail) { if (hasThumbnail) {
Glide.with(context.getApplicationContext()).asBitmap().load(comment.getPoster().getThumbnailUrl(holder.thumbnailView.getLayoutParams().width, holder.thumbnailView.getLayoutParams().height, 85)). Glide.with(context.getApplicationContext()).asBitmap().load(comment.getPoster().getThumbnailUrl()).
apply(RequestOptions.circleCropTransform()).into(holder.thumbnailView); apply(RequestOptions.circleCropTransform()).into(holder.thumbnailView);
} }
holder.alphaView.setText(comment.getChannelName() != null ? comment.getChannelName().substring(1, 2).toUpperCase() : null); holder.alphaView.setText(comment.getChannelName() != null ? comment.getChannelName().substring(1, 2).toUpperCase() : null);

View file

@ -193,7 +193,7 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
vh.thumbnailView.setVisibility(notification.getCommentAuthor() == null ? View.INVISIBLE : View.VISIBLE); vh.thumbnailView.setVisibility(notification.getCommentAuthor() == null ? View.INVISIBLE : View.VISIBLE);
if (notification.getCommentAuthor() != null) { if (notification.getCommentAuthor() != null) {
Glide.with(context.getApplicationContext()).load( Glide.with(context.getApplicationContext()).load(
notification.getCommentAuthor().getThumbnailUrl(vh.thumbnailView.getLayoutParams().width, vh.thumbnailView.getLayoutParams().height, 85)).apply(RequestOptions.circleCropTransform()).into(vh.thumbnailView); notification.getCommentAuthor().getThumbnailUrl()).apply(RequestOptions.circleCropTransform()).into(vh.thumbnailView);
} }
vh.iconView.setVisibility(notification.getCommentAuthor() != null ? View.INVISIBLE : View.VISIBLE); vh.iconView.setVisibility(notification.getCommentAuthor() != null ? View.INVISIBLE : View.VISIBLE);

View file

@ -89,8 +89,7 @@ public class SuggestedChannelGridAdapter extends RecyclerView.Adapter<SuggestedC
@Override @Override
public void onBindViewHolder(SuggestedChannelGridAdapter.ViewHolder vh, int position) { public void onBindViewHolder(SuggestedChannelGridAdapter.ViewHolder vh, int position) {
Claim claim = items.get(position); Claim claim = items.get(position);
ViewGroup.LayoutParams lp = vh.thumbnailView.getLayoutParams(); String thumbnailUrl = claim.getThumbnailUrl();
String thumbnailUrl = claim.getThumbnailUrl(lp.width, lp.height, 85);
int bgColor = Helper.generateRandomColorForValue(claim.getClaimId()); int bgColor = Helper.generateRandomColorForValue(claim.getClaimId());
Helper.setIconViewBackgroundColor(vh.noThumbnailView, bgColor, false, context); Helper.setIconViewBackgroundColor(vh.noThumbnailView, bgColor, false, context);

View file

@ -1,7 +1,5 @@
package io.lbry.browser.model; package io.lbry.browser.model;
import androidx.annotation.Nullable;
import com.google.gson.FieldNamingPolicy; import com.google.gson.FieldNamingPolicy;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
@ -186,21 +184,6 @@ public class Claim {
return null; return null;
} }
/**
* Gets the URL from the CDN where getting the image file
* @param width Pass zero for width and height for the full size image file
* @param height Pass zero for width and height for the full size image file
* @param q Desired quality for the image to be retrieved
* @return URL from the CDN from where image can be retrieved
*/
public String getThumbnailUrl(int width, int height, int q) {
if (value != null && value.getThumbnail() != null) {
ImageCDNUrl imageCDNUrl = new ImageCDNUrl(Math.max(width, 0), Math.max(height, 0), q, null, value.getThumbnail().getUrl());
return imageCDNUrl.toString();
}
return null;
}
public String getCoverUrl() { public String getCoverUrl() {
if (TYPE_CHANNEL.equals(valueType) && value != null && value instanceof ChannelMetadata && ((ChannelMetadata) value).getCover() != null) { if (TYPE_CHANNEL.equals(valueType) && value != null && value instanceof ChannelMetadata && ((ChannelMetadata) value).getCover() != null) {
return ((ChannelMetadata) value).getCover().getUrl(); return ((ChannelMetadata) value).getCover().getUrl();
@ -508,30 +491,6 @@ public class Claim {
private String url; private String url;
} }
/**
* Object to be instantiated. In order to get the URLto the CDN, call toString() on it
*/
static class ImageCDNUrl {
private String appendedPath = "";
public ImageCDNUrl(int width, int height, int quality, @Nullable String format, String thumbnailUrl) {
if (width != 0 && height != 0)
appendedPath = "s:".concat(String.valueOf(width)).concat(":").concat(String.valueOf(height)).concat("/");
appendedPath = appendedPath.concat("quality:").concat(String.valueOf(quality)).concat("/");
appendedPath = appendedPath.concat("plain/").concat(thumbnailUrl);
if (format != null)
appendedPath = appendedPath.concat("@").concat(format);
}
@Override
public String toString() {
String url = "https://image-processor.vanwanet.com/optimize/";
return url.concat(appendedPath);
}
}
@Data @Data
public static class StreamInfo { public static class StreamInfo {
private long duration; // video / audio private long duration; // video / audio

View file

@ -467,7 +467,7 @@ public class ChannelCommentsFragment extends Fragment implements SdkStatusListen
if (hasThumbnail && context != null) { if (hasThumbnail && context != null) {
Glide.with(context.getApplicationContext()). Glide.with(context.getApplicationContext()).
asBitmap(). asBitmap().
load(channel.getThumbnailUrl(commentPostAsThumbnail.getLayoutParams().width, commentPostAsThumbnail.getLayoutParams().height, 85)). load(channel.getThumbnailUrl()).
apply(RequestOptions.circleCropTransform()). apply(RequestOptions.circleCropTransform()).
into(commentPostAsThumbnail); into(commentPostAsThumbnail);
} }

View file

@ -285,7 +285,7 @@ public class ChannelFormFragment extends BaseFragment implements
coverUrl = currentClaim.getCoverUrl(); coverUrl = currentClaim.getCoverUrl();
} }
if (!Helper.isNullOrEmpty(currentClaim.getThumbnailUrl())) { if (!Helper.isNullOrEmpty(currentClaim.getThumbnailUrl())) {
Glide.with(context.getApplicationContext()).load(currentClaim.getThumbnailUrl(imageThumbnail.getLayoutParams().width, imageThumbnail.getLayoutParams().height, 85)).apply(RequestOptions.circleCropTransform()).into(imageThumbnail); Glide.with(context.getApplicationContext()).load(currentClaim.getThumbnailUrl()).apply(RequestOptions.circleCropTransform()).into(imageThumbnail);
thumbnailUrl = currentClaim.getThumbnailUrl(); thumbnailUrl = currentClaim.getThumbnailUrl();
} }
} }

View file

@ -538,15 +538,11 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
else else
buttonTip.setVisibility(View.VISIBLE); buttonTip.setVisibility(View.VISIBLE);
String thumbnailUrl = ""; String thumbnailUrl = claim.getThumbnailUrl();
String coverUrl = claim.getCoverUrl(); String coverUrl = claim.getCoverUrl();
textTitle.setText(Helper.isNullOrEmpty(claim.getTitle()) ? claim.getName() : claim.getTitle()); textTitle.setText(Helper.isNullOrEmpty(claim.getTitle()) ? claim.getName() : claim.getTitle());
Context context = getContext(); Context context = getContext();
if (context != null) {
thumbnailUrl = claim.getThumbnailUrl(imageThumbnail.getLayoutParams().width, imageThumbnail.getLayoutParams().height, 85);
}
if (context != null && !Helper.isNullOrEmpty(coverUrl)) { if (context != null && !Helper.isNullOrEmpty(coverUrl)) {
Glide.with(context.getApplicationContext()).load(coverUrl).centerCrop().into(imageCover); Glide.with(context.getApplicationContext()).load(coverUrl).centerCrop().into(imageCover);
} }

View file

@ -316,10 +316,7 @@ public class FileViewFragment extends BaseFragment implements
hideBuffering(); hideBuffering();
if (loadingNewClaim) { if (loadingNewClaim) {
Context context = getContext(); MainActivity.appPlayer.setPlayWhenReady(Objects.requireNonNull((MainActivity) (getActivity())).isMediaAutoplayEnabled());
if (context instanceof MainActivity) {
MainActivity.appPlayer.setPlayWhenReady(((MainActivity) context).isMediaAutoplayEnabled());
}
loadingNewClaim = false; loadingNewClaim = false;
} }
} else if (playbackState == Player.STATE_BUFFERING) { } else if (playbackState == Player.STATE_BUFFERING) {
@ -1569,8 +1566,7 @@ public class FileViewFragment extends BaseFragment implements
int bgColor = Helper.generateRandomColorForValue(signingChannel.getClaimId()); int bgColor = Helper.generateRandomColorForValue(signingChannel.getClaimId());
Helper.setIconViewBackgroundColor(root.findViewById(R.id.file_view_publisher_no_thumbnail), bgColor, false, context); Helper.setIconViewBackgroundColor(root.findViewById(R.id.file_view_publisher_no_thumbnail), bgColor, false, context);
if (hasPublisherThumbnail && context != null) { if (hasPublisherThumbnail && context != null) {
ViewGroup.LayoutParams lp = root.findViewById(R.id.file_view_publisher_thumbnail).getLayoutParams(); Glide.with(context.getApplicationContext()).load(signingChannel.getThumbnailUrl()).
Glide.with(context.getApplicationContext()).load(signingChannel.getThumbnailUrl(lp.width, lp.height, 85)).
apply(RequestOptions.circleCropTransform()).into((ImageView) root.findViewById(R.id.file_view_publisher_thumbnail)); apply(RequestOptions.circleCropTransform()).into((ImageView) root.findViewById(R.id.file_view_publisher_thumbnail));
} }
((TextView) root.findViewById(R.id.file_view_publisher_thumbnail_alpha)). ((TextView) root.findViewById(R.id.file_view_publisher_thumbnail_alpha)).
@ -1610,7 +1606,7 @@ public class FileViewFragment extends BaseFragment implements
Claim.GenericMetadata metadata = claim.getValue(); Claim.GenericMetadata metadata = claim.getValue();
if (!Helper.isNullOrEmpty(claim.getThumbnailUrl())) { if (!Helper.isNullOrEmpty(claim.getThumbnailUrl())) {
ImageView thumbnailView = root.findViewById(R.id.file_view_thumbnail); ImageView thumbnailView = root.findViewById(R.id.file_view_thumbnail);
Glide.with(context.getApplicationContext()).asBitmap().load(claim.getThumbnailUrl(context.getResources().getDisplayMetrics().widthPixels, thumbnailView.getLayoutParams().height, 85)).centerCrop().into(thumbnailView); Glide.with(context.getApplicationContext()).asBitmap().load(claim.getThumbnailUrl()).centerCrop().into(thumbnailView);
} else { } else {
// display first x letters of claim name, with random background // display first x letters of claim name, with random background
} }
@ -3247,7 +3243,7 @@ public class FileViewFragment extends BaseFragment implements
if (hasThumbnail && context != null) { if (hasThumbnail && context != null) {
Glide.with(context.getApplicationContext()). Glide.with(context.getApplicationContext()).
asBitmap(). asBitmap().
load(channel.getThumbnailUrl(commentPostAsThumbnail.getLayoutParams().width, commentPostAsThumbnail.getLayoutParams().height, 85)). load(channel.getThumbnailUrl()).
apply(RequestOptions.circleCropTransform()). apply(RequestOptions.circleCropTransform()).
into(commentPostAsThumbnail); into(commentPostAsThumbnail);
} }

View file

@ -583,9 +583,7 @@ public class PublishFormFragment extends BaseFragment implements
Context context = getContext(); Context context = getContext();
try { try {
Claim.StreamMetadata metadata = (Claim.StreamMetadata) currentClaim.getValue(); Claim.StreamMetadata metadata = (Claim.StreamMetadata) currentClaim.getValue();
if (context != null) { uploadedThumbnailUrl = currentClaim.getThumbnailUrl();
uploadedThumbnailUrl = currentClaim.getThumbnailUrl(imageThumbnail.getLayoutParams().width, imageThumbnail.getLayoutParams().height, 85);
}
if (context != null && !Helper.isNullOrEmpty(uploadedThumbnailUrl)) { if (context != null && !Helper.isNullOrEmpty(uploadedThumbnailUrl)) {
Glide.with(context.getApplicationContext()).load(uploadedThumbnailUrl).centerCrop().into(imageThumbnail); Glide.with(context.getApplicationContext()).load(uploadedThumbnailUrl).centerCrop().into(imageThumbnail);
} }

View file

@ -3,7 +3,6 @@ package io.lbry.browser.ui.wallet;
import android.content.ClipData; import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.Color; import android.graphics.Color;
import android.net.Uri; import android.net.Uri;
@ -61,9 +60,6 @@ import java.util.concurrent.Future;
import javax.crypto.Mac; import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;
import com.google.zxing.integration.android.IntentIntegrator;
import com.google.zxing.integration.android.IntentResult;
import io.lbry.browser.MainActivity; import io.lbry.browser.MainActivity;
import io.lbry.browser.R; import io.lbry.browser.R;
import io.lbry.browser.adapter.TransactionListAdapter; import io.lbry.browser.adapter.TransactionListAdapter;
@ -121,7 +117,6 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
private ImageButton buttonCopyReceiveAddress; private ImageButton buttonCopyReceiveAddress;
private MaterialButton buttonGetNewAddress; private MaterialButton buttonGetNewAddress;
private TextInputEditText inputSendAddress; private TextInputEditText inputSendAddress;
private ImageButton buttonQRScanAddress;
private TextInputEditText inputSendAmount; private TextInputEditText inputSendAmount;
private MaterialButton buttonSend; private MaterialButton buttonSend;
private TextView textConnectedEmail; private TextView textConnectedEmail;
@ -167,7 +162,6 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
buttonCopyReceiveAddress = root.findViewById(R.id.wallet_copy_receive_address); buttonCopyReceiveAddress = root.findViewById(R.id.wallet_copy_receive_address);
buttonGetNewAddress = root.findViewById(R.id.wallet_get_new_address); buttonGetNewAddress = root.findViewById(R.id.wallet_get_new_address);
inputSendAddress = root.findViewById(R.id.wallet_input_send_address); inputSendAddress = root.findViewById(R.id.wallet_input_send_address);
buttonQRScanAddress = root.findViewById(R.id.wallet_qr_scan_address);
inputSendAmount = root.findViewById(R.id.wallet_input_amount); inputSendAmount = root.findViewById(R.id.wallet_input_amount);
buttonSend = root.findViewById(R.id.wallet_send); buttonSend = root.findViewById(R.id.wallet_send);
textConnectedEmail = root.findViewById(R.id.wallet_connected_email); textConnectedEmail = root.findViewById(R.id.wallet_connected_email);
@ -374,13 +368,6 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
copyReceiveAddress(); copyReceiveAddress();
} }
}); });
buttonQRScanAddress.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
IntentIntegrator intentIntegrator = IntentIntegrator.forSupportFragment(WalletFragment.this);
intentIntegrator.setOrientationLocked(false).initiateScan();
}
});
buttonSend.setOnClickListener(new View.OnClickListener() { buttonSend.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
@ -813,12 +800,4 @@ public class WalletFragment extends BaseFragment implements SdkStatusListener, W
checkRewardsDriverCard(rewardsDriverText, 0); checkRewardsDriverCard(rewardsDriverText, 0);
} }
} }
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == IntentIntegrator.REQUEST_CODE) {
IntentResult intentResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
String code = intentResult.getContents();
inputSendAddress.setText(code);
}
}
} }

View file

@ -51,7 +51,7 @@ public final class Lbry {
public static final int TTL_CLAIM_SEARCH_VALUE = 120000; // 2-minute TTL for cache public static final int TTL_CLAIM_SEARCH_VALUE = 120000; // 2-minute TTL for cache
public static final String SDK_CONNECTION_STRING = "http://127.0.0.1:5279"; public static final String SDK_CONNECTION_STRING = "http://127.0.0.1:5279";
public static final String LBRY_TV_CONNECTION_STRING = "https://api.na-backend.odysee.com/api/v1/proxy"; public static final String LBRY_TV_CONNECTION_STRING = "https://api.lbry.tv/api/v1/proxy";
public static final String TAG = "Lbry"; public static final String TAG = "Lbry";
// Values to obtain from LBRY SDK status // Values to obtain from LBRY SDK status

View file

@ -141,6 +141,20 @@ public class LbryUri {
boolean isChannel = includesChannel && Helper.isNullOrEmpty(possibleStreamName); boolean isChannel = includesChannel && Helper.isNullOrEmpty(possibleStreamName);
String channelName = includesChannel && streamOrChannelName.length() > 1 ? streamOrChannelName.substring(1) : null; String channelName = includesChannel && streamOrChannelName.length() > 1 ? streamOrChannelName.substring(1) : null;
/*
* It would have thrown already on the RegEx parser if protocol value was incorrect
* or HTTPS host was unknown to us.
*
* [https://] hosts use ':' as ModSeparators while [lbry://] protocol expects '#'
*/
if (!components.get(1).isEmpty()) {
if (primaryModSeparator.equals(":"))
primaryModSeparator = "#";
if (secondaryModSeparator.equals(":"))
secondaryModSeparator = "#";
}
if (includesChannel) { if (includesChannel) {
if (Helper.isNullOrEmpty(channelName)) { if (Helper.isNullOrEmpty(channelName)) {
throw new LbryUriException("No channel name after @."); throw new LbryUriException("No channel name after @.");
@ -315,9 +329,9 @@ public class LbryUri {
throw new LbryUriException(String.format("No modifier provided after separator %s", modSeparator)); throw new LbryUriException(String.format("No modifier provided after separator %s", modSeparator));
} }
if ("#".equals(modSeparator) || ":".equals(modSeparator)) { if ("#".equals(modSeparator)) {
claimId = modValue; claimId = modValue;
} else if ("*".equals(modSeparator)) { } else if (":".equals(modSeparator)) {
claimSequence = Helper.parseInt(modValue, -1); claimSequence = Helper.parseInt(modValue, -1);
} else if ("$".equals(modSeparator)) { } else if ("$".equals(modSeparator)) {
bidPosition = Helper.parseInt(modValue, -1); bidPosition = Helper.parseInt(modValue, -1);

View file

@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M9.5,6.5v3h-3v-3H9.5M11,5H5v6h6V5L11,5zM9.5,14.5v3h-3v-3H9.5M11,13H5v6h6V13L11,13zM17.5,6.5v3h-3v-3H17.5M19,5h-6v6h6V5L19,5zM13,13h1.5v1.5H13V13zM14.5,14.5H16V16h-1.5V14.5zM16,13h1.5v1.5H16V13zM13,16h1.5v1.5H13V16zM14.5,17.5H16V19h-1.5V17.5zM16,16h1.5v1.5H16V16zM17.5,14.5H19V16h-1.5V14.5zM17.5,17.5H19V19h-1.5V17.5zM22,7h-2V4h-3V2h5V7zM22,22v-5h-2v3h-3v2H22zM2,22h5v-2H4v-3H2V22zM2,2v5h2V4h3V2H2z"/>
</vector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 B

View file

@ -19,41 +19,18 @@
android:text="@string/send_credits" android:text="@string/send_credits"
android:textSize="20sp"/> android:textSize="20sp"/>
<RelativeLayout <com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:hint="@string/recipient_address">
android:orientation="horizontal"> <com.google.android.material.textfield.TextInputEditText
android:id="@+id/wallet_input_send_address"
<com.google.android.material.textfield.TextInputLayout android:fontFamily="@font/inter"
android:layout_centerVertical="true" android:textSize="14sp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:imeOptions="actionNext" />
android:hint="@string/recipient_address" </com.google.android.material.textfield.TextInputLayout>
android:layout_toStartOf="@id/wallet_qr_scan_address">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/wallet_input_send_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/inter"
android:imeOptions="actionNext"
android:textSize="14sp" />
</com.google.android.material.textfield.TextInputLayout>
<ImageButton
android:id="@+id/wallet_qr_scan_address"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginStart="8dp"
android:background="@null"
android:src="@drawable/ic_qr_scanner"
android:tint="@color/lbryGreen" />
</RelativeLayout>
<RelativeLayout <RelativeLayout
android:layout_marginTop="16dp" android:layout_marginTop="16dp"

View file

@ -10,7 +10,6 @@ import static org.junit.Assert.assertEquals;
public class LbryUriTest { public class LbryUriTest {
private LbryUri expected; private LbryUri expected;
private LbryUri expectedOctoshape;
/* /*
* Create an LbryUri object and assign fields manually using class methods. This object will be * Create an LbryUri object and assign fields manually using class methods. This object will be
@ -19,21 +18,14 @@ public class LbryUriTest {
@Before @Before
public void createExpected() { public void createExpected() {
expected = new LbryUri(); expected = new LbryUri();
expectedOctoshape = new LbryUri();
expected.setChannelName("@lbry"); expected.setChannelName("@lbry");
expected.setStreamName("lbryturns4"); expected.setStreamName("lbryturns4");
expectedOctoshape.setChannelName("@lbry");
expectedOctoshape.setStreamName("lbryturns4");
try { try {
LbryUri.UriModifier primaryMod = LbryUri.UriModifier.parse(":", "3f"); LbryUri.UriModifier primaryMod = LbryUri.UriModifier.parse("#", "3f");
LbryUri.UriModifier secondaryMod = LbryUri.UriModifier.parse(":", "6"); LbryUri.UriModifier secondaryMod = LbryUri.UriModifier.parse("#", "6");
LbryUri.UriModifier primaryModOctoshape = LbryUri.UriModifier.parse("#", "3f");
LbryUri.UriModifier secondaryModOctoshape = LbryUri.UriModifier.parse("#", "6");
expected.setChannelClaimId(primaryMod.getClaimId()); expected.setChannelClaimId(primaryMod.getClaimId());
expected.setStreamClaimId(secondaryMod.getClaimId()); expected.setStreamClaimId(secondaryMod.getClaimId());
expectedOctoshape.setChannelClaimId(primaryModOctoshape.getClaimId());
expectedOctoshape.setStreamClaimId(secondaryModOctoshape.getClaimId());
} catch (LbryUriException e) { } catch (LbryUriException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -79,7 +71,7 @@ public class LbryUriTest {
} }
@Test @Test
public void parseLbryProtocolWithChannelOctoshape() { public void parseLbryProtocolWithChannel() {
LbryUri obtained = new LbryUri(); LbryUri obtained = new LbryUri();
try { try {
@ -88,12 +80,12 @@ public class LbryUriTest {
e.printStackTrace(); e.printStackTrace();
} }
assertEquals(expectedOctoshape, obtained); assertEquals(expected, obtained);
} }
@Test @Test
public void parseLbryProtocolOnlyChannel() { public void parseLbryProtocolOnlyChannel() {
LbryUri expectedForChannel = sinthesizeExpectedChannelOctoshape(); LbryUri expectedForChannel = sinthesizeExpected();
LbryUri obtained = new LbryUri(); LbryUri obtained = new LbryUri();
@ -108,7 +100,7 @@ public class LbryUriTest {
@Test @Test
public void parseLbryTvProtocolOnlyChannel() { public void parseLbryTvProtocolOnlyChannel() {
LbryUri expectedForChannel = sinthesizeExpectedChannelOctoshape(); LbryUri expectedForChannel = sinthesizeExpected();
LbryUri obtained = new LbryUri(); LbryUri obtained = new LbryUri();
@ -200,7 +192,7 @@ public class LbryUriTest {
} }
@NotNull @NotNull
private LbryUri sinthesizeExpectedChannelOctoshape() { private LbryUri sinthesizeExpected() {
LbryUri expectedForChannel = new LbryUri(); LbryUri expectedForChannel = new LbryUri();
expectedForChannel.setChannelName("@UCBerkeley"); expectedForChannel.setChannelName("@UCBerkeley");
expectedForChannel.setChannel(true); expectedForChannel.setChannel(true);