Proyectos de Subversion Iphone Microlearning - Nuevo Interface

Rev

Rev 1 | Rev 9 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 8
Línea 23... Línea 23...
23
 
23
 
24
    func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
24
    func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
25
        return AppDelegate.orientationLock
25
        return AppDelegate.orientationLock
Línea 26... Línea -...
26
    }
-
 
27
    
-
 
28
    /*
-
 
29
    
-
 
30
    func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
-
 
31
        // Called when a new scene session is being created.
-
 
32
        // Use this method to select a configuration to create the new scene with.
-
 
33
        return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
-
 
34
    }
-
 
35
 
-
 
36
    func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
-
 
37
        // Called when the user discards a scene session.
-
 
38
        // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
-
 
39
        // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
-
 
40
    }
-
 
41
    
-
 
42
    */
26
    }
43
 
27
    
Línea 86... Línea 70...
86
 
70
 
Línea 87... Línea 71...
87
        return true;
71
        return true;
Línea 88... Línea -...
88
 
-
 
89
    }
-
 
90
    
72
 
91
    func handleAppRefreshTask(task: BGAppRefreshTask) {
-
 
92
        print("Handling task")
-
 
93
        
-
 
94
        let syncAdapter = SyncAdapter()
-
 
95
        syncAdapter.sync{ success in
-
 
96
            //self.inProgress = false;
-
 
97
        }
-
 
98
        scheduleBackgroundSyncExecute()
-
 
99
    }
-
 
100
      
-
 
101
    func scheduleBackgroundSyncExecute()
-
 
102
     {
-
 
103
        print("scheduleBackgroundSyncExecute")
-
 
104
        let syncTask = BGAppRefreshTaskRequest(identifier: Constants.IDENTIFIER_BACKGROUND_PROCESS)
-
 
105
        syncTask.earliestBeginDate = Date(timeIntervalSinceNow: 60)
-
 
106
        do {
-
 
107
          try BGTaskScheduler.shared.submit(syncTask)
-
 
108
          print("task scheduled")
-
 
109
        } catch {
-
 
Línea 110... Línea 73...
110
          print("Unable to submit task: \(error.localizedDescription)")
73
    }
111
        }
74
    
Línea 112... Línea 75...
112
      }
75
    
Línea 181... Línea 144...
181
 
144
 
182
    // With swizzling disabled you must let Messaging know about the message, for Analytics
145
    // With swizzling disabled you must let Messaging know about the message, for Analytics
Línea 183... Línea 146...
183
    // Messaging.messaging().appDidReceiveMessage(userInfo)
146
    // Messaging.messaging().appDidReceiveMessage(userInfo)
184
 
-
 
185
    // ...
-
 
186
 
147
 
-
 
148
    // ...
-
 
149
    print(userInfo)
-
 
150
    
-
 
151
    if let aps = userInfo["aps"] as? [String:Any] {
-
 
152
      //let badgeNumber = aps["badge"] as! Int
-
 
153
      //application.applicationIconBadgeNumber = badgeNumber
-
 
154
        
-
 
155
        //print("aps: \(aps)")
-
 
156
 
-
 
157
        
-
 
158
        //if let alert = aps["alert"]as? [String:Any] {
-
 
159
        
-
 
160
           // let title = alert["title"] ?  alert["title"]!  : ""
-
 
161
           // let body = alert["body"] ? alert["body"]! : ""
-
 
162
            
-
 
163
            //if !title.isEmpty  && !body.isEmpty {
-
 
164
            
-
 
165
            //    var userNotification = UserNotificationModel()
-
 
166
            //    userNotification.title = title
-
 
167
            //    userNotification.description = body
-
 
168
            //}
-
 
169
        //}
-
 
170
        //let title = aps["title"] as! String
-
 
171
        //let body = aps["body"] as! String
-
 
172
        
-
 
173
        // Print full message.
-
 
174
        //print("userInfo title: \(title)")
-
 
175
        //print("userInfo body: \(body)")
-
 
176
        
-
 
177
        if let new_capsules = userInfo["new_capsules"] as? Int {
-
 
178
              print("new_capsules : \(new_capsules)") // output: "some-value"
-
 
179
           }
-
 
180
    }
-
 
181
    
-
 
182
    /*
-
 
183
     message userNotificationCenter iOS 10
-
 
184
     [AnyHashable("aps"): {
-
 
185
         alert =     {
-
 
186
             body = "Cuerpo notificaci\U00f3n";
-
 
187
             subtitle = "Sub t\U00edtulo notificaci\U00f3n";
-
 
188
             title = "T\U00edtulo notificaci\U00f3n";
-
 
189
         };
-
 
190
     }]
-
 
191
     aps: ["alert": {
-
 
192
         body = "Cuerpo notificaci\U00f3n";
-
 
193
         subtitle = "Sub t\U00edtulo notificaci\U00f3n";
-
 
194
         title = "T\U00edtulo notificaci\U00f3n";
-
 
195
     }]
-
 
196
     */
-
 
197
    
Línea 187... Línea 198...
187
    // Print full message.
198
    
188
    print(userInfo)
199
 
189
 
200
 
Línea 203... Línea 214...
203
 
214
 
204
    // With swizzling disabled you must let Messaging know about the message, for Analytics
215
    // With swizzling disabled you must let Messaging know about the message, for Analytics
Línea 205... Línea 216...
205
    // Messaging.messaging().appDidReceiveMessage(userInfo)
216
    // Messaging.messaging().appDidReceiveMessage(userInfo)
206
 
217
 
Línea 207... Línea 218...
207
    // Print full message.
218
    // Print full message.
208
    print(userInfo)
219
    print("userInfo : \(userInfo)")
209
 
220