update to sdk 112 #16

Merged
jessopb merged 1 commit from update_to_112 into master 2022-11-23 21:03:41 +01:00
6 changed files with 38 additions and 35 deletions
Showing only changes of commit ff4e2e5c8d - Show all commits

View file

@ -39,7 +39,7 @@ version.filename = %(source.dir)s/main.py
# (list) Application requirements # (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy # comma seperated e.g. requirements = sqlite3,kivy
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==21.0.0, defusedxml, netifaces, aioupnp==0.0.17, asn1crypto, mock, cryptography, aiohttp==3.6.0, multidict==4.5.2, idna, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.102.0#egg=lbry" requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==21.0.0, defusedxml, netifaces, aioupnp==0.0.17, asn1crypto, mock, cryptography, aiohttp==3.6.0, multidict==4.5.2, idna, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.112.0#egg=lbry"
# (str) Custom source folders for requirements # (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes # Sets custom source for any requirements with recipes

View file

@ -39,7 +39,7 @@ version.filename = %(source.dir)s/main.py
# (list) Application requirements # (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy # comma seperated e.g. requirements = sqlite3,kivy
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==21.0.0, defusedxml, netifaces, aioupnp==0.0.17, asn1crypto, mock, cryptography, aiohttp==3.6.0, multidict==4.5.2, idna, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.102.0#egg=lbry" requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==21.0.0, defusedxml, netifaces, aioupnp==0.0.17, asn1crypto, mock, cryptography, aiohttp==3.6.0, multidict==4.5.2, idna, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.112.0#egg=lbry"
# (str) Custom source folders for requirements # (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes # Sets custom source for any requirements with recipes

View file

@ -39,7 +39,7 @@ version.filename = %(source.dir)s/main.py
# (list) Application requirements # (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy # comma seperated e.g. requirements = sqlite3,kivy
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==21.0.0, defusedxml, netifaces, aioupnp==0.0.17, asn1crypto, mock, cryptography, aiohttp==3.6.0, multidict==4.5.2, idna, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.102.0#egg=lbry" requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2021.5.30, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==21.0.0, defusedxml, netifaces, aioupnp==0.0.17, asn1crypto, mock, cryptography, aiohttp==3.6.0, multidict==4.5.2, idna, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.112.0#egg=lbry"
# (str) Custom source folders for requirements # (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes # Sets custom source for any requirements with recipes

View file

@ -275,4 +275,4 @@ warn_on_root = 1
# Then, invoke the command line with the "demo" profile: # Then, invoke the command line with the "demo" profile:
# #
#buildozer --profile demo android debug #buildozer --profile demo android debug
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2020.12.5, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==21.0.0, defusedxml, aioupnp==0.0.17, asn1crypto, mock, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.102.0#egg=lbry" requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2020.12.5, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==21.0.0, defusedxml, aioupnp==0.0.17, asn1crypto, mock, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.8.0, "git+https://github.com/lbryio/lbry-sdk@v0.112.0#egg=lbry"

View file

