From d64dc225b3c0b3c6268cbcb68deb1f5d2bd1dc1d Mon Sep 17 00:00:00 2001 From: ElJaviLuki Date: Fri, 16 Sep 2022 01:19:47 +0200 Subject: [PATCH] Handle hook exceptions If a hook does not work properly, the hooker won't stop, i.e. will continue trying the remaining hooks. --- .../java/com/eljaviluki/grindrplus/Hooker.kt | 79 ++++++++++++++++--- 1 file changed, 66 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/eljaviluki/grindrplus/Hooker.kt b/app/src/main/java/com/eljaviluki/grindrplus/Hooker.kt index e7ac90a3..6a12ae2f 100644 --- a/app/src/main/java/com/eljaviluki/grindrplus/Hooker.kt +++ b/app/src/main/java/com/eljaviluki/grindrplus/Hooker.kt @@ -36,19 +36,72 @@ class Hooker : IXposedHookLoadPackage { return } - Hooks.hookFeatureGranting() - Hooks.allowScreenshotsHook() - Hooks.unlimitedExpiringPhotos() - Hooks.addExtraProfileFields() - Hooks.hookUserSessionImpl() - Hooks.allowMockProvider() - Hooks.allowVideocallsOnEmptyChats() - Hooks.allowSomeExperiments() - - //I've set this to max 3 min. If we make an UI for Hook Settings, we'll let the user to change this. - Hooks.hookOnlineIndicatorDuration(3.minutes) - Hooks.unlimitedTaps() - Hooks.removeExpirationOnExpiringPhotos() + try { + Hooks.hookFeatureGranting() + } catch (e : Exception) { + e.message?.let { Logger.xLog(it) } + } + + try { + Hooks.allowScreenshotsHook() + } catch (e : Exception) { + e.message?.let { Logger.xLog(it) } + } + + try { + Hooks.unlimitedExpiringPhotos() + } catch (e : Exception) { + e.message?.let { Logger.xLog(it) } + } + + try { + Hooks.addExtraProfileFields() + } catch (e : Exception) { + e.message?.let { Logger.xLog(it) } + } + + try { + Hooks.hookUserSessionImpl() + } catch (e : Exception) { + e.message?.let { Logger.xLog(it) } + } + + try { + Hooks.allowMockProvider() + } catch (e : Exception) { + e.message?.let { Logger.xLog(it) } + } + + try { + Hooks.allowVideocallsOnEmptyChats() + } catch (e : Exception) { + e.message?.let { Logger.xLog(it) } + } + + try { + Hooks.allowSomeExperiments() + } catch (e : Exception) { + e.message?.let { Logger.xLog(it) } + } + + try { + //I've set this to max 3 min. If we make an UI for Hook Settings, we'll let the user to change this. + Hooks.hookOnlineIndicatorDuration(3.minutes) + } catch (e : Exception) { + e.message?.let { Logger.xLog(it) } + } + + try { + Hooks.unlimitedTaps() + } catch (e : Exception) { + e.message?.let { Logger.xLog(it) } + } + + try { + Hooks.removeExpirationOnExpiringPhotos() + } catch (e : Exception) { + e.message?.let { Logger.xLog(it) } + } } } )