mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-06-12 05:07:46 +02:00
feat: loop media playback
- refactor mappings wrapper
This commit is contained in:
@ -378,6 +378,10 @@
|
||||
"name": "Unlimited Snap View Time",
|
||||
"description": "Removes the Time Limit for viewing Snaps"
|
||||
},
|
||||
"loop_media_playback": {
|
||||
"name": "Loop Media Playback",
|
||||
"description": "Loops media playback when viewing Snaps / Stories"
|
||||
},
|
||||
"disable_replay_in_ff": {
|
||||
"name": "Disable Replay in FF",
|
||||
"description": "Disables the ability to replay with a long press from the Friend Feed"
|
||||
|
@ -31,6 +31,7 @@ class MappingsWrapper : FileLoaderWrapper(BridgeFileType.MAPPINGS, "{}".toByteAr
|
||||
FriendRelationshipChangerMapper::class,
|
||||
ViewBinderMapper::class,
|
||||
FriendingDataSourcesMapper::class,
|
||||
OperaViewerParamsMapper::class,
|
||||
)
|
||||
}
|
||||
|
||||
@ -115,29 +116,22 @@ class MappingsWrapper : FileLoaderWrapper(BridgeFileType.MAPPINGS, "{}".toByteAr
|
||||
return mappings[key]
|
||||
}
|
||||
|
||||
fun getMappedClass(className: String): Class<*> {
|
||||
return context.classLoader.loadClass(getMappedObject(className) as String)
|
||||
fun getMappedClass(className: String): Class<*>? {
|
||||
return runCatching {
|
||||
context.classLoader.loadClass(getMappedObject(className) as? String)
|
||||
}.getOrNull()
|
||||
}
|
||||
|
||||
fun getMappedClass(key: String, subKey: String): Class<*> {
|
||||
return context.classLoader.loadClass(getMappedValue(key, subKey))
|
||||
}
|
||||
|
||||
fun getMappedValue(key: String): String {
|
||||
return getMappedObject(key) as String
|
||||
fun getMappedValue(key: String, subKey: String): String? {
|
||||
return getMappedMap(key)?.get(subKey) as? String
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun <T : Any> getMappedList(key: String): List<T> {
|
||||
return listOf(getMappedObject(key) as List<T>).flatten()
|
||||
}
|
||||
|
||||
fun getMappedValue(key: String, subKey: String): String {
|
||||
return getMappedMap(key)[subKey] as String
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun getMappedMap(key: String): Map<String, *> {
|
||||
return getMappedObject(key) as Map<String, *>
|
||||
fun getMappedMap(key: String): Map<String, *>? {
|
||||
return getMappedObjectNullable(key) as? Map<String, *>
|
||||
}
|
||||
}
|
@ -55,6 +55,7 @@ class MessagingTweaks : ConfigContainer() {
|
||||
val hideBitmojiPresence = boolean("hide_bitmoji_presence")
|
||||
val hideTypingNotifications = boolean("hide_typing_notifications")
|
||||
val unlimitedSnapViewTime = boolean("unlimited_snap_view_time")
|
||||
val loopMediaPlayback = boolean("loop_media_playback") { requireRestart() }
|
||||
val disableReplayInFF = boolean("disable_replay_in_ff")
|
||||
val halfSwipeNotifier = container("half_swipe_notifier", HalfSwipeNotifierConfig()) { requireRestart()}
|
||||
val messagePreviewLength = integer("message_preview_length", defaultValue = 20)
|
||||
|
Reference in New Issue
Block a user