Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
有錢人 ༽
Hello UTS
提交
90bf4e50
H
Hello UTS
项目概览
有錢人 ༽
/
Hello UTS
与 Fork 源项目一致
Fork自
DCloud / Hello UTS
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
Hello UTS
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
90bf4e50
编写于
10月 19, 2022
作者:
DCloud_iOS_XHY
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
提交 iOS 平台uts插件 系统截屏事件
上级
a7cfea73
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
110 addition
and
17 deletion
+110
-17
pages.json
pages.json
+1
-1
pages/SystemAPI/ScreenListen/screenlisten.vue
pages/SystemAPI/ScreenListen/screenlisten.vue
+13
-4
pages/SystemAPI/SystemAPI.vue
pages/SystemAPI/SystemAPI.vue
+9
-2
uni_modules/uni-getbatteryinfo/utssdk/app-ios/index.uts
uni_modules/uni-getbatteryinfo/utssdk/app-ios/index.uts
+9
-0
uni_modules/uts-screenshot-listener/utssdk/app-ios/index.uts
uni_modules/uts-screenshot-listener/utssdk/app-ios/index.uts
+49
-0
uni_modules/uts-tencentgeolocation/readme.md
uni_modules/uts-tencentgeolocation/readme.md
+28
-1
uni_modules/uts-tencentgeolocation/utssdk/app-ios/info.plist
uni_modules/uts-tencentgeolocation/utssdk/app-ios/info.plist
+1
-9
未找到文件。
pages.json
浏览文件 @
90bf4e50
...
...
@@ -64,7 +64,7 @@
},
{
"path"
:
"pages/SystemAPI/
android
/screenlisten"
,
"path"
:
"pages/SystemAPI/
ScreenListen
/screenlisten"
,
"style"
:
{
"navigationBarTitleText"
:
""
,
...
...
pages/SystemAPI/
android
/screenlisten.vue
→
pages/SystemAPI/
ScreenListen
/screenlisten.vue
浏览文件 @
90bf4e50
...
...
@@ -3,7 +3,7 @@
<page-head
title=
"监听系统截屏"
accordion
></page-head>
<uni-list>
<uni-list-item
@
tap=
"testScreenShotPremission"
title=
"准备截屏监听权限"
class=
"itemButton"
:clickable=
"true"
/>
<uni-list-item
@
tap=
"testScreenShotPremission"
title=
"准备截屏监听权限
(仅Android)
"
class=
"itemButton"
:clickable=
"true"
/>
<uni-list-item
@
tap=
"testScreenShotListen"
title=
"监听截屏事件"
class=
"itemButton"
:clickable=
"true"
/>
<uni-list-item
@
tap=
"testScreenShotOff"
title=
"关闭截屏监听"
class=
"itemButton"
:clickable=
"true"
/>
</uni-list>
...
...
@@ -30,6 +30,13 @@
methods
:
{
testScreenShotPremission
()
{
if
(
uni
.
getSystemInfoSync
().
platform
==
"
ios
"
)
{
uni
.
showToast
({
icon
:
"
none
"
,
title
:
'
iOS 平台无需请求权限
'
})
return
;
}
// 请求写入储存的权限
requestPremission
();
},
...
...
@@ -37,16 +44,18 @@
var
that
=
this
;
onUserCaptureScreen
(
function
(
res
)
{
console
.
log
(
res
);
that
.
screenImage
=
res
.
image
uni
.
showToast
({
icon
:
"
none
"
,
title
:
'
截屏捕捉成功
'
title
:
'
捕获截屏事件
'
})
if
(
uni
.
getSystemInfoSync
().
platform
==
"
android
"
)
{
that
.
screenImage
=
res
.
image
}
});
// 提示已经开始监听,注意观察
uni
.
showToast
({
icon
:
"
none
"
,
title
:
'
截屏监听已开启
,注意观察下方Image组件
'
title
:
'
截屏监听已开启
'
})
},
testScreenShotOff
()
{
...
...
pages/SystemAPI/SystemAPI.vue
浏览文件 @
90bf4e50
...
...
@@ -9,11 +9,18 @@
</uni-collapse-item>
</uni-collapse>
<uni-collapse>
<uni-collapse-item
title=
"系统事件"
:border=
"false"
>
<uni-list>
<uni-list-item
@
tap=
"gotoScreenListen"
title=
"监听系统截屏"
class=
"itemButton"
:clickable=
"true"
link
/>
</uni-list>
</uni-collapse-item>
</uni-collapse>
<uni-collapse>
<uni-collapse-item
title=
"android平台"
:border=
"false"
>
<uni-list>
<uni-list-item
@
tap=
"testGotoDemoActivity"
title=
"自定义activity(需自定义基座)"
class=
"itemButton"
:clickable=
"true"
link
/>
<uni-list-item
@
tap=
"gotoScreenListen"
title=
"监听系统截屏"
class=
"itemButton"
:clickable=
"true"
link
/>
</uni-list>
</uni-collapse-item>
</uni-collapse>
...
...
@@ -46,7 +53,7 @@
},
gotoScreenListen
(){
uni
.
navigateTo
({
url
:
'
/pages/SystemAPI/
android
/screenlisten
'
url
:
'
/pages/SystemAPI/
ScreenListen
/screenlisten
'
})
},
...
...
uni_modules/uni-getbatteryinfo/utssdk/app-ios/index.uts
浏览文件 @
90bf4e50
// 引用 iOS 原生平台 api
import { UIDevice } from "UIKit";
/**
* 定义 接口参数
*/
type GetBatteryInfoOptions = {
success?: (res: UTSJSONObject) => void;
fail?: (res: UTSJSONObject) => void;
complete?: (res: UTSJSONObject) => void;
};
/**
* 导出 获取电量方法
*/
export default function getBatteryInfo(options: GetBatteryInfoOptions) {
// 开启电量检测
UIDevice.current.isBatteryMonitoringEnabled = true
// 返回数据
const res = {
errMsg: "getBatteryInfo:ok",
level: Number(UIDevice.current.batteryLevel * 100),
...
...
uni_modules/uts-screenshot-listener/utssdk/app-ios/index.uts
0 → 100644
浏览文件 @
90bf4e50
import { NotificationCenter} from 'Foundation';
import { UIApplication } from "UIKit"
/**
* 定义监听截屏事件工具类
*/
class CaptureScreenTool {
static listener?: UTSCallback;
// 监听截屏
static listenCaptureScreen(callback?: UTSCallback) {
this.listener = callback
// 注册监听截屏事件及回调方法
// target-action 回调方法需要通过 Selector("方法名") 构建
const method = Selector("userDidTakeScreenshot")
NotificationCenter.default.addObserver(this, selector = method, name = UIApplication.userDidTakeScreenshotNotification, object = null)
}
// 捕获截屏回调的方法
// target-action 的方法前需要添加 @objc 前缀
@objc static userDidTakeScreenshot() {
const obj = new UTSJSONObject()
// 回调
this.listener?.(obj)
}
// 移除监听事件
static removeListen(callback?: UTSCallback) {
this.listener = null
NotificationCenter.default.removeObserver(this)
const obj = new UTSJSONObject()
callback?.(obj)
}
}
/**
* 开启截图监听
*/
export function onUserCaptureScreen(callback?: UTSCallback) {
CaptureScreenTool.listenCaptureScreen(callback)
}
/**
* 关闭截屏监听
*/
export function offUserCaptureScreen(callback?: UTSCallback) {
CaptureScreenTool.removeListen(callback)
}
uni_modules/uts-tencentgeolocation/readme.md
浏览文件 @
90bf4e50
# uts-tencentgeolocation腾讯定位插件使用文档
## Android 平台
1.
申请腾讯地图key
[
申请网址
](
https://lbs.qq.com/mobile/androidMapSDK/developerGuide/getKey
)
...
...
@@ -17,7 +19,32 @@
注意打包自定义基座后将androix-core-1.0.0.jar移回原位,然后真机运行自定义基座。这个临时的移出移入问题后续会升级解决,详见uts插件开发文档的
[
临时注意
](
https://uniapp.dcloud.net.cn/plugin/uts-plugin.html#tempnotice
)
。
## iOS 平台
1.
申请腾讯地图key
[
申请网址
](
https://lbs.qq.com/mobile/androidMapSDK/developerGuide/getKey
)
2.
配置key到插件中
将申请的key配置到插件目录下 app-ios -> info.plist 中 TencentLBSAPIKey 对应的值
```
xml
<key>
TencentLBSAPIKey
</key>
<string>
您申请的Key
</string>
```
3.
配置访问位置权限描述信息
选中工程中的 manifest.json -> App权限配置 -> iOS隐私信息访问的许可描述,分别配置下列权限描述信息
-
NSLocationAlwaysUsageDescription
-
NSLocationWhenInUseUsageDescription
-
NSLocationAlwaysAndWhenInUseUsageDescription
4.
制作自定义基座运行后生效
## 相关开发文档
-
[
UTS 语法
](
https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html
)
-
[
UTS 原生插件
](
https://uniapp.dcloud.net.cn/plugin/uts-plugin.html
)
-
[
UTS 原生插件
](
https://uniapp.dcloud.net.cn/plugin/uts-plugin.html
)
\ No newline at end of file
uni_modules/uts-tencentgeolocation/utssdk/app-ios/info.plist
浏览文件 @
90bf4e50
...
...
@@ -2,15 +2,7 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist
version=
"1.0"
>
<dict>
<key>
NSLocationAlwaysUsageDescription
</key>
<string>
访问位置权限
</string>
<key>
NSLocationWhenInUseUsageDescription
</key>
<string>
使用期间获取位置权限
</string>
<key>
TencentLBSAPIKey
</key>
<string>
LZTBZ-77PCJ-HJAFN-KWXJ2-H357V-DJBK4
</string>
<key>
UIBackgroundModes
</key>
<array>
<string>
location
</string>
</array>
<string>
您申请的Key
</string>
</dict>
</plist>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录