From e389632afd52403aba26b6981d098b93cea45e00 Mon Sep 17 00:00:00 2001 From: Jamie Date: Thu, 12 Feb 2026 21:48:45 +0100 Subject: [PATCH] feat(Microsoft Lens): Remove migration to OneDrive (#6551) Co-authored-by: Jamie Stumme <3059647+StummeJ@users.noreply.github.com> Co-authored-by: oSumAtrIX --- patches/api/patches.api | 4 ++++ .../officelens/misc/onedrive/Fingerprints.kt | 11 ++++++++++ .../onedrive/HideOneDriveMigrationPatch.kt | 22 +++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 patches/src/main/kotlin/app/revanced/patches/microsoft/officelens/misc/onedrive/Fingerprints.kt create mode 100644 patches/src/main/kotlin/app/revanced/patches/microsoft/officelens/misc/onedrive/HideOneDriveMigrationPatch.kt diff --git a/patches/api/patches.api b/patches/api/patches.api index 49cde454d..e38ad6f4b 100644 --- a/patches/api/patches.api +++ b/patches/api/patches.api @@ -444,6 +444,10 @@ public final class app/revanced/patches/meta/ads/HideAdsPatchKt { public static final fun getHideAdsPatch ()Lapp/revanced/patcher/patch/BytecodePatch; } +public final class app/revanced/patches/microsoft/officelens/misc/onedrive/HideOneDriveMigrationPatchKt { + public static final fun getHideOneDriveMigrationPatch ()Lapp/revanced/patcher/patch/BytecodePatch; +} + public final class app/revanced/patches/mifitness/misc/locale/ForceEnglishLocalePatchKt { public static final fun getForceEnglishLocalePatch ()Lapp/revanced/patcher/patch/BytecodePatch; } diff --git a/patches/src/main/kotlin/app/revanced/patches/microsoft/officelens/misc/onedrive/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/microsoft/officelens/misc/onedrive/Fingerprints.kt new file mode 100644 index 000000000..570dda087 --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/microsoft/officelens/misc/onedrive/Fingerprints.kt @@ -0,0 +1,11 @@ +package app.revanced.patches.microsoft.officelens.misc.onedrive + +import com.android.tools.smali.dexlib2.Opcode +import com.android.tools.smali.dexlib2.AccessFlags +import app.revanced.patcher.fingerprint + +internal val hasMigratedToOneDriveFingerprint = fingerprint { + custom { method, classDef -> + classDef.endsWith("FREManager;") && method.name == "getMigrationStage" + } +} diff --git a/patches/src/main/kotlin/app/revanced/patches/microsoft/officelens/misc/onedrive/HideOneDriveMigrationPatch.kt b/patches/src/main/kotlin/app/revanced/patches/microsoft/officelens/misc/onedrive/HideOneDriveMigrationPatch.kt new file mode 100644 index 000000000..a772a7b12 --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/microsoft/officelens/misc/onedrive/HideOneDriveMigrationPatch.kt @@ -0,0 +1,22 @@ +package app.revanced.patches.microsoft.officelens.misc.onedrive + +import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions +import app.revanced.patcher.patch.bytecodePatch + +@Suppress("unused") +val hideOneDriveMigrationPatch = bytecodePatch( + name = "Hide OneDrive migration", + description = "Hides the OneDrive migration prompt when opening Microsoft Office Lens.", +) { + compatibleWith("com.microsoft.office.officelens") + + execute { + hasMigratedToOneDriveFingerprint.method.replaceInstructions( + 0, + """ + sget-object v0, Lcom/microsoft/office/officelens/scansMigration/LensMigrationStage;->PreMigration:Lcom/microsoft/office/officelens/scansMigration/LensMigrationStage; + return-object v0 + """, + ) + } +} \ No newline at end of file