Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
Hello UTS
提交
7568a738
H
Hello UTS
项目概览
DCloud
/
Hello UTS
通知
1598
Star
27
Fork
9
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
2
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
Hello UTS
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
2
Issue
2
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
7568a738
编写于
3月 15, 2023
作者:
杜庆泉
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
android 适配3.7.7 新的编译校验规则
上级
40663c1e
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
70 addition
and
67 deletion
+70
-67
pages/index/index.vue
pages/index/index.vue
+2
-1
uni_modules/uts-alert/utssdk/app-android/index.uts
uni_modules/uts-alert/utssdk/app-android/index.uts
+46
-49
uni_modules/uts-helloworld/utssdk/index.uts
uni_modules/uts-helloworld/utssdk/index.uts
+0
-1
uni_modules/uts-screenshot-listener/utssdk/app-android/index.uts
...ules/uts-screenshot-listener/utssdk/app-android/index.uts
+19
-13
uni_modules/uts-screenshot-listener/utssdk/app-ios/index.uts
uni_modules/uts-screenshot-listener/utssdk/app-ios/index.uts
+2
-2
uni_modules/uts-screenshot-listener/utssdk/interface.uts
uni_modules/uts-screenshot-listener/utssdk/interface.uts
+1
-1
未找到文件。
pages/index/index.vue
浏览文件 @
7568a738
...
@@ -56,7 +56,8 @@
...
@@ -56,7 +56,8 @@
*/
*/
testDoSthWithJSON
:
function
()
{
testDoSthWithJSON
:
function
()
{
var
inputObject
=
{
var
inputObject
=
{
inputText
:
this
.
stringParam
inputText
:
this
.
stringParam
,
errCode
:
0
}
}
UTSHello
.
callWithJSONParam
({
UTSHello
.
callWithJSONParam
({
...
...
uni_modules/uts-alert/utssdk/app-android/index.uts
浏览文件 @
7568a738
...
@@ -9,90 +9,87 @@ import DialogInterface from 'android.content.DialogInterface';
...
@@ -9,90 +9,87 @@ import DialogInterface from 'android.content.DialogInterface';
import EditText from 'android.widget.EditText';
import EditText from 'android.widget.EditText';
@Suppress("UNUSED_PARAMETER")
@Suppress("UNUSED_PARAMETER")
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) {
// todo
let uiRunable = new DialogUIRunnable(null, _title!, _message!, "", false);
let uiRunable = new DialogUIRunnable(null,_title!,_message!,"",false);
UTSAndroid.getUniActivity()!.runOnUiThread(uiRunable)
UTSAndroid.getUniActivity()!.runOnUiThread(uiRunable)
}
}
@Suppress("UNUSED_PARAMETER")
@Suppress("UNUSED_PARAMETER")
export function showPrompt(_title
: string|null,_message: string|null,_placeholder: string|null, success: (content: string)=>
void) {
export function showPrompt(_title
: string | null, _message : string | null, _placeholder : string | null, success : (content : string) =>
void) {
let uiRunable = new DialogUIRunnable(success,
_title!,_message!,_placeholder!,
true);
let uiRunable = new DialogUIRunnable(success,
_title!, _message!, _placeholder!,
true);
UTSAndroid.getUniActivity()!.runOnUiThread(uiRunable)
UTSAndroid.getUniActivity()!.runOnUiThread(uiRunable)
}
}
/**
/**
* 用户输入对话框监听器
* 用户输入对话框监听器
*/
*/
class DialogListener extends DialogInterface.OnClickListener{
class DialogListener extends DialogInterface.OnClickListener
{
inputET
:
EditText
inputET
:
EditText
callback
:UTSCallback
callback
: (content : string) => void
constructor(et
:EditText,cb:UTSCallback)
{
constructor(et
: EditText, cb : (content : string) => void)
{
super();
super();
this.callback = cb;
this.callback = cb;
this.inputET = et;
this.inputET = et;
}
}
override onClick(_dialog
:DialogInterface,_arg1:Int ):
void {
override onClick(_dialog
: DialogInterface, _arg1 : Int) :
void {
//数据获取
//数据获取
let input = this.inputET.getText().toString()
let input = this.inputET.getText().toString()
this.callback(input);
this.callback(input);
Toast.makeText(UTSAndroid.getUniActivity(),input,
Toast.makeText(UTSAndroid.getUniActivity(),
input,
Toast.LENGTH_LONG).show();
Toast.LENGTH_LONG).show();
}
}
}
}
/**
/**
* Dialog ui任务封装
* Dialog ui任务封装
*/
*/
class DialogUIRunnable extends Runnable {
class DialogUIRunnable extends Runnable {
callback
:UTSCallback|null
= null
callback
?: (content : string) => void
= null
title: string
title
: string
message: string
message
: string
placeholder: string
placeholder
: string
needInput
:
boolean
needInput
:
boolean
constructor(success
?:UTSCallback,title: string,message: string,placeholder: string,needInput:boolean)
{
constructor(success
?: (content : string) => void, title : string, message : string, placeholder : string, needInput : boolean)
{
super();
super();
if
(success != null)
{
if
(success != null)
{
this.callback = success
this.callback = success
}
}
this.title = title
this.title = title
this.message = message
this.message = message
this.placeholder = placeholder
this.placeholder = placeholder
this.needInput = needInput
this.needInput = needInput
}
}
override run():
void {
override run() :
void {
if
(this.needInput)
{
if
(this.needInput)
{
let et = new EditText(UTSAndroid.getUniActivity());
let et = new EditText(UTSAndroid.getUniActivity());
et.setText(this.placeholder);
et.setText(this.placeholder);
new AlertDialog.Builder(UTSAndroid.getUniActivity())
new AlertDialog.Builder(UTSAndroid.getUniActivity())
.setTitle(this.title)
.setTitle(this.title)
.setMessage(this.message)
.setMessage(this.message)
.setIcon(android.R.drawable.ic_dialog_info).setView(et)
.setIcon(android.R.drawable.ic_dialog_info).setView(et)
.setPositiveButton("确定", new DialogListener(et,
this.callback!))
.setPositiveButton("确定", new DialogListener(et,
this.callback!))
.setNegativeButton("取消", null).show();
.setNegativeButton("取消", null).show();
}
else
{
}
else
{
new AlertDialog.Builder(UTSAndroid.getUniActivity())
new AlertDialog.Builder(UTSAndroid.getUniActivity())
.setTitle(this.title)
.setTitle(this.title)
.setMessage(this.message)
.setMessage(this.message)
.setIcon(android.R.drawable.ic_dialog_info)
.setIcon(android.R.drawable.ic_dialog_info)
.setNegativeButton("取消", null).show();
.setNegativeButton("取消", null).show();
}
}
}
};
}
};
\ No newline at end of file
uni_modules/uts-helloworld/utssdk/index.uts
浏览文件 @
7568a738
...
@@ -15,7 +15,6 @@ type JsonParamOptions = {
...
@@ -15,7 +15,6 @@ type JsonParamOptions = {
complete: (res: string) => void;
complete: (res: string) => void;
};
};
/**
/**
* 导出无参的UTS函数
* 导出无参的UTS函数
* @param opts
* @param opts
...
...
uni_modules/uts-screenshot-listener/utssdk/app-android/index.uts
浏览文件 @
7568a738
...
@@ -4,6 +4,8 @@ import {
...
@@ -4,6 +4,8 @@ import {
UTSAndroid
UTSAndroid
} from "io.dcloud.uts";
} from "io.dcloud.uts";
import { OnUserCaptureScreen, OffUserCaptureScreen, UserCaptureScreenCallback, OnUserCaptureScreenResult } from "../interface.uts"
import ActivityCompat from "androidx.core.app.ActivityCompat";
import ActivityCompat from "androidx.core.app.ActivityCompat";
import Manifest from "android.Manifest";
import Manifest from "android.Manifest";
...
@@ -27,7 +29,7 @@ let lastFileObserverTime: number = 0;
...
@@ -27,7 +29,7 @@ let lastFileObserverTime: number = 0;
/**
/**
* 图片被捕获的实现
* 图片被捕获的实现
*/
*/
let imageChange: U
TS
Callback | null = null;
let imageChange: U
serCaptureScreen
Callback | null = null;
...
@@ -64,11 +66,13 @@ class ScreenFileObserver extends FileObserver {
...
@@ -64,11 +66,13 @@ class ScreenFileObserver extends FileObserver {
}
}
lastFileObserverTime = System.currentTimeMillis()
lastFileObserverTime = System.currentTimeMillis()
let ret = {
errCode:1,
const ret: OnUserCaptureScreenResult = {
errCode: 0,
errSubject: "uni-usercapturescreen",
errMsg: "onUserCaptureScreen:ok",
image:newPath
image:newPath
}
}
imageChange!(ret);
imageChange!(ret);
}
}
}
}
...
@@ -77,15 +81,11 @@ class ScreenFileObserver extends FileObserver {
...
@@ -77,15 +81,11 @@ class ScreenFileObserver extends FileObserver {
/**
/**
* 开启截图监听
* 开启截图监听
*/
*/
@Suppress("DEPRECATION")
@Suppress("DEPRECATION")
export function onUserCaptureScreen(callback:
(res:object) => void
) {
export function onUserCaptureScreen(callback:
UserCaptureScreenCallback
) {
// 检查相关权限是否已经具备
// 检查相关权限是否已经具备
if (ActivityCompat.checkSelfPermission(UTSAndroid.getUniActivity()!, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.checkSelfPermission(UTSAndroid.getUniActivity()!, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
...
@@ -93,8 +93,11 @@ export function onUserCaptureScreen(callback: (res:object) => void) {
...
@@ -93,8 +93,11 @@ export function onUserCaptureScreen(callback: (res:object) => void) {
ActivityCompat.requestPermissions(UTSAndroid.getUniActivity()!, arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE), 1001)
ActivityCompat.requestPermissions(UTSAndroid.getUniActivity()!, arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE), 1001)
// 因权限缺失导致监听失败
// 因权限缺失导致监听失败
let ret = {
const ret: OnUserCaptureScreenResult = {
errCode:-1
errCode: -1,
errSubject: "uni-usercapturescreen",
errMsg: "onUserCaptureScreen:fail",
image: null
}
}
callback(ret);
callback(ret);
return ;
return ;
...
@@ -121,8 +124,11 @@ export function onUserCaptureScreen(callback: (res:object) => void) {
...
@@ -121,8 +124,11 @@ export function onUserCaptureScreen(callback: (res:object) => void) {
screenOB!.startWatching()
screenOB!.startWatching()
// 监听成功
// 监听成功
let ret = {
const ret: OnUserCaptureScreenResult = {
errCode:0
errCode: 0,
errSubject: "uni-usercapturescreen",
errMsg: "onUserCaptureScreen:ok",
image: null
}
}
callback(ret);
callback(ret);
...
...
uni_modules/uts-screenshot-listener/utssdk/app-ios/index.uts
浏览文件 @
7568a738
...
@@ -26,7 +26,7 @@ class CaptureScreenTool {
...
@@ -26,7 +26,7 @@ class CaptureScreenTool {
errCode: 0,
errCode: 0,
errSubject: "uni-usercapturescreen",
errSubject: "uni-usercapturescreen",
errMsg: "onUserCaptureScreen:ok",
errMsg: "onUserCaptureScreen:ok",
path
: null
image
: null
}
}
this.listener?.(res)
this.listener?.(res)
}
}
...
@@ -39,7 +39,7 @@ class CaptureScreenTool {
...
@@ -39,7 +39,7 @@ class CaptureScreenTool {
errCode: 0,
errCode: 0,
errSubject: "uni-usercapturescreen",
errSubject: "uni-usercapturescreen",
errMsg: "offUserCaptureScreen:ok",
errMsg: "offUserCaptureScreen:ok",
path
: null
image
: null
}
}
callback?.(res)
callback?.(res)
}
}
...
...
uni_modules/uts-screenshot-listener/utssdk/interface.uts
浏览文件 @
7568a738
...
@@ -16,7 +16,7 @@ export type OnUserCaptureScreenResult = {
...
@@ -16,7 +16,7 @@ export type OnUserCaptureScreenResult = {
/**
/**
* 截屏文件路径(仅Android返回)
* 截屏文件路径(仅Android返回)
*/
*/
path
: string | null
image
: string | null
}
}
export type UserCaptureScreenCallback = (res: OnUserCaptureScreenResult) => void
export type UserCaptureScreenCallback = (res: OnUserCaptureScreenResult) => void
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录