diff --git a/buildozer.spec.arm.ci b/buildozer.spec.arm.ci index b47df79..43eb1dc 100644 --- a/buildozer.spec.arm.ci +++ b/buildozer.spec.arm.ci @@ -39,7 +39,7 @@ version.filename = %(source.dir)s/main.py # (list) Application requirements # comma seperated e.g. requirements = sqlite3,kivy -requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, 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==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, 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.7.1, "git+https://github.com/lbryio/lbry-sdk@v0.72.0#egg=lbry" +requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, 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==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, 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.7.1, "git+https://github.com/lbryio/lbry-sdk@v0.73.0#egg=lbry" # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes diff --git a/buildozer.spec.arm64.ci b/buildozer.spec.arm64.ci index 81e1a7c..c66aa9b 100644 --- a/buildozer.spec.arm64.ci +++ b/buildozer.spec.arm64.ci @@ -39,7 +39,7 @@ version.filename = %(source.dir)s/main.py # (list) Application requirements # comma seperated e.g. requirements = sqlite3,kivy -requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, 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==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, 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.7.1, "git+https://github.com/lbryio/lbry-sdk@v0.72.0#egg=lbry" +requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, 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==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, 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.7.1, "git+https://github.com/lbryio/lbry-sdk@v0.73.0#egg=lbry" # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes diff --git a/buildozer.spec.sample b/buildozer.spec.sample index ab0ceaa..63c211d 100644 --- a/buildozer.spec.sample +++ b/buildozer.spec.sample @@ -39,7 +39,7 @@ version.filename = %(source.dir)s/main.py # (list) Application requirements # comma seperated e.g. requirements = sqlite3,kivy -requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, 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==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, 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.7.1, "git+https://github.com/lbryio/lbry-sdk@v0.72.0#egg=lbry" +requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, 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==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, 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.7.1, "git+https://github.com/lbryio/lbry-sdk@v0.73.0#egg=lbry" # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes diff --git a/buildozer.spec.vagrant b/buildozer.spec.vagrant index f9f7ad1..5b96443 100644 --- a/buildozer.spec.vagrant +++ b/buildozer.spec.vagrant @@ -39,7 +39,7 @@ version.filename = %(source.dir)s/main.py # (list) Application requirements # comma seperated e.g. requirements = sqlite3,kivy -requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, 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==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, 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.7.1, "git+https://github.com/lbryio/lbry-sdk@v0.72.0#egg=lbry" +requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, 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==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, 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.7.1, "git+https://github.com/lbryio/lbry-sdk@v0.73.0#egg=lbry" # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes diff --git a/src/main/java/io/lbry/lbrysdk/DownloadManager.java b/src/main/java/io/lbry/lbrysdk/DownloadManager.java index 9c83521..b82e75c 100644 --- a/src/main/java/io/lbry/lbrysdk/DownloadManager.java +++ b/src/main/java/io/lbry/lbrysdk/DownloadManager.java @@ -20,55 +20,42 @@ import java.util.List; import java.util.Random; public final class DownloadManager { + private static DownloadManager instance; + private Context context; - private List activeDownloads = new ArrayList(); - private List completedDownloads = new ArrayList(); - private Map downloadIdOutpointsMap = new HashMap(); // maintain a map of uris to writtenBytes, so that we check if it's changed and don't flood RN with update events every 500ms private Map writtenDownloadBytes = new HashMap(); - private HashMap builders = new HashMap(); - private HashMap downloadIdNotificationIdMap = new HashMap(); - private HashMap stoppedDownloadsMap = new HashMap(); - private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#"); - private static final int MAX_FILENAME_LENGTH = 20; - private static final int MAX_PROGRESS = 100; - private static final String GROUP_DOWNLOADS = "io.lbry.browser.GROUP_DOWNLOADS"; - private static final String NOTIFICATION_CHANNEL_ID = "io.lbry.browser.DOWNLOADS_NOTIFICATION_CHANNEL"; - private static boolean channelCreated = false; - private static NotificationCompat.Builder groupBuilder = null; public static final String NOTIFICATION_ID_KEY = "io.lbry.browser.notificationId"; - public static final String ACTION_NOTIFICATION_DELETED = "io.lbry.browser.ACTION_NOTIFICATION_DELETED"; - public static final String ACTION_DOWNLOAD_EVENT = "io.lbry.browser.ACTION_DOWNLOAD_EVENT"; - public static final String ACTION_START = "start"; - public static final String ACTION_COMPLETE = "complete"; - public static final String ACTION_UPDATE = "update"; - public static final int DOWNLOAD_NOTIFICATION_GROUP_ID = 20; - public static boolean groupCreated = false; public DownloadManager(Context context) { this.context = context; + instance = this; + } + + public static DownloadManager getInstance() { + return instance; } private int generateNotificationId() { diff --git a/src/main/java/io/lbry/lbrysdk/LbrynetService.java b/src/main/java/io/lbry/lbrysdk/LbrynetService.java index 4b25398..bd23896 100644 --- a/src/main/java/io/lbry/lbrysdk/LbrynetService.java +++ b/src/main/java/io/lbry/lbrysdk/LbrynetService.java @@ -57,7 +57,6 @@ import org.renpy.android.ResourceManager; public final class LbrynetService extends PythonService { 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_CHECK_DOWNLOADS = "io.lbry.browser.ACTION_CHECK_DOWNLOADS"; public static final String ACTION_QUEUE_DOWNLOAD = "io.lbry.browser.ACTION_QUEUE_DOWNLOAD"; @@ -65,25 +64,16 @@ public final class LbrynetService extends PythonService { public static final String GROUP_SERVICE = "io.lbry.browser.GROUP_SERVICE"; public static final String NOTIFICATION_CHANNEL_ID = "io.lbry.browser.DAEMON_NOTIFICATION_CHANNEL"; public static final String LBRY_SDK_SERVICE_STARTED = "io.lbry.lbrysdk.LBRY_SDK_SERVICE_STARTED"; - public static String TAG = "LbrynetService"; - public static LbrynetService serviceInstance; private static boolean DHTEnabled; - private static final int SDK_POLL_INTERVAL = 1000; // 1 second - private PendingIntent pendingContextIntent; - private BroadcastReceiver stopServiceReceiver; - private BroadcastReceiver downloadReceiver; - private DownloadManager downloadManager; - private ScheduledExecutorService taskExecutor; - private ScheduledFuture taskExecutorHandle = null; private boolean streamManagerReady = false; diff --git a/src/main/python/main.py b/src/main/python/main.py index 4487bd1..8dc7df8 100644 --- a/src/main/python/main.py +++ b/src/main/python/main.py @@ -1,5 +1,5 @@ # going forward, this should match sdk version -__version__ = "0.72.0" +__version__ = "0.73.0" class ServiceApp(App): def build(self):