Skip to content

Commit b0e16a0

Browse files
committed
Exposed ChangeVisibility in native interface
(resolving merge error) Fix instructions for installing protobuf-compiler On Debian/Ubuntu need to sudo apt-get commands. Updated grpc/proto to expose ChangeVisibility
1 parent 568280b commit b0e16a0

File tree

9 files changed

+354
-419
lines changed

9 files changed

+354
-419
lines changed

internal/native/empty.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,6 @@ func (e *EmptyNativeInterface) SwitchToScreenIf(screenName string, shouldSwitch
108108

109109
func (e *EmptyNativeInterface) SwitchToScreenIfDifferent(screenName string) {}
110110

111+
func (e *EmptyNativeInterface) ChangeVisibility(objName string, show bool) {}
112+
111113
func (e *EmptyNativeInterface) DoNotUseThisIsForCrashTestingOnly() {}

internal/native/grpc_clientmethods.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@ func (c *GRPCClient) SwitchToScreenIfDifferent(screenName string) {
207207
_, _ = c.client.SwitchToScreenIfDifferent(context.Background(), &pb.SwitchToScreenIfDifferentRequest{ScreenName: screenName})
208208
}
209209

210+
func (c *GRPCClient) ChangeVisibility(objName string, show bool) {
211+
_, _ = c.client.ChangeVisibility(context.Background(), &pb.ChangeVisibilityRequest{ObjName: objName, Show: show})
212+
}
213+
210214
func (c *GRPCClient) DoNotUseThisIsForCrashTestingOnly() {
211215
_, _ = c.client.DoNotUseThisIsForCrashTestingOnly(context.Background(), &pb.Empty{})
212216
}

internal/native/grpc_servermethods.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,11 @@ func (s *grpcServer) SwitchToScreenIfDifferent(ctx context.Context, req *pb.Swit
224224
return &pb.Empty{}, nil
225225
}
226226

227+
func (s *grpcServer) ChangeVisibility(ctx context.Context, req *pb.ChangeVisibilityRequest) (*pb.Empty, error) {
228+
s.native.ChangeVisibility(req.ObjName, req.Show)
229+
return &pb.Empty{}, nil
230+
}
231+
227232
func (s *grpcServer) DoNotUseThisIsForCrashTestingOnly(ctx context.Context, req *pb.Empty) (*pb.Empty, error) {
228233
s.native.DoNotUseThisIsForCrashTestingOnly()
229234
return &pb.Empty{}, nil

internal/native/interface.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ type NativeInterface interface {
3030
DisplaySetRotation(rotation uint16) (bool, error)
3131
UpdateLabelIfChanged(objName string, newText string)
3232
UpdateLabelAndChangeVisibility(objName string, newText string)
33+
ChangeVisibility(objName string, show bool)
3334
SwitchToScreenIf(screenName string, shouldSwitch []string)
3435
SwitchToScreenIfDifferent(screenName string)
3536
DoNotUseThisIsForCrashTestingOnly()

internal/native/proto/native.pb.go

Lines changed: 259 additions & 377 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/native/proto/native.proto

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ service NativeService {
4141
rpc UpdateLabelAndChangeVisibility(UpdateLabelAndChangeVisibilityRequest) returns (Empty);
4242
rpc SwitchToScreenIf(SwitchToScreenIfRequest) returns (Empty);
4343
rpc SwitchToScreenIfDifferent(SwitchToScreenIfDifferentRequest) returns (Empty);
44+
rpc ChangeVisibility(ChangeVisibilityRequest) returns (Empty);
4445

4546
// Testing
4647
rpc DoNotUseThisIsForCrashTestingOnly(Empty) returns (Empty);
@@ -256,3 +257,7 @@ message VideoFrame {
256257
int64 duration_ns = 2;
257258
}
258259

260+
message ChangeVisibilityRequest {
261+
string obj_name = 1;
262+
bool show = 2;
263+
}

internal/native/proto/native_grpc.pb.go

Lines changed: 70 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/native/proxy.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,13 @@ func (p *NativeProxy) SwitchToScreenIfDifferent(screenName string) {
679679
})
680680
}
681681

682+
func (p *NativeProxy) ChangeVisibility(objName string, show bool) {
683+
_ = nativeProxyClientExecWithoutArgument(p, func(client *GRPCClient) error {
684+
client.ChangeVisibility(objName, show)
685+
return nil
686+
})
687+
}
688+
682689
func (p *NativeProxy) DoNotUseThisIsForCrashTestingOnly() {
683690
_ = nativeProxyClientExecWithoutArgument(p, func(client *GRPCClient) error {
684691
client.DoNotUseThisIsForCrashTestingOnly()

scripts/generate_proto.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ cd "$PROJECT_ROOT"
1212
if ! command -v protoc &> /dev/null; then
1313
echo "Error: protoc is not installed"
1414
echo "Install it with:"
15-
echo " apt-get install protobuf-compiler # Debian/Ubuntu"
15+
echo " sudo apt-get install protobuf-compiler # Debian/Ubuntu"
1616
echo " brew install protobuf # macOS"
1717
exit 1
1818
fi

0 commit comments

Comments
 (0)