提交 9d8a4766 编写于 作者: lizhongyi_'s avatar lizhongyi_

Merge branch 'dev' into LZY

* dev:
  修改 iOS插件引用的内置库名称
  适配最新的 android 内置库路径
...@@ -84,7 +84,7 @@ export function clearIntervalTask(taskId:number) { ...@@ -84,7 +84,7 @@ export function clearIntervalTask(taskId:number) {
* 实现一个添加view的 Runnable类 * 实现一个添加view的 Runnable类
* 用法说明:https://uniapp.dcloud.net.cn/plugin/uts-plugin.html#%E5%8C%BF%E5%90%8D%E5%86%85%E9%83%A8%E7%B1%BB * 用法说明:https://uniapp.dcloud.net.cn/plugin/uts-plugin.html#%E5%8C%BF%E5%90%8D%E5%86%85%E9%83%A8%E7%B1%BB
*/ */
class AddUIRunnable extends Runnable { class AddUIRunnable implements Runnable {
override run():void { override run():void {
......
import { UIAlertController , UIAlertAction , UITextField } from "UIKit" import { UIAlertController , UIAlertAction , UITextField } from "UIKit"
import { DCUTS } from "DCUTSFoundation" import { UTSiOS } from "DCloudUTSFoundation"
import { DispatchQueue } from 'Dispatch'; import { DispatchQueue } from 'Dispatch';
export function showAlert(title: string|null, message: string|null, result: (index: Number) => void) { export function showAlert(title: string|null, message: string|null, result: (index: Number) => void) {
// uts方法默认会在子线程中执行,涉及 UI 操作必须在主线程中运行,通过 DispatchQueue.main.async 方法可将代码在主线程中运行 // uts方法默认会在子线程中执行,涉及 UI 操作必须在主线程中运行,通过 DispatchQueue.main.async 方法可将代码在主线程中运行
DispatchQueue.main.async(execute=():void => { DispatchQueue.main.async(execute=():void => {
...@@ -26,7 +26,7 @@ export function showAlert(title: string|null, message: string|null, result: (ind ...@@ -26,7 +26,7 @@ export function showAlert(title: string|null, message: string|null, result: (ind
alert.addAction(cancelAction) alert.addAction(cancelAction)
// 打开 alert 弹窗 // 打开 alert 弹窗
DCUTS.getCurrentViewController().present(alert, animated= true) UTSiOS.getCurrentViewController().present(alert, animated= true)
}) })
} }
...@@ -58,6 +58,6 @@ export function showPrompt(title: string|null, message: string|null,placeholder: ...@@ -58,6 +58,6 @@ export function showPrompt(title: string|null, message: string|null,placeholder:
alert.addAction(okAction) alert.addAction(okAction)
// 打开 alert 弹窗 // 打开 alert 弹窗
DCUTS.getCurrentViewController().present(alert, animated= true) UTSiOS.getCurrentViewController().present(alert, animated= true)
}) })
} }
\ No newline at end of file
import Context from "android.content.Context"; import Context from "android.content.Context";
import BatteryManager from "android.os.BatteryManager"; import BatteryManager from "android.os.BatteryManager";
import { getAppContext } from "io.dcloud.uts.android"; import { UTSAndroid } from "io.dcloud.uts";
type GetBatteryInfoOptions = { type GetBatteryInfoOptions = {
...@@ -10,7 +10,7 @@ type GetBatteryInfoOptions = { ...@@ -10,7 +10,7 @@ type GetBatteryInfoOptions = {
} }
export default function getBatteryInfo(options: GetBatteryInfoOptions) { export default function getBatteryInfo(options: GetBatteryInfoOptions) {
const context = getAppContext(); const context = UTSAndroid.getAppContext();
if (context != null) { if (context != null) {
const manager = context.getSystemService( const manager = context.getSystemService(
Context.BATTERY_SERVICE Context.BATTERY_SERVICE
......
...@@ -4,5 +4,9 @@ ...@@ -4,5 +4,9 @@
<dict> <dict>
<key>TencentLBSAPIKey</key> <key>TencentLBSAPIKey</key>
<string>您申请的Key</string> <string>您申请的Key</string>
<key>UIBackgroundModes</key>
<array>
<string>location</string>
</array>
</dict> </dict>
</plist> </plist>
\ No newline at end of file
import { DCUTS } from "DCUTSFoundation" import { UTSiOS } from "DCloudUTSFoundation"
import "ToastSwiftFramework" import "ToastSwiftFramework"
import { DispatchQueue } from 'Dispatch'; import { DispatchQueue } from 'Dispatch';
export function showToast():boolean{ export function showToast():boolean{
// uts方法默认会在子线程中执行,涉及 UI 操作必须在主线程中运行,通过 DispatchQueue.main.async 方法可将代码在主线程中运行
DispatchQueue.main.async(execute=():void => { DispatchQueue.main.async(execute=():void => {
DCUTS.getCurrentViewController().view.makeToast("这是一条提示信息") // 在当前显示的控制器view上显示 toast 弹窗
UTSiOS.getCurrentViewController().view.makeToast("这是一条提示信息")
}) })
return true return true
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册