Skip to content

Maintenance: clean up dead code #1055

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: fix/export_user_state
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions lib/src/defines.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
// Determines how notifications should be displayed
enum OSNotificationDisplayType { none, alert, notification }

/// Indicates whether a user tapped a notification (`opened`)
/// or took a specific action by tapping a button (`actionTaken`)
enum OSNotificationActionType { opened, actionTaken }

enum OSNotificationPermission {
notDetermined,
denied,
Expand All @@ -17,24 +10,3 @@ enum OSNotificationPermission {
/// use with the OneSignal SDK, going from the least verbose (none)
/// to verbose (print all comments).
enum OSLogLevel { none, fatal, error, warn, info, debug, verbose }

/// Various iOS Settings that can be passed during initialization
enum OSiOSSettings {
autoPrompt,
inAppAlerts,
inAppLaunchUrl,
promptBeforeOpeningPushUrl,
inFocusDisplayOption
}

enum OSSession { DIRECT, INDIRECT, UNATTRIBUTED, DISABLED }

/// Applies to iOS notifications only
/// Determines if the badgeCount is used to increment
/// the existing badge count, or sets the badge count directly
enum OSCreateNotificationBadgeType { increase, setTo }

/// control how the notification is delayed
/// timezone: Deliver at a specific time of day in each user's timezone
/// last-active: Deliver at the same time the user last used your app
enum OSCreateNotificationDelayOption { timezone, lastActive }
14 changes: 0 additions & 14 deletions lib/src/permission.dart

This file was deleted.

74 changes: 0 additions & 74 deletions lib/src/utils.dart
Original file line number Diff line number Diff line change
@@ -1,79 +1,5 @@
import 'package:onesignal_flutter/src/defines.dart';
import 'dart:convert';

// produces a string like this: 2018-07-23T17:56:30.951030 UTC-7:00
String dateToStringWithOffset(DateTime date) {
var offsetHours = date.timeZoneOffset.inHours;
var offsetMinutes = date.timeZoneOffset.inMinutes % 60;
var dateString = "${date.toIso8601String()} ";

dateString += "UTC" +
((offsetHours > 10 || offsetHours < 0)
? "$offsetHours"
: "0$offsetHours");
dateString += ":" +
((offsetMinutes.abs() > 10) ? "$offsetMinutes" : "0$offsetMinutes:00");

return dateString;
}

// in some places, we want to send an enum value to
// ObjC. Before we can do this, we must convert it
// to a string/int/etc.
// However, in some places such as iOS init settings,
// there could be multiple different types of enum,
// so we've combined it into this one function.
dynamic convertEnumCaseToValue(dynamic key) {
switch (key) {
case OSiOSSettings.autoPrompt:
return "kOSSettingsKeyAutoPrompt";
case OSiOSSettings.inAppAlerts:
return "kOSSettingsKeyInAppAlerts";
case OSiOSSettings.inAppLaunchUrl:
return "kOSSettingsKeyInAppLaunchURL";
case OSiOSSettings.inFocusDisplayOption:
return "kOSSettingsKeyInFocusDisplayOption";
case OSiOSSettings.promptBeforeOpeningPushUrl:
return "kOSSSettingsKeyPromptBeforeOpeningPushURL";
}

switch (key) {
case OSCreateNotificationBadgeType.increase:
return "Increase";
case OSCreateNotificationBadgeType.setTo:
return "SetTo";
}

switch (key) {
case OSCreateNotificationDelayOption.lastActive:
return "last_active";
case OSCreateNotificationDelayOption.timezone:
return "timezone";
}

switch (key) {
case OSNotificationDisplayType.none:
return 0;
case OSNotificationDisplayType.alert:
return 1;
case OSNotificationDisplayType.notification:
return 2;
}

switch (key) {
case OSSession.DIRECT:
return "DIRECT";
case OSSession.INDIRECT:
return "INDIRECT";
case OSSession.UNATTRIBUTED:
return "UNATTRIBUTED";
case OSSession.DISABLED:
return "DISABLED";
}

return key;
}

/// An abstract class to provide JSON decoding
abstract class JSONStringRepresentable {
String jsonRepresentation();
Expand Down
7 changes: 0 additions & 7 deletions test/mock_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ class OneSignalState {
bool? consentGiven = false;
bool? calledPromptPermission;
bool? locationShared;
OSNotificationDisplayType? inFocusDisplayType;
bool? disablePush;
String? externalId;
String? language;
Expand Down Expand Up @@ -137,12 +136,6 @@ class OneSignalState {
this.latestLogStatement = params['message'];
}

void setDisplayType(Map<dynamic, dynamic> params) {
var type = params['displayType'] as int?;
if (type != null)
this.inFocusDisplayType = OSNotificationDisplayType.values[type];
}

void setEmail(Map<dynamic, dynamic> params) {
this.email = params['email'] as String?;
this.emailAuthHashToken = params['emailAuthHashToken'] as String?;
Expand Down
Loading