Commit 6aefeda
committed
refactor: Make GoogleMapsInitializer suspendable
This change refactors the `GoogleMapsInitializer` to use suspend functions for initialization and reset operations, improving its testability and adherence to structured concurrency.
Key changes:
- Converted `GoogleMapsInitializer.initialize()` and `GoogleMapsInitializer.reset()` to `suspend` functions.
- Removed the internal `CoroutineScope` and job management from `GoogleMapsInitializer`.
- Updated unit and instrumentation tests to use `runTest` from `kotlinx-coroutines-test`, removing the need for `Thread.sleep()`.
- Added the `kotlinx-coroutines-test` dependency to the `maps-app` module.1 parent cdac9aa commit 6aefeda
4 files changed
Lines changed: 33 additions & 59 deletions
File tree
- maps-app
- src
- androidTest/java/com/google/maps/android/compose
- test/java/com/google/maps/android/compose
- maps-compose/src/main/java/com/google/maps/android/compose/internal
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
| |||
Lines changed: 5 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | 1 | | |
16 | 2 | | |
17 | 3 | | |
| |||
20 | 6 | | |
21 | 7 | | |
22 | 8 | | |
| 9 | + | |
| 10 | + | |
23 | 11 | | |
24 | 12 | | |
25 | 13 | | |
26 | 14 | | |
| 15 | + | |
27 | 16 | | |
28 | 17 | | |
29 | 18 | | |
30 | 19 | | |
31 | | - | |
| 20 | + | |
32 | 21 | | |
33 | 22 | | |
34 | 23 | | |
35 | 24 | | |
36 | | - | |
| 25 | + | |
37 | 26 | | |
38 | 27 | | |
39 | 28 | | |
40 | 29 | | |
41 | 30 | | |
42 | 31 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | 32 | | |
47 | 33 | | |
48 | 34 | | |
Lines changed: 6 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | 1 | | |
16 | 2 | | |
17 | 3 | | |
18 | 4 | | |
19 | 5 | | |
20 | 6 | | |
21 | 7 | | |
| 8 | + | |
| 9 | + | |
22 | 10 | | |
23 | 11 | | |
24 | 12 | | |
25 | 13 | | |
26 | 14 | | |
| 15 | + | |
27 | 16 | | |
28 | 17 | | |
29 | 18 | | |
30 | 19 | | |
31 | | - | |
| 20 | + | |
32 | 21 | | |
33 | 22 | | |
34 | 23 | | |
35 | 24 | | |
36 | | - | |
| 25 | + | |
37 | 26 | | |
38 | 27 | | |
39 | 28 | | |
40 | 29 | | |
41 | 30 | | |
42 | 31 | | |
43 | | - | |
44 | | - | |
45 | | - | |
| 32 | + | |
46 | 33 | | |
47 | 34 | | |
48 | 35 | | |
Lines changed: 21 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
75 | | - | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
97 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
98 | 101 | | |
| 102 | + | |
99 | 103 | | |
100 | 104 | | |
101 | 105 | | |
102 | | - | |
103 | 106 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
113 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
114 | 118 | | |
115 | 119 | | |
116 | 120 | | |
| |||
123 | 127 | | |
124 | 128 | | |
125 | 129 | | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
0 commit comments