为了上传媒体,我的客户端将向服务器发送请求:
message GetMediaUploadCredRequest {
media.MediaType.Enum media_type = 1;
media.Extension.Enum extension = 2;
string file_name = 3;
bool is_private = 4;
string uploaded_by = 5;
}
Run Code Online (Sandbox Code Playgroud)
服务器将生成 SAS 令牌(如presigned_url
来自 AWS 的令牌)并将http_header
其发送回客户端。
message GetMediaUploadCredResponse {
string upload_credential_url = 1;
map<string, string> https_headers = 2;
string media_id = 3;
}
Run Code Online (Sandbox Code Playgroud)
然后,客户端将向 URL 发出 PUT 请求,https_headers
上传过程将完成。
这是实现:
public class StorexServiceImpl extends StorexServiceGrpc.StorexServiceImplBase {
private static final Logger log = LoggerFactory.getLogger(StorexServiceImpl.class);
private static final String STORAGE_ACCOUNT_CONNECTION_STRING = "<connection-string>";
private …
Run Code Online (Sandbox Code Playgroud) 我将所有原始文件保存在一个文件夹中。概述:
protos
|
|__auth
|
|__some_other
Run Code Online (Sandbox Code Playgroud)
里面的auth
目录我有auth_service.proto
user.proto
等。
但我在导入定义表单时遇到问题user.proto
在auth_service.proto
:
syntax="proto3";
package auth;
import "auth/user.proto"; // Import "auth/user.proto" was not found or had errors.
message SomeMessage {
User user = 1; // user is not defined
}
Run Code Online (Sandbox Code Playgroud)
user.proto 具有相同的包名:
syntax="proto3";
package auth;
message User{}
Run Code Online (Sandbox Code Playgroud)
协议版本:libprotoc : 3.19.4
我有一个带有回调函数的增量按钮:
class IncrementButton extends StatelessWidget {
final VoidCallback callback;
const IncrementButton({
Key? key,
required this.callback,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
callback();
},
onLongPressStart: ((details) {
callback();
}),
......
);
}
}
Run Code Online (Sandbox Code Playgroud)
并将其用作:
IncrementButton(
callback: _increment,
),
Run Code Online (Sandbox Code Playgroud)
_increment函数如下:
_increment() {
value += 1;
}
Run Code Online (Sandbox Code Playgroud)
我想要的是当用户点击一次时,将调用 _increment 函数。但是当用户长按按钮时,应该调用相同的增量函数。但这并没有发生。长按该_increment
方法仅被调用一次