void NotificationModuleGUI() { DrawModuleHeader(); // Now draw the GUI. if (!isNotificationModuleEnable.boolValue) { return; } DrawAndroidPermissionsRequiredSection(Module.Notifications); EditorGUILayout.Space(); DrawIOSInfoPlistItemsRequiredSection(Module.Notifications); // Remote notification setup EditorGUILayout.Space(); DrawUppercaseSection("REMOTE_NOTIFICATION_SETUP_FOLDOUT_KEY", "REMOTE NOTIFICATIONS", () => { // Push Notification Service EditorGUILayout.LabelField("Remote Notification Service", EditorStyles.boldLabel); EditorGUILayout.PropertyField(NotificationProperties.pushNotificationService.property, NotificationProperties.pushNotificationService.content); // If using OneSignal... if (NotificationProperties.pushNotificationService.property.enumValueIndex == (int)PushNotificationProvider.OneSignal) { #if !EM_ONESIGNAL EditorGUILayout.Space(); EditorGUILayout.HelpBox(OneSignalImportInstruction, MessageType.Error); if (GUILayout.Button("Download OneSignal Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadOneSignalPlugin(); } #else EditorGUILayout.Space(); EditorGUILayout.HelpBox(OneSignalAvailMsg, MessageType.Info); if (GUILayout.Button("Download OneSignal Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadOneSignalPlugin(); } // OneSignal setup EditorGUILayout.Space(); EditorGUILayout.LabelField("OneSignal Setup", EditorStyles.boldLabel); NotificationProperties.oneSignalAppId.property.stringValue = EditorGUILayout.TextField(NotificationProperties.oneSignalAppId.content, NotificationProperties.oneSignalAppId.property.stringValue); #endif } if (NotificationProperties.pushNotificationService.property.enumValueIndex == (int)PushNotificationProvider.Firebase) { #if !EM_FIR_MESSAGING EditorGUILayout.Space(); EditorGUILayout.HelpBox(FirebaseImportInstruction, MessageType.Error); if (GUILayout.Button("Download Firebase Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadFirebasePlugin(); } #else EditorGUILayout.Space(); EditorGUILayout.HelpBox(FirebaseAvailMsg, MessageType.Info); if (GUILayout.Button("Download Firebase Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadFirebasePlugin(); } /// Firebase setup EditorGUILayout.Space(); EditorGUILayout.LabelField("Firebase Setup", EditorStyles.boldLabel); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Default Firebase Topics"); /// Draw plus and minus button. GUIContent plusContent = EditorGUIUtility.IconContent("Toolbar Plus"); GUIContent minusContent = EditorGUIUtility.IconContent("Toolbar Minus"); GUIStyle buttonStyle = new GUIStyle(GUIStyle.none) { fixedHeight = EM_GUIStyleManager.smallButtonHeight, fixedWidth = EM_GUIStyleManager.smallButtonWidth }; if (GUILayout.Button(plusContent, buttonStyle)) { var p = NotificationProperties.firebaseTopics.property; p.arraySize++; p.GetArrayElementAtIndex(p.arraySize - 1).stringValue = string.Empty; } bool canDelete = NotificationProperties.firebaseTopics.property.arraySize > 0; EditorGUI.BeginDisabledGroup(!canDelete); if (GUILayout.Button(minusContent, buttonStyle)) { NotificationProperties.firebaseTopics.property.arraySize--; } EditorGUI.EndDisabledGroup(); EditorGUILayout.EndHorizontal(); /// Draw all available topics. EditorGUI.indentLevel++; for (int i = 0; i < NotificationProperties.firebaseTopics.property.arraySize; i++) { EditorGUILayout.PropertyField(NotificationProperties.firebaseTopics.property.GetArrayElementAtIndex(i)); } EditorGUI.indentLevel--; #endif } }); // Initialization setup EditorGUILayout.Space(); DrawUppercaseSection("PRIVACY_AUTO_INIT_CONFIG_FOLDOUT_KEY", "AUTO INITIALIZATION", () => { NotificationProperties.autoInit.property.boolValue = EditorGUILayout.Toggle(NotificationProperties.autoInit.content, NotificationProperties.autoInit.property.boolValue); // Auto init delay EditorGUI.BeginDisabledGroup(!NotificationProperties.autoInit.property.boolValue); EditorGUILayout.PropertyField(NotificationProperties.autoInitDelay.property, NotificationProperties.autoInitDelay.content); EditorGUI.EndDisabledGroup(); // Init tip if (!NotificationProperties.autoInit.property.boolValue) { EditorGUILayout.HelpBox(NotificationManualInitInstruction, MessageType.Info); } //-------------------------------------------------------------- // Uncomment to expose the iOSAuthOptions setting. //-------------------------------------------------------------- /* * // iOS authorization options * EditorGUILayout.PropertyField(NotificationProperties.iosAuthOptions.property, NotificationProperties.iosAuthOptions.content); */ }); // Android Resources Setup EditorGUILayout.Space(); DrawUppercaseSection("ANDROID_NOTIFICATION_RESOURCES_FOLDOUT_KEY", "ANDROID NOTIFICATION RESOURCES", () => { EditorGUILayout.HelpBox(NotificationAndroidResourcesIntro, MessageType.None); if (GUILayout.Button("Open Android Notification Icon Generator", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { Application.OpenURL(NotificationAndroidIconGeneratorUrl); } if (GUILayout.Button("Import Res Folder", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EditorApplication.delayCall += ImportAndroidNotificationResFolder; } }); // Category groups EditorGUILayout.Space(); DrawUppercaseSection("CATEGORY_GROUP_FOLDOUT_KEY", "CATEGORY GROUP", () => { DrawNotificationCategoryGroupsArray(NotificationProperties.categoryGroups, ref notificationIsCategoryGroupsFoldout); // Update the list of category group IDs. notificationCatGroupIDs = BuildListOfNotificationCategoryGroupIDs(); }); // Categories EditorGUILayout.Space(); DrawUppercaseSection("CATEGORIES_FOLDOUT_KEY", "CATEGORIES", () => { EditorGUILayout.HelpBox(NotificationCategoryIntro, MessageType.Info); // Draw the default category EditorGUILayout.LabelField("Default Category", EditorStyles.boldLabel); EditorGUILayout.HelpBox(NotificationDefaultCategoryIntro, MessageType.None); DrawNotificationCategory(NotificationProperties.defaultCategory.property); if (string.IsNullOrEmpty(EM_Settings.Notifications.DefaultCategory.name) || string.IsNullOrEmpty(EM_Settings.Notifications.DefaultCategory.id)) { EditorGUILayout.HelpBox("Default category must have non-empty name and ID.", MessageType.Warning); } else { foreach (var category in EM_Settings.Notifications.UserCategories) { if (!string.IsNullOrEmpty(category.id) && category.id.Equals(EM_Settings.Notifications.DefaultCategory.id)) { EditorGUILayout.HelpBox("Default category cannot share the same ID " + category.id + " with another user category.", MessageType.Warning); break; } } } // Draw user categories EditorGUILayout.LabelField("User Categories", EditorStyles.boldLabel); DrawNotificationCategoriesArray(NotificationProperties.userCategories, ref notificationIsUserCategoriesFoldout); }); // Constant generation. EditorGUILayout.Space(); DrawUppercaseSection("NOTIFICATIONS_CONSTANTS_GENERATION_FOLDOUT_KEY", "CONTANTS GENERATION", () => { EditorGUILayout.HelpBox(NotificationConstantGenerationIntro, MessageType.None); if (GUILayout.Button("Generate Constants Class", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { GenerateNotificationConstants(); } }); }