--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using Tizen.Network.WiFi;
+
+namespace Oobe.Common.Services
+{
+ /// <summary>
+ /// Wifi feature checking service.
+ /// </summary>
+ public static class WifiAvailabilityCheckService
+ {
+ /// <summary>
+ /// Checks the availability of the Wifi Service.
+ /// </summary>
+ /// <returns>Availability of Wifi Service or null in case of error.</returns>
+ public static bool? IsWifiFeatureAvailable()
+ {
+ try
+ {
+ _ = WiFiManager.IsActive;
+ return true;
+ }
+ catch (NotSupportedException e)
+ {
+ if (e.Message == "Unsupported feature http://tizen.org/feature/network.wifi")
+ {
+ Tizen.Log.Debug("oobe", $"Expected not supported error: {e.Message}");
+ return false;
+ }
+ else
+ {
+ Tizen.Log.Error("oobe", $"Unexpected error: {e}");
+ return null;
+ }
+ }
+ catch (Exception e)
+ {
+ Tizen.Log.Error("oobe", $"Unexpected error: {e}");
+ return null;
+ }
+ }
+ }
+}
using System.Collections.Generic;
using System.IO;
using Oobe.Common.Interfaces;
+using Oobe.Common.Services;
using Oobe.Language;
using Oobe.Region;
using Oobe.Terms;
private ProcessManager()
{
// TODO consider loading this from xaml or xml
- steps = new LinkedList<Lazy<ProcessStep>>(new[]
- {
- new Lazy<ProcessStep>(() => new LanguageStep()),
- new Lazy<ProcessStep>(() => new RegionStep()),
- new Lazy<ProcessStep>(() => new TermsStep()),
- new Lazy<ProcessStep>(() => new WifiStep()),
- new Lazy<ProcessStep>(() => new WelcomeStep()),
- });
+ steps = new LinkedList<Lazy<ProcessStep>>();
+ steps.AddLast(new Lazy<ProcessStep>(() => new LanguageStep()));
+ steps.AddLast(new Lazy<ProcessStep>(() => new RegionStep()));
+ steps.AddLast(new Lazy<ProcessStep>(() => new TermsStep()));
+
+ if (WifiAvailabilityCheckService.IsWifiFeatureAvailable() ?? false)
+ {
+ steps.AddLast(new Lazy<ProcessStep>(() => new WifiStep()));
+ }
+
+ steps.AddLast(new Lazy<ProcessStep>(() => new WelcomeStep()));
}
public static ProcessManager Instance