@ -56,7 +56,7 @@ import org.renpy.android.ResourceManager;
*/ */
public final class LbrynetService extends PythonService { public final class LbrynetService extends PythonService {
public static final String LBRY_SDK_VERSION = "0.102.0"; public static final String LBRY_SDK_VERSION = "0.112.0";
public static final int SERVICE_NOTIFICATION_GROUP_ID = 5; public static final int SERVICE_NOTIFICATION_GROUP_ID = 5;
public static final String ACTION_STOP_SERVICE = "io.lbry.browser.ACTION_STOP_SERVICE"; public static final String ACTION_STOP_SERVICE = "io.lbry.browser.ACTION_STOP_SERVICE";
@ -143,8 +143,7 @@ public final class LbrynetService extends PythonService {
// update the notification with the context intent // update the notification with the context intent
Notification notification = buildNotification(); Notification notification = buildNotification();
NotificationManager notificationManager = NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(1, notification); notificationManager.notify(1, notification);
} }
@ -159,13 +158,13 @@ public final class LbrynetService extends PythonService {
String serviceDescription = "The LBRY service is running in the background."; String serviceDescription = "The LBRY service is running in the background.";
Notification notification = builder.setColor(ContextCompat.getColor(this, R.color.lbryGreen)) Notification notification = builder.setColor(ContextCompat.getColor(this, R.color.lbryGreen))
.setContentText(serviceDescription) .setContentText(serviceDescription)
.setGroup(GROUP_SERVICE) .setGroup(GROUP_SERVICE)
.setWhen(System.currentTimeMillis()) .setWhen(System.currentTimeMillis())
.setSmallIcon(R.drawable.ic_lbry) .setSmallIcon(R.drawable.ic_lbry)
.setOngoing(true) .setOngoing(true)
.addAction(android.R.drawable.ic_menu_close_clear_cancel, "Stop", stopPendingIntent) .addAction(android.R.drawable.ic_menu_close_clear_cancel, "Stop", stopPendingIntent)
.build(); .build();
return notification; return notification;
} }
@ -173,11 +172,10 @@ public final class LbrynetService extends PythonService {
@Override @Override
protected void doStartForeground(Bundle extras) { protected void doStartForeground(Bundle extras) {
downloadManager = new DownloadManager(this); downloadManager = new DownloadManager(this);
NotificationManager notificationManager = NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel channel = new NotificationChannel( NotificationChannel channel = new NotificationChannel(
NOTIFICATION_CHANNEL_ID, "LBRY Browser", NotificationManager.IMPORTANCE_LOW); NOTIFICATION_CHANNEL_ID, "LBRY Browser", NotificationManager.IMPORTANCE_LOW);
channel.setDescription("LBRY service notification channel"); channel.setDescription("LBRY service notification channel");
channel.setShowBadge(false); channel.setShowBadge(false);
notificationManager.createNotificationChannel(channel); notificationManager.createNotificationChannel(channel);
@ -186,11 +184,11 @@ public final class LbrynetService extends PythonService {
// Create the notification group // Create the notification group
NotificationCompat.Builder groupBuilder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID); NotificationCompat.Builder groupBuilder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID);
groupBuilder.setContentTitle("LBRY Browser") groupBuilder.setContentTitle("LBRY Browser")
.setColor(ContextCompat.getColor(this, R.color.lbryGreen)) .setColor(ContextCompat.getColor(this, R.color.lbryGreen))
.setSmallIcon(R.drawable.ic_lbry) .setSmallIcon(R.drawable.ic_lbry)
.setPriority(NotificationCompat.PRIORITY_LOW) .setPriority(NotificationCompat.PRIORITY_LOW)
.setGroup(GROUP_SERVICE) .setGroup(GROUP_SERVICE)
.setGroupSummary(true); .setGroupSummary(true);
notificationManager.notify(SERVICE_NOTIFICATION_GROUP_ID, groupBuilder.build()); notificationManager.notify(SERVICE_NOTIFICATION_GROUP_ID, groupBuilder.build());
Notification notification = buildNotification(); Notification notification = buildNotification();
@ -221,7 +219,8 @@ public final class LbrynetService extends PythonService {
JSONObject result = status.getJSONObject("result"); JSONObject result = status.getJSONObject("result");
if (result.has("startup_status")) { if (result.has("startup_status")) {
JSONObject startupStatus = result.getJSONObject("startup_status"); JSONObject startupStatus = result.getJSONObject("startup_status");
fileManagerReady = startupStatus.has("file_manager") && startupStatus.getBoolean("file_manager"); fileManagerReady = startupStatus.has("file_manager")
&& startupStatus.getBoolean("file_manager");
} }
} }
} }
@ -232,8 +231,10 @@ public final class LbrynetService extends PythonService {
params.put("page_size", 100); params.put("page_size", 100);
params.put("reverse", true); params.put("reverse", true);
params.put("sort", "added_on"); params.put("sort", "added_on");
/*params.put("status", "stopped"); /*
params.put("comparison", "ne");*/ * params.put("status", "stopped");
* params.put("comparison", "ne");
*/
String fileList = Utils.sdkCall("file_list", params); String fileList = Utils.sdkCall("file_list", params);
if (fileList != null) { if (fileList != null) {
@ -273,7 +274,8 @@ public final class LbrynetService extends PythonService {
if (fileItems != null && fileItems.length() > 0) { if (fileItems != null && fileItems.length() > 0) {
// TODO: Create Java FileItem class // TODO: Create Java FileItem class
JSONObject item = fileItems.getJSONObject(0); JSONObject item = fileItems.getJSONObject(0);
String downloadPath = item.isNull("download_path") ? null : item.getString("download_path"); String downloadPath = item.isNull("download_path") ? null
: item.getString("download_path");
if (downloadPath == null || downloadPath.trim().length() == 0) { if (downloadPath == null || downloadPath.trim().length() == 0) {
return; return;
} }
@ -281,7 +283,8 @@ public final class LbrynetService extends PythonService {
String claimName = item.getString("claim_name"); String claimName = item.getString("claim_name");
String uri = String.format("lbry://%s#%s", claimName, claimId); String uri = String.format("lbry://%s#%s", claimName, claimId);
if (!downloadManager.isDownloadActive(uri) && !downloadManager.isDownloadCompleted(uri)) { if (!downloadManager.isDownloadActive(uri)
&& !downloadManager.isDownloadCompleted(uri)) {
downloadManager.clearWrittenBytesForDownload(uri); downloadManager.clearWrittenBytesForDownload(uri);
File file = new File(downloadPath); File file = new File(downloadPath);
Intent intent = createDownloadEventIntent(uri, outpoint, item.toString()); Intent intent = createDownloadEventIntent(uri, outpoint, item.toString());
@ -443,7 +446,6 @@ public final class LbrynetService extends PythonService {
} }
} }
private static Intent createDownloadEventIntent(String uri, String outpoint, String fileInfo) { private static Intent createDownloadEventIntent(String uri, String outpoint, String fileInfo) {
Intent intent = new Intent(); Intent intent = new Intent();
intent.setAction(DownloadManager.ACTION_DOWNLOAD_EVENT); intent.setAction(DownloadManager.ACTION_DOWNLOAD_EVENT);
@ -470,14 +472,15 @@ public final class LbrynetService extends PythonService {
if (intent == null) { if (intent == null) {
intent = ServiceHelper.buildIntent( intent = ServiceHelper.buildIntent(
getApplicationContext(), "", LbrynetService.class, "lbrynetservice"); getApplicationContext(), "", LbrynetService.class, "lbrynetservice");
} }
// send a broadcast indicating that the service has started // send a broadcast indicating that the service has started
Intent startedIntent = new Intent(LBRY_SDK_SERVICE_STARTED); Intent startedIntent = new Intent(LBRY_SDK_SERVICE_STARTED);
sendBroadcast(startedIntent); sendBroadcast(startedIntent);
// no need to iterate the checks repeatedly here, because this is service startup // no need to iterate the checks repeatedly here, because this is service
// startup
checkDownloads(); checkDownloads();
return super.onStartCommand(intent, flags, startId); return super.onStartCommand(intent, flags, startId);
@ -496,8 +499,8 @@ public final class LbrynetService extends PythonService {
} }
Context context = getApplicationContext(); Context context = getApplicationContext();
NotificationManager notificationManager = NotificationManager notificationManager = (NotificationManager) context
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); .getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancelAll(); notificationManager.cancelAll();
super.onDestroy(); super.onDestroy();
@ -550,7 +553,7 @@ public final class LbrynetService extends PythonService {
// If the disk data is out of date, extract it and write the // If the disk data is out of date, extract it and write the
// version file. // version file.
// if (! data_version.equals(disk_version)) { // if (! data_version.equals(disk_version)) {
if (! data_version.equals(disk_version)) { if (!data_version.equals(disk_version)) {
Log.v(TAG, "Extracting " + resource + " assets."); Log.v(TAG, "Extracting " + resource + " assets.");
recursiveDelete(target); recursiveDelete(target);
@ -558,7 +561,7 @@ public final class LbrynetService extends PythonService {
AssetExtract ae = new AssetExtract(getApplicationContext()); AssetExtract ae = new AssetExtract(getApplicationContext());
if (!ae.extractTar(resource + ".mp3", target.getAbsolutePath())) { if (!ae.extractTar(resource + ".mp3", target.getAbsolutePath())) {
//toastError("Could not extract " + resource + " data."); // toastError("Could not extract " + resource + " data.");
Log.e(TAG, "Could not extract " + resource + " data."); Log.e(TAG, "Could not extract " + resource + " data.");
} }

View file

@ -1,5 +1,5 @@
# going forward, this should match sdk version # going forward, this should match sdk version
__version__ = "0.111.0" __version__ = "0.112.0"
class ServiceApp(App): class ServiceApp(App):
def build(self): def build(self):