Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2018-03-30 22:31:45 +02:00
commit 53fb449eaf
3 changed files with 32 additions and 13 deletions

View file

@ -19,6 +19,8 @@ apply plugin: 'com.github.ksoichiro.eclipse.aar'
// Less important
// Configure eclipse-aar plugin
def analytics = (!System.getenv("APP_FEATURES") || System.getenv("APP_FEATURES").contains("+play_market")) &&
getGradle().getStartParameter().getTaskRequests().toString().contains("Free")
eclipseAar {
// See "Configurations" for details
@ -312,8 +314,8 @@ task copyStyleIcons(type: Copy) {
include "**/*.png"
}
task collectExternalResources << {}
collectExternalResources.dependsOn collectVoiceAssets,
task collectExternalResources {
dependsOn collectVoiceAssets,
collectFonts,
collectHelpContentsAssets,
collectHelpContentsStyle,
@ -324,11 +326,7 @@ collectExternalResources.dependsOn collectVoiceAssets,
copyStyleIcons,
updateNoTranslate,
validateTranslate
// tasks.whenTaskAdded { task ->
// if (task.name.startsWith("generate") && task.name.endsWith("Resources")) {
// task.dependsOn collectExternalResources
// }
// }
}
// Legacy core build
import org.apache.tools.ant.taskdefs.condition.Os
@ -357,9 +355,14 @@ task cleanupDuplicatesInCore() {
file("libs/x86/libgnustl_shared.so").renameTo(file("libgnustl/x86/libgnustl_shared.so"))
}
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn << [collectExternalResources, buildOsmAndCore, cleanupDuplicatesInCore]
afterEvaluate {
android.applicationVariants.all { variant ->
variant.javaCompiler.dependsOn(collectExternalResources, buildOsmAndCore, cleanupDuplicatesInCore)
}
}
//tasks.withType(JavaCompile) {
//compileTask -> compileTask.dependsOn << [collectExternalResources, buildOsmAndCore, cleanupDuplicatesInCore]
//}
task appStart(type: Exec) {
// linux
@ -383,12 +386,12 @@ repositories {
}
}
def analytics = (System.getenv("APP_FEATURES") && System.getenv("APP_FEATURES").contains("+play_market") &&
["net.osmand", "net.osmand.dev"].contains(System.getenv("PACKAGE_TO_BUILT")) ) || System.getenv("USE_FIREBASE")
project.logger.warn("Analytics enabled for free version: $analytics")
dependencies {
compile project(path: ':OsmAnd-java', configuration: 'android')
if (analytics) {
compile 'com.google.firebase:firebase-core:12.0.1'
compile 'com.google.firebase:firebase-iid:12.0.1'
compile 'com.google.firebase:firebase-config:12.0.1'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
}

View file

@ -609,7 +609,6 @@ public class AppInitializer implements IProgress {
app.mapMarkersHelper.syncAllGroupsAsync();
app.searchUICore.initSearchUICore();
/// Log.i("Firebase token", com.google.firebase.iid.FirebaseInstanceId.getInstance().getToken());
checkLiveUpdatesAlerts();
} catch (RuntimeException e) {

View file

@ -18,12 +18,12 @@ import android.support.multidex.MultiDex;
import android.support.multidex.MultiDexApplication;
import android.support.v7.app.AlertDialog;
import android.text.format.DateFormat;
import android.util.Log;
import android.view.View;
import android.view.accessibility.AccessibilityManager;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import net.osmand.CallbackWithObject;
import net.osmand.PlatformUtil;
import net.osmand.access.AccessibilityPlugin;
@ -168,6 +168,7 @@ public class OsmandApplication extends MultiDexApplication {
InAppHelper.initialize(this);
initRemoteConfig();
printFirebasetoken();
startApplication();
System.out.println("Time to start application " + (System.currentTimeMillis() - timeToStart) + " ms. Should be less < 800 ms");
timeToStart = System.currentTimeMillis();
@ -894,6 +895,22 @@ public class OsmandApplication extends MultiDexApplication {
}
}
public void printFirebasetoken() {
try {
if (Version.isGooglePlayEnabled(this) && Version.isFreeVersion(this)) {
Class<?> cl = Class.forName("com.google.firebase.iid.FirebaseInstanceId");
Method mm = cl.getMethod("getInstance");
Object inst = mm.invoke(null);
Method getToken = cl.getMethod("getToken");
String firebaseToken = (String) getToken.invoke(inst);
LOG.info("Fbase token: " + firebaseToken);
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void fetchRemoteParams() {
try {
if(Version.isGooglePlayEnabled(this) && Version.isFreeVersion(this)) {