Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b86444478 | ||
|
|
74c7a1de4d | ||
|
|
88a43dc679 | ||
|
|
1bb5ce72fa | ||
|
|
b4ce544965 | ||
|
|
1ec6f6173a | ||
|
|
8ee19b3f5c | ||
|
|
1055392b7f | ||
|
|
c772cf2ead | ||
|
|
481c50f465 | ||
|
|
71bc969f2a | ||
|
|
e4edebfed7 | ||
|
|
e8a5ab8307 | ||
|
|
3738f3af21 | ||
|
|
74d10e4199 | ||
|
|
080e00becf | ||
|
|
049d905d7d | ||
|
|
33094f8c88 | ||
|
|
6c44e503db | ||
|
|
fa78c80592 | ||
|
|
07630ca97b | ||
|
|
a2b6d4e570 | ||
|
|
9d6b3ddf81 | ||
|
|
0a2769859a | ||
|
|
c4a1ed801a | ||
|
|
453394bf1b |
No files matched your search
@@ -2,7 +2,7 @@
|
||||
[](https://ci.lbry.tech/lbry/lbry-android/commits/master)
|
||||
[](https://github.com/lbryio/lbry-android/blob/master/LICENSE)
|
||||
|
||||
An Android browser and wallet for the [LBRY](https://lbry.com) network. This app bundles [LBRY SDK](https://github.com/lbryio/lbry) as a background service with a UI layer built with React Native.
|
||||
An Android browser and wallet for the [LBRY](https://lbry.com) network.
|
||||
|
||||
|
||||
<img src="https://spee.ch/@lbry:3f/android-08-homepage.gif" alt="LBRY Android GIF" width="384px" />
|
||||
@@ -18,7 +18,7 @@ The minimum supported Android version is 5.0 Lollipop. There are two ways to ins
|
||||
The app can be launched by opening **LBRY** from the device's app drawer or via the shortcut on the home screen if that was created upon installation.
|
||||
|
||||
## Running from Source
|
||||
Please refer to https://github.com/lbryio/lbry-react-native/blob/master/README.md
|
||||
Clone the repository and open the project in Android Studio. Android Studio will automatically run the initial build process. Click the Run button to launch the app on your simulator or connected debugging device after the build process is complete.
|
||||
|
||||
## Contributing
|
||||
Contributions to this project are welcome, encouraged, and compensated. For more details, see https://lbry.io/faq/contributing
|
||||
|
||||
+4
-4
@@ -16,8 +16,8 @@ android {
|
||||
applicationId "io.lbry.browser"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 29
|
||||
versionCode 1513
|
||||
versionName "0.15.13"
|
||||
versionCode 1516
|
||||
versionName "0.15.16"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
@@ -101,8 +101,8 @@ dependencies {
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
|
||||
__32bitImplementation 'io.lbry:lbrysdk32:0.76.0'
|
||||
__64bitImplementation 'io.lbry:lbrysdk64:0.76.0'
|
||||
__32bitImplementation 'io.lbry:lbrysdk32:0.79.1'
|
||||
__64bitImplementation 'io.lbry:lbrysdk64:0.79.1'
|
||||
}
|
||||
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
|
||||
@@ -56,6 +56,13 @@
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="lbry" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<data android:scheme="https" android:host="open.lbry.com"/>
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
|
||||
Binary file not shown.
@@ -15,6 +15,7 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.text.HtmlCompat;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import io.lbry.browser.exceptions.AuthTokenInvalidatedException;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.Lbry;
|
||||
import io.lbry.browser.utils.LbryAnalytics;
|
||||
@@ -139,7 +140,11 @@ public class FirstRunActivity extends AppCompatActivity {
|
||||
this.context = context;
|
||||
}
|
||||
protected Void doInBackground(Void... params) {
|
||||
Lbryio.authenticate(context);
|
||||
try {
|
||||
Lbryio.authenticate(context);
|
||||
} catch (AuthTokenInvalidatedException ex) {
|
||||
// pass
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,9 +47,7 @@ import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.BitmapImageViewTarget;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.target.ImageViewTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.google.android.exoplayer2.Player;
|
||||
import com.google.android.exoplayer2.SimpleExoPlayer;
|
||||
@@ -109,7 +107,6 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -120,6 +117,7 @@ import io.lbry.browser.adapter.NavigationMenuAdapter;
|
||||
import io.lbry.browser.adapter.UrlSuggestionListAdapter;
|
||||
import io.lbry.browser.data.DatabaseHelper;
|
||||
import io.lbry.browser.dialog.ContentScopeDialogFragment;
|
||||
import io.lbry.browser.exceptions.AuthTokenInvalidatedException;
|
||||
import io.lbry.browser.exceptions.LbryUriException;
|
||||
import io.lbry.browser.listener.CameraPermissionListener;
|
||||
import io.lbry.browser.listener.DownloadActionListener;
|
||||
@@ -296,6 +294,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
public static final String PREFERENCE_KEY_INTERNAL_WALLET_RECEIVE_ADDRESS = "io.lbry.browser.preference.internal.WalletReceiveAddress";
|
||||
public static final String PREFERENCE_KEY_INTERNAL_REWARDS_NOT_INTERESTED = "io.lbry.browser.preference.internal.RewardsNotInterested";
|
||||
public static final String PREFERENCE_KEY_INTERNAL_NEW_ANDROID_REWARD_CLAIMED = "io.lbry.browser.preference.internal.NewAndroidRewardClaimed";
|
||||
public static final String PREFERENCE_KEY_INTERNAL_INITIAL_SUBSCRIPTION_MERGE_DONE = "io.lbry.browser.preference.internal.InitialSubscriptionMergeDone";
|
||||
|
||||
public static final String PREFERENCE_KEY_INTERNAL_FIRST_RUN_COMPLETED = "io.lbry.browser.preference.internal.FirstRunCompleted";
|
||||
public static final String PREFERENCE_KEY_INTERNAL_FIRST_AUTH_COMPLETED = "io.lbry.browser.preference.internal.FirstAuthCompleted";
|
||||
@@ -307,7 +306,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
public static final String SECURE_VALUE_KEY_SAVED_PASSWORD = "io.lbry.browser.PX";
|
||||
public static final String SECURE_VALUE_FIRST_RUN_PASSWORD = "firstRunPassword";
|
||||
|
||||
private static final String TAG = "io.lbry.browser.Main";
|
||||
private static final String TAG = "LbryMain";
|
||||
|
||||
private NavigationMenuAdapter navMenuAdapter;
|
||||
private UrlSuggestionListAdapter urlSuggestionListAdapter;
|
||||
@@ -554,6 +553,11 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
return sp.getBoolean(PREFERENCE_KEY_BACKGROUND_PLAYBACK, false);
|
||||
}
|
||||
|
||||
public boolean initialSubscriptionMergeDone() {
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
return sp.getBoolean(PREFERENCE_KEY_INTERNAL_INITIAL_SUBSCRIPTION_MERGE_DONE, false);
|
||||
}
|
||||
|
||||
private void initSpecialRouteMap() {
|
||||
specialRouteFragmentClassMap = new HashMap<>();
|
||||
specialRouteFragmentClassMap.put("about", AboutFragment.class);
|
||||
@@ -1563,7 +1567,6 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
|
||||
findViewById(R.id.global_sdk_initializing_status).setVisibility(View.GONE);
|
||||
|
||||
syncWalletAndLoadPreferences();
|
||||
scheduleWalletBalanceUpdate();
|
||||
scheduleWalletSyncTask();
|
||||
fetchOwnChannels();
|
||||
@@ -1780,17 +1783,25 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
// reload subscriptions if wallet fragment is FollowingFragment
|
||||
//openNavFragments.get
|
||||
MergeSubscriptionsTask mergeTask = new MergeSubscriptionsTask(
|
||||
subscriptions, MainActivity.this, new MergeSubscriptionsTask.MergeSubscriptionsHandler() {
|
||||
subscriptions,
|
||||
initialSubscriptionMergeDone(),
|
||||
MainActivity.this, new MergeSubscriptionsTask.MergeSubscriptionsHandler() {
|
||||
@Override
|
||||
public void onSuccess(List<Subscription> subscriptions, List<Subscription> diff) {
|
||||
Lbryio.subscriptions = new ArrayList<>(subscriptions);
|
||||
if (diff != null && diff.size() > 0) {
|
||||
saveSharedUserState();
|
||||
}
|
||||
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(MainActivity.this);
|
||||
sp.edit().putBoolean(PREFERENCE_KEY_INTERNAL_INITIAL_SUBSCRIPTION_MERGE_DONE, true).apply();
|
||||
Lbryio.cacheResolvedSubscriptions.clear();
|
||||
|
||||
for (Fragment fragment : openNavFragments.values()) {
|
||||
if (fragment instanceof FollowingFragment) {
|
||||
// reload local subscriptions
|
||||
((FollowingFragment) fragment).fetchLoadedSubscriptions(true);
|
||||
FollowingFragment followingFragment = (FollowingFragment) fragment;
|
||||
followingFragment.fetchLoadedSubscriptions(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1928,7 +1939,6 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
public void onSyncGetSuccess(WalletSync walletSync) {
|
||||
Lbryio.lastWalletSync = walletSync;
|
||||
Lbryio.lastRemoteHash = walletSync.getHash();
|
||||
loadSharedUserState();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2375,7 +2385,13 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
}
|
||||
startupStages.put(STARTUP_STAGE_EXCHANGE_RATE_LOADED, true);
|
||||
|
||||
Lbryio.authenticate(context);
|
||||
try {
|
||||
Lbryio.authenticate(context);
|
||||
} catch (AuthTokenInvalidatedException ex) {
|
||||
// if this happens, attempt to authenticate again, so that we can obtain a new auth token
|
||||
// this will also result in the user having to sign in again
|
||||
Lbryio.authenticate(context);
|
||||
}
|
||||
if (Lbryio.currentUser == null) {
|
||||
throw new Exception("Did not retrieve authenticated user.");
|
||||
}
|
||||
@@ -2628,7 +2644,6 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
LbryAnalytics.logEvent(LbryAnalytics.EVENT_LBRY_NOTIFICATION_OPEN, bundle);
|
||||
}
|
||||
|
||||
|
||||
private void registerServiceActionsReceiver() {
|
||||
IntentFilter intentFilter = new IntentFilter();
|
||||
intentFilter.addAction(DownloadManager.ACTION_DOWNLOAD_EVENT);
|
||||
@@ -2790,9 +2805,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||
JSONObject startupStatus = status.getJSONObject("startup_status");
|
||||
sdkReady = startupStatus.getBoolean("file_manager") && startupStatus.getBoolean("wallet");
|
||||
}
|
||||
} catch (ConnectException ex) {
|
||||
// pass
|
||||
} catch (JSONException ex) {
|
||||
} catch (ConnectException | JSONException ex) {
|
||||
// pass
|
||||
}
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
||||
|
||||
// only sign in required, don't do anything else
|
||||
showLoading();
|
||||
FetchCurrentUserTask task = new FetchCurrentUserTask(new FetchCurrentUserTask.FetchUserTaskHandler() {
|
||||
FetchCurrentUserTask task = new FetchCurrentUserTask(this, new FetchCurrentUserTask.FetchUserTaskHandler() {
|
||||
@Override
|
||||
public void onSuccess(User user) {
|
||||
Lbryio.currentUser = user;
|
||||
@@ -185,7 +185,7 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
||||
} else {
|
||||
// change pager view depending on flow
|
||||
showLoading();
|
||||
FetchCurrentUserTask task = new FetchCurrentUserTask(new FetchCurrentUserTask.FetchUserTaskHandler() {
|
||||
FetchCurrentUserTask task = new FetchCurrentUserTask(this, new FetchCurrentUserTask.FetchUserTaskHandler() {
|
||||
@Override
|
||||
public void onSuccess(User user) {
|
||||
hideLoading();
|
||||
@@ -229,7 +229,7 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
||||
@Override
|
||||
public void onPhoneVerified() {
|
||||
showLoading();
|
||||
FetchCurrentUserTask task = new FetchCurrentUserTask(new FetchCurrentUserTask.FetchUserTaskHandler() {
|
||||
FetchCurrentUserTask task = new FetchCurrentUserTask(this, new FetchCurrentUserTask.FetchUserTaskHandler() {
|
||||
@Override
|
||||
public void onSuccess(User user) {
|
||||
Lbryio.currentUser = user;
|
||||
|
||||
@@ -60,7 +60,13 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
|
||||
|
||||
public ClaimListAdapter(List<Claim> items, Context context) {
|
||||
this.context = context;
|
||||
this.items = new ArrayList<>(items);
|
||||
this.items = new ArrayList<>();
|
||||
for (Claim item : items) {
|
||||
if (item != null) {
|
||||
this.items.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
this.selectedItems = new ArrayList<>();
|
||||
quickClaimIdMap = new HashMap<>();
|
||||
quickClaimUrlMap = new HashMap<>();
|
||||
@@ -139,7 +145,7 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
|
||||
|
||||
public void addItems(List<Claim> claims) {
|
||||
for (Claim claim : claims) {
|
||||
if (!items.contains(claim)) {
|
||||
if (claim != null && !items.contains(claim)) {
|
||||
items.add(claim);
|
||||
}
|
||||
}
|
||||
@@ -149,7 +155,12 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
public void setItems(List<Claim> claims) {
|
||||
items = new ArrayList<>(claims);
|
||||
items = new ArrayList<>();
|
||||
for (Claim claim : claims) {
|
||||
if (claim != null) {
|
||||
items.add(claim);
|
||||
}
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@@ -308,7 +319,8 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
|
||||
|
||||
Claim original = items.get(position);
|
||||
boolean isRepost = Claim.TYPE_REPOST.equalsIgnoreCase(original.getValueType());
|
||||
final Claim item = Claim.TYPE_REPOST.equalsIgnoreCase(original.getValueType()) ? original.getRepostedClaim() : original;
|
||||
final Claim item = Claim.TYPE_REPOST.equalsIgnoreCase(original.getValueType()) ?
|
||||
(original.getRepostedClaim() != null ? original.getRepostedClaim() : original): original;
|
||||
Claim.GenericMetadata metadata = item.getValue();
|
||||
Claim signingChannel = item.getSigningChannel();
|
||||
Claim.StreamMetadata streamMetadata = null;
|
||||
@@ -383,7 +395,7 @@ public class ClaimListAdapter extends RecyclerView.Adapter<ClaimListAdapter.View
|
||||
|
||||
vh.publishTimeView.setVisibility(!isPending ? View.VISIBLE : View.GONE);
|
||||
vh.pendingTextView.setVisibility(isPending ? View.VISIBLE : View.GONE);
|
||||
vh.repostInfoView.setVisibility(isRepost ? View.VISIBLE : View.GONE);
|
||||
vh.repostInfoView.setVisibility(isRepost && type != VIEW_TYPE_FEATURED ? View.VISIBLE : View.GONE);
|
||||
vh.repostChannelView.setText(isRepost ? original.getSigningChannel().getName() : null);
|
||||
vh.repostChannelView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
||||
@@ -41,6 +41,12 @@ public class InlineChannelSpinnerAdapter extends ArrayAdapter<Claim> {
|
||||
channels.add(1, anonymous);
|
||||
}
|
||||
}
|
||||
public void addAnonymousPlaceholder() {
|
||||
Claim anonymous = new Claim();
|
||||
anonymous.setPlaceholderAnonymous(true);
|
||||
insert(anonymous, 0);
|
||||
channels.add(0, anonymous);
|
||||
}
|
||||
|
||||
public void addAll(Collection<? extends Claim> collection) {
|
||||
for (Claim claim : collection) {
|
||||
|
||||
@@ -64,6 +64,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
||||
};
|
||||
|
||||
private static final String SQL_INSERT_SUBSCRIPTION = "REPLACE INTO subscriptions (channel_name, url) VALUES (?, ?)";
|
||||
private static final String SQL_CLEAR_SUBSCRIPTIONS = "DELETE FROM subscriptions";
|
||||
private static final String SQL_DELETE_SUBSCRIPTION = "DELETE FROM subscriptions WHERE url = ?";
|
||||
private static final String SQL_GET_SUBSCRIPTIONS = "SELECT channel_name, url FROM subscriptions";
|
||||
|
||||
@@ -230,6 +231,9 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
||||
public static void deleteSubscription(Subscription subscription, SQLiteDatabase db) {
|
||||
db.execSQL(SQL_DELETE_SUBSCRIPTION, new Object[] { subscription.getUrl() });
|
||||
}
|
||||
public static void clearSubscriptions(SQLiteDatabase db) {
|
||||
db.execSQL(SQL_CLEAR_SUBSCRIPTIONS);
|
||||
}
|
||||
public static List<Subscription> getSubscriptions(SQLiteDatabase db) {
|
||||
List<Subscription> subscriptions = new ArrayList<>();
|
||||
Cursor cursor = null;
|
||||
|
||||
@@ -0,0 +1,346 @@
|
||||
package io.lbry.browser.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatSpinner;
|
||||
import androidx.core.text.HtmlCompat;
|
||||
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.google.android.material.switchmaterial.SwitchMaterial;
|
||||
import com.google.android.material.textfield.TextInputEditText;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.adapter.InlineChannelSpinnerAdapter;
|
||||
import io.lbry.browser.listener.WalletBalanceListener;
|
||||
import io.lbry.browser.model.Claim;
|
||||
import io.lbry.browser.model.WalletBalance;
|
||||
import io.lbry.browser.tasks.GenericTaskHandler;
|
||||
import io.lbry.browser.tasks.claim.ClaimListResultHandler;
|
||||
import io.lbry.browser.tasks.claim.ClaimListTask;
|
||||
import io.lbry.browser.tasks.wallet.SupportCreateTask;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.Lbry;
|
||||
import lombok.Setter;
|
||||
|
||||
public class CreateSupportDialogFragment extends BottomSheetDialogFragment implements WalletBalanceListener {
|
||||
public static final String TAG = "CreateSupportDialog";
|
||||
|
||||
private MaterialButton sendButton;
|
||||
private View cancelLink;
|
||||
private TextInputEditText inputAmount;
|
||||
private View inlineBalanceContainer;
|
||||
private TextView inlineBalanceValue;
|
||||
private ProgressBar sendProgress;
|
||||
|
||||
private InlineChannelSpinnerAdapter channelSpinnerAdapter;
|
||||
private AppCompatSpinner channelSpinner;
|
||||
private SwitchMaterial switchTip;
|
||||
|
||||
private boolean fetchingChannels;
|
||||
private ProgressBar progressLoadingChannels;
|
||||
|
||||
|
||||
@Setter
|
||||
private CreateSupportListener listener;
|
||||
@Setter
|
||||
private Claim claim;
|
||||
|
||||
public static CreateSupportDialogFragment newInstance() {
|
||||
return new CreateSupportDialogFragment();
|
||||
}
|
||||
|
||||
private void disableControls() {
|
||||
Dialog dialog = getDialog();
|
||||
if (dialog != null) {
|
||||
dialog.setCanceledOnTouchOutside(false);
|
||||
}
|
||||
channelSpinner.setEnabled(false);
|
||||
switchTip.setEnabled(false);
|
||||
sendButton.setEnabled(false);
|
||||
cancelLink.setEnabled(false);
|
||||
}
|
||||
private void enableControls() {
|
||||
Dialog dialog = getDialog();
|
||||
if (dialog != null) {
|
||||
dialog.setCanceledOnTouchOutside(true);
|
||||
}
|
||||
channelSpinner.setEnabled(true);
|
||||
switchTip.setEnabled(true);
|
||||
sendButton.setEnabled(true);
|
||||
cancelLink.setEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.dialog_create_support, container, false);
|
||||
|
||||
inputAmount = view.findViewById(R.id.create_support_input_amount);
|
||||
inlineBalanceContainer = view.findViewById(R.id.create_support_inline_balance_container);
|
||||
inlineBalanceValue = view.findViewById(R.id.create_support_inline_balance_value);
|
||||
sendProgress = view.findViewById(R.id.create_support_progress);
|
||||
cancelLink = view.findViewById(R.id.create_support_cancel_link);
|
||||
sendButton = view.findViewById(R.id.create_support_send);
|
||||
|
||||
channelSpinner = view.findViewById(R.id.create_support_channel_spinner);
|
||||
switchTip = view.findViewById(R.id.create_support_make_tip_switch);
|
||||
progressLoadingChannels = view.findViewById(R.id.create_support_channel_progress);
|
||||
|
||||
inputAmount.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View view, boolean hasFocus) {
|
||||
inputAmount.setHint(hasFocus ? getString(R.string.zero) : "");
|
||||
inlineBalanceContainer.setVisibility(hasFocus ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
});
|
||||
inputAmount.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
updateSendButtonText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
|
||||
}
|
||||
});
|
||||
updateInfoText();
|
||||
updateSendButtonText();
|
||||
|
||||
String channel = null;
|
||||
if (Claim.TYPE_CHANNEL.equalsIgnoreCase(claim.getValueType())) {
|
||||
channel = claim.getTitleOrName();
|
||||
} else if (claim.getSigningChannel() != null) {
|
||||
channel = claim.getPublisherTitle();
|
||||
}
|
||||
TextView titleView = view.findViewById(R.id.create_support_title);
|
||||
String tipTitleText = Helper.isNullOrEmpty(channel) ? getString(R.string.send_a_tip) : getString(R.string.send_a_tip_to, channel);
|
||||
titleView.setText(tipTitleText);
|
||||
|
||||
switchTip.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
if (checked) {
|
||||
// show tip info
|
||||
titleView.setText(tipTitleText);
|
||||
updateSendButtonText();
|
||||
} else {
|
||||
// show support info
|
||||
titleView.setText(R.string.support_this_content);
|
||||
sendButton.setText(R.string.send_revocable_support);
|
||||
}
|
||||
updateInfoText();
|
||||
}
|
||||
});
|
||||
|
||||
sendButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
String amountString = Helper.getValue(inputAmount.getText());
|
||||
if (Helper.isNullOrEmpty(amountString)) {
|
||||
showError(getString(R.string.invalid_amount));
|
||||
return;
|
||||
}
|
||||
|
||||
BigDecimal amount = new BigDecimal(amountString);
|
||||
if (amount.doubleValue() > Lbry.walletBalance.getAvailable().doubleValue()) {
|
||||
showError(getString(R.string.insufficient_balance));
|
||||
return;
|
||||
}
|
||||
if (amount.doubleValue() < Helper.MIN_SPEND) {
|
||||
showError(getString(R.string.min_spend_required));
|
||||
return;
|
||||
}
|
||||
|
||||
Claim selectedChannel = (Claim) channelSpinner.getSelectedItem();
|
||||
String channelId = !fetchingChannels && selectedChannel != null ? selectedChannel.getClaimId() : null;
|
||||
boolean isTip = switchTip.isChecked();
|
||||
SupportCreateTask task = new SupportCreateTask(
|
||||
claim.getClaimId(), channelId, amount, isTip, sendProgress, new GenericTaskHandler() {
|
||||
@Override
|
||||
public void beforeStart() {
|
||||
disableControls();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
enableControls();
|
||||
if (listener != null) {
|
||||
listener.onSupportCreated(amount, isTip);
|
||||
}
|
||||
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
showError(error.getMessage());
|
||||
enableControls();
|
||||
}
|
||||
});
|
||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
});
|
||||
|
||||
cancelLink.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
onWalletBalanceUpdated(Lbry.walletBalance);
|
||||
updateInfoText();
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
private void updateSendButtonText() {
|
||||
boolean isTip = switchTip.isChecked();
|
||||
if (!isTip) {
|
||||
sendButton.setText(R.string.send_revocable_support);
|
||||
} else {
|
||||
String amountString = Helper.getValue(inputAmount.getText());
|
||||
double parsedAmount = Helper.parseDouble(amountString, 0);
|
||||
sendButton.setText(parsedAmount == 0 ? getString(R.string.send_a_tip) : getString(R.string.send_lbc_tip, amountString));
|
||||
}
|
||||
}
|
||||
|
||||
private void updateInfoText() {
|
||||
View view = getView();
|
||||
if (view != null && switchTip != null) {
|
||||
TextView infoText = view.findViewById(R.id.create_support_info);
|
||||
boolean isTip = switchTip.isChecked();
|
||||
|
||||
infoText.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
if (!isTip) {
|
||||
infoText.setText(HtmlCompat.fromHtml(getString(R.string.support_info), HtmlCompat.FROM_HTML_MODE_LEGACY));
|
||||
} else if (claim != null) {
|
||||
infoText.setText(HtmlCompat.fromHtml(
|
||||
Claim.TYPE_CHANNEL.equalsIgnoreCase(claim.getValueType()) ?
|
||||
getString(R.string.send_tip_info_channel, claim.getTitleOrName()) :
|
||||
getString(R.string.send_tip_info_content, claim.getTitleOrName()),
|
||||
HtmlCompat.FROM_HTML_MODE_LEGACY));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void fetchChannels() {
|
||||
if (Lbry.ownChannels != null && Lbry.ownChannels.size() > 0) {
|
||||
updateChannelList(Lbry.ownChannels);
|
||||
return;
|
||||
}
|
||||
|
||||
fetchingChannels = true;
|
||||
disableChannelSpinner();
|
||||
ClaimListTask task = new ClaimListTask(Claim.TYPE_CHANNEL, progressLoadingChannels, new ClaimListResultHandler() {
|
||||
@Override
|
||||
public void onSuccess(List<Claim> claims) {
|
||||
Lbry.ownChannels = new ArrayList<>(claims);
|
||||
updateChannelList(Lbry.ownChannels);
|
||||
enableChannelSpinner();
|
||||
fetchingChannels = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
enableChannelSpinner();
|
||||
fetchingChannels = false;
|
||||
}
|
||||
});
|
||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
private void disableChannelSpinner() {
|
||||
Helper.setViewEnabled(channelSpinner, false);
|
||||
}
|
||||
private void enableChannelSpinner() {
|
||||
Helper.setViewEnabled(channelSpinner, true);
|
||||
}
|
||||
|
||||
private void updateChannelList(List<Claim> channels) {
|
||||
if (channelSpinnerAdapter == null) {
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
channelSpinnerAdapter = new InlineChannelSpinnerAdapter(context, R.layout.spinner_item_channel, new ArrayList<>(channels));
|
||||
channelSpinnerAdapter.addAnonymousPlaceholder();
|
||||
channelSpinnerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
} else {
|
||||
channelSpinnerAdapter.clear();
|
||||
channelSpinnerAdapter.addAll(channels);
|
||||
channelSpinnerAdapter.addAnonymousPlaceholder();
|
||||
channelSpinnerAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
if (channelSpinner != null) {
|
||||
channelSpinner.setAdapter(channelSpinnerAdapter);
|
||||
}
|
||||
|
||||
if (channelSpinnerAdapter != null && channelSpinner != null) {
|
||||
if (channelSpinnerAdapter.getCount() > 1) {
|
||||
channelSpinner.setSelection(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).addWalletBalanceListener(this);
|
||||
}
|
||||
updateInfoText();
|
||||
fetchChannels();
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).removeWalletBalanceListener(this);
|
||||
}
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWalletBalanceUpdated(WalletBalance walletBalance) {
|
||||
if (walletBalance != null && inlineBalanceValue != null) {
|
||||
inlineBalanceValue.setText(Helper.shortCurrencyFormat(walletBalance.getAvailable().doubleValue()));
|
||||
}
|
||||
}
|
||||
|
||||
private void showError(String message) {
|
||||
Snackbar.make(getView(), message, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).
|
||||
setTextColor(Color.WHITE).
|
||||
show();
|
||||
}
|
||||
|
||||
public interface CreateSupportListener {
|
||||
void onSupportCreated(BigDecimal amount, boolean isTip);
|
||||
}
|
||||
}
|
||||
@@ -1,200 +0,0 @@
|
||||
package io.lbry.browser.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.core.text.HtmlCompat;
|
||||
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.google.android.material.textfield.TextInputEditText;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.listener.WalletBalanceListener;
|
||||
import io.lbry.browser.model.Claim;
|
||||
import io.lbry.browser.model.WalletBalance;
|
||||
import io.lbry.browser.tasks.GenericTaskHandler;
|
||||
import io.lbry.browser.tasks.wallet.SupportCreateTask;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import io.lbry.browser.utils.Lbry;
|
||||
import lombok.Setter;
|
||||
|
||||
public class SendTipDialogFragment extends BottomSheetDialogFragment implements WalletBalanceListener {
|
||||
public static final String TAG = "SendTipDialog";
|
||||
|
||||
private MaterialButton sendButton;
|
||||
private View cancelLink;
|
||||
private TextInputEditText inputAmount;
|
||||
private View inlineBalanceContainer;
|
||||
private TextView inlineBalanceValue;
|
||||
private ProgressBar sendProgress;
|
||||
|
||||
@Setter
|
||||
private SendTipListener listener;
|
||||
@Setter
|
||||
private Claim claim;
|
||||
|
||||
public static SendTipDialogFragment newInstance() {
|
||||
return new SendTipDialogFragment();
|
||||
}
|
||||
|
||||
private void disableControls() {
|
||||
Dialog dialog = getDialog();
|
||||
if (dialog != null) {
|
||||
dialog.setCanceledOnTouchOutside(false);
|
||||
}
|
||||
sendButton.setEnabled(false);
|
||||
cancelLink.setEnabled(false);
|
||||
}
|
||||
private void enableControls() {
|
||||
Dialog dialog = getDialog();
|
||||
if (dialog != null) {
|
||||
dialog.setCanceledOnTouchOutside(true);
|
||||
}
|
||||
sendButton.setEnabled(true);
|
||||
cancelLink.setEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.dialog_send_tip, container, false);
|
||||
|
||||
inputAmount = view.findViewById(R.id.tip_input_amount);
|
||||
inlineBalanceContainer = view.findViewById(R.id.tip_inline_balance_container);
|
||||
inlineBalanceValue = view.findViewById(R.id.tip_inline_balance_value);
|
||||
sendProgress = view.findViewById(R.id.tip_send_progress);
|
||||
cancelLink = view.findViewById(R.id.tip_cancel_link);
|
||||
sendButton = view.findViewById(R.id.tip_send);
|
||||
|
||||
inputAmount.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View view, boolean hasFocus) {
|
||||
inputAmount.setHint(hasFocus ? getString(R.string.zero) : "");
|
||||
inlineBalanceContainer.setVisibility(hasFocus ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
TextView infoText = view.findViewById(R.id.tip_info);
|
||||
infoText.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
if (claim != null) {
|
||||
infoText.setText(HtmlCompat.fromHtml(
|
||||
Claim.TYPE_CHANNEL.equalsIgnoreCase(claim.getValueType()) ?
|
||||
getString(R.string.send_tip_info_channel, claim.getTitleOrName()) :
|
||||
getString(R.string.send_tip_info_content, claim.getTitleOrName()),
|
||||
HtmlCompat.FROM_HTML_MODE_LEGACY));
|
||||
}
|
||||
|
||||
sendButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
String amountString = Helper.getValue(inputAmount.getText());
|
||||
if (Helper.isNullOrEmpty(amountString)) {
|
||||
showError(getString(R.string.invalid_amount));
|
||||
return;
|
||||
}
|
||||
|
||||
BigDecimal amount = new BigDecimal(amountString);
|
||||
if (amount.doubleValue() > Lbry.walletBalance.getAvailable().doubleValue()) {
|
||||
showError(getString(R.string.insufficient_balance));
|
||||
return;
|
||||
}
|
||||
if (amount.doubleValue() < Helper.MIN_SPEND) {
|
||||
showError(getString(R.string.min_spend_required));
|
||||
return;
|
||||
}
|
||||
|
||||
SupportCreateTask task = new SupportCreateTask(claim.getClaimId(), amount, true, sendProgress, new GenericTaskHandler() {
|
||||
@Override
|
||||
public void beforeStart() {
|
||||
disableControls();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
enableControls();
|
||||
if (listener != null) {
|
||||
listener.onTipSent(amount);
|
||||
}
|
||||
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception error) {
|
||||
showError(error.getMessage());
|
||||
enableControls();
|
||||
}
|
||||
});
|
||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
});
|
||||
|
||||
cancelLink.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
String channel = null;
|
||||
if (Claim.TYPE_CHANNEL.equalsIgnoreCase(claim.getValueType())) {
|
||||
channel = claim.getTitleOrName();
|
||||
} else if (claim.getSigningChannel() != null) {
|
||||
channel = claim.getPublisherTitle();
|
||||
}
|
||||
((TextView) view.findViewById(R.id.tip_send_title)).setText(
|
||||
Helper.isNullOrEmpty(channel) ? getString(R.string.send_a_tip) : getString(R.string.send_a_tip_to, channel)
|
||||
);
|
||||
|
||||
onWalletBalanceUpdated(Lbry.walletBalance);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).addWalletBalanceListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
((MainActivity) context).removeWalletBalanceListener(this);
|
||||
}
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWalletBalanceUpdated(WalletBalance walletBalance) {
|
||||
if (walletBalance != null && inlineBalanceValue != null) {
|
||||
inlineBalanceValue.setText(Helper.shortCurrencyFormat(walletBalance.getAvailable().doubleValue()));
|
||||
}
|
||||
}
|
||||
|
||||
private void showError(String message) {
|
||||
Snackbar.make(getView(), message, Snackbar.LENGTH_LONG).
|
||||
setBackgroundTint(Color.RED).
|
||||
setTextColor(Color.WHITE).
|
||||
show();
|
||||
}
|
||||
|
||||
public interface SendTipListener {
|
||||
void onTipSent(BigDecimal amount);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package io.lbry.browser.exceptions;
|
||||
|
||||
public class AuthTokenInvalidatedException extends Exception {
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package io.lbry.browser.tasks;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.lbry.browser.utils.Helper;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
|
||||
public class BufferEventTask extends AsyncTask<Void, Void, Void> {
|
||||
private static final String TAG = "LbryBufferEvent";
|
||||
private static final String ENDPOINT = "https://collector-service.api.lbry.tv/api/v1/events/video";
|
||||
|
||||
private String streamUrl;
|
||||
private String userIdHash;
|
||||
private long streamDuration;
|
||||
private long streamPosition;
|
||||
private long bufferDuration;
|
||||
|
||||
public BufferEventTask(String streamUrl, long streamDuration, long streamPosition, long bufferDuration, String userIdHash) {
|
||||
this.streamUrl = streamUrl;
|
||||
this.bufferDuration = bufferDuration;
|
||||
this.streamDuration = streamDuration;
|
||||
this.streamPosition = streamPosition;
|
||||
this.userIdHash = userIdHash;
|
||||
}
|
||||
|
||||
protected Void doInBackground(Void... params) {
|
||||
JSONObject requestBody = new JSONObject();
|
||||
JSONObject data = new JSONObject();
|
||||
try {
|
||||
data.put("url", streamUrl);
|
||||
data.put("position", streamPosition);
|
||||
data.put("stream_duration", streamDuration);
|
||||
//data.put("duration", bufferDuration);
|
||||
|
||||
requestBody.put("device", "android");
|
||||
requestBody.put("type", "buffering");
|
||||
requestBody.put("client", userIdHash);
|
||||
requestBody.put("data", data);
|
||||
|
||||
RequestBody body = RequestBody.create(requestBody.toString(), Helper.JSON_MEDIA_TYPE);
|
||||
Request request = new Request.Builder().url(ENDPOINT).post(body).build();
|
||||
OkHttpClient client = new OkHttpClient.Builder().
|
||||
writeTimeout(60, TimeUnit.SECONDS).
|
||||
readTimeout(60, TimeUnit.SECONDS).
|
||||
build();
|
||||
|
||||
Response response = client.newCall(request).execute();
|
||||
String responseString = response.body().string();
|
||||
Log.d(TAG, String.format("buffer event sent: %s", responseString));
|
||||
} catch (Exception ex) {
|
||||
// we don't want to fail if a buffer event fails to register
|
||||
Log.d(TAG, String.format("buffer event log failed: %s", ex.getMessage()), ex);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -34,9 +34,11 @@ public class MergeSubscriptionsTask extends AsyncTask<Void, Void, List<Subscript
|
||||
private List<Subscription> diff;
|
||||
private MergeSubscriptionsHandler handler;
|
||||
private Exception error;
|
||||
private boolean replaceLocal;
|
||||
|
||||
public MergeSubscriptionsTask(List<Subscription> base, Context context, MergeSubscriptionsHandler handler) {
|
||||
public MergeSubscriptionsTask(List<Subscription> base, boolean replaceLocal, Context context, MergeSubscriptionsHandler handler) {
|
||||
this.base = base;
|
||||
this.replaceLocal = replaceLocal;
|
||||
this.context = context;
|
||||
this.handler = handler;
|
||||
}
|
||||
@@ -53,10 +55,17 @@ public class MergeSubscriptionsTask extends AsyncTask<Void, Void, List<Subscript
|
||||
db = ((MainActivity) context).getDbHelper().getWritableDatabase();
|
||||
}
|
||||
if (db != null) {
|
||||
localSubs = DatabaseHelper.getSubscriptions(db);
|
||||
for (Subscription sub : localSubs) {
|
||||
if (!combined.contains(sub)) {
|
||||
combined.add(sub);
|
||||
if (replaceLocal) {
|
||||
DatabaseHelper.clearSubscriptions(db);
|
||||
for (Subscription sub : base) {
|
||||
DatabaseHelper.createOrUpdateSubscription(sub, db);
|
||||
}
|
||||
} else {
|
||||
localSubs = DatabaseHelper.getSubscriptions(db);
|
||||
for (Subscription sub : localSubs) {
|
||||
if (!combined.contains(sub)) {
|
||||
combined.add(sub);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,6 +73,7 @@ public class MergeSubscriptionsTask extends AsyncTask<Void, Void, List<Subscript
|
||||
// fetch remote subscriptions
|
||||
JSONArray array = (JSONArray) Lbryio.parseResponse(Lbryio.call("subscription", "list", context));
|
||||
if (array != null) {
|
||||
// check for any remote subs that may have been removed, and unsubscribe from them
|
||||
for (int i = 0; i < array.length(); i++) {
|
||||
JSONObject item = array.getJSONObject(i);
|
||||
String claimId = item.getString("claim_id");
|
||||
@@ -77,39 +87,39 @@ public class MergeSubscriptionsTask extends AsyncTask<Void, Void, List<Subscript
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < combined.size(); i++) {
|
||||
Subscription local = combined.get(i);
|
||||
if (!remoteSubs.contains(local)) {
|
||||
// add to remote subscriptions
|
||||
try {
|
||||
LbryUri uri = LbryUri.parse(local.getUrl());
|
||||
List<Subscription> remoteUnsubs = new ArrayList<>();
|
||||
List<Subscription> finalRemoteSubs = new ArrayList<>();
|
||||
if (remoteSubs.size() > 0) {
|
||||
for (int i = 0; i < remoteSubs.size(); i++) {
|
||||
Subscription sub = remoteSubs.get(i);
|
||||
if (!combined.contains(sub)) {
|
||||
Map<String, String> options = new HashMap<>();
|
||||
String channelClaimId = uri.getChannelClaimId();
|
||||
String channelName = Helper.normalizeChannelName(local.getChannelName());
|
||||
if (!Helper.isNullOrEmpty(channelClaimId) && !Helper.isNullOrEmpty(channelName)) {
|
||||
options.put("claim_id", channelClaimId);
|
||||
options.put("channel_name", channelName);
|
||||
Lbryio.parseResponse(Lbryio.call("subscription", "new", options, context));
|
||||
LbryUri uri = LbryUri.tryParse(sub.getUrl());
|
||||
if (uri != null) {
|
||||
options.put("claim_id", uri.getChannelClaimId());
|
||||
Lbryio.parseResponse(Lbryio.call("subscription", "delete", options, context));
|
||||
remoteUnsubs.add(sub);
|
||||
} else {
|
||||
finalRemoteSubs.add(sub);
|
||||
}
|
||||
} catch (LbryUriException | LbryioRequestException | LbryioResponseException ex) {
|
||||
// pass
|
||||
Log.e(TAG, String.format("subscription/new failed: %s", ex.getMessage()), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < localSubs.size(); i++) {
|
||||
Subscription local = localSubs.get(i);
|
||||
if (!base.contains(local) && !diff.contains(local)) {
|
||||
diff.add(local);
|
||||
if (!replaceLocal) {
|
||||
for (int i = 0; i < localSubs.size(); i++) {
|
||||
Subscription local = localSubs.get(i);
|
||||
if (!base.contains(local) && !diff.contains(local)) {
|
||||
diff.add(local);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < remoteSubs.size(); i++) {
|
||||
Subscription remote = remoteSubs.get(i);
|
||||
if (!combined.contains(remote)) {
|
||||
combined.add(remote);
|
||||
if (!diff.contains(remote)) {
|
||||
diff.add(remote);
|
||||
for (int i = 0; i < finalRemoteSubs.size(); i++) {
|
||||
Subscription remote = finalRemoteSubs.get(i);
|
||||
if (!combined.contains(remote)) {
|
||||
combined.add(remote);
|
||||
if (!diff.contains(remote)) {
|
||||
diff.add(remote);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
package io.lbry.browser.tasks.lbryinc;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import io.lbry.browser.model.lbryinc.User;
|
||||
import io.lbry.browser.utils.Lbryio;
|
||||
|
||||
public class FetchCurrentUserTask extends AsyncTask<Void, Void, User> {
|
||||
private Context context;
|
||||
private Exception error;
|
||||
private FetchUserTaskHandler handler;
|
||||
|
||||
public FetchCurrentUserTask(FetchUserTaskHandler handler) {
|
||||
public FetchCurrentUserTask(Context context, FetchUserTaskHandler handler) {
|
||||
this.context = context;
|
||||
this.handler = handler;
|
||||
}
|
||||
protected User doInBackground(Void... params) {
|
||||
try {
|
||||
return Lbryio.fetchCurrentUser(null);
|
||||
return Lbryio.fetchCurrentUser(context);
|
||||
} catch (Exception ex) {
|
||||
error = ex;
|
||||
return null;
|
||||
|
||||
+11
-3
@@ -1,20 +1,28 @@
|
||||
package io.lbry.browser.tasks.verification;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import io.lbry.browser.exceptions.AuthTokenInvalidatedException;
|
||||
import io.lbry.browser.model.lbryinc.User;
|
||||
import io.lbry.browser.utils.Lbryio;
|
||||
|
||||
public class CheckUserEmailVerifiedTask extends AsyncTask<Void, Void, Boolean> {
|
||||
private Context context;
|
||||
private CheckUserEmailVerifiedHandler handler;
|
||||
|
||||
public CheckUserEmailVerifiedTask(CheckUserEmailVerifiedHandler handler) {
|
||||
public CheckUserEmailVerifiedTask(Context context, CheckUserEmailVerifiedHandler handler) {
|
||||
this.context = context;
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
protected Boolean doInBackground(Void... params) {
|
||||
User user = Lbryio.fetchCurrentUser(null);
|
||||
return user != null && user.isHasVerifiedEmail();
|
||||
try {
|
||||
User user = Lbryio.fetchCurrentUser(context);
|
||||
return user != null && user.isHasVerifiedEmail();
|
||||
} catch (AuthTokenInvalidatedException ex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected void onPostExecute(Boolean result) {
|
||||
|
||||
@@ -17,14 +17,16 @@ import io.lbry.browser.utils.Lbry;
|
||||
|
||||
public class SupportCreateTask extends AsyncTask<Void, Void, Boolean> {
|
||||
private String claimId;
|
||||
private String channelId;
|
||||
private BigDecimal amount;
|
||||
private boolean tip;
|
||||
private View progressView;
|
||||
private GenericTaskHandler handler;
|
||||
private Exception error;
|
||||
|
||||
public SupportCreateTask(String claimId, BigDecimal amount, boolean tip, View progressView, GenericTaskHandler handler) {
|
||||
public SupportCreateTask(String claimId, String channelId, BigDecimal amount, boolean tip, View progressView, GenericTaskHandler handler) {
|
||||
this.claimId = claimId;
|
||||
this.channelId = channelId;
|
||||
this.amount = amount;
|
||||
this.tip = tip;
|
||||
this.progressView = progressView;
|
||||
@@ -44,6 +46,9 @@ public class SupportCreateTask extends AsyncTask<Void, Void, Boolean> {
|
||||
options.put("claim_id", claimId);
|
||||
options.put("amount", new DecimalFormat(Helper.SDK_AMOUNT_FORMAT, new DecimalFormatSymbols(Locale.US)).format(amount.doubleValue()));
|
||||
options.put("tip", tip);
|
||||
if (!Helper.isNullOrEmpty(channelId)) {
|
||||
options.put("channel_id", channelId);
|
||||
}
|
||||
Lbry.genericApiCall(Lbry.METHOD_SUPPORT_CREATE, options);
|
||||
} catch (ApiCallException ex) {
|
||||
error = ex;
|
||||
|
||||
@@ -107,7 +107,7 @@ public class SyncGetTask extends AsyncTask<Void, Void, WalletSync> {
|
||||
if (applySyncChanges) {
|
||||
if (applySyncSuccessful) {
|
||||
handler.onSyncApplySuccess(syncHash, syncData);
|
||||
} else {
|
||||
} else if (syncApplyError != null) {
|
||||
handler.onSyncApplyError(syncApplyError);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
@@ -36,7 +35,7 @@ import java.util.Map;
|
||||
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.R;
|
||||
import io.lbry.browser.dialog.SendTipDialogFragment;
|
||||
import io.lbry.browser.dialog.CreateSupportDialogFragment;
|
||||
import io.lbry.browser.exceptions.LbryUriException;
|
||||
import io.lbry.browser.listener.FetchChannelsListener;
|
||||
import io.lbry.browser.model.Claim;
|
||||
@@ -50,6 +49,7 @@ import io.lbry.browser.tasks.claim.ClaimListResultHandler;
|
||||
import io.lbry.browser.tasks.claim.ResolveTask;
|
||||
import io.lbry.browser.tasks.lbryinc.FetchStatCountTask;
|
||||
import io.lbry.browser.ui.BaseFragment;
|
||||
import io.lbry.browser.ui.controls.OutlineIconView;
|
||||
import io.lbry.browser.ui.controls.SolidIconView;
|
||||
import io.lbry.browser.ui.findcontent.FollowingFragment;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
@@ -81,7 +81,8 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
|
||||
private View buttonTip;
|
||||
private View buttonFollowUnfollow;
|
||||
private int subCount;
|
||||
private SolidIconView iconFollowUnfollow;
|
||||
private OutlineIconView iconFollow;
|
||||
private SolidIconView iconUnfollow;
|
||||
private View layoutNothingAtLocation;
|
||||
private View layoutLoadingState;
|
||||
|
||||
@@ -106,7 +107,8 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
|
||||
buttonShare = root.findViewById(R.id.channel_view_share);
|
||||
buttonTip = root.findViewById(R.id.channel_view_tip);
|
||||
buttonFollowUnfollow = root.findViewById(R.id.channel_view_follow_unfollow);
|
||||
iconFollowUnfollow = root.findViewById(R.id.channel_view_icon_follow_unfollow);
|
||||
iconFollow = root.findViewById(R.id.channel_view_icon_follow);
|
||||
iconUnfollow = root.findViewById(R.id.channel_view_icon_unfollow);
|
||||
|
||||
tabPager = root.findViewById(R.id.channel_view_pager);
|
||||
tabLayout = root.findViewById(R.id.channel_view_tabs);
|
||||
@@ -174,16 +176,16 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
|
||||
}
|
||||
|
||||
if (claim != null) {
|
||||
SendTipDialogFragment dialog = SendTipDialogFragment.newInstance();
|
||||
CreateSupportDialogFragment dialog = CreateSupportDialogFragment.newInstance();
|
||||
dialog.setClaim(claim);
|
||||
dialog.setListener(new SendTipDialogFragment.SendTipListener() {
|
||||
dialog.setListener(new CreateSupportDialogFragment.CreateSupportListener() {
|
||||
@Override
|
||||
public void onTipSent(BigDecimal amount) {
|
||||
public void onSupportCreated(BigDecimal amount, boolean isTip) {
|
||||
double sentAmount = amount.doubleValue();
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
String message = getResources().getQuantityString(
|
||||
R.plurals.you_sent_a_tip, sentAmount == 1.0 ? 1 : 2,
|
||||
isTip ? R.plurals.you_sent_a_tip : R.plurals.you_sent_a_support, sentAmount == 1.0 ? 1 : 2,
|
||||
new DecimalFormat("#,###.##").format(sentAmount));
|
||||
Snackbar.make(view, message, Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
@@ -191,7 +193,7 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
|
||||
});
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
dialog.show(((MainActivity) context).getSupportFragmentManager(), SendTipDialogFragment.TAG);
|
||||
dialog.show(((MainActivity) context).getSupportFragmentManager(), CreateSupportDialogFragment.TAG);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -275,13 +277,8 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
|
||||
private void checkIsFollowing() {
|
||||
if (claim != null) {
|
||||
boolean isFollowing = Lbryio.isFollowing(claim);
|
||||
if (iconFollowUnfollow != null) {
|
||||
iconFollowUnfollow.setText(isFollowing ? R.string.fa_heart_broken : R.string.fa_heart);
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
iconFollowUnfollow.setTextColor(ContextCompat.getColor(context, isFollowing ? R.color.foreground : R.color.red));
|
||||
}
|
||||
}
|
||||
Helper.setViewVisibility(iconFollow, !isFollowing ? View.VISIBLE : View.GONE);
|
||||
Helper.setViewVisibility(iconUnfollow, isFollowing ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package io.lbry.browser.ui.controls;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Gravity;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
|
||||
public class OutlineIconView extends AppCompatTextView {
|
||||
private Context context;
|
||||
|
||||
public OutlineIconView(Context context) {
|
||||
super(context);
|
||||
this.context = context;
|
||||
init();
|
||||
}
|
||||
|
||||
public OutlineIconView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
this.context = context;
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setGravity(Gravity.CENTER);
|
||||
setTypeface(Typeface.createFromAsset(context.getAssets(), "font_awesome_5_free_regular.otf"));
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Outline;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
@@ -99,7 +100,7 @@ import io.lbry.browser.adapter.CommentListAdapter;
|
||||
import io.lbry.browser.adapter.InlineChannelSpinnerAdapter;
|
||||
import io.lbry.browser.adapter.TagListAdapter;
|
||||
import io.lbry.browser.dialog.RepostClaimDialogFragment;
|
||||
import io.lbry.browser.dialog.SendTipDialogFragment;
|
||||
import io.lbry.browser.dialog.CreateSupportDialogFragment;
|
||||
import io.lbry.browser.exceptions.LbryUriException;
|
||||
import io.lbry.browser.listener.DownloadActionListener;
|
||||
import io.lbry.browser.listener.FetchClaimsListener;
|
||||
@@ -119,6 +120,7 @@ import io.lbry.browser.model.UrlSuggestion;
|
||||
import io.lbry.browser.model.WalletBalance;
|
||||
import io.lbry.browser.model.lbryinc.Reward;
|
||||
import io.lbry.browser.model.lbryinc.Subscription;
|
||||
import io.lbry.browser.tasks.BufferEventTask;
|
||||
import io.lbry.browser.tasks.CommentCreateWithTipTask;
|
||||
import io.lbry.browser.tasks.CommentListHandler;
|
||||
import io.lbry.browser.tasks.CommentListTask;
|
||||
@@ -141,6 +143,7 @@ import io.lbry.browser.tasks.lbryinc.ClaimRewardTask;
|
||||
import io.lbry.browser.tasks.lbryinc.FetchStatCountTask;
|
||||
import io.lbry.browser.tasks.lbryinc.LogFileViewTask;
|
||||
import io.lbry.browser.ui.BaseFragment;
|
||||
import io.lbry.browser.ui.controls.OutlineIconView;
|
||||
import io.lbry.browser.ui.controls.SolidIconView;
|
||||
import io.lbry.browser.ui.publish.PublishFragment;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
@@ -163,6 +166,7 @@ public class FileViewFragment extends BaseFragment implements
|
||||
WalletBalanceListener {
|
||||
private static final int RELATED_CONTENT_SIZE = 16;
|
||||
private static final String DEFAULT_PLAYBACK_SPEED = "1x";
|
||||
private static final String CDN_PREFIX = "https://cdn.lbryplayer.xyz";
|
||||
|
||||
private PlayerControlView castControlView;
|
||||
private Player currentPlayer;
|
||||
@@ -290,6 +294,27 @@ public class FileViewFragment extends BaseFragment implements
|
||||
loadingNewClaim = false;
|
||||
}
|
||||
} else if (playbackState == Player.STATE_BUFFERING) {
|
||||
if (MainActivity.appPlayer != null && MainActivity.appPlayer.getCurrentPosition() > 0) {
|
||||
// we only want to log a buffer event after the media has already started playing
|
||||
String mediaSourceUrl = getStreamingUrl();
|
||||
long duration = MainActivity.appPlayer.getDuration();
|
||||
long position = MainActivity.appPlayer.getCurrentPosition();
|
||||
// TODO: Determine a hash for the userId
|
||||
String userIdHash = Helper.SHA256(Lbryio.currentUser != null ? String.valueOf(Lbryio.currentUser.getId()) : "0");
|
||||
if (mediaSourceUrl.startsWith(CDN_PREFIX)) {
|
||||
BufferEventTask bufferEvent = new BufferEventTask(claim.getPermanentUrl(), duration, position, 1, userIdHash);
|
||||
bufferEvent.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
|
||||
} else {
|
||||
// sdk stream buffer events should be handled differently
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("url", claim.getPermanentUrl());
|
||||
bundle.putLong("stream_duration", duration);
|
||||
bundle.putLong("stream_position", position);
|
||||
bundle.putString("user_id_hash", userIdHash);
|
||||
LbryAnalytics.logEvent(LbryAnalytics.EVENT_BUFFER, bundle);
|
||||
}
|
||||
}
|
||||
|
||||
showBuffering();
|
||||
} else {
|
||||
hideBuffering();
|
||||
@@ -724,6 +749,44 @@ public class FileViewFragment extends BaseFragment implements
|
||||
}
|
||||
}
|
||||
|
||||
private View.OnClickListener followUnfollowListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (claim != null && claim.getSigningChannel() != null) {
|
||||
Claim publisher = claim.getSigningChannel();
|
||||
boolean isFollowing = Lbryio.isFollowing(publisher);
|
||||
Subscription subscription = Subscription.fromClaim(publisher);
|
||||
view.setEnabled(false);
|
||||
Context context = getContext();
|
||||
new ChannelSubscribeTask(context, publisher.getClaimId(), subscription, isFollowing, new ChannelSubscribeTask.ChannelSubscribeHandler() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
if (isFollowing) {
|
||||
Lbryio.removeSubscription(subscription);
|
||||
Lbryio.removeCachedResolvedSubscription(publisher);
|
||||
} else {
|
||||
Lbryio.addSubscription(subscription);
|
||||
Lbryio.addCachedResolvedSubscription(publisher);
|
||||
}
|
||||
view.setEnabled(true);
|
||||
checkIsFollowing();
|
||||
FollowingFragment.resetClaimSearchContent = true;
|
||||
|
||||
// Save shared user state
|
||||
if (context != null) {
|
||||
context.sendBroadcast(new Intent(MainActivity.ACTION_SAVE_SHARED_USER_STATE));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception exception) {
|
||||
view.setEnabled(true);
|
||||
}
|
||||
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private void resolveUrl(String url) {
|
||||
resolving = true;
|
||||
Helper.setViewVisibility(layoutDisplayArea, View.INVISIBLE);
|
||||
@@ -845,21 +908,21 @@ public class FileViewFragment extends BaseFragment implements
|
||||
}
|
||||
|
||||
if (claim != null) {
|
||||
SendTipDialogFragment dialog = SendTipDialogFragment.newInstance();
|
||||
CreateSupportDialogFragment dialog = CreateSupportDialogFragment.newInstance();
|
||||
dialog.setClaim(claim);
|
||||
dialog.setListener(new SendTipDialogFragment.SendTipListener() {
|
||||
dialog.setListener(new CreateSupportDialogFragment.CreateSupportListener() {
|
||||
@Override
|
||||
public void onTipSent(BigDecimal amount) {
|
||||
public void onSupportCreated(BigDecimal amount, boolean isTip) {
|
||||
double sentAmount = amount.doubleValue();
|
||||
String message = getResources().getQuantityString(
|
||||
R.plurals.you_sent_a_tip, sentAmount == 1.0 ? 1 : 2,
|
||||
isTip ? R.plurals.you_sent_a_tip : R.plurals.you_sent_a_support, sentAmount == 1.0 ? 1 : 2,
|
||||
new DecimalFormat("#,###.##").format(sentAmount));
|
||||
Snackbar.make(root.findViewById(R.id.file_view_claim_display_area), message, Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
Context context = getContext();
|
||||
if (context instanceof MainActivity) {
|
||||
dialog.show(((MainActivity) context).getSupportFragmentManager(), SendTipDialogFragment.TAG);
|
||||
dialog.show(((MainActivity) context).getSupportFragmentManager(), CreateSupportDialogFragment.TAG);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1060,44 +1123,10 @@ public class FileViewFragment extends BaseFragment implements
|
||||
}
|
||||
});
|
||||
|
||||
View buttonFollowUnfollow = root.findViewById(R.id.file_view_icon_follow_unfollow);
|
||||
buttonFollowUnfollow.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (claim != null && claim.getSigningChannel() != null) {
|
||||
Claim publisher = claim.getSigningChannel();
|
||||
boolean isFollowing = Lbryio.isFollowing(publisher);
|
||||
Subscription subscription = Subscription.fromClaim(publisher);
|
||||
buttonFollowUnfollow.setEnabled(false);
|
||||
Context context = getContext();
|
||||
new ChannelSubscribeTask(context, publisher.getClaimId(), subscription, isFollowing, new ChannelSubscribeTask.ChannelSubscribeHandler() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
if (isFollowing) {
|
||||
Lbryio.removeSubscription(subscription);
|
||||
Lbryio.removeCachedResolvedSubscription(publisher);
|
||||
} else {
|
||||
Lbryio.addSubscription(subscription);
|
||||
Lbryio.addCachedResolvedSubscription(publisher);
|
||||
}
|
||||
buttonFollowUnfollow.setEnabled(true);
|
||||
checkIsFollowing();
|
||||
FollowingFragment.resetClaimSearchContent = true;
|
||||
|
||||
// Save shared user state
|
||||
if (context != null) {
|
||||
context.sendBroadcast(new Intent(MainActivity.ACTION_SAVE_SHARED_USER_STATE));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception exception) {
|
||||
buttonFollowUnfollow.setEnabled(true);
|
||||
}
|
||||
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
}
|
||||
});
|
||||
View buttonFollow = root.findViewById(R.id.file_view_icon_follow);
|
||||
View buttonUnfollow = root.findViewById(R.id.file_view_icon_unfollow);
|
||||
buttonFollow.setOnClickListener(followUnfollowListener);
|
||||
buttonUnfollow.setOnClickListener(followUnfollowListener);
|
||||
|
||||
commentChannelSpinnerAdapter = new InlineChannelSpinnerAdapter(getContext(), R.layout.spinner_item_channel, new ArrayList<>());
|
||||
commentChannelSpinnerAdapter.addPlaceholder(false);
|
||||
@@ -1418,7 +1447,17 @@ public class FileViewFragment extends BaseFragment implements
|
||||
}
|
||||
}
|
||||
|
||||
root.findViewById(R.id.file_view_icon_follow_unfollow).setVisibility(claim.getSigningChannel() != null ? View.VISIBLE : View.GONE);
|
||||
boolean isAnonymous = claim.getSigningChannel() == null;
|
||||
View iconFollow = root.findViewById(R.id.file_view_icon_follow);
|
||||
View iconUnfollow = root.findViewById(R.id.file_view_icon_unfollow);
|
||||
if (isAnonymous) {
|
||||
if (iconFollow.getVisibility() == View.VISIBLE) {
|
||||
iconFollow.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
if (iconUnfollow.getVisibility() == View.VISIBLE) {
|
||||
iconUnfollow.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
MaterialButton mainActionButton = root.findViewById(R.id.file_view_main_action_button);
|
||||
if (claim.isPlayable()) {
|
||||
@@ -1678,15 +1717,21 @@ public class FileViewFragment extends BaseFragment implements
|
||||
}
|
||||
if (claim.getFile() == null && !claim.isFree()) {
|
||||
if (!Lbry.SDK_READY) {
|
||||
Snackbar.make(getView().findViewById(R.id.file_view_global_layout), R.string.sdk_initializing_functionality, Snackbar.LENGTH_LONG).show();
|
||||
if (root != null) {
|
||||
Snackbar.make(root.findViewById(R.id.file_view_global_layout),
|
||||
R.string.sdk_initializing_functionality, Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
restoreMainActionButton();
|
||||
return;
|
||||
}
|
||||
|
||||
checkAndConfirmPurchaseUrl();
|
||||
} else {
|
||||
if (!claim.isPlayable() && !Lbry.SDK_READY) {
|
||||
Snackbar.make(getView().findViewById(R.id.file_view_global_layout), R.string.sdk_initializing_functionality, Snackbar.LENGTH_LONG).show();
|
||||
if (claim != null && !claim.isPlayable() && !Lbry.SDK_READY) {
|
||||
if (root != null) {
|
||||
Snackbar.make(root.findViewById(R.id.file_view_global_layout),
|
||||
R.string.sdk_initializing_functionality, Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
restoreMainActionButton();
|
||||
return;
|
||||
}
|
||||
@@ -2402,11 +2447,10 @@ public class FileViewFragment extends BaseFragment implements
|
||||
Context context = getContext();
|
||||
View root = getView();
|
||||
if (context != null && root != null) {
|
||||
SolidIconView iconFollowUnfollow = root.findViewById(R.id.file_view_icon_follow_unfollow);
|
||||
if (iconFollowUnfollow != null) {
|
||||
iconFollowUnfollow.setText(isFollowing ? R.string.fa_heart_broken : R.string.fa_heart);
|
||||
iconFollowUnfollow.setTextColor(ContextCompat.getColor(context, isFollowing ? R.color.foreground : R.color.red));
|
||||
}
|
||||
OutlineIconView iconFollow = root.findViewById(R.id.file_view_icon_follow);
|
||||
SolidIconView iconUnfollow = root.findViewById(R.id.file_view_icon_unfollow);
|
||||
Helper.setViewVisibility(iconFollow, !isFollowing ? View.VISIBLE: View.INVISIBLE);
|
||||
Helper.setViewVisibility(iconUnfollow, isFollowing ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,6 +201,7 @@ public class SearchFragment extends BaseFragment implements
|
||||
unresolved.setPermanentUrl(resolved.getPermanentUrl());
|
||||
unresolved.setValue(resolved.getValue());
|
||||
unresolved.setSigningChannel(resolved.getSigningChannel());
|
||||
unresolved.setRepostedClaim(resolved.getRepostedClaim());
|
||||
unresolved.setUnresolved(false);
|
||||
unresolved.setConfirmations(resolved.getConfirmations());
|
||||
}
|
||||
|
||||
@@ -165,7 +165,8 @@ public class EmailVerificationFragment extends Fragment {
|
||||
}
|
||||
|
||||
private void checkEmailVerified() {
|
||||
CheckUserEmailVerifiedTask task = new CheckUserEmailVerifiedTask(new CheckUserEmailVerifiedTask.CheckUserEmailVerifiedHandler() {
|
||||
Context context = getContext();
|
||||
CheckUserEmailVerifiedTask task = new CheckUserEmailVerifiedTask(context, new CheckUserEmailVerifiedTask.CheckUserEmailVerifiedHandler() {
|
||||
@Override
|
||||
public void onUserEmailVerified() {
|
||||
if (listener != null) {
|
||||
|
||||
@@ -30,6 +30,8 @@ import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.android.gms.common.util.Hex;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
@@ -37,6 +39,9 @@ import org.json.JSONObject;
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
@@ -766,4 +771,14 @@ public final class Helper {
|
||||
}
|
||||
return id.toString();
|
||||
}
|
||||
|
||||
public static String SHA256(String value) {
|
||||
try {
|
||||
MessageDigest digest = MessageDigest.getInstance("SHA-256");
|
||||
byte[] hash = digest.digest(value.getBytes("UTF-8"));
|
||||
return Hex.bytesToStringLowercase(hash);
|
||||
} catch (NoSuchAlgorithmException | UnsupportedEncodingException ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ public class LbryAnalytics {
|
||||
public static final String EVENT_APP_ERROR = "app_error";
|
||||
public static final String EVENT_APP_LAUNCH = "app_launch";
|
||||
public static final String EVENT_COMMENT_CREATE = "comment_create";
|
||||
public static final String EVENT_BUFFER = "buffer";
|
||||
public static final String EVENT_EMAIL_ADDED = "email_added";
|
||||
public static final String EVENT_EMAIL_VERIFIED = "email_verified";
|
||||
public static final String EVENT_FIRST_RUN_COMPLETED = "first_run_completed";
|
||||
|
||||
@@ -17,7 +17,8 @@ public class LbryUri {
|
||||
public static final int CHANNEL_NAME_MIN_LENGTH = 1;
|
||||
public static final int CLAIM_ID_MAX_LENGTH = 40;
|
||||
|
||||
private static final String REGEX_PART_PROTOCOL = "^((?:lbry://)?)";
|
||||
private static final String REGEX_PART_PROTOCOL = "^((?:lbry://|https://)?)";
|
||||
private static final String REGEX_PART_HOST = "((?:open.lbry.com/)?)";
|
||||
private static final String REGEX_PART_STREAM_OR_CHANNEL_NAME = "([^:$#/]*)";
|
||||
private static final String REGEX_PART_MODIFIER_SEPARATOR = "([:$#]?)([^/]*)";
|
||||
private static final String QUERY_STRING_BREAKER = "^([\\S]+)([?][\\S]*)";
|
||||
@@ -58,8 +59,9 @@ public class LbryUri {
|
||||
return parse(url, false);
|
||||
}
|
||||
public static LbryUri parse(String url, boolean requireProto) throws LbryUriException {
|
||||
Pattern componentsPattern = Pattern.compile(String.format("%s%s%s(/?)%s%s",
|
||||
Pattern componentsPattern = Pattern.compile(String.format("%s%s%s%s(/?)%s%s",
|
||||
REGEX_PART_PROTOCOL,
|
||||
REGEX_PART_HOST,
|
||||
REGEX_PART_STREAM_OR_CHANNEL_NAME,
|
||||
REGEX_PART_MODIFIER_SEPARATOR,
|
||||
REGEX_PART_STREAM_OR_CHANNEL_NAME,
|
||||
@@ -93,37 +95,48 @@ public class LbryUri {
|
||||
}
|
||||
|
||||
// components[0] = proto
|
||||
// components[1] = streamNameOrChannelName
|
||||
// components[2] = primaryModSeparator
|
||||
// components[3] = primaryModValue
|
||||
// components[4] = pathSep
|
||||
// components[5] = possibleStreamName
|
||||
// components[6] = secondaryModSeparator
|
||||
// components[7] = secondaryModValue
|
||||
// components[1] = host
|
||||
// components[2] = streamNameOrChannelName
|
||||
// components[3] = primaryModSeparator
|
||||
// components[4] = primaryModValue
|
||||
// components[5] = pathSep
|
||||
// components[6] = possibleStreamName
|
||||
// components[7] = secondaryModSeparator
|
||||
// components[8] = secondaryModValue
|
||||
if (requireProto && Helper.isNullOrEmpty(components.get(0))) {
|
||||
throw new LbryUriException("LBRY URLs must include a protocol prefix (lbry://).");
|
||||
}
|
||||
|
||||
if (Helper.isNullOrEmpty(components.get(1))) {
|
||||
if (Helper.isNullOrEmpty(components.get(2))) {
|
||||
throw new LbryUriException("URL does not include name.");
|
||||
}
|
||||
|
||||
for (String component : components.subList(1, components.size())) {
|
||||
for (String component : components.subList(2, components.size())) {
|
||||
if (component.indexOf(' ') > -1) {
|
||||
throw new LbryUriException("URL cannot include a space.");
|
||||
}
|
||||
}
|
||||
|
||||
String streamOrChannelName = components.get(1);
|
||||
String primaryModSeparator = components.get(2);
|
||||
String primaryModValue = components.get(3);
|
||||
String possibleStreamName = components.get(5);
|
||||
String secondaryModSeparator = components.get(6);
|
||||
String secondaryModValue = components.get(7);
|
||||
String streamOrChannelName = components.get(2);
|
||||
String primaryModSeparator = components.get(3);
|
||||
String primaryModValue = components.get(4);
|
||||
String possibleStreamName = components.get(6);
|
||||
String secondaryModSeparator = components.get(7);
|
||||
String secondaryModValue = components.get(8);
|
||||
|
||||
boolean includesChannel = streamOrChannelName.startsWith("@");
|
||||
boolean isChannel = includesChannel && Helper.isNullOrEmpty(possibleStreamName);
|
||||
String channelName = includesChannel && streamOrChannelName.length() > 1 ? streamOrChannelName.substring(1) : null;
|
||||
|
||||
// It would have thrown already on the RegEx parser if protocol value was incorrect
|
||||
// open.lbry.com uses ':' as ModSeparators while lbry:// expects '#'
|
||||
if (components.get(1).equals("open.lbry.com/")) {
|
||||
if (primaryModSeparator.equals(":"))
|
||||
primaryModSeparator = "#";
|
||||
if (secondaryModSeparator.equals(":"))
|
||||
secondaryModSeparator = "#";
|
||||
}
|
||||
|
||||
if (includesChannel) {
|
||||
if (Helper.isNullOrEmpty(channelName)) {
|
||||
throw new LbryUriException("No channel name after @.");
|
||||
@@ -147,7 +160,7 @@ public class LbryUri {
|
||||
|
||||
LbryUri uri = new LbryUri();
|
||||
uri.setChannel(isChannel);
|
||||
uri.setPath(Helper.join(components.subList(1, components.size()), ""));
|
||||
uri.setPath(Helper.join(components.subList(2, components.size()), ""));
|
||||
uri.setStreamName(streamName);
|
||||
uri.setStreamClaimId(streamClaimId);
|
||||
uri.setChannelName(channelName);
|
||||
|
||||
@@ -2,11 +2,14 @@ package io.lbry.browser.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.google.gson.FieldNamingPolicy;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
@@ -27,6 +30,7 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.lbry.browser.BuildConfig;
|
||||
import io.lbry.browser.MainActivity;
|
||||
import io.lbry.browser.exceptions.AuthTokenInvalidatedException;
|
||||
import io.lbry.browser.exceptions.LbryioRequestException;
|
||||
import io.lbry.browser.exceptions.LbryioResponseException;
|
||||
import io.lbry.browser.model.Claim;
|
||||
@@ -200,7 +204,7 @@ public final class Lbryio {
|
||||
}
|
||||
}
|
||||
|
||||
public static User fetchCurrentUser(Context context) {
|
||||
public static User fetchCurrentUser(Context context) throws AuthTokenInvalidatedException {
|
||||
try {
|
||||
Response response = Lbryio.call("user", "me", context);
|
||||
JSONObject object = (JSONObject) parseResponse(response);
|
||||
@@ -210,6 +214,22 @@ public final class Lbryio {
|
||||
return user;
|
||||
} catch (LbryioRequestException | LbryioResponseException | ClassCastException | IllegalStateException ex) {
|
||||
LbryAnalytics.logError(String.format("/user/me failed: %s", ex.getMessage()), ex.getClass().getName());
|
||||
|
||||
if (ex instanceof LbryioResponseException) {
|
||||
LbryioResponseException error = (LbryioResponseException) ex;
|
||||
if (error.getStatusCode() == 403) {
|
||||
// auth token invalidated
|
||||
AUTH_TOKEN = null;
|
||||
// remove the cached auth token
|
||||
if (context != null) {
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
sp.edit().remove(MainActivity.PREFERENCE_KEY_AUTH_TOKEN).apply();
|
||||
}
|
||||
|
||||
throw new AuthTokenInvalidatedException();
|
||||
}
|
||||
}
|
||||
|
||||
android.util.Log.e(TAG, "Could not retrieve the current user", ex);
|
||||
return null;
|
||||
}
|
||||
@@ -256,7 +276,7 @@ public final class Lbryio {
|
||||
return currentUser != null && currentUser.isHasVerifiedEmail();
|
||||
}
|
||||
|
||||
public static void authenticate(Context context) {
|
||||
public static void authenticate(Context context) throws AuthTokenInvalidatedException {
|
||||
User user = fetchCurrentUser(context);
|
||||
if (user != null) {
|
||||
currentUser = user;
|
||||
|
||||
+59
-19
@@ -9,7 +9,7 @@
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
<TextView
|
||||
android:id="@+id/tip_send_title"
|
||||
android:id="@+id/create_support_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
@@ -22,19 +22,58 @@
|
||||
android:layout_height="0.5dp"
|
||||
android:background="@color/divider"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="4dp" />
|
||||
android:layout_marginBottom="12dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/create_support_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/send_tip_info_content"
|
||||
android:textFontWeight="300"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:background="@color/lightDivider"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/channel_to_show_support_as" />
|
||||
<ProgressBar
|
||||
android:id="@+id/create_support_channel_progress"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:visibility="gone" />
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatSpinner
|
||||
android:id="@+id/create_support_channel_spinner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/tip_input_layout_amount"
|
||||
android:id="@+id/create_support_input_layout_amount"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/amount">
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/tip_input_amount"
|
||||
android:id="@+id/create_support_input_amount"
|
||||
android:fontFamily="@font/inter"
|
||||
android:textSize="14sp"
|
||||
android:layout_width="match_parent"
|
||||
@@ -43,8 +82,8 @@
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tip_input_currency"
|
||||
android:layout_toRightOf="@id/tip_input_layout_amount"
|
||||
android:id="@+id/create_support_input_currency"
|
||||
android:layout_toRightOf="@id/create_support_input_layout_amount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
@@ -56,8 +95,8 @@
|
||||
android:textFontWeight="300" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/tip_inline_balance_container"
|
||||
android:layout_toRightOf="@id/tip_input_currency"
|
||||
android:id="@+id/create_support_inline_balance_container"
|
||||
android:layout_toRightOf="@id/create_support_input_currency"
|
||||
android:layout_marginLeft="24dp"
|
||||
android:layout_marginTop="28dp"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -69,7 +108,7 @@
|
||||
android:layout_height="18dp"
|
||||
android:text="@string/fa_coins" />
|
||||
<TextView
|
||||
android:id="@+id/tip_inline_balance_value"
|
||||
android:id="@+id/create_support_inline_balance_value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
@@ -78,14 +117,15 @@
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tip_info"
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
android:id="@+id/create_support_make_tip_switch"
|
||||
android:checked="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:text="@string/make_this_a_tip"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/send_tip_info_content"
|
||||
android:textFontWeight="300"
|
||||
android:textSize="14sp" />
|
||||
|
||||
@@ -93,7 +133,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@+id/tip_cancel_link"
|
||||
android:id="@+id/create_support_cancel_link"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -105,20 +145,20 @@
|
||||
android:textSize="14sp" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/tip_send_progress"
|
||||
android:id="@+id/create_support_progress"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_toLeftOf="@id/tip_send"
|
||||
android:layout_toLeftOf="@id/create_support_send"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="8dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/tip_send"
|
||||
android:id="@+id/create_support_send"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/send"
|
||||
android:text="@string/send_lbc_tip"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
@@ -210,14 +210,22 @@
|
||||
android:clickable="true"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp">
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
android:id="@+id/channel_view_icon_follow_unfollow"
|
||||
<io.lbry.browser.ui.controls.OutlineIconView
|
||||
android:id="@+id/channel_view_icon_follow"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:text="@string/fa_heart"
|
||||
android:textColor="@color/red"
|
||||
android:textSize="20dp" />
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
android:id="@+id/channel_view_icon_unfollow"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:text="@string/fa_heart_broken"
|
||||
android:textSize="20dp"
|
||||
android:visibility="invisible"/>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -295,7 +295,7 @@
|
||||
<TextView
|
||||
android:fontFamily="@font/inter"
|
||||
android:textSize="12sp"
|
||||
android:text="@string/tip"
|
||||
android:text="@string/support"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
@@ -484,7 +484,7 @@
|
||||
android:paddingTop="12dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:layout_toLeftOf="@id/file_view_icon_follow_unfollow">
|
||||
android:layout_toLeftOf="@id/file_view_icon_follow">
|
||||
<RelativeLayout
|
||||
android:id="@+id/file_view_publisher_avatar"
|
||||
android:layout_width="50dp"
|
||||
@@ -541,8 +541,8 @@
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
android:id="@+id/file_view_icon_follow_unfollow"
|
||||
<io.lbry.browser.ui.controls.OutlineIconView
|
||||
android:id="@+id/file_view_icon_follow"
|
||||
android:clickable="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:layout_alignParentRight="true"
|
||||
@@ -554,6 +554,20 @@
|
||||
android:text="@string/fa_heart"
|
||||
android:textColor="@color/red"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<io.lbry.browser.ui.controls.SolidIconView
|
||||
android:id="@+id/file_view_icon_unfollow"
|
||||
android:clickable="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:text="@string/fa_heart_broken"
|
||||
android:textSize="20dp"
|
||||
android:visibility="invisible" />
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
|
||||
@@ -373,6 +373,12 @@
|
||||
<string name="tag_limit_reached">You cannot add more than 5 tags.</string>
|
||||
<string name="send_a_tip">Send a tip</string>
|
||||
<string name="send_a_tip_to">Send a tip to %1$s</string>
|
||||
<string name="support_this_content">Support this content</string>
|
||||
<string name="support_info">This will increase the overall bid amount for this content, which will boost its ability to be discovered while active. <a href="https://lbry.com/faq/tipping">Learn more</a>.</string>
|
||||
<string name="channel_to_show_support_as">Channel to show support as</string>
|
||||
<string name="make_this_a_tip">Make this a tip</string>
|
||||
<string name="send_revocable_support">Send Revocable Support</string>
|
||||
<string name="send_lbc_tip">Send a %1$s LBC Tip</string>
|
||||
<string name="send_tip_info_content">This will appear as a tip for %1$s, which will boost its ability to be discovered while active. <a href="https://lbry.com/faq/tipping">Learn more</a>.</string>
|
||||
<string name="send_tip_info_channel">This will appear as a tip for %1$s, which will boost the channel\'s ability to be discovered while active. <a href="https://lbry.com/faq/tipping">Learn more</a>.</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
@@ -389,6 +395,10 @@
|
||||
<item quantity="one">You sent %1$s credit as a tip, Mahalo!</item>
|
||||
<item quantity="other">You sent %1$s credits as a tip, Mahalo!</item>
|
||||
</plurals>
|
||||
<plurals name="you_sent_a_support">
|
||||
<item quantity="one">You staked %1$s credit as a support. You can revoke your support at any time.</item>
|
||||
<item quantity="other">You staked %1$s credits as a support. You can revoke your support at any time.</item>
|
||||
</plurals>
|
||||
|
||||
<!-- Verification -->
|
||||
<string name="provide_email_address">Please provide an email address.</string>
|
||||
@@ -594,26 +604,26 @@
|
||||
<string name="cannot_share_lbrynet_log">The lbrynet.log file cannot be shared due to permission restrictions.</string>
|
||||
|
||||
<!-- Font Awesome -->
|
||||
<string name="fa_gift"></string>
|
||||
<string name="fa_lock"></string>
|
||||
<string name="fa_coins"></string>
|
||||
<string name="fa_file"></string>
|
||||
<string name="fa_hashtag"></string>
|
||||
<string name="fa_search"></string>
|
||||
<string name="fa_at"></string>
|
||||
<string name="fa_gift" translatable="false"></string>
|
||||
<string name="fa_lock" translatable="false"></string>
|
||||
<string name="fa_coins" translatable="false"></string>
|
||||
<string name="fa_file" translatable="false"></string>
|
||||
<string name="fa_hashtag" translatable="false"></string>
|
||||
<string name="fa_search" translatable="false"></string>
|
||||
<string name="fa_at" translatable="false"></string>
|
||||
|
||||
<string name="fa_heart"></string>
|
||||
<string name="fa_heart_broken"></string>
|
||||
<string name="fa_star"></string>
|
||||
<string name="fa_globe_americas"></string>
|
||||
<string name="fa_upload"></string>
|
||||
<string name="fa_download"></string>
|
||||
<string name="fa_cloud_upload"></string>
|
||||
<string name="fa_wallet"></string>
|
||||
<string name="fa_award"></string>
|
||||
<string name="fa_user_friends"></string>
|
||||
<string name="fa_cog"></string>
|
||||
<string name="fa_mobile_alt"></string>
|
||||
<string name="fa_repost"></string>
|
||||
<string name="fa_folder_open"></string>
|
||||
<string name="fa_heart" translatable="false"></string>
|
||||
<string name="fa_heart_broken" translatable="false"></string>
|
||||
<string name="fa_star" translatable="false"></string>
|
||||
<string name="fa_globe_americas" translatable="false"></string>
|
||||
<string name="fa_upload" translatable="false"></string>
|
||||
<string name="fa_download" translatable="false"></string>
|
||||
<string name="fa_cloud_upload" translatable="false"></string>
|
||||
<string name="fa_wallet" translatable="false"></string>
|
||||
<string name="fa_award" translatable="false"></string>
|
||||
<string name="fa_user_friends" translatable="false"></string>
|
||||
<string name="fa_cog" translatable="false"></string>
|
||||
<string name="fa_mobile_alt" translatable="false"></string>
|
||||
<string name="fa_repost" translatable="false"></string>
|
||||
<string name="fa_folder_open" translatable="false"></string>
|
||||
</resources>
|
||||
@@ -21,7 +21,6 @@ allprojects {
|
||||
google()
|
||||
jcenter()
|
||||
maven { url "https://jitpack.io" }
|
||||
maven { url "https://dl.bintray.com/lbryio/io.lbry" }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user