Skip to content

Commit

Permalink
Replace serverInfo from VPN to session model, due to go model changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jigar-f committed Oct 5, 2023
1 parent 7a90c8d commit 8b569c7
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -316,4 +316,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 0cfe0e959396ac6aad61f61d0b82005395de9d66

COCOAPODS: 1.12.1
COCOAPODS: 1.11.3
1 change: 1 addition & 0 deletions ios/Runner/Lantern/Models/SessionModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class SessionModel: BaseModel {
}
try super.init(flutterBinary, model)
getBandwidth()
startService()
}

func startService() {
Expand Down
11 changes: 11 additions & 0 deletions lib/common/session_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,17 @@ class SessionModel extends Model {
);
}


Widget serverInfo(ValueWidgetBuilder<ServerInfo> builder) {
return subscribedSingleValueBuilder<ServerInfo>(
'/server_info',
builder: builder,
deserialize: (Uint8List serialized) {
return ServerInfo.fromBuffer(serialized);
},
);
}

Future<String> requestLinkCode() {
return methodChannel
.invokeMethod('requestLinkCode')
Expand Down
20 changes: 11 additions & 9 deletions lib/vpn/vpn_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@ class VpnModel extends Model {
return vpnStatus == 'connected';
}

Widget serverInfo(ValueWidgetBuilder<ServerInfo> builder) {
return subscribedSingleValueBuilder<ServerInfo>(
'/server_info',
builder: builder,
deserialize: (Uint8List serialized) {
return ServerInfo.fromBuffer(serialized);
},
);
}
//This method has moved to Session model
// Due to go model changes
// Widget serverInfo(ValueWidgetBuilder<ServerInfo> builder) {
// return subscribedSingleValueBuilder<ServerInfo>(
// '/server_info',
// builder: builder,
// deserialize: (Uint8List serialized) {
// return ServerInfo.fromBuffer(serialized);
// },
// );
// }

Widget bandwidth(ValueWidgetBuilder<Bandwidth> builder) {
return subscribedSingleValueBuilder<Bandwidth>(
Expand Down
2 changes: 1 addition & 1 deletion lib/vpn/vpn_server_location.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ServerLocationWidget extends StatelessWidget {
const Spacer(),
vpnModel.vpnStatus(
(BuildContext context, String vpnStatus, Widget? child) {
return vpnModel.serverInfo(
return sessionModel.serverInfo(
(BuildContext context, ServerInfo serverInfo, Widget? child) {
if (vpnStatus == 'connected' || vpnStatus == 'disconnecting') {
return Row(
Expand Down

0 comments on commit 8b569c7

Please sign in to comment.