mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 18:30:20 +01:00
Don't show donate or research megaphones on new app installs.
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
package org.thoughtcrime.securesms.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||
import org.thoughtcrime.securesms.logging.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class VersionTracker {
|
||||
|
||||
@@ -30,4 +33,17 @@ public class VersionTracker {
|
||||
throw new AssertionError(ioe);
|
||||
}
|
||||
}
|
||||
|
||||
public static long getDaysSinceFirstInstalled(Context context) {
|
||||
try {
|
||||
long installTimestamp = context.getPackageManager()
|
||||
.getPackageInfo(context.getPackageName(), 0)
|
||||
.firstInstallTime;
|
||||
|
||||
return TimeUnit.MILLISECONDS.toDays(System.currentTimeMillis() - installTimestamp);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.w(TAG, e);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user