From e312c451f832ecb0d60e99723db480000159d2f1 Mon Sep 17 00:00:00 2001 From: Michael Tintiuc Date: Fri, 31 Jan 2020 19:51:32 +0200 Subject: [PATCH 1/3] Fix npm install --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 87f78951..9c973bf1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,8 +10,9 @@ RUN dpkg --add-architecture i386 && \ python-pip zlib1g-dev m4 zlib1g:i386 libc6-dev-i386 gawk nodejs npm unzip openjdk-8-jdk \ autoconf autogen automake libtool libffi-dev build-essential \ ccache git libncurses5:i386 libstdc++6:i386 \ - libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 && \ - npm install -g yarn react-native-cli && \ + libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 +RUN npm install -g npm@latest +RUN npm install -g yarn react-native-cli && \ pip2 install --upgrade cython setuptools && \ pip2 install git+https://github.com/lbryio/buildozer.git@master && \ ln -s /src/scripts/build-docker.sh /usr/local/bin/build && \ -- 2.45.2 From 8eb96025ec973f095581daeb0f115d604f22463a Mon Sep 17 00:00:00 2001 From: YULIUS KURNIAWAN KRISTIANTO Date: Mon, 3 Feb 2020 04:38:17 +0700 Subject: [PATCH 2/3] Update LICENSE --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index eb958df1..a293e51a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2017-2019 LBRY Inc +Copyright (c) 2017-2020 LBRY Inc Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -- 2.45.2 From 2d01b63cfebd212c41f9eea2f2aa30ac70fced59 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Mon, 17 Feb 2020 07:19:16 +0100 Subject: [PATCH 3/3] app cold and warm start timing --- app | 2 +- .../java/io/lbry/browser/MainActivity.java | 29 ++++++++++++++++++- .../browser/reactmodules/FirebaseModule.java | 20 +++++++++++++ 3 files changed, 49 insertions(+), 2 deletions(-) diff --git a/app b/app index 601c589f..04f1537e 160000 --- a/app +++ b/app @@ -1 +1 @@ -Subproject commit 601c589f6903a1c33b073b7d72fb4618ecf4a0ef +Subproject commit 04f1537e7650d238208ea5d790ec0fdd3f4fe0ab diff --git a/src/main/java/io/lbry/browser/MainActivity.java b/src/main/java/io/lbry/browser/MainActivity.java index bf4d9d12..2b94a846 100644 --- a/src/main/java/io/lbry/browser/MainActivity.java +++ b/src/main/java/io/lbry/browser/MainActivity.java @@ -66,6 +66,7 @@ import java.net.URISyntaxException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; +import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -129,9 +130,12 @@ public class MainActivity extends FragmentActivity implements DefaultHardwareBac protected String getMainComponentName() { return "LBRYApp"; } - + + public static LaunchTiming CurrentLaunchTiming; + @Override protected void onCreate(Bundle savedInstanceState) { + CurrentLaunchTiming = new LaunchTiming(new Date()); super.onCreate(savedInstanceState); currentActivity = this; @@ -149,6 +153,7 @@ public class MainActivity extends FragmentActivity implements DefaultHardwareBac // Start the daemon service if it is not started serviceRunning = isServiceRunning(LbrynetService.class); if (!serviceRunning) { + CurrentLaunchTiming.setColdStart(true); ServiceHelper.start(this, "", LbrynetService.class, "lbrynetservice"); } @@ -845,4 +850,26 @@ public class MainActivity extends FragmentActivity implements DefaultHardwareBac public static boolean isGooglePhotosUri(Uri uri) { return "com.google.android.apps.photos.content".equals(uri.getAuthority()); } + + public static class LaunchTiming { + private Date start; + private boolean coldStart; + + public LaunchTiming(Date start) { + this.start = start; + } + + public Date getStart() { + return start; + } + public void setStart(Date start) { + this.start = start; + } + public boolean isColdStart() { + return coldStart; + } + public void setColdStart(boolean coldStart) { + this.coldStart = coldStart; + } + } } diff --git a/src/main/java/io/lbry/browser/reactmodules/FirebaseModule.java b/src/main/java/io/lbry/browser/reactmodules/FirebaseModule.java index b16af22e..7cf2a65d 100644 --- a/src/main/java/io/lbry/browser/reactmodules/FirebaseModule.java +++ b/src/main/java/io/lbry/browser/reactmodules/FirebaseModule.java @@ -20,6 +20,7 @@ import io.lbry.browser.BuildConfig; import io.lbry.browser.MainActivity; import io.lbry.browser.Utils; +import java.util.Date; import java.util.HashMap; import java.util.Map; import org.json.JSONObject; @@ -108,4 +109,23 @@ public class FirebaseModule extends ReactContextBaseJavaModule { } }); } + + @ReactMethod + public void logLaunchTiming() { + Date end = new Date(); + MainActivity.LaunchTiming currentTiming = MainActivity.CurrentLaunchTiming; + if (currentTiming == null) { + // no start timing data, so skip this + return; + } + + long totalTimeMs = end.getTime() - currentTiming.getStart().getTime(); + String eventName = currentTiming.isColdStart() ? "app_cold_start" : "app_warm_start"; + Bundle bundle = new Bundle(); + bundle.putLong("total_ms", totalTimeMs); + bundle.putLong("total_seconds", new Double(Math.ceil(totalTimeMs / 1000.0)).longValue()); + if (firebaseAnalytics != null) { + firebaseAnalytics.logEvent(eventName, bundle); + } + } } \ No newline at end of file -- 2.45.2