A system call responsible for a process attaching itself to another process: ptrace.
sudo dtrace -ln 'syscall:::entry'
static func initConfig() { | |
multiConfig = startMultiConfig(apply: { | |
$0.multiConfig(configuration: configuration()) | |
}) |
class SampleApp : Application() { | |
override fun onCreate() { | |
super.onCreate() | |
startMultiConfig { | |
multiConfig( | |
configuration = configuration() | |
) | |
} | |
} | |
} |
implementation('com.juliuscanute.multiconfignoui:multiconfignoui:1.0.59@aar') { | |
transitive = true | |
} |
class MainActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
val config = MultiConfigure.getConfig() | |
val colorConfig = config.getConfigPair("D") | |
setContent { | |
MaterialTheme { | |
Greeting( | |
text = config.getConfigString("C"), | |
visibility = config.getConfigBoolean("A"), |
final class ConfigurationData: ObservableObject { | |
/*...*/ | |
func setData(environment: String? = nil) { | |
/*...*/ | |
let config: ConfigurationGetter = Environment.multiConfig!.getConfig() | |
let text = config.getConfigString(userKey: "C") | |
let visibility = config.getConfigBoolean(userKey: "A") | |
let size = Int(config.getConfigInt(userKey: "B")) | |
let currentChoice: KotlinPair = config.getConfigPair(userKey: "D") | |
let choiceNo: Int = Int(currentChoice.second as! Int32) |
public enum Environment { | |
/*...*/ | |
static func initConfig() { | |
multiConfig = startMultiConfig(rootGroup: "group.julius.multiconfig", | |
controller: getLaunchController(), apply: { | |
$0.multiConfig(configuration: configuration()) | |
}) | |
} | |
/*...*/ | |
} |
class SampleApp : Application() { | |
override fun onCreate() { | |
super.onCreate() | |
startMultiConfig( | |
context = this, | |
intent = Intent(this@SampleApp, MainActivity::class.java) | |
) { | |
multiConfig(configuration = configuration()) | |
} | |
} |
appConfig { | |
config("FREE") {/*...*/} | |
config("PREMIUM") {/*...*/} | |
} |