About page (#78)
* added about page with version info * lock drawer to closed state for About screen. Added About screen hardware back button handling.
This commit is contained in:
parent
b9e0065aad
commit
496ec53f8a
10 changed files with 449 additions and 4861 deletions
src/main/java/io/lbry/browser/reactmodules
|
@ -0,0 +1,38 @@
|
|||
package io.lbry.browser.reactmodules;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
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 android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
|
||||
public class VersionInfoModule extends ReactContextBaseJavaModule {
|
||||
private Context context;
|
||||
|
||||
public VersionInfoModule(ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
this.context = reactContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "VersionInfo";
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void getAppVersion(final Promise promise) {
|
||||
PackageManager packageManager = this.context.getPackageManager();
|
||||
String packageName = this.context.getPackageName();
|
||||
try {
|
||||
PackageInfo packageInfo = packageManager.getPackageInfo(packageName, 0);
|
||||
promise.resolve(packageInfo.versionName);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
// normally shouldn't happen
|
||||
promise.resolve("Unknown");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue