Skip to content

Commit a360e21

Browse files
Merge pull request #30 from SingularityIndonesia/main
Release Debug
2 parents b5c2b7a + 015751a commit a360e21

File tree

2 files changed

+106
-2
lines changed

2 files changed

+106
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ allprojects {
4545
}
4646
4747
dependencies {
48-
releaseImplementation 'com.github.SingularityIndonesia:AndroidCodebase:2.0.0-alpha1-20230908'
49-
debugImplementation 'com.github.SingularityIndonesia:AndroidCodebase:2.0.0-alpha1-20230908-debug'
48+
releaseImplementation 'com.github.SingularityIndonesia:AndroidCodebase:2.0.0-alpha1-20230911'
49+
debugImplementation 'com.github.SingularityIndonesia:AndroidCodebase:2.0.0-alpha1-20230911-debug'
5050
}
5151
```
5252

@@ -69,6 +69,7 @@ dependencies {
6969

7070
# Architecture Guideline
7171
See : [Architecture Guideline](https://github.com/SingularityIndonesia/AndroidCodebase/blob/docs/ArchitectureGuideline.md)
72+
Example : [Android Multi Module Guide](https://github.com/SingularityIndonesia/AndroidArchitectureGuide)
7273

7374
# Note
7475
Note that this example was made as simple as possible, so it is not recommended to follow the architecture of the given sample and please read the notes.
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
package com.singularity_code.codebase.util.scope
2+
3+
import kotlin.contracts.ExperimentalContracts
4+
import kotlin.contracts.InvocationKind
5+
import kotlin.contracts.contract
6+
7+
/**
8+
* Created by: stefanus
9+
* 25/09/23 01.36
10+
* Design by: stefanus.ayudha@gmail.com
11+
*/
12+
@OptIn(ExperimentalContracts::class)
13+
@Suppress("SUBTYPING_BETWEEN_CONTEXT_RECEIVERS")
14+
inline fun <A, B, R> with(
15+
a: A,
16+
b: B,
17+
block: context(A, B) () -> R
18+
): R {
19+
contract {
20+
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
21+
}
22+
return block(a, b)
23+
}
24+
25+
@OptIn(ExperimentalContracts::class)
26+
@Suppress("SUBTYPING_BETWEEN_CONTEXT_RECEIVERS")
27+
inline fun <A, B, C, R> with(
28+
a: A,
29+
b: B,
30+
c: C,
31+
block: context(A, B, C) () -> R
32+
): R {
33+
contract {
34+
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
35+
}
36+
return block(a, b, c)
37+
}
38+
39+
@OptIn(ExperimentalContracts::class)
40+
@Suppress("SUBTYPING_BETWEEN_CONTEXT_RECEIVERS")
41+
inline fun <A, B, C, D, R> with(
42+
a: A,
43+
b: B,
44+
c: C,
45+
d: D,
46+
block: context(A, B, C, D) () -> R
47+
): R {
48+
contract {
49+
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
50+
}
51+
return block(a, b, c, d)
52+
}
53+
54+
@OptIn(ExperimentalContracts::class)
55+
@Suppress("SUBTYPING_BETWEEN_CONTEXT_RECEIVERS")
56+
inline fun <A, B, C, D, E, R> with(
57+
a: A,
58+
b: B,
59+
c: C,
60+
d: D,
61+
e: E,
62+
block: context(A, B, C, D, E) () -> R
63+
): R {
64+
contract {
65+
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
66+
}
67+
return block(a, b, c, d, e)
68+
}
69+
70+
@OptIn(ExperimentalContracts::class)
71+
@Suppress("SUBTYPING_BETWEEN_CONTEXT_RECEIVERS")
72+
inline fun <A, B, C, D, E, F, R> with(
73+
a: A,
74+
b: B,
75+
c: C,
76+
d: D,
77+
e: E,
78+
f: F,
79+
block: context(A, B, C, D, E, F) () -> R
80+
): R {
81+
contract {
82+
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
83+
}
84+
return block(a, b, c, d, e, f)
85+
}
86+
87+
@OptIn(ExperimentalContracts::class)
88+
@Suppress("SUBTYPING_BETWEEN_CONTEXT_RECEIVERS")
89+
inline fun <A, B, C, D, E, F, G, R> with(
90+
a: A,
91+
b: B,
92+
c: C,
93+
d: D,
94+
e: E,
95+
f: F,
96+
g: G,
97+
block: context(A, B, C, D, E, F, G) () -> R
98+
): R {
99+
contract {
100+
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
101+
}
102+
return block(a, b, c, d, e, f, g)
103+
}

0 commit comments

Comments
 (0)