Skip to content

Conversation

marionbarker
Copy link
Contributor

@marionbarker marionbarker commented Jul 14, 2025

Purpose

Edited because this is now based off of Loop PR 2329 with PR 2325 closed.

This is a preliminary addition of Loop PR 2325 to the customization script.

Two PR are required: one for customization and one for lnl-scripts

Limitations

Because there are so many customizations that touch similar parts of the code, it can get hard to make all options completely independent of the inclusion of other customization items.

The patch that adds the Food Search is configured to be applied last (and removed first if removing a customization).

Order is not independent

The patch required to add PR 2329 is not independent from these 3 customizations:

  • Profile Save & Load, Basal Lock and Live Activity
  • If applied after any or all of those, all the customizations previously applied are present but a message will report that one or more of those 3 is not compatible

However, this version of the patch can be applied to a clone with no customizations or if any those 3 is already applied. That is deemed good enough for this preliminary version.

@marionbarker
Copy link
Contributor Author

marionbarker commented Aug 11, 2025

An updated version was obtained from PR 2329 with the following steps.

for more details, review these comments in PR 2329:

  1. I created a new branch hosted at loopandlearn Loop: modify_for_pr2329, which has changes required to allow the version in Taylor's repository to build, but tests do not work.

  2. I created a new branch hosted at loopandlearn Loop: prepare_for_customization_pr2329 that goes farther than modify_for_pr2329. I removed test files and Documentation files - these do not need to be part of the customization patch.

  3. The naming conventions for the patch is: pr2329_commit{from-taylor}_commit{from-prepare_for_customization_pr2329}.patch

Update method

Each time Taylor updates his original PR or sometimes when the dev branch is updated, I need to update these branches.

Note that while preparing this, Taylor did an update, so the version labeled: pr2329_477ca57a_c7ff2ca0.patch will soon be moved to the archive branch.

Update with new commits

When Taylor updates his branch, then I need to also update my two branches:

In a local copy of Taylor's branch:

git pull
git switch modify_for_pr2329
git merge <local-name-for-taylor's-branch>
git switch prepare_for_customization_pr2329
git merge modify_for_pr2329

This keeps the 3 version in alignment.

At that time, I can either regenerate or update the patch file for customization, depending on the details of the modification. It is typically easier to edit because there are custom edits required to modify 2 files in the patch to be compatible with some other customizations:

@marionbarker
Copy link
Contributor Author

marionbarker commented Aug 11, 2025

The customization patch was updated with Taylor's update. This modifies the default choices for each option of food search to the suggested choice.

@rfmurphy81
Copy link

I'm interested in giving this functionality a whirl, but have been relying on the Live Activity customization almost religiously since it was introduced into the customization script to amazing benefit, so I'm really wishing to keep Live Activity. Any ideas on when AI Food Search would be compatible with Live Activity in the customization? Forgive me if this is not the place to ask such a question.

@marionbarker
Copy link
Contributor Author

@rfmurphy81

In order to implement a new customization, both the lnl-scripts and customization repositories are updated together via a paired set of PR.

The instructions on how to test are found in the lnl-scripts PR.

loopandlearn/lnl-scripts#82 (comment)

Taylor is making a few more changes. Those will be added in a few days (after he says he is done).

The functionality of the Food Search is already included in this special branch.

@marionbarker
Copy link
Contributor Author

Update for dev v3.7.7

Summary

  • updates completed
  • successful test for main and dev branches of LoopWorkspace

Details

After dev branch was updated to v3.7.7, this customization required an update.

Update modify_for_pr2329

First merge dev into modify_for_pr2329.

These files had a merge conflict when merging dev into modify_for_pr2329:

  • CONFLICT (content): Merge conflict in Loop.xcodeproj/project.pbxproj
  • CONFLICT (content): Merge conflict in Loop/Views/CarbEntryView.swift

After merging, I checked the state of localizations. The Loop/Localizable.xcstrings content:

  • 619 strings for modify_for_pr2329
  • 439 strings for 'dev`

When building using Loop with updated modify_for_pr2329 and spot checking translations, it appears the translations in dev are also in modify_for_pr2329.

Update

Now merge modify_for_pr2329 into prepare_for_customization_pr2329,
There were no conflicts.
Do a test build using prepare_for_customization_pr2329 as branch for Loop.

Prepare the customization with

git diff --binary dev prepare_for_customization_pr2329 > temporary_loop_patch_filename_for_dev377

convert to LoopWorkspace patch by global s/r of /Loop with /Loop/Loop
Tweak the patch in a few places to make it compatible with profiles, live_activity and basal_lock.

Test

After pushing updates to customization repository, test with this command on an unmodified main branch and an unmodified dev branch.

export SCRIPT_BRANCH=prelim_ai_food 
export PATCH_BRANCH=prelim_ai_food

/bin/bash -c \
    "$(curl -fsSL https://raw.githubusercontent.com/loopandlearn/lnl-scripts/$SCRIPT_BRANCH/CustomizationSelect.sh)" \
    negative_insulin \
    dexcom_upload_readings \
    future_carbs_4h \
    no_auth \
    override_sens \
    now_line \
    watch_title \
    profiles \
    basal_lock \
    live_activity \
    meal_days \
    food_search

unset SCRIPT_BRANCH
unset PATCH_BRANCH

Successful for both main and dev.

@marionbarker
Copy link
Contributor Author

marionbarker commented Sep 23, 2025

Update using what Taylor claimed was his last commit: f090fdde.

Work through merges from his code with appropriate conflict resolution to a buildable version.

  • Note: both Loop and LoopKit must be modified
  • Branches in loopandlearn GitHub user name of modify_for_pr2329 for both Loop and LoopKit are needed to incorporate PR 2329
  • The scaled-down branch for Loop, prepare_for_customization_pr2329, is used to create the patch for the customization along with LoopKit modify_for_pr2329
  • warning, the GitHub versions for the 2 Loop branches are out of date because of the "secrets" issue - see note at end

First step:

  1. bring in Taylor's commits to my local clone of Loop in branch named: taylor-try2-dev
  2. merge taylor-try2-dev into modify_for_pr2329
  3. Taylor sent me the 4 files that are modified in LoopKit to enable his latests commits to work
  4. create a modify_for_pr2329 branch in my local clone for LoopKit
  5. confirm my clone builds
  6. Now merge the latest Loop dev branch into modify_for_pr2329
  7. Resolve conflicts and test the build
  8. Because that latest merge of dev brought in string catalogs, there are updates to the catalogs following the build
  9. Commit the string catalog changes

Second step:

  1. merge modify_for_pr2329 in my local clone of Loop into prepare_for_customization_pr2329 branch and resolve merge conflicts
  2. Taylor modified the documentation in his branch, so it reappeared in prepare_for_customization_pr2329
  3. Remove the documentation again because we don't want that to be part of the customization patch
  4. test build

Third step:
Prepare a new patch, using the naming convention of taylor's commit then prepare_for_customization_pr2329 commit in Loop.

Create the patch from local repository changes.
Do the hand edits to the patch required to make this it compatible with other customization patches.

Push the patch with a name that includes the commit from Taylor and the commit from prepare_for_customization_pr2329 in my local clone. (See note later about why this commit for this branch is not available in loopandlearn Loop at this time.)

Final cleanup:
Push the local clone changes to loopandlearn GitHub for Loop and LoopKit

I don't have time to deal with this right now.
If people want the customization - it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants