Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miscellaneous updates and cleanup #192

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/gradle-wrapper-validation.yml
@@ -0,0 +1,10 @@
name: "Validate Gradle Wrapper"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I correctly understands how this work, this creates an external dependency, right?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might not work for F-Droid.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's actually fine, no external dependency is used. Slide uses this validation tool and still builds with F-Droid.

on: [push, pull_request]

jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
13 changes: 1 addition & 12 deletions .gitignore
Expand Up @@ -4,18 +4,7 @@ local.properties
keystore.properties
crowdin.properties
.gradle
.idea/caches
.idea/dictionaries
.idea/libraries
.idea/crowdin_settings.xml
.idea/encodings.xml
.idea/assetWizardSettings.xml
.idea/gradle.xml
.idea/misc.xml
.idea/modules.xml
.idea/tasks.xml
.idea/vcs.xml
.idea/workspace.xml
.idea/*
app/.cxx/
build
captures
134 changes: 0 additions & 134 deletions .idea/codeStyles/Project.xml

This file was deleted.

5 changes: 0 additions & 5 deletions .idea/codeStyles/codeStyleConfig.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/compiler.xml

This file was deleted.

35 changes: 0 additions & 35 deletions .idea/jarRepositories.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

2 changes: 1 addition & 1 deletion app/CMakeLists.txt
@@ -1,7 +1,7 @@

# https://developer.android.com/studio/projects/configure-cmake

cmake_minimum_required(VERSION 3.4.1)
cmake_minimum_required(VERSION 3.10.2)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you test this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In what manner, exactly? I built an APK and tested it, and it seemed to work perfectly fine. Is there another way it should be tested? I'm not very familiar with CMake stuff, really.


add_library(fairemail SHARED
src/main/jni/fairemail.cc
Expand Down
7 changes: 2 additions & 5 deletions app/build.gradle
Expand Up @@ -32,7 +32,7 @@ android {
// https://developer.android.com/guide/topics/graphics/vector-drawable-resources
vectorDrawables.useSupportLibrary = true

//ndkVersion "21.0.6113669"
//ndkVersion "22.0.7026061"
ndk {
// Bugsnag, sqlite
abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
Expand Down Expand Up @@ -249,7 +249,6 @@ dependencies {
def swiperefresh_version = "1.2.0-alpha01"
def documentfile_version = "1.0.1"
def lifecycle_version = "2.3.0-rc01"
def lifecycle_extensions_version = "2.2.0"
def sqlite_version = "2.1.0"
def room_version = "2.2.6" // 2.3.0-alpha04
def paging_version = "2.1.2" // 3.0.0-alpha11
Expand Down Expand Up @@ -330,11 +329,9 @@ dependencies {
implementation "androidx.lifecycle:lifecycle-runtime:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata-core:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-service:$lifecycle_version"
annotationProcessor "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"

// https://mvnrepository.com/artifact/androidx.lifecycle/lifecycle-extensions
M66B marked this conversation as resolved.
Show resolved Hide resolved
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_extensions_version"

// https://mvnrepository.com/artifact/androidx.room/room-runtime
implementation "androidx.room:room-runtime:$room_version"
implementation "androidx.room:room-common:$room_version" // because of exclude
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/eu/faircode/email/AdapterFolder.java
Expand Up @@ -1005,10 +1005,10 @@ public void set(@NonNull List<TupleFolderEx> folders) {
for (TupleFolderEx parent : parents)
parent.parent_ref = root;

for (long pid : parentChilds.keySet()) {
TupleFolderEx parent = idFolder.get(pid);
for (Map.Entry<Long, List<TupleFolderEx>> entry : parentChilds.entrySet()) {
TupleFolderEx parent = idFolder.get(entry.getKey());
if (parent != null) {
parent.child_refs = parentChilds.get(pid);
parent.child_refs = entry.getValue();
for (TupleFolderEx child : parent.child_refs)
child.parent_ref = parent;
}
Expand Down
35 changes: 19 additions & 16 deletions app/src/main/java/eu/faircode/email/Core.java
Expand Up @@ -1031,8 +1031,9 @@ private static void onMove(Context context, JSONArray jargs, boolean copy, Entit
Log.i(folder.name + " move from " + folder.type + " to " + target.type);

List<Message> icopies = new ArrayList<>();
for (Message imessage : map.keySet()) {
EntityMessage message = map.get(imessage);
for (Map.Entry<Message, EntityMessage> entry : map.entrySet()) {
Message imessage = entry.getKey();
EntityMessage message = entry.getValue();

File file = File.createTempFile("draft", "." + message.id, context.getCacheDir());
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
Expand Down Expand Up @@ -1698,8 +1699,7 @@ static void onSynchronizeFolders(

// Get remote folders
long start = new Date().getTime();
List<Folder> ifolders = new ArrayList<>();
ifolders.addAll(Arrays.asList(defaultFolder.list("*")));
List<Folder> ifolders = new ArrayList<>(Arrays.asList(defaultFolder.list("*")));

List<String> subscription = new ArrayList<>();
try {
Expand Down Expand Up @@ -1876,15 +1876,16 @@ else if (EntityFolder.INBOX.equals(type) && !EntityFolder.INBOX.equals(folder.ty
}

Log.i("Updating folders parents=" + parentFolders.size());
for (String parentName : parentFolders.keySet()) {
EntityFolder parent = nameFolder.get(parentName);
for (EntityFolder child : parentFolders.get(parentName))
for (Map.Entry<String, List<EntityFolder>> entry : parentFolders.entrySet()) {
EntityFolder parent = nameFolder.get(entry.getKey());
for (EntityFolder child : entry.getValue())
db.folder().setFolderParent(child.id, parent == null ? null : parent.id);
}

Log.i("Delete local count=" + local.size());
for (String name : local.keySet()) {
EntityFolder folder = local.get(name);
for (Map.Entry<String, EntityFolder> entry : local.entrySet()) {
String name = entry.getKey();
EntityFolder folder = entry.getValue();
List<EntityFolder> childs = parentFolders.get(name);
if (EntityFolder.USER.equals(folder.type) ||
childs == null || childs.size() == 0) {
Expand Down Expand Up @@ -3507,8 +3508,8 @@ private static void reportEmptyMessage(Context context, State state, EntityAccou
Map<String, String> sid = istore.id(id);
if (sid != null) {
StringBuilder sb = new StringBuilder();
for (String key : sid.keySet())
sb.append(" ").append(key).append("=").append(sid.get(key));
for (Map.Entry<String, String> entry : sid.entrySet())
sb.append(" ").append(entry.getKey()).append("=").append(entry.getValue());
if (!account.partial_fetch)
Log.w("Empty message" + sb.toString());
}
Expand Down Expand Up @@ -3620,11 +3621,12 @@ static void notifyMessages(Context context, List<TupleMessageEx> messages, Map<L
}

// Difference
for (long group : groupMessages.keySet()) {
for (Map.Entry<Long, List<TupleMessageEx>> entry : groupMessages.entrySet()) {
long group = entry.getKey();
List<Long> add = new ArrayList<>();
List<Long> update = new ArrayList<>();
List<Long> remove = new ArrayList<>(groupNotifying.get(group));
for (TupleMessageEx message : groupMessages.get(group)) {
for (TupleMessageEx message : entry.getValue()) {
long id = (message.content ? message.id : -message.id);
if (remove.contains(id)) {
remove.remove(id);
Expand Down Expand Up @@ -3655,7 +3657,7 @@ static void notifyMessages(Context context, List<TupleMessageEx> messages, Map<L

// Build notifications
List<NotificationCompat.Builder> notifications = getNotificationUnseen(context,
group, groupMessages.get(group),
group, entry.getValue(),
notify_summary, new_messages,
redacted);

Expand Down Expand Up @@ -4435,8 +4437,9 @@ void reset() {
void resetBatches() {
process = false;
synchronized (this) {
for (FolderPriority key : sequence.keySet()) {
batch.put(key, sequence.get(key));
for (Map.Entry<FolderPriority, Long> entry : sequence.entrySet()) {
FolderPriority key = entry.getKey();
batch.put(key, entry.getValue());
if (BuildConfig.DEBUG)
Log.i("=== Reset " + key.folder + ":" + key.priority + " batch=" + batch.get(key));
}
Expand Down