Skip to content

Commit

Permalink
Handle hook exceptions
Browse files Browse the repository at this point in the history
If a hook does not work properly, the hooker won't stop, i.e. will continue trying the remaining hooks.
  • Loading branch information
ElJaviLuki committed Sep 15, 2022
1 parent ae7d0d8 commit d64dc22
Showing 1 changed file with 66 additions and 13 deletions.
79 changes: 66 additions & 13 deletions app/src/main/java/com/eljaviluki/grindrplus/Hooker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
}
}
}
)
Expand Down

0 comments on commit d64dc22

Please sign in to comment.