Skip to content

Commit

Permalink
Merge pull request #5 from HelloVolla/safetye-dev
Browse files Browse the repository at this point in the history
Safetye dev
  • Loading branch information
wurzer authored Aug 30, 2022
2 parents f9377bb + 5053951 commit abad7fe
Show file tree
Hide file tree
Showing 18 changed files with 854 additions and 205 deletions.
8 changes: 7 additions & 1 deletion AppGrid.qml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ Page {
property int selectedGroup: 0
property int maxAppCount: 12

property double lastAppsCheck: 0.0

background: Rectangle {
anchors.fill: parent
color: "transparent"
Expand Down Expand Up @@ -121,7 +123,7 @@ Page {
apps = getAllApps()
appLauncher.destroyAppGroups()
appLauncher.createAppGroups(getGroupedApps(apps))
} else if (key === "useColoredIcons") {
} else if (key === "coloredIcons") {
settings.useColoredIcons = value
for (i = 0; i < appLauncher.appGroups.length; i++) {
appGroup = appLauncher.appGroups[i]
Expand Down Expand Up @@ -428,10 +430,14 @@ Page {
appLauncher.appCount = message["appCount"]
mainView.updateSpinner(true)
AN.SystemDispatcher.dispatch("volla.launcher.appAction", new Object)
} else if (new Date().valueOf() - appLauncher.lastAppsCheck > 3600000) {
console.debug("AppGrid | Will update statistics")
AN.SystemDispatcher.dispatch("volla.launcher.appAction", new Object)
}
} else if (type === "volla.launcher.appResponse") {
console.log("AppGrid | " + message["appsCount"] + " app infos received")
settings.sync()
appLauncher.lastAppsCheck = new Date().valueOf()
var groupedApps = appLauncher.getGroupedApps(message["apps"])
if (appLauncher.appGroups.length !== groupedApps.lemgth) {
for (var i = 0; i < appLauncher.appGroups.length; i++) {
Expand Down
1 change: 1 addition & 0 deletions AppGroup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Item {
}

onDesaturationChanged: {
console.log("AppGroup " + groupIndex + " | onDesaturationChanged to " + desaturation)
groupGrid.forceLayout()
}

Expand Down
2 changes: 1 addition & 1 deletion Details.qml
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ Page {
textFormat: Text.RichText
verticalAlignment: Text.AlignTop
background: Rectangle {
color: mainView.backgroundOpacity === 1.0 ? "green" : "transparent"
color: "transparent"
border.color: "transparent"
}

Expand Down
2 changes: 1 addition & 1 deletion android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<manifest package="com.volla.launcher" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="2.0.29" android:versionCode="229" android:installLocation="auto">
<manifest package="com.volla.launcher" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="2.0.32" android:versionCode="232" android:installLocation="auto">
<uses-sdk android:minSdkVersion="28" android:targetSdkVersion="29"/>

<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
Expand Down
5 changes: 2 additions & 3 deletions android/src/com/volla/launcher/util/LayoutUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,9 @@ public static String getSponsorImageUrl(String deviceId) {
final Map<String, String> map
= Arrays.stream(new String[][] {
{ "1", "/images/sponsor-logo-bfe.png" },
{ "2", "Geek" },
{ "3", "GeeksForGeeks" } })
{ "2", "/images/sponsor-logo-bfe.png" } })
.collect(Collectors.toMap(keyMapper -> keyMapper[0], valueMapper -> valueMapper[1]));

return map.get("1");
return map.get(deviceId) != null ? map.get(deviceId) : map.get("1");
}
}
9 changes: 5 additions & 4 deletions android/src/com/volla/launcher/worker/AppWorker.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void run() {
List<UsageStats> queryUsageStats = new LinkedList();

if (checkUsagePermission(activity)) {
long startTime = System.currentTimeMillis() - (7 * 24 * 60 * 60 * 1000);
long startTime = System.currentTimeMillis() - (7 * 86400000);
long endTime = System.currentTimeMillis();

UsageStatsManager usageStatsManager = (UsageStatsManager)activity.getSystemService(Context.USAGE_STATS_SERVICE);
Expand All @@ -81,7 +81,7 @@ public void run() {
appList.ensureCapacity(availableActivities.size());

for (ResolveInfo ri:availableActivities) {
//Log.d(TAG, "Found package " + ri.activityInfo.packageName);
Log.d(TAG, "Found package " + ri.activityInfo.packageName);

if (!packages.contains(ri.activityInfo.packageName)) {
Map appInfo = new HashMap();
Expand All @@ -104,15 +104,16 @@ public void run() {
long timeInForeground = 0;

for (UsageStats us : queryUsageStats) {
if (us.getPackageName() == ri.activityInfo.packageName) {
if (us.getPackageName().equalsIgnoreCase(ri.activityInfo.packageName)) {
timeInForeground = us.getTotalTimeInForeground();
break;
}
}
if (mostUsed.contains(ri.activityInfo.packageName)) {
timeInForeground = timeInForeground + 10; // fall back for missing stats
}

//Log.d(TAG, "Statistic: " + timeInForeground);
Log.d(TAG, "Statistic: " + timeInForeground);

appInfo.put("statistic", (int)timeInForeground);
appList.add(appInfo);
Expand Down
3 changes: 2 additions & 1 deletion android/src/com/volla/launcher/worker/CallWorker.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public void run() {
}
};

activity.runOnUiThread(runnable);
Thread thread = new Thread(runnable);
thread.start();
} else if (type.equals(GET_CONVERSATION)) {
Runnable runnable = new Runnable () {
public void run() {
Expand Down
4 changes: 4 additions & 0 deletions main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,10 @@ ApplicationWindow {
}

function getContacts() {
if (contacts === undefined) {
var contactsStr = contactsCache.readPrivate()
contacts = contactsStr.length === 0 ? new Array : JSON.parse(contactsStr)
}
return contacts
}

Expand Down
Loading

0 comments on commit abad7fe

Please sign in to comment.