From cb6767b44240d82352089ecb9be55d2885be73bb Mon Sep 17 00:00:00 2001 From: Git Action Bot Date: Mon, 6 May 2024 20:14:51 +0000 Subject: [PATCH 1/7] Bump patchVersion --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index 137d98588..f1f8c294d 100644 --- a/version.properties +++ b/version.properties @@ -1,3 +1,3 @@ majorVersion=5 minorVersion=6 -patchVersion=16 +patchVersion=17 From 50b9f20a35c8ba5df5861b5d8bda52e2da40b930 Mon Sep 17 00:00:00 2001 From: chaneylc Date: Fri, 10 May 2024 15:49:29 -0500 Subject: [PATCH 2/7] fix #965 preference file bugfix 'search by plot' bugfix now correctly uses unique name/id --- .../fieldbook/tracker/database/DataHelper.java | 4 ++-- .../database/dao/ObservationUnitPropertyDao.kt | 6 ++---- .../fieldbook/tracker/dialogs/SearchDialog.java | 15 +++++++++++---- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/fieldbook/tracker/database/DataHelper.java b/app/src/main/java/com/fieldbook/tracker/database/DataHelper.java index cef5b955a..559d63811 100644 --- a/app/src/main/java/com/fieldbook/tracker/database/DataHelper.java +++ b/app/src/main/java/com/fieldbook/tracker/database/DataHelper.java @@ -2703,11 +2703,11 @@ public ObservationModel[] getRepeatedValues(String studyId, String plotId, Strin return ObservationDao.Companion.getAllRepeatedValues(studyId, plotId, traitDbId); } - public String getObservationUnitPropertyByPlotId(String column, String plot_id) { + public String getObservationUnitPropertyByPlotId(String uniqueName, String column, String uniqueId) { open(); - return ObservationUnitPropertyDao.Companion.getObservationUnitPropertyByPlotId(column, plot_id); + return ObservationUnitPropertyDao.Companion.getObservationUnitPropertyByUniqueId(uniqueName, column, uniqueId); } /** diff --git a/app/src/main/java/com/fieldbook/tracker/database/dao/ObservationUnitPropertyDao.kt b/app/src/main/java/com/fieldbook/tracker/database/dao/ObservationUnitPropertyDao.kt index 2e6f367ae..433b0baea 100644 --- a/app/src/main/java/com/fieldbook/tracker/database/dao/ObservationUnitPropertyDao.kt +++ b/app/src/main/java/com/fieldbook/tracker/database/dao/ObservationUnitPropertyDao.kt @@ -7,11 +7,9 @@ import android.util.Log import androidx.preference.PreferenceManager import com.fieldbook.tracker.database.DataHelper import com.fieldbook.tracker.database.Migrator.Companion.sObservationUnitPropertyViewName -import com.fieldbook.tracker.database.Migrator.Observation import com.fieldbook.tracker.database.Migrator.ObservationUnit import com.fieldbook.tracker.database.Migrator.ObservationUnitAttribute import com.fieldbook.tracker.database.Migrator.ObservationUnitValue -import com.fieldbook.tracker.database.Migrator.ObservationVariable import com.fieldbook.tracker.database.Migrator.Study import com.fieldbook.tracker.database.query import com.fieldbook.tracker.database.toFirst @@ -30,8 +28,8 @@ class ObservationUnitPropertyDao { // db.query(sObservationUnitPropertyViewName).toTable().toTypedArray() // } - fun getObservationUnitPropertyByPlotId(column: String, plot_id: String): String = withDatabase { db -> - db.query("ObservationUnitProperty", select = arrayOf(column), where = "plot_id = ?", whereArgs = arrayOf(plot_id)) + fun getObservationUnitPropertyByUniqueId(uniqueName: String, column: String, uniqueId: String): String = withDatabase { db -> + db.query(sObservationUnitPropertyViewName, select = arrayOf(column), where = "`${uniqueName}` = ?", whereArgs = arrayOf(uniqueId)) .toFirst()[column].toString() }?: "" diff --git a/app/src/main/java/com/fieldbook/tracker/dialogs/SearchDialog.java b/app/src/main/java/com/fieldbook/tracker/dialogs/SearchDialog.java index 3ff8fdcc2..02441178d 100644 --- a/app/src/main/java/com/fieldbook/tracker/dialogs/SearchDialog.java +++ b/app/src/main/java/com/fieldbook/tracker/dialogs/SearchDialog.java @@ -37,12 +37,19 @@ import java.util.ArrayList; import java.util.List; +import javax.inject.Inject; + +import dagger.hilt.android.AndroidEntryPoint; + +@AndroidEntryPoint public class SearchDialog extends DialogFragment implements AttributeChooserDialog.OnAttributeSelectedListener, OperatorDialog.OnOperatorClickedListener, SearchAdapter.onEditTextChangedListener, SearchAdapter.onDeleteClickedListener { + @Inject + SharedPreferences ep; + private static final String TAG = "SearchDialog"; private static CollectActivity originActivity; private SearchAdapter searchAdapter; - private SharedPreferences ep; private static List dataSet; public static boolean openResults; private final onSearchResultsClickedListener onSearchResultsClickedListener; @@ -56,8 +63,6 @@ public SearchDialog(CollectActivity activity, onSearchResultsClickedListener onS @Override public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { - ep = requireContext().getSharedPreferences(GeneralKeys.SHARED_PREF_FILE_NAME, 0); - AlertDialog.Builder builder = new AlertDialog.Builder(originActivity, R.style.AppAlertDialog); View customView = getLayoutInflater().inflate(R.layout.dialog_search, null); @@ -164,6 +169,8 @@ public void createSearchResultsDialog () { if (data != null) { + String uniqueName = ep.getString(GeneralKeys.UNIQUE_NAME, ""); + //Array to store all the columns to be displayed in the search results dialog ArrayList columnsList = new ArrayList<>(); columnsList.add(ep.getString(GeneralKeys.PRIMARY_NAME, getString(R.string.search_results_dialog_range))); @@ -208,7 +215,7 @@ public void createSearchResultsDialog () { } // If column is an attribute else { - temp.add(originActivity.getDatabase().getObservationUnitPropertyByPlotId(column, searchdata.unique)); + temp.add(originActivity.getDatabase().getObservationUnitPropertyByPlotId(uniqueName, column, searchdata.unique)); } } traitData.add(temp); From f3045833101294c151d4d81911965f5b70245380 Mon Sep 17 00:00:00 2001 From: Git Action Bot Date: Thu, 16 May 2024 17:34:11 +0000 Subject: [PATCH 3/7] Bump patchVersion --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index f1f8c294d..00725aa79 100644 --- a/version.properties +++ b/version.properties @@ -1,3 +1,3 @@ majorVersion=5 minorVersion=6 -patchVersion=17 +patchVersion=18 From f7642d22b245f6c288e8fd29dd3318960317e863 Mon Sep 17 00:00:00 2001 From: chaneylc Date: Fri, 17 May 2024 13:46:01 -0500 Subject: [PATCH 4/7] hotfix for database upgrading issue --- .../main/java/com/fieldbook/tracker/database/DataHelper.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/fieldbook/tracker/database/DataHelper.java b/app/src/main/java/com/fieldbook/tracker/database/DataHelper.java index 559d63811..716351d22 100644 --- a/app/src/main/java/com/fieldbook/tracker/database/DataHelper.java +++ b/app/src/main/java/com/fieldbook/tracker/database/DataHelper.java @@ -944,6 +944,9 @@ public void open() { try { db = openHelper.getWritableDatabase(); + if (DATABASE_VERSION == 11) { + openHelper.onUpgrade(db, 10, 11); + } } catch (Exception e) { Log.e(TAG, e.getMessage()); } @@ -2962,7 +2965,7 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { } - if (oldVersion <= 10 & newVersion >= 11) { + if (oldVersion <= 10 && newVersion >= 11) { // modify studies table for better handling of brapi study attributes db.execSQL("ALTER TABLE studies ADD COLUMN import_format TEXT"); From 12cc197c9e1bca81da7cc3bb74df86c5026ac5c8 Mon Sep 17 00:00:00 2001 From: chaneylc Date: Sat, 18 May 2024 14:20:48 -0500 Subject: [PATCH 5/7] database upgrade fixes on fresh install --- .../java/com/fieldbook/tracker/database/DataHelper.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/fieldbook/tracker/database/DataHelper.java b/app/src/main/java/com/fieldbook/tracker/database/DataHelper.java index 716351d22..5b34a4f51 100644 --- a/app/src/main/java/com/fieldbook/tracker/database/DataHelper.java +++ b/app/src/main/java/com/fieldbook/tracker/database/DataHelper.java @@ -944,9 +944,6 @@ public void open() { try { db = openHelper.getWritableDatabase(); - if (DATABASE_VERSION == 11) { - openHelper.onUpgrade(db, 10, 11); - } } catch (Exception e) { Log.e(TAG, e.getMessage()); } @@ -2775,7 +2772,11 @@ public void onCreate(SQLiteDatabase db) { Log.e(TAG, e.getMessage()); } + //migrate handles database upgrade from 8 -> 9 Migrator.Companion.createTables(db, getAllTraitObjects(db)); + + //this will force new databases to have full updates, otherwise sqliteopenhelper will not upgrade + onUpgrade(db, 9, DATABASE_VERSION); } /** From b7461a69ded030a224de1f5ce1ed83bb4fb4a977 Mon Sep 17 00:00:00 2001 From: Git Action Bot Date: Mon, 20 May 2024 01:55:09 +0000 Subject: [PATCH 6/7] Bump patchVersion --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index 00725aa79..5175be390 100644 --- a/version.properties +++ b/version.properties @@ -1,3 +1,3 @@ majorVersion=5 minorVersion=6 -patchVersion=18 +patchVersion=19 From 3e323b237970f9cb91d51706f7255734c2dffa7d Mon Sep 17 00:00:00 2001 From: Trevor Rife Date: Tue, 28 May 2024 14:32:48 -0500 Subject: [PATCH 7/7] Update github-release.yml --- .github/workflows/github-release.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml index 9a40cc6fb..f27558c66 100644 --- a/.github/workflows/github-release.yml +++ b/.github/workflows/github-release.yml @@ -158,10 +158,10 @@ jobs: ${{ steps.matching_release.outputs.body }} ${{ env.COMMIT_MSG }} -# - name: Release APK to Play Store -# uses: r0adkll/upload-google-play@v1 -# with: -# serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }} -# packageName: com.fieldbook.tracker -# releaseFiles: app/build/outputs/apk/release/app-release-unsigned-signed.apk -# track: alpha + - name: Release APK to Play Store + uses: r0adkll/upload-google-play@v1 + with: + serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }} + packageName: com.fieldbook.tracker + releaseFiles: app/build/outputs/apk/release/app-release-unsigned-signed.apk + track: alpha