enableChannelPushNotification static method
Implementation
static Future<TPChannel?> enableChannelPushNotification(
TPChannel tpChannel,
{
Function(int? errorCode, String? errorMessage)? errorCallback
}) async
{
if (!_isInitialized(errorCallback: errorCallback)) { return null; }
if (!_checkAuthInfo(errorCallback: errorCallback)) { return null; }
try {
Map<String, dynamic> body = Map.from({});
String url = "/channels/${tpChannel.getChannelId()}/push/enable";
Map<String, dynamic> response = await HttpUtil.postJson(url, body);
Map<String, dynamic> channelMap = response["channel"];
return TPChannel(channelMap);
} on TPException catch(e) {
Logger.log("$e");
if(errorCallback != null) { errorCallback(e.getCode(), e.getMessage()); }
} catch(e){
Logger.log("$e");
if(errorCallback != null) { errorCallback(-1, e.toString()); }
}
return null;
}