mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-04-30 06:34:29 +02:00
feat(client_bootstrap_override): simple snapchat
This commit is contained in:
parent
047efccb3f
commit
7d932f0fb4
@ -478,6 +478,10 @@
|
|||||||
"home_tab": {
|
"home_tab": {
|
||||||
"name": "Home Tab",
|
"name": "Home Tab",
|
||||||
"description": "Overrides the startup tab when opening Snapchat"
|
"description": "Overrides the startup tab when opening Snapchat"
|
||||||
|
},
|
||||||
|
"simple_snapchat":{
|
||||||
|
"name": "Simple Snapchat",
|
||||||
|
"description": "Enables a simplified version of Snapchat"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1279,6 +1283,10 @@
|
|||||||
"discover": "Discover",
|
"discover": "Discover",
|
||||||
"spotlight": "Spotlight"
|
"spotlight": "Spotlight"
|
||||||
},
|
},
|
||||||
|
"simple_snapchat": {
|
||||||
|
"always_enabled": "Always Enabled",
|
||||||
|
"always_disabled": "Always Disabled"
|
||||||
|
},
|
||||||
"add_friend_source_spoof": {
|
"add_friend_source_spoof": {
|
||||||
"added_by_username": "By Username",
|
"added_by_username": "By Username",
|
||||||
"added_by_mention": "By Mention",
|
"added_by_mention": "By Mention",
|
||||||
|
@ -11,8 +11,9 @@ class UserInterfaceTweaks : ConfigContainer() {
|
|||||||
val tabs = arrayOf("map", "chat", "camera", "discover", "spotlight")
|
val tabs = arrayOf("map", "chat", "camera", "discover", "spotlight")
|
||||||
}
|
}
|
||||||
|
|
||||||
val appAppearance = unique("app_appearance", "always_light", "always_dark")
|
val appAppearance = unique("app_appearance", "always_light", "always_dark") { requireRestart() }
|
||||||
val homeTab = unique("home_tab", *tabs) { addNotices(FeatureNotice.UNSTABLE) }
|
val homeTab = unique("home_tab", *tabs) { addNotices(FeatureNotice.UNSTABLE); requireRestart() }
|
||||||
|
val simpleSnapchat = unique("simple_snapchat", "always_enabled", "always_disabled") { addNotices(FeatureNotice.UNSTABLE); requireRestart() }
|
||||||
}
|
}
|
||||||
|
|
||||||
inner class FriendFeedMessagePreview : ConfigContainer(hasGlobalState = true) {
|
inner class FriendFeedMessagePreview : ConfigContainer(hasGlobalState = true) {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package me.rhunk.snapenhance.core.features.impl.ui
|
package me.rhunk.snapenhance.core.features.impl.ui
|
||||||
|
|
||||||
import me.rhunk.snapenhance.common.config.impl.UserInterfaceTweaks
|
import me.rhunk.snapenhance.common.config.impl.UserInterfaceTweaks
|
||||||
|
import me.rhunk.snapenhance.common.util.protobuf.ProtoEditor
|
||||||
|
import me.rhunk.snapenhance.common.util.protobuf.ProtoWriter
|
||||||
import me.rhunk.snapenhance.core.features.Feature
|
import me.rhunk.snapenhance.core.features.Feature
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
@ -28,8 +30,26 @@ class ClientBootstrapOverride: Feature("ClientBootstrapOverride") {
|
|||||||
appearanceStartupConfigFile.writeBytes(byteArrayOf(0, 0, 0, state))
|
appearanceStartupConfigFile.writeBytes(byteArrayOf(0, 0, 0, state))
|
||||||
}
|
}
|
||||||
|
|
||||||
bootstrapOverrideConfig.homeTab.getNullable()?.also { currentTab ->
|
val homeTab = bootstrapOverrideConfig.homeTab.getNullable()
|
||||||
plusFile.writeBytes(byteArrayOf(8, (UserInterfaceTweaks.BootstrapOverride.tabs.indexOf(currentTab) + 1).toByte()))
|
val simpleSnapchat = bootstrapOverrideConfig.simpleSnapchat.getNullable()
|
||||||
|
|
||||||
|
if (homeTab != null || simpleSnapchat != null) {
|
||||||
|
val plusFileBytes = plusFile.exists().let { if (it) plusFile.readBytes() else ProtoWriter().toByteArray() }
|
||||||
|
|
||||||
|
plusFile.writeBytes(
|
||||||
|
ProtoEditor(plusFileBytes).apply {
|
||||||
|
edit {
|
||||||
|
homeTab?.let { currentTab ->
|
||||||
|
remove(1)
|
||||||
|
addVarInt(1, UserInterfaceTweaks.BootstrapOverride.tabs.indexOf(currentTab) + 1)
|
||||||
|
}
|
||||||
|
simpleSnapchat?.let { simpleSnapchat ->
|
||||||
|
remove(2)
|
||||||
|
addVarInt(2, if (simpleSnapchat == "always_enabled") 1 else 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.toByteArray()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user