@@ -178,29 +178,27 @@ val unlockPremiumPatch = bytecodePatch(
178
178
?.let { interfaceName -> classes.find { it.type == interfaceName } }
179
179
? : throw PatchException (" Could not find context menu item interface." )
180
180
181
- val contextMenuItemInterfaceName = contextMenuItemInterfaceClassDef.type
182
-
183
181
val contextMenuItemViewModelClassName = getViewModelFingerprint
184
182
.matchOrNull(contextMenuItemInterfaceClassDef)
185
183
?.originalMethod
186
184
?.returnType
187
185
? : throw PatchException (" Could not find context menu item view model class." )
188
186
189
187
val castContextMenuItemStubIndex = indexOfFirstInstructionOrThrow {
190
- getReference<TypeReference >()?.type == CONTEXT_MENU_ITEM_PLACEHOLDER_CLASS_NAME
188
+ getReference<TypeReference >()?.type == CONTEXT_MENU_ITEM_CLASS_DESCRIPTOR_PLACEHOLDER
191
189
}
192
190
val contextMenuItemRegister = getInstruction<OneRegisterInstruction >(castContextMenuItemStubIndex)
193
191
.registerA
194
192
val getContextMenuItemStubViewModelIndex = indexOfFirstInstructionOrThrow {
195
- getReference<MethodReference >()?.definingClass == CONTEXT_MENU_ITEM_PLACEHOLDER_CLASS_NAME
193
+ getReference<MethodReference >()?.definingClass == CONTEXT_MENU_ITEM_CLASS_DESCRIPTOR_PLACEHOLDER
196
194
}
197
195
198
196
val getViewModelDescriptor =
199
- " $contextMenuItemInterfaceName ->getViewModel()$contextMenuItemViewModelClassName "
197
+ " $contextMenuItemInterfaceClassDef ->getViewModel()$contextMenuItemViewModelClassName "
200
198
201
199
replaceInstruction(
202
200
castContextMenuItemStubIndex,
203
- " check-cast v$contextMenuItemRegister , $contextMenuItemInterfaceName "
201
+ " check-cast v$contextMenuItemRegister , $contextMenuItemInterfaceClassDef "
204
202
)
205
203
replaceInstruction(
206
204
getContextMenuItemStubViewModelIndex,
@@ -209,14 +207,15 @@ val unlockPremiumPatch = bytecodePatch(
209
207
}
210
208
211
209
contextMenuViewModelConstructorFingerprint.match(contextMenuViewModelClassDef).method.apply {
210
+ val itemsListParameter = parameters.indexOfFirst { it.type == " Ljava/util/List;" } + 1
212
211
val filterContextMenuItemsDescriptor =
213
212
" $EXTENSION_CLASS_DESCRIPTOR ->filterContextMenuItems(Ljava/util/List;)Ljava/util/List;"
214
213
215
214
addInstructions(
216
215
0 ,
217
216
"""
218
- invoke-static { p3 }, $filterContextMenuItemsDescriptor
219
- move-result-object p3
217
+ invoke-static { p $itemsListParameter }, $filterContextMenuItemsDescriptor
218
+ move-result-object p $itemsListParameter
220
219
"""
221
220
)
222
221
}
@@ -306,8 +305,8 @@ val unlockPremiumPatch = bytecodePatch(
306
305
onErrorReturnCallIndex,
307
306
" invoke-static { v$onErrorReturnValueRegister }, " +
308
307
" $singleClassName ->just(Ljava/lang/Object;)$singleClassName \n " +
309
- " move-result-object v$onErrorReturnValueRegister \n " +
310
- " return-object v$onErrorReturnValueRegister "
308
+ " move-result-object v$onErrorReturnValueRegister \n " +
309
+ " return-object v$onErrorReturnValueRegister "
311
310
)
312
311
313
312
// Remove every instruction from the request call to right before the error static value construction.
0 commit comments