SDK 0.86.1. is_seen vs is_read swap. Fix error condition where wallet sync starts if the wallet is not ready.
This commit is contained in:
parent
6c406c5a85
commit
f1b167693d
7 changed files with 96 additions and 45 deletions
|
@ -130,8 +130,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.85.1'
|
__32bitImplementation 'io.lbry:lbrysdk32:0.86.1'
|
||||||
__64bitImplementation 'io.lbry:lbrysdk64:0.85.1'
|
__64bitImplementation 'io.lbry:lbrysdk64:0.86.1'
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'com.google.gms.google-services'
|
apply plugin: 'com.google.gms.google-services'
|
||||||
|
|
|
@ -70,8 +70,6 @@ import com.google.android.gms.cast.framework.CastContext;
|
||||||
import com.google.android.gms.tasks.OnCompleteListener;
|
import com.google.android.gms.tasks.OnCompleteListener;
|
||||||
import com.google.android.gms.tasks.Task;
|
import com.google.android.gms.tasks.Task;
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
import com.google.firebase.iid.FirebaseInstanceId;
|
|
||||||
import com.google.firebase.iid.InstanceIdResult;
|
|
||||||
import com.google.firebase.messaging.FirebaseMessaging;
|
import com.google.firebase.messaging.FirebaseMessaging;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
@ -518,7 +516,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
// setup uri bar
|
// setup uri bar
|
||||||
setupUriBar();
|
setupUriBar();
|
||||||
initNotificationsPage();
|
initNotificationsPage();
|
||||||
loadUnreadNotificationsCount();
|
loadUnseenNotificationsCount();
|
||||||
|
|
||||||
// other
|
// other
|
||||||
pendingSyncSetQueue = new ArrayList<>();
|
pendingSyncSetQueue = new ArrayList<>();
|
||||||
|
@ -1826,19 +1824,6 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
checkSyncedWallet();
|
checkSyncedWallet();
|
||||||
}
|
}
|
||||||
|
|
||||||
(new Thread() {
|
|
||||||
public void run() {
|
|
||||||
Map<String, Object> params = new HashMap<>();
|
|
||||||
try {
|
|
||||||
Log.d(TAG, "Calling settings_get");
|
|
||||||
Log.d(TAG, ((JSONObject) Lbry.parseResponse(Lbry.apiCall("settings_get", params, Lbry.SDK_CONNECTION_STRING))).toString(2));
|
|
||||||
} catch (Exception ex) {
|
|
||||||
// pass
|
|
||||||
Log.d(TAG, ex.getMessage(), ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
|
|
||||||
//findViewById(R.id.global_sdk_initializing_status).setVisibility(View.GONE);
|
//findViewById(R.id.global_sdk_initializing_status).setVisibility(View.GONE);
|
||||||
checkAndEnableShareUsageData();
|
checkAndEnableShareUsageData();
|
||||||
|
|
||||||
|
@ -2464,7 +2449,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notificationListAdapter != null) {
|
if (notificationListAdapter != null) {
|
||||||
markNotificationsRead();
|
markNotificationsSeen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2473,17 +2458,17 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
findViewById(R.id.notifications_container).setVisibility(View.GONE);
|
findViewById(R.id.notifications_container).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void markNotificationsRead() {
|
private void markNotificationsSeen() {
|
||||||
List<LbryNotification> all = notificationListAdapter != null ? notificationListAdapter.getItems() : null;
|
List<LbryNotification> all = notificationListAdapter != null ? notificationListAdapter.getItems() : null;
|
||||||
if (all != null) {
|
if (all != null) {
|
||||||
List<Long> unreadIds = new ArrayList<>();
|
List<Long> unseenIds = new ArrayList<>();
|
||||||
for (LbryNotification notification : all) {
|
for (LbryNotification notification : all) {
|
||||||
if (!notification.isRead() && notification.getRemoteId() > 0) {
|
if (!notification.isSeen() && notification.getRemoteId() > 0) {
|
||||||
unreadIds.add(notification.getRemoteId());
|
unseenIds.add(notification.getRemoteId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (unreadIds.size() > 0) {
|
if (unseenIds.size() > 0) {
|
||||||
NotificationUpdateTask task = new NotificationUpdateTask(unreadIds, true);
|
NotificationUpdateTask task = new NotificationUpdateTask(unseenIds, true);
|
||||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2493,14 +2478,14 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
try {
|
try {
|
||||||
SQLiteDatabase db = dbHelper.getWritableDatabase();
|
SQLiteDatabase db = dbHelper.getWritableDatabase();
|
||||||
DatabaseHelper.markNotificationsRead(db);
|
DatabaseHelper.markNotificationsSeen(db);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
// pass
|
// pass
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
protected void onPostExecute(Void result) {
|
protected void onPostExecute(Void result) {
|
||||||
loadUnreadNotificationsCount();
|
loadUnseenNotificationsCount();
|
||||||
}
|
}
|
||||||
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}
|
}
|
||||||
|
@ -3500,7 +3485,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayUnreadNotificationCount(int count) {
|
private void displayUnseenNotificationCount(int count) {
|
||||||
String text = count > 99 ? "99+" : String.valueOf(count);
|
String text = count > 99 ? "99+" : String.valueOf(count);
|
||||||
|
|
||||||
TextView badge = findViewById(R.id.notifications_badge_count);
|
TextView badge = findViewById(R.id.notifications_badge_count);
|
||||||
|
@ -3508,19 +3493,19 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
badge.setText(text);
|
badge.setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadUnreadNotificationsCount() {
|
private void loadUnseenNotificationsCount() {
|
||||||
(new AsyncTask<Void, Void, Integer>() {
|
(new AsyncTask<Void, Void, Integer>() {
|
||||||
@Override
|
@Override
|
||||||
protected Integer doInBackground(Void... params) {
|
protected Integer doInBackground(Void... params) {
|
||||||
try {
|
try {
|
||||||
SQLiteDatabase db = dbHelper.getReadableDatabase();
|
SQLiteDatabase db = dbHelper.getReadableDatabase();
|
||||||
return DatabaseHelper.getUnreadNotificationsCount(db);
|
return DatabaseHelper.getUnseenNotificationsCount(db);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected void onPostExecute(Integer count) {
|
protected void onPostExecute(Integer count) {
|
||||||
displayUnreadNotificationCount(count);
|
displayUnseenNotificationCount(count);
|
||||||
}
|
}
|
||||||
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}
|
}
|
||||||
|
@ -3532,10 +3517,10 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
public void onSuccess(List<LbryNotification> notifications) {
|
public void onSuccess(List<LbryNotification> notifications) {
|
||||||
remoteNotifcationsLastLoaded = new Date();
|
remoteNotifcationsLastLoaded = new Date();
|
||||||
|
|
||||||
loadUnreadNotificationsCount();
|
loadUnseenNotificationsCount();
|
||||||
loadLocalNotifications();
|
loadLocalNotifications();
|
||||||
if (markRead && findViewById(R.id.notifications_container).getVisibility() == View.VISIBLE) {
|
if (markRead && findViewById(R.id.notifications_container).getVisibility() == View.VISIBLE) {
|
||||||
markNotificationsRead();
|
markNotificationsSeen();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notificationsSwipeContainer != null) {
|
if (notificationsSwipeContainer != null) {
|
||||||
|
@ -3576,7 +3561,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
protected void onPostExecute(List<LbryNotification> notifications) {
|
protected void onPostExecute(List<LbryNotification> notifications) {
|
||||||
findViewById(R.id.notification_list_empty_container).setVisibility(notifications.size() == 0 ? View.VISIBLE : View.GONE);
|
findViewById(R.id.notification_list_empty_container).setVisibility(notifications.size() == 0 ? View.VISIBLE : View.GONE);
|
||||||
findViewById(R.id.notifications_progress).setVisibility(View.GONE);
|
findViewById(R.id.notifications_progress).setVisibility(View.GONE);
|
||||||
loadUnreadNotificationsCount();
|
loadUnseenNotificationsCount();
|
||||||
|
|
||||||
if (notificationListAdapter == null) {
|
if (notificationListAdapter == null) {
|
||||||
notificationListAdapter = new NotificationListAdapter(notifications, MainActivity.this);
|
notificationListAdapter = new NotificationListAdapter(notifications, MainActivity.this);
|
||||||
|
@ -3633,7 +3618,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
protected void onPostExecute() {
|
protected void onPostExecute() {
|
||||||
loadUnreadNotificationsCount();
|
loadUnseenNotificationsCount();
|
||||||
}
|
}
|
||||||
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.lbry.browser.adapter.VerificationPagerAdapter;
|
import io.lbry.browser.adapter.VerificationPagerAdapter;
|
||||||
|
import io.lbry.browser.listener.SdkStatusListener;
|
||||||
import io.lbry.browser.listener.SignInListener;
|
import io.lbry.browser.listener.SignInListener;
|
||||||
import io.lbry.browser.listener.WalletSyncListener;
|
import io.lbry.browser.listener.WalletSyncListener;
|
||||||
import io.lbry.browser.model.lbryinc.RewardVerified;
|
import io.lbry.browser.model.lbryinc.RewardVerified;
|
||||||
|
@ -48,6 +49,7 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
||||||
public static final int VERIFICATION_FLOW_REWARDS = 2;
|
public static final int VERIFICATION_FLOW_REWARDS = 2;
|
||||||
public static final int VERIFICATION_FLOW_WALLET = 3;
|
public static final int VERIFICATION_FLOW_WALLET = 3;
|
||||||
|
|
||||||
|
private List<SdkStatusListener> sdkStatusListeners;
|
||||||
private BillingClient billingClient;
|
private BillingClient billingClient;
|
||||||
private BroadcastReceiver sdkReceiver;
|
private BroadcastReceiver sdkReceiver;
|
||||||
private String email;
|
private String email;
|
||||||
|
@ -105,6 +107,8 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
sdkStatusListeners = new ArrayList<>();
|
||||||
|
|
||||||
signedIn = Lbryio.isSignedIn();
|
signedIn = Lbryio.isSignedIn();
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
if (intent != null) {
|
if (intent != null) {
|
||||||
|
@ -126,11 +130,18 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
||||||
|
|
||||||
IntentFilter filter = new IntentFilter();
|
IntentFilter filter = new IntentFilter();
|
||||||
filter.addAction(LbrynetService.ACTION_STOP_SERVICE);
|
filter.addAction(LbrynetService.ACTION_STOP_SERVICE);
|
||||||
|
filter.addAction(MainActivity.ACTION_SDK_READY);
|
||||||
sdkReceiver = new BroadcastReceiver() {
|
sdkReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
if (LbrynetService.ACTION_STOP_SERVICE.equals(action)) {
|
if (MainActivity.ACTION_SDK_READY.equals(action)) {
|
||||||
|
for (SdkStatusListener listener : sdkStatusListeners) {
|
||||||
|
if (listener != null) {
|
||||||
|
listener.onSdkReady();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (LbrynetService.ACTION_STOP_SERVICE.equals(action)) {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -436,4 +447,14 @@ public class VerificationActivity extends FragmentActivity implements SignInList
|
||||||
Helper.unregisterReceiver(sdkReceiver, this);
|
Helper.unregisterReceiver(sdkReceiver, this);
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addSdkStatusListener(SdkStatusListener listener) {
|
||||||
|
if (!sdkStatusListeners.contains(listener)) {
|
||||||
|
sdkStatusListeners.add(listener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeSdkStatusListener(SdkStatusListener listener) {
|
||||||
|
sdkStatusListeners.remove(listener);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,9 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
||||||
private static final String SQL_INSERT_NOTIFICATION = "REPLACE INTO notifications (remote_id, author_url, title, description, rule, target_url, is_read, is_seen, timestamp) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
private static final String SQL_INSERT_NOTIFICATION = "REPLACE INTO notifications (remote_id, author_url, title, description, rule, target_url, is_read, is_seen, timestamp) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||||
private static final String SQL_GET_NOTIFICATIONS = "SELECT id, remote_id, author_url, title, description, rule, target_url, is_read, is_seen, timestamp FROM notifications ORDER BY timestamp DESC LIMIT 500";
|
private static final String SQL_GET_NOTIFICATIONS = "SELECT id, remote_id, author_url, title, description, rule, target_url, is_read, is_seen, timestamp FROM notifications ORDER BY timestamp DESC LIMIT 500";
|
||||||
private static final String SQL_GET_UNREAD_NOTIFICATIONS_COUNT = "SELECT COUNT(id) FROM notifications WHERE is_read <> 1";
|
private static final String SQL_GET_UNREAD_NOTIFICATIONS_COUNT = "SELECT COUNT(id) FROM notifications WHERE is_read <> 1";
|
||||||
|
private static final String SQL_GET_UNSEEN_NOTIFICATIONS_COUNT = "SELECT COUNT(id) FROM notifications WHERE is_seen <> 1";
|
||||||
private static final String SQL_MARK_NOTIFICATIONS_READ = "UPDATE notifications SET is_read = 1 WHERE is_read = 0";
|
private static final String SQL_MARK_NOTIFICATIONS_READ = "UPDATE notifications SET is_read = 1 WHERE is_read = 0";
|
||||||
|
private static final String SQL_MARK_NOTIFICATIONS_SEEN = "UPDATE notifications SET is_seen = 1 WHERE is_seen = 0";
|
||||||
private static final String SQL_MARK_NOTIFICATION_READ_AND_SEEN = "UPDATE notifications SET is_read = 1, is_seen = 1 WHERE id = ?";
|
private static final String SQL_MARK_NOTIFICATION_READ_AND_SEEN = "UPDATE notifications SET is_read = 1, is_seen = 1 WHERE id = ?";
|
||||||
|
|
||||||
private static final String SQL_INSERT_SHUFFLE_WATCHED = "REPLACE INTO shuffle_watched (claim_id) VALUES (?)";
|
private static final String SQL_INSERT_SHUFFLE_WATCHED = "REPLACE INTO shuffle_watched (claim_id) VALUES (?)";
|
||||||
|
@ -417,6 +419,22 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
public static int getUnseenNotificationsCount(SQLiteDatabase db) {
|
||||||
|
int count = 0;
|
||||||
|
Cursor cursor = null;
|
||||||
|
try {
|
||||||
|
cursor = db.rawQuery(SQL_GET_UNSEEN_NOTIFICATIONS_COUNT, null);
|
||||||
|
if (cursor.moveToNext()) {
|
||||||
|
count = cursor.getInt(0);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
Helper.closeCursor(cursor);
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
public static void markNotificationsSeen(SQLiteDatabase db) {
|
||||||
|
db.execSQL(SQL_MARK_NOTIFICATIONS_SEEN);
|
||||||
|
}
|
||||||
public static void markNotificationsRead(SQLiteDatabase db) {
|
public static void markNotificationsRead(SQLiteDatabase db) {
|
||||||
db.execSQL(SQL_MARK_NOTIFICATIONS_READ);
|
db.execSQL(SQL_MARK_NOTIFICATIONS_READ);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,25 +15,25 @@ public class NotificationUpdateTask extends AsyncTask<Void, Void, Boolean> {
|
||||||
private List<Long> ids;
|
private List<Long> ids;
|
||||||
private boolean seen;
|
private boolean seen;
|
||||||
private boolean read;
|
private boolean read;
|
||||||
private boolean updateSeen;
|
private boolean updateRead;
|
||||||
|
|
||||||
public NotificationUpdateTask(List<Long> ids, boolean read) {
|
public NotificationUpdateTask(List<Long> ids, boolean seen) {
|
||||||
this(ids, read, false, false);
|
this(ids, false, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NotificationUpdateTask(List<Long> ids, boolean read, boolean seen, boolean updateSeen) {
|
public NotificationUpdateTask(List<Long> ids, boolean read, boolean seen, boolean updateRead) {
|
||||||
this.ids = ids;
|
this.ids = ids;
|
||||||
this.read = read;
|
this.read = read;
|
||||||
this.seen = seen;
|
this.seen = seen;
|
||||||
this.updateSeen = updateSeen;
|
this.updateRead = updateRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Boolean doInBackground(Void... params) {
|
protected Boolean doInBackground(Void... params) {
|
||||||
Map<String, String> options = new HashMap<>();
|
Map<String, String> options = new HashMap<>();
|
||||||
options.put("notification_ids", Helper.joinL(ids, ","));
|
options.put("notification_ids", Helper.joinL(ids, ","));
|
||||||
options.put("is_read", String.valueOf(read));
|
options.put("is_seen", String.valueOf(seen));
|
||||||
if (updateSeen) {
|
if (updateRead) {
|
||||||
options.put("is_seen", String.valueOf(seen));
|
options.put("is_read", String.valueOf(read));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -33,6 +33,7 @@ public class WalletSendTask extends AsyncTask<Void, Void, Boolean> {
|
||||||
Map<String, Object> options = new HashMap<>();
|
Map<String, Object> options = new HashMap<>();
|
||||||
options.put("addresses", Arrays.asList(recipientAddress));
|
options.put("addresses", Arrays.asList(recipientAddress));
|
||||||
options.put("amount", amount);
|
options.put("amount", amount);
|
||||||
|
options.put("blocking", true);
|
||||||
Lbry.genericApiCall(Lbry.METHOD_WALLET_SEND, options);
|
Lbry.genericApiCall(Lbry.METHOD_WALLET_SEND, options);
|
||||||
} catch (ApiCallException ex) {
|
} catch (ApiCallException ex) {
|
||||||
error = ex;
|
error = ex;
|
||||||
|
|
|
@ -21,6 +21,8 @@ import com.google.android.material.textfield.TextInputEditText;
|
||||||
|
|
||||||
import io.lbry.browser.MainActivity;
|
import io.lbry.browser.MainActivity;
|
||||||
import io.lbry.browser.R;
|
import io.lbry.browser.R;
|
||||||
|
import io.lbry.browser.VerificationActivity;
|
||||||
|
import io.lbry.browser.listener.SdkStatusListener;
|
||||||
import io.lbry.browser.listener.WalletSyncListener;
|
import io.lbry.browser.listener.WalletSyncListener;
|
||||||
import io.lbry.browser.model.WalletSync;
|
import io.lbry.browser.model.WalletSync;
|
||||||
import io.lbry.browser.tasks.wallet.DefaultSyncTaskHandler;
|
import io.lbry.browser.tasks.wallet.DefaultSyncTaskHandler;
|
||||||
|
@ -33,7 +35,7 @@ import io.lbry.browser.utils.Lbryio;
|
||||||
import io.lbry.lbrysdk.Utils;
|
import io.lbry.lbrysdk.Utils;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
public class WalletVerificationFragment extends Fragment {
|
public class WalletVerificationFragment extends Fragment implements SdkStatusListener {
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
private WalletSyncListener listener = null;
|
private WalletSyncListener listener = null;
|
||||||
|
@ -86,6 +88,30 @@ public class WalletVerificationFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
if (!Lbry.SDK_READY) {
|
||||||
|
Context context = getContext();
|
||||||
|
if (context instanceof VerificationActivity) {
|
||||||
|
VerificationActivity activity = (VerificationActivity) context;
|
||||||
|
activity.addSdkStatusListener(this);
|
||||||
|
}
|
||||||
|
Helper.setViewVisibility(loading, View.VISIBLE);
|
||||||
|
Helper.setViewVisibility(textLoading, View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
onSdkReady();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStop() {
|
||||||
|
Context context = getContext();
|
||||||
|
if (context instanceof VerificationActivity) {
|
||||||
|
VerificationActivity activity = (VerificationActivity) context;
|
||||||
|
activity.removeSdkStatusListener(this);
|
||||||
|
}
|
||||||
|
super.onStop();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSdkReady() {
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue