Skip to content

Commit

Permalink
[spalenque] - #12942 * revamp and refactor of track chairs app
Browse files Browse the repository at this point in the history
fix concurrency bug and tune up drag and drop

12948 - add moved flag on browse page

12949 - send email con change request and add rejection reason

remove lightning and tune up concurrency

fix concurrency bug and tune up drag and drop

12958 - add rate to speakers and link to bureau

fix bugs 1

fix bug on drag from team to other list

13045 - resolve category change bug fix

13056 - fix change request persisting

13045 - fix bug on approve change request

13061 - start wip

13061 - track chair push notification backend

firebase wip

firebase push notification wip

wip

13061 - adding push notific wip

13061 - done adding push notif

13061 - bug fix

bug fixxx

remove server key from template

[smarcet] - #13061 (OpenStackweb#88)

* proposed refactoring to push notifications
  • Loading branch information
santipalenque committed Jul 12, 2017
1 parent 10a9f7d commit 937a35e
Show file tree
Hide file tree
Showing 65 changed files with 1,770 additions and 736 deletions.
2 changes: 1 addition & 1 deletion cron_jobs_scheduler/_config/schedule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
cron_expression: "*/5 * * * *" # run every 5 minutes
enabled: 1

- name: "SummitPushNotificationSenderTask"
- name: "PushNotificationSenderTask"
cron_expression: "* * * * *" # run every minute
enabled: 1

Expand Down
3 changes: 2 additions & 1 deletion favicon/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
}
],
"theme_color": "#ffffff",
"display": "standalone"
"display": "standalone",
"gcm_sender_id": "103953800507" //Some browsers will use this to enable push notifications
}
4 changes: 4 additions & 0 deletions openstack/code/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -582,4 +582,8 @@ public function MetaTags()
public function showUpdateProfileModal(){
return (Member::currentUser() && Session::get("Member.showUpdateProfileModal"));
}

public function getEnv($name) {
return constant($name);
}
}
15 changes: 15 additions & 0 deletions push_notifications/_config/injector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
Name: 'push-notification-injection'
---
Injector:
FirebaseSerializationSummitFactory:
class: FireBaseSerializationTrackChairPushNotificationFactory
FirebaseSerializationTrackChairFactory:
class: FireBaseSerializationSummitPushNotificationFactory
FireBasePushNotificationSerializationStrategyFactory:
constructor:
- '%$FirebaseSerializationSummitFactory'
- '%$FirebaseSerializationTrackChairFactory'
PushNotificationSenderTask:
constructor:
0: '%$FireBasePushNotificationSerializationStrategyFactory'
7 changes: 7 additions & 0 deletions push_notifications/_config/routes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
Name: pushnotificationroutes
After: 'framework/routes#coreroutes'
---
Director:
rules:
'api/v1/push_notifications': 'PushNotificationAPI'
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
class PushNotificationMessage extends DataObject implements IEntity
class PushNotificationMessage extends DataObject implements IPushNotificationMessage
{
use CustomDataObject;

Expand All @@ -23,6 +23,7 @@ class PushNotificationMessage extends DataObject implements IEntity
'IsSent' => 'Boolean',
'SentDate' => 'SS_Datetime',
'Priority' => "Enum('NORMAL, HIGH', 'NORMAL')",
'Platform' => "Enum('MOBILE, WEB','MOBILE')"
);

private static $has_one = array
Expand Down Expand Up @@ -51,6 +52,9 @@ public function approve(){
$this->ApprovedByID = Member::currentUserID();
}

/**
* @return boolean
*/
public function isAlreadySent(){
return $this->IsSent;
}
Expand All @@ -77,4 +81,29 @@ public function getTimestamp(){

return $date->getTimestamp();
}

const PushType = 'PUSH_NOTIFICATION';

/**
* @return string
*/
public function getType(){
return self::PushType;
}

/**
* @return string
*/
public function getPlatform()
{
return $this->getField('Platform');
}

/**
* @return string
*/
public function getPriority()
{
return $this->getField('Priority');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

/**
* Copyright 2017 OpenStack Foundation
* 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.
**/
final class FireBasePushNotificationSerializationStrategyFactory implements IFireBasePushNotificationSerializationStrategyFactory
{

/**
* @var IFireBasePushNotificationSerializationStrategyFactory
*/
private $factories;
/**
* FireBasePushNotificationSerializationStrategyFactory constructor.
*/
public function __construct()
{
// this is done in this way bc framework/control/injector/InjectionCreator.php
// does not support pass array as constructor param
$this->factories = func_get_args();
}

/**
* @param IPushNotificationMessage $message
* @return IFireBasePushNotificationSerializationStrategy;
*/
function build(IPushNotificationMessage $message)
{
$strategy = null;
foreach($this->factories as $factory){
$strategy = $factory->build($message);
if(!is_null($strategy)) break;
}
return $strategy;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/**
* Copyright 2017 OpenStack Foundation
* 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.
**/
interface IFireBasePushNotificationSerializationStrategyFactory
{
/**
* @param IPushNotificationMessage $message
* @return IFireBasePushNotificationSerializationStrategy;
*/
function build(IPushNotificationMessage $message);
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Copyright 2015 OpenStack Foundation
* Copyright 2017 OpenStack Foundation
* 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
Expand All @@ -12,10 +12,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
final class SapphireSummitPushNotificationRepository extends SapphireRepository
final class SapphirePushNotificationRepository extends SapphireRepository
{
public function __construct()
{
parent::__construct(new SummitPushNotification());
parent::__construct(new PushNotificationMessage());
}
}
Loading

0 comments on commit 937a35e

Please sign in to comment.