Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6729842ed8 | ||
|
|
723ade8ba6 | ||
|
|
83066232b6 | ||
|
|
4dc0b19c5d | ||
|
|
a58cc820ef | ||
|
|
2b3397bc85 | ||
|
|
a519b5c0b1 | ||
|
|
fb3a34c871 | ||
|
|
a1bc3fcd7e | ||
|
|
7daf3c6f55 | ||
|
|
7d032179ef | ||
|
|
156507f8f7 | ||
|
|
032a1927db | ||
|
|
f24bf570ef | ||
|
|
75c2ece016 | ||
|
|
0c1c1a6c79 | ||
|
|
5af25a9d43 | ||
|
|
55fec0f578 | ||
|
|
b61fc3a148 | ||
|
|
e3cd0fc2b1 | ||
|
|
fe01f50c65 |
No files matched your search
@@ -6,6 +6,7 @@ bin
|
||||
buildozer.spec
|
||||
build.log
|
||||
recipes/**/*.pyc
|
||||
src/main/assets/blockchain/headers
|
||||
src/main/assets/index.android.bundle
|
||||
src/main/assets/index.android.bundle.meta
|
||||
*.log
|
||||
@@ -14,4 +15,3 @@ src/main/assets/index.android.bundle.meta
|
||||
lbry-android.keystore
|
||||
p4a/pythonforandroid/bootstraps/lbry/build/templates/google-services.json
|
||||
.gitsecret/keys/random_seed
|
||||
|
||||
@@ -30,6 +30,7 @@ build arm64 apk:
|
||||
- rm ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz
|
||||
- git secret reveal
|
||||
- mv buildozer.spec.arm64.ci buildozer.spec
|
||||
- mkdir -p $CI_PROJECT_DIR/src/main/assets/blockchain && wget -q https://headers.lbry.io/blockchain_headers_latest -O $CI_PROJECT_DIR/src/main/assets/blockchain/headers
|
||||
- "./release.sh | grep -Fv -e 'working:' -e 'copy' -e 'Compiling' --line-buffered"
|
||||
- cp $CI_PROJECT_DIR/bin/browser-$BUILD_VERSION-release.apk $CI_PROJECT_DIR/bin/browser-$BUILD_VERSION-release__arm64.apk
|
||||
- cp $CI_PROJECT_DIR/bin/browser-$BUILD_VERSION-release.apk /dev/null
|
||||
@@ -61,6 +62,7 @@ build arm apk:
|
||||
- rm ~/.buildozer/android/crystax-ndk-10.3.2-linux-x86_64.tar.xz
|
||||
- git secret reveal
|
||||
- mv buildozer.spec.arm.ci buildozer.spec
|
||||
- mkdir -p $CI_PROJECT_DIR/src/main/assets/blockchain && wget -q https://headers.lbry.io/blockchain_headers_latest -O $CI_PROJECT_DIR/src/main/assets/blockchain/headers
|
||||
- "./release.sh | grep -Fv -e 'working:' -e 'copy' -e 'Compiling' --line-buffered"
|
||||
- cp $CI_PROJECT_DIR/bin/browser-$BUILD_VERSION-release.apk $CI_PROJECT_DIR/bin/browser-$BUILD_VERSION-release__arm.apk
|
||||
- cp $CI_PROJECT_DIR/bin/browser-$BUILD_VERSION-release.apk /dev/null
|
||||
|
||||
@@ -36,7 +36,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, "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=torba&subdirectory=torba"
|
||||
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, "git+https://github.com/lbryio/lbry-sdk@v0.50.1#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.50.1#egg=torba&subdirectory=torba"
|
||||
|
||||
# (str) Custom source folders for requirements
|
||||
# Sets custom source for any requirements with recipes
|
||||
|
||||
@@ -36,7 +36,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, "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=torba&subdirectory=torba"
|
||||
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, "git+https://github.com/lbryio/lbry-sdk@v0.50.1#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.50.1#egg=torba&subdirectory=torba"
|
||||
|
||||
# (str) Custom source folders for requirements
|
||||
# Sets custom source for any requirements with recipes
|
||||
|
||||
@@ -36,7 +36,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, "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=torba&subdirectory=torba"
|
||||
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, "git+https://github.com/lbryio/lbry-sdk@v0.50.1#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.50.1#egg=torba&subdirectory=torba"
|
||||
|
||||
# (str) Custom source folders for requirements
|
||||
# Sets custom source for any requirements with recipes
|
||||
|
||||
@@ -36,7 +36,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, "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.43.4#egg=torba&subdirectory=torba"
|
||||
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, "git+https://github.com/lbryio/lbry-sdk@v0.50.1#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.50.1#egg=torba&subdirectory=torba"
|
||||
|
||||
# (str) Custom source folders for requirements
|
||||
# Sets custom source for any requirements with recipes
|
||||
|
||||
@@ -123,7 +123,7 @@ class BdistAPK(Command):
|
||||
exit(1)
|
||||
if len(main_py_dirs) > 1:
|
||||
print('WARNING: Multiple main.py dirs found, using the shortest path')
|
||||
main_py_dirs = sorted(main_py_dirs, key=lambda j: len(split(j)))
|
||||
main_py_dirs.sort(key=lambda j: len(split(j)))
|
||||
|
||||
if not argv_contains('--launcher'):
|
||||
sys.argv.append('--private={}'.format(
|
||||
@@ -145,4 +145,4 @@ def _set_user_options():
|
||||
|
||||
BdistAPK.user_options = user_options
|
||||
|
||||
_set_user_options()
|
||||
_set_user_options()
|
||||
@@ -447,8 +447,7 @@ main.py that loads it.''')
|
||||
# Try to build with the newest available build tools
|
||||
ignored = {".DS_Store", ".ds_store"}
|
||||
build_tools_versions = [x for x in listdir(join(sdk_dir, 'build-tools')) if x not in ignored]
|
||||
build_tools_versions = sorted(build_tools_versions,
|
||||
key=LooseVersion)
|
||||
build_tools_versions.sort(key=LooseVersion)
|
||||
build_tools_version = build_tools_versions[-1]
|
||||
|
||||
# Folder name for launcher (used by SDL2 bootstrap)
|
||||
|
||||
@@ -344,8 +344,7 @@ main.py that loads it.''')
|
||||
|
||||
# Try to build with the newest available build tools
|
||||
build_tools_versions = listdir(join(sdk_dir, 'build-tools'))
|
||||
build_tools_versions = sorted(build_tools_versions,
|
||||
key=LooseVersion)
|
||||
build_tools_versions.sort(key=LooseVersion)
|
||||
build_tools_version = build_tools_versions[-1]
|
||||
|
||||
|
||||
|
||||
@@ -111,6 +111,7 @@ dependencies {
|
||||
compile project(':react-native-fs')
|
||||
compile project(':react-native-gesture-handler')
|
||||
compile project(':react-native-reanimated')
|
||||
compile project(':react-native-snackbar')
|
||||
compile project(':react-native-video')
|
||||
compile project(':rn-fetch-blob')
|
||||
{%- for aar in aars %}
|
||||
|
||||
@@ -111,6 +111,7 @@ dependencies {
|
||||
compile project(':react-native-fs')
|
||||
compile project(':react-native-gesture-handler')
|
||||
compile project(':react-native-reanimated')
|
||||
compile project(':react-native-snackbar')
|
||||
compile project(':react-native-video')
|
||||
compile project(':rn-fetch-blob')
|
||||
{%- for aar in aars %}
|
||||
|
||||
@@ -13,6 +13,8 @@ include ':react-native-gesture-handler'
|
||||
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, './react/node_modules/react-native-gesture-handler/android')
|
||||
include ':react-native-reanimated'
|
||||
project(':react-native-reanimated').projectDir = new File(rootProject.projectDir, './react/node_modules/react-native-reanimated/android')
|
||||
include ':react-native-snackbar'
|
||||
project(':react-native-snackbar').projectDir = new File(rootProject.projectDir, './react/node_modules/react-native-snackbar/android')
|
||||
include ':react-native-video'
|
||||
project(':react-native-video').projectDir = new File(rootProject.projectDir, './react/node_modules/react-native-video/android-exoplayer')
|
||||
include ':rn-fetch-blob'
|
||||
|
||||
@@ -293,8 +293,7 @@ def get_recipe_order_and_bootstrap(ctx, names, bs=None, blacklist=None):
|
||||
orders.append(list(order))
|
||||
|
||||
# prefer python3 and SDL2 if available
|
||||
orders = sorted(orders,
|
||||
key=lambda order: -('python3' in order) - ('sdl2' in order))
|
||||
orders.sort(key=lambda order: -('python3' in order) - ('sdl2' in order))
|
||||
|
||||
if not orders:
|
||||
raise BuildInterruptingException(
|
||||
|
||||
@@ -93,9 +93,7 @@ def find_channel(force=False):
|
||||
if not force:
|
||||
return None
|
||||
|
||||
busy.sort(key=lambda x: x.play_time)
|
||||
|
||||
return busy[0]
|
||||
return min(busy, key=lambda x: x.play_time)
|
||||
|
||||
|
||||
class ChannelImpl(object):
|
||||
|
||||
@@ -822,8 +822,7 @@ class ToolchainCL(object):
|
||||
|
||||
build_tools_versions = os.listdir(join(ctx.sdk_dir,
|
||||
'build-tools'))
|
||||
build_tools_versions = sorted(build_tools_versions,
|
||||
key=LooseVersion)
|
||||
build_tools_versions.sort(key=LooseVersion)
|
||||
build_tools_version = build_tools_versions[-1]
|
||||
info(('Detected highest available build tools '
|
||||
'version to be {}').format(build_tools_version))
|
||||
|
||||
@@ -79,9 +79,7 @@ def find_channel(force=False):
|
||||
if not force:
|
||||
return None
|
||||
|
||||
busy.sort(key=lambda x : x.play_time)
|
||||
|
||||
return busy[0]
|
||||
return min(busy, key=lambda x : x.play_time)
|
||||
|
||||
class ChannelImpl(object):
|
||||
|
||||
|
||||
@@ -86,6 +86,7 @@ public class DownloadManager {
|
||||
NotificationChannel channel = new NotificationChannel(
|
||||
NOTIFICATION_CHANNEL_ID, "LBRY Downloads", NotificationManager.IMPORTANCE_LOW);
|
||||
channel.setDescription("LBRY file downloads");
|
||||
channel.setSound(null, null);
|
||||
notificationManager.createNotificationChannel(channel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import android.telephony.SmsMessage;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.azendoo.reactnativesnackbar.SnackbarPackage;
|
||||
import com.brentvatne.react.ReactVideoPackage;
|
||||
import com.dylanvann.fastimage.FastImageViewPackage;
|
||||
import com.facebook.react.common.LifecycleState;
|
||||
@@ -168,6 +169,7 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
|
||||
.addPackage(new RNFetchBlobPackage())
|
||||
.addPackage(new RNFSPackage())
|
||||
.addPackage(new RNGestureHandlerPackage())
|
||||
.addPackage(new SnackbarPackage())
|
||||
.addPackage(new LbryReactPackage())
|
||||
.setUseDeveloperSupport(true)
|
||||
.setInitialLifecycleState(LifecycleState.RESUMED)
|
||||
|
||||
@@ -2,8 +2,22 @@ package io.lbry.browser;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.Context;
|
||||
import android.content.res.AssetFileDescriptor;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class ServiceHelper {
|
||||
|
||||
private static final String TAG = "io.lbry.browser.ServiceHelper";
|
||||
|
||||
private static final String HEADERS_ASSET_KEY = "headersAssetInitialized";
|
||||
|
||||
public static Intent buildIntent(Context ctx, String pythonServiceArgument, Class serviceClass, String pythonName) {
|
||||
Intent intent = new Intent(ctx, serviceClass);
|
||||
String argument = ctx.getFilesDir().getAbsolutePath() + "/app";
|
||||
@@ -18,13 +32,83 @@ public class ServiceHelper {
|
||||
return intent;
|
||||
}
|
||||
|
||||
public static void start(Context ctx, String pythonServiceArgument, Class serviceClass, String pythonName) {
|
||||
Intent intent = buildIntent(ctx, pythonServiceArgument, serviceClass, pythonName);
|
||||
ctx.startService(intent);
|
||||
public static void start(final Context ctx, String pythonServiceArgument, Class serviceClass, String pythonName) {
|
||||
// always check initial headers status before starting the service
|
||||
final SharedPreferences sp = ctx.getSharedPreferences(MainActivity.SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
boolean initHeaders = sp.getBoolean(HEADERS_ASSET_KEY, false);
|
||||
if (initHeaders) {
|
||||
// initial headers asset copy already done. simply start the service
|
||||
Intent intent = buildIntent(ctx, pythonServiceArgument, serviceClass, pythonName);
|
||||
ctx.startService(intent);
|
||||
return;
|
||||
}
|
||||
|
||||
(new AsyncTask<Void, Void, Void>() {
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
String targetPath = String.format("%s/lbryum/lbc_mainnet", Utils.getAppInternalStorageDir(ctx));
|
||||
File targetDir = new File(targetPath);
|
||||
if (!targetDir.exists()) {
|
||||
targetDir.mkdirs();
|
||||
}
|
||||
|
||||
String headersPath = String.format("%s/headers", targetPath);
|
||||
android.util.Log.d(TAG, String.format("HeadersPath: %s", headersPath));
|
||||
File targetHeadersFile = new File(headersPath);
|
||||
InputStream in = null;
|
||||
FileOutputStream out = null;
|
||||
|
||||
long sourceLen = 0;
|
||||
long targetLen = 0;
|
||||
try {
|
||||
android.util.Log.d(TAG, "Opening asset: blockchain/headers");
|
||||
in = ctx.getAssets().open("blockchain/headers");
|
||||
out = new FileOutputStream(targetHeadersFile);
|
||||
byte[] b = new byte[1120]; // 10 headers at a time?
|
||||
int len;
|
||||
while ((len = in.read(b, 0, 1120)) > 0) {
|
||||
sourceLen += len;
|
||||
out.write(b, 0, len);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
// failed to copy the headers. sdk will perform the download instead.
|
||||
android.util.Log.e(TAG, "failed to copy headers asset", ex);
|
||||
} finally {
|
||||
closeStream(in);
|
||||
closeStream(out);
|
||||
|
||||
// only mark the copy as successful if the file sizes are the same
|
||||
targetLen = targetHeadersFile.exists() ? targetHeadersFile.length() : 0;
|
||||
android.util.Log.d(TAG, String.format("SourceLength=%d; TargetLength=%d", sourceLen, targetLen));
|
||||
if (targetLen > 0 && targetLen == sourceLen) {
|
||||
SharedPreferences.Editor editor = sp.edit();
|
||||
editor.putBoolean(HEADERS_ASSET_KEY, true);
|
||||
editor.commit();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void onPostExecute(Void result) {
|
||||
Intent intent = buildIntent(ctx, pythonServiceArgument, serviceClass, pythonName);
|
||||
ctx.startService(intent);
|
||||
}
|
||||
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
public static void stop(Context ctx, Class serviceClass) {
|
||||
Intent intent = new Intent(ctx, serviceClass);
|
||||
ctx.stopService(intent);
|
||||
}
|
||||
|
||||
private static void closeStream(Closeable closeable) {
|
||||
try {
|
||||
if (closeable != null) {
|
||||
closeable.close();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
// pass
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,10 +25,14 @@ import com.facebook.react.bridge.Promise;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.Closeable;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -60,6 +64,10 @@ public class UtilityModule extends ReactContextBaseJavaModule {
|
||||
|
||||
public static final String RECEIVE_CREATOR_NOTIFICATIONS = "receiveCreatorNotifications";
|
||||
|
||||
// the last language set to be loaded
|
||||
private static final String LANGUAGE_SETTING_KEY = "language";
|
||||
|
||||
private String language;
|
||||
|
||||
private Context context;
|
||||
|
||||
@@ -73,6 +81,16 @@ public class UtilityModule extends ReactContextBaseJavaModule {
|
||||
} catch (Exception ex) {
|
||||
// continue without keystore
|
||||
}
|
||||
|
||||
SharedPreferences sp = context.getSharedPreferences(MainActivity.SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
language = sp.getString(LANGUAGE_SETTING_KEY, "en");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getConstants() {
|
||||
final Map<String, Object> constants = MapBuilder.newHashMap();
|
||||
constants.put("language", language);
|
||||
return constants;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -122,7 +140,6 @@ public class UtilityModule extends ReactContextBaseJavaModule {
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,6 +414,26 @@ public class UtilityModule extends ReactContextBaseJavaModule {
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void setNativeStringSetting(String key, String value) {
|
||||
if (context != null) {
|
||||
SharedPreferences sp = context.getSharedPreferences(MainActivity.SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sp.edit();
|
||||
editor.putString(key, value);
|
||||
editor.commit();
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void getNativeStringSetting(String key, String defaultValue, Promise promise) {
|
||||
if (context != null) {
|
||||
SharedPreferences sp = context.getSharedPreferences(MainActivity.SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
promise.resolve(sp.getString(key, defaultValue));
|
||||
} else {
|
||||
promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void getNotificationLaunchTarget(Promise promise) {
|
||||
Activity activity = MainActivity.getActivity();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
__version__ = "0.11.1"
|
||||
__version__ = "0.12.1"
|
||||
|
||||
class ServiceApp(App):
|
||||
def build(self):
|
||||
|
||||
|
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 620 B |
|
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 444 B |
|
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 2.2 KiB |