1
1
2
+ /*
3
+ * Copyright (c) 2018 stanwood Gmbh
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ * of this software and associated documentation files (the "Software"), to deal
7
+ * in the Software without restriction, including without limitation the rights
8
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ * copies of the Software, and to permit persons to whom the Software is
10
+ * furnished to do so, subject to the following conditions:
11
+ *
12
+ * The above copyright notice and this permission notice shall be included in all
13
+ * copies or substantial portions of the Software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ * SOFTWARE.
22
+ */
23
+
2
24
package io.stanwood.bitrise
3
25
26
+ import android.content.SharedPreferences
4
27
import android.os.Bundle
5
- import android.support.v7.app.AppCompatActivity
6
28
import io.stanwood.bitrise.di.Properties
7
29
import io.stanwood.bitrise.di.applicationModule
8
- import io.stanwood.bitrise.navigation.Navigator
9
- import io.stanwood.bitrise.navigation.SCREEN_LOGIN
10
30
import io.stanwood.bitrise.ui.artifacts.di.artifactsModule
11
31
import io.stanwood.bitrise.ui.build.di.buildModule
12
32
import io.stanwood.bitrise.ui.builds.di.buildsModule
@@ -20,44 +40,29 @@ import org.koin.android.ext.android.setProperty
20
40
import org.koin.android.ext.koin.with
21
41
import org.koin.error.AlreadyStartedException
22
42
import org.koin.standalone.StandAloneContext
23
- import ru.terrakok.cicerone.NavigatorHolder
24
- import ru.terrakok.cicerone.Router
25
43
import timber.log.Timber
26
- import timber.log.Timber.DebugTree
27
44
28
45
29
46
class MainActivity : PermissionActivity () {
30
47
31
- private val navigator: Navigator by inject()
32
- private val navigatorHolder: NavigatorHolder by inject()
33
- private val router: Router by inject()
48
+ private val sharedPreferences: SharedPreferences by inject()
34
49
35
50
override fun onCreate (savedInstanceState : Bundle ? ) {
36
51
super .onCreate(savedInstanceState)
37
52
if (BuildConfig .DEBUG ) {
38
- Timber .plant(DebugTree ())
53
+ Timber .plant(Timber . DebugTree ())
39
54
}
40
55
startKoin()
41
56
setProperty(Properties .ACTIVITY , this )
57
+ setProperty(Properties .TOKEN , sharedPreferences.getString(Properties .TOKEN , BuildConfig .BITRISE_API_TOKEN ) ? : " " )
42
58
setContentView(R .layout.activity_main)
43
- router.newRootScreen(SCREEN_LOGIN , true )
44
59
}
45
60
46
61
override fun onDestroy () {
47
62
super .onDestroy()
48
63
StandAloneContext .closeKoin()
49
64
}
50
65
51
- override fun onResumeFragments () {
52
- super .onResumeFragments()
53
- navigatorHolder.setNavigator(navigator)
54
- }
55
-
56
- override fun onPause () {
57
- super .onPause()
58
- navigatorHolder.removeNavigator()
59
- }
60
-
61
66
private fun startKoin () {
62
67
try {
63
68
StandAloneContext .startKoin(listOf (
0 commit comments