-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e6b2f4f
commit 5b170fe
Showing
22 changed files
with
299 additions
and
292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.v.base | ||
|
||
import com.v.base.net.VBNetApi | ||
|
||
|
||
//直接使用base库里面的网络请求 | ||
val apiBase: VBNetApi by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) { | ||
val netOptions = VBConfig.options.netOptions | ||
|
||
if (netOptions.baseUrl.isNullOrEmpty()) { | ||
throw IllegalStateException("baseUrl为空,请继承BaseApplication重写baseUrl()") | ||
} | ||
netOptions.retrofitBuilder.apply { | ||
baseUrl(netOptions.baseUrl) | ||
client(netOptions.okHttpClient) | ||
}.build().create(VBNetApi::class.java) | ||
} | ||
|
||
/** | ||
* author : ww | ||
* desc : 网络请求配置 | ||
* time : 2022-02-16 | ||
*/ | ||
object VBConfig { | ||
|
||
var options: VBConfigOptions = VBConfigOptions.Builder().build() | ||
|
||
fun init(options: VBConfigOptions) { | ||
this.options = options | ||
} | ||
|
||
} | ||
|
||
|
Oops, something went wrong.